@agimon-ai/po-computer-use 0.0.0-alpha.0 → 0.0.0-stage
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 +2 -48
- package/package.json +3 -144
- package/LICENSE +0 -21
- package/dist/apiContracts.cjs +0 -242
- package/dist/apiContracts.cjs.map +0 -1
- package/dist/apiContracts.d.mts +0 -53
- package/dist/apiContracts.d.mts.map +0 -1
- package/dist/apiContracts.mjs +0 -237
- package/dist/apiContracts.mjs.map +0 -1
- package/dist/extensionService-Bp0q295i.cjs +0 -504
- package/dist/extensionService-Bp0q295i.cjs.map +0 -1
- package/dist/extensionService-DXvF7esO.mjs +0 -434
- package/dist/extensionService-DXvF7esO.mjs.map +0 -1
- package/dist/extensions/mcp-ui.mjs +0 -47
- package/dist/extensions/mcp-ui.mjs.map +0 -1
- package/dist/extensions/mcp.cjs +0 -66
- package/dist/extensions/mcp.cjs.map +0 -1
- package/dist/extensions/mcp.d.mts +0 -5
- package/dist/extensions/mcp.d.mts.map +0 -1
- package/dist/extensions/mcp.mjs +0 -61
- package/dist/extensions/mcp.mjs.map +0 -1
- package/dist/extensions/server.cjs +0 -1394
- package/dist/extensions/server.cjs.map +0 -1
- package/dist/extensions/server.d.mts +0 -5
- package/dist/extensions/server.d.mts.map +0 -1
- package/dist/extensions/server.mjs +0 -1388
- package/dist/extensions/server.mjs.map +0 -1
- package/dist/extensions/web.mjs +0 -771
- package/dist/extensions/web.mjs.map +0 -1
- package/dist/index.cjs +0 -140
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -325
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -129
- package/dist/index.mjs.map +0 -1
- package/docs/computer-scripts.md +0 -72
- package/llms.txt +0 -12
- package/src/prompts/po-use-computer-use/SKILL.md +0 -34
- package/src/types/computerUse.ts +0 -132
- package/src/types/computerUseApi.ts +0 -83
package/README.md
CHANGED
|
@@ -1,49 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Temporary Holding Version
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Requirements
|
|
6
|
-
|
|
7
|
-
- Node.js 24 or newer
|
|
8
|
-
- A supported packaged macOS Po Desktop with native Computer Use permissions
|
|
9
|
-
- The Pi version declared by this package's peer dependencies
|
|
10
|
-
|
|
11
|
-
## Use
|
|
12
|
-
|
|
13
|
-
In Desktop, enable Computer Use in global settings, then select the default-off **Computer Use** minor mode. Its Activity section lists eligible application windows and starts native confirmation. Only one session can hold a live Desktop run. The setting, minor-mode row, and Activity group are hidden in a normal browser, including a browser opened against the Desktop server.
|
|
14
|
-
|
|
15
|
-
The `computer-use` minor mode exposes Activate, Deactivate, and Doctor actions. `/computer-use` reports the current state.
|
|
16
|
-
|
|
17
|
-
While active, the package exposes three tools:
|
|
18
|
-
|
|
19
|
-
- `computer_state` observes the authorized window and returns a semantic snapshot.
|
|
20
|
-
- `computer_action` performs one semantic press, focus change, value change, or scroll against a current snapshot.
|
|
21
|
-
- `computer_exec` executes a reusable JavaScript or erasable TypeScript function and its relative helpers in a restricted runtime, then returns a fresh semantic observation.
|
|
22
|
-
|
|
23
|
-
Generated functions receive the authorized program API, JSON input, bounded logging, and cancellation. They do not receive Node or filesystem access. Script-internal observations omit screenshots by default, and `includeScreenshot: true` requests an image explicitly. Full Node execution requires both `trusted: true` and an exact host-configured `PO_COMPUTER_USE_SCRIPT_PATHS` allowlist. Trusted scripts remain unsandboxed, including their imported dependencies. See [Author computer functions](./docs/computer-scripts.md) for the contract, limits, trust boundary, and examples.
|
|
24
|
-
|
|
25
|
-
All three tools remain unavailable during setup and are admitted only after the native grant becomes active. Disabling the mode or global opt-in, stopping control, expiry, or Desktop disconnection stops further actions. Once Desktop claims a session, browser and remote MCP clients cannot drive it, including previously attached clients. This ownership stays pinned for the server lifetime and is not restored from saved session data.
|
|
26
|
-
|
|
27
|
-
## Public API
|
|
28
|
-
|
|
29
|
-
```ts
|
|
30
|
-
import { ComputerScriptRunner, createComputerUseSessionClient } from '@agimon-ai/po-computer-use';
|
|
31
|
-
import type { ComputerScriptRun } from '@agimon-ai/po-computer-use';
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
The session-scoped server facet owns the agent and hub routes. Their host-issued context tokens remain opaque and session-bound inside the request broker.
|
|
35
|
-
|
|
36
|
-
## Development
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
pnpm fixcode
|
|
40
|
-
pnpm typecheck
|
|
41
|
-
pnpm test
|
|
42
|
-
pnpm build
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## License
|
|
46
|
-
|
|
47
|
-
MIT
|
|
48
|
-
|
|
49
|
-
Direct plugin routes live in `src/extensions`. The session root constructs one broker shared by the typed agent client and activation API. The host owns the Desktop IPC connection, native renderer authentication, session identity, and grant lifetime. The hub channel uses lifecycle events rather than polling to forward operations. Public exports remain under `src/exports`.
|
|
3
|
+
This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
|
package/package.json
CHANGED
|
@@ -1,147 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-computer-use",
|
|
3
|
-
"version": "0.0.0-
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"ai",
|
|
7
|
-
"coding-agent",
|
|
8
|
-
"computer-use",
|
|
9
|
-
"developer-tools",
|
|
10
|
-
"pi-coding-agent",
|
|
11
|
-
"pi-extension",
|
|
12
|
-
"pi-package",
|
|
13
|
-
"po",
|
|
14
|
-
"typescript"
|
|
15
|
-
],
|
|
16
|
-
"homepage": "https://agimon.ai",
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/AgiFlow/po/issues"
|
|
19
|
-
},
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"author": "Vuong Ngo",
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/AgiFlow/po.git",
|
|
25
|
-
"directory": "packages/minor/po-computer-use"
|
|
26
|
-
},
|
|
27
|
-
"files": [
|
|
28
|
-
"dist",
|
|
29
|
-
"docs",
|
|
30
|
-
"src/types/computerUse.ts",
|
|
31
|
-
"src/types/computerUseApi.ts",
|
|
32
|
-
"src/prompts",
|
|
33
|
-
"llms.txt",
|
|
34
|
-
"README.md",
|
|
35
|
-
"LICENSE",
|
|
36
|
-
"package.json"
|
|
37
|
-
],
|
|
38
|
-
"type": "module",
|
|
39
|
-
"main": "./dist/index.cjs",
|
|
40
|
-
"module": "./dist/index.mjs",
|
|
41
|
-
"types": "./dist/index.d.mts",
|
|
42
|
-
"jsnext:main": "./dist/index.mjs",
|
|
43
|
-
"exports": {
|
|
44
|
-
".": {
|
|
45
|
-
"types": "./dist/index.d.mts",
|
|
46
|
-
"import": "./dist/index.mjs",
|
|
47
|
-
"require": "./dist/index.cjs"
|
|
48
|
-
},
|
|
49
|
-
"./extensions/server": {
|
|
50
|
-
"types": "./dist/extensions/server.d.mts",
|
|
51
|
-
"import": "./dist/extensions/server.mjs",
|
|
52
|
-
"require": "./dist/extensions/server.cjs"
|
|
53
|
-
},
|
|
54
|
-
"./extensions/web": {
|
|
55
|
-
"import": "./dist/extensions/web.mjs"
|
|
56
|
-
},
|
|
57
|
-
"./package.json": "./package.json"
|
|
58
|
-
},
|
|
59
|
-
"publishConfig": {
|
|
60
|
-
"access": "public"
|
|
61
|
-
},
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"@agimon-ai/po-config": "0.0.0-alpha.0",
|
|
64
|
-
"@agimon-ai/po-core": "0.0.0-alpha.0",
|
|
65
|
-
"@agimon-ai/po-minor-mode": "0.0.0-alpha.0",
|
|
66
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.0",
|
|
67
|
-
"@agimon-ai/po-web-security": "0.0.0-alpha.0",
|
|
68
|
-
"@deepseek-ai/cordis": "4.0.4",
|
|
69
|
-
"quickjs-emscripten": "0.32.0",
|
|
70
|
-
"typebox": "1.3.34"
|
|
71
|
-
},
|
|
72
|
-
"devDependencies": {
|
|
73
|
-
"@agimon-ai/po-build": "0.0.0-alpha.0",
|
|
74
|
-
"@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.0-alpha.0",
|
|
75
|
-
"@earendil-works/pi-coding-agent": "1.0.2",
|
|
76
|
-
"@tanstack/react-store": "0.11.2",
|
|
77
|
-
"@tanstack/store": "0.11.2",
|
|
78
|
-
"@types/node": "26.6.4",
|
|
79
|
-
"@types/react": "19.3.0",
|
|
80
|
-
"@vitest/coverage-v8": "5.0.3",
|
|
81
|
-
"react": "19.3.0",
|
|
82
|
-
"react-dom": "19.3.0",
|
|
83
|
-
"tsdown": "0.23.0",
|
|
84
|
-
"typescript": "7.0.2",
|
|
85
|
-
"vitest": "5.0.3"
|
|
86
|
-
},
|
|
87
|
-
"peerDependencies": {
|
|
88
|
-
"@earendil-works/pi-coding-agent": "1.0.2"
|
|
89
|
-
},
|
|
90
|
-
"peerDependenciesMeta": {
|
|
91
|
-
"@earendil-works/pi-coding-agent": {
|
|
92
|
-
"optional": true
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"engines": {
|
|
96
|
-
"node": ">=24"
|
|
97
|
-
},
|
|
98
|
-
"poMcp": {
|
|
99
|
-
"entry": "./generated/mcp.ts",
|
|
100
|
-
"dist": "./dist/extensions/mcp.mjs",
|
|
101
|
-
"scopes": [
|
|
102
|
-
"session"
|
|
103
|
-
],
|
|
104
|
-
"ui": {
|
|
105
|
-
"entry": "./generated/mcp-ui.ts",
|
|
106
|
-
"dist": "./dist/extensions/mcp-ui.mjs",
|
|
107
|
-
"widgets": [
|
|
108
|
-
"@agimon-ai/po-computer-use/computer_action",
|
|
109
|
-
"@agimon-ai/po-computer-use/computer_exec",
|
|
110
|
-
"@agimon-ai/po-computer-use/computer_state"
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
"poServer": {
|
|
115
|
-
"entry": "./generated/server.ts",
|
|
116
|
-
"dist": "./dist/extensions/server.mjs",
|
|
117
|
-
"scopes": [
|
|
118
|
-
"global",
|
|
119
|
-
"workspace",
|
|
120
|
-
"session"
|
|
121
|
-
],
|
|
122
|
-
"contracts": {
|
|
123
|
-
"entry": "./src/exports/apiContracts.ts",
|
|
124
|
-
"dist": "./dist/apiContracts.mjs"
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"poWeb": {
|
|
128
|
-
"pluginId": "computer-use",
|
|
129
|
-
"channels": [
|
|
130
|
-
"computer_use"
|
|
131
|
-
],
|
|
132
|
-
"client": "./dist/extensions/web.mjs",
|
|
133
|
-
"scopes": [
|
|
134
|
-
"global",
|
|
135
|
-
"workspace",
|
|
136
|
-
"session"
|
|
137
|
-
]
|
|
138
|
-
},
|
|
139
|
-
"scripts": {
|
|
140
|
-
"build": "tsdown && tsdown --config tsdown.mcp.config.ts",
|
|
141
|
-
"build:mcp": "tsdown --config tsdown.mcp.config.ts",
|
|
142
|
-
"test": "vitest --run",
|
|
143
|
-
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.web.json && tsc --noEmit -p tsconfig.mcp.json",
|
|
144
|
-
"lint": "oxlint . && oxfmt . --check",
|
|
145
|
-
"fixcode": "oxlint . --fix && oxfmt ."
|
|
146
|
-
}
|
|
3
|
+
"version": "0.0.0-stage",
|
|
4
|
+
"stub": true,
|
|
5
|
+
"description": "Temporary package placeholder for staged publishing"
|
|
147
6
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Vuong Ngo
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/apiContracts.cjs
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
|
|
6
|
-
let typebox = require("typebox");
|
|
7
|
-
//#region src/schemas/apiContracts.ts
|
|
8
|
-
const S = typebox.Type.String();
|
|
9
|
-
const N = typebox.Type.Number();
|
|
10
|
-
const O = typebox.Type.Optional;
|
|
11
|
-
const values = (items) => typebox.Type.Union(items.map((item) => typebox.Type.Literal(item)));
|
|
12
|
-
const Json = typebox.Type.Unknown({ description: "Desktop provider JSON value. Targets, observations and action results are supplied by the admitted Desktop provider." });
|
|
13
|
-
const Target = typebox.Type.Record(S, Json);
|
|
14
|
-
const Error = typebox.Type.Object({
|
|
15
|
-
code: S,
|
|
16
|
-
message: S
|
|
17
|
-
});
|
|
18
|
-
const Artifact = typebox.Type.Object({
|
|
19
|
-
artifactId: S,
|
|
20
|
-
status: values(["ready", "failed"]),
|
|
21
|
-
sizeBytes: O(N),
|
|
22
|
-
downloadUrl: O(S),
|
|
23
|
-
previewUrl: O(S),
|
|
24
|
-
actionCount: O(N),
|
|
25
|
-
completedAt: O(S),
|
|
26
|
-
failure: O(Error)
|
|
27
|
-
});
|
|
28
|
-
const ComputerStateSchema = typebox.Type.Object({
|
|
29
|
-
sessionId: S,
|
|
30
|
-
revision: N,
|
|
31
|
-
wake: N,
|
|
32
|
-
phase: values([
|
|
33
|
-
"inactive",
|
|
34
|
-
"awaiting_confirmation",
|
|
35
|
-
"activating",
|
|
36
|
-
"active",
|
|
37
|
-
"stopping",
|
|
38
|
-
"failed"
|
|
39
|
-
]),
|
|
40
|
-
requestId: O(S),
|
|
41
|
-
target: O(Target),
|
|
42
|
-
durationMs: O(N),
|
|
43
|
-
expiresAt: O(N),
|
|
44
|
-
failure: O(Error),
|
|
45
|
-
artifact: O(Artifact)
|
|
46
|
-
});
|
|
47
|
-
const Reference = {
|
|
48
|
-
snapshotId: typebox.Type.String({ minLength: 1 }),
|
|
49
|
-
elementRef: typebox.Type.String({ minLength: 1 })
|
|
50
|
-
};
|
|
51
|
-
const ComputerActionSchema = typebox.Type.Union([
|
|
52
|
-
typebox.Type.Object({
|
|
53
|
-
kind: values(["press", "focus"]),
|
|
54
|
-
...Reference
|
|
55
|
-
}, { additionalProperties: false }),
|
|
56
|
-
typebox.Type.Object({
|
|
57
|
-
kind: typebox.Type.Literal("set_value"),
|
|
58
|
-
...Reference,
|
|
59
|
-
value: S
|
|
60
|
-
}, { additionalProperties: false }),
|
|
61
|
-
typebox.Type.Object({
|
|
62
|
-
kind: typebox.Type.Literal("scroll"),
|
|
63
|
-
...Reference,
|
|
64
|
-
direction: values([
|
|
65
|
-
"up",
|
|
66
|
-
"down",
|
|
67
|
-
"left",
|
|
68
|
-
"right"
|
|
69
|
-
]),
|
|
70
|
-
amount: values(["line", "page"])
|
|
71
|
-
}, { additionalProperties: false })
|
|
72
|
-
]);
|
|
73
|
-
const internal = (method, path, output, body, status = 200) => ({
|
|
74
|
-
id: `computer.${path.slice(1).replaceAll("/", ".")}`,
|
|
75
|
-
scope: "session",
|
|
76
|
-
basePath: "computer-use",
|
|
77
|
-
path,
|
|
78
|
-
method,
|
|
79
|
-
authentication: "owner",
|
|
80
|
-
description: `Computer use broker ${path}. Requires the host-issued ${path.startsWith("/agent/") ? "agent" : "hub"} bearer token.`,
|
|
81
|
-
availability: "Internal broker route; ordinary browser credentials are insufficient.",
|
|
82
|
-
parameters: [{
|
|
83
|
-
name: "Authorization",
|
|
84
|
-
in: "header",
|
|
85
|
-
required: true,
|
|
86
|
-
schema: typebox.Type.String({ pattern: "^Bearer .+" })
|
|
87
|
-
}],
|
|
88
|
-
...body ? { body: {
|
|
89
|
-
required: true,
|
|
90
|
-
contentType: "application/json",
|
|
91
|
-
schema: body
|
|
92
|
-
} } : {},
|
|
93
|
-
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(output, status)
|
|
94
|
-
});
|
|
95
|
-
const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
96
|
-
version: 1,
|
|
97
|
-
dynamic: ["Desktop provider target extensions, observations and operation results are runtime-defined JSON."],
|
|
98
|
-
http: [
|
|
99
|
-
{
|
|
100
|
-
id: "computer.activation.state",
|
|
101
|
-
scope: "session",
|
|
102
|
-
basePath: "computer-use",
|
|
103
|
-
path: "/activate",
|
|
104
|
-
method: "GET",
|
|
105
|
-
authentication: "owner",
|
|
106
|
-
description: "Read state as the matching pending requester or approved recording reader.",
|
|
107
|
-
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(ComputerStateSchema)
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
id: "computer.activation.cancel",
|
|
111
|
-
scope: "session",
|
|
112
|
-
basePath: "computer-use",
|
|
113
|
-
path: "/activate",
|
|
114
|
-
method: "DELETE",
|
|
115
|
-
authentication: "owner",
|
|
116
|
-
description: "Cancel only the matching requester pending activation.",
|
|
117
|
-
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(ComputerStateSchema, 202)
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: "computer.activate",
|
|
121
|
-
scope: "session",
|
|
122
|
-
basePath: "computer-use",
|
|
123
|
-
path: "/activate",
|
|
124
|
-
method: "POST",
|
|
125
|
-
authentication: "owner",
|
|
126
|
-
description: "Request confirmed Desktop access with admitted caller and remote step-up context. A remote caller may omit target so the local Mac selects the window.",
|
|
127
|
-
body: {
|
|
128
|
-
required: true,
|
|
129
|
-
contentType: "application/json",
|
|
130
|
-
schema: typebox.Type.Object({
|
|
131
|
-
target: O(typebox.Type.Object({
|
|
132
|
-
windowId: S,
|
|
133
|
-
bundleId: S
|
|
134
|
-
})),
|
|
135
|
-
durationMs: typebox.Type.Integer({
|
|
136
|
-
minimum: 1e3,
|
|
137
|
-
maximum: 18e5
|
|
138
|
-
})
|
|
139
|
-
})
|
|
140
|
-
},
|
|
141
|
-
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(ComputerStateSchema, 202)
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
id: "computer.artifact",
|
|
145
|
-
scope: "session",
|
|
146
|
-
basePath: "computer-use",
|
|
147
|
-
path: "/artifact",
|
|
148
|
-
method: "GET",
|
|
149
|
-
authentication: "owner",
|
|
150
|
-
description: "Read at most 1 MiB of a recording belonging to this session and approved caller.",
|
|
151
|
-
parameters: [{
|
|
152
|
-
name: "artifactId",
|
|
153
|
-
in: "query",
|
|
154
|
-
required: true,
|
|
155
|
-
schema: S
|
|
156
|
-
}, {
|
|
157
|
-
name: "offset",
|
|
158
|
-
in: "query",
|
|
159
|
-
required: true,
|
|
160
|
-
schema: typebox.Type.Integer({ minimum: 0 })
|
|
161
|
-
}],
|
|
162
|
-
responses: { 206: {
|
|
163
|
-
description: "Bounded recording bytes.",
|
|
164
|
-
contentType: "video/mp4",
|
|
165
|
-
schema: typebox.Type.String({ format: "binary" })
|
|
166
|
-
} }
|
|
167
|
-
},
|
|
168
|
-
internal("GET", "/agent/state", ComputerStateSchema),
|
|
169
|
-
internal("GET", "/hub/state", ComputerStateSchema),
|
|
170
|
-
internal("POST", "/agent/observe", Json),
|
|
171
|
-
internal("POST", "/agent/action", Json, ComputerActionSchema),
|
|
172
|
-
internal("POST", "/agent/stop", ComputerStateSchema, void 0, 202),
|
|
173
|
-
internal("GET", "/hub/activation", typebox.Type.Union([typebox.Type.Null(), typebox.Type.Object({
|
|
174
|
-
requestId: S,
|
|
175
|
-
target: Target,
|
|
176
|
-
durationSeconds: N,
|
|
177
|
-
createdAt: N,
|
|
178
|
-
confirmationExpiresAt: N,
|
|
179
|
-
caller: typebox.Type.Object({
|
|
180
|
-
locality: values(["local", "remote"]),
|
|
181
|
-
stepUp: S
|
|
182
|
-
})
|
|
183
|
-
})])),
|
|
184
|
-
internal("GET", "/hub/authorization", typebox.Type.Union([typebox.Type.Null(), typebox.Type.Object({
|
|
185
|
-
grantId: S,
|
|
186
|
-
expiresAt: O(N)
|
|
187
|
-
})])),
|
|
188
|
-
internal("GET", "/hub/next", typebox.Type.Union([typebox.Type.Null(), typebox.Type.Object({
|
|
189
|
-
id: S,
|
|
190
|
-
operation: values(["observe", "act"]),
|
|
191
|
-
payload: O(Json),
|
|
192
|
-
grantId: S,
|
|
193
|
-
sequence: O(N)
|
|
194
|
-
})])),
|
|
195
|
-
internal("POST", "/hub/complete", ComputerStateSchema, typebox.Type.Object({
|
|
196
|
-
id: S,
|
|
197
|
-
error: O(S),
|
|
198
|
-
result: O(Json)
|
|
199
|
-
})),
|
|
200
|
-
internal("POST", "/hub/stop", ComputerStateSchema, typebox.Type.Object({
|
|
201
|
-
error: O(S),
|
|
202
|
-
host: O(typebox.Type.Object({
|
|
203
|
-
grantId: S,
|
|
204
|
-
expiresAt: N
|
|
205
|
-
})),
|
|
206
|
-
artifact: O(Artifact)
|
|
207
|
-
}))
|
|
208
|
-
],
|
|
209
|
-
sockets: ["global", "workspace"].flatMap((scope) => [{
|
|
210
|
-
id: "computer.state",
|
|
211
|
-
scope,
|
|
212
|
-
service: "po.hub.v1",
|
|
213
|
-
member: "computer_use_state",
|
|
214
|
-
kind: "channel",
|
|
215
|
-
direction: "server-to-client",
|
|
216
|
-
description: "Computer use channel payload.",
|
|
217
|
-
input: typebox.Type.Object({
|
|
218
|
-
state: ComputerStateSchema,
|
|
219
|
-
targets: typebox.Type.Array(Target),
|
|
220
|
-
busy: O(typebox.Type.Literal(true))
|
|
221
|
-
})
|
|
222
|
-
}, {
|
|
223
|
-
id: "computer.command",
|
|
224
|
-
scope,
|
|
225
|
-
service: "po.hub.v1",
|
|
226
|
-
member: "computer_use_state",
|
|
227
|
-
kind: "channel",
|
|
228
|
-
direction: "client-to-server",
|
|
229
|
-
description: "Computer use browser channel command.",
|
|
230
|
-
input: typebox.Type.Object({ action: values([
|
|
231
|
-
"status",
|
|
232
|
-
"targets",
|
|
233
|
-
"stop",
|
|
234
|
-
"artifacts"
|
|
235
|
-
]) })
|
|
236
|
-
}])
|
|
237
|
-
});
|
|
238
|
-
//#endregion
|
|
239
|
-
exports.apiContracts = apiContracts;
|
|
240
|
-
exports.default = apiContracts;
|
|
241
|
-
|
|
242
|
-
//# sourceMappingURL=apiContracts.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.cjs","names":["Type","jsonApiResponses","defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses, type DoomHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nconst O = Type.Optional;\nconst values = <T extends string>(items: T[]) => Type.Union(items.map((item) => Type.Literal(item)));\nconst Json = Type.Unknown({\n description:\n 'Desktop provider JSON value. Targets, observations and action results are supplied by the admitted Desktop provider.',\n});\nconst Target = Type.Record(S, Json);\nconst Error = Type.Object({ code: S, message: S });\nconst Artifact = Type.Object({\n artifactId: S,\n status: values(['ready', 'failed']),\n sizeBytes: O(N),\n downloadUrl: O(S),\n previewUrl: O(S),\n actionCount: O(N),\n completedAt: O(S),\n failure: O(Error),\n});\nexport const ComputerStateSchema = Type.Object({\n sessionId: S,\n revision: N,\n wake: N,\n phase: values(['inactive', 'awaiting_confirmation', 'activating', 'active', 'stopping', 'failed']),\n requestId: O(S),\n target: O(Target),\n durationMs: O(N),\n expiresAt: O(N),\n failure: O(Error),\n artifact: O(Artifact),\n});\nconst Reference = { snapshotId: Type.String({ minLength: 1 }), elementRef: Type.String({ minLength: 1 }) };\nexport const ComputerActionSchema = Type.Union([\n Type.Object({ kind: values(['press', 'focus']), ...Reference }, { additionalProperties: false }),\n Type.Object({ kind: Type.Literal('set_value'), ...Reference, value: S }, { additionalProperties: false }),\n Type.Object(\n {\n kind: Type.Literal('scroll'),\n ...Reference,\n direction: values(['up', 'down', 'left', 'right']),\n amount: values(['line', 'page']),\n },\n { additionalProperties: false },\n ),\n]);\nconst internal = (\n method: 'GET' | 'POST',\n path: string,\n output: object,\n body?: object,\n status = 200,\n): DoomHttpContract => ({\n id: `computer.${path.slice(1).replaceAll('/', '.')}`,\n scope: 'session',\n basePath: 'computer-use',\n path,\n method,\n authentication: 'owner',\n description: `Computer use broker ${path}. Requires the host-issued ${path.startsWith('/agent/') ? 'agent' : 'hub'} bearer token.`,\n availability: 'Internal broker route; ordinary browser credentials are insufficient.',\n parameters: [{ name: 'Authorization', in: 'header', required: true, schema: Type.String({ pattern: '^Bearer .+' }) }],\n ...(body ? { body: { required: true, contentType: 'application/json', schema: body } } : {}),\n responses: jsonApiResponses(output, status),\n});\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: ['Desktop provider target extensions, observations and operation results are runtime-defined JSON.'],\n http: [\n {\n id: 'computer.activation.state',\n scope: 'session',\n basePath: 'computer-use',\n path: '/activate',\n method: 'GET',\n authentication: 'owner',\n description: 'Read state as the matching pending requester or approved recording reader.',\n responses: jsonApiResponses(ComputerStateSchema),\n },\n {\n id: 'computer.activation.cancel',\n scope: 'session',\n basePath: 'computer-use',\n path: '/activate',\n method: 'DELETE',\n authentication: 'owner',\n description: 'Cancel only the matching requester pending activation.',\n responses: jsonApiResponses(ComputerStateSchema, 202),\n },\n {\n id: 'computer.activate',\n scope: 'session',\n basePath: 'computer-use',\n path: '/activate',\n method: 'POST',\n authentication: 'owner',\n description:\n 'Request confirmed Desktop access with admitted caller and remote step-up context. A remote caller may omit target so the local Mac selects the window.',\n body: {\n required: true,\n contentType: 'application/json',\n schema: Type.Object({\n target: O(Type.Object({ windowId: S, bundleId: S })),\n durationMs: Type.Integer({ minimum: 1000, maximum: 1800000 }),\n }),\n },\n responses: jsonApiResponses(ComputerStateSchema, 202),\n },\n {\n id: 'computer.artifact',\n scope: 'session',\n basePath: 'computer-use',\n path: '/artifact',\n method: 'GET',\n authentication: 'owner',\n description: 'Read at most 1 MiB of a recording belonging to this session and approved caller.',\n parameters: [\n { name: 'artifactId', in: 'query', required: true, schema: S },\n { name: 'offset', in: 'query', required: true, schema: Type.Integer({ minimum: 0 }) },\n ],\n responses: {\n 206: {\n description: 'Bounded recording bytes.',\n contentType: 'video/mp4',\n schema: Type.String({ format: 'binary' }),\n },\n },\n },\n internal('GET', '/agent/state', ComputerStateSchema),\n internal('GET', '/hub/state', ComputerStateSchema),\n internal('POST', '/agent/observe', Json),\n internal('POST', '/agent/action', Json, ComputerActionSchema),\n internal('POST', '/agent/stop', ComputerStateSchema, undefined, 202),\n internal(\n 'GET',\n '/hub/activation',\n Type.Union([\n Type.Null(),\n Type.Object({\n requestId: S,\n target: Target,\n durationSeconds: N,\n createdAt: N,\n confirmationExpiresAt: N,\n caller: Type.Object({ locality: values(['local', 'remote']), stepUp: S }),\n }),\n ]),\n ),\n internal('GET', '/hub/authorization', Type.Union([Type.Null(), Type.Object({ grantId: S, expiresAt: O(N) })])),\n internal(\n 'GET',\n '/hub/next',\n Type.Union([\n Type.Null(),\n Type.Object({ id: S, operation: values(['observe', 'act']), payload: O(Json), grantId: S, sequence: O(N) }),\n ]),\n ),\n internal('POST', '/hub/complete', ComputerStateSchema, Type.Object({ id: S, error: O(S), result: O(Json) })),\n internal(\n 'POST',\n '/hub/stop',\n ComputerStateSchema,\n Type.Object({ error: O(S), host: O(Type.Object({ grantId: S, expiresAt: N })), artifact: O(Artifact) }),\n ),\n ],\n sockets: (['global', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'computer.state',\n scope,\n service: 'po.hub.v1',\n member: 'computer_use_state',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Computer use channel payload.',\n input: Type.Object({ state: ComputerStateSchema, targets: Type.Array(Target), busy: O(Type.Literal(true)) }),\n },\n {\n id: 'computer.command',\n scope,\n service: 'po.hub.v1',\n member: 'computer_use_state',\n kind: 'channel',\n direction: 'client-to-server',\n description: 'Computer use browser channel command.',\n input: Type.Object({ action: values(['status', 'targets', 'stop', 'artifacts']) }),\n },\n ]),\n});\nexport default apiContracts;\n"],"mappings":";;;;;;;AAGA,MAAM,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAM,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAM,IAAIA,QAAAA,KAAK;AACf,MAAM,UAA4B,UAAeA,QAAAA,KAAK,MAAM,MAAM,KAAK,SAASA,QAAAA,KAAK,QAAQ,IAAI,CAAC,CAAC;AACnG,MAAM,OAAOA,QAAAA,KAAK,QAAQ,EACxB,aACE,uHACJ,CAAC;AACD,MAAM,SAASA,QAAAA,KAAK,OAAO,GAAG,IAAI;AAClC,MAAM,QAAQA,QAAAA,KAAK,OAAO;CAAE,MAAM;CAAG,SAAS;AAAE,CAAC;AACjD,MAAM,WAAWA,QAAAA,KAAK,OAAO;CAC3B,YAAY;CACZ,QAAQ,OAAO,CAAC,SAAS,QAAQ,CAAC;CAClC,WAAW,EAAE,CAAC;CACd,aAAa,EAAE,CAAC;CAChB,YAAY,EAAE,C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;GAAG,QAAQ,EAAE,IAAI;EAAE,CAAC,CAAC;EAC3G,SACE,QACA,aACA,qBACAA,QAAAA,KAAK,OAAO;GAAE,OAAO,EAAE,CAAC;GAAG,MAAM,EAAEA,QAAAA,KAAK,OAAO;IAAE,SAAS;IAAG,WAAW;GAAE,CAAC,CAAC;GAAG,UAAU,EAAE,QAAQ;EAAE,CAAC,CACxG;CACF;CACA,SAAU,CAAC,UAAU,WAAW,CAAC,CAAW,SAAS,UAAU,CAC7D;EACE,IAAI;EACJ;EACA,SAAS;EACT,QAAQ;EACR,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAOA,QAAAA,KAAK,OAAO;GAAE,OAAO;GAAqB,SAASA,QAAAA,KAAK,MAAM,MAAM;GAAG,MAAM,EAAEA,QAAAA,KAAK,QAAQ,IAAI,CAAC;EAAE,CAAC;CAC7G,GACA;EACE,IAAI;EACJ;EACA,SAAS;EACT,QAAQ;EACR,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAOA,QAAAA,KAAK,OAAO,EAAE,QAAQ,OAAO;GAAC;GAAU;GAAW;GAAQ;EAAW,CAAC,EAAE,CAAC;CACnF,CACF,CAAC;AACH,CAAC"}
|
package/dist/apiContracts.d.mts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Type } from "typebox";
|
|
2
|
-
//#region src/schemas/apiContracts.d.ts
|
|
3
|
-
export declare const apiContracts: {
|
|
4
|
-
version: 1;
|
|
5
|
-
protocols?: Record<string, string> | undefined;
|
|
6
|
-
schemas?: Record<string, boolean | object> | undefined;
|
|
7
|
-
http: {
|
|
8
|
-
id: string;
|
|
9
|
-
scope: "global" | "session" | "workspace";
|
|
10
|
-
basePath?: string | undefined;
|
|
11
|
-
path: string;
|
|
12
|
-
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
13
|
-
description: string;
|
|
14
|
-
availability?: string | undefined;
|
|
15
|
-
authentication: "device" | "none" | "owner";
|
|
16
|
-
parameters?: {
|
|
17
|
-
name: string;
|
|
18
|
-
in: "header" | "path" | "query";
|
|
19
|
-
required: boolean;
|
|
20
|
-
schema: boolean | object;
|
|
21
|
-
}[] | undefined;
|
|
22
|
-
body?: {
|
|
23
|
-
contentType: string;
|
|
24
|
-
contentTypes?: string[] | undefined;
|
|
25
|
-
required: boolean;
|
|
26
|
-
schema: boolean | object;
|
|
27
|
-
} | undefined;
|
|
28
|
-
responses: Record<string, {
|
|
29
|
-
description: string;
|
|
30
|
-
contentType?: string | undefined;
|
|
31
|
-
schema?: boolean | object | undefined;
|
|
32
|
-
events?: Record<string, boolean | object> | undefined;
|
|
33
|
-
}>;
|
|
34
|
-
}[];
|
|
35
|
-
sockets: {
|
|
36
|
-
id: string;
|
|
37
|
-
scope: "global" | "session" | "workspace";
|
|
38
|
-
description: string;
|
|
39
|
-
availability?: string | undefined;
|
|
40
|
-
service: string;
|
|
41
|
-
member: string;
|
|
42
|
-
direction: "client-to-server" | "server-to-client";
|
|
43
|
-
kind: "channel" | "method" | "state";
|
|
44
|
-
input: boolean | object;
|
|
45
|
-
output?: boolean | object | undefined;
|
|
46
|
-
errors?: boolean | object | undefined;
|
|
47
|
-
}[];
|
|
48
|
-
dynamic: string[];
|
|
49
|
-
gaps?: string[] | undefined;
|
|
50
|
-
};
|
|
51
|
-
//#endregion
|
|
52
|
-
export { apiContracts as default };
|
|
53
|
-
//# sourceMappingURL=apiContracts.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAoEa"}
|