@agimon-ai/po-codemode 0.0.0-stage → 0.0.1-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 +149 -0
- package/README.md +82 -2
- package/dist/apiContracts.cjs +17 -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 +13 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/codemodeTools-BX2qieCR.cjs +349 -0
- package/dist/codemodeTools-BX2qieCR.cjs.map +1 -0
- package/dist/codemodeTools-CSYUxIeA.mjs +338 -0
- package/dist/codemodeTools-CSYUxIeA.mjs.map +1 -0
- package/dist/extensions/server.cjs +206 -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 +201 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.mts +60 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1 -0
- package/llms.txt +13 -0
- package/package.json +97 -3
- package/src/prompts/po-use-codemode/SKILL.md +44 -0
package/package.json
CHANGED
|
@@ -1,6 +1,100 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-codemode",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.1-alpha.0",
|
|
4
|
+
"description": "Code mode for Po sessions: discover and exec over namespaces other packages contribute",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"code-mode",
|
|
8
|
+
"coding-agent",
|
|
9
|
+
"developer-tools",
|
|
10
|
+
"pi-coding-agent",
|
|
11
|
+
"po",
|
|
12
|
+
"typescript"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://agimon.ai",
|
|
15
|
+
"license": "BUSL-1.1",
|
|
16
|
+
"author": "Vuong Ngo",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"src/prompts",
|
|
20
|
+
"llms.txt",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"package.json"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"main": "./dist/index.cjs",
|
|
27
|
+
"module": "./dist/index.mjs",
|
|
28
|
+
"types": "./dist/index.d.mts",
|
|
29
|
+
"jsnext:main": "./dist/index.mjs",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
33
|
+
"import": "./dist/index.mjs",
|
|
34
|
+
"require": "./dist/index.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./apiContracts": {
|
|
37
|
+
"types": "./dist/apiContracts.d.mts",
|
|
38
|
+
"import": "./dist/apiContracts.mjs",
|
|
39
|
+
"require": "./dist/apiContracts.cjs"
|
|
40
|
+
},
|
|
41
|
+
"./extensions/server": {
|
|
42
|
+
"types": "./dist/extensions/server.d.mts",
|
|
43
|
+
"import": "./dist/extensions/server.mjs",
|
|
44
|
+
"require": "./dist/extensions/server.cjs"
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@agimon-ai/po-core": "0.0.0-alpha.27",
|
|
53
|
+
"@deepseek-ai/cordis": "4.0.5",
|
|
54
|
+
"typebox": "1.3.37"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@agimon-ai/po-build": "0.0.0-alpha.27",
|
|
58
|
+
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.27",
|
|
59
|
+
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
60
|
+
"@types/node": "26.6.5",
|
|
61
|
+
"@vitest/coverage-v8": "5.0.4",
|
|
62
|
+
"tsdown": "0.23.1",
|
|
63
|
+
"typescript": "7.0.2",
|
|
64
|
+
"vitest": "5.0.4"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"@earendil-works/pi-coding-agent": "1.3.0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@earendil-works/pi-coding-agent": {
|
|
71
|
+
"optional": true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": ">=24"
|
|
76
|
+
},
|
|
77
|
+
"poServer": {
|
|
78
|
+
"entry": "./generated/server.ts",
|
|
79
|
+
"dist": "./dist/extensions/server.mjs",
|
|
80
|
+
"scopes": [
|
|
81
|
+
"session"
|
|
82
|
+
],
|
|
83
|
+
"contracts": {
|
|
84
|
+
"entry": "./src/exports/apiContracts.ts",
|
|
85
|
+
"dist": "./dist/apiContracts.mjs"
|
|
86
|
+
},
|
|
87
|
+
"provides": {
|
|
88
|
+
"session": [
|
|
89
|
+
"po/codemode"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"scripts": {
|
|
94
|
+
"build": "tsdown",
|
|
95
|
+
"test": "vitest --run",
|
|
96
|
+
"typecheck": "tsc --noEmit",
|
|
97
|
+
"lint": "oxlint . && oxfmt . --check",
|
|
98
|
+
"fixcode": "oxlint . --fix && oxfmt ."
|
|
99
|
+
}
|
|
6
100
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: po-use-codemode
|
|
3
|
+
description: 'Use @agimon-ai/po-codemode: run TypeScript against live Po objects with the discover and exec tools. Use when a task needs several steps on a namespace such as browser in one call.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Use code mode
|
|
7
|
+
|
|
8
|
+
Code mode gives you two tools.
|
|
9
|
+
|
|
10
|
+
- `discover`: with no arguments, lists the namespaces this session has (for example `browser`) and their members, plus reusable scripts from the active domains and this session's saved scripts (capped, newest first). `discover({ namespace })` shows full TypeScript declarations; `discover({ query })` finds members, script names and script descriptions.
|
|
11
|
+
- `exec`: runs a TypeScript async function body. Namespaces are in scope as globals. `return` a value, use `console.log` for notes, `image(data, mimeType)` to send back a screenshot, and `sleep(ms)` to wait.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// exec({ code })
|
|
15
|
+
const snapshot = await browser.snapshot({ search: 'Sign in' });
|
|
16
|
+
console.log(snapshot);
|
|
17
|
+
return 'done';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Saved scripts and chaining
|
|
21
|
+
|
|
22
|
+
Every `exec` body is saved, even when it fails, as `<session temp folder>/codemode/exec-<n>.ts`. The result ends with `Saved as session:exec-<n> (<absolute path>)`, so you can fix the file and rerun it.
|
|
23
|
+
|
|
24
|
+
A saved script becomes an async function of one parameter, `args`, when you import it; its `return` is the call's result. `.default` is the same function.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
// exec({ code })
|
|
28
|
+
const titles = await import('session:exec-3');
|
|
29
|
+
return await titles({ url: 'https://example.com' });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Specifiers: an absolute path; `./name` or `name.ts`, relative to the session `codemode/` folder; `session:<name>`; or `<domain>/<name>` for an active domain's script. Use `await import(...)`; a static `import ... from` statement is a compile error. Imported code shares the run's deadline and namespaces, and its errors name the imported file and line. The edge host cannot import.
|
|
33
|
+
|
|
34
|
+
## Promote a script
|
|
35
|
+
|
|
36
|
+
To keep a useful script, copy the saved file with normal file tools to `plugins/<domain>/codemode/<name>.ts`. Start it with a `/** ... */` comment whose first paragraph says what it does and what `args` it takes; `discover` shows that paragraph. Sessions with that domain active then call it as `<domain>/<name>`.
|
|
37
|
+
|
|
38
|
+
## Rules
|
|
39
|
+
|
|
40
|
+
- Keep each `exec` call to one logical step, then look at the result before the next.
|
|
41
|
+
- Scripts stop at their deadline (30 s by default, `timeoutMs` up to 120 s). Long loops and recursion are stopped too.
|
|
42
|
+
- Objects you get from a namespace are live. Listeners you add and the objects themselves stop working when the run ends; keep state in the namespace, not in script variables.
|
|
43
|
+
- `exec` runs inside the Po server with full trust, like `bash`. Do not use it to bypass a blocked tool.
|
|
44
|
+
- There is no `eval`, `Function`, `setTimeout`, `fetch`, `require` or `process` inside a script.
|