@agimon-ai/po-computer-use 0.0.0-alpha.0
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/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/apiContracts.cjs +242 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +237 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/extensionService-Bp0q295i.cjs +504 -0
- package/dist/extensionService-Bp0q295i.cjs.map +1 -0
- package/dist/extensionService-DXvF7esO.mjs +434 -0
- package/dist/extensionService-DXvF7esO.mjs.map +1 -0
- package/dist/extensions/mcp-ui.mjs +47 -0
- package/dist/extensions/mcp-ui.mjs.map +1 -0
- package/dist/extensions/mcp.cjs +66 -0
- package/dist/extensions/mcp.cjs.map +1 -0
- package/dist/extensions/mcp.d.mts +5 -0
- package/dist/extensions/mcp.d.mts.map +1 -0
- package/dist/extensions/mcp.mjs +61 -0
- package/dist/extensions/mcp.mjs.map +1 -0
- package/dist/extensions/server.cjs +1394 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +1388 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +771 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +140 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +325 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +129 -0
- package/dist/index.mjs.map +1 -0
- package/docs/computer-scripts.md +72 -0
- package/llms.txt +12 -0
- package/package.json +147 -0
- package/src/prompts/po-use-computer-use/SKILL.md +34 -0
- package/src/types/computerUse.ts +132 -0
- package/src/types/computerUseApi.ts +83 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.mjs","names":["legacy","legacy","routes","legacy","legacy","legacy","legacy","legacy","legacy","legacy","settingComputerUse","settingComputerUse2","activityGroupComputerUse","channelComputerUse","fillComputerUse","modeComputerUse","toolComputerAction","toolComputerExec","toolComputerState"],"sources":["../../src/extensions/(frontend)/_lib/computerUseSettings.ts","../../src/extensions/(frontend)/_legacy/index.ts","../../src/extensions/(frontend)/setting/computer-use.web.ts","../../src/extensions/workspaces/(frontend)/_legacy/index.ts","../../src/extensions/workspaces/(frontend)/setting/computer-use.web.ts","../../src/types/computerUseApi.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/computerUseStore.ts","../../src/types/apiRoutes.ts","../../generated/client.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/computerUseRecording.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/_components/ComputerUsePanel.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/computerActionToolRender.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ComputerActionToolCard.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/computerExecToolRender.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ComputerExecToolCard.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/computerStateToolRender.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ComputerStateToolCard.tsx","../../src/extensions/workspaces/sessions/(frontend)/_legacy/index.ts","../../src/extensions/workspaces/sessions/(frontend)/activity-group/computer-use.web.ts","../../src/extensions/workspaces/sessions/(frontend)/channel/computer-use.web.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/ComputerUse.activity.computer-use.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/mode/computer-use/mode.web.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/computer-action.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/computer-exec.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/computer-state.web.tsx","../../generated/web.ts"],"sourcesContent":["import type { SettingsSectionContribution } from '@agimon-ai/po-core/web';\n\nexport const computerUseSettingsSection: SettingsSectionContribution = {\n id: 'computer-use',\n desktopOnly: true,\n label: 'computer use',\n detail: 'control whether Po Desktop may expose session-scoped computer control',\n order: 45,\n fields: [\n {\n id: 'enabled',\n label: 'enable computer use',\n kind: 'toggle',\n keyPath: ['computerUse', 'enabled'],\n detail: 'Makes the computer-use minor mode available. Each control session still requires native confirmation.',\n },\n ],\n};\n","import type { WebPluginDefinition } from '@agimon-ai/po-core/web';\n\nimport { computerUseSettingsSection } from '../_lib/computerUseSettings';\n\nexport default {\n settingsSections: [computerUseSettingsSection],\n} satisfies NonNullable<WebPluginDefinition['global']>;\n","import { defineSettingsSection } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_legacy';\n\nexport default defineSettingsSection(legacy.settingsSections![0]!);\n","import type { WebPluginDefinition } from '@agimon-ai/po-core/web';\n\nimport { computerUseSettingsSection } from '../../../(frontend)/_lib/computerUseSettings';\n\nexport default {\n settingsSections: [computerUseSettingsSection],\n} satisfies NonNullable<WebPluginDefinition['workspace']>;\n","import { defineSettingsSection } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_legacy';\n\nexport default defineSettingsSection(legacy.settingsSections![0]!);\n","import type { DoomApiCaller } 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 = 'doom-computer-use';\nexport const COMPUTER_USE_MODE_STATUS_KEY = 'doom-computer-use-mode';\nexport const COMPUTER_USE_MAX_DURATION_MS = 1_800 * 1_000;\nexport const COMPUTER_USE_DEFAULT_DURATION_MS = 300 * 1_000;\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 readonly caller: DoomApiCaller;\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 { defineSessionStore } from '@agimon-ai/po-core/web';\n\nimport { computerUseChannelType } from '../../../../../types/computerUseApi';\nimport type { ComputerUseChannelPayload } from '../../../../../types/computerUseApi';\n\nexport interface ComputerUseSession extends ComputerUseChannelPayload {}\n\nconst initialState: ComputerUseSession = {\n state: { sessionId: '', revision: 0, wake: 0, phase: 'inactive' },\n targets: [],\n};\n\nexport const computerUse = defineSessionStore<ComputerUseSession>(initialState);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport const computerUseChannel = computerUse.channel<ComputerUseChannelPayload>({\n channel: computerUseChannelType,\n parse(input) {\n if (!isRecord(input) || !isRecord(input.state) || !Array.isArray(input.targets)) return null;\n if (typeof input.state.phase !== 'string' || typeof input.state.revision !== 'number') return null;\n return input as unknown as ComputerUseChannelPayload;\n },\n reduce: (_current, payload) => payload,\n});\n","import { apiResponse, defineApiRoutes } from '@agimon-ai/po-core/web';\n\nimport {\n COMPUTER_USE_ROUTES,\n type ComputerUseActivationRequest,\n type ComputerUseBrokerRequest,\n type ComputerUseSessionView,\n} from './computerUseApi';\n\n/**\n * This package's routes, as data.\n *\n * No scope and no base path: the build reads both off\n * `src/extensions/workspaces/sessions/(backend)/api/computer-use/`, so the\n * mount is stated once, by the folder that creates it.\n *\n * The paths come from `COMPUTER_USE_ROUTES` rather than being written out\n * again. That table already addressed the broker from the hub channel and from\n * the broker's own dispatcher, and a second copy here is exactly the\n * disagreement this file exists to prevent. The dispatcher now reads this\n * table, so the page, the broker and the hub all resolve one set of strings.\n *\n * Activation, status, cancellation and recording reads are reachable from a browser. The `/agent/` and `/hub/` routes\n * each demand a host-issued bearer token and answer 404 without one; they are\n * declared here because they are this API's surface, not because a page calls\n * them.\n */\nexport default defineApiRoutes({\n artifact: {\n method: 'GET',\n path: COMPUTER_USE_ROUTES.artifact,\n query: ['artifactId', 'offset'],\n raw: true,\n },\n activationState: {\n method: 'GET',\n path: COMPUTER_USE_ROUTES.activate,\n response: apiResponse<ComputerUseSessionView>(),\n },\n cancelActivation: {\n method: 'DELETE',\n path: COMPUTER_USE_ROUTES.activate,\n response: apiResponse<ComputerUseSessionView>(),\n },\n activate: {\n method: 'POST',\n path: COMPUTER_USE_ROUTES.activate,\n response: apiResponse<ComputerUseSessionView>(),\n },\n agentState: {\n method: 'GET',\n path: COMPUTER_USE_ROUTES.agentState,\n response: apiResponse<ComputerUseSessionView>(),\n },\n /** Answers whatever the admitted Desktop provider returned, which is runtime-defined JSON. */\n agentObserve: {\n method: 'POST',\n path: COMPUTER_USE_ROUTES.agentObserve,\n response: apiResponse<unknown>(),\n },\n agentAction: {\n method: 'POST',\n path: COMPUTER_USE_ROUTES.agentAction,\n response: apiResponse<unknown>(),\n },\n agentStop: {\n method: 'POST',\n path: COMPUTER_USE_ROUTES.agentStop,\n response: apiResponse<ComputerUseSessionView>(),\n },\n hubState: {\n method: 'GET',\n path: COMPUTER_USE_ROUTES.hubState,\n response: apiResponse<ComputerUseSessionView>(),\n },\n /** Null until a reader has confirmed one; reading it moves the session to `activating`. */\n hubActivation: {\n method: 'GET',\n path: COMPUTER_USE_ROUTES.hubActivation,\n response: apiResponse<ComputerUseActivationRequest | null>(),\n },\n hubAuthorization: {\n method: 'GET',\n path: COMPUTER_USE_ROUTES.hubAuthorization,\n response: apiResponse<{ readonly grantId: string; readonly expiresAt?: number } | null>(),\n },\n hubNext: {\n method: 'GET',\n path: COMPUTER_USE_ROUTES.hubNext,\n response: apiResponse<ComputerUseBrokerRequest | null>(),\n },\n hubComplete: {\n method: 'POST',\n path: COMPUTER_USE_ROUTES.hubComplete,\n response: apiResponse<ComputerUseSessionView>(),\n },\n hubStop: {\n method: 'POST',\n path: COMPUTER_USE_ROUTES.hubStop,\n response: apiResponse<ComputerUseSessionView>(),\n },\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { createApiClient, sessionApiAddress } from '@agimon-ai/po-core/web';\nimport { sealedTransport } from '@agimon-ai/po-web-security/browser';\n\nimport routes from '../src/types/apiRoutes';\n\n/** Scopes the tree mounts 'computer-use' at. */\nexport const apiScopes = ['session'] as const;\n\nexport const api = createApiClient(routes, {\n scopes: apiScopes,\n basePath: 'computer-use',\n transport: (input, init) => sealedTransport.fetch(input, init),\n sessionAddress: sessionApiAddress,\n});\n","import { api } from '../../../../../../generated/client';\n\nconst MAX_RECORDING_BYTES = 128 * 1024 * 1024;\nconst CHUNK_BYTES = 1024 * 1024;\n\n/** Owns only a bounded sealed download and its disposable browser URL. */\nexport async function loadComputerUseRecording(\n sessionId: string,\n artifactId: string,\n sizeBytes: number,\n signal: AbortSignal,\n): Promise<{ url: string; dispose(): void }> {\n if (!Number.isSafeInteger(sizeBytes) || sizeBytes < 1 || sizeBytes > MAX_RECORDING_BYTES)\n throw new Error('Recording exceeds the permitted size.');\n const parts: ArrayBuffer[] = [];\n for (let offset = 0; offset < sizeBytes; offset += CHUNK_BYTES) {\n signal.throwIfAborted();\n const result = await api.session(sessionId).artifact({ query: { artifactId, offset }, signal });\n if (!result.ok || result.status !== 206) throw new Error('The recording is unavailable or access was revoked.');\n const end = Math.min(offset + CHUNK_BYTES, sizeBytes) - 1;\n if (result.response.headers.get('content-range') !== `bytes ${offset}-${end}/${sizeBytes}`)\n throw new Error('The recording response is invalid.');\n const bytes = await result.response.arrayBuffer();\n signal.throwIfAborted();\n if (bytes.byteLength !== end - offset + 1) throw new Error('The recording response is incomplete.');\n parts.push(bytes);\n }\n signal.throwIfAborted();\n const url = URL.createObjectURL(new Blob(parts, { type: 'video/mp4' }));\n let disposed = false;\n return {\n url,\n dispose() {\n if (!disposed) {\n disposed = true;\n URL.revokeObjectURL(url);\n }\n },\n };\n}\n","import type { WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport { Button } from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport { useEffect, useState } from 'react';\n\nimport { api } from '../../../../../../../generated/client';\nimport { COMPUTER_USE_DEFAULT_DURATION_MS, computerUseChannelType } from '../../../../../../types/computerUseApi';\nimport { loadComputerUseRecording } from '../../_lib/computerUseRecording';\nimport { computerUse } from '../../_lib/computerUseStore';\n\nfunction text(value: unknown, fallback: string): string {\n return typeof value === 'string' || typeof value === 'number' ? String(value) : fallback;\n}\n\nexport function ComputerUsePanel({ sessionId, sendSessionFrame }: WebPluginSlotProps) {\n const session = useStore(computerUse.store, (state) => computerUse.select(state, sessionId));\n const [selected, setSelected] = useState(0);\n const [confirmationTarget, setConfirmationTarget] = useState<Record<string, unknown>>();\n const [error, setError] = useState<string>();\n const [recordingUrl, setRecordingUrl] = useState<string>();\n const [recordingAccessDenied, setRecordingAccessDenied] = useState(false);\n const send = (payload: Record<string, unknown>) => {\n if (sessionId !== null) sendSessionFrame(sessionId, { type: computerUseChannelType, payload });\n };\n\n useEffect(() => {\n if (sessionId === null) return;\n sendSessionFrame(sessionId, { type: computerUseChannelType, payload: { action: 'status' } });\n sendSessionFrame(sessionId, { type: computerUseChannelType, payload: { action: 'targets' } });\n }, [sendSessionFrame, sessionId]);\n\n useEffect(() => {\n if (sessionId === null) return;\n const controller = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const poll = async () => {\n try {\n const result = await api.session(sessionId).activationState({ signal: controller.signal });\n if (controller.signal.aborted) return;\n setRecordingAccessDenied(!result.ok);\n if (result.ok) {\n computerUse.update(sessionId, (current) =>\n result.data.revision >= current.state.revision ? { ...current, state: result.data } : current,\n );\n }\n } catch {\n // A closed session or standalone story may no longer have an API address.\n // Fail closed and dispose any existing recording instead of rejecting globally.\n if (!controller.signal.aborted) setRecordingAccessDenied(true);\n }\n if (!controller.signal.aborted) timer = setTimeout(() => void poll(), 2000);\n };\n void poll();\n return () => {\n controller.abort();\n clearTimeout(timer);\n };\n }, [sessionId]);\n\n const artifactId = session.state.artifact?.artifactId;\n const artifactSize = session.state.artifact?.sizeBytes;\n const artifactStatus = session.state.artifact?.status;\n useEffect(() => {\n setRecordingUrl(undefined);\n if (\n recordingAccessDenied ||\n sessionId === null ||\n artifactId === undefined ||\n artifactSize === undefined ||\n artifactStatus !== 'ready'\n )\n return;\n const controller = new AbortController();\n let asset: Awaited<ReturnType<typeof loadComputerUseRecording>> | undefined;\n void loadComputerUseRecording(sessionId, artifactId, artifactSize, controller.signal)\n .then((loaded) => {\n if (controller.signal.aborted) loaded.dispose();\n else {\n asset = loaded;\n setRecordingUrl(loaded.url);\n }\n })\n .catch(() => {\n if (!controller.signal.aborted) setError('The recording is unavailable or access was revoked.');\n });\n return () => {\n controller.abort();\n asset?.dispose();\n };\n }, [sessionId, artifactId, artifactSize, artifactStatus, recordingAccessDenied]);\n\n if (sessionId === null) return <p className=\"px-1 text-sm text-doom-dim\">Select a session.</p>;\n const state = session.state;\n const target = session.targets[selected];\n const artifact = state.artifact;\n const confirm = async (chosenTarget = confirmationTarget) => {\n setError(undefined);\n try {\n // Through the generated client, which carries the sealed transport: this\n // request names an application window a reader just agreed to hand over,\n // and the global fetch it used to call handed that to a remote session's\n // relay in the clear.\n const result = await api.session(sessionId).activate({\n body: {\n ...(chosenTarget === undefined ? {} : { target: chosenTarget }),\n durationMs: COMPUTER_USE_DEFAULT_DURATION_MS,\n },\n });\n if (!result.ok) {\n // `status: 0` is the one case nothing answered at all, which the old\n // bare fetch reported by rejecting into nobody's handler.\n if (result.status === 0) setError('The session is unreachable.');\n else setError(result.error === '' ? `Activation failed with HTTP ${result.status}.` : result.error);\n return;\n }\n setConfirmationTarget(undefined);\n computerUse.update(sessionId, (current) => ({ ...current, state: result.data }));\n send({ action: 'status' });\n } catch {\n setError('The activation request is unavailable.');\n }\n };\n\n return (\n <div data-testid=\"computer-use-panel\" className=\"flex flex-col gap-2 text-base text-doom-text\">\n <header className=\"flex items-center justify-between gap-2\">\n <span className=\"text-doom-dim\">{state.phase.replaceAll('_', ' ')}</span>\n <Button\n size=\"sm\"\n type=\"button\"\n className=\"min-h-7 rounded border border-doom-border bg-doom-panel px-2 py-1\"\n onClick={() => send({ action: 'targets' })}\n >\n Refresh targets\n </Button>\n </header>\n {session.busy ? (\n <p className=\"rounded border border-doom-yellow px-2 py-1\">Computer use is busy in another session</p>\n ) : null}\n {state.failure ? <p className=\"text-doom-red\">{state.failure.message}</p> : null}\n {error ? <p className=\"text-doom-red\">{error}</p> : null}\n\n {(state.phase === 'inactive' || state.phase === 'failed') && confirmationTarget === undefined ? (\n <div className=\"flex flex-col gap-2\">\n <label htmlFor=\"computer-use-target\">Application window</label>\n <select\n id=\"computer-use-target\"\n value={selected}\n onChange={(event) => setSelected(Number(event.target.value))}\n className=\"min-h-7 rounded border border-doom-border bg-doom-panel px-2 py-1\"\n >\n {session.targets.map((item, index) => (\n <option key={text(item.windowId, String(index))} value={index}>\n {text(item.applicationName, text(item.windowTitle, text(item.windowId, 'Window')))}\n </option>\n ))}\n </select>\n <Button\n size=\"sm\"\n type=\"button\"\n disabled={Boolean(session.busy)}\n variant=\"primary\"\n onClick={() => {\n if (target === undefined) void confirm();\n else setConfirmationTarget(Object.freeze({ ...target }));\n }}\n >\n {target === undefined ? 'Choose window on Mac' : 'Request activation'}\n </Button>\n </div>\n ) : null}\n\n {confirmationTarget !== undefined ? (\n <div className=\"rounded border border-doom-blue p-3\">\n <strong>Confirm computer control</strong>\n <p className=\"my-2 text-doom-text\">\n {text(confirmationTarget.applicationName, 'Application')}:{' '}\n {text(confirmationTarget.windowTitle, text(confirmationTarget.windowId, 'Window'))}\n </p>\n <p className=\"my-2 text-doom-dim\">Confirm a 5 minute session for this exact application window.</p>\n <div className=\"flex gap-2\">\n <Button size=\"sm\" type=\"button\" variant=\"primary\" onClick={() => void confirm()}>\n Confirm\n </Button>\n <Button\n size=\"sm\"\n type=\"button\"\n className=\"min-h-7 rounded border border-doom-border bg-doom-panel px-2 py-1\"\n onClick={() => setConfirmationTarget(undefined)}\n >\n Cancel\n </Button>\n </div>\n </div>\n ) : null}\n\n {state.phase === 'awaiting_confirmation' || state.phase === 'activating' ? (\n <div>\n <p>Desktop activation is pending.</p>\n <Button\n size=\"sm\"\n type=\"button\"\n onClick={() => {\n void (async () => {\n try {\n const result = await api.session(sessionId).cancelActivation();\n if (!result.ok) setError('The activation could not be cancelled.');\n else computerUse.update(sessionId, (current) => ({ ...current, state: result.data }));\n } catch {\n setError('The activation could not be cancelled.');\n }\n })();\n }}\n >\n Cancel activation\n </Button>\n </div>\n ) : null}\n {state.phase === 'active' || state.phase === 'stopping' ? (\n <Button\n size=\"sm\"\n type=\"button\"\n disabled={state.phase === 'stopping'}\n className=\"min-h-7 rounded border border-doom-border bg-doom-panel px-2 py-1\"\n onClick={() => send({ action: 'stop' })}\n >\n Stop computer use\n </Button>\n ) : null}\n {artifact ? (\n <div data-testid=\"computer-use-artifact\" className=\"rounded bg-doom-panel p-2\">\n <strong>{artifact.status === 'ready' ? 'Completed recording' : 'Recording unavailable'}</strong>\n <p>ID: {artifact.artifactId}</p>\n <p>Status: {artifact.status}</p>\n {artifact.failure ? <p className=\"text-doom-red\">{artifact.failure.message}</p> : null}\n {artifact.completedAt ? <p>Completed: {artifact.completedAt}</p> : null}\n {artifact.actionCount !== undefined ? <p>Actions: {artifact.actionCount}</p> : null}\n {artifact.status === 'ready' && artifact.sizeBytes && !recordingUrl ? (\n <p>Loading recording through the secure channel.</p>\n ) : null}\n {artifact.status === 'ready' && recordingUrl ? (\n <video className=\"mt-2 w-full\" controls preload=\"metadata\" src={recordingUrl}>\n <track kind=\"captions\" />\n </video>\n ) : null}\n {artifact.status === 'ready' && recordingUrl ? (\n <a className=\"mt-2 inline-block text-doom-blue\" href={recordingUrl} download=\"Po-recording.mp4\">\n Download recording\n </a>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n}\n","import { type ToolResultView, toolResultTextLines } from '@agimon-ai/po-core/web';\nimport type { MessageLine } from '@agimon-ai/po-web-components';\n\nexport const computerActionToolName = 'computer_action' as const;\nexport const computerActionCollapsedLines = 8;\n\nexport function computerActionCallSummary(args: Readonly<Record<string, unknown>>): string {\n const kind = typeof args.kind === 'string' ? args.kind : '';\n const ref = typeof args.elementRef === 'string' ? args.elementRef : '';\n return [kind, ref].filter(Boolean).join(' ');\n}\n\n/**\n * The body as toned lines: what the result's details say, or its text. Pure,\n * so a unit test can pin it without a DOM; the item decides how many to show.\n */\nexport function computerActionResultLines(result: ToolResultView | null): MessageLine[] {\n if (result === null) return [];\n return toolResultTextLines(result.content).map((text) => ({ text, tone: 'dim' }));\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\n// @scaffold-generated\nimport {\n collapseLines,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n MessageLines,\n toolTone,\n} from '@agimon-ai/po-web-components';\n\nimport {\n computerActionCallSummary,\n computerActionCollapsedLines,\n computerActionResultLines,\n} from '../_lib/computerActionToolRender';\n\n/**\n * The computer_action tool's timeline item: Perform one constrained semantic action in the authorized application window. The shell owns\n * the frame, the outcome tone, the status badge, and the expand toggle; this\n * card supplies the header summary and the body lines, and says whether it\n * hides any so the toggle appears only when it reveals something.\n */\nexport function ComputerActionToolCard({ toolName, args, result, running, isError }: ToolMessageRenderProps) {\n const lines = computerActionResultLines(result);\n const collapsed = collapseLines(lines, computerActionCollapsedLines, false);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={collapsed.hidden > 0}>\n {({ expanded }) => {\n const view = expanded ? collapseLines(lines, computerActionCollapsedLines, true) : collapsed;\n return (\n <>\n <MessageItemHeader title={toolName}>\n <span data-testid={`tool-call-${toolName}`} className=\"min-w-0 flex-1 truncate text-doom-text\">\n {computerActionCallSummary(args)}\n </span>\n </MessageItemHeader>\n {view.shown.length > 0 || running || isError ? (\n <MessageItemBody data-testid={`tool-result-${toolName}`} className=\"flex flex-col gap-1\">\n {view.shown.length > 0 ? <MessageLines lines={view.shown} /> : null}\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more line(s)</MessageItemStatus> : null}\n {running ? <MessageItemStatus tone=\"running\">running</MessageItemStatus> : null}\n {isError ? <MessageItemStatus tone=\"error\">failed</MessageItemStatus> : null}\n </MessageItemBody>\n ) : null}\n </>\n );\n }}\n </MessageItem>\n );\n}\n","import { type ToolResultView, toolResultTextLines } from '@agimon-ai/po-core/web';\nimport type { MessageLine } from '@agimon-ai/po-web-components';\n\nexport const computerExecToolName = 'computer_exec' as const;\nexport const computerExecCollapsedLines = 8;\n\nexport function computerExecCallSummary(args: Readonly<Record<string, unknown>>): string {\n return typeof args.scriptPath === 'string' ? args.scriptPath : '';\n}\n\nexport function computerExecResultLines(result: ToolResultView | null): MessageLine[] {\n if (result === null) return [];\n return toolResultTextLines(result.content).map((text) => ({ text, tone: 'dim' }));\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n collapseLines,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n MessageLines,\n toolTone,\n} from '@agimon-ai/po-web-components';\n\nimport {\n computerExecCallSummary,\n computerExecCollapsedLines,\n computerExecResultLines,\n} from '../_lib/computerExecToolRender';\n\nexport function ComputerExecToolCard({ toolName, args, result, running, isError }: ToolMessageRenderProps) {\n const lines = computerExecResultLines(result);\n const collapsed = collapseLines(lines, computerExecCollapsedLines, false);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={collapsed.hidden > 0}>\n {({ expanded }) => {\n const view = expanded ? collapseLines(lines, computerExecCollapsedLines, true) : collapsed;\n return (\n <>\n <MessageItemHeader title={toolName}>\n <span data-testid={`tool-call-${toolName}`} className=\"min-w-0 flex-1 truncate text-doom-text\">\n {computerExecCallSummary(args)}\n </span>\n </MessageItemHeader>\n {view.shown.length > 0 || running || isError ? (\n <MessageItemBody data-testid={`tool-result-${toolName}`} className=\"flex flex-col gap-1\">\n {view.shown.length > 0 ? <MessageLines lines={view.shown} /> : null}\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more line(s)</MessageItemStatus> : null}\n {running ? <MessageItemStatus tone=\"running\">running</MessageItemStatus> : null}\n {isError ? <MessageItemStatus tone=\"error\">failed</MessageItemStatus> : null}\n </MessageItemBody>\n ) : null}\n </>\n );\n }}\n </MessageItem>\n );\n}\n","import { type ToolResultView, toolResultTextLines } from '@agimon-ai/po-core/web';\nimport type { MessageLine } from '@agimon-ai/po-web-components';\n\nexport const computerStateToolName = 'computer_state' as const;\nexport const computerStateCollapsedLines = 8;\n\nexport function computerStateCallSummary(_args: Readonly<Record<string, unknown>>): string {\n return 'authorized window';\n}\n\n/**\n * The body as toned lines: what the result's details say, or its text. Pure,\n * so a unit test can pin it without a DOM; the item decides how many to show.\n */\nexport function computerStateResultLines(result: ToolResultView | null): MessageLine[] {\n if (result === null) return [];\n return toolResultTextLines(result.content).map((text) => ({ text, tone: 'dim' }));\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\n// @scaffold-generated\nimport {\n collapseLines,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n MessageLines,\n toolTone,\n} from '@agimon-ai/po-web-components';\n\nimport {\n computerStateCallSummary,\n computerStateCollapsedLines,\n computerStateResultLines,\n} from '../_lib/computerStateToolRender';\n\n/**\n * The computer_state tool's timeline item: Observe the authorized application window and semantic accessibility state. The shell owns\n * the frame, the outcome tone, the status badge, and the expand toggle; this\n * card supplies the header summary and the body lines, and says whether it\n * hides any so the toggle appears only when it reveals something.\n */\nexport function ComputerStateToolCard({ toolName, args, result, running, isError }: ToolMessageRenderProps) {\n const lines = computerStateResultLines(result);\n const collapsed = collapseLines(lines, computerStateCollapsedLines, false);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={collapsed.hidden > 0}>\n {({ expanded }) => {\n const view = expanded ? collapseLines(lines, computerStateCollapsedLines, true) : collapsed;\n return (\n <>\n <MessageItemHeader title={toolName}>\n <span data-testid={`tool-call-${toolName}`} className=\"min-w-0 flex-1 truncate text-doom-text\">\n {computerStateCallSummary(args)}\n </span>\n </MessageItemHeader>\n {view.shown.length > 0 || running || isError ? (\n <MessageItemBody data-testid={`tool-result-${toolName}`} className=\"flex flex-col gap-1\">\n {view.shown.length > 0 ? <MessageLines lines={view.shown} /> : null}\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more line(s)</MessageItemStatus> : null}\n {running ? <MessageItemStatus tone=\"running\">running</MessageItemStatus> : null}\n {isError ? <MessageItemStatus tone=\"error\">failed</MessageItemStatus> : null}\n </MessageItemBody>\n ) : null}\n </>\n );\n }}\n </MessageItem>\n );\n}\n","import type { WebPluginDefinition } from '@agimon-ai/po-core/web';\n\nimport {\n COMPUTER_USE_MODE_ID,\n COMPUTER_USE_MODE_STATUS_KEY,\n COMPUTER_USE_STATUS_KEY,\n} from '../../../../../types/computerUseApi';\nimport { computerUseChannel } from '../_lib/computerUseStore';\nimport { ComputerUsePanel } from '../fill/_components/ComputerUsePanel';\nimport { ComputerActionToolCard } from '../tool/_components/ComputerActionToolCard';\nimport { ComputerExecToolCard } from '../tool/_components/ComputerExecToolCard';\nimport { ComputerStateToolCard } from '../tool/_components/ComputerStateToolCard';\nimport { computerActionToolName } from '../tool/_lib/computerActionToolRender';\nimport { computerExecToolName } from '../tool/_lib/computerExecToolRender';\nimport { computerStateToolName } from '../tool/_lib/computerStateToolRender';\n\nexport default {\n minorModes: [\n {\n name: 'computer use',\n modeId: COMPUTER_USE_MODE_ID,\n keys: 'c e',\n statusKey: COMPUTER_USE_MODE_STATUS_KEY,\n hideWhenMissing: true,\n desktopOnly: true,\n order: 70,\n },\n ],\n activityGroups: [\n {\n name: 'computer-use',\n keys: 'c e',\n order: 70,\n statusKey: COMPUTER_USE_STATUS_KEY,\n hideWhenEmpty: true,\n desktopOnly: true,\n marksBackgroundWork: false,\n },\n ],\n activitySections: [{ id: 'computer-use', component: ComputerUsePanel }],\n channels: [computerUseChannel],\n toolRenderers: [\n { tools: [computerStateToolName], message: ComputerStateToolCard },\n { tools: [computerActionToolName], message: ComputerActionToolCard },\n { tools: [computerExecToolName], message: ComputerExecToolCard },\n ],\n} satisfies NonNullable<WebPluginDefinition['session']>;\n","import { defineActivityGroup } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_legacy';\n\nexport default defineActivityGroup(legacy.activityGroups![0]!);\n","import { defineChannelFile } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_legacy';\n\nexport default defineChannelFile(legacy.channels![0]!);\n","import { defineFill } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_legacy';\n\nexport default defineFill({ slot: 'activity.computer-use', ...legacy.activitySections![0]! });\n","import { defineMinorModeFile } from '@agimon-ai/po-core/web';\n\nimport legacy from '../../_legacy';\n\nexport default defineMinorModeFile(legacy.minorModes![0]!);\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_legacy';\n\nexport default defineToolRenderer(legacy.toolRenderers![1]!);\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_legacy';\n\nexport default defineToolRenderer(legacy.toolRenderers![2]!);\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_legacy';\n\nexport default defineToolRenderer(legacy.toolRenderers![0]!);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport settingComputerUse from '../src/extensions/(frontend)/setting/computer-use.web';\nimport settingComputerUse2 from '../src/extensions/workspaces/(frontend)/setting/computer-use.web';\nimport activityGroupComputerUse from '../src/extensions/workspaces/sessions/(frontend)/activity-group/computer-use.web';\nimport channelComputerUse from '../src/extensions/workspaces/sessions/(frontend)/channel/computer-use.web';\nimport fillComputerUse from '../src/extensions/workspaces/sessions/(frontend)/fill/ComputerUse.activity.computer-use.web';\nimport modeComputerUse from '../src/extensions/workspaces/sessions/(frontend)/mode/computer-use/mode.web';\nimport toolComputerAction from '../src/extensions/workspaces/sessions/(frontend)/tool/computer-action.web';\nimport toolComputerExec from '../src/extensions/workspaces/sessions/(frontend)/tool/computer-exec.web';\nimport toolComputerState from '../src/extensions/workspaces/sessions/(frontend)/tool/computer-state.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'computer-use',\n global: {\n get settingsSections(): WebPluginContributions['settingsSections'] { return [via({ id: 'computer-use' }, settingComputerUse)]; },\n },\n workspace: {\n get settingsSections(): WebPluginContributions['settingsSections'] { return [via({ id: 'computer-use' }, settingComputerUse2)]; },\n },\n session: {\n get activityGroups(): WebPluginContributions['activityGroups'] { return [via({ name: 'computer-use' }, activityGroupComputerUse)]; },\n get channels(): WebPluginContributions['channels'] { return [via({ channel: 'computer_use' }, channelComputerUse)]; },\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'activity.computer-use', id: 'computer-use' }, fillComputerUse)]; },\n get minorModes(): WebPluginContributions['minorModes'] { return [via({ name: 'computer-use' }, modeComputerUse)]; },\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['computer_action'] }, toolComputerAction), via({ tools: ['computer_exec'] }, toolComputerExec), via({ tools: ['computer_state'] }, toolComputerState)]; },\n },\n});\n"],"mappings":";;;;;;;AAEA,MAAa,6BAA0D;CACrE,IAAI;CACJ,aAAa;CACb,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ,CACN;EACE,IAAI;EACJ,OAAO;EACP,MAAM;EACN,SAAS,CAAC,eAAe,SAAS;EAClC,QAAQ;CACV,CACF;AACF;;;AEbA,IAAA,6BAAe,sBAAsBA,EDCnC,kBAAkB,CAAC,0BAA0B,ECDVA,EAAO,iBAAkB,EAAG;;;AEAjE,IAAA,6BAAe,sBAAsBC,EDCnC,kBAAkB,CAAC,0BAA0B,ECDVA,EAAO,iBAAkB,EAAG;;;ACDjE,MAAa,yBAAyB;AACtC,MAAa,uBAAuB;AACpC,MAAa,0BAA0B;AACvC,MAAa,+BAA+B;AAE5C,MAAa,mCAAmC;;;;;;;;AAUhD,MAAa,sBAAsB;CACjC,UAAU;CACV,UAAU;CACV,YAAY;CACZ,cAAc;CACd,aAAa;CACb,WAAW;CACX,UAAU;CACV,eAAe;CACf,kBAAkB;CAClB,SAAS;CACT,aAAa;CACb,SAAS;AACX;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gB,EAAE,GAAGC,0BAAiB;GAAC;EAAG;CAC/O;AACF,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_extensionService = require("./extensionService-Bp0q295i.cjs");
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
node_path = require_extensionService.__toESM(node_path, 1);
|
|
5
|
+
let _agimon_ai_po_config = require("@agimon-ai/po-config");
|
|
6
|
+
//#region src/services/sessionApiClient/index.ts
|
|
7
|
+
/** Uses the injected host-owned service. Absence never triggers transport or credential discovery. */
|
|
8
|
+
function createComputerUseSessionClient(host) {
|
|
9
|
+
return host;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/services/dependencies/index.ts
|
|
13
|
+
const COMPUTER_USE_SCRIPT_PATHS_ENV = "PO_COMPUTER_USE_SCRIPT_PATHS";
|
|
14
|
+
function createComputerUseDependencies(overrides = {}) {
|
|
15
|
+
const client = overrides.client ?? createComputerUseSessionClient();
|
|
16
|
+
const allowedScriptPaths = (process.env["PO_COMPUTER_USE_SCRIPT_PATHS"] ?? "").split(node_path.default.delimiter).filter((entry) => entry.length > 0);
|
|
17
|
+
return {
|
|
18
|
+
service: overrides.service ?? new require_extensionService.DefaultComputerUseExtensionService(client),
|
|
19
|
+
enabled: overrides.enabled ?? ((cwd) => (0, _agimon_ai_po_config.loadDoomConfig)(cwd ?? process.env.PI_PROJECT_ROOT ?? process.cwd()).computerUse?.enabled === true),
|
|
20
|
+
...client === void 0 ? {} : { client },
|
|
21
|
+
...overrides.scriptRunner !== void 0 ? { scriptRunner: overrides.scriptRunner } : client === void 0 ? {} : { scriptRunner: new require_extensionService.ComputerScriptRunner({
|
|
22
|
+
client,
|
|
23
|
+
allowedScriptPaths
|
|
24
|
+
}) }
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/models/computerUseState.ts
|
|
29
|
+
function requireRequest(state, requestId) {
|
|
30
|
+
if (state.requestId !== requestId) throw new Error("The computer-use activation request is stale.");
|
|
31
|
+
}
|
|
32
|
+
function next(state, patch) {
|
|
33
|
+
return {
|
|
34
|
+
revision: state.revision + 1,
|
|
35
|
+
identity: state.identity,
|
|
36
|
+
...patch
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function initialComputerUseState(identity) {
|
|
40
|
+
return {
|
|
41
|
+
revision: 0,
|
|
42
|
+
phase: "inactive",
|
|
43
|
+
identity
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function reduceComputerUseState(state, event) {
|
|
47
|
+
if (event.type === "fail") return next(state, {
|
|
48
|
+
phase: "failed",
|
|
49
|
+
failure: {
|
|
50
|
+
code: event.code,
|
|
51
|
+
message: event.message
|
|
52
|
+
},
|
|
53
|
+
...state.requestId === void 0 ? {} : { requestId: state.requestId },
|
|
54
|
+
...state.target === void 0 ? {} : { target: state.target },
|
|
55
|
+
...state.grant === void 0 ? {} : { grant: state.grant }
|
|
56
|
+
});
|
|
57
|
+
if (event.type === "reset") {
|
|
58
|
+
if (state.phase !== "failed") throw new Error("Only a failed computer-use state can be reset.");
|
|
59
|
+
return next(state, { phase: "inactive" });
|
|
60
|
+
}
|
|
61
|
+
switch (state.phase) {
|
|
62
|
+
case "inactive":
|
|
63
|
+
if (event.type !== "request") throw new Error("Computer use is inactive.");
|
|
64
|
+
return next(state, {
|
|
65
|
+
phase: "requesting",
|
|
66
|
+
requestId: event.requestId,
|
|
67
|
+
target: event.target
|
|
68
|
+
});
|
|
69
|
+
case "requesting":
|
|
70
|
+
if (event.type !== "await_confirmation") throw new Error("Computer use is preparing an activation request.");
|
|
71
|
+
requireRequest(state, event.requestId);
|
|
72
|
+
return next(state, {
|
|
73
|
+
phase: "awaiting_confirmation",
|
|
74
|
+
requestId: event.requestId,
|
|
75
|
+
target: state.target
|
|
76
|
+
});
|
|
77
|
+
case "awaiting_confirmation":
|
|
78
|
+
if (event.type === "deny") {
|
|
79
|
+
requireRequest(state, event.requestId);
|
|
80
|
+
return next(state, { phase: "inactive" });
|
|
81
|
+
}
|
|
82
|
+
if (event.type !== "confirm") throw new Error("Computer use is waiting for confirmation.");
|
|
83
|
+
requireRequest(state, event.requestId);
|
|
84
|
+
return next(state, {
|
|
85
|
+
phase: "activating",
|
|
86
|
+
requestId: event.requestId,
|
|
87
|
+
target: state.target
|
|
88
|
+
});
|
|
89
|
+
case "activating":
|
|
90
|
+
if (event.type !== "activated") throw new Error("Computer use is activating.");
|
|
91
|
+
requireRequest(state, event.requestId);
|
|
92
|
+
return next(state, {
|
|
93
|
+
phase: "active",
|
|
94
|
+
requestId: event.requestId,
|
|
95
|
+
target: state.target,
|
|
96
|
+
grant: event.grant
|
|
97
|
+
});
|
|
98
|
+
case "active":
|
|
99
|
+
if (event.type !== "stop") throw new Error("Computer use is active.");
|
|
100
|
+
return next(state, {
|
|
101
|
+
phase: "stopping",
|
|
102
|
+
requestId: state.requestId,
|
|
103
|
+
target: state.target,
|
|
104
|
+
grant: state.grant
|
|
105
|
+
});
|
|
106
|
+
case "stopping":
|
|
107
|
+
if (event.type !== "stopped") throw new Error("Computer use is stopping.");
|
|
108
|
+
return next(state, { phase: "inactive" });
|
|
109
|
+
case "failed": throw new Error("Computer use must be reset before another transition.");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/services/traceRedaction/index.ts
|
|
114
|
+
function redactComputerUseTrace(input) {
|
|
115
|
+
return {
|
|
116
|
+
sequence: input.sequence,
|
|
117
|
+
timestamp: input.timestamp,
|
|
118
|
+
runId: input.runId,
|
|
119
|
+
bundleId: input.bundleId,
|
|
120
|
+
actionKind: input.action.kind,
|
|
121
|
+
...input.role === void 0 ? {} : { role: input.role },
|
|
122
|
+
...input.action.kind === "set_value" ? { textLength: input.action.value.length } : {},
|
|
123
|
+
durationMs: input.durationMs,
|
|
124
|
+
outcome: input.outcome,
|
|
125
|
+
...input.errorCode === void 0 ? {} : { errorCode: input.errorCode }
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
exports.COMPUTER_USE_GUIDANCE = require_extensionService.COMPUTER_USE_GUIDANCE;
|
|
130
|
+
exports.COMPUTER_USE_SCRIPT_PATHS_ENV = COMPUTER_USE_SCRIPT_PATHS_ENV;
|
|
131
|
+
exports.COMPUTER_USE_TOOL_NAMES = require_extensionService.COMPUTER_USE_TOOL_NAMES;
|
|
132
|
+
exports.ComputerScriptRunner = require_extensionService.ComputerScriptRunner;
|
|
133
|
+
exports.DefaultComputerUseExtensionService = require_extensionService.DefaultComputerUseExtensionService;
|
|
134
|
+
exports.createComputerUseDependencies = createComputerUseDependencies;
|
|
135
|
+
exports.createComputerUseSessionClient = createComputerUseSessionClient;
|
|
136
|
+
exports.initialComputerUseState = initialComputerUseState;
|
|
137
|
+
exports.redactComputerUseTrace = redactComputerUseTrace;
|
|
138
|
+
exports.reduceComputerUseState = reduceComputerUseState;
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["path","DefaultComputerUseExtensionService","loadDoomConfig","ComputerScriptRunner"],"sources":["../src/services/sessionApiClient/index.ts","../src/services/dependencies/index.ts","../src/models/computerUseState.ts","../src/services/traceRedaction/index.ts"],"sourcesContent":["import type { ComputerUseSessionClient } from '../../types/computerUse';\n\nexport type { ComputerUseSessionClient } from '../../types/computerUse';\n\n/** Uses the injected host-owned service. Absence never triggers transport or credential discovery. */\nexport function createComputerUseSessionClient(host?: ComputerUseSessionClient): ComputerUseSessionClient | undefined {\n return host;\n}\n","import path from 'node:path';\n\nimport { loadDoomConfig } from '@agimon-ai/po-config';\n\nimport type { ComputerUseExtensionDependencies } from '../../types/extension';\nimport { ComputerScriptRunner } from '../computerScriptRunner';\nimport { DefaultComputerUseExtensionService } from '../extensionService';\nimport { createComputerUseSessionClient } from '../sessionApiClient';\n\nexport const COMPUTER_USE_SCRIPT_PATHS_ENV = 'PO_COMPUTER_USE_SCRIPT_PATHS';\nexport function createComputerUseDependencies(\n overrides: Partial<ComputerUseExtensionDependencies> = {},\n): ComputerUseExtensionDependencies {\n const client = overrides.client ?? createComputerUseSessionClient();\n const allowedScriptPaths = (process.env[COMPUTER_USE_SCRIPT_PATHS_ENV] ?? '')\n .split(path.delimiter)\n .filter((entry) => entry.length > 0);\n return {\n service: overrides.service ?? new DefaultComputerUseExtensionService(client),\n enabled:\n overrides.enabled ??\n ((cwd) => loadDoomConfig(cwd ?? process.env.PI_PROJECT_ROOT ?? process.cwd()).computerUse?.enabled === true),\n ...(client === undefined ? {} : { client }),\n ...(overrides.scriptRunner !== undefined\n ? { scriptRunner: overrides.scriptRunner }\n : client === undefined\n ? {}\n : { scriptRunner: new ComputerScriptRunner({ client, allowedScriptPaths }) }),\n };\n}\n","import type { ComputerUseState, ComputerUseStateEvent } from '../types/computerUse';\n\nfunction requireRequest(state: ComputerUseState, requestId: string): void {\n if (state.requestId !== requestId) throw new Error('The computer-use activation request is stale.');\n}\n\nfunction next(state: ComputerUseState, patch: Omit<ComputerUseState, 'revision' | 'identity'>): ComputerUseState {\n return {\n revision: state.revision + 1,\n identity: state.identity,\n ...patch,\n };\n}\n\nexport function initialComputerUseState(identity: ComputerUseState['identity']): ComputerUseState {\n return { revision: 0, phase: 'inactive', identity };\n}\n\nexport function reduceComputerUseState(state: ComputerUseState, event: ComputerUseStateEvent): ComputerUseState {\n if (event.type === 'fail') {\n return next(state, {\n phase: 'failed',\n failure: { code: event.code, message: event.message },\n ...(state.requestId === undefined ? {} : { requestId: state.requestId }),\n ...(state.target === undefined ? {} : { target: state.target }),\n ...(state.grant === undefined ? {} : { grant: state.grant }),\n });\n }\n\n if (event.type === 'reset') {\n if (state.phase !== 'failed') throw new Error('Only a failed computer-use state can be reset.');\n return next(state, { phase: 'inactive' });\n }\n\n switch (state.phase) {\n case 'inactive': {\n if (event.type !== 'request') throw new Error('Computer use is inactive.');\n return next(state, {\n phase: 'requesting',\n requestId: event.requestId,\n target: event.target,\n });\n }\n case 'requesting': {\n if (event.type !== 'await_confirmation') throw new Error('Computer use is preparing an activation request.');\n requireRequest(state, event.requestId);\n return next(state, {\n phase: 'awaiting_confirmation',\n requestId: event.requestId,\n target: state.target,\n });\n }\n case 'awaiting_confirmation': {\n if (event.type === 'deny') {\n requireRequest(state, event.requestId);\n return next(state, { phase: 'inactive' });\n }\n if (event.type !== 'confirm') throw new Error('Computer use is waiting for confirmation.');\n requireRequest(state, event.requestId);\n return next(state, {\n phase: 'activating',\n requestId: event.requestId,\n target: state.target,\n });\n }\n case 'activating': {\n if (event.type !== 'activated') throw new Error('Computer use is activating.');\n requireRequest(state, event.requestId);\n return next(state, {\n phase: 'active',\n requestId: event.requestId,\n target: state.target,\n grant: event.grant,\n });\n }\n case 'active': {\n if (event.type !== 'stop') throw new Error('Computer use is active.');\n return next(state, {\n phase: 'stopping',\n requestId: state.requestId,\n target: state.target,\n grant: state.grant,\n });\n }\n case 'stopping': {\n if (event.type !== 'stopped') throw new Error('Computer use is stopping.');\n return next(state, { phase: 'inactive' });\n }\n case 'failed':\n throw new Error('Computer use must be reset before another transition.');\n }\n}\n","import type { ComputerUseAction, ComputerUseFailureCode } from '../../types/computerUse';\n\nexport interface ComputerUseTraceInput {\n readonly sequence: number;\n readonly timestamp: number;\n readonly runId: string;\n readonly bundleId: string;\n readonly action: ComputerUseAction;\n readonly role?: string;\n readonly durationMs: number;\n readonly outcome: 'succeeded' | 'failed' | 'uncertain';\n readonly errorCode?: ComputerUseFailureCode;\n}\n\nexport interface ComputerUseTraceRecord {\n readonly sequence: number;\n readonly timestamp: number;\n readonly runId: string;\n readonly bundleId: string;\n readonly actionKind: ComputerUseAction['kind'];\n readonly role?: string;\n readonly textLength?: number;\n readonly durationMs: number;\n readonly outcome: ComputerUseTraceInput['outcome'];\n readonly errorCode?: ComputerUseFailureCode;\n}\n\nexport function redactComputerUseTrace(input: ComputerUseTraceInput): ComputerUseTraceRecord {\n return {\n sequence: input.sequence,\n timestamp: input.timestamp,\n runId: input.runId,\n bundleId: input.bundleId,\n actionKind: input.action.kind,\n ...(input.role === undefined ? {} : { role: input.role }),\n ...(input.action.kind === 'set_value' ? { textLength: input.action.value.length } : {}),\n durationMs: input.durationMs,\n outcome: input.outcome,\n ...(input.errorCode === undefined ? {} : { errorCode: input.errorCode }),\n };\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,+BAA+B,MAAuE;CACpH,OAAO;AACT;;;ACEA,MAAa,gCAAgC;AAC7C,SAAgB,8BACd,YAAuD,CAAC,GACtB;CAClC,MAAM,SAAS,UAAU,UAAU,+BAA+B;CAClE,MAAM,sBAAsB,QAAQ,IAAA,mCAAsC,GAAA,CACvE,MAAMA,UAAAA,QAAK,SAAS,CAAC,CACrB,QAAQ,UAAU,MAAM,SAAS,CAAC;CACrC,OAAO;EACL,SAAS,UAAU,WAAW,IAAIC,yBAAAA,mCAAmC,MAAM;EAC3E,SACE,UAAU,aACR,SAAA,GAAQC,qBAAAA,eAAAA,CAAe,OAAO,QAAQ,IAAI,mBAAmB,QAAQ,IAAI,CAAC,CAAC,CAAC,aAAa,YAAY;EACzG,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;EACzC,GAAI,UAAU,iBAAiB,KAAA,IAC3B,EAAE,cAAc,UAAU,aAAa,IACvC,WAAW,KAAA,IACT,CAAC,IACD,EAAE,cAAc,IAAIC,yBAAAA,qBAAqB;GAAE;GAAQ;EAAmB,CAAC,EAAE;CACjF;AACF;;;AC3BA,SAAS,eAAe,OAAyB,WAAyB;CACxE,IAAI,MAAM,cAAc,WAAW,MAAM,IAAI,MAAM,+CAA+C;AACpG;AAEA,SAAS,KAAK,OAAyB,OAA0E;CAC/G,OAAO;EACL,UAAU,MAAM,WAAW;EAC3B,UAAU,MAAM;EAChB,GAAG;CACL;AACF;AAEA,SAA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B,QAAQ,MAAM;GAChB,CAAC;EAEH,KAAK;GACH,IAAI,MAAM,SAAS,aAAa,MAAM,IAAI,MAAM,6BAA6B;GAC7E,eAAe,OAAO,MAAM,SAAS;GACrC,OAAO,KAAK,OAAO;IACjB,OAAO;IACP,WAAW,MAAM;IACjB,QAAQ,MAAM;IACd,OAAO,MAAM;GACf,CAAC;EAEH,KAAK;GACH,IAAI,MAAM,SAAS,QAAQ,MAAM,IAAI,MAAM,yBAAyB;GACpE,OAAO,KAAK,OAAO;IACjB,OAAO;IACP,WAAW,MAAM;IACjB,QAAQ,MAAM;IACd,OAAO,MAAM;GACf,CAAC;EAEH,KAAK;GACH,IAAI,MAAM,SAAS,WAAW,MAAM,IAAI,MAAM,2BAA2B;GACzE,OAAO,KAAK,OAAO,EAAE,OAAO,WAAW,CAAC;EAE1C,KAAK,UACH,MAAM,IAAI,MAAM,uDAAuD;CAC3E;AACF;;;AChEA,SAAgB,uBAAuB,OAAsD;CAC3F,OAAO;EACL,UAAU,MAAM;EAChB,WAAW,MAAM;EACjB,OAAO,MAAM;EACb,UAAU,MAAM;EAChB,YAAY,MAAM,OAAO;EACzB,GAAI,MAAM,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,MAAM,KAAK;EACvD,GAAI,MAAM,OAAO,SAAS,cAAc,EAAE,YAAY,MAAM,OAAO,MAAM,OAAO,IAAI,CAAC;EACrF,YAAY,MAAM;EAClB,SAAS,MAAM;EACf,GAAI,MAAM,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,MAAM,UAAU;CACxE;AACF"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { DoomApiCaller } from "@agimon-ai/po-core/packageApi";
|
|
2
|
+
//#region src/constants/computerUse.d.ts
|
|
3
|
+
export declare const COMPUTER_USE_GUIDANCE = "[COMPUTER USE ACTIVE]\nUse computer_state before acting and after any action that may change the interface. Use only element refs and snapshot ids returned by computer_state. Use computer_action for one semantic press, focus, set_value, or scroll at a time. Use computer_exec only for a trusted, explicitly allowed local TypeScript script. Never infer coordinates, inspect another application, bypass secure elements, or retry an uncertain outcome. Stop computer use when the task is complete.";
|
|
4
|
+
export declare const COMPUTER_USE_TOOL_NAMES: readonly ['computer_state', 'computer_action', 'computer_exec'];
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/types/computerUseApi.d.ts
|
|
7
|
+
declare const API_BASE_PATH = "computer-use";
|
|
8
|
+
declare const computerUseChannelType = "computer_use_state";
|
|
9
|
+
declare const COMPUTER_USE_MODE_ID = "computer-use";
|
|
10
|
+
declare const COMPUTER_USE_STATUS_KEY = "doom-computer-use";
|
|
11
|
+
declare const COMPUTER_USE_MODE_STATUS_KEY = "doom-computer-use-mode";
|
|
12
|
+
declare const COMPUTER_USE_MAX_DURATION_MS: number;
|
|
13
|
+
declare const COMPUTER_USE_DEFAULT_DURATION_MS: number;
|
|
14
|
+
declare const COMPUTER_USE_CONFIRMATION_WINDOW_MS: number;
|
|
15
|
+
/**
|
|
16
|
+
* Every path this API answers on, below its mount.
|
|
17
|
+
*
|
|
18
|
+
* The typed route table in `./apiRoutes` is built from this, the dispatcher
|
|
19
|
+
* reads that table, and the hub channel addresses the broker with these same
|
|
20
|
+
* strings, so a route cannot move on one side alone.
|
|
21
|
+
*/
|
|
22
|
+
declare const COMPUTER_USE_ROUTES: {
|
|
23
|
+
readonly activate: '/activate';
|
|
24
|
+
readonly artifact: '/artifact';
|
|
25
|
+
readonly agentState: '/agent/state';
|
|
26
|
+
readonly agentObserve: '/agent/observe';
|
|
27
|
+
readonly agentAction: '/agent/action';
|
|
28
|
+
readonly agentStop: '/agent/stop';
|
|
29
|
+
readonly hubState: '/hub/state';
|
|
30
|
+
readonly hubActivation: '/hub/activation';
|
|
31
|
+
readonly hubAuthorization: '/hub/authorization';
|
|
32
|
+
readonly hubNext: '/hub/next';
|
|
33
|
+
readonly hubComplete: '/hub/complete';
|
|
34
|
+
readonly hubStop: '/hub/stop';
|
|
35
|
+
};
|
|
36
|
+
declare const COMPUTER_USE_WAKE_LIMIT = 1000000;
|
|
37
|
+
interface ComputerUseArtifactView {
|
|
38
|
+
readonly artifactId: string;
|
|
39
|
+
readonly status: 'ready' | 'failed';
|
|
40
|
+
readonly sizeBytes?: number;
|
|
41
|
+
readonly downloadUrl?: string;
|
|
42
|
+
readonly previewUrl?: string;
|
|
43
|
+
readonly actionCount?: number;
|
|
44
|
+
readonly completedAt?: string;
|
|
45
|
+
readonly failure?: {
|
|
46
|
+
readonly code: string;
|
|
47
|
+
readonly message: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
interface ComputerUseSessionView {
|
|
51
|
+
readonly sessionId: string;
|
|
52
|
+
readonly revision: number;
|
|
53
|
+
readonly wake: number;
|
|
54
|
+
readonly phase: 'inactive' | 'awaiting_confirmation' | 'activating' | 'active' | 'stopping' | 'failed';
|
|
55
|
+
readonly requestId?: string;
|
|
56
|
+
readonly target?: Record<string, unknown>;
|
|
57
|
+
readonly durationMs?: number;
|
|
58
|
+
readonly expiresAt?: number;
|
|
59
|
+
readonly failure?: {
|
|
60
|
+
readonly code: string;
|
|
61
|
+
readonly message: string;
|
|
62
|
+
};
|
|
63
|
+
readonly artifact?: ComputerUseArtifactView;
|
|
64
|
+
}
|
|
65
|
+
interface ComputerUseActivationRequest {
|
|
66
|
+
readonly requestId: string;
|
|
67
|
+
readonly target?: Record<string, unknown>;
|
|
68
|
+
readonly durationSeconds: number;
|
|
69
|
+
readonly createdAt: number;
|
|
70
|
+
readonly confirmationExpiresAt: number;
|
|
71
|
+
readonly caller: DoomApiCaller;
|
|
72
|
+
}
|
|
73
|
+
interface ComputerUseBrokerRequest {
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly operation: 'observe' | 'act';
|
|
76
|
+
readonly payload?: unknown;
|
|
77
|
+
readonly grantId: string;
|
|
78
|
+
readonly sequence?: number;
|
|
79
|
+
}
|
|
80
|
+
interface ComputerUseChannelPayload {
|
|
81
|
+
readonly state: ComputerUseSessionView;
|
|
82
|
+
readonly targets: readonly Record<string, unknown>[];
|
|
83
|
+
readonly busy?: true;
|
|
84
|
+
}
|
|
85
|
+
type ComputerUseBrowserCommand = {
|
|
86
|
+
readonly action: 'status' | 'targets' | 'stop' | 'artifacts';
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/types/computerUse.d.ts
|
|
90
|
+
interface ComputerUseSessionClient {
|
|
91
|
+
state(signal?: AbortSignal): Promise<ComputerUseSessionView>;
|
|
92
|
+
subscribeStatus?(listener: (state: ComputerUseSessionView) => void): () => void;
|
|
93
|
+
observe(signal?: AbortSignal, options?: ComputerUseObservationOptions): Promise<ComputerUseObservation>;
|
|
94
|
+
act(action: ComputerUseAction, signal?: AbortSignal): Promise<unknown>;
|
|
95
|
+
stop(signal?: AbortSignal): Promise<ComputerUseSessionView>;
|
|
96
|
+
}
|
|
97
|
+
interface ComputerUseObservationOptions {
|
|
98
|
+
includeScreenshot?: boolean;
|
|
99
|
+
}
|
|
100
|
+
declare const COMPUTER_USE_PHASES: readonly ['inactive', 'requesting', 'awaiting_confirmation', 'activating', 'active', 'stopping', 'failed'];
|
|
101
|
+
type ComputerUsePhase = (typeof COMPUTER_USE_PHASES)[number];
|
|
102
|
+
interface ComputerUseSessionIdentity {
|
|
103
|
+
readonly sessionId: string;
|
|
104
|
+
readonly runtimeId: string;
|
|
105
|
+
readonly modeEpoch: string;
|
|
106
|
+
}
|
|
107
|
+
interface ComputerUseTarget {
|
|
108
|
+
readonly bundleId: string;
|
|
109
|
+
readonly applicationName: string;
|
|
110
|
+
readonly processId: number;
|
|
111
|
+
readonly windowId: string;
|
|
112
|
+
readonly windowTitle: string;
|
|
113
|
+
}
|
|
114
|
+
interface ComputerUseGrant {
|
|
115
|
+
readonly runId: string;
|
|
116
|
+
readonly grantId: string;
|
|
117
|
+
readonly hostGeneration: string;
|
|
118
|
+
readonly targetGeneration: string;
|
|
119
|
+
readonly expiresAt: number;
|
|
120
|
+
}
|
|
121
|
+
interface ComputerUseElement {
|
|
122
|
+
readonly ref: string;
|
|
123
|
+
readonly role: string;
|
|
124
|
+
readonly label?: string;
|
|
125
|
+
readonly value?: string;
|
|
126
|
+
readonly enabled: boolean;
|
|
127
|
+
readonly secure: boolean;
|
|
128
|
+
readonly actions: readonly ComputerUseActionKind[];
|
|
129
|
+
}
|
|
130
|
+
interface ComputerUseObservation {
|
|
131
|
+
readonly runId: string;
|
|
132
|
+
readonly snapshotId: string;
|
|
133
|
+
readonly targetGeneration: string;
|
|
134
|
+
readonly applicationName: string;
|
|
135
|
+
readonly bundleId: string;
|
|
136
|
+
readonly windowTitle: string;
|
|
137
|
+
readonly elements: readonly ComputerUseElement[];
|
|
138
|
+
readonly screenshot?: {
|
|
139
|
+
readonly mimeType: 'image/png';
|
|
140
|
+
readonly data: string;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
type ComputerUseActionKind = 'press' | 'focus' | 'set_value' | 'scroll';
|
|
144
|
+
type ComputerUseAction = {
|
|
145
|
+
readonly kind: 'press' | 'focus';
|
|
146
|
+
readonly snapshotId: string;
|
|
147
|
+
readonly elementRef: string;
|
|
148
|
+
} | {
|
|
149
|
+
readonly kind: 'set_value';
|
|
150
|
+
readonly snapshotId: string;
|
|
151
|
+
readonly elementRef: string;
|
|
152
|
+
readonly value: string;
|
|
153
|
+
} | {
|
|
154
|
+
readonly kind: 'scroll';
|
|
155
|
+
readonly snapshotId: string;
|
|
156
|
+
readonly elementRef: string;
|
|
157
|
+
readonly direction: 'up' | 'down' | 'left' | 'right';
|
|
158
|
+
readonly amount: 'line' | 'page';
|
|
159
|
+
};
|
|
160
|
+
type ComputerUseFailureCode = 'busy_in_another_session' | 'desktop_unavailable' | 'permission_required_on_mac' | 'confirmation_denied' | 'confirmation_expired' | 'target_invalid' | 'target_lost' | 'recording_failed' | 'trace_failed' | 'grant_expired' | 'stale_request' | 'outcome_uncertain' | 'internal_error';
|
|
161
|
+
interface ComputerUseState {
|
|
162
|
+
readonly revision: number;
|
|
163
|
+
readonly phase: ComputerUsePhase;
|
|
164
|
+
readonly identity: ComputerUseSessionIdentity;
|
|
165
|
+
readonly requestId?: string;
|
|
166
|
+
readonly target?: ComputerUseTarget;
|
|
167
|
+
readonly grant?: ComputerUseGrant;
|
|
168
|
+
readonly failure?: {
|
|
169
|
+
readonly code: ComputerUseFailureCode;
|
|
170
|
+
readonly message: string;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
type ComputerUseStateEvent = {
|
|
174
|
+
readonly type: 'request';
|
|
175
|
+
readonly requestId: string;
|
|
176
|
+
readonly target: ComputerUseTarget;
|
|
177
|
+
} | {
|
|
178
|
+
readonly type: 'await_confirmation';
|
|
179
|
+
readonly requestId: string;
|
|
180
|
+
} | {
|
|
181
|
+
readonly type: 'confirm';
|
|
182
|
+
readonly requestId: string;
|
|
183
|
+
} | {
|
|
184
|
+
readonly type: 'deny';
|
|
185
|
+
readonly requestId: string;
|
|
186
|
+
} | {
|
|
187
|
+
readonly type: 'activated';
|
|
188
|
+
readonly requestId: string;
|
|
189
|
+
readonly grant: ComputerUseGrant;
|
|
190
|
+
} | {
|
|
191
|
+
readonly type: 'stop';
|
|
192
|
+
} | {
|
|
193
|
+
readonly type: 'stopped';
|
|
194
|
+
} | {
|
|
195
|
+
readonly type: 'fail';
|
|
196
|
+
readonly code: ComputerUseFailureCode;
|
|
197
|
+
readonly message: string;
|
|
198
|
+
} | {
|
|
199
|
+
readonly type: 'reset';
|
|
200
|
+
};
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/services/sessionApiClient/index.d.ts
|
|
203
|
+
/** Uses the injected host-owned service. Absence never triggers transport or credential discovery. */
|
|
204
|
+
export declare function createComputerUseSessionClient(host?: ComputerUseSessionClient): ComputerUseSessionClient | undefined;
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/types/computerScript.d.ts
|
|
207
|
+
interface ComputerScriptProgram {
|
|
208
|
+
observe(options?: ComputerUseObservationOptions): Promise<ComputerUseObservation>;
|
|
209
|
+
act(action: ComputerUseAction): Promise<unknown>;
|
|
210
|
+
}
|
|
211
|
+
interface ComputerScriptLogger {
|
|
212
|
+
debug(message: string): void;
|
|
213
|
+
info(message: string): void;
|
|
214
|
+
warn(message: string): void;
|
|
215
|
+
error(message: string): void;
|
|
216
|
+
}
|
|
217
|
+
interface ComputerScriptRunContext {
|
|
218
|
+
context: {
|
|
219
|
+
program: ComputerScriptProgram;
|
|
220
|
+
};
|
|
221
|
+
input: unknown;
|
|
222
|
+
logger: ComputerScriptLogger;
|
|
223
|
+
/** Portable cancellation surface. Trusted Node scripts receive the full AbortSignal. */
|
|
224
|
+
signal: Pick<AbortSignal, 'aborted' | 'throwIfAborted'>;
|
|
225
|
+
}
|
|
226
|
+
/** Both a synchronous result and a promise are accepted and awaited by the worker. */
|
|
227
|
+
type ComputerScriptRun = (options: ComputerScriptRunContext) => unknown;
|
|
228
|
+
interface ComputerScriptExecutionResult {
|
|
229
|
+
result?: unknown;
|
|
230
|
+
observation: ComputerUseObservation;
|
|
231
|
+
logs: readonly string[];
|
|
232
|
+
metrics?: {
|
|
233
|
+
actions: number;
|
|
234
|
+
observations: number;
|
|
235
|
+
durationMs: number;
|
|
236
|
+
outputBytes: number;
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
interface ComputerScriptExecutionOptions {
|
|
240
|
+
/** Full Node execution additionally requires an exact host-configured path allowlist. */
|
|
241
|
+
trusted?: boolean;
|
|
242
|
+
includeScreenshot?: boolean;
|
|
243
|
+
}
|
|
244
|
+
interface ComputerScriptExecutor {
|
|
245
|
+
execute(scriptPath: string, input: unknown, signal?: AbortSignal, options?: ComputerScriptExecutionOptions, cwd?: string): Promise<ComputerScriptExecutionResult>;
|
|
246
|
+
}
|
|
247
|
+
interface ComputerScriptRunnerOptions {
|
|
248
|
+
readonly client: ComputerUseSessionClient;
|
|
249
|
+
readonly allowedScriptPaths: readonly string[];
|
|
250
|
+
/** Host-admitted root for generated functions and their relative helper modules. */
|
|
251
|
+
readonly scriptRoot?: string;
|
|
252
|
+
readonly timeoutMs?: number;
|
|
253
|
+
readonly maxOutputBytes?: number;
|
|
254
|
+
}
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/types/extension.d.ts
|
|
257
|
+
type ComputerUseNotificationLevel = 'info' | 'error';
|
|
258
|
+
interface ComputerUseExtensionResult {
|
|
259
|
+
message: string;
|
|
260
|
+
level: ComputerUseNotificationLevel;
|
|
261
|
+
}
|
|
262
|
+
interface ComputerUseExtensionService {
|
|
263
|
+
execute(): Promise<ComputerUseExtensionResult>;
|
|
264
|
+
}
|
|
265
|
+
interface ComputerUseExtensionDependencies {
|
|
266
|
+
service: ComputerUseExtensionService;
|
|
267
|
+
client?: ComputerUseSessionClient;
|
|
268
|
+
scriptRunner?: ComputerScriptExecutor;
|
|
269
|
+
enabled?: (cwd?: string) => boolean | Promise<boolean>;
|
|
270
|
+
}
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/services/dependencies/index.d.ts
|
|
273
|
+
export declare const COMPUTER_USE_SCRIPT_PATHS_ENV = "PO_COMPUTER_USE_SCRIPT_PATHS";
|
|
274
|
+
export declare function createComputerUseDependencies(overrides?: Partial<ComputerUseExtensionDependencies>): ComputerUseExtensionDependencies;
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/services/computerScriptRunner/index.d.ts
|
|
277
|
+
export declare class ComputerScriptRunner {
|
|
278
|
+
private readonly client;
|
|
279
|
+
private readonly allowedScriptPaths;
|
|
280
|
+
private readonly scriptRoot?;
|
|
281
|
+
private readonly timeoutMs;
|
|
282
|
+
private readonly maxOutputBytes;
|
|
283
|
+
constructor(options: ComputerScriptRunnerOptions);
|
|
284
|
+
execute(scriptPath: string, input: unknown, signal?: AbortSignal, options?: ComputerScriptExecutionOptions, cwd?: string): Promise<ComputerScriptExecutionResult>;
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/services/extensionService/index.d.ts
|
|
288
|
+
export declare class DefaultComputerUseExtensionService implements ComputerUseExtensionService {
|
|
289
|
+
private readonly client?;
|
|
290
|
+
constructor(client?: ComputerUseSessionClient | undefined);
|
|
291
|
+
execute(): Promise<ComputerUseExtensionResult>;
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/models/computerUseState.d.ts
|
|
295
|
+
export declare function initialComputerUseState(identity: ComputerUseState['identity']): ComputerUseState;
|
|
296
|
+
export declare function reduceComputerUseState(state: ComputerUseState, event: ComputerUseStateEvent): ComputerUseState;
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/services/traceRedaction/index.d.ts
|
|
299
|
+
interface ComputerUseTraceInput {
|
|
300
|
+
readonly sequence: number;
|
|
301
|
+
readonly timestamp: number;
|
|
302
|
+
readonly runId: string;
|
|
303
|
+
readonly bundleId: string;
|
|
304
|
+
readonly action: ComputerUseAction;
|
|
305
|
+
readonly role?: string;
|
|
306
|
+
readonly durationMs: number;
|
|
307
|
+
readonly outcome: 'succeeded' | 'failed' | 'uncertain';
|
|
308
|
+
readonly errorCode?: ComputerUseFailureCode;
|
|
309
|
+
}
|
|
310
|
+
interface ComputerUseTraceRecord {
|
|
311
|
+
readonly sequence: number;
|
|
312
|
+
readonly timestamp: number;
|
|
313
|
+
readonly runId: string;
|
|
314
|
+
readonly bundleId: string;
|
|
315
|
+
readonly actionKind: ComputerUseAction['kind'];
|
|
316
|
+
readonly role?: string;
|
|
317
|
+
readonly textLength?: number;
|
|
318
|
+
readonly durationMs: number;
|
|
319
|
+
readonly outcome: ComputerUseTraceInput['outcome'];
|
|
320
|
+
readonly errorCode?: ComputerUseFailureCode;
|
|
321
|
+
}
|
|
322
|
+
export declare function redactComputerUseTrace(input: ComputerUseTraceInput): ComputerUseTraceRecord;
|
|
323
|
+
//#endregion
|
|
324
|
+
export type { API_BASE_PATH, COMPUTER_USE_CONFIRMATION_WINDOW_MS, COMPUTER_USE_DEFAULT_DURATION_MS, COMPUTER_USE_MAX_DURATION_MS, COMPUTER_USE_MODE_ID, COMPUTER_USE_MODE_STATUS_KEY, COMPUTER_USE_PHASES, COMPUTER_USE_ROUTES, COMPUTER_USE_STATUS_KEY, COMPUTER_USE_WAKE_LIMIT, ComputerScriptExecutionOptions, ComputerScriptExecutionResult, ComputerScriptExecutor, ComputerScriptLogger, ComputerScriptProgram, ComputerScriptRun, ComputerScriptRunContext, ComputerScriptRunnerOptions, ComputerUseAction, ComputerUseActionKind, ComputerUseActivationRequest, ComputerUseArtifactView, ComputerUseBrokerRequest, ComputerUseBrowserCommand, ComputerUseChannelPayload, ComputerUseElement, ComputerUseExtensionDependencies, ComputerUseExtensionResult, ComputerUseExtensionService, ComputerUseFailureCode, ComputerUseGrant, ComputerUseNotificationLevel, ComputerUseObservation, ComputerUseObservationOptions, ComputerUsePhase, ComputerUseSessionClient, ComputerUseSessionIdentity, ComputerUseSessionView, ComputerUseState, ComputerUseStateEvent, ComputerUseTarget, computerUseChannelType };
|
|
325
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/constants/computerUse.ts","../src/types/computerUseApi.ts","../src/types/computerUse.ts","../src/services/sessionApiClient/index.ts","../src/types/computerScript.ts","../src/types/extension.ts","../src/services/dependencies/index.ts","../src/services/computerScriptRunner/index.ts","../src/services/extensionService/index.ts","../src/models/computerUseState.ts","../src/services/traceRedaction/index.ts"],"mappings":";;qBAAa;qBAKA;;;cCHA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;;;;;;;;cASA;WACX;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;cAGW;UAEI;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;aAAqB;aAAuB;;;UAGtC;WACN;WACA;WACA;WACA;WACA;WACA,SAAS;WACT;WACA;WACA;aAAqB;aAAuB;;WAC5C,WAAW;;UAGL;WACN;WACA,SAAS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