super-dsh 0.1.9 → 0.1.10-e
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 +25 -3
- package/agent-agy/cordis.patch.yml +7 -4
- package/agent-agy/dist/agent.d.ts +12 -11
- package/agent-agy/dist/agy-auth-gateway.d.ts +124 -0
- package/agent-agy/dist/agy-auth-gateway.js +233 -0
- package/agent-agy/dist/agy-auth.d.ts +153 -0
- package/agent-agy/dist/agy-auth.js +179 -0
- package/agent-agy/dist/agy-cli-client.d.ts +39 -9
- package/agent-agy/dist/agy-cli-client.js +82 -18
- package/agent-agy/dist/agy-store.d.ts +8 -0
- package/agent-agy/dist/index.d.ts +46 -16
- package/agent-agy/dist/index.js +82 -56
- package/agent-agy/dist/models.d.ts +70 -0
- package/agent-agy/dist/models.js +102 -3
- package/agent-agy/package.json +7 -5
- package/agent-agy-sdk/cordis.patch.yml +58 -0
- package/agent-agy-sdk/dist/adapter.d.ts +15 -0
- package/agent-agy-sdk/dist/adapter.js +42 -0
- package/agent-agy-sdk/dist/agent-preset-agy.d.ts +27 -0
- package/agent-agy-sdk/dist/agent-preset-agy.js +32 -0
- package/agent-agy-sdk/dist/agent.d.ts +138 -0
- package/agent-agy-sdk/dist/agent.js +494 -0
- package/{agent-agy → agent-agy-sdk}/dist/agy-client.d.ts +26 -6
- package/{agent-agy → agent-agy-sdk}/dist/agy-client.js +43 -25
- package/agent-agy-sdk/dist/agy-sessions.d.ts +25 -0
- package/agent-agy-sdk/dist/agy-sessions.js +107 -0
- package/agent-agy-sdk/dist/agy-store.d.ts +39 -0
- package/agent-agy-sdk/dist/agy-store.js +83 -0
- package/agent-agy-sdk/dist/inbox.d.ts +26 -0
- package/agent-agy-sdk/dist/inbox.js +53 -0
- package/agent-agy-sdk/dist/index.d.ts +93 -0
- package/agent-agy-sdk/dist/index.js +476 -0
- package/agent-agy-sdk/dist/models.d.ts +41 -0
- package/agent-agy-sdk/dist/models.js +74 -0
- package/agent-agy-sdk/dist/sdk-venv.d.ts +76 -0
- package/agent-agy-sdk/dist/sdk-venv.js +173 -0
- package/agent-agy-sdk/dist/world-plugin.d.ts +10 -0
- package/agent-agy-sdk/dist/world-plugin.js +82 -0
- package/agent-agy-sdk/package.json +64 -0
- package/agent-claude/dist/adapter.js +106 -31
- package/agent-claude/dist/agent.js +154 -17
- package/agent-claude/dist/claude-client.js +84 -43
- package/agent-claude/dist/claude-launch.js +101 -0
- package/agent-claude/dist/claude-native-config.js +169 -0
- package/agent-claude/dist/claude-provider-gateway.js +340 -0
- package/agent-claude/dist/claude-providers.js +391 -0
- package/agent-claude/dist/claude-route.js +152 -0
- package/agent-claude/dist/index.js +214 -37
- package/agent-claude/dist/models.js +14 -0
- package/agent-claude/dist/sdk-runtime.js +320 -0
- package/agent-claude/package.json +6 -4
- package/agent-codex/README.md +141 -36
- package/agent-codex/cordis.patch.yml +14 -10
- package/agent-codex/dist/adapter.js +64 -28
- package/agent-codex/dist/agent.js +255 -81
- package/agent-codex/dist/app-server-approvals.js +165 -0
- package/agent-codex/dist/app-server-client.js +723 -0
- package/agent-codex/dist/app-server-events.js +432 -0
- package/agent-codex/dist/app-server-protocol.js +95 -0
- package/agent-codex/dist/app-server-wire.js +299 -0
- package/agent-codex/dist/codex-launch.js +78 -0
- package/agent-codex/dist/codex-native-config.js +392 -0
- package/agent-codex/dist/codex-provider-gateway.js +402 -0
- package/agent-codex/dist/codex-providers.js +376 -0
- package/agent-codex/dist/codex-route.js +86 -0
- package/agent-codex/dist/index.js +256 -115
- package/agent-codex/dist/permission.js +75 -1
- package/agent-codex/package.json +1 -2
- package/agent-codex-sdk/README.md +79 -0
- package/agent-codex-sdk/cordis.patch.yml +81 -0
- package/agent-codex-sdk/dist/adapter.js +91 -0
- package/agent-codex-sdk/dist/agent-preset-codex.js +32 -0
- package/agent-codex-sdk/dist/agent.js +1085 -0
- package/agent-codex-sdk/dist/codex-native-config.js +392 -0
- package/agent-codex-sdk/dist/codex-provider-gateway.js +402 -0
- package/agent-codex-sdk/dist/codex-providers.js +376 -0
- package/agent-codex-sdk/dist/codex-route.js +86 -0
- package/{agent-codex/dist/codex-client.js → agent-codex-sdk/dist/codex-sdk-client.js} +253 -32
- package/agent-codex-sdk/dist/codex-sdk-launch.js +92 -0
- package/agent-codex-sdk/dist/codex-store.js +180 -0
- package/agent-codex-sdk/dist/inbox.js +53 -0
- package/agent-codex-sdk/dist/index.js +739 -0
- package/agent-codex-sdk/dist/permission.js +71 -0
- package/agent-codex-sdk/dist/sdk-runtime.js +307 -0
- package/agent-codex-sdk/dist/session-map.js +167 -0
- package/agent-codex-sdk/dist/world-plugin.js +93 -0
- package/agent-codex-sdk/package.json +79 -0
- package/agent-codex-sdk/scripts/fetch-sdk-runtime.mjs +57 -0
- package/agent-omp/README.md +72 -55
- package/agent-omp/dist/agent.js +36 -11
- package/agent-omp/dist/index.js +92 -52
- package/agent-omp/dist/lazy-rpc.js +11 -4
- package/agent-omp/dist/omp-cli.js +114 -97
- package/agent-omp/dist/omp-store.js +12 -4
- package/agent-omp/dist/permission.js +70 -5
- package/agent-omp/dist/rpc-client.js +409 -0
- package/agent-omp/dist/world-plugin.js +36 -3
- package/agent-omp/package.json +2 -6
- package/agent-omp-sdk/README.md +103 -0
- package/agent-omp-sdk/cordis.patch.yml +108 -0
- package/agent-omp-sdk/dist/adapter.d.ts +21 -0
- package/agent-omp-sdk/dist/adapter.js +36 -0
- package/agent-omp-sdk/dist/agent-preset-omp.d.ts +31 -0
- package/agent-omp-sdk/dist/agent-preset-omp.js +32 -0
- package/agent-omp-sdk/dist/agent.d.ts +64 -0
- package/agent-omp-sdk/dist/agent.js +1178 -0
- package/agent-omp-sdk/dist/discovery.d.ts +57 -0
- package/agent-omp-sdk/dist/discovery.js +116 -0
- package/agent-omp-sdk/dist/inbox.d.ts +28 -0
- package/agent-omp-sdk/dist/inbox.js +53 -0
- package/agent-omp-sdk/dist/index.d.ts +60 -0
- package/agent-omp-sdk/dist/index.js +632 -0
- package/agent-omp-sdk/dist/knobs.d.ts +34 -0
- package/agent-omp-sdk/dist/knobs.js +50 -0
- package/agent-omp-sdk/dist/lazy-rpc.d.ts +98 -0
- package/agent-omp-sdk/dist/lazy-rpc.js +178 -0
- package/agent-omp-sdk/dist/mobile/zoom-guard.d.ts +187 -0
- package/agent-omp-sdk/dist/mobile/zoom-guard.js +294 -0
- package/agent-omp-sdk/dist/mobile-boot.d.ts +49 -0
- package/agent-omp-sdk/dist/mobile-boot.js +38 -0
- package/agent-omp-sdk/dist/models.d.ts +39 -0
- package/agent-omp-sdk/dist/models.js +299 -0
- package/agent-omp-sdk/dist/omp-cli.d.ts +67 -0
- package/agent-omp-sdk/dist/omp-cli.js +164 -0
- package/agent-omp-sdk/dist/omp-disk-discovery.d.ts +27 -0
- package/agent-omp-sdk/dist/omp-disk-discovery.js +178 -0
- package/agent-omp-sdk/dist/omp-executable.d.ts +2 -0
- package/agent-omp-sdk/dist/omp-executable.js +30 -0
- package/agent-omp-sdk/dist/omp-store.d.ts +134 -0
- package/agent-omp-sdk/dist/omp-store.js +526 -0
- package/agent-omp-sdk/dist/pairing.d.ts +7 -0
- package/agent-omp-sdk/dist/pairing.js +45 -0
- package/agent-omp-sdk/dist/permission.d.ts +138 -0
- package/agent-omp-sdk/dist/permission.js +161 -0
- package/agent-omp-sdk/dist/protocol.d.ts +189 -0
- package/agent-omp-sdk/dist/rpc-types.d.ts +77 -0
- package/agent-omp-sdk/dist/rpc-types.js +1 -0
- package/agent-omp-sdk/dist/sdk-client.d.ts +160 -0
- package/{agent-omp → agent-omp-sdk}/dist/sdk-client.js +108 -56
- package/agent-omp-sdk/dist/sdk-runtime.d.ts +211 -0
- package/agent-omp-sdk/dist/sdk-runtime.js +418 -0
- package/agent-omp-sdk/dist/sidecar-client.d.ts +87 -0
- package/agent-omp-sdk/dist/sidecar-client.js +197 -0
- package/agent-omp-sdk/dist/store/adapter.d.ts +17 -0
- package/agent-omp-sdk/dist/store/adapter.js +47 -0
- package/agent-omp-sdk/dist/store/db.d.ts +70 -0
- package/agent-omp-sdk/dist/store/db.js +210 -0
- package/agent-omp-sdk/dist/store/index.d.ts +23 -0
- package/agent-omp-sdk/dist/store/index.js +59 -0
- package/agent-omp-sdk/dist/store/reconcile.d.ts +15 -0
- package/agent-omp-sdk/dist/store/reconcile.js +51 -0
- package/agent-omp-sdk/dist/store/schema.d.ts +8 -0
- package/agent-omp-sdk/dist/store/schema.js +40 -0
- package/agent-omp-sdk/dist/transport.d.ts +49 -0
- package/agent-omp-sdk/dist/transport.js +35 -0
- package/agent-omp-sdk/dist/world-home.d.ts +4 -0
- package/agent-omp-sdk/dist/world-home.js +23 -0
- package/agent-omp-sdk/dist/world-plugin.d.ts +10 -0
- package/agent-omp-sdk/dist/world-plugin.js +137 -0
- package/agent-omp-sdk/package.json +87 -0
- package/client/index.js +1204 -93
- package/cordis.patch.yml +64 -0
- package/package.json +17 -8
- package/superd-hub/dist/client/agent-settings.d.ts +210 -0
- package/superd-hub/dist/client/agent-settings.js +300 -0
- package/superd-hub/dist/client/roster.js +6 -0
- package/superd-hub/dist/client/runtime-settings-api.d.ts +76 -0
- package/superd-hub/dist/client/runtime-settings-api.js +137 -0
- package/superd-hub/dist/client/switch.d.ts +165 -0
- package/superd-hub/dist/client/switch.js +295 -0
- package/superd-hub/lib/client/index.js +1204 -93
- package/agent-codex/dist/models.js +0 -152
- package/agent-omp/dist/sidecar-client.js +0 -195
- /package/{agent-agy → agent-agy-sdk}/bridge/agy_bridge.py +0 -0
- /package/{agent-agy → agent-agy-sdk}/bridge/gemini_openai_server.mjs +0 -0
- /package/{agent-codex/dist/codex-events.js → agent-codex-sdk/dist/codex-sdk-events.js} +0 -0
- /package/{agent-omp → agent-omp-sdk}/dist/protocol.js +0 -0
- /package/{agent-omp → agent-omp-sdk}/sidecar/main.ts +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pgmi-builds/agent-codex-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Codex (SDK) provider for DeepSeek Harness (dsh) — the OPT-IN in-process SDK transport for the Codex agent: it embeds Codex threads in this Node process instead of driving a `codex app-server` child (that is @pgmi-builds/agent-codex, the PRIMARY path, because it reuses the operator's own codex binary). Delivered DISABLED by default (world key `codex-sdk`, roster label \"Codex (SDK)\"); turning the composite row on IS the switch. This package declares NO SDK dependency — not a dependency, not an optionalDependency and not a peer — and ships NO postinstall: the durable SDK tree (the codex SDK package plus the pinned codex binary package) is fetched into the world home on the first real prompt (src/sdk-runtime.ts, `npm run fetch-sdk-runtime`).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/index.js",
|
|
8
|
+
"./world": "./dist/world-plugin.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"scripts",
|
|
13
|
+
"cordis.patch.yml",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"dsh": {
|
|
17
|
+
"bundle": {
|
|
18
|
+
"patch": "./cordis.patch.yml"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc -p tsconfig.json",
|
|
23
|
+
"test": "node --test test/*.test.mjs",
|
|
24
|
+
"fetch-sdk-runtime": "node scripts/fetch-sdk-runtime.mjs"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
29
|
+
"@deepseek-ai/dsh-agent": ">=0.1.5-0 <0.3.0-0",
|
|
30
|
+
"@deepseek-ai/dsh-agent-presets": ">=0.1.5-0 <0.3.0-0",
|
|
31
|
+
"@deepseek-ai/dsh-llm": ">=0.1.5-0 <0.3.0-0",
|
|
32
|
+
"@deepseek-ai/dsh-scope": ">=0.1.5-0 <0.3.0-0",
|
|
33
|
+
"@deepseek-ai/dsh-session": ">=0.1.5-0 <0.3.0-0",
|
|
34
|
+
"@deepseek-ai/dsh-session-persistence": ">=0.1.5-0 <0.3.0-0",
|
|
35
|
+
"@deepseek-ai/dsh-typert-protocol": ">=0.1.5-0 <0.3.0-0",
|
|
36
|
+
"@pgmi-builds/superd-hub": "*"
|
|
37
|
+
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"@deepseek-ai/cordis": {
|
|
40
|
+
"optional": true
|
|
41
|
+
},
|
|
42
|
+
"@deepseek-ai/dsh-agent": {
|
|
43
|
+
"optional": true
|
|
44
|
+
},
|
|
45
|
+
"@deepseek-ai/dsh-agent-presets": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"@deepseek-ai/dsh-llm": {
|
|
49
|
+
"optional": true
|
|
50
|
+
},
|
|
51
|
+
"@deepseek-ai/dsh-scope": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
54
|
+
"@deepseek-ai/dsh-session": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"@deepseek-ai/dsh-session-persistence": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"@deepseek-ai/dsh-typert-protocol": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"@pgmi-builds/superd-hub": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@types/node": "^26.2.0",
|
|
69
|
+
"typescript": "^5.6.0"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
},
|
|
74
|
+
"license": "MIT",
|
|
75
|
+
"main": "dist/index.js",
|
|
76
|
+
"engines": {
|
|
77
|
+
"node": ">=22.18"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* fetch-sdk-runtime.mjs — eagerly warm the durable SDK runtime for a world home.
|
|
4
|
+
*
|
|
5
|
+
* The adapter fetches this runtime lazily on the first real prompt
|
|
6
|
+
* (src/sdk-runtime.ts); this script exists for the two cases where waiting for
|
|
7
|
+
* a first turn is unacceptable: pre-provisioning a machine, and recovering from
|
|
8
|
+
* a recorded failure (`<worldHome>/sdk-runtime.error.log`).
|
|
9
|
+
*
|
|
10
|
+
* node scripts/fetch-sdk-runtime.mjs [<home>]
|
|
11
|
+
*
|
|
12
|
+
* `<home>` is the DSH/SUPERD home (default: `$DSH_HOME`, then
|
|
13
|
+
* `$SUPERD_HOME_DIR`); the world home is `<home>/agents/codex-sdk`, exactly
|
|
14
|
+
* what the world plugin provisions (world key `codex-sdk`). There is
|
|
15
|
+
* deliberately NO default to `~/.dsh`: this is a dev/test tool and it refuses
|
|
16
|
+
* any home outside this repository's `.tests` tree — the same red line the
|
|
17
|
+
* launcher enforces (repo AGENTS §〇).
|
|
18
|
+
*
|
|
19
|
+
* Idempotent: a complete, matching runtime short-circuits (no network, no npm).
|
|
20
|
+
*/
|
|
21
|
+
import { dirname, resolve, sep } from "node:path";
|
|
22
|
+
import { fileURLToPath } from "node:url";
|
|
23
|
+
import { createSdkRuntimeDeps, ensureSdkRuntime, sdkRuntimeLayout } from "../dist/sdk-runtime.js";
|
|
24
|
+
|
|
25
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const pluginDir = resolve(here, "..");
|
|
27
|
+
const repoRoot = resolve(pluginDir, "..", "..");
|
|
28
|
+
const testsRoot = resolve(repoRoot, ".tests");
|
|
29
|
+
|
|
30
|
+
const home = process.argv[2] ?? process.env.DSH_HOME ?? process.env.SUPERD_HOME_DIR;
|
|
31
|
+
if (home === undefined || home === "") {
|
|
32
|
+
console.error(
|
|
33
|
+
"refusing: pass a DSH home as argv[2] or set DSH_HOME / SUPERD_HOME_DIR " +
|
|
34
|
+
"(no default — ~/.dsh is a prod home)",
|
|
35
|
+
);
|
|
36
|
+
process.exit(2);
|
|
37
|
+
}
|
|
38
|
+
const dshHome = resolve(home);
|
|
39
|
+
if (dshHome !== testsRoot && !dshHome.startsWith(testsRoot + sep)) {
|
|
40
|
+
console.error(`refusing: DSH home ${dshHome} is outside ${testsRoot} (repo red line)`);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
const worldHome = resolve(dshHome, "agents", "codex-sdk");
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
// ONE implementation shared with the adapter's first-prompt fetch: the
|
|
47
|
+
// builder lives in the module, so this script cannot drift from it.
|
|
48
|
+
const record = await ensureSdkRuntime(worldHome, createSdkRuntimeDeps(pluginDir));
|
|
49
|
+
console.log(JSON.stringify(record, null, 2));
|
|
50
|
+
if (process.env.VERBOSE === "1") {
|
|
51
|
+
console.log(`layout: ${JSON.stringify(sdkRuntimeLayout(worldHome), null, 2)}`);
|
|
52
|
+
}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
// ensureSdkRuntime already wrote the durable trace; add the operator-facing line.
|
|
55
|
+
console.error(String(error instanceof Error ? error.message : error));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
package/agent-omp/README.md
CHANGED
|
@@ -1,77 +1,94 @@
|
|
|
1
|
-
# @pgmi-builds/agent-omp(OMP adapter,
|
|
1
|
+
# @pgmi-builds/agent-omp(OMP adapter,RPC 线)
|
|
2
2
|
|
|
3
|
-
OMP
|
|
3
|
+
OMP provider for DeepSeek Harness([dsh](https://www.npmjs.com/package/@deepseek-ai/dsh))。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**不内嵌任何 OMP 代码副本**:适配器用操作员本机已在用的 `omp` binary,以 `omp --mode rpc` 子进程形态驱动,
|
|
6
|
+
stdio 上跑 OMP 的 NDJSON 协议(v1),把 OMP 的 RPC 面(prompt / follow_up / steer / abort / get_state /
|
|
7
|
+
get_messages / set_model / resume / compact)桥接进 Dash 的 Agent/Session 契约,标准 DSH Web UI 即可驱动 OMP 会话。
|
|
8
|
+
模型选择由 OMP 数据面的 `LlmAdapter` 承接(`config.yml` 的 `modelRoles`)。
|
|
9
|
+
|
|
10
|
+
## 集成形态
|
|
6
11
|
|
|
7
12
|
```
|
|
8
|
-
dsh 宿主 (Node 22, 本包 dist/)
|
|
9
|
-
omp-web 衔接层(agent/adapter/
|
|
10
|
-
replay/store/supervisor
|
|
13
|
+
dsh 宿主 (Node 22, 本包 dist/) 操作员本机的 omp binary
|
|
14
|
+
omp-web 衔接层(agent/adapter/ ←→ `omp --mode rpc`(NDJSON v1 over stdio)
|
|
15
|
+
replay/store/supervisor) ~/.omp 是其唯一的 app home
|
|
11
16
|
```
|
|
12
17
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
18
|
+
- **没有 sidecar,没有 Bun,没有 SDK 依赖**:一会话一 `omp --mode rpc` 子进程,进程生命周期跟随会话。
|
|
19
|
+
- **binary 解析**(`src/rpc-client.ts` 的 `resolveOmpExecutable()`):
|
|
20
|
+
`$OMP_EXECUTABLE` → `PATH` 上的 `omp` → `~/.local/bin/omp` / `/usr/local/bin/omp` → 裸 `"omp"`(让 spawn 报 ENOENT)。
|
|
21
|
+
- **进程组隔离**:子进程 `detached` 自成进程组,teardown 走 SIGTERM + 2s 宽限后 SIGKILL,保证 `omp` 及其工具子进程不残留。
|
|
22
|
+
|
|
23
|
+
## 安装与启用
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
本包是 `super-dsh` 单一交付包内的兄弟目录,**不单独安装**(`dsh plugin --profile <name> add super-dsh`),
|
|
26
|
+
也不需要预装任何 OMP SDK。唯一的外部前置条件 = **操作员机器上有 `omp`**:
|
|
17
27
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- **pi 文档 vs omp 实现**:`createAgentSessionRuntime`/`ModelRuntime`/`DefaultResourceLoader`/`SettingsManager`/`defineTool`/`createEventBus` 不在 omp 根 exports——对应能力由 `AgentSession` 实例面与 `Settings`/`discover*` 家族承担。评估文档中标 [pi] 的条目按此折算。
|
|
21
|
-
- **`AgentSession` 实例面远超 pi 文档**:`state{systemPrompt,model,thinkingLevel,tools,messages,isStreaming,streamMessage,pendingToolCalls,error}`、`messages`、`systemPrompt`、`prompt`/`promptCustomMessage`/`sendCustomMessage`/`sendUserMessage`、`steer`/`followUp`、`setModel`/`cycleModel`/`applyRoleModel`、`compact`/`abortCompaction`、`switchSession`/`branch`/`navigateTree`/`fork`/`handoff`、`newSession`/`moveSession`、`abort`、`beginDispose`/`dispose`。S1/S2/S3/S6/S7/S8/S10 均有一等 API;S5(messages 手术)通道结构性在位(`state` 暴露 messages/tools 键),赋值语义待 TS 类型面确认。
|
|
22
|
-
- **真机冒烟**:`OMP_HOME=~/.omp` 下 `discoverAuthStorage`+`ModelRegistry.refresh()` 得 50 模型 / 5 provider(deepseek,xai,bailian,kimi-plan,zai-plan)——与 `omp models --json` 完全一致;`SessionManager.inMemory()` 建会话成功、dispose 干净、零 LLM 调用。
|
|
23
|
-
- **沙箱注意**:SDK 以读写模式打开 `~/.omp/agent/agent.db`;agent 沙箱内跑 sidecar/spike 需要对该库的写权限(本轮以 danger-full-access 实测通过)。
|
|
28
|
+
- 缺失时不静默回落:adapter 在 `apply()` 做一次二进制可解析性探测并打显式诊断,首轮 prompt 以 spawn 错误 fail loud 冒到会话。
|
|
29
|
+
- 启用由包内 `cordis.patch.yml` 承担(挂 OMP provider + 禁用原生 agent-loop / llm 路由),profile 无需手改。
|
|
24
30
|
|
|
25
|
-
##
|
|
31
|
+
## Home 布局(两个 home,别混)
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
| 名字 | 是什么 | 定义(`src/knobs.ts`) | 默认 |
|
|
34
|
+
|---|---|---|---|
|
|
35
|
+
| **`OMP_HOME`** | OMP runtime app home(`agent.db`/`models.db`/`sessions/` 的写入目标,也是数据面子进程的 cwd) | `$OMP_HOME ?? resolveOmpNativeHome()` | **原生 `~/.omp`**(`$OMP_HOME` 只作测试 / 适配器级隔离 knob) |
|
|
36
|
+
| **`OMP_NATIVE_HOME`** | 操作员的原生 OMP 安装(TUI/CLI)读面:`agent/config.yml`、`agent/models.yml`、原生 session store | `$OMP_NATIVE_HOME ?? join(homedir(), ".omp")` | `~/.omp` |
|
|
37
|
+
| `<DSH_HOME>/agents/omp/` | 该 world 的 **DSH** home(DSH 会话日志、storages、settings) | dsh 宿主解析 | 非 app home |
|
|
31
38
|
|
|
32
|
-
|
|
39
|
+
- spawn **零重定向**:不把 `OMP_HOME` 喂给子进程;`~/.omp` 是唯一 OMP app home。
|
|
40
|
+
- 绝不要把 `OMP_NATIVE_HOME` 指到空目录 / 测试 home——它是 models.yml 的读取来源,读空 ⇒ 适配器零 provider ⇒ `session/prompt` 报 `model-unavailable`。
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
- `src/protocol.ts`:协议与方法表类型(sys.ping / models.list / settings.get / session.create|info|prompt|steer|followUp|abort|dispose / sessions.list)。
|
|
36
|
-
- `src/sidecar-client.ts`:Node 侧 spawn/关联/事件分发/优雅关停;`src/index.ts` 暂导出 client。
|
|
37
|
-
- ~~冒烟 `test/sidecar-smoke.test.mjs`~~(2026-09-24 场景退役删除;整包验证走 superd 的 4999 pack 线 + dev3)。
|
|
38
|
-
- 坑已修:`ModelRegistry.refreshInBackground()` 此版本返回 void(非 Promise),可选链后接 `.catch` 会炸;ready-timeout 定时器必须 clear 否则 Node 进程挂 60s。
|
|
42
|
+
## 数据面(`omp` 子进程)
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
`src/omp-cli.ts` 把操作员 binary 作为模型目录与 `modelRoles` 的**第一源**(不吃 RPC 帧);原生 `~/.omp` 的文件只作失败回落与排序读面:
|
|
41
45
|
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
- 本地 dev fixture:`node_modules/@deepseek-ai/*` symlink 至真实 dsh 安装(照 omp-web 惯例,node_modules 不入库)。
|
|
46
|
+
- `omp models --json` → 凭证解析后的可用模型目录(含 agent.db 里的 OAuth/login key 等配置面看不见的凭证);子进程失败才回落磁盘 `models.db` ∪ `models.yml`(并打 stderr 提示)。
|
|
47
|
+
- `omp config get modelRoles --json` → role → `"provider/model[:effort]"` 映射(含持久化的 `default` 选择),每次现读。
|
|
48
|
+
- `omp config set modelRoles --json <obj>` → 整对象回写(拒绝点号 key),OMP 自己持久化 `modelRoles.default`。
|
|
49
|
+
- provider 排序与 boot 期默认模型仍首选 `agent/config.yml` 磁盘读(`omp-store.ts` 的 mini-YAML 扫描),`ompModelRolesSync` 兜底。
|
|
50
|
+
- 每次调用都按 `resolveOmpExecutable()` 现解析、`cwd = OMP_HOME`;**fail-soft**:binary 缺失/损坏/无响应 → 读 `undefined`、写 `false`,provider 永因 CLI 挂掉而 boot 失败。
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
## 实现要点
|
|
50
53
|
|
|
51
|
-
- `
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
+
- **传输**:`src/rpc-client.ts` 的 `OmpRpcClient` —— NDJSON 读取(按 `\n` 切帧)、`ready` 握手(默认 120s 上限,`OMP_READY_TIMEOUT_MS`)、
|
|
55
|
+
per-command 响应 deadline(默认 30s,`OMP_COMMAND_TIMEOUT_MS`)、`on`/`onTitle`/`onFailure` 事件分发。
|
|
56
|
+
- **不协商协议**:不发 `negotiate_protocol`,停在 v1 = 纯 NDJSON(旧读取器即正确)。协商到 v2 会切换到 >1MiB 分帧,需要重组器——列为已知 gap。
|
|
57
|
+
- **lazy 铁律**:`src/lazy-rpc.ts` 的 `LazyOmpRpc` 是唯一 spawn 点,构造零 spawn;`prompt`/`followUp`/`steer`/`ensureStarted` 才拉起子进程,
|
|
58
|
+
被动查询(`getState`/`getSubagents`/`getSessionStats`/`getSystemPrompt`/`abort`/`sendRaw`)合成应答、绝不 spawn。
|
|
59
|
+
`createAgent` 与 `resume` 两条路径都走它(resume 有映射时加 `--resume <ompFile>`),生成参数 `--approval-mode <mode>`。
|
|
60
|
+
- **两平面**:dsh 原生 session log 是 WebUI 唯一读面(插件当 producer:OMP RPC 事件 → SessionEvent → `ctx.sessionPersistence`);
|
|
61
|
+
OMP 原生会话文件是 runtime 权威(插件当 bridge:`bridge-store.sqlite` 只存 dsh↔omp 映射)。双份存储显式接受,单向阀 = 不回读。
|
|
62
|
+
- **已删除面**(本 RPC 轮,2026-10-03):`src/sdk-client.ts`、`src/sidecar-client.ts`、`src/protocol.ts`、`sidecar/`,以及 SDK/Bun 依赖与 `test/sidecar-*.test.mjs`;`scripts/build-client.ts` 与 `src/client/`、`src/mobile/` 保留(client 半边与 sidecar 无关)。
|
|
54
63
|
|
|
55
|
-
##
|
|
64
|
+
## 协议与实测记录(2026-10-03)
|
|
56
65
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
`ready` 帧实测:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{"type":"ready","protocolVersion":1,"supportedProtocolVersions":[1,2],
|
|
70
|
+
"maxFrameBytes":1048576,"maxReassembledFrameBytes":67108864}
|
|
71
|
+
```
|
|
61
72
|
|
|
62
|
-
|
|
73
|
+
- 只要求 `type === "ready"`;`protocolVersion` / `supportedProtocolVersions` / `maxFrameBytes` / `maxReassembledFrameBytes` 记录不校验。
|
|
74
|
+
- 不协商的路径实测停在 v1;`get_state` / `get_available_models` 未协商也照常应答;事件词表
|
|
75
|
+
(`agent_start` / `turn_start` / `message_start` / `message_update` / `message_end` / `tool_execution_start` / `tool_execution_end` / `turn_end` / `agent_end`)与 `agent.ts` 的 switch 对齐。
|
|
76
|
+
- 已知 gap:v2 分帧未实现(单帧 >1MiB 靠大行承载);对 `omp` 版本门仅实测 v18.4.9。
|
|
77
|
+
|
|
78
|
+
## 测试
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm run build # tsc -p tsconfig.json && tsc -p tsconfig.client.json
|
|
82
|
+
node --test test/*.test.mjs # 全 fakes / 源级断言,零真 runtime、零真 omp spawn
|
|
83
|
+
```
|
|
63
84
|
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
- **P4 `97cbc7b`** JSONL 解析切 SDK:`sessions.listAll` 一次全库索引(147 会话 26ms;id/cwd/size 0 diff,20 处 title 差异经实证为 SDK 当前 title slot 更正确)+ `sessions.messagesReadOnly` 按需 transcript(compaction 折叠语义);自研解析保留为 fail-soft fallback;顺带修了 `sessions.list {all:true}` 恒 0 的旧 bug。supervisor 热路径保留 naive 防游标错位。
|
|
69
|
-
- 总验收:29/29 测试、4999 wire 三连(roster 单条 OMP / session list 147 / modelCatalog)、实例留 4999 供手动验收。
|
|
70
|
-
- 遗留(低):forFile 对个别大文件 "Agent Main was replaced"(~1/tick,fail-soft);SDK 元数据快照滞后一个 tick;`sessions.messagesReadOnly` 大文件双读。
|
|
85
|
+
- `test/no-sidecar.test.mjs` = RPC 轮的删除面 + tick 门双重把守(源级断言:`src/` 不得再出现 SDK/sidecar client;
|
|
86
|
+
`index.ts` 只能 `new LazyOmpRpc(`;tick 的目录刷新必须挂在 `liveOmpSessionExists` 上,并对编译后的 `dist/index.js` 跑行为真值表)。
|
|
87
|
+
- `rpc-client` / `lazy-rpc` / `omp-cli-rpc` / `resolve-executable` / `package-contract` 覆盖传输、lazy 不变量、数据面与交付清单。
|
|
88
|
+
- **场景级验证只走整包**:`super-dsh` 的 4999 pack 线(`test/start-4999.sh`)+ dev3 目标机实装;本目录不再有 per-agent 场景 rig。
|
|
71
89
|
|
|
72
|
-
##
|
|
90
|
+
## 历史
|
|
73
91
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
- 遗留:移动端侧栏为 push-drawer 语义(打开时内容窗格被压窄,与 dashr 原行为一致);`npm install` 会剪掉 `node_modules/@deepseek-ai` symlink(需重挂);4999 端口与 superd 测试线冲突时用 `--patch` overlay 换端口。
|
|
92
|
+
本包在 2026-10-03 前是内嵌 SDK + Bun 子进程(sidecar)线(SDK 事件 → SessionEvent,单进程多路复用);该线连同
|
|
93
|
+
762M SDK 树 + 76M bun 二进制一起从交付面删除,改用操作员本机 binary 的 RPC 传输(设计正本:
|
|
94
|
+
`docs/specs/omp-rpc-transport/spec.md`)。
|
package/agent-omp/dist/agent.js
CHANGED
|
@@ -2,6 +2,7 @@ import { agentEvents } from "@deepseek-ai/dsh-agent";
|
|
|
2
2
|
import { Inbox } from "./inbox.js";
|
|
3
3
|
import { LlmAttemptId, ToolCallId, QUOTA_EXCEEDED_CODE, createAssistantMessage, createSystemMessage, createToolResultMessage, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
4
|
import { createScope } from "@deepseek-ai/dsh-scope";
|
|
5
|
+
import { ompPermissionCommand } from "./permission.js";
|
|
5
6
|
import { getBridgeStore } from "./store/index.js";
|
|
6
7
|
import { withSystemHead } from "../../superd-hub/dist/index.js";
|
|
7
8
|
/**
|
|
@@ -312,20 +313,20 @@ export class OmpAgent {
|
|
|
312
313
|
// so a freshly created session announces completely blank, exactly like
|
|
313
314
|
// the native agent-loop factory's: the backend takes zero part in the
|
|
314
315
|
// UI's browser-local new-session draft.
|
|
315
|
-
// `/permission`
|
|
316
|
-
// no RPC
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
//
|
|
316
|
+
// `/permission` — a launch fact, so the shadow routes it by child state:
|
|
317
|
+
// OMP pins `--approval-mode` at spawn and no RPC moves it mid-session, so
|
|
318
|
+
// an accepted switch only exists while this session's child does NOT. This
|
|
319
|
+
// agent-scoped registration (a child of `agent.ctx`) shadows the global
|
|
320
|
+
// command; before the first prompt it writes the same durable preset the
|
|
321
|
+
// global handler would (`permissionPresets.set`, no live-agent narration),
|
|
322
|
+
// and afterwards it refuses instead of appending a preset the running
|
|
323
|
+
// `omp` cannot honor. The spawn reads exactly those events
|
|
324
|
+
// (`resolveSpawnPermission`), so the pick reaches the child's argv.
|
|
321
325
|
this.ctx.inject(["commands"], (cmdCtx) => cmdCtx.commands.register({
|
|
322
326
|
name: "permission",
|
|
323
|
-
description: "
|
|
327
|
+
description: "Switch the permission preset (takes effect at the OMP child's launch)",
|
|
324
328
|
input: { hint: "<preset>" },
|
|
325
|
-
handler: () => (
|
|
326
|
-
kind: "error",
|
|
327
|
-
text: "Approval policy is fixed at OMP launch; runtime switching is not supported for OMP sessions.",
|
|
328
|
-
}),
|
|
329
|
+
handler: (invocation) => this.#handlePermissionCommand(invocation.rawInput),
|
|
329
330
|
}));
|
|
330
331
|
// `/compact` parity (route 1): OMP owns context compaction — the Dash log
|
|
331
332
|
// is only the UI's scrollback projection, so no compaction/* events are
|
|
@@ -522,6 +523,30 @@ export class OmpAgent {
|
|
|
522
523
|
}
|
|
523
524
|
}
|
|
524
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* `/permission` handler: mirror the global command's write for a session whose
|
|
528
|
+
* `omp` child does not exist yet (the pick then lands in the launch flag via
|
|
529
|
+
* {@link resolveSpawnPermission}), and refuse it once the child does — the
|
|
530
|
+
* policy is a launch flag, so accepting later would desync UI from runtime.
|
|
531
|
+
* Uses `permissionPresets.set` (log-only preset + knob events) rather than the
|
|
532
|
+
* global handler's `approval.setPolicy`, which would inject a narration user
|
|
533
|
+
* message into the OMP session for a change OMP never sees.
|
|
534
|
+
*/
|
|
535
|
+
#handlePermissionCommand(rawInput) {
|
|
536
|
+
const presets = this.#loopCtx.get("permissionPresets");
|
|
537
|
+
if (presets === undefined) {
|
|
538
|
+
return { kind: "error", text: "permission presets are not available on this host" };
|
|
539
|
+
}
|
|
540
|
+
const decision = ompPermissionCommand({
|
|
541
|
+
rawInput,
|
|
542
|
+
spawned: this.#rpc.spawned,
|
|
543
|
+
names: presets.names,
|
|
544
|
+
current: presets.current(this.session),
|
|
545
|
+
});
|
|
546
|
+
if (decision.action === "apply")
|
|
547
|
+
presets.set(this.session, decision.preset);
|
|
548
|
+
return decision.result;
|
|
549
|
+
}
|
|
525
550
|
/**
|
|
526
551
|
* /compact handler (route 1): run OMP's own compaction on the live child
|
|
527
552
|
* and report its real metering as the command outcome. No compaction/*
|