super-dsh 0.1.5 → 0.1.9
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/client/index.js +1010 -345
- package/cordis.patch.yml +22 -5
- package/package.json +8 -3
- 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 +32 -17
- 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/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 +96 -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/fusion-transport.d.ts +23 -21
- package/superd-hub/dist/fusion-transport.js +12 -40
- 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 +18 -4
- package/superd-hub/dist/index.js +19 -3
- 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 +10 -0
- package/superd-hub/dist/roster.js +9 -1
- 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 +98 -21
- package/superd-hub/dist/switch-core.js +123 -28
- package/superd-hub/dist/system-head.d.ts +22 -12
- package/superd-hub/dist/system-head.js +100 -84
- package/superd-hub/dist/toast-core.d.ts +43 -0
- package/superd-hub/dist/toast-core.js +63 -0
- package/superd-hub/dist/wire-endpoints.d.ts +264 -0
- package/superd-hub/dist/wire-endpoints.js +180 -0
- package/superd-hub/dist/world-join.js +8 -3
- package/superd-hub/dist/world-mount.d.ts +27 -0
- package/superd-hub/dist/world-mount.js +67 -0
- package/superd-hub/lib/client/index.js +1010 -345
- package/superd-hub/package.json +11 -2
|
@@ -10,16 +10,10 @@
|
|
|
10
10
|
* (before any step) — so every bridge-written log violated one rule or the
|
|
11
11
|
* other and became unresumable across restarts.
|
|
12
12
|
*
|
|
13
|
-
* The
|
|
14
|
-
*
|
|
15
|
-
* and
|
|
16
|
-
*
|
|
17
|
-
* a one-line wrap:
|
|
18
|
-
*
|
|
19
|
-
* this.session = withSystemHead(session, () => createSystemMessage(""))
|
|
20
|
-
*
|
|
21
|
-
* The wrap is a transparent Proxy that tracks the open turn/step (exactly as
|
|
22
|
-
* the v4 reader does) and intervenes minimally:
|
|
13
|
+
* The wrap installs the co-writer as OWN PROPERTIES on the session object
|
|
14
|
+
* itself (an `append` own-property shadow over the prototype method, plus
|
|
15
|
+
* `stampSystemPrompt`) and tracks the open turn/step (exactly as the v4
|
|
16
|
+
* reader does), intervening minimally:
|
|
23
17
|
*
|
|
24
18
|
* - the FIRST `user/message` append on a still-headless, still-empty
|
|
25
19
|
* surface first opens the turn's next step (when a turn is open but no
|
|
@@ -35,6 +29,18 @@
|
|
|
35
29
|
* queued and flushed inside the next step the adapter opens;
|
|
36
30
|
* - everything else delegates unchanged.
|
|
37
31
|
*
|
|
32
|
+
* IDENTITY IS THE CONTRACT (2026-09-28, D1): the wrap must return the session
|
|
33
|
+
* object ITSELF, never a wrapper. Upstream identity-checks live sessions by
|
|
34
|
+
* object equality — `session-title`'s `rename()` refuses unless
|
|
35
|
+
* `ctx.sessions.get(session.id) === session` (session-title/src/index.ts),
|
|
36
|
+
* and adapters register the RAW prepared session with `sessions.enter()` /
|
|
37
|
+
* `announce()` (e.g. agent-pi/src/index.ts). An earlier revision returned a
|
|
38
|
+
* transparent `Proxy`; every world-context rename then failed with
|
|
39
|
+
* `session "<id>" is not live in this store` because the Agent handle's
|
|
40
|
+
* `session` (the Proxy) was never the store-registered object. Returning the
|
|
41
|
+
* same object keeps `agent.session === ctx.sessions.get(id)` true, so the
|
|
42
|
+
* whole upstream session plane (rename included) sees one identity.
|
|
43
|
+
*
|
|
38
44
|
* A surface that already starts with a user message and has no head (legacy
|
|
39
45
|
* logs) stays headless — valid — and is never stamped: appending a head
|
|
40
46
|
* there is exactly the corruption this module exists to prevent.
|
|
@@ -59,14 +65,22 @@ function surfaceIsEmpty(events) {
|
|
|
59
65
|
* @param session - the adapter's real Session.
|
|
60
66
|
* @param placeholder - builds the placeholder head message when the first
|
|
61
67
|
* user message arrives on an empty surface.
|
|
62
|
-
* @returns the session
|
|
68
|
+
* @returns the SAME session object with the co-writer installed as own
|
|
69
|
+
* properties (`append` shadow + `stampSystemPrompt`). Identity is the
|
|
70
|
+
* contract (D1): upstream liveness checks compare
|
|
71
|
+
* `ctx.sessions.get(id) === agent.session`, so the returned object must be
|
|
72
|
+
* the one registered with `sessions.enter()` — never a wrapper.
|
|
63
73
|
*/
|
|
64
74
|
export function withSystemHead(session, placeholder) {
|
|
75
|
+
// Idempotent: a session already carrying the co-writer is returned as-is.
|
|
76
|
+
if (Object.prototype.hasOwnProperty.call(session, 'stampSystemPrompt'))
|
|
77
|
+
return session;
|
|
65
78
|
// The one narrow this module performs: the loose face above is what makes
|
|
66
79
|
// the generic real Session assignable; every call below issues exactly the
|
|
67
80
|
// SystemHeadAppend shape.
|
|
68
81
|
const appendHead = session.append.bind(session);
|
|
69
82
|
const rawAppend = session.append.bind(session);
|
|
83
|
+
const rawAppendFull = session.append.bind(session);
|
|
70
84
|
// Reader-mirrored turn/step state.
|
|
71
85
|
let turn = null;
|
|
72
86
|
let step = null;
|
|
@@ -115,80 +129,82 @@ export function withSystemHead(session, placeholder) {
|
|
|
115
129
|
}
|
|
116
130
|
headSeq = appendHead('system/message', { turn: turn ?? turnArg, step: step ?? stepArg, message }, { surfaceOp: { op: 'replace', startSeq: headSeq, endSeq: headSeq }, sourceEventSeqs: [headSeq] }).seq;
|
|
117
131
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
132
|
+
const interceptAppend = (type, data, opts) => {
|
|
133
|
+
if (type === 'turn/start') {
|
|
134
|
+
turn = data.turn;
|
|
135
|
+
nextStep = 1;
|
|
136
|
+
wrapOpenedStep = false;
|
|
137
|
+
wrapClosedStep = undefined;
|
|
138
|
+
}
|
|
139
|
+
else if (type === 'turn/end') {
|
|
140
|
+
// A step THIS wrap opened must not survive the turn boundary.
|
|
141
|
+
if (step !== null && wrapOpenedStep) {
|
|
142
|
+
rawAppend('step/end', { turn, step });
|
|
143
|
+
wrapClosedStep = step;
|
|
144
|
+
step = null;
|
|
145
|
+
nextStep += 1;
|
|
146
|
+
}
|
|
147
|
+
turn = null;
|
|
148
|
+
}
|
|
149
|
+
else if (type === 'step/start') {
|
|
150
|
+
const dataStep = data;
|
|
151
|
+
if (step !== null && wrapOpenedStep && dataStep.turn === turn && dataStep.step === step) {
|
|
152
|
+
// The adapter opened the step the wrap already wrote: drop the
|
|
153
|
+
// duplicate (the adapter's own counters stay consistent).
|
|
154
|
+
return { type, seq: session.snapshotEvents().length, time: Date.now(), data };
|
|
155
|
+
}
|
|
156
|
+
if (step === null && dataStep.step !== undefined)
|
|
157
|
+
step = dataStep.step;
|
|
158
|
+
wrapOpenedStep = false;
|
|
159
|
+
const applied = rawAppendFull(type, data);
|
|
160
|
+
if (queuedStamp !== undefined && step !== null) {
|
|
161
|
+
const pending = queuedStamp;
|
|
162
|
+
queuedStamp = undefined;
|
|
163
|
+
stamp(pending.turn, pending.step, pending.message);
|
|
122
164
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const applied = rawAppend(type, data);
|
|
152
|
-
if (queuedStamp !== undefined && step !== null) {
|
|
153
|
-
const pending = queuedStamp;
|
|
154
|
-
queuedStamp = undefined;
|
|
155
|
-
stamp(pending.turn, pending.step, pending.message);
|
|
156
|
-
}
|
|
157
|
-
return applied;
|
|
158
|
-
}
|
|
159
|
-
else if (type === 'step/end') {
|
|
160
|
-
const dataStep = data;
|
|
161
|
-
if (step === null && wrapClosedStep !== undefined && dataStep.step === wrapClosedStep) {
|
|
162
|
-
wrapClosedStep = undefined;
|
|
163
|
-
return { type, seq: session.snapshotEvents().length, time: Date.now(), data }; // the wrap already closed it
|
|
164
|
-
}
|
|
165
|
-
step = null;
|
|
166
|
-
if (dataStep.step !== undefined)
|
|
167
|
-
nextStep = dataStep.step + 1;
|
|
168
|
-
}
|
|
169
|
-
else if (type === 'user/message') {
|
|
170
|
-
ensureHead();
|
|
171
|
-
}
|
|
172
|
-
else if (type === 'system/message') {
|
|
173
|
-
// A direct adapter append (notices, bootstraps): give it the step
|
|
174
|
-
// context the reader demands — open the turn's next step when
|
|
175
|
-
// none is open and NORMALIZE the coordinates to that context
|
|
176
|
-
// (requireStep compares them for equality; a mismatched append
|
|
177
|
-
// is doomed otherwise). Surface ordering beyond the head rules
|
|
178
|
-
// stays the adapter's own responsibility.
|
|
179
|
-
if (step === null && turn !== null)
|
|
180
|
-
openWrapStep();
|
|
181
|
-
if (step !== null && turn !== null) {
|
|
182
|
-
const direct = data;
|
|
183
|
-
if (direct.turn !== turn || direct.step !== step)
|
|
184
|
-
data = { ...data, turn, step };
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return Reflect.apply(target.append, target, [type, data, opts]);
|
|
188
|
-
};
|
|
165
|
+
return applied;
|
|
166
|
+
}
|
|
167
|
+
else if (type === 'step/end') {
|
|
168
|
+
const dataStep = data;
|
|
169
|
+
if (step === null && wrapClosedStep !== undefined && dataStep.step === wrapClosedStep) {
|
|
170
|
+
wrapClosedStep = undefined;
|
|
171
|
+
return { type, seq: session.snapshotEvents().length, time: Date.now(), data }; // the wrap already closed it
|
|
172
|
+
}
|
|
173
|
+
step = null;
|
|
174
|
+
if (dataStep.step !== undefined)
|
|
175
|
+
nextStep = dataStep.step + 1;
|
|
176
|
+
}
|
|
177
|
+
else if (type === 'user/message') {
|
|
178
|
+
ensureHead();
|
|
179
|
+
}
|
|
180
|
+
else if (type === 'system/message') {
|
|
181
|
+
// A direct adapter append (notices, bootstraps): give it the step
|
|
182
|
+
// context the reader demands — open the turn's next step when
|
|
183
|
+
// none is open and NORMALIZE the coordinates to that context
|
|
184
|
+
// (requireStep compares them for equality; a mismatched append
|
|
185
|
+
// is doomed otherwise). Surface ordering beyond the head rules
|
|
186
|
+
// stays the adapter's own responsibility.
|
|
187
|
+
if (step === null && turn !== null)
|
|
188
|
+
openWrapStep();
|
|
189
|
+
if (step !== null && turn !== null) {
|
|
190
|
+
const direct = data;
|
|
191
|
+
if (direct.turn !== turn || direct.step !== step)
|
|
192
|
+
data = { ...data, turn, step };
|
|
189
193
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
}
|
|
195
|
+
return rawAppendFull(type, data, opts);
|
|
196
|
+
};
|
|
197
|
+
// Install the co-writer as OWN PROPERTIES on the session itself. The
|
|
198
|
+
// `append` shadow covers every holder of the object (the adapter's Agent
|
|
199
|
+
// AND upstream services that resolved the session from the store); both
|
|
200
|
+
// properties are non-enumerable so scans/serialization of the session see
|
|
201
|
+
// nothing, and writable/configurable so it stays an ordinary instance.
|
|
202
|
+
Object.defineProperty(session, 'append', {
|
|
203
|
+
value: interceptAppend, writable: true, configurable: true, enumerable: false,
|
|
204
|
+
});
|
|
205
|
+
Object.defineProperty(session, 'stampSystemPrompt', {
|
|
206
|
+
value: (turnArg, stepArg, message) => { stamp(turnArg, stepArg, message); },
|
|
207
|
+
writable: true, configurable: true, enumerable: false,
|
|
193
208
|
});
|
|
209
|
+
return session;
|
|
194
210
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast feedback core (C1 task 4) — the pure, host-half half of the
|
|
3
|
+
* official-primitive toast: the props seam and the module store. The React
|
|
4
|
+
* wrapper (the always-mounted host component + element factory) lives in
|
|
5
|
+
* `src/client/toast.ts`; this split mirrors switch-core (pure logic where
|
|
6
|
+
* tsc emits and node tests import; the DOM/React face is injected by the
|
|
7
|
+
* client lane).
|
|
8
|
+
*
|
|
9
|
+
* The toast copy rides the platform's `Toast` primitive — top-center
|
|
10
|
+
* banner, dark surface in both themes, warn-orange icon seat, green
|
|
11
|
+
* `tone="success"` — rendered by the HOST's React tree through the
|
|
12
|
+
* primitive's own body portal. Failure notices hold ~6 s: the primitive's
|
|
13
|
+
* docblock prescribes longer holds for failures that name what broke.
|
|
14
|
+
*
|
|
15
|
+
* @module superd-hub/toast-core
|
|
16
|
+
*/
|
|
17
|
+
/** Options: the toast tone and hold window. */
|
|
18
|
+
export interface SuperdToastOptions {
|
|
19
|
+
/** `'success'` renders the primitive's green check glyph. */
|
|
20
|
+
tone?: 'success';
|
|
21
|
+
/** Full-opacity hold before the fade; defaults to {@link TOAST_DEFAULT_HOLD_MS}. */
|
|
22
|
+
holdMs?: number;
|
|
23
|
+
}
|
|
24
|
+
/** Failures that name what broke need a longer read than a one-liner. */
|
|
25
|
+
export declare const TOAST_DEFAULT_HOLD_MS = 6000;
|
|
26
|
+
/** One pending toast: a monotonic sequence plus its resolved copy. */
|
|
27
|
+
export interface PendingSuperdToast {
|
|
28
|
+
readonly seq: number;
|
|
29
|
+
readonly text: string;
|
|
30
|
+
readonly options: SuperdToastOptions;
|
|
31
|
+
}
|
|
32
|
+
/** The exact props the official primitive receives (pure — the unit seam). */
|
|
33
|
+
export declare function toastProps(text: string, options?: SuperdToastOptions): {
|
|
34
|
+
text: string;
|
|
35
|
+
tone?: 'success';
|
|
36
|
+
holdMs: number;
|
|
37
|
+
};
|
|
38
|
+
/** Fire one toast (best-effort: without a mounted owner nothing renders). */
|
|
39
|
+
export declare function showSuperdToast(text: string, options?: SuperdToastOptions): void;
|
|
40
|
+
/** Clear a shown toast (the fade's `onDone`); stale sequences are no-ops. */
|
|
41
|
+
export declare function clearSuperdToast(done: number): void;
|
|
42
|
+
/** Subscribe to the store (the host's effect face); returns unsubscribe. */
|
|
43
|
+
export declare function onSuperdToast(fn: (toast: PendingSuperdToast | undefined) => void): () => void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast feedback core (C1 task 4) — the pure, host-half half of the
|
|
3
|
+
* official-primitive toast: the props seam and the module store. The React
|
|
4
|
+
* wrapper (the always-mounted host component + element factory) lives in
|
|
5
|
+
* `src/client/toast.ts`; this split mirrors switch-core (pure logic where
|
|
6
|
+
* tsc emits and node tests import; the DOM/React face is injected by the
|
|
7
|
+
* client lane).
|
|
8
|
+
*
|
|
9
|
+
* The toast copy rides the platform's `Toast` primitive — top-center
|
|
10
|
+
* banner, dark surface in both themes, warn-orange icon seat, green
|
|
11
|
+
* `tone="success"` — rendered by the HOST's React tree through the
|
|
12
|
+
* primitive's own body portal. Failure notices hold ~6 s: the primitive's
|
|
13
|
+
* docblock prescribes longer holds for failures that name what broke.
|
|
14
|
+
*
|
|
15
|
+
* @module superd-hub/toast-core
|
|
16
|
+
*/
|
|
17
|
+
/** Failures that name what broke need a longer read than a one-liner. */
|
|
18
|
+
export const TOAST_DEFAULT_HOLD_MS = 6_000;
|
|
19
|
+
/** The exact props the official primitive receives (pure — the unit seam). */
|
|
20
|
+
export function toastProps(text, options = {}) {
|
|
21
|
+
const props = {
|
|
22
|
+
text,
|
|
23
|
+
holdMs: options.holdMs ?? TOAST_DEFAULT_HOLD_MS,
|
|
24
|
+
};
|
|
25
|
+
if (options.tone !== undefined)
|
|
26
|
+
props.tone = options.tone;
|
|
27
|
+
return props;
|
|
28
|
+
}
|
|
29
|
+
// ---- the module store (last-wins; transient notices never queue) ----------
|
|
30
|
+
let seq = 0;
|
|
31
|
+
let current;
|
|
32
|
+
const listeners = new Set();
|
|
33
|
+
function emit() {
|
|
34
|
+
for (const fn of [...listeners]) {
|
|
35
|
+
try {
|
|
36
|
+
fn(current);
|
|
37
|
+
}
|
|
38
|
+
catch { /* a broken listener never breaks the store */ }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Fire one toast (best-effort: without a mounted owner nothing renders). */
|
|
42
|
+
export function showSuperdToast(text, options = {}) {
|
|
43
|
+
current = { seq: ++seq, text, options };
|
|
44
|
+
emit();
|
|
45
|
+
}
|
|
46
|
+
/** Clear a shown toast (the fade's `onDone`); stale sequences are no-ops. */
|
|
47
|
+
export function clearSuperdToast(done) {
|
|
48
|
+
if (current === undefined || current.seq !== done)
|
|
49
|
+
return;
|
|
50
|
+
current = undefined;
|
|
51
|
+
emit();
|
|
52
|
+
}
|
|
53
|
+
/** Subscribe to the store (the host's effect face); returns unsubscribe. */
|
|
54
|
+
export function onSuperdToast(fn) {
|
|
55
|
+
listeners.add(fn);
|
|
56
|
+
// Initial push: an owner mounting after a toast fired still shows it
|
|
57
|
+
// (the host's effect subscribes post-mount).
|
|
58
|
+
try {
|
|
59
|
+
fn(current);
|
|
60
|
+
}
|
|
61
|
+
catch { /* a broken listener never breaks the store */ }
|
|
62
|
+
return () => { listeners.delete(fn); };
|
|
63
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session-plane wire vocabulary (mesh P3 Task 1).
|
|
3
|
+
*
|
|
4
|
+
* The hub CALLS the native session-plane RPCs through a GatewayFace
|
|
5
|
+
* (`CarrierGatewayFace.dispatchRpc` / `.openWireStream`, P2 machinery — local
|
|
6
|
+
* in-process or remote wire). These endpoint strings are exactly the ones the
|
|
7
|
+
* official browser UI reaches the Host through: the generated
|
|
8
|
+
* `ctx.remote.session` namespace emits `connection.rpc.call('/api', endpoint,
|
|
9
|
+
* { args }, signal)` with `endpoint = '<namespace>/<method>'`, and the native
|
|
10
|
+
* gateway dispatches that same string.
|
|
11
|
+
*
|
|
12
|
+
* Every constant below is extracted from the upstream checkout
|
|
13
|
+
* (`upstream/deepseek-harness` @ `dsh-v0.1.7-rc.1`, read-only). Each JSDoc
|
|
14
|
+
* block carries the primary anchor (the `@Remote` declaration on the Host
|
|
15
|
+
* controller) plus the payload-type anchor. Missing methods are `undefined`
|
|
16
|
+
* with a comment — names are NEVER invented here.
|
|
17
|
+
*
|
|
18
|
+
* Wire-arg convention (how a GatewayFace payload is built):
|
|
19
|
+
* payload = { args: { <parameterWireName>: <value> } }
|
|
20
|
+
* The client gateway builds it at
|
|
21
|
+
* `packages/api/gateway/src/client/index.ts:445` (`{ args: prepared.args }`,
|
|
22
|
+
* with `args[parameter.wire] = value` at :525); the Host gateway unpacks it at
|
|
23
|
+
* `packages/api/gateway/src/index.ts:692–704` (`assertExactArguments` +
|
|
24
|
+
* `resolveParameter` per declared parameter). For every session-plane method
|
|
25
|
+
* the single business parameter is named `request` — EXCEPT `session/list`,
|
|
26
|
+
* whose parameter is declared `_request` (the controller ignores it), so its
|
|
27
|
+
* args key is `_request`. The trailing `signal` parameter never travels in
|
|
28
|
+
* `args` (it is carried by the envelope/stream carrier, not the payload).
|
|
29
|
+
*
|
|
30
|
+
* Namespace binding: `super(ctx, 'sessionController', { namespace: 'session' })`
|
|
31
|
+
* — packages/api/session-controller/src/index.ts:136 (Cordis service key
|
|
32
|
+
* `sessionController`, wire namespace `session`).
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* `session/list` — cold Session list (the sidebar's session rows).
|
|
36
|
+
*
|
|
37
|
+
* Upstream anchors:
|
|
38
|
+
* - `@Remote('list')`: packages/api/session-controller/src/index.ts:251
|
|
39
|
+
* (method `list(_request: SessionListRequest, signal)` at :252)
|
|
40
|
+
* - payload type: packages/api/session-controller/src/types.ts:262
|
|
41
|
+
* (`SessionListRequest`), value at :267 (`SessionListValue`)
|
|
42
|
+
* - generated client string: packages/api/session-controller/lib/typert.remote-client.d.ts:47
|
|
43
|
+
* - wire-arg key quirk: `_request` (declared name, ignored by the Host) —
|
|
44
|
+
* typert.remote-client.js `session/list` descriptor, parameter wire `_request`
|
|
45
|
+
*
|
|
46
|
+
* Wire payload: `{ args: { _request: SessionListRequestMirror } }`.
|
|
47
|
+
*/
|
|
48
|
+
export declare const WIRE_SESSION_LIST = "session/list";
|
|
49
|
+
/**
|
|
50
|
+
* `session/create` — create a Session (or adopt an explicit id).
|
|
51
|
+
*
|
|
52
|
+
* Upstream anchors:
|
|
53
|
+
* - `@Remote('create')`: packages/api/session-controller/src/index.ts:272
|
|
54
|
+
* (method `create(request: SessionCreateRequest)` at :273)
|
|
55
|
+
* - payload type: packages/api/session-controller/src/types.ts:283
|
|
56
|
+
* (`SessionCreateRequest`), value at :291 (`SessionCreateValue`)
|
|
57
|
+
* - generated client string: .../typert.remote-client.d.ts:44
|
|
58
|
+
*
|
|
59
|
+
* Wire payload: `{ args: { request: SessionCreateRequestMirror } }`.
|
|
60
|
+
*/
|
|
61
|
+
export declare const WIRE_SESSION_CREATE = "session/create";
|
|
62
|
+
/**
|
|
63
|
+
* `session/rename` — set a Session's title (the dedicated title-set RPC).
|
|
64
|
+
*
|
|
65
|
+
* Upstream anchors:
|
|
66
|
+
* - `@Remote('rename')`: packages/api/session-controller/src/index.ts:384
|
|
67
|
+
* (method `rename(request: SessionRenameRequest)` at :385)
|
|
68
|
+
* - payload type: packages/api/session-controller/src/types.ts:307
|
|
69
|
+
* (`SessionRenameRequest`), value at :313 (`SessionRenameValue`)
|
|
70
|
+
* - generated client string: .../typert.remote-client.d.ts:53
|
|
71
|
+
* - invalid title → typed error `session/title-invalid`
|
|
72
|
+
* (types.ts:223, thrown at commands.ts:204)
|
|
73
|
+
*
|
|
74
|
+
* Wire payload: `{ args: { request: SessionRenameRequestMirror } }`.
|
|
75
|
+
*/
|
|
76
|
+
export declare const WIRE_SESSION_TITLE = "session/rename";
|
|
77
|
+
/**
|
|
78
|
+
* `session/prompt` — submit one user turn into a Session.
|
|
79
|
+
*
|
|
80
|
+
* Upstream anchors:
|
|
81
|
+
* - `@Remote('prompt')`: packages/api/session-controller/src/index.ts:407
|
|
82
|
+
* (method `prompt(request: SessionPromptRequest, signal)` at :408)
|
|
83
|
+
* - payload type: packages/api/session-controller/src/types.ts:331
|
|
84
|
+
* (`SessionPromptRequest`), value at :342 (`SessionPromptValue`)
|
|
85
|
+
* - generated client string: .../typert.remote-client.d.ts:52
|
|
86
|
+
* - typed rejections: `session/agent-busy` / `session/attachment-invalid` /
|
|
87
|
+
* `session/not-found` (commands.ts:366–398)
|
|
88
|
+
*
|
|
89
|
+
* Wire payload: `{ args: { request: SessionPromptRequestMirror } }`.
|
|
90
|
+
*/
|
|
91
|
+
export declare const WIRE_PROMPT_SUBMIT = "session/prompt";
|
|
92
|
+
/**
|
|
93
|
+
* `session/follow` — open the event/log stream the UI renders (logical stream).
|
|
94
|
+
*
|
|
95
|
+
* Upstream anchors:
|
|
96
|
+
* - `@Remote({ mode: 'stream' })`: packages/api/session-controller/src/index.ts:461
|
|
97
|
+
* (method `follow(request: SessionFollowRequest, signal): AsyncIterable<SessionFollowFrame>` at :462)
|
|
98
|
+
* - payload type: packages/api/session-controller/src/types.ts:485
|
|
99
|
+
* (`SessionFollowRequest`), frame union at :550 (`SessionFollowFrame`)
|
|
100
|
+
* - generated client string: .../typert.remote-client.d.ts:45
|
|
101
|
+
* - UI consumption: packages/api/session-controller/src/client/transport.ts:172
|
|
102
|
+
* (`SessionEventStream.follow` → `remote.session.follow({ address, assistantStream: true, ... })`)
|
|
103
|
+
*
|
|
104
|
+
* Wire payload: `{ args: { request: SessionFollowRequestMirror } }`, opened
|
|
105
|
+
* via `openWireStream` (not `dispatchRpc`). The opening frame is
|
|
106
|
+
* `{ type: 'snapshot', header, cursor, records, hasMore, projections }`; then
|
|
107
|
+
* ordered `{ type: 'event', event }` entries.
|
|
108
|
+
*/
|
|
109
|
+
export declare const WIRE_STREAM_OPEN = "session/follow";
|
|
110
|
+
/**
|
|
111
|
+
* `session/cancel` — cancel/interrupt the active Agent turn.
|
|
112
|
+
*
|
|
113
|
+
* Upstream anchors:
|
|
114
|
+
* - `@Remote('cancel')`: packages/api/session-controller/src/index.ts:438
|
|
115
|
+
* (method `cancel(request: SessionCancelRequest)` at :439)
|
|
116
|
+
* - payload type: packages/api/session-controller/src/types.ts:371
|
|
117
|
+
* (`SessionCancelRequest`), value at :376 (`SessionCancelValue`)
|
|
118
|
+
* - generated client string: .../typert.remote-client.d.ts:41
|
|
119
|
+
*
|
|
120
|
+
* Wire payload: `{ args: { request: SessionCancelRequestMirror } }`.
|
|
121
|
+
*/
|
|
122
|
+
export declare const WIRE_TURN_CANCEL = "session/cancel";
|
|
123
|
+
/**
|
|
124
|
+
* `session/close` / session delete — DOES NOT EXIST upstream.
|
|
125
|
+
*
|
|
126
|
+
* The session namespace (packages/api/session-controller/src/index.ts:251–501,
|
|
127
|
+
* complete `@Remote` set: list, search, create, selectModel, modelCatalog,
|
|
128
|
+
* canOpenWorkspacePath, openWorkspacePath, workspacePathApplications, rename,
|
|
129
|
+
* fork, prompt, attachment, updateQueue, cancel, page, follow, projections,
|
|
130
|
+
* control) has no close/dispose/delete/archive method. Session lifetime is
|
|
131
|
+
* Host-owned (Agent lifecycle + `session/disposed` events); the browser never
|
|
132
|
+
* closes a session over the wire. The nearest upstream analogues live on a
|
|
133
|
+
* DIFFERENT namespace (workspace, not session-plane): `workspace/archiveSession`
|
|
134
|
+
* (packages/api/workspace-controller/src/index.ts:159) and
|
|
135
|
+
* `workspace/unarchiveSession` (:169). Kept `undefined` per the no-invention
|
|
136
|
+
* rule; Task 2 must not route a close through the session plane.
|
|
137
|
+
*/
|
|
138
|
+
export declare const WIRE_SESSION_CLOSE: undefined;
|
|
139
|
+
/**
|
|
140
|
+
* The session-plane endpoint vocabulary (mesh P3 Task 1 deliverable).
|
|
141
|
+
* Undefined keys = no upstream counterpart (see the constant's JSDoc).
|
|
142
|
+
*/
|
|
143
|
+
export declare const WIRE: {
|
|
144
|
+
readonly sessionList: "session/list";
|
|
145
|
+
readonly sessionCreate: "session/create";
|
|
146
|
+
readonly sessionTitle: "session/rename";
|
|
147
|
+
readonly promptSubmit: "session/prompt";
|
|
148
|
+
readonly streamOpen: "session/follow";
|
|
149
|
+
readonly turnCancel: "session/cancel";
|
|
150
|
+
readonly sessionClose: undefined;
|
|
151
|
+
};
|
|
152
|
+
/** Opaque branded string ids on the wire are plain JSON strings here. */
|
|
153
|
+
export type SessionIdMirror = string;
|
|
154
|
+
/** Client-minted prompt identity (`Branded<'session-request-id'>` upstream). */
|
|
155
|
+
export type SessionRequestIdMirror = string;
|
|
156
|
+
/**
|
|
157
|
+
* MIRROR of upstream `SessionListRequest`
|
|
158
|
+
* (packages/api/session-controller/src/types.ts:262). Reference data for the
|
|
159
|
+
* wire caller — not an owned contract.
|
|
160
|
+
*/
|
|
161
|
+
export interface SessionListRequestMirror {
|
|
162
|
+
readonly cursor?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* MIRROR of upstream `SessionCreateRequest` (types.ts:283). `workspaceId` +
|
|
166
|
+
* `cwd` name the workspace (cwd alone is accepted), `sessionId` adopts an
|
|
167
|
+
* explicit id, `agentPreset` selects the composition.
|
|
168
|
+
*/
|
|
169
|
+
export interface SessionCreateRequestMirror {
|
|
170
|
+
readonly workspaceId?: SessionIdMirror;
|
|
171
|
+
readonly cwd?: string;
|
|
172
|
+
readonly sessionId?: SessionIdMirror;
|
|
173
|
+
readonly agentPreset?: string;
|
|
174
|
+
}
|
|
175
|
+
/** MIRROR of upstream `SessionRenameRequest` (types.ts:307). */
|
|
176
|
+
export interface SessionRenameRequestMirror {
|
|
177
|
+
readonly sessionId: SessionIdMirror;
|
|
178
|
+
readonly title: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* MIRROR of upstream `PromptContentPart` (types.ts:89): browser-submitted
|
|
182
|
+
* prompt content; the Host promotes image bytes to durable references.
|
|
183
|
+
*/
|
|
184
|
+
export type PromptContentPartMirror = {
|
|
185
|
+
readonly type: 'text';
|
|
186
|
+
readonly text: string;
|
|
187
|
+
} | {
|
|
188
|
+
readonly type: 'image';
|
|
189
|
+
readonly mediaType: string;
|
|
190
|
+
readonly data: string;
|
|
191
|
+
readonly name?: string;
|
|
192
|
+
} | {
|
|
193
|
+
readonly type: 'file';
|
|
194
|
+
readonly receiptId: string;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* MIRROR of upstream `SessionPromptRequest` (types.ts:331). `mode` picks
|
|
198
|
+
* delivery: `'queue'` waits for the live turn, `'steer'` steers it.
|
|
199
|
+
*/
|
|
200
|
+
export interface SessionPromptRequestMirror {
|
|
201
|
+
readonly requestId: SessionRequestIdMirror;
|
|
202
|
+
readonly sessionId: SessionIdMirror;
|
|
203
|
+
readonly mode: 'queue' | 'steer';
|
|
204
|
+
readonly content: readonly PromptContentPartMirror[];
|
|
205
|
+
readonly clientTimeZone?: string;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* MIRROR of upstream `SessionAddress` (types.ts:406): one ordinary Session or
|
|
209
|
+
* one direct subagent child.
|
|
210
|
+
*/
|
|
211
|
+
export type SessionAddressMirror = {
|
|
212
|
+
readonly kind: 'session';
|
|
213
|
+
readonly sessionId: SessionIdMirror;
|
|
214
|
+
} | {
|
|
215
|
+
readonly kind: 'subagent';
|
|
216
|
+
readonly parentSessionId: SessionIdMirror;
|
|
217
|
+
readonly childSessionId: SessionIdMirror;
|
|
218
|
+
readonly mode: 'one-shot' | 'continuable' | 'unknown';
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* MIRROR of upstream `SessionFollowRequest` (types.ts:485; page-budget fields
|
|
222
|
+
* from `SessionPageRequest` at :469–482). The UI always passes
|
|
223
|
+
* `assistantStream: true` (transport.ts:172–175) to opt into live
|
|
224
|
+
* assistant-stream frames.
|
|
225
|
+
*/
|
|
226
|
+
export interface SessionFollowRequestMirror {
|
|
227
|
+
readonly address: SessionAddressMirror;
|
|
228
|
+
readonly assistantStream?: true;
|
|
229
|
+
readonly maxMessages?: number;
|
|
230
|
+
readonly turnWindow?: {
|
|
231
|
+
readonly minMessages: number;
|
|
232
|
+
readonly minTurns: number;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/** MIRROR of upstream `SessionCancelRequest` (types.ts:371). */
|
|
236
|
+
export interface SessionCancelRequestMirror {
|
|
237
|
+
readonly sessionId: SessionIdMirror;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Wire-arg wrapper keys per endpoint, as the native gateway's
|
|
241
|
+
* `assertExactArguments`/`resolveParameter` expects them
|
|
242
|
+
* (packages/api/gateway/src/index.ts:692–704; client builds
|
|
243
|
+
* `{ args: { [parameter.wire]: value } }` at api/gateway/src/client/index.ts:525).
|
|
244
|
+
* `session/list` alone uses `_request` (its controller parameter is declared
|
|
245
|
+
* `_request` and ignored).
|
|
246
|
+
*/
|
|
247
|
+
export declare const WIRE_ARGS: {
|
|
248
|
+
readonly "session/list": "_request";
|
|
249
|
+
readonly "session/create": "request";
|
|
250
|
+
readonly "session/rename": "request";
|
|
251
|
+
readonly "session/prompt": "request";
|
|
252
|
+
readonly "session/follow": "request";
|
|
253
|
+
readonly "session/cancel": "request";
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Build the GatewayFace payload (`{ args: { <key>: value } }`) for one
|
|
257
|
+
* session-plane endpoint.
|
|
258
|
+
* @param endpoint - one of the defined `WIRE` constants.
|
|
259
|
+
* @param value - the mirrored request object for that endpoint.
|
|
260
|
+
* @returns the wire payload accepted by `dispatchRpc`/`openWireStream`.
|
|
261
|
+
*/
|
|
262
|
+
export declare function wireArgsOf(endpoint: string, value: unknown): {
|
|
263
|
+
args: Record<string, unknown>;
|
|
264
|
+
};
|