@agimon-ai/po-computer-use 0.0.0-alpha.162 → 0.0.0-alpha.163

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/README.md CHANGED
@@ -10,9 +10,9 @@ Session-scoped semantic computer control through the Po Desktop capability.
10
10
 
11
11
  ## Use
12
12
 
13
- In Desktop, enable Computer Use in host settings, then select the default-off **Computer Use** minor mode. Request control from the session's Activity section, available in web and native clients when the host supplies the capability. The Mac selects the application window and requires native confirmation. Only one session can hold a live Desktop run. The host opt-in setting remains Desktop-only; remote activation does not bypass it or the native grant.
13
+ In Desktop, enable Computer Use in host settings, then select the default-off **Computer Use** mode. Request control from the session's Activity section, available in web and native clients when the host supplies the capability. The Mac selects the application window and requires native confirmation. Only one session can hold a live Desktop run. The host opt-in setting remains Desktop-only; remote activation does not bypass it or the native grant.
14
14
 
15
- The `computer-use` minor mode exposes Activate, Deactivate, and Doctor actions. `/computer-use` reports the current state.
15
+ The `computer-use` mode exposes Activate, Deactivate, and Doctor actions. `/computer-use` reports the current state.
16
16
 
17
17
  While active, the package exposes three tools:
18
18
 
