@oharness/engine 0.10.0 → 0.11.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/dist/acp/claude.d.ts +34 -0
- package/dist/acp/claude.js +122 -0
- package/dist/acp/claude.js.map +1 -0
- package/dist/acp/client.d.ts +193 -0
- package/dist/acp/client.js +279 -0
- package/dist/acp/client.js.map +1 -0
- package/dist/acp/runner.d.ts +80 -0
- package/dist/acp/runner.js +159 -0
- package/dist/acp/runner.js.map +1 -0
- package/dist/agent/agent.d.ts +51 -1
- package/dist/agent/agent.js +322 -1
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/hooks.js +6 -6
- package/dist/agent/hooks.js.map +1 -1
- package/dist/agent/session.d.ts +2 -0
- package/dist/agent/session.js +19 -2
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/subagent.d.ts +9 -0
- package/dist/agent/subagent.js +6 -0
- package/dist/agent/subagent.js.map +1 -1
- package/dist/auth/index.d.ts +3 -1
- package/dist/auth/index.js +3 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/manager.js +4 -0
- package/dist/auth/manager.js.map +1 -1
- package/dist/auth/oauth.d.ts +33 -0
- package/dist/auth/oauth.js +59 -8
- package/dist/auth/oauth.js.map +1 -1
- package/dist/auth/providers/anthropic.d.ts +25 -5
- package/dist/auth/providers/anthropic.js +47 -6
- package/dist/auth/providers/anthropic.js.map +1 -1
- package/dist/auth/providers/chatgpt.d.ts +8 -0
- package/dist/auth/providers/chatgpt.js +180 -0
- package/dist/auth/providers/chatgpt.js.map +1 -0
- package/dist/auth/providers/openrouter.d.ts +2 -0
- package/dist/auth/providers/openrouter.js +101 -0
- package/dist/auth/providers/openrouter.js.map +1 -0
- package/dist/auth/types.d.ts +15 -0
- package/dist/auth/types.js.map +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/plugin.d.ts +6 -1
- package/dist/browser/plugin.js.map +1 -1
- package/dist/browser/session.d.ts +47 -0
- package/dist/browser/session.js +177 -2
- package/dist/browser/session.js.map +1 -1
- package/dist/browser/tools.js +139 -18
- package/dist/browser/tools.js.map +1 -1
- package/dist/computer/cua-driver.d.ts +60 -1
- package/dist/computer/cua-driver.js +149 -5
- package/dist/computer/cua-driver.js.map +1 -1
- package/dist/computer/helper-client.d.ts +3 -1
- package/dist/computer/helper-client.js +3 -0
- package/dist/computer/helper-client.js.map +1 -1
- package/dist/computer/index.d.ts +3 -2
- package/dist/computer/index.js +1 -1
- package/dist/computer/index.js.map +1 -1
- package/dist/computer/mode.d.ts +15 -0
- package/dist/computer/mode.js +11 -1
- package/dist/computer/mode.js.map +1 -1
- package/dist/computer/session.d.ts +36 -7
- package/dist/computer/session.js +118 -17
- package/dist/computer/session.js.map +1 -1
- package/dist/computer/target.d.ts +19 -0
- package/dist/computer/target.js.map +1 -1
- package/dist/computer/tools.js +135 -8
- package/dist/computer/tools.js.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.js.map +1 -1
- package/dist/harness.d.ts +52 -0
- package/dist/harness.js +113 -12
- package/dist/harness.js.map +1 -1
- package/dist/mcp/manager.d.ts +15 -0
- package/dist/mcp/manager.js +28 -1
- package/dist/mcp/manager.js.map +1 -1
- package/dist/providers/catalog.json +14 -3
- package/dist/providers/models-dev.d.ts +15 -0
- package/dist/providers/models-dev.js +14 -0
- package/dist/providers/models-dev.js.map +1 -1
- package/dist/providers/piai.d.ts +38 -1
- package/dist/providers/piai.js +70 -2
- package/dist/providers/piai.js.map +1 -1
- package/dist/providers/registry.d.ts +16 -1
- package/dist/providers/registry.js +42 -11
- package/dist/providers/registry.js.map +1 -1
- package/dist/runtime-plugins/builtin/studio.d.ts +7 -0
- package/dist/runtime-plugins/builtin/studio.js +69 -4
- package/dist/runtime-plugins/builtin/studio.js.map +1 -1
- package/dist/tools/builtin/bash.js +6 -10
- package/dist/tools/builtin/bash.js.map +1 -1
- package/dist/util/shell.d.ts +30 -0
- package/dist/util/shell.js +70 -0
- package/dist/util/shell.js.map +1 -1
- package/package.json +3 -3
- package/skills/media-generation/SKILL.md +22 -1
package/dist/util/shell.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
1
2
|
/**
|
|
2
3
|
* `SHELL` is honoured on POSIX so a user on zsh/fish gets their own
|
|
3
4
|
* environment; `ComSpec` is the Windows equivalent.
|
|
@@ -21,4 +22,73 @@ export function shellFor(script) {
|
|
|
21
22
|
export function isWindowsShell() {
|
|
22
23
|
return process.platform === "win32" && !/powershell|pwsh/i.test(process.env["ComSpec"] ?? "");
|
|
23
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* How long a shell that has exited is given for its output to finish
|
|
27
|
+
* arriving. The pipes normally close with it; when they do not, something it
|
|
28
|
+
* started is still holding them, and nothing that thing writes is output of
|
|
29
|
+
* the command any more.
|
|
30
|
+
*/
|
|
31
|
+
export const EXIT_GRACE_MS = 1_000;
|
|
32
|
+
/**
|
|
33
|
+
* Start a shell that can be stopped along with everything it started.
|
|
34
|
+
*
|
|
35
|
+
* On POSIX it leads its own process group, so a kill reaches the `grep` or
|
|
36
|
+
* `find` it is running too. Killing only the shell left those behind,
|
|
37
|
+
* re-parented to init and still holding the output pipe, and the call waiting
|
|
38
|
+
* for that pipe to close waited forever. Not on Windows, where a detached
|
|
39
|
+
* child gets a console window of its own; the tree is killed by pid there.
|
|
40
|
+
*/
|
|
41
|
+
export function spawnShell(script, opts) {
|
|
42
|
+
const shell = shellFor(script);
|
|
43
|
+
return spawn(shell.command, shell.args, {
|
|
44
|
+
cwd: opts.cwd,
|
|
45
|
+
env: opts.env,
|
|
46
|
+
detached: process.platform !== "win32",
|
|
47
|
+
windowsHide: true,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Kill a shell from `spawnShell` and every process under it. */
|
|
51
|
+
export function killShell(child) {
|
|
52
|
+
const pid = child.pid;
|
|
53
|
+
if (pid === undefined)
|
|
54
|
+
return;
|
|
55
|
+
if (process.platform === "win32") {
|
|
56
|
+
const killer = spawn("taskkill", ["/pid", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
|
|
57
|
+
killer.on("error", () => child.kill("SIGKILL"));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
process.kill(-pid, "SIGKILL");
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// The group is gone already, or never formed: the shell alone, then.
|
|
65
|
+
child.kill("SIGKILL");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Call `done` once a shell's output is complete: when its pipes close, or
|
|
70
|
+
* `graceMs` after it exits if something it left running still holds them —
|
|
71
|
+
* `server &`, or a child that outlived a kill. Then the pipes are let go, so
|
|
72
|
+
* this side stops waiting on a process that is no longer the command.
|
|
73
|
+
*/
|
|
74
|
+
export function whenShellDone(child, done, graceMs = EXIT_GRACE_MS) {
|
|
75
|
+
let settled = false;
|
|
76
|
+
let grace;
|
|
77
|
+
const settle = (code) => {
|
|
78
|
+
if (settled)
|
|
79
|
+
return;
|
|
80
|
+
settled = true;
|
|
81
|
+
if (grace)
|
|
82
|
+
clearTimeout(grace);
|
|
83
|
+
done(code);
|
|
84
|
+
};
|
|
85
|
+
child.on("close", (code) => settle(code));
|
|
86
|
+
child.on("exit", (code) => {
|
|
87
|
+
grace = setTimeout(() => {
|
|
88
|
+
child.stdout.destroy();
|
|
89
|
+
child.stderr.destroy();
|
|
90
|
+
settle(code);
|
|
91
|
+
}, graceMs);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
24
94
|
//# sourceMappingURL=shell.js.map
|
package/dist/util/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/util/shell.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/util/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EA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I,CAAC;QACf,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,CAAC,CAAC;IACF,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACxB,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACtB,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACvB,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oharness/engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "The agent loop, tool execution, context management and permissions. No frontend, no transport.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"postpack": "node scripts/write-official.mjs --clean"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@earendil-works/pi-ai": "^
|
|
52
|
-
"ottoport": "1.
|
|
51
|
+
"@earendil-works/pi-ai": "^1.1.0",
|
|
52
|
+
"ottoport": "1.13.0",
|
|
53
53
|
"zod": "^4.1.5"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -5,7 +5,7 @@ description: Generate images, video, speech and music with the GenerateImage, Ge
|
|
|
5
5
|
|
|
6
6
|
# Generating media
|
|
7
7
|
|
|
8
|
-
Five tools, when the account has a media gateway configured:
|
|
8
|
+
Five tools to make media, when the account has a media gateway configured:
|
|
9
9
|
|
|
10
10
|
| Tool | For |
|
|
11
11
|
| --- | --- |
|
|
@@ -94,3 +94,24 @@ and the first one is still running.
|
|
|
94
94
|
Under `media/` by default, or wherever `path` says. Point `path` at the
|
|
95
95
|
directory the work actually belongs in — an `assets/` folder, the directory of
|
|
96
96
|
the page that will reference it — when that is obvious, and ask when it is not.
|
|
97
|
+
|
|
98
|
+
## Keeping files online
|
|
99
|
+
|
|
100
|
+
The workspace copy is the user's for good. The URL a generation returns
|
|
101
|
+
lasts a few days. When the user wants results kept online — to use them from
|
|
102
|
+
another device, or kept together as a campaign or a character — that is a
|
|
103
|
+
**collection**, in their OHarness account (or the team's, when team credits
|
|
104
|
+
are in use):
|
|
105
|
+
|
|
106
|
+
| Tool | For |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| `ListMediaCollections` | Their collections, and how much of their allowance is used |
|
|
109
|
+
| `CreateMediaCollection` | A new one — check the list first |
|
|
110
|
+
| `ListSavedMedia` | What is kept, by collection and kind |
|
|
111
|
+
| `SaveMedia` | Keep a result after the fact, from its URL, while it lasts |
|
|
112
|
+
| `UploadMedia` | A local file as a URL models accept (a reference, a first frame), optionally kept |
|
|
113
|
+
| `DeleteSavedMedia` | Remove a kept file, for good — only when asked |
|
|
114
|
+
|
|
115
|
+
To keep a result as it is made, pass `collection` (an id or exact name) to the
|
|
116
|
+
generate tool. Keeping is free within the allowance. Do not create collections
|
|
117
|
+
or save files nobody asked to keep.
|