Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assistant/src/daemon/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,8 @@ export async function runDaemon(): Promise<void> {
guardianFollowUpConversationGenerator:
createGuardianFollowUpConversationGenerator(),
sendMessageDeps: {
getOrCreateConversation: (conversationId) =>
server.getConversationForMessages(conversationId),
getOrCreateConversation: (conversationId, options) =>
server.getConversationForMessages(conversationId, options),
assistantEventHub,
resolveAttachments: (attachmentIds) => {
const resolved = attachmentsStore.getAttachmentsByIds(attachmentIds, {
Expand Down
3 changes: 2 additions & 1 deletion assistant/src/daemon/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1448,8 +1448,9 @@ export class DaemonServer {
*/
async getConversationForMessages(
conversationId: string,
options?: ConversationCreateOptions,
): Promise<Conversation> {
return this.getOrCreateConversation(conversationId);
return this.getOrCreateConversation(conversationId, options);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion assistant/src/runtime/http-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { ChannelId, InterfaceId } from "../channels/types.js";
import type { CesClient } from "../credential-execution/client.js";
import type { Conversation } from "../daemon/conversation.js";
import type { TrustContext } from "../daemon/conversation-runtime-assembly.js";
import type { ConversationCreateOptions } from "../daemon/handlers/shared.js";
import type { SkillOperationContext } from "../daemon/handlers/skills.js";
import type { ServerMessage } from "../daemon/message-protocol.js";
import type {
Expand Down Expand Up @@ -150,7 +151,10 @@ export type MessageProcessor = (
* Hub publishing wires outbound events to the SSE stream.
*/
export interface SendMessageDeps {
getOrCreateConversation: (conversationId: string) => Promise<Conversation>;
getOrCreateConversation: (
conversationId: string,
options?: ConversationCreateOptions,
) => Promise<Conversation>;
assistantEventHub: AssistantEventHub;
resolveAttachments: (attachmentIds: string[]) => Array<{
id: string;
Expand Down
23 changes: 23 additions & 0 deletions assistant/src/runtime/routes/conversation-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ import { HostBashProxy } from "../../daemon/host-bash-proxy.js";
import { HostCuProxy } from "../../daemon/host-cu-proxy.js";
import { HostFileProxy } from "../../daemon/host-file-proxy.js";
import type { ServerMessage } from "../../daemon/message-protocol.js";
import type {
MacosTransportMetadata,
NonMacosTransportMetadata,
} from "../../daemon/message-types/conversations.js";
import type { HeartbeatService } from "../../heartbeat/heartbeat-service.js";
import * as attachmentsStore from "../../memory/attachments-store.js";
import {
Expand Down Expand Up @@ -942,6 +946,8 @@ export async function handleSendMessage(
conversationType?: string;
automated?: boolean;
bypassSecretCheck?: boolean;
hostHomeDir?: string;
hostUsername?: string;
};

const { conversationKey, content, attachmentIds } = body;
Expand Down Expand Up @@ -1045,8 +1051,25 @@ export async function handleSendMessage(
conversationType,
});
const smDeps = deps.sendMessageDeps;

// Build transport metadata from the request so the daemon can inject
// host environment hints (home directory, username) into the LLM context.
const transport =
sourceInterface === "macos"
? ({
channelId: sourceChannel,
interfaceId: "macos" as const,
hostHomeDir: body.hostHomeDir,
hostUsername: body.hostUsername,
} satisfies MacosTransportMetadata)
: ({
channelId: sourceChannel,
interfaceId: sourceInterface,
} satisfies NonMacosTransportMetadata);

const conversation = await smDeps.getOrCreateConversation(
mapping.conversationId,
{ transport },
);

// Resolve guardian context from the AuthContext's actorPrincipalId.
Expand Down
Loading
Loading