@@ -15,9 +15,9 @@ function bindMcpTool(context, name) {
15
15
  return {
16
16
  ...tool,
17
17
  execute(toolCallId, parameters, signal, onUpdate) {
18
- if (!(context.selection.read().state?.["minor-mode"] ?? []).includes("computer-use")) {
18
+ if (!(context.selection.read().state?.["mode"] ?? []).includes("computer-use")) {
19
19
  const inactiveTools = [...catalog.names()].sort().join(", ");
20
- throw new Error(`${MODE_LABEL} minor mode is inactive. Inactive ${MODE_LABEL} tools: ${inactiveTools}.`);
20
+ throw new Error(`${MODE_LABEL} mode is inactive. Inactive ${MODE_LABEL} tools: ${inactiveTools}.`);
21
21
  }
22
22
  const executionSignal = AbortSignal.any([context.signal, signal ?? context.signal]);
23
23
  return tool.execute(toolCallId, parameters, executionSignal, onUpdate, context.execution);
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.cjs","names":["defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineMcpPlugin","toolComputerAction","toolComputerExec","toolComputerState"],"sources":["../../src/types/computerUseApi.ts","../../src/services/mcpTools/index.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_action.mcp.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_exec.mcp.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_state.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import type { PoApiCaller } from '@agimon-ai/po-core/packageApi';\n\nexport const API_BASE_PATH = 'computer-use';\nexport const computerUseChannelType = 'computer_use_state';\nexport const COMPUTER_USE_MODE_ID = 'computer-use';\nexport const COMPUTER_USE_STATUS_KEY = 'po-computer-use';\nexport const COMPUTER_USE_MODE_STATUS_KEY = 'po-computer-use-mode';\nexport const COMPUTER_USE_MAX_DURATION_MS = 1_800 * 1_000;\nexport const COMPUTER_USE_DEFAULT_DURATION_MS = 300 * 1_000;\n/** The session lengths a person can pick when granting control, up to the maximum. */\nexport const COMPUTER_USE_DURATION_CHOICES_MS = [\n COMPUTER_USE_DEFAULT_DURATION_MS,\n 900_000,\n COMPUTER_USE_MAX_DURATION_MS,\n] as const;\nexport const COMPUTER_USE_CONFIRMATION_WINDOW_MS = 2 * 60 * 1_000;\n\n/**\n * Every path this API answers on, below its mount.\n *\n * The typed route table in `./apiRoutes` is built from this, the dispatcher\n * reads that table, and the hub channel addresses the broker with these same\n * strings, so a route cannot move on one side alone.\n */\nexport const COMPUTER_USE_ROUTES = {\n activate: '/activate',\n artifact: '/artifact',\n agentState: '/agent/state',\n agentObserve: '/agent/observe',\n agentAction: '/agent/action',\n agentStop: '/agent/stop',\n hubState: '/hub/state',\n hubActivation: '/hub/activation',\n hubAuthorization: '/hub/authorization',\n hubNext: '/hub/next',\n hubComplete: '/hub/complete',\n hubStop: '/hub/stop',\n} as const;\n\nexport const COMPUTER_USE_WAKE_LIMIT = 1_000_000;\n\nexport interface ComputerUseArtifactView {\n readonly artifactId: string;\n readonly status: 'ready' | 'failed';\n readonly sizeBytes?: number;\n readonly downloadUrl?: string;\n readonly previewUrl?: string;\n readonly actionCount?: number;\n readonly completedAt?: string;\n readonly failure?: { readonly code: string; readonly message: string };\n}\n\nexport interface ComputerUseSessionView {\n readonly sessionId: string;\n readonly revision: number;\n readonly wake: number;\n readonly phase: 'inactive' | 'awaiting_confirmation' | 'activating' | 'active' | 'stopping' | 'failed';\n readonly requestId?: string;\n readonly target?: Record<string, unknown>;\n readonly durationMs?: number;\n readonly expiresAt?: number;\n readonly failure?: { readonly code: string; readonly message: string };\n readonly artifact?: ComputerUseArtifactView;\n}\n\nexport interface ComputerUseActivationRequest {\n readonly requestId: string;\n readonly target?: Record<string, unknown>;\n readonly durationSeconds: number;\n readonly createdAt: number;\n readonly confirmationExpiresAt: number;\n /** Set by the session broker only after the person approves the in-app dialog. */\n readonly confirmedAt?: number;\n readonly caller: PoApiCaller;\n}\n\nexport interface ComputerUseBrokerRequest {\n readonly id: string;\n readonly operation: 'observe' | 'act';\n readonly payload?: unknown;\n readonly grantId: string;\n readonly sequence?: number;\n}\n\nexport interface ComputerUseChannelPayload {\n readonly state: ComputerUseSessionView;\n readonly targets: readonly Record<string, unknown>[];\n readonly busy?: true;\n}\n\nexport type ComputerUseBrowserCommand = { readonly action: 'status' | 'targets' | 'stop' | 'artifacts' };\n","import type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { COMPUTER_USE_MODE_ID } from '../../types/computerUseApi';\n\nexport const COMPUTER_USE_MCP_TOOLS_SERVICE = 'po/computer-use-mcp-tools';\n\nconst MODE_LABEL = 'Computer Use';\n\nexport interface McpToolCatalog {\n get(name: string): PoHeadlessTool | undefined;\n names(): readonly string[];\n}\n\nexport function mountMcpTools(tools: readonly PoHeadlessTool[]) {\n return (context: Context): void => {\n context.plugin((providerContext) => {\n providerContext.provide(COMPUTER_USE_MCP_TOOLS_SERVICE, {\n get: (name) => tools.find((tool) => tool.name === name),\n names: () => tools.map((tool) => tool.name),\n } satisfies McpToolCatalog);\n });\n };\n}\n\nexport function bindMcpTool(context: PoMcpPluginContext, name: string): PoHeadlessTool | undefined {\n const catalog = context.services.get<McpToolCatalog>(COMPUTER_USE_MCP_TOOLS_SERVICE);\n const tool = catalog?.get(name);\n if (!tool || !catalog) return undefined;\n return {\n ...tool,\n execute(toolCallId, parameters, signal, onUpdate) {\n const activeModes = context.selection.read().state?.['minor-mode'] ?? [];\n if (!activeModes.includes(COMPUTER_USE_MODE_ID)) {\n const inactiveTools = [...catalog.names()].sort().join(', ');\n throw new Error(`${MODE_LABEL} minor mode is inactive. Inactive ${MODE_LABEL} tools: ${inactiveTools}.`);\n }\n const executionSignal = AbortSignal.any([context.signal, signal ?? context.signal]);\n return tool.execute(toolCallId, parameters, executionSignal, onUpdate, context.execution);\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_action'), {\n cardinality: 'optional',\n});\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_exec'), {\n cardinality: 'optional',\n});\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_state'), {\n cardinality: 'optional',\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport toolComputerAction from '../src/extensions/workspaces/sessions/(backend)/tool/computer_action.mcp';\nimport toolComputerExec from '../src/extensions/workspaces/sessions/(backend)/tool/computer_exec.mcp';\nimport toolComputerState from '../src/extensions/workspaces/sessions/(backend)/tool/computer_state.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nconst withWidget = <T>(key: string, value: T): T => value === undefined ? value : ({\n ...value, _meta: { ...(value as { _meta?: object })._meta, [\"po/widget\"]: key },\n});\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-computer-use',\n session: (context) => ({\n get tools(): PoMcpSessionPlugin['tools'] { return defined([withWidget(\"@agimon-ai/po-computer-use/computer_action\", via({ name: 'computer_action' }, at(toolComputerAction, context))), withWidget(\"@agimon-ai/po-computer-use/computer_exec\", via({ name: 'computer_exec' }, at(toolComputerExec, context))), withWidget(\"@agimon-ai/po-computer-use/computer_state\", via({ name: 'computer_state' }, at(toolComputerState, context)))]); },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;;;;;ACMA,MAAa,iCAAiC;AAE9C,MAAM,aAAa;AAkBnB,SAAgB,YAAY,SAA6B,MAA0C;CACjG,MAAM,UAAU,QAAQ,SAAS,IAAoB,8BAA8B;CACnF,MAAM,OAAO,SAAS,IAAI,IAAI;CAC9B,IAAI,CAAC,QAAQ,CAAC,SAAS,OAAO,KAAA;CAC9B,OAAO;EACL,GAAG;EACH,QAAQ,YAAY,YAAY,QAAQ,UAAU;GAEhD,IAAI,EADgB,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AA8C,IAAI,EAAE,MAAM,kBAAkB,GAAG,GAAGC,6BAAoB,OAAO,CAAC,CAAC;GAAG,WAAW,4CAA4C,IAAI,EAAE,MAAM,gBAAgB,GAAG,GAAGC,2BAAkB,OAAO,CAAC,CAAC;GAAG,WAAW,6CAA6C,IAAI,EAAE,MAAM,iBAAiB,GAAG,GAAGC,4BAAmB,OAAO,CAAC,CAAC;EAAC,CAAC;CAAG,EAC7a;AACF,CAAC"}
1
+ {"version":3,"file":"mcp.cjs","names":["defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineMcpPlugin","toolComputerAction","toolComputerExec","toolComputerState"],"sources":["../../src/types/computerUseApi.ts","../../src/services/mcpTools/index.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_action.mcp.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_exec.mcp.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_state.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import type { PoApiCaller } from '@agimon-ai/po-core/packageApi';\n\nexport const API_BASE_PATH = 'computer-use';\nexport const computerUseChannelType = 'computer_use_state';\nexport const COMPUTER_USE_MODE_ID = 'computer-use';\nexport const COMPUTER_USE_STATUS_KEY = 'po-computer-use';\nexport const COMPUTER_USE_MODE_STATUS_KEY = 'po-computer-use-mode';\nexport const COMPUTER_USE_MAX_DURATION_MS = 1_800 * 1_000;\nexport const COMPUTER_USE_DEFAULT_DURATION_MS = 300 * 1_000;\n/** The session lengths a person can pick when granting control, up to the maximum. */\nexport const COMPUTER_USE_DURATION_CHOICES_MS = [\n COMPUTER_USE_DEFAULT_DURATION_MS,\n 900_000,\n COMPUTER_USE_MAX_DURATION_MS,\n] as const;\nexport const COMPUTER_USE_CONFIRMATION_WINDOW_MS = 2 * 60 * 1_000;\n\n/**\n * Every path this API answers on, below its mount.\n *\n * The typed route table in `./apiRoutes` is built from this, the dispatcher\n * reads that table, and the hub channel addresses the broker with these same\n * strings, so a route cannot move on one side alone.\n */\nexport const COMPUTER_USE_ROUTES = {\n activate: '/activate',\n artifact: '/artifact',\n agentState: '/agent/state',\n agentObserve: '/agent/observe',\n agentAction: '/agent/action',\n agentStop: '/agent/stop',\n hubState: '/hub/state',\n hubActivation: '/hub/activation',\n hubAuthorization: '/hub/authorization',\n hubNext: '/hub/next',\n hubComplete: '/hub/complete',\n hubStop: '/hub/stop',\n} as const;\n\nexport const COMPUTER_USE_WAKE_LIMIT = 1_000_000;\n\nexport interface ComputerUseArtifactView {\n readonly artifactId: string;\n readonly status: 'ready' | 'failed';\n readonly sizeBytes?: number;\n readonly downloadUrl?: string;\n readonly previewUrl?: string;\n readonly actionCount?: number;\n readonly completedAt?: string;\n readonly failure?: { readonly code: string; readonly message: string };\n}\n\nexport interface ComputerUseSessionView {\n readonly sessionId: string;\n readonly revision: number;\n readonly wake: number;\n readonly phase: 'inactive' | 'awaiting_confirmation' | 'activating' | 'active' | 'stopping' | 'failed';\n readonly requestId?: string;\n readonly target?: Record<string, unknown>;\n readonly durationMs?: number;\n readonly expiresAt?: number;\n readonly failure?: { readonly code: string; readonly message: string };\n readonly artifact?: ComputerUseArtifactView;\n}\n\nexport interface ComputerUseActivationRequest {\n readonly requestId: string;\n readonly target?: Record<string, unknown>;\n readonly durationSeconds: number;\n readonly createdAt: number;\n readonly confirmationExpiresAt: number;\n /** Set by the session broker only after the person approves the in-app dialog. */\n readonly confirmedAt?: number;\n readonly caller: PoApiCaller;\n}\n\nexport interface ComputerUseBrokerRequest {\n readonly id: string;\n readonly operation: 'observe' | 'act';\n readonly payload?: unknown;\n readonly grantId: string;\n readonly sequence?: number;\n}\n\nexport interface ComputerUseChannelPayload {\n readonly state: ComputerUseSessionView;\n readonly targets: readonly Record<string, unknown>[];\n readonly busy?: true;\n}\n\nexport type ComputerUseBrowserCommand = { readonly action: 'status' | 'targets' | 'stop' | 'artifacts' };\n","import type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { COMPUTER_USE_MODE_ID } from '../../types/computerUseApi';\n\nexport const COMPUTER_USE_MCP_TOOLS_SERVICE = 'po/computer-use-mcp-tools';\n\nconst MODE_LABEL = 'Computer Use';\n\nexport interface McpToolCatalog {\n get(name: string): PoHeadlessTool | undefined;\n names(): readonly string[];\n}\n\nexport function mountMcpTools(tools: readonly PoHeadlessTool[]) {\n return (context: Context): void => {\n context.plugin((providerContext) => {\n providerContext.provide(COMPUTER_USE_MCP_TOOLS_SERVICE, {\n get: (name) => tools.find((tool) => tool.name === name),\n names: () => tools.map((tool) => tool.name),\n } satisfies McpToolCatalog);\n });\n };\n}\n\nexport function bindMcpTool(context: PoMcpPluginContext, name: string): PoHeadlessTool | undefined {\n const catalog = context.services.get<McpToolCatalog>(COMPUTER_USE_MCP_TOOLS_SERVICE);\n const tool = catalog?.get(name);\n if (!tool || !catalog) return undefined;\n return {\n ...tool,\n execute(toolCallId, parameters, signal, onUpdate) {\n const activeModes = context.selection.read().state?.['mode'] ?? [];\n if (!activeModes.includes(COMPUTER_USE_MODE_ID)) {\n const inactiveTools = [...catalog.names()].sort().join(', ');\n throw new Error(`${MODE_LABEL} mode is inactive. Inactive ${MODE_LABEL} tools: ${inactiveTools}.`);\n }\n const executionSignal = AbortSignal.any([context.signal, signal ?? context.signal]);\n return tool.execute(toolCallId, parameters, executionSignal, onUpdate, context.execution);\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_action'), {\n cardinality: 'optional',\n});\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_exec'), {\n cardinality: 'optional',\n});\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_state'), {\n cardinality: 'optional',\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport toolComputerAction from '../src/extensions/workspaces/sessions/(backend)/tool/computer_action.mcp';\nimport toolComputerExec from '../src/extensions/workspaces/sessions/(backend)/tool/computer_exec.mcp';\nimport toolComputerState from '../src/extensions/workspaces/sessions/(backend)/tool/computer_state.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nconst withWidget = <T>(key: string, value: T): T => value === undefined ? value : ({\n ...value, _meta: { ...(value as { _meta?: object })._meta, [\"po/widget\"]: key },\n});\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-computer-use',\n session: (context) => ({\n get tools(): PoMcpSessionPlugin['tools'] { return defined([withWidget(\"@agimon-ai/po-computer-use/computer_action\", via({ name: 'computer_action' }, at(toolComputerAction, context))), withWidget(\"@agimon-ai/po-computer-use/computer_exec\", via({ name: 'computer_exec' }, at(toolComputerExec, context))), withWidget(\"@agimon-ai/po-computer-use/computer_state\", via({ name: 'computer_state' }, at(toolComputerState, context)))]); },\n }) satisfies PoMcpSessionPlugin,\n});\n\n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AU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAM,cAAiB,KAAa,UAAgB,UAAU,KAAA,IAAY,QAAS;CACjF,GAAG;CAAO,OAAO;EAAE,GAAI,MAA6B;GAAQ,cAAc;CAAI;AAChF;AAEA,MAAa,OAAA,GAAMC,4BAAAA,gBAAAA,CAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,QAAqC;EAAE,OAAO,QAAQ;GAAC,WAAW,8CAA8C,IAAI,EAAE,MAAM,kBAAkB,GAAG,GAAGC,6BAAoB,OAAO,CAAC,CAAC;GAAG,WAAW,4CAA4C,IAAI,EAAE,MAAM,gBAAgB,GAAG,GAAGC,2BAAkB,OAAO,CAAC,CAAC;GAAG,WAAW,6CAA6C,IAAI,EAAE,MAAM,iBAAiB,GAAG,GAAGC,4BAAmB,OAAO,CAAC,CAAC;EAAC,CAAC;CAAG,EAC7a;AACF,CAAC"}
@@ -11,9 +11,9 @@ function bindMcpTool(context, name) {
11
11
  return {
12
12
  ...tool,
13
13
  execute(toolCallId, parameters, signal, onUpdate) {
14
- if (!(context.selection.read().state?.["minor-mode"] ?? []).includes("computer-use")) {
14
+ if (!(context.selection.read().state?.["mode"] ?? []).includes("computer-use")) {
15
15
  const inactiveTools = [...catalog.names()].sort().join(", ");
16
- throw new Error(`${MODE_LABEL} minor mode is inactive. Inactive ${MODE_LABEL} tools: ${inactiveTools}.`);
16
+ throw new Error(`${MODE_LABEL} mode is inactive. Inactive ${MODE_LABEL} tools: ${inactiveTools}.`);
17
17
  }
18
18
  const executionSignal = AbortSignal.any([context.signal, signal ?? context.signal]);
19
19
  return tool.execute(toolCallId, parameters, executionSignal, onUpdate, context.execution);
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.mjs","names":["toolComputerAction","toolComputerExec","toolComputerState"],"sources":["../../src/types/computerUseApi.ts","../../src/services/mcpTools/index.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_action.mcp.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_exec.mcp.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_state.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import type { PoApiCaller } from '@agimon-ai/po-core/packageApi';\n\nexport const API_BASE_PATH = 'computer-use';\nexport const computerUseChannelType = 'computer_use_state';\nexport const COMPUTER_USE_MODE_ID = 'computer-use';\nexport const COMPUTER_USE_STATUS_KEY = 'po-computer-use';\nexport const COMPUTER_USE_MODE_STATUS_KEY = 'po-computer-use-mode';\nexport const COMPUTER_USE_MAX_DURATION_MS = 1_800 * 1_000;\nexport const COMPUTER_USE_DEFAULT_DURATION_MS = 300 * 1_000;\n/** The session lengths a person can pick when granting control, up to the maximum. */\nexport const COMPUTER_USE_DURATION_CHOICES_MS = [\n COMPUTER_USE_DEFAULT_DURATION_MS,\n 900_000,\n COMPUTER_USE_MAX_DURATION_MS,\n] as const;\nexport const COMPUTER_USE_CONFIRMATION_WINDOW_MS = 2 * 60 * 1_000;\n\n/**\n * Every path this API answers on, below its mount.\n *\n * The typed route table in `./apiRoutes` is built from this, the dispatcher\n * reads that table, and the hub channel addresses the broker with these same\n * strings, so a route cannot move on one side alone.\n */\nexport const COMPUTER_USE_ROUTES = {\n activate: '/activate',\n artifact: '/artifact',\n agentState: '/agent/state',\n agentObserve: '/agent/observe',\n agentAction: '/agent/action',\n agentStop: '/agent/stop',\n hubState: '/hub/state',\n hubActivation: '/hub/activation',\n hubAuthorization: '/hub/authorization',\n hubNext: '/hub/next',\n hubComplete: '/hub/complete',\n hubStop: '/hub/stop',\n} as const;\n\nexport const COMPUTER_USE_WAKE_LIMIT = 1_000_000;\n\nexport interface ComputerUseArtifactView {\n readonly artifactId: string;\n readonly status: 'ready' | 'failed';\n readonly sizeBytes?: number;\n readonly downloadUrl?: string;\n readonly previewUrl?: string;\n readonly actionCount?: number;\n readonly completedAt?: string;\n readonly failure?: { readonly code: string; readonly message: string };\n}\n\nexport interface ComputerUseSessionView {\n readonly sessionId: string;\n readonly revision: number;\n readonly wake: number;\n readonly phase: 'inactive' | 'awaiting_confirmation' | 'activating' | 'active' | 'stopping' | 'failed';\n readonly requestId?: string;\n readonly target?: Record<string, unknown>;\n readonly durationMs?: number;\n readonly expiresAt?: number;\n readonly failure?: { readonly code: string; readonly message: string };\n readonly artifact?: ComputerUseArtifactView;\n}\n\nexport interface ComputerUseActivationRequest {\n readonly requestId: string;\n readonly target?: Record<string, unknown>;\n readonly durationSeconds: number;\n readonly createdAt: number;\n readonly confirmationExpiresAt: number;\n /** Set by the session broker only after the person approves the in-app dialog. */\n readonly confirmedAt?: number;\n readonly caller: PoApiCaller;\n}\n\nexport interface ComputerUseBrokerRequest {\n readonly id: string;\n readonly operation: 'observe' | 'act';\n readonly payload?: unknown;\n readonly grantId: string;\n readonly sequence?: number;\n}\n\nexport interface ComputerUseChannelPayload {\n readonly state: ComputerUseSessionView;\n readonly targets: readonly Record<string, unknown>[];\n readonly busy?: true;\n}\n\nexport type ComputerUseBrowserCommand = { readonly action: 'status' | 'targets' | 'stop' | 'artifacts' };\n","import type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { COMPUTER_USE_MODE_ID } from '../../types/computerUseApi';\n\nexport const COMPUTER_USE_MCP_TOOLS_SERVICE = 'po/computer-use-mcp-tools';\n\nconst MODE_LABEL = 'Computer Use';\n\nexport interface McpToolCatalog {\n get(name: string): PoHeadlessTool | undefined;\n names(): readonly string[];\n}\n\nexport function mountMcpTools(tools: readonly PoHeadlessTool[]) {\n return (context: Context): void => {\n context.plugin((providerContext) => {\n providerContext.provide(COMPUTER_USE_MCP_TOOLS_SERVICE, {\n get: (name) => tools.find((tool) => tool.name === name),\n names: () => tools.map((tool) => tool.name),\n } satisfies McpToolCatalog);\n });\n };\n}\n\nexport function bindMcpTool(context: PoMcpPluginContext, name: string): PoHeadlessTool | undefined {\n const catalog = context.services.get<McpToolCatalog>(COMPUTER_USE_MCP_TOOLS_SERVICE);\n const tool = catalog?.get(name);\n if (!tool || !catalog) return undefined;\n return {\n ...tool,\n execute(toolCallId, parameters, signal, onUpdate) {\n const activeModes = context.selection.read().state?.['minor-mode'] ?? [];\n if (!activeModes.includes(COMPUTER_USE_MODE_ID)) {\n const inactiveTools = [...catalog.names()].sort().join(', ');\n throw new Error(`${MODE_LABEL} minor mode is inactive. Inactive ${MODE_LABEL} tools: ${inactiveTools}.`);\n }\n const executionSignal = AbortSignal.any([context.signal, signal ?? context.signal]);\n return tool.execute(toolCallId, parameters, executionSignal, onUpdate, context.execution);\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_action'), {\n cardinality: 'optional',\n});\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_exec'), {\n cardinality: 'optional',\n});\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_state'), {\n cardinality: 'optional',\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport toolComputerAction from '../src/extensions/workspaces/sessions/(backend)/tool/computer_action.mcp';\nimport toolComputerExec from '../src/extensions/workspaces/sessions/(backend)/tool/computer_exec.mcp';\nimport toolComputerState from '../src/extensions/workspaces/sessions/(backend)/tool/computer_state.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nconst withWidget = <T>(key: string, value: T): T => value === undefined ? value : ({\n ...value, _meta: { ...(value as { _meta?: object })._meta, [\"po/widget\"]: key },\n});\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-computer-use',\n session: (context) => ({\n get tools(): PoMcpSessionPlugin['tools'] { return defined([withWidget(\"@agimon-ai/po-computer-use/computer_action\", via({ name: 'computer_action' }, at(toolComputerAction, context))), withWidget(\"@agimon-ai/po-computer-use/computer_exec\", via({ name: 'computer_exec' }, at(toolComputerExec, context))), withWidget(\"@agimon-ai/po-computer-use/computer_state\", via({ name: 'computer_state' }, at(toolComputerState, context)))]); },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;ACMA,MAAa,iCAAiC;AAE9C,MAAM,aAAa;AAkBnB,SAAgB,YAAY,SAA6B,MAA0C;CACjG,MAAM,UAAU,QAAQ,SAAS,IAAoB,8BAA8B;CACnF,MAAM,OAAO,SAAS,IAAI,IAAI;CAC9B,IAAI,CAAC,QAAQ,CAAC,SAAS,OAAO,KAAA;CAC9B,OAAO;EACL,GAAG;EACH,QAAQ,YAAY,YAAY,QAAQ,UAAU;GAEhD,IAAI,EADgB,QAAQ,UAAU,KAAK,CAAC,CAAC,QAAQ,iBAAiB,CAAC,EAAA,CACtD,SAAA,cAA6B,GAAG;IAC/C,MAAM,gBAAgB,CAAC,GAAG,QAAQ,MAAM,CAAC,CAAC,CAAC,KAAK,C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AC,CAAC;CAAG,EAC7a;AACF,CAAC"}
1
+ {"version":3,"file":"mcp.mjs","names":["toolComputerAction","toolComputerExec","toolComputerState"],"sources":["../../src/types/computerUseApi.ts","../../src/services/mcpTools/index.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_action.mcp.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_exec.mcp.ts","../../src/extensions/workspaces/sessions/(backend)/tool/computer_state.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import type { PoApiCaller } from '@agimon-ai/po-core/packageApi';\n\nexport const API_BASE_PATH = 'computer-use';\nexport const computerUseChannelType = 'computer_use_state';\nexport const COMPUTER_USE_MODE_ID = 'computer-use';\nexport const COMPUTER_USE_STATUS_KEY = 'po-computer-use';\nexport const COMPUTER_USE_MODE_STATUS_KEY = 'po-computer-use-mode';\nexport const COMPUTER_USE_MAX_DURATION_MS = 1_800 * 1_000;\nexport const COMPUTER_USE_DEFAULT_DURATION_MS = 300 * 1_000;\n/** The session lengths a person can pick when granting control, up to the maximum. */\nexport const COMPUTER_USE_DURATION_CHOICES_MS = [\n COMPUTER_USE_DEFAULT_DURATION_MS,\n 900_000,\n COMPUTER_USE_MAX_DURATION_MS,\n] as const;\nexport const COMPUTER_USE_CONFIRMATION_WINDOW_MS = 2 * 60 * 1_000;\n\n/**\n * Every path this API answers on, below its mount.\n *\n * The typed route table in `./apiRoutes` is built from this, the dispatcher\n * reads that table, and the hub channel addresses the broker with these same\n * strings, so a route cannot move on one side alone.\n */\nexport const COMPUTER_USE_ROUTES = {\n activate: '/activate',\n artifact: '/artifact',\n agentState: '/agent/state',\n agentObserve: '/agent/observe',\n agentAction: '/agent/action',\n agentStop: '/agent/stop',\n hubState: '/hub/state',\n hubActivation: '/hub/activation',\n hubAuthorization: '/hub/authorization',\n hubNext: '/hub/next',\n hubComplete: '/hub/complete',\n hubStop: '/hub/stop',\n} as const;\n\nexport const COMPUTER_USE_WAKE_LIMIT = 1_000_000;\n\nexport interface ComputerUseArtifactView {\n readonly artifactId: string;\n readonly status: 'ready' | 'failed';\n readonly sizeBytes?: number;\n readonly downloadUrl?: string;\n readonly previewUrl?: string;\n readonly actionCount?: number;\n readonly completedAt?: string;\n readonly failure?: { readonly code: string; readonly message: string };\n}\n\nexport interface ComputerUseSessionView {\n readonly sessionId: string;\n readonly revision: number;\n readonly wake: number;\n readonly phase: 'inactive' | 'awaiting_confirmation' | 'activating' | 'active' | 'stopping' | 'failed';\n readonly requestId?: string;\n readonly target?: Record<string, unknown>;\n readonly durationMs?: number;\n readonly expiresAt?: number;\n readonly failure?: { readonly code: string; readonly message: string };\n readonly artifact?: ComputerUseArtifactView;\n}\n\nexport interface ComputerUseActivationRequest {\n readonly requestId: string;\n readonly target?: Record<string, unknown>;\n readonly durationSeconds: number;\n readonly createdAt: number;\n readonly confirmationExpiresAt: number;\n /** Set by the session broker only after the person approves the in-app dialog. */\n readonly confirmedAt?: number;\n readonly caller: PoApiCaller;\n}\n\nexport interface ComputerUseBrokerRequest {\n readonly id: string;\n readonly operation: 'observe' | 'act';\n readonly payload?: unknown;\n readonly grantId: string;\n readonly sequence?: number;\n}\n\nexport interface ComputerUseChannelPayload {\n readonly state: ComputerUseSessionView;\n readonly targets: readonly Record<string, unknown>[];\n readonly busy?: true;\n}\n\nexport type ComputerUseBrowserCommand = { readonly action: 'status' | 'targets' | 'stop' | 'artifacts' };\n","import type { PoHeadlessTool } from '@agimon-ai/po-core/headless';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { COMPUTER_USE_MODE_ID } from '../../types/computerUseApi';\n\nexport const COMPUTER_USE_MCP_TOOLS_SERVICE = 'po/computer-use-mcp-tools';\n\nconst MODE_LABEL = 'Computer Use';\n\nexport interface McpToolCatalog {\n get(name: string): PoHeadlessTool | undefined;\n names(): readonly string[];\n}\n\nexport function mountMcpTools(tools: readonly PoHeadlessTool[]) {\n return (context: Context): void => {\n context.plugin((providerContext) => {\n providerContext.provide(COMPUTER_USE_MCP_TOOLS_SERVICE, {\n get: (name) => tools.find((tool) => tool.name === name),\n names: () => tools.map((tool) => tool.name),\n } satisfies McpToolCatalog);\n });\n };\n}\n\nexport function bindMcpTool(context: PoMcpPluginContext, name: string): PoHeadlessTool | undefined {\n const catalog = context.services.get<McpToolCatalog>(COMPUTER_USE_MCP_TOOLS_SERVICE);\n const tool = catalog?.get(name);\n if (!tool || !catalog) return undefined;\n return {\n ...tool,\n execute(toolCallId, parameters, signal, onUpdate) {\n const activeModes = context.selection.read().state?.['mode'] ?? [];\n if (!activeModes.includes(COMPUTER_USE_MODE_ID)) {\n const inactiveTools = [...catalog.names()].sort().join(', ');\n throw new Error(`${MODE_LABEL} mode is inactive. Inactive ${MODE_LABEL} tools: ${inactiveTools}.`);\n }\n const executionSignal = AbortSignal.any([context.signal, signal ?? context.signal]);\n return tool.execute(toolCallId, parameters, executionSignal, onUpdate, context.execution);\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_action'), {\n cardinality: 'optional',\n});\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_exec'), {\n cardinality: 'optional',\n});\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\n\nimport { bindMcpTool } from '../../../../../services/mcpTools';\n\nexport default defineRoutedContribution((context: PoMcpPluginContext) => bindMcpTool(context, 'computer_state'), {\n cardinality: 'optional',\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport toolComputerAction from '../src/extensions/workspaces/sessions/(backend)/tool/computer_action.mcp';\nimport toolComputerExec from '../src/extensions/workspaces/sessions/(backend)/tool/computer_exec.mcp';\nimport toolComputerState from '../src/extensions/workspaces/sessions/(backend)/tool/computer_state.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nconst withWidget = <T>(key: string, value: T): T => value === undefined ? value : ({\n ...value, _meta: { ...(value as { _meta?: object })._meta, [\"po/widget\"]: key },\n});\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-computer-use',\n session: (context) => ({\n get tools(): PoMcpSessionPlugin['tools'] { return defined([withWidget(\"@agimon-ai/po-computer-use/computer_action\", via({ name: 'computer_action' }, at(toolComputerAction, context))), withWidget(\"@agimon-ai/po-computer-use/computer_exec\", via({ name: 'computer_exec' }, at(toolComputerExec, context))), withWidget(\"@agimon-ai/po-computer-use/computer_state\", via({ name: 'computer_state' }, at(toolComputerState, context)))]); },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;ACMA,MAAa,iCAAiC;AAE9C,MAAM,aAAa;AAkBnB,SAAgB,YAAY,SAA6B,MAA0C;CACjG,MAAM,UAAU,QAAQ,SAAS,IAAoB,8BAA8B;CACnF,MAAM,OAAO,SAAS,IAAI,IAAI;CAC9B,IAAI,CAAC,QAAQ,CAAC,SAAS,OAAO,KAAA;CAC9B,OAAO;EACL,GAAG;EACH,QAAQ,YAAY,YAAY,QAAQ,UAAU;G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G,WAAW,4CAA4C,IAAI,EAAE,MAAM,gBAAgB,GAAG,GAAGC,2BAAkB,OAAO,CAAC,CAAC;GAAG,WAAW,6CAA6C,IAAI,EAAE,MAAM,iBAAiB,GAAG,GAAGC,4BAAmB,OAAO,CAAC,CAAC;EAAC,CAAC;CAAG,EAC7a;AACF,CAAC"}
@@ -10,7 +10,7 @@ let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin")
10
10
  let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
11
11
  let _agimon_ai_po_core_codemode = require("@agimon-ai/po-core/codemode");
12
12
  let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
13
- let _agimon_ai_po_minor_mode = require("@agimon-ai/po-minor-mode");
13
+ let _agimon_ai_po_mode = require("@agimon-ai/po-mode");
14
14
  //#region src/services/mcpTools/index.ts
15
15
  const COMPUTER_USE_MCP_TOOLS_SERVICE = "po/computer-use-mcp-tools";
16
16
  function mountMcpTools(tools) {
@@ -472,7 +472,7 @@ function createComputerUseServer(host, apiContext) {
472
472
  });
473
473
  }).catch(() => void 0);
474
474
  };
475
- const modeSelected = () => (host.context.selection.state?.["minor-mode"] ?? []).includes(require_extensionService.COMPUTER_USE_MODE_ID);
475
+ const modeSelected = () => (host.context.selection.state?.["mode"] ?? []).includes(require_extensionService.COMPUTER_USE_MODE_ID);
476
476
  const publishMode = () => modeOwner?.publish();
477
477
  const applyState = (next) => {
478
478
  state = next;
@@ -482,10 +482,10 @@ function createComputerUseServer(host, apiContext) {
482
482
  for (const listener of restrictionListeners) listener();
483
483
  };
484
484
  const selectMode = async (enabled) => {
485
- const modes = (host.context.selection.state?.["minor-mode"] ?? []).filter((mode) => mode !== require_extensionService.COMPUTER_USE_MODE_ID);
485
+ const modes = (host.context.selection.state?.["mode"] ?? []).filter((mode) => mode !== require_extensionService.COMPUTER_USE_MODE_ID);
486
486
  await host.changeSelection({
487
487
  axis: "state",
488
- key: "minor-mode",
488
+ key: "mode",
489
489
  values: enabled ? [...modes, require_extensionService.COMPUTER_USE_MODE_ID] : modes
490
490
  });
491
491
  publishMode();
@@ -506,7 +506,7 @@ function createComputerUseServer(host, apiContext) {
506
506
  if (!isActive()) throw new Error(NOT_ACTIVE);
507
507
  return client;
508
508
  };
509
- modeOwner = (0, _agimon_ai_po_minor_mode.defineMinorMode)({
509
+ modeOwner = (0, _agimon_ai_po_mode.defineMode)({
510
510
  descriptor: {
511
511
  source: SOURCE,
512
512
  id: require_extensionService.COMPUTER_USE_MODE_ID,
@@ -648,7 +648,7 @@ function createComputerUseServer(host, apiContext) {
648
648
  });
649
649
  },
650
650
  (context) => {
651
- const fiber = context.plugin((0, _agimon_ai_po_minor_mode.serverMinorModes)([modeOwner]));
651
+ const fiber = context.plugin((0, _agimon_ai_po_mode.serverModes)([modeOwner]));
652
652
  context.effect(() => desktop.subscribe(() => {
653
653
  if (!desktop.available) fiber.dispose();
654
654
  }));
@@ -710,10 +710,10 @@ function createComputerUseServer(host, apiContext) {
710
710
  }],
711
711
  activities: [{
712
712
  when: {
713
- state: { "minor-mode": require_extensionService.COMPUTER_USE_MODE_ID },
713
+ state: { mode: require_extensionService.COMPUTER_USE_MODE_ID },
714
714
  attribution: {
715
- kind: "minor",
716
- mode: require_extensionService.COMPUTER_USE_MODE_ID
715
+ kind: "mode",
716
+ name: require_extensionService.COMPUTER_USE_MODE_ID
717
717
  }
718
718
  },
719
719
  name: SOURCE,
@@ -731,10 +731,10 @@ function createComputerUseServer(host, apiContext) {
731
731
  tools: [
732
732
  {
733
733
  when: {
734
- state: { "minor-mode": require_extensionService.COMPUTER_USE_MODE_ID },
734
+ state: { mode: require_extensionService.COMPUTER_USE_MODE_ID },
735
735
  attribution: {
736
- kind: "minor",
737
- mode: require_extensionService.COMPUTER_USE_MODE_ID
736
+ kind: "mode",
737
+ name: require_extensionService.COMPUTER_USE_MODE_ID
738
738
  }
739
739
  },
740
740
  name: "computer_state",
@@ -778,10 +778,10 @@ function createComputerUseServer(host, apiContext) {
778
778
  },
779
779
  {
780
780
  when: {
781
- state: { "minor-mode": require_extensionService.COMPUTER_USE_MODE_ID },
781
+ state: { mode: require_extensionService.COMPUTER_USE_MODE_ID },
782
782
  attribution: {
783
- kind: "minor",
784
- mode: require_extensionService.COMPUTER_USE_MODE_ID
783
+ kind: "mode",
784
+ name: require_extensionService.COMPUTER_USE_MODE_ID
785
785
  }
786
786
  },
787
787
  name: "computer_action",
@@ -841,10 +841,10 @@ function createComputerUseServer(host, apiContext) {
841
841
  },
842
842
  {
843
843
  when: {
844
- state: { "minor-mode": require_extensionService.COMPUTER_USE_MODE_ID },
844
+ state: { mode: require_extensionService.COMPUTER_USE_MODE_ID },
845
845
  attribution: {
846
- kind: "minor",
847
- mode: require_extensionService.COMPUTER_USE_MODE_ID
846
+ kind: "mode",
847
+ name: require_extensionService.COMPUTER_USE_MODE_ID
848
848
  }
849
849
  },
850
850
  name: "computer_exec",
@@ -881,8 +881,8 @@ function createComputerUseServer(host, apiContext) {
881
881
  await client.stop();
882
882
  await host.changeSelection({
883
883
  axis: "state",
884
- key: "minor-mode",
885
- values: (execution.selection.state?.["minor-mode"] ?? []).filter((mode) => mode !== require_extensionService.COMPUTER_USE_MODE_ID)
884
+ key: "mode",
885
+ values: (execution.selection.state?.["mode"] ?? []).filter((mode) => mode !== require_extensionService.COMPUTER_USE_MODE_ID)
886
886
  });
887
887
  await refresh();
888
888
  }
@@ -890,10 +890,10 @@ function createComputerUseServer(host, apiContext) {
890
890
  }],
891
891
  hooks: [{
892
892
  when: {
893
- state: { "minor-mode": require_extensionService.COMPUTER_USE_MODE_ID },
893
+ state: { mode: require_extensionService.COMPUTER_USE_MODE_ID },
894
894
  attribution: {
895
- kind: "minor",
896
- mode: require_extensionService.COMPUTER_USE_MODE_ID
895
+ kind: "mode",
896
+ name: require_extensionService.COMPUTER_USE_MODE_ID
897
897
  }
898
898
  },
899
899
  event: "before_agent_start",
@@ -903,10 +903,10 @@ function createComputerUseServer(host, apiContext) {
903
903
  }
904
904
  }, {
905
905
  when: {
906
- state: { "minor-mode": require_extensionService.COMPUTER_USE_MODE_ID },
906
+ state: { mode: require_extensionService.COMPUTER_USE_MODE_ID },
907
907
  attribution: {
908
- kind: "minor",
909
- mode: require_extensionService.COMPUTER_USE_MODE_ID
908
+ kind: "mode",
909
+ name: require_extensionService.COMPUTER_USE_MODE_ID
910
910
  }
911
911
  },
912
912
  event: "session_shutdown",
@@ -1308,10 +1308,10 @@ var codemode_how_to_computer_use_server_default = (0, _agimon_ai_po_core_extensi
1308
1308
  kind: "skill",
1309
1309
  pinned: true,
1310
1310
  when: {
1311
- state: { "minor-mode": require_extensionService.COMPUTER_USE_MODE_ID },
1311
+ state: { mode: require_extensionService.COMPUTER_USE_MODE_ID },
1312
1312
  attribution: {
1313
- kind: "minor",
1314
- mode: require_extensionService.COMPUTER_USE_MODE_ID
1313
+ kind: "mode",
1314
+ name: require_extensionService.COMPUTER_USE_MODE_ID
1315
1315
  }
1316
1316
  },
1317
1317
  path: (0, _agimon_ai_po_core_serverPlugin.packageResourcePath)(require("url").pathToFileURL(__filename).href, "src/prompts/codemode-how-to-computer-use/SKILL.md"),