@geminixiang/mikan 1.0.0-beta.62 → 1.0.0-beta.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +13 -13
- package/dist/adapters/commands/sandbox.d.ts.map +1 -1
- package/dist/adapters/commands/sandbox.js +30 -53
- package/dist/adapters/commands/sandbox.js.map +1 -1
- package/dist/adapters/commands/types.d.ts +3 -3
- package/dist/adapters/commands/types.d.ts.map +1 -1
- package/dist/adapters/commands/types.js.map +1 -1
- package/dist/adapters/slack/bot.d.ts +8 -0
- package/dist/adapters/slack/bot.d.ts.map +1 -1
- package/dist/adapters/slack/bot.js +32 -2
- package/dist/adapters/slack/bot.js.map +1 -1
- package/dist/adapters/web/admin/portal.d.ts.map +1 -1
- package/dist/adapters/web/admin/portal.js +26 -121
- package/dist/adapters/web/admin/portal.js.map +1 -1
- package/dist/cli/boot.js +1 -1
- package/dist/cli/boot.js.map +1 -1
- package/dist/cli/office.d.ts.map +1 -1
- package/dist/cli/office.js +33 -1
- package/dist/cli/office.js.map +1 -1
- package/dist/config.d.ts +26 -11
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +103 -61
- package/dist/config.js.map +1 -1
- package/dist/harness/execution-resolver.d.ts.map +1 -1
- package/dist/harness/execution-resolver.js +1 -1
- package/dist/harness/execution-resolver.js.map +1 -1
- package/dist/harness/prompt.d.ts.map +1 -1
- package/dist/harness/prompt.js +17 -21
- package/dist/harness/prompt.js.map +1 -1
- package/dist/harness/runner.d.ts.map +1 -1
- package/dist/harness/runner.js +2 -2
- package/dist/harness/runner.js.map +1 -1
- package/dist/office/projection.d.ts +19 -2
- package/dist/office/projection.d.ts.map +1 -1
- package/dist/office/projection.js +67 -99
- package/dist/office/projection.js.map +1 -1
- package/dist/office/types.d.ts +7 -8
- package/dist/office/types.d.ts.map +1 -1
- package/dist/office/types.js.map +1 -1
- package/dist/sandbox/index.d.ts +9 -1
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/index.js +16 -12
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/provisioner.d.ts +8 -0
- package/dist/sandbox/provisioner.d.ts.map +1 -1
- package/dist/sandbox/provisioner.js +36 -0
- package/dist/sandbox/provisioner.js.map +1 -1
- package/dist/settings-mutation.d.ts +5 -29
- package/dist/settings-mutation.d.ts.map +1 -1
- package/dist/settings-mutation.js +7 -13
- package/dist/settings-mutation.js.map +1 -1
- package/dist/types.d.ts +2 -32
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/harness/runner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EACL,oCAAoC,EACpC,cAAc,EAId,+BAA+B,GAChC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAQrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CA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C;QAC7B,GAAG,CAAC,UAAU,CAAC,wBAAwB,EAAE,aAAa,CAAC,QAAQ,EAAG,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAE7E,oEAAoE;IACpE,MAAM,YAAY,GAAG,gBAAgB,CACnC,QAAQ,EACR,IAAI,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,EACpD,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,IAAI,WAAW,EAAE,EACjF,yBAAyB,IAAI,EAAE,EAC/B;QACE,KAAK;QACL,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC;QACnE,sEAAsE;QACtE,sEAAsE;QACtE,sCAAsC;QACtC,SAAS,EAAE,eAAe;KAC3B,CACF,CAAC;IAEF,MAAM,YAAY,GAAG,MAAM,wBAAwB,CAAC;QAClD,MAAM;QACN,WAAW;QACX,UAAU;QACV,aAAa;KACd,CAAC,CAAC;IACH,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IACjC,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,YAAY,CAAC;IACxD,MAAM,cAAc,GAAG,MAAM,wBAAwB,CAAC;QACpD,WAAW;QACX,oBAAoB,EAAE,WAAW,CAAC,oBAAoB;QACtD,UAAU;QACV,iBAAiB;KAClB,CAAC,CAAC;IACH,OAAO,oBAAoB,CAAC;QAC1B,OAAO;QACP,cAAc;QACd,eAAe;QACf,YAAY;QACZ,QAAQ;QACR,aAAa;QACb,KAAK;QACL,aAAa;QACb,WAAW;QACX,YAAY;QACZ,cAAc;QACd,YAAY;QACZ,WAAW;KACZ,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Office, Workspace } from \"../office/index.js\";\nimport type { ExecutionToolContext, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { Api, Model } from \"@earendil-works/pi-ai\";\nimport { MikanModels } from \"./models.js\";\nimport type { SessionStore } from \"../sessions/session-store.js\";\nimport { MikanAgentSession, DEFAULT_EVENT_BUDGET } from \"./session.js\";\nimport { runSubagent, DEFAULT_GLOBAL_SUBAGENT_SLOTS, SubagentSlotPool } from \"./subagent.js\";\nimport { loadSubagentProfiles } from \"./subagent-profiles.js\";\nimport { createMikanTools, createSubagentTool } from \"./tools/index.js\";\nimport { adaptAgentTool } from \"./tools/pi-tools.js\";\nimport { createSandboxExecutionEnv } from \"./execution-env.js\";\nimport { mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type {\n ConversationMessage,\n ConversationKind,\n ConversationResponder,\n MessagingInfo,\n PlatformName,\n} from \"../adapter.js\";\nimport { ActorExecutionResolver } from \"./execution-resolver.js\";\nimport type { DockerContainerManager } from \"../sandbox/provisioner.js\";\nimport {\n assertSandboxSupportsWorkspacePolicy,\n createExecutor,\n type Executor,\n type RuntimePathContext,\n type SandboxConfig,\n getUnresolvedSandboxPathContext,\n} from \"../sandbox/index.js\";\nimport type { VaultManager } from \"../vault/index.js\";\nimport { resolveWorkspaceProjection } from \"../office/projection.js\";\nimport type {\n RunnerExecutionContext,\n PreparedRunContext,\n RunPresentation,\n RunnerSessionState,\n} from \"./types.js\";\nimport type { CreateRunnerOptions, OfficeAddress, PiAgentWrapper } from \"../types.js\";\nimport { createHash } from \"node:crypto\";\nimport { resolveConversationSettings } from \"../config.js\";\nimport { ensureDefaultOpenConnector } from \"./open-connector.js\";\nimport { OfficeEventStore } from \"../events/index.js\";\nimport { addLifecycleEvent, updateActiveSpanAttribution } from \"../observability/index.js\";\nimport { ChatHistorySync } from \"../sessions/chat-history-sync.js\";\nimport { conversationIdOf, isThreadSessionKey } from \"../sessions/session-key.js\";\nimport {\n extractSessionUuid,\n openManagedSession,\n type ThreadRootMessage,\n} from \"../sessions/store.js\";\nimport type { PlatformToolRunContext } from \"./tools/types.js\";\nimport { loadMikanSkills } from \"./skills.js\";\nimport {\n normalizeAttachRuntimePath,\n withStagedRuntimeFile,\n buildPromptPayload,\n buildSystemPrompt,\n buildTurnInstructions,\n getMemory,\n resolveTriggerAttribution,\n} from \"./prompt.js\";\nimport {\n attachSessionEventHandlers,\n activateRunPresentation,\n createRunState,\n finalizeRunResponse,\n isEventTriggerAttribution,\n reportUsageSummary,\n} from \"./presenter.js\";\n\nimport * as log from \"../log.js\";\n\n// One process-wide fan-out account: per-conversation queues serialize runs,\n// but each run can fan out up to the per-run cap — without this shared\n// ceiling, N busy conversations hold N × cap live subagent sessions.\nconst globalSubagentSlots = new SubagentSlotPool(DEFAULT_GLOBAL_SUBAGENT_SLOTS);\n\nasync function createConfiguredAgentSession(params: {\n workspaceDir: string;\n systemPrompt: string;\n model: Model<Api>;\n thinkingLevel: ThinkingLevel;\n tools: Awaited<ReturnType<typeof createMikanTools>>[\"tools\"];\n toolContext: ExecutionToolContext;\n sessionStore: SessionStore;\n models: MikanModels;\n}): Promise<MikanAgentSession> {\n const {\n workspaceDir,\n systemPrompt,\n model,\n thinkingLevel,\n tools,\n toolContext,\n sessionStore,\n models,\n } = params;\n const loadedProfiles = loadSubagentProfiles(workspaceDir);\n for (const diagnostic of loadedProfiles.diagnostics) {\n log.logWarning(`Subagent profile ignored: ${diagnostic.path}`, diagnostic.message);\n }\n\n const availableToolNames = new Set(tools.map((tool) => tool.name));\n const runnableProfiles = new Map(\n [...loadedProfiles.profiles].filter(([, profile]) =>\n profile.tools.every((tool) => availableToolNames.has(tool)),\n ),\n );\n let session: MikanAgentSession | undefined;\n const subagentTool = createSubagentTool(\n (request, hooks) =>\n runSubagent({\n request,\n ...(hooks?.onActivity ? { onActivity: hooks.onActivity } : {}),\n defaultModel: model,\n thinkingLevel,\n models,\n workspaceDir,\n availableTools: tools.filter((tool) => ![\"start_task\", \"task_status\"].includes(tool.name)),\n profiles: runnableProfiles,\n slots: globalSubagentSlots,\n toolContext,\n parentMessages: [...session!.messages],\n onUsage: session!.captureExternalUsageSink(),\n }),\n runnableProfiles,\n );\n\n session = new MikanAgentSession({\n systemPrompt,\n model,\n thinkingLevel,\n tools: [...tools, adaptAgentTool(subagentTool)],\n toolContext,\n models,\n sessionStore,\n });\n const reloaded = await session.reloadFromSession();\n if (reloaded > 0) log.logInfo(`Reloaded ${reloaded} messages from session context`);\n return session;\n}\n\nfunction createRunnerExecutionContext(\n sandboxConfig: SandboxConfig,\n vaultManager: VaultManager | undefined,\n provisioner: DockerContainerManager | undefined,\n workspace: Workspace,\n): RunnerExecutionContext {\n const executionResolver =\n vaultManager && sandboxConfig.type !== \"host\"\n ? new ActorExecutionResolver(sandboxConfig, vaultManager, provisioner, workspace)\n : undefined;\n\n // activeExecutor is replaced at the start of each run() call when executionResolver\n // is present, so the stable `executor` wrapper always delegates to the latest resolved value.\n let activeExecutor: Executor =\n executionResolver !== undefined\n ? createExecutor({ type: \"host\" })\n : createExecutor(sandboxConfig);\n const executor: Executor = {\n exec(command, options) {\n return activeExecutor.exec(command, options);\n },\n readFile(path, options) {\n return activeExecutor.readFile(path, options);\n },\n readFileBase64(path, options) {\n return activeExecutor.readFileBase64(path, options);\n },\n writeFile(path, content, options) {\n return activeExecutor.writeFile(path, content, options);\n },\n getWorkspacePath(hostPath) {\n return activeExecutor.getWorkspacePath(hostPath);\n },\n getSandboxConfig() {\n return activeExecutor.getSandboxConfig();\n },\n getPathContext(hostWorkspaceRoot) {\n return activeExecutor.getPathContext(hostWorkspaceRoot);\n },\n };\n\n return {\n executor,\n async resolveForRun(context) {\n if (executionResolver) {\n const decision = await executionResolver.resolve(context);\n activeExecutor = decision.executor;\n return {\n pathContext: decision.pathContext,\n projection: decision.projection,\n };\n }\n\n const office = workspace.office(context.address);\n const projection = resolveWorkspaceProjection(office);\n assertSandboxSupportsWorkspacePolicy(\n sandboxConfig,\n projection.doorPolicy,\n projection.promptSources.globalMemoryReadOnly === true,\n );\n return {\n pathContext: executor.getPathContext(workspace.root),\n projection,\n };\n },\n };\n}\n\nfunction buildThreadSessionName(message: ThreadRootMessage | null): string | undefined {\n const text = message?.text?.trim();\n if (!text) return undefined;\n const userLabel = message?.userName || message?.user || \"unknown\";\n return `[${userLabel}]: ${text}`;\n}\n\n/**\n * Fill in the deployment's default OpenConnector entry before settings are\n * read, so the runner then sees only ordinary MCP configuration. A failed\n * default is reported and skipped; the office keeps its other servers.\n */\nasync function ensureDefaultMcpServers(options: {\n office: Office;\n trustModel: CreateRunnerOptions[\"trustModel\"];\n platformWorkspaceId?: string;\n openConnector?: CreateRunnerOptions[\"openConnector\"];\n signal?: AbortSignal;\n}): Promise<void> {\n if (options.trustModel === \"open-trigger\") return;\n try {\n await ensureDefaultOpenConnector(\n options.office,\n options.platformWorkspaceId,\n options.openConnector,\n options.signal,\n );\n } catch (error) {\n options.signal?.throwIfAborted();\n log.logWarning(\n `[${options.office.address.conversationId}] OpenConnector default provisioning failed`,\n error instanceof Error ? error.message : String(error),\n );\n }\n}\n\ntype PrepareRunParams = {\n message: ConversationMessage;\n responder: ConversationResponder;\n platform: MessagingInfo;\n office: Office;\n executor: Executor;\n resolveForRun: RunnerExecutionContext[\"resolveForRun\"];\n session: MikanAgentSession;\n setEventContext: (context: {\n platform: string;\n conversationId: string;\n conversationKind: ConversationKind;\n userId: string;\n }) => void;\n setSandboxContext: (context: { address: OfficeAddress; userId: string }) => void;\n setUploadFunction: (fn: (filePath: string, title?: string) => Promise<void>) => void;\n setImageUploadFunction: (fn: (hostPath: string, title?: string) => Promise<void>) => void;\n bindTasks: ReturnType<typeof createMikanTools>[\"bindTasks\"];\n setReactFunction: (fn: ((emoji: string) => Promise<void>) | null) => void;\n bindPlatformToolPacks: (ctx: PlatformToolRunContext) => void;\n};\n\ntype RunPromptContext = {\n pathContext: RuntimePathContext;\n memory: string;\n systemPrompt: string;\n triggerAttribution: string | undefined;\n};\n\nasync function preparePromptContext(params: PrepareRunParams): Promise<RunPromptContext> {\n const { message, platform, office, executor, resolveForRun, session } = params;\n const conversationId = office.address.conversationId;\n const decision = await resolveForRun({\n address: message.address,\n userId: message.userId,\n trustModel: platform.trustModel,\n });\n const { pathContext, projection } = decision;\n const reloaded = await session.reloadFromSession();\n if (reloaded > 0) {\n log.logInfo(`[${conversationId}] Reloaded ${reloaded} messages from context`);\n }\n\n const memory = await getMemory(projection);\n const conversationSkillLoad = loadMikanSkills(\n office,\n pathContext.runtimeWorkspaceRoot,\n projection,\n );\n const triggerAttribution = resolveTriggerAttribution(message);\n const systemPrompt = buildSystemPrompt({\n workspacePath: pathContext.runtimeWorkspaceRoot,\n office,\n memory,\n sandboxConfig: executor.getSandboxConfig(),\n platform,\n skills: conversationSkillLoad.skills,\n projection,\n skippedSkillLinks: conversationSkillLoad.skippedSkillLinks,\n });\n session.setSystemPrompt(systemPrompt);\n // A stable hash across turns verifies that turn-specific data did not leak\n // into the provider-cacheable system prompt.\n const promptHash = createHash(\"sha256\").update(systemPrompt).digest(\"hex\").slice(0, 8);\n log.logInfo(\n `[${conversationId}] System prompt (base): ${systemPrompt.length} chars, sha ${promptHash}`,\n );\n return { pathContext, memory, systemPrompt, triggerAttribution };\n}\n\nfunction bindRunCapabilities(params: PrepareRunParams, pathContext: RuntimePathContext): void {\n const {\n message,\n responder,\n platform,\n office,\n executor,\n setEventContext,\n setSandboxContext,\n setUploadFunction,\n setImageUploadFunction,\n setReactFunction,\n bindTasks,\n bindPlatformToolPacks,\n } = params;\n setEventContext({\n platform: platform.name,\n conversationId: office.address.conversationId,\n conversationKind: message.conversationKind,\n userId: message.userId,\n });\n setSandboxContext({ address: message.address, userId: message.userId });\n setUploadFunction(async (filePath: string, title?: string) => {\n const runtimePath = normalizeAttachRuntimePath(filePath, pathContext.runtimeWorkspaceRoot);\n await withStagedRuntimeFile(executor, runtimePath, (stagedPath) =>\n responder.uploadFile(stagedPath, title),\n );\n });\n // Generated images already live host-side and must not be staged through a sandbox.\n setImageUploadFunction(async (hostPath: string, title?: string) => {\n await responder.uploadFile(hostPath, title);\n });\n // Unset reaction support when the active responder cannot react.\n bindTasks(responder);\n setReactFunction(responder.react ? async (emoji: string) => responder.react!(emoji) : null);\n bindPlatformToolPacks({\n conversationId: office.address.conversationId,\n platformName: platform.name,\n threadTs: message.threadTs,\n });\n}\n\nasync function prepareRunContext(params: PrepareRunParams): Promise<PreparedRunContext> {\n const { message, platform, office, executor } = params;\n const sessionConversation = conversationIdOf(message.sessionKey);\n await mkdir(join(office.dir, \"scratch\"), { recursive: true });\n const { pathContext, memory, systemPrompt, triggerAttribution } =\n await preparePromptContext(params);\n bindRunCapabilities(params, pathContext);\n\n log.logInfo(\n `Context sizes - system: ${systemPrompt.length} chars, memory: ${memory.length} chars`,\n );\n log.logInfo(`Channels: ${platform.channels.length}, Users: ${platform.users.length}`);\n\n const { userMessage, imageAttachments } = await buildPromptPayload(\n message,\n pathContext.runtimeWorkspaceRoot,\n pathContext,\n (runtimePath) => executor.readFileBase64(runtimePath),\n );\n const turnInstructions = buildTurnInstructions(\n message.id.startsWith(\"event:\"),\n triggerAttribution,\n platform.name,\n );\n const finalUserMessage = turnInstructions ? `${turnInstructions}\\n\\n${userMessage}` : userMessage;\n return {\n sessionConversation,\n userMessage: finalUserMessage,\n imageAttachments,\n triggerAttribution,\n };\n}\n\nasync function buildInitialSystemPrompt(params: {\n office: Office;\n pathContext: RuntimePathContext;\n projection: ReturnType<typeof resolveWorkspaceProjection>;\n sandboxConfig: CreateRunnerOptions[\"sandboxConfig\"];\n}): Promise<string> {\n const { office, pathContext, projection, sandboxConfig } = params;\n const memory = await getMemory(projection);\n const { skills, skippedSkillLinks } = loadMikanSkills(\n office,\n pathContext.runtimeWorkspaceRoot,\n projection,\n );\n return buildSystemPrompt({\n workspacePath: pathContext.runtimeWorkspaceRoot,\n office,\n memory,\n sandboxConfig,\n platform: {\n name: \"chat\",\n formattingGuide: \"\",\n channels: [],\n users: [],\n trustModel: \"membership\",\n },\n skills,\n projection,\n skippedSkillLinks,\n });\n}\n\nasync function rollbackRunnerResource(label: string, cleanup: () => Promise<void>): Promise<void> {\n try {\n await cleanup();\n } catch (error) {\n log.logWarning(`Runner rollback failed to ${label}`, String(error));\n }\n}\n\nasync function openRunnerSessionManager(params: {\n contextFile: string;\n runtimeWorkspaceRoot: string;\n sessionKey: string;\n threadRootMessage: ThreadRootMessage | null;\n}) {\n const { contextFile, runtimeWorkspaceRoot, sessionKey, threadRootMessage } = params;\n const sessionManager = await openManagedSession(contextFile, runtimeWorkspaceRoot);\n try {\n const threadSessionName = buildThreadSessionName(threadRootMessage);\n if (\n isThreadSessionKey(sessionKey) &&\n threadSessionName &&\n (await sessionManager.getSessionName()) !== threadSessionName\n ) {\n await sessionManager.setSessionName(threadSessionName);\n }\n return sessionManager;\n } catch (error) {\n await rollbackRunnerResource(\"close the session writer\", () => sessionManager.close());\n throw error;\n }\n}\n\nasync function createRunnerAgentSession(params: {\n workspaceDir: string;\n systemPrompt: string;\n model: Model<Api>;\n agentConfig: ReturnType<typeof resolveConversationSettings>;\n tools: ReturnType<typeof createMikanTools>[\"tools\"];\n toolContext: ExecutionToolContext;\n sessionManager: Awaited<ReturnType<typeof openManagedSession>>;\n modelRegistry: MikanModels;\n conversationId: string;\n signal?: AbortSignal;\n}) {\n const {\n workspaceDir,\n systemPrompt,\n model,\n agentConfig,\n tools,\n toolContext,\n sessionManager,\n modelRegistry,\n signal,\n } = params;\n const mcpTools = await sessionManager.connectMcp(agentConfig.mcpServers ?? {}, signal);\n return createConfiguredAgentSession({\n workspaceDir,\n systemPrompt,\n model,\n thinkingLevel: agentConfig.thinkingLevel,\n tools: [...tools, ...mcpTools.map(adaptAgentTool)],\n toolContext,\n sessionStore: sessionManager,\n models: modelRegistry,\n });\n}\n\ntype PreparedTurnParams = {\n prepared: PreparedRunContext;\n presentation: RunPresentation;\n message: ConversationMessage;\n responder: ConversationResponder;\n platform: MessagingInfo;\n runState: RunnerSessionState;\n session: MikanAgentSession;\n model: Model<Api>;\n agentConfig: ReturnType<typeof resolveConversationSettings>;\n sessionUuid: string;\n conversationId: string;\n contextFile: string;\n sessionView: CreateRunnerOptions[\"sessionView\"];\n};\n\nasync function runPreparedTurn(params: PreparedTurnParams): Promise<{\n stopReason: string;\n errorMessage?: string;\n}> {\n const {\n prepared,\n presentation,\n message,\n responder,\n platform,\n runState,\n session,\n model,\n agentConfig,\n sessionUuid,\n conversationId,\n contextFile,\n sessionView,\n } = params;\n if (runState.logCtx) {\n log.logAgentRunStart(runState.logCtx, model.provider, model.id, model.name);\n }\n\n updateActiveSpanAttribution({\n provider: model.provider,\n model: model.id,\n channel_id: prepared.sessionConversation,\n session_id: sessionUuid,\n \"mikan.input.message_count\": 1,\n \"mikan.input.characters\": prepared.userMessage.length,\n \"mikan.input.attachment_count\": message.attachments?.length ?? 0,\n \"mikan.input.image_count\": prepared.imageAttachments.length,\n \"mikan.input.has_text\": prepared.userMessage.length > 0,\n });\n addLifecycleEvent(\"agent.prompt.sent\", {\n provider: model.provider,\n model: agentConfig.model,\n channel_id: prepared.sessionConversation,\n session_id: sessionUuid,\n attachment_count: message.attachments?.length ?? 0,\n image_attachment_count: prepared.imageAttachments.length,\n });\n\n const isEventRun = message.id.startsWith(\"event:\");\n await session.prompt(prepared.userMessage, {\n allowTaskHandoff: responder.startTask !== undefined,\n allowTaskStatus: responder.getTaskStatus !== undefined,\n ...(prepared.imageAttachments.length > 0 ? { images: prepared.imageAttachments } : {}),\n ...(isEventRun ? { budget: DEFAULT_EVENT_BUDGET } : {}),\n });\n await presentation.wait();\n\n const sessionViewTokenStore = sessionView?.tokenStore;\n const sessionViewPortalBaseUrl = sessionView?.portalBaseUrl;\n let sessionViewLink: string | undefined;\n const createSessionViewLink =\n sessionViewTokenStore && sessionViewPortalBaseUrl\n ? () => {\n if (!sessionViewLink) {\n const token = sessionViewTokenStore.create({\n platform: platform.name as PlatformName,\n platformUserId: message.userId,\n conversationId,\n sessionKey: message.sessionKey,\n sessionFile: contextFile,\n platformUserName: message.userName,\n });\n sessionViewLink = `${sessionViewPortalBaseUrl}/session?token=${token.token}`;\n }\n return sessionViewLink;\n }\n : undefined;\n\n await finalizeRunResponse(responder, session, runState, {\n initialTask: message.id.startsWith(\"task:\"),\n triggerSessionLink: isEventTriggerAttribution(prepared.triggerAttribution)\n ? createSessionViewLink?.()\n : undefined,\n createOverflowLink: createSessionViewLink,\n platform: platform.name,\n model,\n sessionConversation: prepared.sessionConversation,\n sessionUuid,\n });\n await reportUsageSummary({\n session,\n runState,\n responder,\n platform,\n model,\n agentConfig,\n sessionConversation: prepared.sessionConversation,\n sessionUuid,\n waitForQueue: presentation.wait,\n });\n return { stopReason: runState.stopReason, errorMessage: runState.errorMessage };\n}\n\ntype MikanToolBindings = ReturnType<typeof createMikanTools>;\n\ntype RunnerInterfaceParams = {\n conversationId: string;\n conversationDir: string;\n sessionKey: string;\n office: Office;\n sessionUuid: string;\n contextFile: string;\n sessionView: CreateRunnerOptions[\"sessionView\"];\n runState: RunnerSessionState;\n executor: Executor;\n resolveForRun: RunnerExecutionContext[\"resolveForRun\"];\n session: MikanAgentSession;\n model: Model<Api>;\n agentConfig: ReturnType<typeof resolveConversationSettings>;\n sessionManager: Awaited<ReturnType<typeof openManagedSession>>;\n chatSessionManager: ChatHistorySync;\n toolBindings: MikanToolBindings;\n};\n\nasync function steerRun(\n session: MikanAgentSession,\n activeMessage: ConversationMessage | undefined,\n message: ConversationMessage,\n): Promise<boolean> {\n if (!activeMessage) return false;\n // Claimed by the control path, including rejected/cancelled inputs: history sync\n // must not turn a rejected control into a new instruction on the next run.\n await session.sessionStore.appendCustomEntry(\"mikan.control_input\", { messageId: message.id });\n if (!session.isActiveRun)\n throw new Error(\"Task is preparing or settling. Please retry this update shortly.\");\n if (message.userId !== activeMessage.userId)\n throw new Error(\"Only the task's current actor can guide this run.\");\n if (message.attachments?.length)\n throw new Error(\"Stop the task before continuing with new attachments.\");\n if (!(await session.steer(`[${message.userName ?? message.userId}]: ${message.text}`))) {\n throw new Error(\"Task settled while receiving this update. Please send it again to continue.\");\n }\n return true;\n}\n\nfunction createRunnerInterface(params: RunnerInterfaceParams): PiAgentWrapper {\n const {\n conversationId,\n conversationDir,\n sessionKey,\n office,\n sessionUuid,\n contextFile,\n sessionView,\n runState,\n executor,\n resolveForRun,\n session,\n model,\n agentConfig,\n sessionManager,\n chatSessionManager,\n toolBindings,\n } = params;\n let activeMessage: ConversationMessage | undefined;\n let stopped = false;\n return {\n steer: (message) => steerRun(session, activeMessage, message),\n async syncChatHistory(currentMessageId?: string): Promise<void> {\n await chatSessionManager.syncSessionManager({\n conversationDir,\n sessionKey,\n sessionManager,\n currentMessageId,\n });\n },\n\n async run(message, responder, platform) {\n activeMessage = message;\n stopped = false;\n let presentation: RunPresentation | undefined;\n try {\n const prepared = await prepareRunContext({\n message,\n responder,\n platform,\n office,\n executor,\n resolveForRun,\n session,\n setEventContext: toolBindings.setEventContext,\n setSandboxContext: toolBindings.setSandboxContext,\n setUploadFunction: toolBindings.setUploadFunction,\n setImageUploadFunction: toolBindings.setImageUploadFunction,\n setReactFunction: toolBindings.setReactFunction,\n bindTasks: toolBindings.bindTasks,\n bindPlatformToolPacks: toolBindings.bindPlatformToolPacks,\n });\n if (stopped) return { stopReason: \"aborted\" };\n presentation = activateRunPresentation(runState, {\n responder,\n sessionConversation: prepared.sessionConversation,\n userName: message.userName,\n sessionUuid,\n triggerAttribution: prepared.triggerAttribution,\n });\n return await runPreparedTurn({\n prepared,\n presentation,\n message,\n responder,\n platform,\n runState,\n session,\n model,\n agentConfig,\n sessionUuid,\n conversationId,\n contextFile,\n sessionView,\n });\n } finally {\n activeMessage = undefined;\n presentation?.dispose();\n }\n },\n\n abort(): void {\n stopped = true;\n session.abort();\n },\n\n async dispose(): Promise<void> {\n await sessionManager.close();\n },\n\n getCurrentStep(): { toolName?: string; label?: string } | undefined {\n const first = runState.pendingTools.values().next().value;\n if (!first) return undefined;\n return {\n toolName: first.toolName,\n label: (first.args as { label?: string })?.label,\n };\n },\n };\n}\n\nasync function finishRunnerCreation(params: {\n options: CreateRunnerOptions;\n conversationId: string;\n conversationDir: string;\n workspaceDir: string;\n executor: Executor;\n resolveForRun: RunnerExecutionContext[\"resolveForRun\"];\n model: Model<Api>;\n modelRegistry: MikanModels;\n agentConfig: ReturnType<typeof resolveConversationSettings>;\n systemPrompt: string;\n sessionManager: Awaited<ReturnType<typeof openManagedSession>>;\n toolBindings: MikanToolBindings;\n toolContext: ExecutionToolContext;\n}): Promise<PiAgentWrapper> {\n const {\n options,\n conversationId,\n conversationDir,\n workspaceDir,\n executor,\n resolveForRun,\n model,\n modelRegistry,\n agentConfig,\n systemPrompt,\n sessionManager,\n toolBindings,\n toolContext,\n } = params;\n const { sessionKey, office, sessionScope, sessionView } = options;\n const { contextFile } = sessionScope;\n try {\n const sessionUuid = extractSessionUuid(contextFile);\n const chatSessionManager = new ChatHistorySync();\n const session = await createRunnerAgentSession({\n workspaceDir,\n systemPrompt,\n model,\n agentConfig,\n tools: toolBindings.tools,\n toolContext,\n sessionManager,\n modelRegistry,\n conversationId,\n signal: options.signal,\n });\n options.signal?.throwIfAborted();\n\n const runState = createRunState();\n attachSessionEventHandlers({ session, runState, model, agentConfig });\n\n return createRunnerInterface({\n conversationId,\n conversationDir,\n sessionKey,\n office,\n sessionUuid,\n contextFile,\n sessionView,\n runState,\n executor,\n resolveForRun,\n session,\n model,\n agentConfig,\n sessionManager,\n chatSessionManager,\n toolBindings,\n });\n } catch (error) {\n await rollbackRunnerResource(\"close the session writer\", () => sessionManager.close());\n throw error;\n }\n}\n\nexport async function createRunner(options: CreateRunnerOptions): Promise<PiAgentWrapper> {\n options.signal?.throwIfAborted();\n const {\n sandboxConfig,\n sessionKey,\n office,\n trustModel,\n sessionScope,\n vaultManager,\n provisioner,\n resourceController,\n platformToolPackFactories,\n } = options;\n const conversationId = office.address.conversationId;\n const conversationDir = office.dir;\n const workspaceDir = office.workspace.root;\n await ensureDefaultMcpServers({\n office,\n trustModel,\n platformWorkspaceId: options.platformWorkspaceId,\n openConnector: options.openConnector,\n signal: options.signal,\n });\n options.signal?.throwIfAborted();\n const resolvedAgentConfig = resolveConversationSettings(office);\n // open-trigger conversations get no MCP tools at all (see ARCHITECTURE.md).\n const agentConfig = {\n ...resolvedAgentConfig,\n mcpServers: trustModel === \"open-trigger\" ? {} : (resolvedAgentConfig.mcpServers ?? {}),\n };\n\n const projection = resolveWorkspaceProjection(office);\n // Bootstrap validation fails runner creation early. resolveForRun repeats\n // the check against the actor-specific decision before any provider call.\n assertSandboxSupportsWorkspacePolicy(\n sandboxConfig,\n projection.doorPolicy,\n projection.promptSources.globalMemoryReadOnly === true,\n );\n const { executor, resolveForRun } = createRunnerExecutionContext(\n sandboxConfig,\n vaultManager,\n provisioner,\n office.workspace,\n );\n const pathContext = getUnresolvedSandboxPathContext(sandboxConfig, workspaceDir);\n // The env wraps the stable executor wrapper, which delegates to the\n // actor-resolved executor per call, so one env serves every run.\n const toolContext: ExecutionToolContext = {\n env: createSandboxExecutionEnv(executor, sandboxConfig.type, pathContext.runtimeWorkspaceRoot),\n };\n\n const modelRegistry = options.models ?? MikanModels.create();\n if (modelRegistry.getError()) {\n log.logWarning(\"models.json load error\", modelRegistry.getError()!);\n }\n const model = modelRegistry.resolve(agentConfig.provider, agentConfig.model);\n\n // Create tools (per-runner, with per-runner upload function setter)\n const toolBindings = createMikanTools(\n executor,\n new OfficeEventStore(office, options.eventScheduler),\n { sandbox: sandboxConfig, resourceController: resourceController ?? provisioner },\n platformToolPackFactories ?? [],\n {\n model,\n getApiKey: () => modelRegistry.getApiKeyForProvider(model.provider),\n // The conversation's own office dir: mounted into the sandbox, unlike\n // the workspace base — generated images must land somewhere the agent\n // (and a future run) can still reach.\n outputDir: conversationDir,\n },\n );\n\n const systemPrompt = await buildInitialSystemPrompt({\n office,\n pathContext,\n projection,\n sandboxConfig,\n });\n options.signal?.throwIfAborted();\n const { contextFile, threadRootMessage } = sessionScope;\n const sessionManager = await openRunnerSessionManager({\n contextFile,\n runtimeWorkspaceRoot: pathContext.runtimeWorkspaceRoot,\n sessionKey,\n threadRootMessage,\n });\n return finishRunnerCreation({\n options,\n conversationId,\n conversationDir,\n workspaceDir,\n executor,\n resolveForRun,\n model,\n modelRegistry,\n agentConfig,\n systemPrompt,\n sessionManager,\n toolBindings,\n toolContext,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/harness/runner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EACL,oCAAoC,EACpC,cAAc,EAId,+BAA+B,GAChC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAQrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,2BAA2B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ACnC,QAAQ,EACR,IAAI,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,EACpD,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,IAAI,WAAW,EAAE,EACjF,yBAAyB,IAAI,EAAE,EAC/B;QACE,KAAK;QACL,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC;QACnE,sEAAsE;QACtE,sEAAsE;QACtE,sCAAsC;QACtC,SAAS,EAAE,eAAe;KAC3B,CACF,CAAC;IAEF,MAAM,YAAY,GAAG,MAAM,wBAAwB,CAAC;QAClD,MAAM;QACN,WAAW;QACX,UAAU;QACV,aAAa;KACd,CAAC,CAAC;IACH,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IACjC,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,YAAY,CAAC;IACxD,MAAM,cAAc,GAAG,MAAM,wBAAwB,CAAC;QACpD,WAAW;QACX,oBAAoB,EAAE,WAAW,CAAC,oBAAoB;QACtD,UAAU;QACV,iBAAiB;KAClB,CAAC,CAAC;IACH,OAAO,oBAAoB,CAAC;QAC1B,OAAO;QACP,cAAc;QACd,eAAe;QACf,YAAY;QACZ,QAAQ;QACR,aAAa;QACb,KAAK;QACL,aAAa;QACb,WAAW;QACX,YAAY;QACZ,cAAc;QACd,YAAY;QACZ,WAAW;KACZ,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Office, Workspace } from \"../office/index.js\";\nimport type { ExecutionToolContext, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { Api, Model } from \"@earendil-works/pi-ai\";\nimport { MikanModels } from \"./models.js\";\nimport type { SessionStore } from \"../sessions/session-store.js\";\nimport { MikanAgentSession, DEFAULT_EVENT_BUDGET } from \"./session.js\";\nimport { runSubagent, DEFAULT_GLOBAL_SUBAGENT_SLOTS, SubagentSlotPool } from \"./subagent.js\";\nimport { loadSubagentProfiles } from \"./subagent-profiles.js\";\nimport { createMikanTools, createSubagentTool } from \"./tools/index.js\";\nimport { adaptAgentTool } from \"./tools/pi-tools.js\";\nimport { createSandboxExecutionEnv } from \"./execution-env.js\";\nimport { mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type {\n ConversationMessage,\n ConversationKind,\n ConversationResponder,\n MessagingInfo,\n PlatformName,\n} from \"../adapter.js\";\nimport { ActorExecutionResolver } from \"./execution-resolver.js\";\nimport type { DockerContainerManager } from \"../sandbox/provisioner.js\";\nimport {\n assertSandboxSupportsWorkspacePolicy,\n createExecutor,\n type Executor,\n type RuntimePathContext,\n type SandboxConfig,\n getUnresolvedSandboxPathContext,\n} from \"../sandbox/index.js\";\nimport type { VaultManager } from \"../vault/index.js\";\nimport { resolveWorkspaceProjection } from \"../office/projection.js\";\nimport type {\n RunnerExecutionContext,\n PreparedRunContext,\n RunPresentation,\n RunnerSessionState,\n} from \"./types.js\";\nimport type { CreateRunnerOptions, OfficeAddress, PiAgentWrapper } from \"../types.js\";\nimport { createHash } from \"node:crypto\";\nimport { resolveConversationSettings } from \"../config.js\";\nimport { ensureDefaultOpenConnector } from \"./open-connector.js\";\nimport { OfficeEventStore } from \"../events/index.js\";\nimport { addLifecycleEvent, updateActiveSpanAttribution } from \"../observability/index.js\";\nimport { ChatHistorySync } from \"../sessions/chat-history-sync.js\";\nimport { conversationIdOf, isThreadSessionKey } from \"../sessions/session-key.js\";\nimport {\n extractSessionUuid,\n openManagedSession,\n type ThreadRootMessage,\n} from \"../sessions/store.js\";\nimport type { PlatformToolRunContext } from \"./tools/types.js\";\nimport { loadMikanSkills } from \"./skills.js\";\nimport {\n normalizeAttachRuntimePath,\n withStagedRuntimeFile,\n buildPromptPayload,\n buildSystemPrompt,\n buildTurnInstructions,\n getMemory,\n resolveTriggerAttribution,\n} from \"./prompt.js\";\nimport {\n attachSessionEventHandlers,\n activateRunPresentation,\n createRunState,\n finalizeRunResponse,\n isEventTriggerAttribution,\n reportUsageSummary,\n} from \"./presenter.js\";\n\nimport * as log from \"../log.js\";\n\n// One process-wide fan-out account: per-conversation queues serialize runs,\n// but each run can fan out up to the per-run cap — without this shared\n// ceiling, N busy conversations hold N × cap live subagent sessions.\nconst globalSubagentSlots = new SubagentSlotPool(DEFAULT_GLOBAL_SUBAGENT_SLOTS);\n\nasync function createConfiguredAgentSession(params: {\n workspaceDir: string;\n systemPrompt: string;\n model: Model<Api>;\n thinkingLevel: ThinkingLevel;\n tools: Awaited<ReturnType<typeof createMikanTools>>[\"tools\"];\n toolContext: ExecutionToolContext;\n sessionStore: SessionStore;\n models: MikanModels;\n}): Promise<MikanAgentSession> {\n const {\n workspaceDir,\n systemPrompt,\n model,\n thinkingLevel,\n tools,\n toolContext,\n sessionStore,\n models,\n } = params;\n const loadedProfiles = loadSubagentProfiles(workspaceDir);\n for (const diagnostic of loadedProfiles.diagnostics) {\n log.logWarning(`Subagent profile ignored: ${diagnostic.path}`, diagnostic.message);\n }\n\n const availableToolNames = new Set(tools.map((tool) => tool.name));\n const runnableProfiles = new Map(\n [...loadedProfiles.profiles].filter(([, profile]) =>\n profile.tools.every((tool) => availableToolNames.has(tool)),\n ),\n );\n let session: MikanAgentSession | undefined;\n const subagentTool = createSubagentTool(\n (request, hooks) =>\n runSubagent({\n request,\n ...(hooks?.onActivity ? { onActivity: hooks.onActivity } : {}),\n defaultModel: model,\n thinkingLevel,\n models,\n workspaceDir,\n availableTools: tools.filter((tool) => ![\"start_task\", \"task_status\"].includes(tool.name)),\n profiles: runnableProfiles,\n slots: globalSubagentSlots,\n toolContext,\n parentMessages: [...session!.messages],\n onUsage: session!.captureExternalUsageSink(),\n }),\n runnableProfiles,\n );\n\n session = new MikanAgentSession({\n systemPrompt,\n model,\n thinkingLevel,\n tools: [...tools, adaptAgentTool(subagentTool)],\n toolContext,\n models,\n sessionStore,\n });\n const reloaded = await session.reloadFromSession();\n if (reloaded > 0) log.logInfo(`Reloaded ${reloaded} messages from session context`);\n return session;\n}\n\nfunction createRunnerExecutionContext(\n sandboxConfig: SandboxConfig,\n vaultManager: VaultManager | undefined,\n provisioner: DockerContainerManager | undefined,\n workspace: Workspace,\n): RunnerExecutionContext {\n const executionResolver =\n vaultManager && sandboxConfig.type !== \"host\"\n ? new ActorExecutionResolver(sandboxConfig, vaultManager, provisioner, workspace)\n : undefined;\n\n // activeExecutor is replaced at the start of each run() call when executionResolver\n // is present, so the stable `executor` wrapper always delegates to the latest resolved value.\n let activeExecutor: Executor =\n executionResolver !== undefined\n ? createExecutor({ type: \"host\" })\n : createExecutor(sandboxConfig);\n const executor: Executor = {\n exec(command, options) {\n return activeExecutor.exec(command, options);\n },\n readFile(path, options) {\n return activeExecutor.readFile(path, options);\n },\n readFileBase64(path, options) {\n return activeExecutor.readFileBase64(path, options);\n },\n writeFile(path, content, options) {\n return activeExecutor.writeFile(path, content, options);\n },\n getWorkspacePath(hostPath) {\n return activeExecutor.getWorkspacePath(hostPath);\n },\n getSandboxConfig() {\n return activeExecutor.getSandboxConfig();\n },\n getPathContext(hostWorkspaceRoot) {\n return activeExecutor.getPathContext(hostWorkspaceRoot);\n },\n };\n\n return {\n executor,\n async resolveForRun(context) {\n if (executionResolver) {\n const decision = await executionResolver.resolve(context);\n activeExecutor = decision.executor;\n return {\n pathContext: decision.pathContext,\n projection: decision.projection,\n };\n }\n\n const office = workspace.office(context.address);\n const projection = resolveWorkspaceProjection(office);\n assertSandboxSupportsWorkspacePolicy(sandboxConfig, projection.visibility, office.key);\n return {\n pathContext: executor.getPathContext(workspace.root),\n projection,\n };\n },\n };\n}\n\nfunction buildThreadSessionName(message: ThreadRootMessage | null): string | undefined {\n const text = message?.text?.trim();\n if (!text) return undefined;\n const userLabel = message?.userName || message?.user || \"unknown\";\n return `[${userLabel}]: ${text}`;\n}\n\n/**\n * Fill in the deployment's default OpenConnector entry before settings are\n * read, so the runner then sees only ordinary MCP configuration. A failed\n * default is reported and skipped; the office keeps its other servers.\n */\nasync function ensureDefaultMcpServers(options: {\n office: Office;\n trustModel: CreateRunnerOptions[\"trustModel\"];\n platformWorkspaceId?: string;\n openConnector?: CreateRunnerOptions[\"openConnector\"];\n signal?: AbortSignal;\n}): Promise<void> {\n if (options.trustModel === \"open-trigger\") return;\n try {\n await ensureDefaultOpenConnector(\n options.office,\n options.platformWorkspaceId,\n options.openConnector,\n options.signal,\n );\n } catch (error) {\n options.signal?.throwIfAborted();\n log.logWarning(\n `[${options.office.address.conversationId}] OpenConnector default provisioning failed`,\n error instanceof Error ? error.message : String(error),\n );\n }\n}\n\ntype PrepareRunParams = {\n message: ConversationMessage;\n responder: ConversationResponder;\n platform: MessagingInfo;\n office: Office;\n executor: Executor;\n resolveForRun: RunnerExecutionContext[\"resolveForRun\"];\n session: MikanAgentSession;\n setEventContext: (context: {\n platform: string;\n conversationId: string;\n conversationKind: ConversationKind;\n userId: string;\n }) => void;\n setSandboxContext: (context: { address: OfficeAddress; userId: string }) => void;\n setUploadFunction: (fn: (filePath: string, title?: string) => Promise<void>) => void;\n setImageUploadFunction: (fn: (hostPath: string, title?: string) => Promise<void>) => void;\n bindTasks: ReturnType<typeof createMikanTools>[\"bindTasks\"];\n setReactFunction: (fn: ((emoji: string) => Promise<void>) | null) => void;\n bindPlatformToolPacks: (ctx: PlatformToolRunContext) => void;\n};\n\ntype RunPromptContext = {\n pathContext: RuntimePathContext;\n memory: string;\n systemPrompt: string;\n triggerAttribution: string | undefined;\n};\n\nasync function preparePromptContext(params: PrepareRunParams): Promise<RunPromptContext> {\n const { message, platform, office, executor, resolveForRun, session } = params;\n const conversationId = office.address.conversationId;\n const decision = await resolveForRun({\n address: message.address,\n userId: message.userId,\n trustModel: platform.trustModel,\n });\n const { pathContext, projection } = decision;\n const reloaded = await session.reloadFromSession();\n if (reloaded > 0) {\n log.logInfo(`[${conversationId}] Reloaded ${reloaded} messages from context`);\n }\n\n const memory = await getMemory(projection);\n const conversationSkillLoad = loadMikanSkills(\n office,\n pathContext.runtimeWorkspaceRoot,\n projection,\n );\n const triggerAttribution = resolveTriggerAttribution(message);\n const systemPrompt = buildSystemPrompt({\n workspacePath: pathContext.runtimeWorkspaceRoot,\n office,\n memory,\n sandboxConfig: executor.getSandboxConfig(),\n platform,\n skills: conversationSkillLoad.skills,\n projection,\n skippedSkillLinks: conversationSkillLoad.skippedSkillLinks,\n });\n session.setSystemPrompt(systemPrompt);\n // A stable hash across turns verifies that turn-specific data did not leak\n // into the provider-cacheable system prompt.\n const promptHash = createHash(\"sha256\").update(systemPrompt).digest(\"hex\").slice(0, 8);\n log.logInfo(\n `[${conversationId}] System prompt (base): ${systemPrompt.length} chars, sha ${promptHash}`,\n );\n return { pathContext, memory, systemPrompt, triggerAttribution };\n}\n\nfunction bindRunCapabilities(params: PrepareRunParams, pathContext: RuntimePathContext): void {\n const {\n message,\n responder,\n platform,\n office,\n executor,\n setEventContext,\n setSandboxContext,\n setUploadFunction,\n setImageUploadFunction,\n setReactFunction,\n bindTasks,\n bindPlatformToolPacks,\n } = params;\n setEventContext({\n platform: platform.name,\n conversationId: office.address.conversationId,\n conversationKind: message.conversationKind,\n userId: message.userId,\n });\n setSandboxContext({ address: message.address, userId: message.userId });\n setUploadFunction(async (filePath: string, title?: string) => {\n const runtimePath = normalizeAttachRuntimePath(filePath, pathContext.runtimeWorkspaceRoot);\n await withStagedRuntimeFile(executor, runtimePath, (stagedPath) =>\n responder.uploadFile(stagedPath, title),\n );\n });\n // Generated images already live host-side and must not be staged through a sandbox.\n setImageUploadFunction(async (hostPath: string, title?: string) => {\n await responder.uploadFile(hostPath, title);\n });\n // Unset reaction support when the active responder cannot react.\n bindTasks(responder);\n setReactFunction(responder.react ? async (emoji: string) => responder.react!(emoji) : null);\n bindPlatformToolPacks({\n conversationId: office.address.conversationId,\n platformName: platform.name,\n threadTs: message.threadTs,\n });\n}\n\nasync function prepareRunContext(params: PrepareRunParams): Promise<PreparedRunContext> {\n const { message, platform, office, executor } = params;\n const sessionConversation = conversationIdOf(message.sessionKey);\n await mkdir(join(office.dir, \"scratch\"), { recursive: true });\n const { pathContext, memory, systemPrompt, triggerAttribution } =\n await preparePromptContext(params);\n bindRunCapabilities(params, pathContext);\n\n log.logInfo(\n `Context sizes - system: ${systemPrompt.length} chars, memory: ${memory.length} chars`,\n );\n log.logInfo(`Channels: ${platform.channels.length}, Users: ${platform.users.length}`);\n\n const { userMessage, imageAttachments } = await buildPromptPayload(\n message,\n pathContext.runtimeWorkspaceRoot,\n pathContext,\n (runtimePath) => executor.readFileBase64(runtimePath),\n );\n const turnInstructions = buildTurnInstructions(\n message.id.startsWith(\"event:\"),\n triggerAttribution,\n platform.name,\n );\n const finalUserMessage = turnInstructions ? `${turnInstructions}\\n\\n${userMessage}` : userMessage;\n return {\n sessionConversation,\n userMessage: finalUserMessage,\n imageAttachments,\n triggerAttribution,\n };\n}\n\nasync function buildInitialSystemPrompt(params: {\n office: Office;\n pathContext: RuntimePathContext;\n projection: ReturnType<typeof resolveWorkspaceProjection>;\n sandboxConfig: CreateRunnerOptions[\"sandboxConfig\"];\n}): Promise<string> {\n const { office, pathContext, projection, sandboxConfig } = params;\n const memory = await getMemory(projection);\n const { skills, skippedSkillLinks } = loadMikanSkills(\n office,\n pathContext.runtimeWorkspaceRoot,\n projection,\n );\n return buildSystemPrompt({\n workspacePath: pathContext.runtimeWorkspaceRoot,\n office,\n memory,\n sandboxConfig,\n platform: {\n name: \"chat\",\n formattingGuide: \"\",\n channels: [],\n users: [],\n trustModel: \"membership\",\n },\n skills,\n projection,\n skippedSkillLinks,\n });\n}\n\nasync function rollbackRunnerResource(label: string, cleanup: () => Promise<void>): Promise<void> {\n try {\n await cleanup();\n } catch (error) {\n log.logWarning(`Runner rollback failed to ${label}`, String(error));\n }\n}\n\nasync function openRunnerSessionManager(params: {\n contextFile: string;\n runtimeWorkspaceRoot: string;\n sessionKey: string;\n threadRootMessage: ThreadRootMessage | null;\n}) {\n const { contextFile, runtimeWorkspaceRoot, sessionKey, threadRootMessage } = params;\n const sessionManager = await openManagedSession(contextFile, runtimeWorkspaceRoot);\n try {\n const threadSessionName = buildThreadSessionName(threadRootMessage);\n if (\n isThreadSessionKey(sessionKey) &&\n threadSessionName &&\n (await sessionManager.getSessionName()) !== threadSessionName\n ) {\n await sessionManager.setSessionName(threadSessionName);\n }\n return sessionManager;\n } catch (error) {\n await rollbackRunnerResource(\"close the session writer\", () => sessionManager.close());\n throw error;\n }\n}\n\nasync function createRunnerAgentSession(params: {\n workspaceDir: string;\n systemPrompt: string;\n model: Model<Api>;\n agentConfig: ReturnType<typeof resolveConversationSettings>;\n tools: ReturnType<typeof createMikanTools>[\"tools\"];\n toolContext: ExecutionToolContext;\n sessionManager: Awaited<ReturnType<typeof openManagedSession>>;\n modelRegistry: MikanModels;\n conversationId: string;\n signal?: AbortSignal;\n}) {\n const {\n workspaceDir,\n systemPrompt,\n model,\n agentConfig,\n tools,\n toolContext,\n sessionManager,\n modelRegistry,\n signal,\n } = params;\n const mcpTools = await sessionManager.connectMcp(agentConfig.mcpServers ?? {}, signal);\n return createConfiguredAgentSession({\n workspaceDir,\n systemPrompt,\n model,\n thinkingLevel: agentConfig.thinkingLevel,\n tools: [...tools, ...mcpTools.map(adaptAgentTool)],\n toolContext,\n sessionStore: sessionManager,\n models: modelRegistry,\n });\n}\n\ntype PreparedTurnParams = {\n prepared: PreparedRunContext;\n presentation: RunPresentation;\n message: ConversationMessage;\n responder: ConversationResponder;\n platform: MessagingInfo;\n runState: RunnerSessionState;\n session: MikanAgentSession;\n model: Model<Api>;\n agentConfig: ReturnType<typeof resolveConversationSettings>;\n sessionUuid: string;\n conversationId: string;\n contextFile: string;\n sessionView: CreateRunnerOptions[\"sessionView\"];\n};\n\nasync function runPreparedTurn(params: PreparedTurnParams): Promise<{\n stopReason: string;\n errorMessage?: string;\n}> {\n const {\n prepared,\n presentation,\n message,\n responder,\n platform,\n runState,\n session,\n model,\n agentConfig,\n sessionUuid,\n conversationId,\n contextFile,\n sessionView,\n } = params;\n if (runState.logCtx) {\n log.logAgentRunStart(runState.logCtx, model.provider, model.id, model.name);\n }\n\n updateActiveSpanAttribution({\n provider: model.provider,\n model: model.id,\n channel_id: prepared.sessionConversation,\n session_id: sessionUuid,\n \"mikan.input.message_count\": 1,\n \"mikan.input.characters\": prepared.userMessage.length,\n \"mikan.input.attachment_count\": message.attachments?.length ?? 0,\n \"mikan.input.image_count\": prepared.imageAttachments.length,\n \"mikan.input.has_text\": prepared.userMessage.length > 0,\n });\n addLifecycleEvent(\"agent.prompt.sent\", {\n provider: model.provider,\n model: agentConfig.model,\n channel_id: prepared.sessionConversation,\n session_id: sessionUuid,\n attachment_count: message.attachments?.length ?? 0,\n image_attachment_count: prepared.imageAttachments.length,\n });\n\n const isEventRun = message.id.startsWith(\"event:\");\n await session.prompt(prepared.userMessage, {\n allowTaskHandoff: responder.startTask !== undefined,\n allowTaskStatus: responder.getTaskStatus !== undefined,\n ...(prepared.imageAttachments.length > 0 ? { images: prepared.imageAttachments } : {}),\n ...(isEventRun ? { budget: DEFAULT_EVENT_BUDGET } : {}),\n });\n await presentation.wait();\n\n const sessionViewTokenStore = sessionView?.tokenStore;\n const sessionViewPortalBaseUrl = sessionView?.portalBaseUrl;\n let sessionViewLink: string | undefined;\n const createSessionViewLink =\n sessionViewTokenStore && sessionViewPortalBaseUrl\n ? () => {\n if (!sessionViewLink) {\n const token = sessionViewTokenStore.create({\n platform: platform.name as PlatformName,\n platformUserId: message.userId,\n conversationId,\n sessionKey: message.sessionKey,\n sessionFile: contextFile,\n platformUserName: message.userName,\n });\n sessionViewLink = `${sessionViewPortalBaseUrl}/session?token=${token.token}`;\n }\n return sessionViewLink;\n }\n : undefined;\n\n await finalizeRunResponse(responder, session, runState, {\n initialTask: message.id.startsWith(\"task:\"),\n triggerSessionLink: isEventTriggerAttribution(prepared.triggerAttribution)\n ? createSessionViewLink?.()\n : undefined,\n createOverflowLink: createSessionViewLink,\n platform: platform.name,\n model,\n sessionConversation: prepared.sessionConversation,\n sessionUuid,\n });\n await reportUsageSummary({\n session,\n runState,\n responder,\n platform,\n model,\n agentConfig,\n sessionConversation: prepared.sessionConversation,\n sessionUuid,\n waitForQueue: presentation.wait,\n });\n return { stopReason: runState.stopReason, errorMessage: runState.errorMessage };\n}\n\ntype MikanToolBindings = ReturnType<typeof createMikanTools>;\n\ntype RunnerInterfaceParams = {\n conversationId: string;\n conversationDir: string;\n sessionKey: string;\n office: Office;\n sessionUuid: string;\n contextFile: string;\n sessionView: CreateRunnerOptions[\"sessionView\"];\n runState: RunnerSessionState;\n executor: Executor;\n resolveForRun: RunnerExecutionContext[\"resolveForRun\"];\n session: MikanAgentSession;\n model: Model<Api>;\n agentConfig: ReturnType<typeof resolveConversationSettings>;\n sessionManager: Awaited<ReturnType<typeof openManagedSession>>;\n chatSessionManager: ChatHistorySync;\n toolBindings: MikanToolBindings;\n};\n\nasync function steerRun(\n session: MikanAgentSession,\n activeMessage: ConversationMessage | undefined,\n message: ConversationMessage,\n): Promise<boolean> {\n if (!activeMessage) return false;\n // Claimed by the control path, including rejected/cancelled inputs: history sync\n // must not turn a rejected control into a new instruction on the next run.\n await session.sessionStore.appendCustomEntry(\"mikan.control_input\", { messageId: message.id });\n if (!session.isActiveRun)\n throw new Error(\"Task is preparing or settling. Please retry this update shortly.\");\n if (message.userId !== activeMessage.userId)\n throw new Error(\"Only the task's current actor can guide this run.\");\n if (message.attachments?.length)\n throw new Error(\"Stop the task before continuing with new attachments.\");\n if (!(await session.steer(`[${message.userName ?? message.userId}]: ${message.text}`))) {\n throw new Error(\"Task settled while receiving this update. Please send it again to continue.\");\n }\n return true;\n}\n\nfunction createRunnerInterface(params: RunnerInterfaceParams): PiAgentWrapper {\n const {\n conversationId,\n conversationDir,\n sessionKey,\n office,\n sessionUuid,\n contextFile,\n sessionView,\n runState,\n executor,\n resolveForRun,\n session,\n model,\n agentConfig,\n sessionManager,\n chatSessionManager,\n toolBindings,\n } = params;\n let activeMessage: ConversationMessage | undefined;\n let stopped = false;\n return {\n steer: (message) => steerRun(session, activeMessage, message),\n async syncChatHistory(currentMessageId?: string): Promise<void> {\n await chatSessionManager.syncSessionManager({\n conversationDir,\n sessionKey,\n sessionManager,\n currentMessageId,\n });\n },\n\n async run(message, responder, platform) {\n activeMessage = message;\n stopped = false;\n let presentation: RunPresentation | undefined;\n try {\n const prepared = await prepareRunContext({\n message,\n responder,\n platform,\n office,\n executor,\n resolveForRun,\n session,\n setEventContext: toolBindings.setEventContext,\n setSandboxContext: toolBindings.setSandboxContext,\n setUploadFunction: toolBindings.setUploadFunction,\n setImageUploadFunction: toolBindings.setImageUploadFunction,\n setReactFunction: toolBindings.setReactFunction,\n bindTasks: toolBindings.bindTasks,\n bindPlatformToolPacks: toolBindings.bindPlatformToolPacks,\n });\n if (stopped) return { stopReason: \"aborted\" };\n presentation = activateRunPresentation(runState, {\n responder,\n sessionConversation: prepared.sessionConversation,\n userName: message.userName,\n sessionUuid,\n triggerAttribution: prepared.triggerAttribution,\n });\n return await runPreparedTurn({\n prepared,\n presentation,\n message,\n responder,\n platform,\n runState,\n session,\n model,\n agentConfig,\n sessionUuid,\n conversationId,\n contextFile,\n sessionView,\n });\n } finally {\n activeMessage = undefined;\n presentation?.dispose();\n }\n },\n\n abort(): void {\n stopped = true;\n session.abort();\n },\n\n async dispose(): Promise<void> {\n await sessionManager.close();\n },\n\n getCurrentStep(): { toolName?: string; label?: string } | undefined {\n const first = runState.pendingTools.values().next().value;\n if (!first) return undefined;\n return {\n toolName: first.toolName,\n label: (first.args as { label?: string })?.label,\n };\n },\n };\n}\n\nasync function finishRunnerCreation(params: {\n options: CreateRunnerOptions;\n conversationId: string;\n conversationDir: string;\n workspaceDir: string;\n executor: Executor;\n resolveForRun: RunnerExecutionContext[\"resolveForRun\"];\n model: Model<Api>;\n modelRegistry: MikanModels;\n agentConfig: ReturnType<typeof resolveConversationSettings>;\n systemPrompt: string;\n sessionManager: Awaited<ReturnType<typeof openManagedSession>>;\n toolBindings: MikanToolBindings;\n toolContext: ExecutionToolContext;\n}): Promise<PiAgentWrapper> {\n const {\n options,\n conversationId,\n conversationDir,\n workspaceDir,\n executor,\n resolveForRun,\n model,\n modelRegistry,\n agentConfig,\n systemPrompt,\n sessionManager,\n toolBindings,\n toolContext,\n } = params;\n const { sessionKey, office, sessionScope, sessionView } = options;\n const { contextFile } = sessionScope;\n try {\n const sessionUuid = extractSessionUuid(contextFile);\n const chatSessionManager = new ChatHistorySync();\n const session = await createRunnerAgentSession({\n workspaceDir,\n systemPrompt,\n model,\n agentConfig,\n tools: toolBindings.tools,\n toolContext,\n sessionManager,\n modelRegistry,\n conversationId,\n signal: options.signal,\n });\n options.signal?.throwIfAborted();\n\n const runState = createRunState();\n attachSessionEventHandlers({ session, runState, model, agentConfig });\n\n return createRunnerInterface({\n conversationId,\n conversationDir,\n sessionKey,\n office,\n sessionUuid,\n contextFile,\n sessionView,\n runState,\n executor,\n resolveForRun,\n session,\n model,\n agentConfig,\n sessionManager,\n chatSessionManager,\n toolBindings,\n });\n } catch (error) {\n await rollbackRunnerResource(\"close the session writer\", () => sessionManager.close());\n throw error;\n }\n}\n\nexport async function createRunner(options: CreateRunnerOptions): Promise<PiAgentWrapper> {\n options.signal?.throwIfAborted();\n const {\n sandboxConfig,\n sessionKey,\n office,\n trustModel,\n sessionScope,\n vaultManager,\n provisioner,\n resourceController,\n platformToolPackFactories,\n } = options;\n const conversationId = office.address.conversationId;\n const conversationDir = office.dir;\n const workspaceDir = office.workspace.root;\n await ensureDefaultMcpServers({\n office,\n trustModel,\n platformWorkspaceId: options.platformWorkspaceId,\n openConnector: options.openConnector,\n signal: options.signal,\n });\n options.signal?.throwIfAborted();\n const resolvedAgentConfig = resolveConversationSettings(office);\n // open-trigger conversations get no MCP tools at all (see ARCHITECTURE.md).\n const agentConfig = {\n ...resolvedAgentConfig,\n mcpServers: trustModel === \"open-trigger\" ? {} : (resolvedAgentConfig.mcpServers ?? {}),\n };\n\n const projection = resolveWorkspaceProjection(office);\n // Bootstrap validation fails runner creation early. resolveForRun repeats\n // the check against the actor-specific decision before any provider call.\n assertSandboxSupportsWorkspacePolicy(sandboxConfig, projection.visibility, office.key);\n const { executor, resolveForRun } = createRunnerExecutionContext(\n sandboxConfig,\n vaultManager,\n provisioner,\n office.workspace,\n );\n const pathContext = getUnresolvedSandboxPathContext(sandboxConfig, workspaceDir);\n // The env wraps the stable executor wrapper, which delegates to the\n // actor-resolved executor per call, so one env serves every run.\n const toolContext: ExecutionToolContext = {\n env: createSandboxExecutionEnv(executor, sandboxConfig.type, pathContext.runtimeWorkspaceRoot),\n };\n\n const modelRegistry = options.models ?? MikanModels.create();\n if (modelRegistry.getError()) {\n log.logWarning(\"models.json load error\", modelRegistry.getError()!);\n }\n const model = modelRegistry.resolve(agentConfig.provider, agentConfig.model);\n\n // Create tools (per-runner, with per-runner upload function setter)\n const toolBindings = createMikanTools(\n executor,\n new OfficeEventStore(office, options.eventScheduler),\n { sandbox: sandboxConfig, resourceController: resourceController ?? provisioner },\n platformToolPackFactories ?? [],\n {\n model,\n getApiKey: () => modelRegistry.getApiKeyForProvider(model.provider),\n // The conversation's own office dir: mounted into the sandbox, unlike\n // the workspace base — generated images must land somewhere the agent\n // (and a future run) can still reach.\n outputDir: conversationDir,\n },\n );\n\n const systemPrompt = await buildInitialSystemPrompt({\n office,\n pathContext,\n projection,\n sandboxConfig,\n });\n options.signal?.throwIfAborted();\n const { contextFile, threadRootMessage } = sessionScope;\n const sessionManager = await openRunnerSessionManager({\n contextFile,\n runtimeWorkspaceRoot: pathContext.runtimeWorkspaceRoot,\n sessionKey,\n threadRootMessage,\n });\n return finishRunnerCreation({\n options,\n conversationId,\n conversationDir,\n workspaceDir,\n executor,\n resolveForRun,\n model,\n modelRegistry,\n agentConfig,\n systemPrompt,\n sessionManager,\n toolBindings,\n toolContext,\n });\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Office } from "./index.js";
|
|
2
|
+
import type { WorkspaceVisibility } from "../types.js";
|
|
2
3
|
import type { PlatformChannelKind, WorkspaceProjection } from "./types.js";
|
|
3
4
|
export type { PlatformChannelKind, WorkspaceProjection } from "./types.js";
|
|
4
5
|
/**
|
|
@@ -13,10 +14,26 @@ export type { PlatformChannelKind, WorkspaceProjection } from "./types.js";
|
|
|
13
14
|
export declare function recordPlatformChannelKind(office: Office, kind: PlatformChannelKind): void;
|
|
14
15
|
/** The recorded platform channel kind, or undefined when never observed. */
|
|
15
16
|
export declare function readPlatformChannelKind(office: Office): PlatformChannelKind | undefined;
|
|
17
|
+
/** Where an office's visibility came from; shown to operators instead of raw values. */
|
|
18
|
+
export interface OfficeVisibilityDecision {
|
|
19
|
+
visibility: WorkspaceVisibility;
|
|
20
|
+
source: "platform" | "override" | "unknown";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* One dimension, derived from the platform (ADR 0008): public channels are
|
|
24
|
+
* public; private channels, DMs, group DMs, and externally shared
|
|
25
|
+
* conversations are private; an unknown kind fails closed to private. An
|
|
26
|
+
* operator may narrow a public conversation to private, never the reverse.
|
|
27
|
+
* Legacy door-policy settings are not consulted.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveOfficeVisibility(office: Office): OfficeVisibilityDecision;
|
|
16
30
|
/**
|
|
17
31
|
* The single policy seam for a managed office. It both materializes the
|
|
18
32
|
* host-side roots and authorizes the prompt sources that describe them.
|
|
19
|
-
*
|
|
33
|
+
* Every office gets the same shape (ADR 0008): its own directory read-write,
|
|
34
|
+
* every other public office read-only under /workspace/public, and the
|
|
35
|
+
* workspace-global knowledge read-write for public offices or read-only for
|
|
36
|
+
* private ones. No layout mounts the workspace root.
|
|
20
37
|
*/
|
|
21
38
|
export declare function resolveWorkspaceProjection(office: Office): WorkspaceProjection;
|
|
22
39
|
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/office/projection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/office/projection.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAEhE,OAAO,KAAK,EAAkB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE3E,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAU3E;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAIzF;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAiBvF;AAED,wFAAwF;AACxF,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,mBAAmB,CAAC;IAChC,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,wBAAwB,CAOhF;AAsBD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAmC9E"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { dirname, join } from "node:path";
|
|
2
2
|
import { lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { atomicWritePrivateFile, ensureDirExists } from "../file-guards.js";
|
|
4
|
-
import {
|
|
4
|
+
import { loadOfficeVisibilityOverride } from "../config.js";
|
|
5
|
+
import { listRegisteredOffices } from "./index.js";
|
|
5
6
|
import * as log from "../log.js";
|
|
6
7
|
const CHANNEL_KIND_FILE = "channel-kind";
|
|
7
8
|
const CHANNEL_KINDS = [
|
|
@@ -35,7 +36,7 @@ export function readPlatformChannelKind(office) {
|
|
|
35
36
|
catch (err) {
|
|
36
37
|
if (err.code === "ENOENT")
|
|
37
38
|
return undefined;
|
|
38
|
-
log.logWarning("Could not read platform channel kind;
|
|
39
|
+
log.logWarning("Could not read platform channel kind; treating the office as private", `${path}: ${err instanceof Error ? err.message : String(err)}`);
|
|
39
40
|
return undefined;
|
|
40
41
|
}
|
|
41
42
|
const value = raw.trim();
|
|
@@ -43,119 +44,86 @@ export function readPlatformChannelKind(office) {
|
|
|
43
44
|
? value
|
|
44
45
|
: undefined;
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* One dimension, derived from the platform (ADR 0008): public channels are
|
|
49
|
+
* public; private channels, DMs, group DMs, and externally shared
|
|
50
|
+
* conversations are private; an unknown kind fails closed to private. An
|
|
51
|
+
* operator may narrow a public conversation to private, never the reverse.
|
|
52
|
+
* Legacy door-policy settings are not consulted.
|
|
53
|
+
*/
|
|
54
|
+
export function resolveOfficeVisibility(office) {
|
|
55
|
+
if (loadOfficeVisibilityOverride(office) === "private") {
|
|
56
|
+
return { visibility: "private", source: "override" };
|
|
57
|
+
}
|
|
58
|
+
const kind = readPlatformChannelKind(office);
|
|
59
|
+
if (kind === undefined)
|
|
60
|
+
return { visibility: "private", source: "unknown" };
|
|
61
|
+
return { visibility: kind === "public_channel" ? "public" : "private", source: "platform" };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Every public office other than `self`, as read-only mounts under
|
|
65
|
+
* `/workspace/public/<key>`. Bind mounts rather than a symlink directory:
|
|
66
|
+
* symlinks would resolve against the container's own filesystem, where host
|
|
67
|
+
* paths do not exist. A public channel appearing or changing visibility
|
|
68
|
+
* changes the mount signature, so affected containers rebuild on their next
|
|
69
|
+
* message with contents preserved.
|
|
70
|
+
*/
|
|
71
|
+
function publicOfficeMounts(self) {
|
|
72
|
+
const { workspace } = self;
|
|
73
|
+
const mounts = [];
|
|
74
|
+
for (const record of listRegisteredOffices(workspace.stateDir)) {
|
|
75
|
+
const other = workspace.office(record);
|
|
76
|
+
if (other.key === self.key || !exists(other.dir))
|
|
77
|
+
continue;
|
|
78
|
+
if (resolveOfficeVisibility(other).visibility !== "public")
|
|
79
|
+
continue;
|
|
80
|
+
mounts.push({ source: other.dir, target: `/workspace/public/${other.key}`, readOnly: true });
|
|
81
|
+
}
|
|
82
|
+
return mounts.toSorted((a, b) => a.target.localeCompare(b.target));
|
|
83
|
+
}
|
|
46
84
|
/**
|
|
47
85
|
* The single policy seam for a managed office. It both materializes the
|
|
48
86
|
* host-side roots and authorizes the prompt sources that describe them.
|
|
49
|
-
*
|
|
87
|
+
* Every office gets the same shape (ADR 0008): its own directory read-write,
|
|
88
|
+
* every other public office read-only under /workspace/public, and the
|
|
89
|
+
* workspace-global knowledge read-write for public offices or read-only for
|
|
90
|
+
* private ones. No layout mounts the workspace root.
|
|
50
91
|
*/
|
|
51
92
|
export function resolveWorkspaceProjection(office) {
|
|
52
93
|
const { workspace } = office;
|
|
53
|
-
const
|
|
94
|
+
const decision = resolveOfficeVisibility(office);
|
|
95
|
+
const readOnlyKnowledge = decision.visibility === "private";
|
|
54
96
|
assertDirectory(workspace.root, "Host workspace root");
|
|
55
97
|
office.ensure();
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
ensureDirectoryRoot(workspace.skillsDir, "Workspace skills");
|
|
60
|
-
}
|
|
61
|
-
// Private visibility only changes anything for shared-support: the shared
|
|
62
|
-
// MEMORY.md is the one file that leaks information between offices when
|
|
63
|
-
// writable, so a private office reads it but cannot write it (modeled on
|
|
64
|
-
// Claude Tag's private-channel memory). "full" mounts the whole workspace
|
|
65
|
-
// as one read-write bind with no separate memory file to gate, and
|
|
66
|
-
// "conversation" never sees workspace memory at all.
|
|
67
|
-
//
|
|
68
|
-
// The `readOnly` mount flag below is a kernel-enforced boundary only for
|
|
69
|
-
// backends with managed Workspace projection. Runner and actor execution
|
|
70
|
-
// resolution reject every other backend before the agent can start.
|
|
71
|
-
const globalMemoryReadOnly = shared && effective.visibility === "private";
|
|
72
|
-
const mounts = effective.layout === "full"
|
|
73
|
-
? [{ source: workspace.root, target: "/workspace" }]
|
|
74
|
-
: effective.layout === "shared-support"
|
|
75
|
-
? [
|
|
76
|
-
{
|
|
77
|
-
source: workspace.memoryPath,
|
|
78
|
-
target: "/workspace/MEMORY.md",
|
|
79
|
-
...(globalMemoryReadOnly ? { readOnly: true } : {}),
|
|
80
|
-
},
|
|
81
|
-
{ source: workspace.skillsDir, target: "/workspace/skills" },
|
|
82
|
-
{ source: office.dir, target: `/workspace/${office.key}` },
|
|
83
|
-
]
|
|
84
|
-
: [{ source: office.dir, target: `/workspace/${office.key}` }];
|
|
98
|
+
ensureRegularFile(workspace.memoryPath, "Workspace memory");
|
|
99
|
+
ensureDirectoryRoot(workspace.skillsDir, "Workspace skills");
|
|
100
|
+
const ro = { readOnly: true };
|
|
85
101
|
return {
|
|
86
|
-
...
|
|
87
|
-
mounts
|
|
102
|
+
...decision,
|
|
103
|
+
mounts: [
|
|
104
|
+
{ source: office.dir, target: `/workspace/${office.key}` },
|
|
105
|
+
{
|
|
106
|
+
source: workspace.memoryPath,
|
|
107
|
+
target: "/workspace/MEMORY.md",
|
|
108
|
+
...(readOnlyKnowledge ? ro : {}),
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
source: workspace.skillsDir,
|
|
112
|
+
target: "/workspace/skills",
|
|
113
|
+
...(readOnlyKnowledge ? ro : {}),
|
|
114
|
+
},
|
|
115
|
+
...publicOfficeMounts(office),
|
|
116
|
+
],
|
|
88
117
|
promptSources: {
|
|
89
118
|
conversationDir: office.dir,
|
|
90
119
|
conversationMemoryPath: office.memoryPath,
|
|
91
120
|
conversationSkillsDir: office.skillsDir,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
globalSkillsDir: workspace.skillsDir,
|
|
96
|
-
...(globalMemoryReadOnly ? { globalMemoryReadOnly: true } : {}),
|
|
97
|
-
}
|
|
98
|
-
: {}),
|
|
121
|
+
globalMemoryPath: workspace.memoryPath,
|
|
122
|
+
globalSkillsDir: workspace.skillsDir,
|
|
123
|
+
...(readOnlyKnowledge ? { globalKnowledgeReadOnly: true } : {}),
|
|
99
124
|
},
|
|
100
125
|
};
|
|
101
126
|
}
|
|
102
|
-
function resolveEffectiveWorkspace(office) {
|
|
103
|
-
try {
|
|
104
|
-
const settings = resolveConversationSettings(office).sandbox;
|
|
105
|
-
if (settings?.workspace) {
|
|
106
|
-
return normalizeWorkspace(settings.workspace.doorPolicy, settings.workspace.layout, settings.workspace.visibility);
|
|
107
|
-
}
|
|
108
|
-
if (settings?.image?.workspaceMount) {
|
|
109
|
-
return legacyWorkspace(settings.image.workspaceMount);
|
|
110
|
-
}
|
|
111
|
-
return platformDerivedWorkspace(office);
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
// Settings are host-authoritative. A malformed file must not fall back to
|
|
115
|
-
// an unvalidated value from a mounted legacy location.
|
|
116
|
-
log.logWarning("Refusing to resolve workspace projection from malformed settings", err instanceof Error ? err.message : String(err));
|
|
117
|
-
throw new Error("Cannot resolve workspace projection: settings are malformed", { cause: err });
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* No explicit workspace setting anywhere: follow the platform's own channel
|
|
122
|
-
* vocabulary (modeled on Claude Tag). A public channel's knowledge is shared
|
|
123
|
-
* workspace-wide read-write; a private channel reads the shared pool but
|
|
124
|
-
* writes only its own conversation memory; DMs, externally shared channels,
|
|
125
|
-
* and conversations whose kind was never observed stay fully isolated —
|
|
126
|
-
* platform-public is a necessary condition for sharing, never assumed.
|
|
127
|
-
* An admin's explicit setting (conversation or global) always wins over this.
|
|
128
|
-
*/
|
|
129
|
-
function platformDerivedWorkspace(office) {
|
|
130
|
-
switch (readPlatformChannelKind(office)) {
|
|
131
|
-
case "public_channel":
|
|
132
|
-
return { doorPolicy: "trusted", layout: "shared-support", visibility: "public" };
|
|
133
|
-
case "private_channel":
|
|
134
|
-
return { doorPolicy: "trusted", layout: "shared-support", visibility: "private" };
|
|
135
|
-
default:
|
|
136
|
-
return { doorPolicy: "isolated", layout: "conversation", visibility: "public" };
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function normalizeWorkspace(doorPolicy, layout, visibility) {
|
|
140
|
-
const policy = doorPolicy ?? "isolated";
|
|
141
|
-
if (policy === "isolated") {
|
|
142
|
-
return { doorPolicy: policy, layout: "conversation", visibility: "public" };
|
|
143
|
-
}
|
|
144
|
-
return {
|
|
145
|
-
doorPolicy: policy,
|
|
146
|
-
layout: layout === "full" ? "full" : "shared-support",
|
|
147
|
-
// Missing visibility defaults to "public": every office that predates this
|
|
148
|
-
// setting keeps today's read-write shared MEMORY.md behavior unchanged.
|
|
149
|
-
visibility: visibility ?? "public",
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
function legacyWorkspace(mode) {
|
|
153
|
-
return mode === "full"
|
|
154
|
-
? { doorPolicy: "trusted", layout: "full", visibility: "public" }
|
|
155
|
-
: mode === "private"
|
|
156
|
-
? { doorPolicy: "trusted", layout: "shared-support", visibility: "public" }
|
|
157
|
-
: { doorPolicy: "isolated", layout: "conversation", visibility: "public" };
|
|
158
|
-
}
|
|
159
127
|
function ensureDirectoryRoot(path, label) {
|
|
160
128
|
if (!exists(path)) {
|
|
161
129
|
mkdirSync(path, { recursive: true, mode: 0o700 });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../src/office/projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAA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AE,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,wCAAwC,IAAI,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,KAAa;IAClD,IAAI,KAAK,CAAC;IACV,IAAI,CAAC;QACH,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,yBAAyB,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,6CAA6C,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,IAAI,CAAC;QACH,SAAS,CAAC,IAAI,CAAC,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACnE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import { dirname, join } from \"node:path\";\nimport { lstatSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { atomicWritePrivateFile, ensureDirExists } from \"../file-guards.js\";\nimport { resolveConversationSettings } from \"../config.js\";\nimport type { Office } from \"./index.js\";\nimport * as log from \"../log.js\";\nimport type {\n ImageWorkspaceMountMode,\n WorkspaceDoorPolicy,\n WorkspaceLayout,\n WorkspaceVisibility,\n} from \"../types.js\";\nimport type { PlatformChannelKind, WorkspaceProjection } from \"./types.js\";\n\nexport type { PlatformChannelKind, WorkspaceProjection } from \"./types.js\";\n\nconst CHANNEL_KIND_FILE = \"channel-kind\";\nconst CHANNEL_KINDS: readonly PlatformChannelKind[] = [\n \"public_channel\",\n \"private_channel\",\n \"im\",\n \"external\",\n];\n\n/**\n * Record the platform's own channel kind for this conversation, as observed\n * by the adapter at message intake. Stored under the host-only office state\n * dir (never the sandbox-mounted workspace), so sandboxed code cannot\n * promote its own conversation into the shared pool. Written only on change;\n * the value is a snapshot as of the last message, which is exactly the\n * freshness the projection needs — a conversation that never speaks again\n * never needs a fresher value.\n */\nexport function recordPlatformChannelKind(office: Office, kind: PlatformChannelKind): void {\n if (readPlatformChannelKind(office) === kind) return;\n ensureDirExists(office.stateDir);\n atomicWritePrivateFile(join(office.stateDir, CHANNEL_KIND_FILE), kind + \"\\n\");\n}\n\n/** The recorded platform channel kind, or undefined when never observed. */\nexport function readPlatformChannelKind(office: Office): PlatformChannelKind | undefined {\n const path = join(office.stateDir, CHANNEL_KIND_FILE);\n let raw: string;\n try {\n raw = readFileSync(path, \"utf-8\");\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return undefined;\n log.logWarning(\n \"Could not read platform channel kind; falling back to isolated workspace\",\n `${path}: ${err instanceof Error ? err.message : String(err)}`,\n );\n return undefined;\n }\n const value = raw.trim();\n return (CHANNEL_KINDS as readonly string[]).includes(value)\n ? (value as PlatformChannelKind)\n : undefined;\n}\n\n/**\n * The single policy seam for a managed office. It both materializes the\n * host-side roots and authorizes the prompt sources that describe them.\n * Legacy image settings are deliberately translated here, never at callers.\n */\nexport function resolveWorkspaceProjection(office: Office): WorkspaceProjection {\n const { workspace } = office;\n const effective = resolveEffectiveWorkspace(office);\n\n assertDirectory(workspace.root, \"Host workspace root\");\n office.ensure();\n const shared = effective.layout === \"shared-support\";\n if (shared) {\n ensureRegularFile(workspace.memoryPath, \"Workspace memory\");\n ensureDirectoryRoot(workspace.skillsDir, \"Workspace skills\");\n }\n\n // Private visibility only changes anything for shared-support: the shared\n // MEMORY.md is the one file that leaks information between offices when\n // writable, so a private office reads it but cannot write it (modeled on\n // Claude Tag's private-channel memory). \"full\" mounts the whole workspace\n // as one read-write bind with no separate memory file to gate, and\n // \"conversation\" never sees workspace memory at all.\n //\n // The `readOnly` mount flag below is a kernel-enforced boundary only for\n // backends with managed Workspace projection. Runner and actor execution\n // resolution reject every other backend before the agent can start.\n const globalMemoryReadOnly = shared && effective.visibility === \"private\";\n const mounts =\n effective.layout === \"full\"\n ? [{ source: workspace.root, target: \"/workspace\" }]\n : effective.layout === \"shared-support\"\n ? [\n {\n source: workspace.memoryPath,\n target: \"/workspace/MEMORY.md\",\n ...(globalMemoryReadOnly ? { readOnly: true as const } : {}),\n },\n { source: workspace.skillsDir, target: \"/workspace/skills\" },\n { source: office.dir, target: `/workspace/${office.key}` },\n ]\n : [{ source: office.dir, target: `/workspace/${office.key}` }];\n\n return {\n ...effective,\n mounts,\n promptSources: {\n conversationDir: office.dir,\n conversationMemoryPath: office.memoryPath,\n conversationSkillsDir: office.skillsDir,\n ...(effective.layout === \"shared-support\" || effective.layout === \"full\"\n ? {\n globalMemoryPath: workspace.memoryPath,\n globalSkillsDir: workspace.skillsDir,\n ...(globalMemoryReadOnly ? { globalMemoryReadOnly: true } : {}),\n }\n : {}),\n },\n };\n}\n\nfunction resolveEffectiveWorkspace(\n office: Office,\n): Pick<WorkspaceProjection, \"doorPolicy\" | \"layout\" | \"visibility\"> {\n try {\n const settings = resolveConversationSettings(office).sandbox;\n if (settings?.workspace) {\n return normalizeWorkspace(\n settings.workspace.doorPolicy,\n settings.workspace.layout,\n settings.workspace.visibility,\n );\n }\n if (settings?.image?.workspaceMount) {\n return legacyWorkspace(settings.image.workspaceMount);\n }\n return platformDerivedWorkspace(office);\n } catch (err) {\n // Settings are host-authoritative. A malformed file must not fall back to\n // an unvalidated value from a mounted legacy location.\n log.logWarning(\n \"Refusing to resolve workspace projection from malformed settings\",\n err instanceof Error ? err.message : String(err),\n );\n throw new Error(\"Cannot resolve workspace projection: settings are malformed\", { cause: err });\n }\n}\n\n/**\n * No explicit workspace setting anywhere: follow the platform's own channel\n * vocabulary (modeled on Claude Tag). A public channel's knowledge is shared\n * workspace-wide read-write; a private channel reads the shared pool but\n * writes only its own conversation memory; DMs, externally shared channels,\n * and conversations whose kind was never observed stay fully isolated —\n * platform-public is a necessary condition for sharing, never assumed.\n * An admin's explicit setting (conversation or global) always wins over this.\n */\nfunction platformDerivedWorkspace(\n office: Office,\n): Pick<WorkspaceProjection, \"doorPolicy\" | \"layout\" | \"visibility\"> {\n switch (readPlatformChannelKind(office)) {\n case \"public_channel\":\n return { doorPolicy: \"trusted\", layout: \"shared-support\", visibility: \"public\" };\n case \"private_channel\":\n return { doorPolicy: \"trusted\", layout: \"shared-support\", visibility: \"private\" };\n default:\n return { doorPolicy: \"isolated\", layout: \"conversation\", visibility: \"public\" };\n }\n}\n\nfunction normalizeWorkspace(\n doorPolicy: WorkspaceDoorPolicy | undefined,\n layout: WorkspaceLayout | undefined,\n visibility: WorkspaceVisibility | undefined,\n): Pick<WorkspaceProjection, \"doorPolicy\" | \"layout\" | \"visibility\"> {\n const policy = doorPolicy ?? \"isolated\";\n if (policy === \"isolated\") {\n return { doorPolicy: policy, layout: \"conversation\", visibility: \"public\" };\n }\n return {\n doorPolicy: policy,\n layout: layout === \"full\" ? \"full\" : \"shared-support\",\n // Missing visibility defaults to \"public\": every office that predates this\n // setting keeps today's read-write shared MEMORY.md behavior unchanged.\n visibility: visibility ?? \"public\",\n };\n}\n\nfunction legacyWorkspace(\n mode: ImageWorkspaceMountMode | undefined,\n): Pick<WorkspaceProjection, \"doorPolicy\" | \"layout\" | \"visibility\"> {\n return mode === \"full\"\n ? { doorPolicy: \"trusted\", layout: \"full\", visibility: \"public\" }\n : mode === \"private\"\n ? { doorPolicy: \"trusted\", layout: \"shared-support\", visibility: \"public\" }\n : { doorPolicy: \"isolated\", layout: \"conversation\", visibility: \"public\" };\n}\n\nfunction ensureDirectoryRoot(path: string, label: string): void {\n if (!exists(path)) {\n mkdirSync(path, { recursive: true, mode: 0o700 });\n return;\n }\n assertDirectory(path, label);\n}\n\nfunction ensureRegularFile(path: string, label: string): void {\n if (!exists(path)) {\n ensureDirExists(dirname(path));\n writeFileSync(path, \"\", { mode: 0o600, flag: \"wx\" });\n return;\n }\n let stats;\n try {\n stats = lstatSync(path);\n } catch (err) {\n throw new Error(`${label} cannot be inspected: ${path}`, { cause: err });\n }\n if (stats.isSymbolicLink() || !stats.isFile()) {\n throw new Error(`${label} must be a regular non-symlink file: ${path}`);\n }\n}\n\nfunction assertDirectory(path: string, label: string): void {\n let stats;\n try {\n stats = lstatSync(path);\n } catch (err) {\n throw new Error(`${label} cannot be inspected: ${path}`, { cause: err });\n }\n if (stats.isSymbolicLink() || !stats.isDirectory()) {\n throw new Error(`${label} must be a regular non-symlink directory: ${path}`);\n }\n}\n\nfunction exists(path: string): boolean {\n try {\n lstatSync(path);\n return true;\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return false;\n throw err;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../src/office/projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAe,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAMjC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AACzC,MAAM,aAAa,GAAmC;IACpD,gBAAg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AG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,yBAAyB,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,6CAA6C,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,IAAI,CAAC;QACH,SAAS,CAAC,IAAI,CAAC,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACnE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import { dirname, join } from \"node:path\";\nimport { lstatSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { atomicWritePrivateFile, ensureDirExists } from \"../file-guards.js\";\nimport { loadOfficeVisibilityOverride } from \"../config.js\";\nimport { listRegisteredOffices, type Office } from \"./index.js\";\nimport * as log from \"../log.js\";\nimport type { ContainerMount, WorkspaceVisibility } from \"../types.js\";\nimport type { PlatformChannelKind, WorkspaceProjection } from \"./types.js\";\n\nexport type { PlatformChannelKind, WorkspaceProjection } from \"./types.js\";\n\nconst CHANNEL_KIND_FILE = \"channel-kind\";\nconst CHANNEL_KINDS: readonly PlatformChannelKind[] = [\n \"public_channel\",\n \"private_channel\",\n \"im\",\n \"external\",\n];\n\n/**\n * Record the platform's own channel kind for this conversation, as observed\n * by the adapter at message intake. Stored under the host-only office state\n * dir (never the sandbox-mounted workspace), so sandboxed code cannot\n * promote its own conversation into the shared pool. Written only on change;\n * the value is a snapshot as of the last message, which is exactly the\n * freshness the projection needs — a conversation that never speaks again\n * never needs a fresher value.\n */\nexport function recordPlatformChannelKind(office: Office, kind: PlatformChannelKind): void {\n if (readPlatformChannelKind(office) === kind) return;\n ensureDirExists(office.stateDir);\n atomicWritePrivateFile(join(office.stateDir, CHANNEL_KIND_FILE), kind + \"\\n\");\n}\n\n/** The recorded platform channel kind, or undefined when never observed. */\nexport function readPlatformChannelKind(office: Office): PlatformChannelKind | undefined {\n const path = join(office.stateDir, CHANNEL_KIND_FILE);\n let raw: string;\n try {\n raw = readFileSync(path, \"utf-8\");\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return undefined;\n log.logWarning(\n \"Could not read platform channel kind; treating the office as private\",\n `${path}: ${err instanceof Error ? err.message : String(err)}`,\n );\n return undefined;\n }\n const value = raw.trim();\n return (CHANNEL_KINDS as readonly string[]).includes(value)\n ? (value as PlatformChannelKind)\n : undefined;\n}\n\n/** Where an office's visibility came from; shown to operators instead of raw values. */\nexport interface OfficeVisibilityDecision {\n visibility: WorkspaceVisibility;\n source: \"platform\" | \"override\" | \"unknown\";\n}\n\n/**\n * One dimension, derived from the platform (ADR 0008): public channels are\n * public; private channels, DMs, group DMs, and externally shared\n * conversations are private; an unknown kind fails closed to private. An\n * operator may narrow a public conversation to private, never the reverse.\n * Legacy door-policy settings are not consulted.\n */\nexport function resolveOfficeVisibility(office: Office): OfficeVisibilityDecision {\n if (loadOfficeVisibilityOverride(office) === \"private\") {\n return { visibility: \"private\", source: \"override\" };\n }\n const kind = readPlatformChannelKind(office);\n if (kind === undefined) return { visibility: \"private\", source: \"unknown\" };\n return { visibility: kind === \"public_channel\" ? \"public\" : \"private\", source: \"platform\" };\n}\n\n/**\n * Every public office other than `self`, as read-only mounts under\n * `/workspace/public/<key>`. Bind mounts rather than a symlink directory:\n * symlinks would resolve against the container's own filesystem, where host\n * paths do not exist. A public channel appearing or changing visibility\n * changes the mount signature, so affected containers rebuild on their next\n * message with contents preserved.\n */\nfunction publicOfficeMounts(self: Office): ContainerMount[] {\n const { workspace } = self;\n const mounts: ContainerMount[] = [];\n for (const record of listRegisteredOffices(workspace.stateDir)) {\n const other = workspace.office(record);\n if (other.key === self.key || !exists(other.dir)) continue;\n if (resolveOfficeVisibility(other).visibility !== \"public\") continue;\n mounts.push({ source: other.dir, target: `/workspace/public/${other.key}`, readOnly: true });\n }\n return mounts.toSorted((a, b) => a.target.localeCompare(b.target));\n}\n\n/**\n * The single policy seam for a managed office. It both materializes the\n * host-side roots and authorizes the prompt sources that describe them.\n * Every office gets the same shape (ADR 0008): its own directory read-write,\n * every other public office read-only under /workspace/public, and the\n * workspace-global knowledge read-write for public offices or read-only for\n * private ones. No layout mounts the workspace root.\n */\nexport function resolveWorkspaceProjection(office: Office): WorkspaceProjection {\n const { workspace } = office;\n const decision = resolveOfficeVisibility(office);\n const readOnlyKnowledge = decision.visibility === \"private\";\n\n assertDirectory(workspace.root, \"Host workspace root\");\n office.ensure();\n ensureRegularFile(workspace.memoryPath, \"Workspace memory\");\n ensureDirectoryRoot(workspace.skillsDir, \"Workspace skills\");\n const ro = { readOnly: true as const };\n return {\n ...decision,\n mounts: [\n { source: office.dir, target: `/workspace/${office.key}` },\n {\n source: workspace.memoryPath,\n target: \"/workspace/MEMORY.md\",\n ...(readOnlyKnowledge ? ro : {}),\n },\n {\n source: workspace.skillsDir,\n target: \"/workspace/skills\",\n ...(readOnlyKnowledge ? ro : {}),\n },\n ...publicOfficeMounts(office),\n ],\n promptSources: {\n conversationDir: office.dir,\n conversationMemoryPath: office.memoryPath,\n conversationSkillsDir: office.skillsDir,\n globalMemoryPath: workspace.memoryPath,\n globalSkillsDir: workspace.skillsDir,\n ...(readOnlyKnowledge ? { globalKnowledgeReadOnly: true } : {}),\n },\n };\n}\n\nfunction ensureDirectoryRoot(path: string, label: string): void {\n if (!exists(path)) {\n mkdirSync(path, { recursive: true, mode: 0o700 });\n return;\n }\n assertDirectory(path, label);\n}\n\nfunction ensureRegularFile(path: string, label: string): void {\n if (!exists(path)) {\n ensureDirExists(dirname(path));\n writeFileSync(path, \"\", { mode: 0o600, flag: \"wx\" });\n return;\n }\n let stats;\n try {\n stats = lstatSync(path);\n } catch (err) {\n throw new Error(`${label} cannot be inspected: ${path}`, { cause: err });\n }\n if (stats.isSymbolicLink() || !stats.isFile()) {\n throw new Error(`${label} must be a regular non-symlink file: ${path}`);\n }\n}\n\nfunction assertDirectory(path: string, label: string): void {\n let stats;\n try {\n stats = lstatSync(path);\n } catch (err) {\n throw new Error(`${label} cannot be inspected: ${path}`, { cause: err });\n }\n if (stats.isSymbolicLink() || !stats.isDirectory()) {\n throw new Error(`${label} must be a regular non-symlink directory: ${path}`);\n }\n}\n\nfunction exists(path: string): boolean {\n try {\n lstatSync(path);\n return true;\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return false;\n throw err;\n }\n}\n"]}
|
package/dist/office/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContainerMount, OfficeAddress, OfficeKey,
|
|
1
|
+
import type { ContainerMount, OfficeAddress, OfficeKey, WorkspaceVisibility } from "../types.js";
|
|
2
2
|
export interface OfficeMigrationRunSummary {
|
|
3
3
|
/** Raw ids whose directories moved to the office-key layout this run. */
|
|
4
4
|
migrated: string[];
|
|
@@ -97,16 +97,15 @@ interface WorkspacePromptSources {
|
|
|
97
97
|
conversationDir: string;
|
|
98
98
|
conversationMemoryPath: string;
|
|
99
99
|
conversationSkillsDir: string;
|
|
100
|
-
globalMemoryPath
|
|
101
|
-
globalSkillsDir
|
|
102
|
-
/** True
|
|
103
|
-
|
|
100
|
+
globalMemoryPath: string;
|
|
101
|
+
globalSkillsDir: string;
|
|
102
|
+
/** True for private offices: global MEMORY.md and skills are mounted read-only. */
|
|
103
|
+
globalKnowledgeReadOnly?: boolean;
|
|
104
104
|
}
|
|
105
105
|
export interface WorkspaceProjection {
|
|
106
|
-
doorPolicy: WorkspaceDoorPolicy;
|
|
107
|
-
layout: WorkspaceLayout;
|
|
108
|
-
/** Only meaningful for shared-support layout; "public" is the default and preserves prior read-write behavior. */
|
|
109
106
|
visibility: WorkspaceVisibility;
|
|
107
|
+
/** Where the visibility came from, for operator display. */
|
|
108
|
+
source: "platform" | "override" | "unknown";
|
|
110
109
|
mounts: ContainerMount[];
|
|
111
110
|
promptSources: WorkspacePromptSources;
|
|
112
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/office/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/office/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEjG,MAAM,WAAW,yBAAyB;IACxC,yEAAyE;IACzE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uEAAuE;IACvE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,wEAAwE;IACxE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,iEAAiE;IACjE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,yEAAyE;IACzE,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,gFAAgF;IAChF,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,kDAAkD;IAClD,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,gFAAgF;IAChF,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iDAAiD;IACjD,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