super-dsh 0.1.0 → 0.1.2
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/agent-agy/bridge/agy_bridge.py +250 -0
- package/agent-agy/bridge/gemini_openai_server.mjs +98 -0
- package/agent-agy/cordis.patch.yml +49 -0
- package/agent-agy/dist/adapter.d.ts +15 -0
- package/agent-agy/dist/adapter.js +42 -0
- package/agent-agy/dist/agent-preset-agy.d.ts +47 -0
- package/agent-agy/dist/agent-preset-agy.js +169 -0
- package/agent-agy/dist/agent-preset-projection.d.ts +31 -0
- package/agent-agy/dist/agent-preset-projection.js +33 -0
- package/agent-agy/dist/agent.d.ts +137 -0
- package/agent-agy/dist/agent.js +493 -0
- package/agent-agy/dist/agy-cli-client.d.ts +137 -0
- package/agent-agy/dist/agy-cli-client.js +301 -0
- package/agent-agy/dist/agy-client.d.ts +160 -0
- package/agent-agy/dist/agy-client.js +252 -0
- package/agent-agy/dist/agy-sessions.d.ts +24 -0
- package/agent-agy/dist/agy-sessions.js +116 -0
- package/agent-agy/dist/agy-store.d.ts +39 -0
- package/agent-agy/dist/agy-store.js +83 -0
- package/agent-agy/dist/inbox.d.ts +26 -0
- package/agent-agy/dist/inbox.js +53 -0
- package/agent-agy/dist/index.d.ts +80 -0
- package/agent-agy/dist/index.js +505 -0
- package/agent-agy/dist/models.d.ts +41 -0
- package/agent-agy/dist/models.js +74 -0
- package/agent-agy/dist/world-plugin.d.ts +9 -0
- package/agent-agy/dist/world-plugin.js +97 -0
- package/agent-agy/package.json +64 -0
- package/agent-claude/cordis.patch.yml +42 -0
- package/agent-claude/dist/adapter.js +62 -0
- package/agent-claude/dist/agent-preset-claude.js +169 -0
- package/agent-claude/dist/agent-preset-projection.js +30 -0
- package/agent-claude/dist/agent.js +1271 -0
- package/agent-claude/dist/claude-client.js +357 -0
- package/agent-claude/dist/claude-events.js +223 -0
- package/agent-claude/dist/claude-home.js +29 -0
- package/agent-claude/dist/commands.js +182 -0
- package/agent-claude/dist/content.js +134 -0
- package/agent-claude/dist/inbox.js +53 -0
- package/agent-claude/dist/index.js +555 -0
- package/agent-claude/dist/input-queue.js +64 -0
- package/agent-claude/dist/interaction.js +271 -0
- package/agent-claude/dist/models.js +158 -0
- package/agent-claude/dist/permission.js +120 -0
- package/agent-claude/dist/session-id.js +20 -0
- package/agent-claude/dist/session-map.js +165 -0
- package/agent-claude/dist/world-plugin.js +14 -0
- package/agent-claude/package.json +74 -0
- package/agent-codex/README.md +74 -0
- package/agent-codex/cordis.patch.yml +77 -0
- package/agent-codex/dist/adapter.js +55 -0
- package/agent-codex/dist/agent-preset-codex.js +171 -0
- package/agent-codex/dist/agent-preset-projection.js +37 -0
- package/agent-codex/dist/agent.js +1056 -0
- package/agent-codex/dist/app-home.js +65 -0
- package/agent-codex/dist/codex-client.js +469 -0
- package/agent-codex/dist/codex-events.js +297 -0
- package/agent-codex/dist/codex-store.js +190 -0
- package/agent-codex/dist/inbox.js +53 -0
- package/agent-codex/dist/index.js +605 -0
- package/agent-codex/dist/models.js +152 -0
- package/agent-codex/dist/permission.js +71 -0
- package/agent-codex/dist/session-map.js +170 -0
- package/agent-codex/dist/spike.js +46 -0
- package/agent-codex/dist/world-plugin.js +96 -0
- package/agent-codex/package.json +78 -0
- package/agent-hermes/README.md +144 -0
- package/agent-hermes/cordis.patch.yml +83 -0
- package/agent-hermes/dist/adapter.js +83 -0
- package/agent-hermes/dist/agent-preset-hermes.js +171 -0
- package/agent-hermes/dist/agent-preset-projection.js +34 -0
- package/agent-hermes/dist/agent.js +1068 -0
- package/agent-hermes/dist/hermes-client.js +953 -0
- package/agent-hermes/dist/hermes-events.js +289 -0
- package/agent-hermes/dist/hermes-store.js +158 -0
- package/agent-hermes/dist/inbox.js +53 -0
- package/agent-hermes/dist/index.js +541 -0
- package/agent-hermes/dist/models.js +324 -0
- package/agent-hermes/dist/permission.js +60 -0
- package/agent-hermes/dist/world-plugin.js +101 -0
- package/agent-hermes/package.json +76 -0
- package/agent-hub/cordis.patch.yml +12 -0
- package/agent-hub/dist/agent-roster.d.ts +34 -0
- package/agent-hub/dist/agent-roster.js +27 -0
- package/agent-hub/dist/carrier.d.ts +43 -0
- package/agent-hub/dist/carrier.js +241 -0
- package/agent-hub/dist/client-shim.d.ts +28 -0
- package/agent-hub/dist/client-shim.js +251 -0
- package/agent-hub/dist/envelope.d.ts +54 -0
- package/agent-hub/dist/envelope.js +92 -0
- package/agent-hub/dist/gateway.d.ts +28 -0
- package/agent-hub/dist/gateway.js +18 -0
- package/agent-hub/dist/index-pass.d.ts +22 -0
- package/agent-hub/dist/index-pass.js +47 -0
- package/agent-hub/dist/index.d.ts +29 -0
- package/agent-hub/dist/index.js +29 -0
- package/agent-hub/dist/labels.d.ts +45 -0
- package/agent-hub/dist/labels.js +83 -0
- package/agent-hub/dist/ownership.d.ts +37 -0
- package/agent-hub/dist/ownership.js +54 -0
- package/agent-hub/dist/roster.d.ts +28 -0
- package/agent-hub/dist/roster.js +38 -0
- package/agent-hub/dist/rpc.d.ts +38 -0
- package/agent-hub/dist/rpc.js +52 -0
- package/agent-hub/dist/spawn-world.d.ts +46 -0
- package/agent-hub/dist/spawn-world.js +72 -0
- package/agent-hub/dist/targets.d.ts +33 -0
- package/agent-hub/dist/targets.js +30 -0
- package/agent-hub/dist/world-entry.d.ts +31 -0
- package/agent-hub/dist/world-entry.js +51 -0
- package/agent-hub/dist/world-host.d.ts +69 -0
- package/agent-hub/dist/world-host.js +44 -0
- package/agent-hub/dist/world-join.d.ts +16 -0
- package/agent-hub/dist/world-join.js +122 -0
- package/agent-hub/dist/world-mount.d.ts +52 -0
- package/agent-hub/dist/world-mount.js +52 -0
- package/agent-hub/dist/world-mux.d.ts +72 -0
- package/agent-hub/dist/world-mux.js +224 -0
- package/agent-hub/dist/world-provision.d.ts +20 -0
- package/agent-hub/dist/world-provision.js +122 -0
- package/agent-hub/dist/world-web-server.d.ts +162 -0
- package/agent-hub/dist/world-web-server.js +248 -0
- package/agent-hub/lib/client/index.js +242 -0
- package/agent-hub/package.json +65 -0
- package/agent-omp/README.md +77 -0
- package/agent-omp/cordis.patch.yml +92 -0
- package/agent-omp/dist/adapter.js +36 -0
- package/agent-omp/dist/agent-preset-omp.js +171 -0
- package/agent-omp/dist/agent-preset-projection.js +36 -0
- package/agent-omp/dist/agent.js +1145 -0
- package/agent-omp/dist/app-home.js +86 -0
- package/agent-omp/dist/discovery.js +116 -0
- package/agent-omp/dist/inbox.js +53 -0
- package/agent-omp/dist/index.js +574 -0
- package/agent-omp/dist/knobs.js +50 -0
- package/agent-omp/dist/lazy-rpc.js +161 -0
- package/agent-omp/dist/mobile/gesture.js +148 -0
- package/agent-omp/dist/mobile/zoom-guard.js +294 -0
- package/agent-omp/dist/mobile-boot.js +38 -0
- package/agent-omp/dist/models.js +299 -0
- package/agent-omp/dist/omp-cli.js +147 -0
- package/agent-omp/dist/omp-disk-discovery.js +178 -0
- package/agent-omp/dist/omp-store.js +518 -0
- package/agent-omp/dist/pairing.js +45 -0
- package/agent-omp/dist/permission.js +96 -0
- package/agent-omp/dist/protocol.js +13 -0
- package/agent-omp/dist/rpc-types.js +1 -0
- package/agent-omp/dist/sdk-client.js +378 -0
- package/agent-omp/dist/sidecar-client.js +195 -0
- package/agent-omp/dist/store/adapter.js +47 -0
- package/agent-omp/dist/store/db.js +210 -0
- package/agent-omp/dist/store/index.js +59 -0
- package/agent-omp/dist/store/reconcile.js +51 -0
- package/agent-omp/dist/store/schema.js +40 -0
- package/agent-omp/dist/world-plugin.js +96 -0
- package/agent-omp/package.json +97 -0
- package/agent-omp/sidecar/main.ts +481 -0
- package/agent-pi/README.md +67 -0
- package/agent-pi/cordis.patch.yml +80 -0
- package/agent-pi/dist/adapter.js +53 -0
- package/agent-pi/dist/agent-preset-pi.js +169 -0
- package/agent-pi/dist/agent-preset-projection.js +29 -0
- package/agent-pi/dist/agent.js +949 -0
- package/agent-pi/dist/inbox.js +53 -0
- package/agent-pi/dist/index.js +595 -0
- package/agent-pi/dist/knobs.js +24 -0
- package/agent-pi/dist/models.js +200 -0
- package/agent-pi/dist/permission.js +66 -0
- package/agent-pi/dist/pi-client.js +224 -0
- package/agent-pi/dist/pi-events.js +155 -0
- package/agent-pi/dist/pi-home.js +55 -0
- package/agent-pi/dist/safe-json.js +25 -0
- package/agent-pi/dist/session-map.js +119 -0
- package/agent-pi/dist/world-plugin.js +97 -0
- package/agent-pi/package.json +77 -0
- package/cordis.patch.yml +22 -19
- package/package.json +88 -25
- package/client.js +0 -4
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aw.agent-adapter-agy — the Antigravity (agy) adapter's WORLD plugin (spec S2):
|
|
3
|
+
* activation IS roster membership.
|
|
4
|
+
*
|
|
5
|
+
* AW-B URL scheme (DL1–DL5), mirroring `@pgmi-builds/agent-adapter-omp/world`
|
|
6
|
+
* and `@pgmi-builds/agent-adapter-codex/world` so the hub sees every foreign
|
|
7
|
+
* runtime through one shape: the world is spawned as a sibling ROOT context
|
|
8
|
+
* with NO listener (`worldMountPatches`) and mounts itself under `/agy`.
|
|
9
|
+
*
|
|
10
|
+
* 1. ctx0 publishes the host mount (real webServer instance) before spawn;
|
|
11
|
+
* 2. the world's entry row provides the virtual `webServer` in the world
|
|
12
|
+
* root, translating every route its plugins declare into `/agy+path`;
|
|
13
|
+
* 3. the hub's carrier answers `/agy/api` + `/agy/api/remote.mux` in
|
|
14
|
+
* ctx0's auth domain and dispatches into this world's gateway instance.
|
|
15
|
+
*/
|
|
16
|
+
import { mkdirSync } from 'node:fs';
|
|
17
|
+
import { resolveDshHome } from '@deepseek-ai/dsh-home-paths';
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
import { spawnWorld, registerAgent, setReady, registerForeignTarget, registerHostMount, mountWorld, worldMountPatches, provisionWorldProfile, } from '../../agent-hub/dist/index.js';
|
|
20
|
+
export const name = 'aw.agent-adapter-agy';
|
|
21
|
+
/** Runtime key — also the mount label. */
|
|
22
|
+
const KEY = 'agy';
|
|
23
|
+
const ANCHOR = process.env.SUPERD_DSH_ANCHOR
|
|
24
|
+
?? '/home/u1/.local/lib/node_modules/@deepseek-ai/dsh/package.json';
|
|
25
|
+
export function apply(ctx) {
|
|
26
|
+
registerAgent({ key: KEY, label: 'Antigravity', ready: false });
|
|
27
|
+
// Harness resolver (env → ~/.dsh): a consumer install has no DSH_HOME and
|
|
28
|
+
// no cwd contract — deriving the world root from cwd spawns worlds into a
|
|
29
|
+
// garbage tree or throws inside apply() and kills the whole host boot.
|
|
30
|
+
const root = resolveDshHome();
|
|
31
|
+
// Nested home: the world's DSH data lives INSIDE `agents/<label>` (sessions
|
|
32
|
+
// / settings / workspaces, and the adapter's dsh-sessions.json mapping).
|
|
33
|
+
// agy: RUNTIME data lives in the SDK (google-antigravity localharness reads is the native ~/.pi (2026-09-17 ruling) — ~/.gemini read-only). Nothing is
|
|
34
|
+
// seeded or nested for the pi SDK itself.
|
|
35
|
+
const worldHome = join(root, 'agents', KEY);
|
|
36
|
+
mkdirSync(join(worldHome, 'profiles'), { recursive: true });
|
|
37
|
+
// Publish story: a foreign install has no line bootstrap, so the nested
|
|
38
|
+
// profile + @pgmi-builds links are provisioned HERE (idempotent; dev lines
|
|
39
|
+
// keep parity — smoke.mjs wrote the same layout, and AW_BARE_BASE still
|
|
40
|
+
// overrides the resolved base).
|
|
41
|
+
const bareBase = provisionWorldProfile({
|
|
42
|
+
key: KEY,
|
|
43
|
+
adapterPkg: '@pgmi-builds/agent-adapter-agy',
|
|
44
|
+
worldHome,
|
|
45
|
+
});
|
|
46
|
+
const world = (async () => {
|
|
47
|
+
// Wait for ctx0's listening stack: the mount needs the real webServer and
|
|
48
|
+
// the browser-trust fence from the live connection service.
|
|
49
|
+
const host = await new Promise((resolve) => {
|
|
50
|
+
ctx.inject(['webServer', 'connection'], (hostCtx) => { resolve(hostCtx); });
|
|
51
|
+
});
|
|
52
|
+
const real = host['webServer'];
|
|
53
|
+
const connection = host['connection'];
|
|
54
|
+
const dropHostMount = registerHostMount({
|
|
55
|
+
key: KEY,
|
|
56
|
+
labelPath: `/${KEY}`,
|
|
57
|
+
real,
|
|
58
|
+
// ctx0's index gate, applied by the mount to this world's pages and assets:
|
|
59
|
+
// the world is reached in-ctx and owns no listener, so ctx0 decides auth.
|
|
60
|
+
authorize: (req, res) => connection.authorizeIndex(req, res),
|
|
61
|
+
});
|
|
62
|
+
const ctxW = await spawnWorld({
|
|
63
|
+
appName: `aw-${KEY}`,
|
|
64
|
+
profileName: 'web',
|
|
65
|
+
installAnchor: ANCHOR,
|
|
66
|
+
home: worldHome,
|
|
67
|
+
dataHome: worldHome,
|
|
68
|
+
// Adapter-local bundle names resolve from the profile's own
|
|
69
|
+
// node_modules (heal owns @deepseek-ai there; @pgmi-builds links are
|
|
70
|
+
// provisioned by provisionWorldProfile above, or by the line bootstrap
|
|
71
|
+
// when the adapter package was not resolvable — env wins over both).
|
|
72
|
+
bareModuleBaseUrl: process.env.AW_BARE_BASE ?? bareBase ?? undefined,
|
|
73
|
+
extraPatches: worldMountPatches(KEY),
|
|
74
|
+
});
|
|
75
|
+
const gateway = ctxW.get('typertGateway');
|
|
76
|
+
registerForeignTarget({ key: KEY, gateway });
|
|
77
|
+
const mounted = mountWorld({
|
|
78
|
+
real,
|
|
79
|
+
label: KEY,
|
|
80
|
+
gateway,
|
|
81
|
+
requestRejection: (request) => connection
|
|
82
|
+
.requestRejection(request),
|
|
83
|
+
});
|
|
84
|
+
setReady(KEY, true);
|
|
85
|
+
ctx.effect?.(() => () => {
|
|
86
|
+
mounted.dispose();
|
|
87
|
+
dropHostMount();
|
|
88
|
+
}, `aw.agent-adapter-${KEY}: mount`);
|
|
89
|
+
return ctxW;
|
|
90
|
+
})().catch((cause) => {
|
|
91
|
+
// A failed world degrades to a not-ready roster row; a rejected provided
|
|
92
|
+
// promise would fail the entire host boot (loader entry apply).
|
|
93
|
+
console.error(`[super-dsh] ${KEY} world failed:`, cause);
|
|
94
|
+
return null;
|
|
95
|
+
});
|
|
96
|
+
ctx.provide(`aw.world.${KEY}`, world);
|
|
97
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pgmi-builds/agent-adapter-agy",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Google Antigravity (Gemini) provider for DeepSeek Harness (dsh) — drives the google-antigravity Python SDK through a JSONL stdio bridge (bridge/agy_bridge.py, localharness embedded). Consumer-first auth: Gemini API key stored adapter-side; ADC picked up transparently by the SDK. The agy CLI is never invoked.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/index.js",
|
|
8
|
+
"./world": "./dist/world-plugin.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"bridge",
|
|
13
|
+
"cordis.patch.yml"
|
|
14
|
+
],
|
|
15
|
+
"dsh": {
|
|
16
|
+
"bundle": {
|
|
17
|
+
"patch": "./cordis.patch.yml"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json",
|
|
22
|
+
"test": "node --test test/*.test.mjs",
|
|
23
|
+
"setup-venv": "bash scripts/setup-venv.sh"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"zod": "3.25.76"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
30
|
+
"@deepseek-ai/dsh-agent": "0.1.5-rc.2",
|
|
31
|
+
"@deepseek-ai/dsh-llm": "0.1.5-rc.2",
|
|
32
|
+
"@deepseek-ai/dsh-scope": "0.1.5-rc.2",
|
|
33
|
+
"@deepseek-ai/dsh-session": "0.1.5-rc.2",
|
|
34
|
+
"@deepseek-ai/dsh-session-persistence": "0.1.5-rc.2"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"@deepseek-ai/cordis": {
|
|
38
|
+
"optional": true
|
|
39
|
+
},
|
|
40
|
+
"@deepseek-ai/dsh-agent": {
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
"@deepseek-ai/dsh-llm": {
|
|
44
|
+
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"@deepseek-ai/dsh-scope": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"@deepseek-ai/dsh-session": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"@deepseek-ai/dsh-session-persistence": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/node": "^26.2.0",
|
|
58
|
+
"typescript": "^5.6.0"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"main": "dist/index.js"
|
|
64
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @pgmi-builds/agent-adapter-claude bundle patch (standalone web app form).
|
|
2
|
+
- insert:
|
|
3
|
+
- id: claude-provider
|
|
4
|
+
name: '@pgmi-builds/agent-adapter-claude'
|
|
5
|
+
|
|
6
|
+
- id: agent-loop
|
|
7
|
+
disabled: true
|
|
8
|
+
- id: llm-deepseek
|
|
9
|
+
disabled: true
|
|
10
|
+
- id: llm-pi-ai
|
|
11
|
+
disabled: true
|
|
12
|
+
- id: agent-presets
|
|
13
|
+
disabled: true
|
|
14
|
+
|
|
15
|
+
# The upstream jsonl persistence row STAYS MOUNTED: the provider owns the DSH
|
|
16
|
+
# session log write channel, so list/read/replay are ordinary DSH services.
|
|
17
|
+
|
|
18
|
+
# Claude has real runtime approval (canUseTool), so the preset table is the
|
|
19
|
+
# 3-preset skeleton plus plan/auto/dontAsk extra tiers (src/permission.ts).
|
|
20
|
+
- id: permission
|
|
21
|
+
config:
|
|
22
|
+
presets:
|
|
23
|
+
read-only:
|
|
24
|
+
sandbox: read-only
|
|
25
|
+
approval: ask
|
|
26
|
+
workspace-write:
|
|
27
|
+
sandbox: workspace-write
|
|
28
|
+
approval: ask
|
|
29
|
+
danger-full-access:
|
|
30
|
+
sandbox: danger-full-access
|
|
31
|
+
approval: never
|
|
32
|
+
defaultPreset: danger-full-access
|
|
33
|
+
|
|
34
|
+
# Directory picker: pin the in-app browser (both faces) and unmount the auto
|
|
35
|
+
# row — never `disabled: true` the row itself (that removes the entry point).
|
|
36
|
+
- insert:
|
|
37
|
+
- id: directory-picker-browse
|
|
38
|
+
name: '@deepseek-ai/dsh-host-directory-picker-browse'
|
|
39
|
+
- id: directory-picker-browse-surface
|
|
40
|
+
name: '@deepseek-ai/dsh-client-ui-directory-picker-browse'
|
|
41
|
+
- id: directory-picker
|
|
42
|
+
disabled: true
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude-backed `LlmAdapter` registered on `ctx.llm` by the Claude provider.
|
|
3
|
+
*
|
|
4
|
+
* The browser model selector never touches the Claude agent directly: it is an
|
|
5
|
+
* RPC round-trip through the apiproxy, which reads `ctx.llm.listProviders /
|
|
6
|
+
* listModels / resolveModel` to build the catalog. This adapter answers those
|
|
7
|
+
* queries from the models Claude actually reported (`models.ts`) under the
|
|
8
|
+
* single provider route `claude`.
|
|
9
|
+
*
|
|
10
|
+
* The route id must be `claude`, NOT `claude-code`: the upstream package
|
|
11
|
+
* `@deepseek-ai/dsh-subagent-claude-code` already occupies the subagent
|
|
12
|
+
* provider name `claude-code`, and a world mounting both must not collide.
|
|
13
|
+
*
|
|
14
|
+
* `stream` is never dispatched: Claude owns generation through its own SDK
|
|
15
|
+
* thread, so the adapter only serves catalog/metadata queries. It throws
|
|
16
|
+
* rather than fabricating a wire route the harness would misuse.
|
|
17
|
+
*/
|
|
18
|
+
import { LlmAdapter, LlmError, ReasoningEffortId, } from "@deepseek-ai/dsh-llm";
|
|
19
|
+
import { readModelCatalog } from "./models.js";
|
|
20
|
+
/** The one provider route every observed Claude model is served under. */
|
|
21
|
+
export const CLAUDE_PROVIDER_ID = "claude";
|
|
22
|
+
/** Human-readable provider name for selectors and diagnostics. */
|
|
23
|
+
const CLAUDE_PROVIDER_NAME = "Claude";
|
|
24
|
+
export class ClaudeLlmAdapter extends LlmAdapter {
|
|
25
|
+
providerInfo(_provider) {
|
|
26
|
+
return { id: CLAUDE_PROVIDER_ID, name: CLAUDE_PROVIDER_NAME };
|
|
27
|
+
}
|
|
28
|
+
async listModels(_provider) {
|
|
29
|
+
return readModelCatalog().models.map((model) => ({
|
|
30
|
+
provider: CLAUDE_PROVIDER_ID,
|
|
31
|
+
id: model.id,
|
|
32
|
+
name: model.label,
|
|
33
|
+
...(model.description === undefined ? {} : { description: model.description }),
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
async resolveModel(_provider, model) {
|
|
37
|
+
const found = readModelCatalog().models.find((candidate) => candidate.id === model);
|
|
38
|
+
if (found === undefined) {
|
|
39
|
+
throw new LlmError(`Claude provider "${CLAUDE_PROVIDER_ID}" does not serve model "${model}"`, "MODEL_NOT_FOUND");
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
provider: CLAUDE_PROVIDER_ID,
|
|
43
|
+
id: found.id,
|
|
44
|
+
name: found.label,
|
|
45
|
+
...(found.description === undefined ? {} : { description: found.description }),
|
|
46
|
+
// Only a positive window is real metadata: an absent or zero window must
|
|
47
|
+
// never become `context: { contextWindow: 0 }`.
|
|
48
|
+
...(found.contextWindow !== undefined && found.contextWindow > 0
|
|
49
|
+
? { context: { contextWindow: found.contextWindow } }
|
|
50
|
+
: {}),
|
|
51
|
+
// The CLI's advertised effort levels become adapter-owned reasoning
|
|
52
|
+
// efforts (omp thinking.efforts parity); the CLI names no default, so
|
|
53
|
+
// none is invented.
|
|
54
|
+
...(found.reasoningEfforts !== undefined && found.reasoningEfforts.length > 0
|
|
55
|
+
? { reasoning: { efforts: found.reasoningEfforts.map((effort) => ({ id: ReasoningEffortId(effort), name: effort })) } }
|
|
56
|
+
: {}),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
stream(_options) {
|
|
60
|
+
throw new LlmError("the Claude adapter does not stream: Claude owns generation through its SDK thread", "UNSUPPORTED_STREAM");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
36
|
+
const CLAUDE_PRESET = Object.freeze({
|
|
37
|
+
id: "claude",
|
|
38
|
+
trust: "system",
|
|
39
|
+
path: "",
|
|
40
|
+
name: "Claude",
|
|
41
|
+
description: "Claude Code via the agent-claude adapter",
|
|
42
|
+
});
|
|
43
|
+
const COMPOSITION_TEXT = [
|
|
44
|
+
"# Claude (fixed roster)",
|
|
45
|
+
"",
|
|
46
|
+
"This deployment runs exactly one agent mode: the Claude provider bridges Dash",
|
|
47
|
+
"sessions to a native Claude Code CLI over the official @anthropic-ai/claude-agent-sdk.",
|
|
48
|
+
"There is no per-session plugin composition to configure, so this preset",
|
|
49
|
+
"mounts nothing.",
|
|
50
|
+
"",
|
|
51
|
+
"rows: []",
|
|
52
|
+
"",
|
|
53
|
+
].join("\n");
|
|
54
|
+
/** The standing scope key every `claude` session reads presenters through. */
|
|
55
|
+
const STANDING_KEY = {};
|
|
56
|
+
let SingleClaudePresetRoster = (() => {
|
|
57
|
+
let _classSuper = TypertRemoteService;
|
|
58
|
+
let _instanceExtraInitializers = [];
|
|
59
|
+
let _remoteList_decorators;
|
|
60
|
+
let _remoteRead_decorators;
|
|
61
|
+
let _remoteCopy_decorators;
|
|
62
|
+
let _remoteDelete_decorators;
|
|
63
|
+
let _remoteSelect_decorators;
|
|
64
|
+
return class SingleClaudePresetRoster extends _classSuper {
|
|
65
|
+
static {
|
|
66
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
67
|
+
_remoteList_decorators = [Remote("list")];
|
|
68
|
+
_remoteRead_decorators = [Remote("read")];
|
|
69
|
+
_remoteCopy_decorators = [Remote("copy")];
|
|
70
|
+
_remoteDelete_decorators = [Remote("deletePreset")];
|
|
71
|
+
_remoteSelect_decorators = [Remote("select")];
|
|
72
|
+
__esDecorate(this, null, _remoteList_decorators, { kind: "method", name: "remoteList", static: false, private: false, access: { has: obj => "remoteList" in obj, get: obj => obj.remoteList }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
73
|
+
__esDecorate(this, null, _remoteRead_decorators, { kind: "method", name: "remoteRead", static: false, private: false, access: { has: obj => "remoteRead" in obj, get: obj => obj.remoteRead }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
74
|
+
__esDecorate(this, null, _remoteCopy_decorators, { kind: "method", name: "remoteCopy", static: false, private: false, access: { has: obj => "remoteCopy" in obj, get: obj => obj.remoteCopy }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
75
|
+
__esDecorate(this, null, _remoteDelete_decorators, { kind: "method", name: "remoteDelete", static: false, private: false, access: { has: obj => "remoteDelete" in obj, get: obj => obj.remoteDelete }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
76
|
+
__esDecorate(this, null, _remoteSelect_decorators, { kind: "method", name: "remoteSelect", static: false, private: false, access: { has: obj => "remoteSelect" in obj, get: obj => obj.remoteSelect }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
77
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
78
|
+
}
|
|
79
|
+
constructor(ctx) {
|
|
80
|
+
super(ctx, "agentPresets");
|
|
81
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
82
|
+
}
|
|
83
|
+
get defaultId() {
|
|
84
|
+
return CLAUDE_PRESET.id;
|
|
85
|
+
}
|
|
86
|
+
get roots() {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
get authorable() {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
async list() {
|
|
93
|
+
return [CLAUDE_PRESET];
|
|
94
|
+
}
|
|
95
|
+
async resolve(id) {
|
|
96
|
+
if (id === undefined || id === CLAUDE_PRESET.id)
|
|
97
|
+
return CLAUDE_PRESET;
|
|
98
|
+
throw new RemoteError("agent-preset/not-found", `agent-presets: preset "${id}" not found (available: claude)`, { agentPreset: id, available: [CLAUDE_PRESET.id] });
|
|
99
|
+
}
|
|
100
|
+
async mount(_agentCtx, id) {
|
|
101
|
+
return this.resolve(id);
|
|
102
|
+
}
|
|
103
|
+
async recompose(_agentCtx, id) {
|
|
104
|
+
return this.resolve(id);
|
|
105
|
+
}
|
|
106
|
+
async read(id) {
|
|
107
|
+
await this.resolve(id);
|
|
108
|
+
return COMPOSITION_TEXT;
|
|
109
|
+
}
|
|
110
|
+
// ── Remote RPC surface (alpha: agentPresets routes come from @Remote) ────
|
|
111
|
+
async remoteList() {
|
|
112
|
+
if (process.env.CLAUDE_TRACE === "1")
|
|
113
|
+
process.stderr.write("[claude-roster] remoteList INVOKED\n");
|
|
114
|
+
return {
|
|
115
|
+
presets: [
|
|
116
|
+
{
|
|
117
|
+
id: CLAUDE_PRESET.id,
|
|
118
|
+
trust: CLAUDE_PRESET.trust,
|
|
119
|
+
isDefault: true,
|
|
120
|
+
name: CLAUDE_PRESET.name,
|
|
121
|
+
description: CLAUDE_PRESET.description,
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
authorable: this.authorable,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
async remoteRead(agentPreset) {
|
|
128
|
+
const preset = await this.resolve(agentPreset);
|
|
129
|
+
return {
|
|
130
|
+
agentPreset: preset.id,
|
|
131
|
+
trust: preset.trust,
|
|
132
|
+
content: await this.read(preset.id),
|
|
133
|
+
name: preset.name,
|
|
134
|
+
description: preset.description,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
async remoteCopy(from, id, name) {
|
|
138
|
+
await this.copy(from, id, name);
|
|
139
|
+
}
|
|
140
|
+
async remoteDelete(id) {
|
|
141
|
+
await this.remove(id);
|
|
142
|
+
}
|
|
143
|
+
/** Fixed roster: one preset, so selecting it is a no-op ack; anything else is unknown. */
|
|
144
|
+
async remoteSelect(agent, agentPreset) {
|
|
145
|
+
const preset = await this.resolve(agentPreset);
|
|
146
|
+
return preset.id;
|
|
147
|
+
}
|
|
148
|
+
async copy(_from, id, _name) {
|
|
149
|
+
throw new RemoteError("agent-preset/read-only", `agent-presets: preset "${id}" cannot be written: the Claude roster is fixed and ships exactly one preset`, { agentPreset: id, reason: "the Claude roster is fixed and ships exactly one preset" });
|
|
150
|
+
}
|
|
151
|
+
async remove(id) {
|
|
152
|
+
throw new RemoteError("agent-preset/read-only", `agent-presets: preset "${id}" cannot be written: the Claude roster is fixed and ships exactly one preset`, { agentPreset: id, reason: "the Claude roster is fixed and ships exactly one preset" });
|
|
153
|
+
}
|
|
154
|
+
serviceFor(_agent, _name) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
composeFrom(_agentCtx, _parentCtx) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
composedPreset(_agentCtx) {
|
|
161
|
+
return CLAUDE_PRESET.id;
|
|
162
|
+
}
|
|
163
|
+
async standingKeyFor(id) {
|
|
164
|
+
await this.resolve(id);
|
|
165
|
+
return STANDING_KEY;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
})();
|
|
169
|
+
export { SingleClaudePresetRoster };
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
};
|