super-dsh 0.1.6 → 0.1.10
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-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 +1794 -287
- package/cordis.patch.yml +80 -0
- package/package.json +23 -8
- package/superd-hub/dist/a2a-delivery.d.ts +189 -0
- package/superd-hub/dist/a2a-delivery.js +240 -0
- package/superd-hub/dist/a2a-host.d.ts +76 -0
- package/superd-hub/dist/a2a-host.js +145 -0
- package/superd-hub/dist/a2a-ingest.d.ts +31 -0
- package/superd-hub/dist/a2a-ingest.js +636 -0
- package/superd-hub/dist/a2a-log.d.ts +17 -0
- package/superd-hub/dist/a2a-log.js +42 -0
- package/superd-hub/dist/a2a-row.d.ts +65 -0
- package/superd-hub/dist/a2a-row.js +162 -0
- package/superd-hub/dist/a2a-service.d.ts +357 -0
- package/superd-hub/dist/a2a-service.js +980 -0
- package/superd-hub/dist/a2a-wire.d.ts +220 -0
- package/superd-hub/dist/a2a-wire.js +305 -0
- package/superd-hub/dist/agent-ids.d.ts +10 -0
- package/superd-hub/dist/agent-ids.js +68 -0
- package/superd-hub/dist/agent-roster.d.ts +29 -18
- package/superd-hub/dist/agent-roster.js +54 -15
- package/superd-hub/dist/agent-status.d.ts +119 -0
- package/superd-hub/dist/agent-status.js +386 -0
- package/superd-hub/dist/client/agent-settings.d.ts +156 -0
- package/superd-hub/dist/client/agent-settings.js +229 -0
- package/superd-hub/dist/client/mesh-api.d.ts +134 -0
- package/superd-hub/dist/client/mesh-api.js +219 -0
- package/superd-hub/dist/client/mesh-groups.d.ts +63 -0
- package/superd-hub/dist/client/mesh-groups.js +66 -0
- package/superd-hub/dist/client/roster.d.ts +48 -0
- package/superd-hub/dist/client/roster.js +102 -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/dist/exec-pty-channel.d.ts +58 -0
- package/superd-hub/dist/exec-pty-channel.js +162 -0
- package/superd-hub/dist/exec-pty-framing.d.ts +32 -0
- package/superd-hub/dist/exec-pty-framing.js +81 -0
- package/superd-hub/dist/exec-pty-rpc.d.ts +21 -0
- package/superd-hub/dist/exec-pty-rpc.js +128 -0
- package/superd-hub/dist/exec-pty-session.d.ts +76 -0
- package/superd-hub/dist/exec-pty-session.js +234 -0
- package/superd-hub/dist/exec.d.ts +56 -0
- package/superd-hub/dist/exec.js +225 -0
- package/superd-hub/dist/gateway.d.ts +39 -2
- package/superd-hub/dist/gateway.js +62 -3
- package/superd-hub/dist/hub-tool.d.ts +174 -0
- package/superd-hub/dist/hub-tool.js +464 -0
- package/superd-hub/dist/index.d.ts +15 -1
- package/superd-hub/dist/index.js +16 -0
- package/superd-hub/dist/machines.d.ts +45 -0
- package/superd-hub/dist/machines.js +125 -0
- package/superd-hub/dist/mesh-federate.d.ts +138 -0
- package/superd-hub/dist/mesh-federate.js +223 -0
- package/superd-hub/dist/mesh-gateway.d.ts +67 -0
- package/superd-hub/dist/mesh-gateway.js +408 -0
- package/superd-hub/dist/mesh-link.d.ts +274 -0
- package/superd-hub/dist/mesh-link.js +441 -0
- package/superd-hub/dist/mesh-rpc.d.ts +123 -0
- package/superd-hub/dist/mesh-rpc.js +250 -0
- package/superd-hub/dist/mux-client.d.ts +71 -0
- package/superd-hub/dist/mux-client.js +281 -0
- package/superd-hub/dist/pack-version.d.ts +2 -0
- package/superd-hub/dist/pack-version.js +30 -0
- package/superd-hub/dist/roster.d.ts +6 -0
- package/superd-hub/dist/rpc.d.ts +18 -2
- package/superd-hub/dist/rpc.js +34 -4
- package/superd-hub/dist/spawn-world.js +3 -1
- package/superd-hub/dist/switch-core.d.ts +62 -25
- package/superd-hub/dist/switch-core.js +53 -30
- package/superd-hub/dist/system-head.d.ts +22 -12
- package/superd-hub/dist/system-head.js +100 -84
- package/superd-hub/dist/wire-endpoints.d.ts +264 -0
- package/superd-hub/dist/wire-endpoints.js +180 -0
- package/superd-hub/lib/client/index.js +1794 -287
- package/superd-hub/package.json +11 -2
- package/agent-agy/dist/agent-preset-projection.d.ts +0 -31
- package/agent-agy/dist/agent-preset-projection.js +0 -33
- package/agent-claude/dist/agent-preset-projection.js +0 -30
- package/agent-codex/dist/agent-preset-projection.js +0 -37
- package/agent-codex/dist/app-home.js +0 -65
- package/agent-codex/dist/models.js +0 -152
- package/agent-codex/dist/spike.js +0 -46
- package/agent-hermes/dist/agent-preset-projection.js +0 -34
- package/agent-omp/dist/agent-preset-projection.js +0 -36
- package/agent-omp/dist/app-home.js +0 -86
- package/agent-omp/dist/sidecar-client.js +0 -195
- package/agent-pi/dist/agent-preset-projection.js +0 -29
- package/superd-hub/dist/client-shim.d.ts +0 -28
- package/superd-hub/dist/client-shim.js +0 -251
- package/superd-hub/dist/index-pass.d.ts +0 -22
- package/superd-hub/dist/index-pass.js +0 -47
- package/superd-hub/dist/labels.d.ts +0 -45
- package/superd-hub/dist/labels.js +0 -83
- /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
package/superd-hub/package.json
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"./client": "./lib/client/index.js",
|
|
9
9
|
"./world": "./dist/world-entry.js",
|
|
10
10
|
"./join": "./dist/world-join.js",
|
|
11
|
-
"./web-trust": "./dist/web-trust.js"
|
|
11
|
+
"./web-trust": "./dist/web-trust.js",
|
|
12
|
+
"./a2a": "./dist/a2a-row.js"
|
|
12
13
|
},
|
|
13
14
|
"files": [
|
|
14
15
|
"dist",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"build": "tsc -p .",
|
|
31
32
|
"typecheck:client": "tsc -p tsconfig.client.json",
|
|
32
33
|
"build-client": "npm run typecheck:client && node scripts/build-client.mjs",
|
|
33
|
-
"test": "node --test --test-force-exit test/*.test.mjs"
|
|
34
|
+
"test": "node --test --test-reporter=spec --test-concurrency=8 --test-force-exit test/*.test.mjs"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"js-yaml": "^4.3.2",
|
|
@@ -39,7 +40,9 @@
|
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"@deepseek-ai/cordis": "*",
|
|
41
42
|
"@deepseek-ai/dsh-api-gateway": ">=0.1.5-0 <0.3.0-0",
|
|
43
|
+
"@deepseek-ai/dsh-home-paths": ">=0.1.5-0 <0.3.0-0",
|
|
42
44
|
"@deepseek-ai/dsh-host-webserver": ">=0.1.5-0 <0.3.0-0",
|
|
45
|
+
"@deepseek-ai/dsh-tools": ">=0.1.5-0 <0.3.0-0",
|
|
43
46
|
"@deepseek-ai/dsh-typert-protocol": ">=0.1.5-0 <0.3.0-0"
|
|
44
47
|
},
|
|
45
48
|
"peerDependenciesMeta": {
|
|
@@ -49,9 +52,15 @@
|
|
|
49
52
|
"@deepseek-ai/dsh-api-gateway": {
|
|
50
53
|
"optional": true
|
|
51
54
|
},
|
|
55
|
+
"@deepseek-ai/dsh-home-paths": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
52
58
|
"@deepseek-ai/dsh-host-webserver": {
|
|
53
59
|
"optional": true
|
|
54
60
|
},
|
|
61
|
+
"@deepseek-ai/dsh-tools": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
55
64
|
"@deepseek-ai/dsh-typert-protocol": {
|
|
56
65
|
"optional": true
|
|
57
66
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `agentPreset` session projection, owned by the adapter.
|
|
3
|
-
*
|
|
4
|
-
* Upstream registers this fold from the `dsh-agent-presets` package, which our
|
|
5
|
-
* patch disables (the Antigravity provider replaces preset composition
|
|
6
|
-
* wholesale). But the Web UI depends on the projection regardless: the preset
|
|
7
|
-
* hero chip renders only when `session.projectionValues.agentPreset` resolves
|
|
8
|
-
* (presetOf in ui-agent-preset/seat-store.ts), and the session-header label
|
|
9
|
-
* reads it too. Without a registrant the projection is absent for every
|
|
10
|
-
* adapter session and both surfaces stay blank — roster or no roster.
|
|
11
|
-
*
|
|
12
|
-
* Same fold as upstream (packages/preset/agent-presets/src/session.ts):
|
|
13
|
-
* initialized from the creation header, advanced by `agent-preset/selected`
|
|
14
|
-
* events, which this adapter synthesizes (`"agy"`) on every session it
|
|
15
|
-
* prepares. Registered under the provider's own fiber via
|
|
16
|
-
* `ctx.inject(['sessionProjections'])`, so the key lives exactly as long as
|
|
17
|
-
* the provider is mounted.
|
|
18
|
-
*/
|
|
19
|
-
import { z } from "zod";
|
|
20
|
-
/** Current Session preset, initialized from its header and advanced by selection events. */
|
|
21
|
-
export declare const agyAgentPresetProjection: {
|
|
22
|
-
key: "agentPreset";
|
|
23
|
-
stateSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
|
24
|
-
init: (header: import("@deepseek-ai/dsh-session").SessionHeader) => string;
|
|
25
|
-
apply: (state: string | null, event: import("@deepseek-ai/dsh-session").SessionEvent) => string | null;
|
|
26
|
-
wire: {
|
|
27
|
-
viewSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
|
28
|
-
view: (state: string | null) => string | null;
|
|
29
|
-
};
|
|
30
|
-
stateVersion: number;
|
|
31
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `agentPreset` session projection, owned by the adapter.
|
|
3
|
-
*
|
|
4
|
-
* Upstream registers this fold from the `dsh-agent-presets` package, which our
|
|
5
|
-
* patch disables (the Antigravity provider replaces preset composition
|
|
6
|
-
* wholesale). But the Web UI depends on the projection regardless: the preset
|
|
7
|
-
* hero chip renders only when `session.projectionValues.agentPreset` resolves
|
|
8
|
-
* (presetOf in ui-agent-preset/seat-store.ts), and the session-header label
|
|
9
|
-
* reads it too. Without a registrant the projection is absent for every
|
|
10
|
-
* adapter session and both surfaces stay blank — roster or no roster.
|
|
11
|
-
*
|
|
12
|
-
* Same fold as upstream (packages/preset/agent-presets/src/session.ts):
|
|
13
|
-
* initialized from the creation header, advanced by `agent-preset/selected`
|
|
14
|
-
* events, which this adapter synthesizes (`"agy"`) on every session it
|
|
15
|
-
* prepares. Registered under the provider's own fiber via
|
|
16
|
-
* `ctx.inject(['sessionProjections'])`, so the key lives exactly as long as
|
|
17
|
-
* the provider is mounted.
|
|
18
|
-
*/
|
|
19
|
-
import { z } from "zod";
|
|
20
|
-
const agentPresetSchema = z.union([z.string(), z.null()]);
|
|
21
|
-
/** Current Session preset, initialized from its header and advanced by selection events. */
|
|
22
|
-
export const agyAgentPresetProjection = {
|
|
23
|
-
key: "agentPreset",
|
|
24
|
-
stateSchema: agentPresetSchema,
|
|
25
|
-
// adapter-agy is single-preset: default every session to "agy" so the
|
|
26
|
-
// header chip resolves for scan-native (never-resumed) sessions too.
|
|
27
|
-
init: (header) => header.agentPreset ?? "agy",
|
|
28
|
-
apply: (state, event) => event.type === "agent-preset/selected"
|
|
29
|
-
? event.data.agentPreset
|
|
30
|
-
: state,
|
|
31
|
-
wire: { viewSchema: agentPresetSchema, view: (state) => state },
|
|
32
|
-
stateVersion: 1,
|
|
33
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `agentPreset` session projection, owned by the adapter.
|
|
3
|
-
*
|
|
4
|
-
* Upstream registers this fold from the `dsh-agent-presets` package, which
|
|
5
|
-
* the bundle patch disables (the claude provider replaces preset composition
|
|
6
|
-
* wholesale). But the Web UI depends on the projection regardless: the
|
|
7
|
-
* preset hero chip renders only when `session.projectionValues.agentPreset`
|
|
8
|
-
* resolves, and the session-header label reads it too. Without a registrant
|
|
9
|
-
* the projection is absent for every adapter session and both surfaces stay
|
|
10
|
-
* blank — roster or no roster (the omp line's "no mode" bug, re-observed as
|
|
11
|
-
* the claude "degraded preset" finding).
|
|
12
|
-
*
|
|
13
|
-
* Same fold as upstream; adapter-claude is single-preset: default every
|
|
14
|
-
* session to "claude" so the header chip resolves for sessions whose log
|
|
15
|
-
* carries no `agent-preset/selected` event yet. Registered under the
|
|
16
|
-
* provider's own fiber via `ctx.inject(['sessionProjections'])`.
|
|
17
|
-
*/
|
|
18
|
-
import { z } from "zod";
|
|
19
|
-
const agentPresetSchema = z.union([z.string(), z.null()]);
|
|
20
|
-
/** Current Session preset, initialized from its header and advanced by selection events. */
|
|
21
|
-
export const claudeAgentPresetProjection = {
|
|
22
|
-
key: "agentPreset",
|
|
23
|
-
stateSchema: agentPresetSchema,
|
|
24
|
-
init: (header) => header.agentPreset ?? "claude",
|
|
25
|
-
apply: (state, event) => event.type === "agent-preset/selected"
|
|
26
|
-
? event.data.agentPreset
|
|
27
|
-
: state,
|
|
28
|
-
wire: { viewSchema: agentPresetSchema, view: (state) => state },
|
|
29
|
-
stateVersion: 1,
|
|
30
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `agentPreset` session projection, owned by the adapter.
|
|
3
|
-
*
|
|
4
|
-
* Upstream registers this fold from the `dsh-agent-presets` package, which our
|
|
5
|
-
* patch disables (the Codex provider replaces preset composition wholesale).
|
|
6
|
-
* But the Web UI depends on the projection regardless: the preset hero chip
|
|
7
|
-
* renders only when `session.projectionValues.agentPreset` resolves
|
|
8
|
-
* (`presetOf` in ui-agent-preset/seat-store.ts), and the session-header label
|
|
9
|
-
* reads it too. Without a registrant the projection is absent for every
|
|
10
|
-
* adapter session and both surfaces stay blank — roster or no roster (that
|
|
11
|
-
* was the "no mode" bug on the omp line: the roster service answered
|
|
12
|
-
* agentPresets/list 200, yet nothing drove the per-session projection the
|
|
13
|
-
* chip gates on).
|
|
14
|
-
*
|
|
15
|
-
* Same fold as upstream (packages/preset/agent-presets/src/session.ts):
|
|
16
|
-
* initialized from the creation header, advanced by `agent-preset/selected`
|
|
17
|
-
* events, which this adapter synthesizes (`"codex"`) on every session it
|
|
18
|
-
* prepares. Registered under the provider's own fiber via
|
|
19
|
-
* `ctx.inject(['sessionProjections'])`, so the key lives exactly as long as
|
|
20
|
-
* the provider is mounted.
|
|
21
|
-
*/
|
|
22
|
-
import { z } from "zod";
|
|
23
|
-
const agentPresetSchema = z.union([z.string(), z.null()]);
|
|
24
|
-
/** Current Session preset, initialized from its header and advanced by selection events. */
|
|
25
|
-
export const codexAgentPresetProjection = {
|
|
26
|
-
key: "agentPreset",
|
|
27
|
-
stateSchema: agentPresetSchema,
|
|
28
|
-
// adapter-codex is single-preset: default every session to "codex" so the
|
|
29
|
-
// header chip resolves for scan-native (never-resumed) sessions too,
|
|
30
|
-
// instead of only those whose log carries an `agent-preset/selected` event.
|
|
31
|
-
init: (header) => header.agentPreset ?? "codex",
|
|
32
|
-
apply: (state, event) => event.type === "agent-preset/selected"
|
|
33
|
-
? event.data.agentPreset
|
|
34
|
-
: state,
|
|
35
|
-
wire: { viewSchema: agentPresetSchema, view: (state) => state },
|
|
36
|
-
stateVersion: 1,
|
|
37
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Codex runtime app home bootstrap — idempotently creates the codex home and
|
|
3
|
-
* seeds it with the Codex CLI's own config set (config.toml / model catalog /
|
|
4
|
-
* auth) copied once from the native `~/.codex`.
|
|
5
|
-
*
|
|
6
|
-
* Why this is required, not cosmetic: a Codex home without `config.toml` makes
|
|
7
|
-
* the CLI fall back to its built-in OpenAI provider, so every turn dies on
|
|
8
|
-
* `wss://api.openai.com/v1/responses` with a region block (403 "Country,
|
|
9
|
-
* region, or territory not supported"). The native home is where the user's
|
|
10
|
-
* provider wiring lives (e.g. a local proxy: `model_provider = "custom"`,
|
|
11
|
-
* `base_url = "http://127.0.0.1:15721/v1"`, `model = "glm-5.3-flash"`), and the
|
|
12
|
-
* world deliberately runs with its own CODEX_HOME — so the config has to travel.
|
|
13
|
-
*
|
|
14
|
-
* Same manners as the OMP twin: never overwrites an existing file (a
|
|
15
|
-
* provisioned app home wins), skips missing sources, and is fail-soft — the app
|
|
16
|
-
* home is derived state, never a boot gate.
|
|
17
|
-
*/
|
|
18
|
-
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
|
19
|
-
import { homedir } from "node:os";
|
|
20
|
-
import { join } from "node:path";
|
|
21
|
-
import { resolveCodexHome } from "./codex-store.js";
|
|
22
|
-
/**
|
|
23
|
-
* Config files seeded into the codex home. `config.toml` names the provider and
|
|
24
|
-
* model, `cc-switch-model-catalog.json` is what its `model_catalog_json` key
|
|
25
|
-
* points at (a relative path, hence the same directory), and `auth.json` is the
|
|
26
|
-
* CLI's own credential record.
|
|
27
|
-
*/
|
|
28
|
-
export const CODEX_HOME_CONFIG_FILES = ["config.toml", "cc-switch-model-catalog.json", "auth.json"];
|
|
29
|
-
/** Native codex home — the copy source (`AW_CODEX_SEED_HOME` overrides). */
|
|
30
|
-
export function defaultCodexSeedHome() {
|
|
31
|
-
const configured = process.env.AW_CODEX_SEED_HOME;
|
|
32
|
-
return configured !== undefined && configured !== "" ? configured : join(homedir(), ".codex");
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Ensure the codex home exists and carries the CLI config set.
|
|
36
|
-
*
|
|
37
|
-
* @param options - target/source/files overrides.
|
|
38
|
-
* @returns the resolved codex home path (always, even on a failed seed).
|
|
39
|
-
*/
|
|
40
|
-
export function ensureCodexAppHome(options = {}) {
|
|
41
|
-
const codexHome = options.codexHome ?? resolveCodexHome();
|
|
42
|
-
const source = options.seedHome ?? defaultCodexSeedHome();
|
|
43
|
-
const files = options.files ?? CODEX_HOME_CONFIG_FILES;
|
|
44
|
-
const seeded = [];
|
|
45
|
-
try {
|
|
46
|
-
mkdirSync(codexHome, { recursive: true });
|
|
47
|
-
for (const name of files) {
|
|
48
|
-
const dest = join(codexHome, name);
|
|
49
|
-
if (existsSync(dest))
|
|
50
|
-
continue;
|
|
51
|
-
const src = join(source, name);
|
|
52
|
-
if (!existsSync(src))
|
|
53
|
-
continue;
|
|
54
|
-
copyFileSync(src, dest);
|
|
55
|
-
seeded.push(name);
|
|
56
|
-
}
|
|
57
|
-
if (seeded.length > 0) {
|
|
58
|
-
options.warn?.(`codex-provider: app home ${codexHome} seeded from ${source} (${seeded.join(", ")})`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
options.warn?.(`codex-provider: app-home bootstrap failed (fail-soft): ${String(error)}`);
|
|
63
|
-
}
|
|
64
|
-
return codexHome;
|
|
65
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Codex model catalog for the Dash model selector (AW-E Task 5).
|
|
3
|
-
*
|
|
4
|
-
* Reads the adapter's nested codex home the native way (spec S7: the native
|
|
5
|
-
* app self-populates its config; we read, never write):
|
|
6
|
-
* - `config.toml` top-level keys `model`, `model_reasoning_effort`,
|
|
7
|
-
* `model_provider`, `model_catalog_json` (minimal line parser — the full
|
|
8
|
-
* TOML grammar is deliberately not implemented; unknown lines are skipped);
|
|
9
|
-
* - `model_catalog_json` (relative to the codex home) → per-model identity
|
|
10
|
-
* fields (slug / display_name / default_reasoning_level / context_window).
|
|
11
|
-
*
|
|
12
|
-
* The frozen multi-agent-ctx models.ts used the app-server `model/list` —
|
|
13
|
-
* that surface does not exist on the SDK line, so the TOML+catalog pair is
|
|
14
|
-
* the only catalog source. Fail-soft everywhere: any missing/unparsable piece
|
|
15
|
-
* degrades toward a single `codex-default` placeholder, never a throw.
|
|
16
|
-
*/
|
|
17
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
18
|
-
import { join } from "node:path";
|
|
19
|
-
import { resolveCodexHome, useCodexHome } from "./codex-store.js";
|
|
20
|
-
/** Minimal top-level TOML scan: `key = value` pairs + `[section]` headers. */
|
|
21
|
-
function parseTopLevelToml(text) {
|
|
22
|
-
const values = {};
|
|
23
|
-
const sections = new Map();
|
|
24
|
-
let current = null;
|
|
25
|
-
let currentName = "";
|
|
26
|
-
for (const rawLine of text.split("\n")) {
|
|
27
|
-
const lineText = rawLine.trim();
|
|
28
|
-
if (lineText === "" || lineText.startsWith("#"))
|
|
29
|
-
continue;
|
|
30
|
-
const header = /^\[([^\]]+)\]$/.exec(lineText);
|
|
31
|
-
if (header !== null) {
|
|
32
|
-
currentName = header[1].trim();
|
|
33
|
-
current = {};
|
|
34
|
-
sections.set(currentName, current);
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
const eq = lineText.indexOf("=");
|
|
38
|
-
if (eq <= 0)
|
|
39
|
-
continue; // broken line — tolerated
|
|
40
|
-
const key = lineText.slice(0, eq).trim();
|
|
41
|
-
let value = lineText.slice(eq + 1).trim();
|
|
42
|
-
if (value.startsWith('"') && value.endsWith('"') && value.length >= 2) {
|
|
43
|
-
value = value.slice(1, -1);
|
|
44
|
-
}
|
|
45
|
-
else if (value.startsWith("'") && value.endsWith("'") && value.length >= 2) {
|
|
46
|
-
value = value.slice(1, -1);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
// strip trailing comment on bare values; keep numbers/bools as strings
|
|
50
|
-
const hash = value.indexOf(" #");
|
|
51
|
-
if (hash >= 0)
|
|
52
|
-
value = value.slice(0, hash).trim();
|
|
53
|
-
}
|
|
54
|
-
if (current !== null && currentName !== "")
|
|
55
|
-
current[key] = value;
|
|
56
|
-
else
|
|
57
|
-
values[key] = value;
|
|
58
|
-
}
|
|
59
|
-
return { values, sections };
|
|
60
|
-
}
|
|
61
|
-
/** The fail-soft placeholder model id (never sent to the real codex binary). */
|
|
62
|
-
export const CODEX_DEFAULT_MODEL_PLACEHOLDER = "codex-default";
|
|
63
|
-
/** The fail-soft placeholder: one entry, no claims about the runtime. */
|
|
64
|
-
function placeholder(defaultModel = CODEX_DEFAULT_MODEL_PLACEHOLDER) {
|
|
65
|
-
return { defaultModel, models: [{ id: defaultModel, label: "Codex default" }] };
|
|
66
|
-
}
|
|
67
|
-
/** Read the model catalog out of the codex home (fail-soft, never throws). */
|
|
68
|
-
export function readCodexModelCatalog(codexHome) {
|
|
69
|
-
let home;
|
|
70
|
-
try {
|
|
71
|
-
home = codexHome !== undefined ? useCodexHome(codexHome) : resolveCodexHome();
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
return placeholder();
|
|
75
|
-
}
|
|
76
|
-
let configValues = {};
|
|
77
|
-
let providerName;
|
|
78
|
-
const configPath = join(home, "config.toml");
|
|
79
|
-
if (existsSync(configPath)) {
|
|
80
|
-
try {
|
|
81
|
-
const parsed = parseTopLevelToml(readFileSync(configPath, "utf8"));
|
|
82
|
-
configValues = parsed.values;
|
|
83
|
-
const providerId = configValues["model_provider"];
|
|
84
|
-
if (providerId !== undefined) {
|
|
85
|
-
const section = parsed.sections.get(`model_providers.${providerId}`);
|
|
86
|
-
if (section !== undefined && typeof section["name"] === "string" && section["name"] !== "") {
|
|
87
|
-
providerName = section["name"];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
return placeholder();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const configModel = configValues["model"];
|
|
96
|
-
const catalogRel = configValues["model_catalog_json"];
|
|
97
|
-
const entries = [];
|
|
98
|
-
if (catalogRel !== undefined && catalogRel !== "") {
|
|
99
|
-
const catalogPath = join(home, catalogRel);
|
|
100
|
-
if (existsSync(catalogPath)) {
|
|
101
|
-
try {
|
|
102
|
-
const parsed = JSON.parse(readFileSync(catalogPath, "utf8"));
|
|
103
|
-
const models = parsed?.models;
|
|
104
|
-
if (Array.isArray(models)) {
|
|
105
|
-
for (const raw of models) {
|
|
106
|
-
if (raw === null || typeof raw !== "object")
|
|
107
|
-
continue;
|
|
108
|
-
const m = raw;
|
|
109
|
-
const slug = m["slug"];
|
|
110
|
-
if (typeof slug !== "string" || slug === "")
|
|
111
|
-
continue;
|
|
112
|
-
const label = typeof m["display_name"] === "string" && m["display_name"] !== "" ? m["display_name"] : slug;
|
|
113
|
-
const entry = {
|
|
114
|
-
id: slug,
|
|
115
|
-
label,
|
|
116
|
-
...(typeof m["default_reasoning_level"] === "string" && m["default_reasoning_level"] !== ""
|
|
117
|
-
? { reasoningEffort: m["default_reasoning_level"] }
|
|
118
|
-
: {}),
|
|
119
|
-
...(typeof m["context_window"] === "number" && Number.isSafeInteger(m["context_window"])
|
|
120
|
-
? { contextWindow: m["context_window"] }
|
|
121
|
-
: {}),
|
|
122
|
-
};
|
|
123
|
-
entries.push(entry);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
catch {
|
|
128
|
-
// unparsable catalog — fall through to the config-model entry
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (entries.length === 0) {
|
|
133
|
-
if (configModel === undefined || configModel === "")
|
|
134
|
-
return placeholder();
|
|
135
|
-
return {
|
|
136
|
-
defaultModel: configModel,
|
|
137
|
-
...(providerName === undefined ? {} : { provider: providerName }),
|
|
138
|
-
models: [{ id: configModel, label: configModel }],
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
// The configured model is what sessions actually run, so it must be
|
|
142
|
-
// selectable even when the provider's own catalog file does not list it
|
|
143
|
-
// (cc-switch ships a fixed list; `config.toml` may name a newer entry).
|
|
144
|
-
const models = configModel !== undefined && configModel !== "" && !entries.some((entry) => entry.id === configModel)
|
|
145
|
-
? [{ id: configModel, label: configModel }, ...entries]
|
|
146
|
-
: entries;
|
|
147
|
-
return {
|
|
148
|
-
defaultModel: configModel !== undefined && configModel !== "" ? configModel : entries[0].id,
|
|
149
|
-
...(providerName === undefined ? {} : { provider: providerName }),
|
|
150
|
-
models,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AW-E Task 1 spike (P0 gate): prove `@openai/codex-sdk@0.154.0` drives a real
|
|
3
|
-
* turn against the local cc-switch provider (glm-5.2) under an ISOLATED
|
|
4
|
-
* CODEX_HOME, and capture the raw ThreadEvent chain for the Task 2 projection
|
|
5
|
-
* fixtures. The SDK spawns its own exact-pinned codex binary — the 0.153.4
|
|
6
|
-
* CLI on PATH is never consulted (version-mix safety, 2026-09-10 fact).
|
|
7
|
-
*/
|
|
8
|
-
import { Codex } from "@openai/codex-sdk";
|
|
9
|
-
function lastOfType(events, type) {
|
|
10
|
-
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
11
|
-
const evt = events[i];
|
|
12
|
-
if (evt.type === type)
|
|
13
|
-
return evt;
|
|
14
|
-
}
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
/** Run one real streamed turn and collect the full event chain. */
|
|
18
|
-
export async function runSpike(opts) {
|
|
19
|
-
const codex = new Codex({
|
|
20
|
-
// env REPLACES process.env (SDK contract) — carry it forward + redirect home.
|
|
21
|
-
env: { ...process.env, CODEX_HOME: opts.codexHome },
|
|
22
|
-
});
|
|
23
|
-
const thread = codex.startThread({
|
|
24
|
-
workingDirectory: opts.cwd,
|
|
25
|
-
skipGitRepoCheck: true,
|
|
26
|
-
approvalPolicy: "never",
|
|
27
|
-
sandboxMode: "read-only",
|
|
28
|
-
});
|
|
29
|
-
const events = [];
|
|
30
|
-
const streamed = await thread.runStreamed(opts.prompt ?? "Reply with exactly: ok");
|
|
31
|
-
for await (const evt of streamed.events) {
|
|
32
|
-
events.push(evt);
|
|
33
|
-
if (evt.type === "turn.failed") {
|
|
34
|
-
const error = evt.error;
|
|
35
|
-
throw new Error(`spike turn failed: ${error?.message ?? "unknown"}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const completed = lastOfType(events, "turn.completed");
|
|
39
|
-
const message = lastOfType(events, "item.completed");
|
|
40
|
-
return {
|
|
41
|
-
threadId: thread.id ?? "",
|
|
42
|
-
finalResponse: message?.item?.text ?? "",
|
|
43
|
-
usage: completed?.usage ?? null,
|
|
44
|
-
events,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `agentPreset` session projection, owned by the adapter.
|
|
3
|
-
*
|
|
4
|
-
* Upstream registers this fold from the `dsh-agent-presets` package, which our
|
|
5
|
-
* patch disables (the Hermes provider replaces preset composition wholesale).
|
|
6
|
-
* But the Web UI depends on the projection regardless: the preset hero chip
|
|
7
|
-
* renders only when `session.projectionValues.agentPreset` resolves
|
|
8
|
-
* (`presetOf` in ui-agent-preset/seat-store.ts), and the session-header label
|
|
9
|
-
* reads it too. Without a registrant the projection is absent for every
|
|
10
|
-
* adapter session and both surfaces stay blank — roster or no roster.
|
|
11
|
-
*
|
|
12
|
-
* Same fold as upstream (packages/preset/agent-presets/src/session.ts):
|
|
13
|
-
* initialized from the creation header, advanced by `agent-preset/selected`
|
|
14
|
-
* events, which this adapter synthesizes (`"hermes"`) on every session it
|
|
15
|
-
* prepares. Registered under the provider's own fiber via
|
|
16
|
-
* `ctx.inject(['sessionProjections'])`, so the key lives exactly as long as
|
|
17
|
-
* the provider is mounted.
|
|
18
|
-
*/
|
|
19
|
-
import { z } from "zod";
|
|
20
|
-
const agentPresetSchema = z.union([z.string(), z.null()]);
|
|
21
|
-
/** Current Session preset, initialized from its header and advanced by selection events. */
|
|
22
|
-
export const hermesAgentPresetProjection = {
|
|
23
|
-
key: "agentPreset",
|
|
24
|
-
stateSchema: agentPresetSchema,
|
|
25
|
-
// adapter-hermes is single-preset: default every session to "hermes" so the
|
|
26
|
-
// header chip resolves for scan-native (never-resumed) sessions too,
|
|
27
|
-
// instead of only those whose log carries an `agent-preset/selected` event.
|
|
28
|
-
init: (header) => header.agentPreset ?? "hermes",
|
|
29
|
-
apply: (state, event) => event.type === "agent-preset/selected"
|
|
30
|
-
? event.data.agentPreset
|
|
31
|
-
: state,
|
|
32
|
-
wire: { viewSchema: agentPresetSchema, view: (state) => state },
|
|
33
|
-
stateVersion: 1,
|
|
34
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `agentPreset` session projection, owned by the bridge.
|
|
3
|
-
*
|
|
4
|
-
* Upstream registers this fold from the `dsh-agent-presets` package, which our
|
|
5
|
-
* patch disables (OMP replaces preset composition wholesale). But the Web UI
|
|
6
|
-
* depends on the projection regardless: the preset hero chip renders only when
|
|
7
|
-
* `session.projectionValues.agentPreset` resolves (`presetOf` in
|
|
8
|
-
* ui-agent-preset/seat-store.ts), and the session-header label reads it too.
|
|
9
|
-
* Without a registrant the projection is absent for every bridge session and
|
|
10
|
-
* both surfaces stay blank — roster or no roster (that was the "no omp mode"
|
|
11
|
-
* bug: the roster service answered `agentPresets/list` 200, yet nothing drove
|
|
12
|
-
* the per-session projection the chip gates on).
|
|
13
|
-
*
|
|
14
|
-
* Same fold as upstream (packages/preset/agent-presets/src/session.ts):
|
|
15
|
-
* initialized from the creation header, advanced by `agent-preset/selected`
|
|
16
|
-
* events, which this bridge already synthesizes (`"omp"`) on every session it
|
|
17
|
-
* prepares. Registered under the provider's own fiber via
|
|
18
|
-
* `ctx.inject(['sessionProjections'])`, so the key lives exactly as long as
|
|
19
|
-
* the provider is mounted.
|
|
20
|
-
*/
|
|
21
|
-
import { z } from "zod";
|
|
22
|
-
const agentPresetSchema = z.union([z.string(), z.null()]);
|
|
23
|
-
/** Current Session preset, initialized from its header and advanced by selection events. */
|
|
24
|
-
export const ompAgentPresetProjection = {
|
|
25
|
-
key: "agentPreset",
|
|
26
|
-
stateSchema: agentPresetSchema,
|
|
27
|
-
// omp-web is single-preset: default every session to "omp" so the header
|
|
28
|
-
// chip resolves for scan-native (never-resumed) sessions too, instead of
|
|
29
|
-
// only those whose log carries an `agent-preset/selected` event.
|
|
30
|
-
init: (header) => header.agentPreset ?? "omp",
|
|
31
|
-
apply: (state, event) => event.type === "agent-preset/selected"
|
|
32
|
-
? event.data.agentPreset
|
|
33
|
-
: state,
|
|
34
|
-
wire: { viewSchema: agentPresetSchema, view: (state) => state },
|
|
35
|
-
stateVersion: 1,
|
|
36
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OMP runtime app home bootstrap — idempotently creates the runtime's OMP home
|
|
3
|
-
* (`<DSH_HOME>/agents/omp/.omp`) and seeds it with the OMP config (config.yml /
|
|
4
|
-
* mcp.json / models.yml / .env) copied once from `~/.omp/agent`. Fail-soft: any
|
|
5
|
-
* error is reported and the host boot continues — the app home is derived state,
|
|
6
|
-
* never a boot gate.
|
|
7
|
-
*/
|
|
8
|
-
import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
9
|
-
import { join } from "node:path";
|
|
10
|
-
import { OMP_HOME, OMP_NATIVE_HOME } from "./knobs.js";
|
|
11
|
-
/** Config files seeded into the app home from the native OMP agent dir. */
|
|
12
|
-
export const APP_HOME_CONFIG_FILES = ["config.yml", "mcp.json", "models.yml", ".env"];
|
|
13
|
-
/**
|
|
14
|
-
* Comma/space separated `mcpServers` names the launcher refuses to inherit
|
|
15
|
-
* (`AW_OMP_MCP_EXCLUDE=zai-vision`). Deployment policy lives in the launcher, so
|
|
16
|
-
* this module never names a vendor.
|
|
17
|
-
*/
|
|
18
|
-
export const OMP_MCP_EXCLUDE_ENV = "AW_OMP_MCP_EXCLUDE";
|
|
19
|
-
/** Native OMP agent dir (`<OMP_NATIVE_HOME>/agent`) — the copy source. */
|
|
20
|
-
function defaultSourceAgentDir() {
|
|
21
|
-
return join(OMP_NATIVE_HOME, "agent");
|
|
22
|
-
}
|
|
23
|
-
/** Parse {@link OMP_MCP_EXCLUDE_ENV} into server names. */
|
|
24
|
-
function excludedMcpServers() {
|
|
25
|
-
return (process.env[OMP_MCP_EXCLUDE_ENV] ?? "")
|
|
26
|
-
.split(/[\s,]+/)
|
|
27
|
-
.map((name) => name.trim())
|
|
28
|
-
.filter((name) => name !== "");
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Drop excluded stdio MCP servers from the app home's `mcp.json`.
|
|
32
|
-
*
|
|
33
|
-
* Why this exists: the native `~/.omp/agent/mcp.json` carries a `npx -y
|
|
34
|
-
* @z_ai/mcp-server@latest` stdio server, and every spawned MCP child is a real
|
|
35
|
-
* process (a live npx install ~200 MB) that this runtime does not need. Seeding
|
|
36
|
-
* copies the file verbatim, so the filter runs after seeding and is idempotent:
|
|
37
|
-
* it only rewrites the document when a listed server was actually present.
|
|
38
|
-
*/
|
|
39
|
-
function pruneMcpServers(appHome, names, warn) {
|
|
40
|
-
if (names.length === 0)
|
|
41
|
-
return;
|
|
42
|
-
const file = join(appHome, "mcp.json");
|
|
43
|
-
if (!existsSync(file))
|
|
44
|
-
return;
|
|
45
|
-
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
46
|
-
const servers = parsed.mcpServers;
|
|
47
|
-
if (servers === undefined || typeof servers !== "object" || servers === null)
|
|
48
|
-
return;
|
|
49
|
-
const removed = names.filter((name) => Object.hasOwn(servers, name));
|
|
50
|
-
if (removed.length === 0)
|
|
51
|
-
return;
|
|
52
|
-
for (const name of removed)
|
|
53
|
-
delete servers[name];
|
|
54
|
-
writeFileSync(file, `${JSON.stringify(parsed, null, 2)}\n`);
|
|
55
|
-
warn?.(`omp-provider: pruned MCP servers from ${file}: ${removed.join(", ")}`);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Ensure the app home exists and is seeded. Never overwrites an existing file
|
|
59
|
-
* (an already-provisioned app home wins); a missing source file is skipped.
|
|
60
|
-
* Returns the resolved app home path.
|
|
61
|
-
*/
|
|
62
|
-
export function ensureOmpAppHome(options = {}) {
|
|
63
|
-
const appHome = options.appHome ?? OMP_HOME;
|
|
64
|
-
const source = options.sourceAgentDir ?? defaultSourceAgentDir();
|
|
65
|
-
const files = options.files ?? APP_HOME_CONFIG_FILES;
|
|
66
|
-
try {
|
|
67
|
-
mkdirSync(appHome, { recursive: true });
|
|
68
|
-
for (const name of files) {
|
|
69
|
-
const dest = join(appHome, name);
|
|
70
|
-
if (existsSync(dest))
|
|
71
|
-
continue;
|
|
72
|
-
const src = join(source, name);
|
|
73
|
-
if (!existsSync(src))
|
|
74
|
-
continue;
|
|
75
|
-
copyFileSync(src, dest);
|
|
76
|
-
}
|
|
77
|
-
// Deployment policy, data-side: a seeded/kept `mcp.json` may still carry
|
|
78
|
-
// heavy stdio servers this runtime must not inherit (a vendor name does not
|
|
79
|
-
// belong in adapter code, so the launcher names them here).
|
|
80
|
-
pruneMcpServers(appHome, options.excludeMcpServers ?? excludedMcpServers(), options.warn);
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
options.warn?.(`omp-provider: app-home bootstrap failed (fail-soft): ${String(error)}`);
|
|
84
|
-
}
|
|
85
|
-
return appHome;
|
|
86
|
-
}
|