@dsmm/dsmm 0.3.0 → 0.3.1
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 +26 -40
- package/cordis.patch.yml +0 -13
- package/docs/agent-presets.md +26 -14
- package/docs/compatibility.md +19 -73
- package/docs/deferred-native-approval-risk.md +8 -12
- package/docs/design.md +25 -254
- package/docs/lsp.md +2 -2
- package/docs/migration-from-ocmm.md +38 -51
- package/docs/model-routing.md +21 -21
- package/docs/native-permissions.md +17 -7
- package/docs/profiles.md +13 -9
- package/docs/releasing.md +34 -280
- package/docs/roadmap.md +23 -254
- package/docs/runtime-recovery.md +29 -91
- package/docs/safety-guards.md +19 -16
- package/docs/settings-status.md +23 -11
- package/docs/skill-sync.md +17 -17
- package/docs/web-fetch-fakeip.md +82 -0
- package/lib/child-capture.d.ts +12 -2
- package/lib/child-capture.js +22 -5
- package/lib/client/ChildrenPanel.d.ts +1 -4
- package/lib/client/ChildrenPanel.js +4 -16
- package/lib/client/DeploymentFields.d.ts +28 -0
- package/lib/client/DeploymentFields.js +68 -0
- package/lib/client/DeploymentPage.d.ts +17 -5
- package/lib/client/DeploymentPage.js +79 -112
- package/lib/client/NativeCommandEntries.d.ts +17 -0
- package/lib/client/NativeCommandEntries.js +68 -0
- package/lib/client/PermissionsPanel.d.ts +1 -1
- package/lib/client/PermissionsPanel.js +8 -8
- package/lib/client/ProfilesSection.js +7 -5
- package/lib/client/RoleToolView-data.d.ts +35 -0
- package/lib/client/RoleToolView-data.js +52 -0
- package/lib/client/RoleToolView-locales.d.ts +36 -0
- package/lib/client/RoleToolView-locales.js +20 -0
- package/lib/client/RoleToolView.d.ts +10 -0
- package/lib/client/RoleToolView.js +47 -0
- package/lib/client/SessionProfiles.js +39 -15
- package/lib/client/children-controller.d.ts +2 -8
- package/lib/client/children-controller.js +1 -26
- package/lib/client/children-locales.d.ts +27 -52
- package/lib/client/children-locales.js +8 -12
- package/lib/client/configuration-display.d.ts +5 -0
- package/lib/client/configuration-display.js +11 -0
- package/lib/client/controller.d.ts +1 -0
- package/lib/client/controller.js +20 -13
- package/lib/client/deployment-controller.d.ts +13 -1
- package/lib/client/deployment-controller.js +84 -24
- package/lib/client/deployment-data.d.ts +1 -0
- package/lib/client/deployment-data.js +4 -1
- package/lib/client/deployment-locales.d.ts +43 -0
- package/lib/client/deployment-locales.js +35 -9
- package/lib/client/deployment-modules.d.ts +9 -0
- package/lib/client/deployment-modules.js +24 -0
- package/lib/client/deployment-workspace.d.ts +48 -0
- package/lib/client/deployment-workspace.js +123 -0
- package/lib/client/index.js +11 -74
- package/lib/client/locales.d.ts +7 -0
- package/lib/client/locales.js +12 -6
- package/lib/client/permission-controller.d.ts +1 -0
- package/lib/client/permission-controller.js +3 -2
- package/lib/client/permission-locales.d.ts +25 -0
- package/lib/client/permission-locales.js +24 -4
- package/lib/client/session-labels.js +4 -3
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +9 -8
- package/lib/client.js +2713 -2361
- package/lib/commands.js +2 -0
- package/lib/config-file-store.d.ts +3 -0
- package/lib/config-file-store.js +4 -2
- package/lib/config-revision.d.ts +5 -0
- package/lib/config-revision.js +11 -0
- package/lib/core-permission-authority.js +11 -41
- package/lib/deployment-config.d.ts +9 -2
- package/lib/deployment-config.js +35 -8
- package/lib/deployment-permission-rules.js +19 -7
- package/lib/dsh-types.d.ts +1 -1
- package/lib/host-llm-startup.js +3 -3
- package/lib/host-llm.d.ts +9 -3
- package/lib/host-llm.js +48 -8
- package/lib/index.d.ts +16 -20
- package/lib/index.js +130 -416
- package/lib/lifetime.d.ts +4 -0
- package/lib/lifetime.js +22 -0
- package/lib/live-pi-ai-owner.d.ts +1 -0
- package/lib/live-pi-ai-owner.js +8 -4
- package/lib/mode.d.ts +3 -2
- package/lib/mode.js +28 -41
- package/lib/model-routing.d.ts +2 -8
- package/lib/model-routing.js +59 -175
- package/lib/native-admission.d.ts +56 -0
- package/lib/native-admission.js +313 -0
- package/lib/native-pi-ai-wire.d.ts +3 -1
- package/lib/native-pi-ai-wire.js +47 -13
- package/lib/permission-control.d.ts +0 -3
- package/lib/preset-registry.js +3 -2
- package/lib/preset-skills.d.ts +3 -12
- package/lib/preset-skills.js +28 -58
- package/lib/profile-diagnostics.d.ts +1 -1
- package/lib/profile-diagnostics.js +2 -2
- package/lib/profile-remote.js +61 -22
- package/lib/profile-rpc.d.ts +4 -3
- package/lib/profile-rpc.js +33 -37
- package/lib/profile-runtime.d.ts +31 -74
- package/lib/profile-runtime.js +224 -639
- package/lib/profile-store.d.ts +18 -6
- package/lib/profile-store.js +104 -62
- package/lib/profile-types.d.ts +18 -4
- package/lib/profiles.d.ts +3 -1
- package/lib/profiles.js +9 -7
- package/lib/prompt-content.d.ts +1 -0
- package/lib/prompt-content.js +4 -1
- package/lib/prompts.d.ts +2 -12
- package/lib/prompts.js +11 -66
- package/lib/role-control-remote.d.ts +1 -4
- package/lib/role-control-remote.js +8 -36
- package/lib/role-control-rpc.d.ts +10 -36
- package/lib/role-control-rpc.js +112 -269
- package/lib/role-control-types.d.ts +3 -26
- package/lib/role-control-types.js +3 -4
- package/lib/role-identity.d.ts +5 -0
- package/lib/role-identity.js +10 -0
- package/lib/role-invocation.d.ts +2 -2
- package/lib/role-llm-runtime.js +5 -11
- package/lib/role-policy.d.ts +19 -50
- package/lib/role-policy.js +136 -508
- package/lib/role-providers.d.ts +5 -8
- package/lib/role-providers.js +20 -86
- package/lib/role-routing.d.ts +1 -3
- package/lib/role-routing.js +24 -34
- package/lib/role-subagents.d.ts +5 -14
- package/lib/role-subagents.js +148 -106
- package/lib/runtime-integration.d.ts +5 -78
- package/lib/runtime-integration.js +11 -697
- package/lib/session-metadata.d.ts +13 -12
- package/lib/session-metadata.js +6 -31
- package/lib/session-scope.js +2 -1
- package/lib/settings.d.ts +5 -18
- package/lib/settings.js +19 -43
- package/lib/state.d.ts +3 -2
- package/lib/state.js +26 -10
- package/lib/status.d.ts +1 -9
- package/lib/status.js +3 -55
- package/lib/web-fetch-address-policy.d.ts +24 -0
- package/lib/web-fetch-address-policy.js +189 -0
- package/lib/web-fetch-fakeip.d.ts +25 -0
- package/lib/web-fetch-fakeip.js +107 -0
- package/package.json +113 -103
- package/docs/research/deepseek-v4-pro.md +0 -74
- package/docs/research/oh-dsh.md +0 -96
- package/lib/agent-registry.d.ts +0 -36
- package/lib/agent-registry.js +0 -75
- package/lib/child-admission.d.ts +0 -40
- package/lib/child-admission.js +0 -151
- package/lib/delivery-authority.d.ts +0 -83
- package/lib/delivery-authority.js +0 -397
- package/lib/native-child-evidence.d.ts +0 -40
- package/lib/native-child-evidence.js +0 -104
- package/lib/role-runs.d.ts +0 -138
- package/lib/role-runs.js +0 -335
- package/lib/session-persistence.d.ts +0 -36
- package/lib/session-persistence.js +0 -304
- package/lib/subagent-runtime.d.ts +0 -57
- package/lib/subagent-runtime.js +0 -257
- package/prompts/deepseek-flash.md +0 -11
- package/prompts/deepseek-v4-pro.md +0 -14
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
import { symbols } from "@deepseek-ai/cordis";
|
|
2
|
-
import { SubagentError } from "@deepseek-ai/dsh-subagent";
|
|
3
|
-
import { currentManagedCreation, exactRegistry } from "./agent-registry.js";
|
|
4
|
-
function original(value) {
|
|
5
|
-
return Reflect.get(value, symbols.original) ?? value;
|
|
6
|
-
}
|
|
7
|
-
function unauthorized() {
|
|
8
|
-
throw new SubagentError("DSMM delivery requires current exact direct-parent authority.", "UNAUTHORIZED");
|
|
9
|
-
}
|
|
10
|
-
/** Public plugin/status dispatch precedes async cleanup, including ancestor Host teardown. */
|
|
11
|
-
export function scopeLifetime(scope, label, revoke, install = () => { }) {
|
|
12
|
-
// Cordis's public ambient const enum has no JavaScript export for source-only Node loading.
|
|
13
|
-
const unloading = 5, disposed = 4;
|
|
14
|
-
return scope.effect(() => {
|
|
15
|
-
// Context.fiber can be a facade; its public readonly ctx identifies the exact owner.
|
|
16
|
-
const owners = new Map();
|
|
17
|
-
for (let fiber = scope.fiber; !owners.has(fiber.ctx); fiber = fiber.parent.fiber)
|
|
18
|
-
owners.set(fiber.ctx, fiber);
|
|
19
|
-
let retired = false;
|
|
20
|
-
let detachPlugin = () => { }, detachStatus = () => { };
|
|
21
|
-
const retire = () => { retired = true; revoke(); };
|
|
22
|
-
const cleanup = () => { detachPlugin(); detachStatus(); retire(); };
|
|
23
|
-
try {
|
|
24
|
-
detachPlugin = scope.on("internal/plugin", (fiber) => {
|
|
25
|
-
if (owners.has(fiber.ctx) && fiber.uid === null)
|
|
26
|
-
retire();
|
|
27
|
-
}, { global: true, prepend: true });
|
|
28
|
-
detachStatus = scope.on("internal/status", (fiber) => {
|
|
29
|
-
if (owners.has(fiber.ctx) && (fiber.state === unloading || fiber.state === disposed))
|
|
30
|
-
retire();
|
|
31
|
-
}, { global: true, prepend: true });
|
|
32
|
-
if ([...owners.values()].some((fiber) => fiber.uid === null || fiber.state === unloading || fiber.state === disposed))
|
|
33
|
-
unauthorized();
|
|
34
|
-
install();
|
|
35
|
-
if (retired)
|
|
36
|
-
unauthorized();
|
|
37
|
-
return cleanup;
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
cleanup();
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
}, label);
|
|
44
|
-
}
|
|
45
|
-
/** Stable Host lifetime; profile entry disposal must not replace this object. */
|
|
46
|
-
export class DsmmDeliveryAuthority {
|
|
47
|
-
ctx;
|
|
48
|
-
lifetime = new AbortController();
|
|
49
|
-
parents = new Map();
|
|
50
|
-
tickets = new WeakMap();
|
|
51
|
-
managedIds = new Set();
|
|
52
|
-
managed = new WeakMap();
|
|
53
|
-
liveManaged = new Set();
|
|
54
|
-
retiredAgents = new WeakSet();
|
|
55
|
-
binding;
|
|
56
|
-
connection;
|
|
57
|
-
providersReady;
|
|
58
|
-
changed;
|
|
59
|
-
hostClassifier;
|
|
60
|
-
constructor(ctx, providersReady = () => true, changed = () => { }, hostClassifier) {
|
|
61
|
-
this.ctx = ctx;
|
|
62
|
-
this.providersReady = providersReady;
|
|
63
|
-
this.changed = changed;
|
|
64
|
-
this.hostClassifier = hostClassifier;
|
|
65
|
-
scopeLifetime(ctx, "dsmm.deliveryAuthority: revoke Host tickets", () => {
|
|
66
|
-
this.lifetime.abort();
|
|
67
|
-
for (const parent of this.liveManaged)
|
|
68
|
-
this.revokeParent(parent, "host-disposed");
|
|
69
|
-
for (const parent of this.parents.keys())
|
|
70
|
-
this.revokeParent(parent, "host-disposed");
|
|
71
|
-
this.changed();
|
|
72
|
-
});
|
|
73
|
-
ctx.on("agent/disposed", ({ agent }) => this.revokeParent(agent, "registry-residency-disposed"), { global: true });
|
|
74
|
-
ctx.on("agent/created", ({ agent, signal }) => {
|
|
75
|
-
const retire = () => this.revokeParent(agent, "agent-lifecycle-ended");
|
|
76
|
-
signal?.addEventListener("abort", retire, { once: true });
|
|
77
|
-
if (signal?.aborted)
|
|
78
|
-
retire();
|
|
79
|
-
const operation = currentManagedCreation();
|
|
80
|
-
if (operation === undefined || !operation.claimed || operation.childId !== agent.id
|
|
81
|
-
|| operation.registry !== exactRegistry(ctx.agents) || !ctx.agents.isOwnedBy(agent.id, operation.parent))
|
|
82
|
-
return;
|
|
83
|
-
if (operation.child !== agent || operation.retired)
|
|
84
|
-
unauthorized();
|
|
85
|
-
if (signal?.aborted || operation.ownerSignal?.aborted)
|
|
86
|
-
retire();
|
|
87
|
-
}, { global: true, prepend: true });
|
|
88
|
-
ctx.inject(["connection"], (connectionCtx) => {
|
|
89
|
-
const connection = connectionCtx.get("connection");
|
|
90
|
-
const state = { owner: original(connection), browserPeer: connection.browserPeer, controller: new AbortController() };
|
|
91
|
-
const revoke = () => {
|
|
92
|
-
state.controller.abort();
|
|
93
|
-
if (this.connection === state)
|
|
94
|
-
this.connection = undefined;
|
|
95
|
-
};
|
|
96
|
-
connection.browserPeer.signal.addEventListener("abort", revoke, { once: true });
|
|
97
|
-
// Browser peer scope ancestry includes the exact providing Connection fiber.
|
|
98
|
-
const detachPeer = scopeLifetime(connection.browserPeer.ctx, "dsmm.deliveryAuthority: revoke browser and Connection lifetime", revoke);
|
|
99
|
-
scopeLifetime(connectionCtx, "dsmm.deliveryAuthority: release Connection observer", () => { revoke(); connection.browserPeer.signal.removeEventListener("abort", revoke); detachPeer(); }, () => {
|
|
100
|
-
if (state.controller.signal.aborted || connection.browserPeer.signal.aborted)
|
|
101
|
-
unauthorized();
|
|
102
|
-
this.connection = state;
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
view() {
|
|
107
|
-
const ready = !this.lifetime.signal.aborted && this.binding?.enabled === true && this.providersReady();
|
|
108
|
-
return { binding: "dsmm", deliveryFenceReady: ready, restartRequired: false,
|
|
109
|
-
...(ready ? {} : { reason: "authority-not-ready" }) };
|
|
110
|
-
}
|
|
111
|
-
/** Bind once per entry scope; teardown revokes its pending tickets synchronously. */
|
|
112
|
-
bindPolicy(scope, owner, policy) {
|
|
113
|
-
if (this.lifetime.signal.aborted || this.binding !== undefined)
|
|
114
|
-
unauthorized();
|
|
115
|
-
const binding = { owner, policy, enabled: false };
|
|
116
|
-
return scopeLifetime(scope, "dsmm.deliveryAuthority: release policy owner", () => {
|
|
117
|
-
if (this.binding !== binding)
|
|
118
|
-
return;
|
|
119
|
-
this.binding = undefined;
|
|
120
|
-
this.revokeOwner(owner, "policy-owner-disposed");
|
|
121
|
-
this.changed();
|
|
122
|
-
}, () => {
|
|
123
|
-
this.binding = binding;
|
|
124
|
-
this.changed();
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
/** Called after A/B admission/capture guards are installed, not at service mount. */
|
|
128
|
-
enablePolicy(owner) {
|
|
129
|
-
if (this.binding?.owner !== owner || this.lifetime.signal.aborted)
|
|
130
|
-
unauthorized();
|
|
131
|
-
this.binding.enabled = true;
|
|
132
|
-
this.changed();
|
|
133
|
-
}
|
|
134
|
-
isManaged(parent, intent = "delivery") {
|
|
135
|
-
if (this.managed.has(parent))
|
|
136
|
-
return true;
|
|
137
|
-
// An admitted native parent still needs current proof of its delivery target's identity.
|
|
138
|
-
if (intent === "delivery" && this.parents.has(parent))
|
|
139
|
-
return true;
|
|
140
|
-
if (intent === "creation" && parent.session.header.origin !== "subagent" && this.binding?.policy.classifyParent(parent) === "native")
|
|
141
|
-
return false;
|
|
142
|
-
if (this.managedIds.has(parent.id))
|
|
143
|
-
return true;
|
|
144
|
-
// An absent binding is unknown authority, never proof of a native caller.
|
|
145
|
-
const hostKind = this.hostClassifier?.(parent);
|
|
146
|
-
if (hostKind === "dsmm")
|
|
147
|
-
return true;
|
|
148
|
-
const kind = this.binding?.policy.classifyParent(parent) ?? hostKind;
|
|
149
|
-
return kind !== "native";
|
|
150
|
-
}
|
|
151
|
-
registerParent(parent, admission, owner) {
|
|
152
|
-
if (this.retiredAgents.has(parent) || this.binding?.owner !== owner || this.lifetime.signal.aborted
|
|
153
|
-
|| this.ctx.get("agents")?.get(parent.id) !== parent || admission.epoch.length === 0)
|
|
154
|
-
unauthorized();
|
|
155
|
-
const managed = this.managed.get(parent);
|
|
156
|
-
if (managed === undefined && parent.session.header.origin === "subagent")
|
|
157
|
-
unauthorized();
|
|
158
|
-
if (managed?.status === "retired")
|
|
159
|
-
unauthorized();
|
|
160
|
-
if (managed?.status === "pending") {
|
|
161
|
-
if (managed.admission !== undefined && (managed.admission !== admission || managed.owner !== owner))
|
|
162
|
-
unauthorized();
|
|
163
|
-
managed.admission = admission;
|
|
164
|
-
managed.owner = owner;
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const existing = this.parents.get(parent);
|
|
168
|
-
if (existing !== undefined) {
|
|
169
|
-
if (existing.owner !== owner || existing.admission !== admission || existing.publishing)
|
|
170
|
-
unauthorized();
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
// Durable IDs may be reused on cold resume; the former exact Agent cannot retain authority.
|
|
174
|
-
for (const [previous, state] of this.parents) {
|
|
175
|
-
if (previous.id === parent.id)
|
|
176
|
-
this.revokeParent(state.parent, "residency-replaced");
|
|
177
|
-
}
|
|
178
|
-
const state = { parent, owner, admission, epoch: new AbortController(), lifetime: new AbortController(),
|
|
179
|
-
publishing: false, usedEpochs: new Set([admission.epoch]) };
|
|
180
|
-
state.detachResidency = scopeLifetime(parent.ctx, "dsmm.deliveryAuthority: revoke exact Agent residency", () => {
|
|
181
|
-
if (this.parents.get(parent) === state)
|
|
182
|
-
this.revokeParent(parent, "residency-disposed");
|
|
183
|
-
}, () => {
|
|
184
|
-
this.parents.set(parent, state);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
beginPending(operation, agent) {
|
|
188
|
-
if (operation.child !== undefined || operation.retired || this.managed.has(agent) || this.retiredAgents.has(agent))
|
|
189
|
-
unauthorized();
|
|
190
|
-
operation.child = agent;
|
|
191
|
-
let release;
|
|
192
|
-
const ready = new Promise(done => { release = done; });
|
|
193
|
-
this.managed.set(agent, { operation, status: "pending", ready, release });
|
|
194
|
-
this.liveManaged.add(agent);
|
|
195
|
-
this.managedIds.add(operation.parent.id);
|
|
196
|
-
this.managedIds.add(agent.id);
|
|
197
|
-
const retire = () => this.revokeParent(agent, "managed-owner-ended");
|
|
198
|
-
operation.ownerSignal?.addEventListener("abort", retire, { once: true });
|
|
199
|
-
scopeLifetime(agent.ctx, "dsmm.deliveryAuthority: pending residency", retire);
|
|
200
|
-
if (operation.ownerSignal?.aborted || this.lifetime.signal.aborted)
|
|
201
|
-
retire();
|
|
202
|
-
}
|
|
203
|
-
/** Receipt acceptance, not the caller's old operation signal, opens execution. */
|
|
204
|
-
promote(operation) {
|
|
205
|
-
const child = operation.child, managed = child === undefined ? undefined : this.managed.get(child);
|
|
206
|
-
if (child === undefined || managed?.operation !== operation)
|
|
207
|
-
throw new SubagentError("Managed receipt has no exact prepared child", "UNAUTHORIZED");
|
|
208
|
-
if (managed.status !== "pending" || operation.retired || operation.ownerSignal?.aborted)
|
|
209
|
-
throw new SubagentError("Managed receipt residency ended before promotion", "UNAUTHORIZED");
|
|
210
|
-
if (this.ctx.agents.get(child.id) !== child || !this.ctx.agents.isOwnedBy(child.id, operation.parent)
|
|
211
|
-
|| exactRegistry(this.ctx.agents) !== operation.registry)
|
|
212
|
-
throw new SubagentError("Managed receipt registry or ownership changed", "UNAUTHORIZED");
|
|
213
|
-
if (managed.admission === undefined || managed.owner !== operation.owner)
|
|
214
|
-
throw new SubagentError("Managed receipt has no completed capture admission", "UNAUTHORIZED");
|
|
215
|
-
managed.status = "active";
|
|
216
|
-
try {
|
|
217
|
-
this.registerParent(child, managed.admission, managed.owner);
|
|
218
|
-
}
|
|
219
|
-
catch (error) {
|
|
220
|
-
this.revokeParent(child, "promotion-failed");
|
|
221
|
-
throw error;
|
|
222
|
-
}
|
|
223
|
-
managed.release();
|
|
224
|
-
}
|
|
225
|
-
assertSender(parent) {
|
|
226
|
-
if (this.retiredAgents.has(parent))
|
|
227
|
-
unauthorized();
|
|
228
|
-
const state = this.managed.get(parent);
|
|
229
|
-
if (state !== undefined && state.status !== "active")
|
|
230
|
-
unauthorized();
|
|
231
|
-
}
|
|
232
|
-
async waitForPromotion(parent, signal) {
|
|
233
|
-
if (this.retiredAgents.has(parent))
|
|
234
|
-
unauthorized();
|
|
235
|
-
const state = this.managed.get(parent);
|
|
236
|
-
if (state === undefined || state.status === "active")
|
|
237
|
-
return;
|
|
238
|
-
if (state.status === "retired" || signal === undefined)
|
|
239
|
-
unauthorized();
|
|
240
|
-
signal.throwIfAborted();
|
|
241
|
-
await new Promise((resolve, reject) => {
|
|
242
|
-
const abort = () => { signal.removeEventListener("abort", abort); reject(signal.reason); };
|
|
243
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
244
|
-
void state.ready.then(() => { signal.removeEventListener("abort", abort); resolve(); });
|
|
245
|
-
});
|
|
246
|
-
signal.throwIfAborted();
|
|
247
|
-
this.assertSender(parent);
|
|
248
|
-
}
|
|
249
|
-
retireOperation(operation, reason) {
|
|
250
|
-
operation.retired = true;
|
|
251
|
-
if (operation.child !== undefined)
|
|
252
|
-
this.revokeParent(operation.child, reason);
|
|
253
|
-
}
|
|
254
|
-
acquireParentTicket(parent) {
|
|
255
|
-
if (!this.view().deliveryFenceReady)
|
|
256
|
-
unauthorized();
|
|
257
|
-
const state = this.current(parent);
|
|
258
|
-
const ticket = Object.freeze({ parent, owner: state.owner, admission: state.admission, parentEpoch: state.admission.epoch,
|
|
259
|
-
signal: AbortSignal.any([state.epoch.signal, state.lifetime.signal, this.lifetime.signal]) });
|
|
260
|
-
this.tickets.set(ticket, state);
|
|
261
|
-
return ticket;
|
|
262
|
-
}
|
|
263
|
-
assertTicket(ticket) {
|
|
264
|
-
ticket.signal.throwIfAborted();
|
|
265
|
-
if (!this.view().deliveryFenceReady)
|
|
266
|
-
unauthorized();
|
|
267
|
-
const state = this.current(ticket.parent);
|
|
268
|
-
if (this.tickets.get(ticket) !== state || state.owner !== ticket.owner || state.admission !== ticket.admission
|
|
269
|
-
|| state.admission.epoch !== ticket.parentEpoch)
|
|
270
|
-
unauthorized();
|
|
271
|
-
}
|
|
272
|
-
async resolveChildEvidence(ticket, childId, signal) {
|
|
273
|
-
signal.throwIfAborted();
|
|
274
|
-
this.assertTicket(ticket);
|
|
275
|
-
const policy = this.binding.policy;
|
|
276
|
-
const evidence = await policy.resolveChildEvidence(ticket, childId, signal);
|
|
277
|
-
signal.throwIfAborted();
|
|
278
|
-
this.assertTicket(ticket);
|
|
279
|
-
return evidence;
|
|
280
|
-
}
|
|
281
|
-
/** Validate the target and return whether its materialization requires DSMM capture. */
|
|
282
|
-
assertDelivery(ticket, childId, evidence) {
|
|
283
|
-
this.assertTicket(ticket);
|
|
284
|
-
this.binding.policy.assertDelivery(ticket, childId, evidence);
|
|
285
|
-
const managed = this.binding.policy.isNativeEvidence?.(evidence) !== true;
|
|
286
|
-
if (!managed && this.managedIds.has(childId))
|
|
287
|
-
unauthorized();
|
|
288
|
-
this.assertTicket(ticket);
|
|
289
|
-
return managed;
|
|
290
|
-
}
|
|
291
|
-
prepareParentAdmission(parent, expectedEpoch, nextAdmission) {
|
|
292
|
-
if (!this.view().deliveryFenceReady)
|
|
293
|
-
unauthorized();
|
|
294
|
-
const state = this.current(parent);
|
|
295
|
-
if (state.admission.epoch !== expectedEpoch || nextAdmission.epoch.length === 0 || state.usedEpochs.has(nextAdmission.epoch))
|
|
296
|
-
unauthorized();
|
|
297
|
-
state.prepared = { expectedEpoch, expected: state.admission, admission: nextAdmission, controller: new AbortController() };
|
|
298
|
-
}
|
|
299
|
-
/** Core configuration uses the same exact parent state without acquiring delivery capability. */
|
|
300
|
-
assertCoreParentAdmission(parent, owner, expected) {
|
|
301
|
-
const state = this.current(parent);
|
|
302
|
-
if (state.owner !== owner || state.admission !== expected || state.admission.epoch !== expected.epoch
|
|
303
|
-
|| parent.session.header.origin === "subagent" || !this.ctx.agents.roots().includes(parent))
|
|
304
|
-
unauthorized();
|
|
305
|
-
}
|
|
306
|
-
prepareCoreParentAdmission(parent, owner, expected, nextAdmission) {
|
|
307
|
-
this.assertCoreParentAdmission(parent, owner, expected);
|
|
308
|
-
const state = this.current(parent);
|
|
309
|
-
if (nextAdmission.epoch.length === 0 || state.usedEpochs.has(nextAdmission.epoch))
|
|
310
|
-
unauthorized();
|
|
311
|
-
state.prepared = { expectedEpoch: expected.epoch, expected, admission: nextAdmission, controller: new AbortController() };
|
|
312
|
-
}
|
|
313
|
-
/** Trusted successful-commit callback: install MUST be synchronous and nonthrowing. */
|
|
314
|
-
publishParentAdmission(parent, expectedEpoch, nextAdmission, install) {
|
|
315
|
-
const state = this.current(parent);
|
|
316
|
-
const prepared = state.prepared;
|
|
317
|
-
if (state.admission.epoch !== expectedEpoch || prepared?.expectedEpoch !== expectedEpoch || prepared.expected !== state.admission || prepared.admission !== nextAdmission)
|
|
318
|
-
unauthorized();
|
|
319
|
-
const previous = state.epoch;
|
|
320
|
-
state.publishing = true;
|
|
321
|
-
try {
|
|
322
|
-
install();
|
|
323
|
-
state.admission = nextAdmission;
|
|
324
|
-
state.epoch = prepared.controller;
|
|
325
|
-
state.usedEpochs.add(nextAdmission.epoch);
|
|
326
|
-
state.prepared = undefined;
|
|
327
|
-
previous.abort();
|
|
328
|
-
}
|
|
329
|
-
catch (error) {
|
|
330
|
-
this.withdrawParent(parent, "publication-failed");
|
|
331
|
-
throw error;
|
|
332
|
-
}
|
|
333
|
-
finally {
|
|
334
|
-
state.publishing = false;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
revokeParent(parent, _reason) {
|
|
338
|
-
this.retiredAgents.add(parent);
|
|
339
|
-
const managed = this.managed.get(parent);
|
|
340
|
-
if (managed !== undefined) {
|
|
341
|
-
managed.status = "retired";
|
|
342
|
-
managed.operation.retired = true;
|
|
343
|
-
managed.release();
|
|
344
|
-
}
|
|
345
|
-
this.liveManaged.delete(parent);
|
|
346
|
-
for (const child of this.liveManaged)
|
|
347
|
-
if (this.managed.get(child).operation.parent === parent)
|
|
348
|
-
this.revokeParent(child, _reason);
|
|
349
|
-
this.withdrawParent(parent, _reason);
|
|
350
|
-
}
|
|
351
|
-
/** Admission withdrawal invalidates tickets without terminating a living Agent. */
|
|
352
|
-
withdrawParent(parent, reason) {
|
|
353
|
-
const managed = this.managed.get(parent);
|
|
354
|
-
if (managed?.status === "pending") {
|
|
355
|
-
this.revokeParent(parent, reason);
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
const state = this.parents.get(parent);
|
|
359
|
-
if (state === undefined)
|
|
360
|
-
return;
|
|
361
|
-
this.parents.delete(parent);
|
|
362
|
-
state.lifetime.abort();
|
|
363
|
-
state.epoch.abort();
|
|
364
|
-
state.prepared?.controller.abort();
|
|
365
|
-
state.detachResidency?.();
|
|
366
|
-
}
|
|
367
|
-
revokeOwner(owner, reason) {
|
|
368
|
-
for (const parent of this.liveManaged) {
|
|
369
|
-
const state = this.managed.get(parent);
|
|
370
|
-
if (state.status === "pending" && state.operation.owner === owner)
|
|
371
|
-
this.revokeParent(parent, reason);
|
|
372
|
-
}
|
|
373
|
-
for (const [parent, state] of this.parents)
|
|
374
|
-
if (state.owner === owner)
|
|
375
|
-
this.withdrawParent(parent, reason);
|
|
376
|
-
}
|
|
377
|
-
/** Only the native exact browser peer/Connection can authorize browser delivery. */
|
|
378
|
-
acquireBrowserSignal(callerCtx) {
|
|
379
|
-
const invocation = callerCtx.invocation;
|
|
380
|
-
const connection = callerCtx.get("connection");
|
|
381
|
-
const state = this.connection;
|
|
382
|
-
if (invocation?.peer === undefined || connection === undefined || state === undefined
|
|
383
|
-
|| original(connection) !== state.owner || connection.browserPeer !== invocation.peer || state.browserPeer !== invocation.peer)
|
|
384
|
-
unauthorized();
|
|
385
|
-
state.controller.signal.throwIfAborted();
|
|
386
|
-
return state.controller.signal;
|
|
387
|
-
}
|
|
388
|
-
current(parent) {
|
|
389
|
-
this.assertSender(parent);
|
|
390
|
-
const state = this.parents.get(parent);
|
|
391
|
-
if (state === undefined || state.publishing || state.lifetime.signal.aborted || this.lifetime.signal.aborted
|
|
392
|
-
|| this.binding?.owner !== state.owner || this.ctx.get("agents")?.get(parent.id) !== parent)
|
|
393
|
-
unauthorized();
|
|
394
|
-
return state;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
//# sourceMappingURL=delivery-authority.js.map
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
-
import type { SessionEvent, SessionHeader, SessionId as NativeSessionId } from "@deepseek-ai/dsh-session";
|
|
3
|
-
import type { ContinuableSubagentDescriptorData } from "@deepseek-ai/dsh-subagent";
|
|
4
|
-
import type { ParentAdmissionTicket } from "./delivery-authority.js";
|
|
5
|
-
import type { ChildAdmissionCapture } from "./child-capture.js";
|
|
6
|
-
import type { DsmmProfileAdmission } from "./settings.js";
|
|
7
|
-
import type { DsmmRoleId } from "./roles.js";
|
|
8
|
-
/** Host-only borrowed cut returned by the PUBLIC SessionQueryEngine.observeSession service. */
|
|
9
|
-
export interface NativeChildObservation extends Disposable {
|
|
10
|
-
readonly header: SessionHeader;
|
|
11
|
-
readonly inheritedEventCount: number;
|
|
12
|
-
readonly events: readonly SessionEvent[];
|
|
13
|
-
}
|
|
14
|
-
/** Injection avoids making the optional query provider a new DSMM package dependency. No wire caller supplies history. */
|
|
15
|
-
export interface NativeChildHistory {
|
|
16
|
-
observeSession(id: NativeSessionId, options: {
|
|
17
|
-
signal: AbortSignal;
|
|
18
|
-
projectionMode: "none";
|
|
19
|
-
}): Promise<NativeChildObservation>;
|
|
20
|
-
}
|
|
21
|
-
export interface NativeChildFacts {
|
|
22
|
-
readonly childSessionId: string;
|
|
23
|
-
readonly parentSessionId: string;
|
|
24
|
-
readonly depth: number;
|
|
25
|
-
readonly role: DsmmRoleId;
|
|
26
|
-
readonly descriptor: ContinuableSubagentDescriptorData;
|
|
27
|
-
readonly active?: boolean;
|
|
28
|
-
readonly requestBudgetObserved: boolean;
|
|
29
|
-
}
|
|
30
|
-
/** Exact public catalog and replay-validated physical cuts; never resumes an Agent. */
|
|
31
|
-
export declare class NativeChildEvidenceReader {
|
|
32
|
-
private readonly ctx;
|
|
33
|
-
private readonly assertTicket;
|
|
34
|
-
private readonly history;
|
|
35
|
-
constructor(ctx: Context, assertTicket: (ticket: ParentAdmissionTicket<DsmmProfileAdmission>) => void, history: NativeChildHistory);
|
|
36
|
-
read(ticket: ParentAdmissionTicket<DsmmProfileAdmission>, childId: string, callerSignal: AbortSignal): Promise<NativeChildFacts>;
|
|
37
|
-
}
|
|
38
|
-
/** Capture evidence must agree with the child's establishing descriptor, not current parent routing. */
|
|
39
|
-
export declare function assertNativeChildCapture(capture: ChildAdmissionCapture, facts: NativeChildFacts): void;
|
|
40
|
-
//# sourceMappingURL=native-child-evidence.d.ts.map
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { symbols } from "@deepseek-ai/cordis";
|
|
2
|
-
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
3
|
-
import { foldSubagentDescriptor, SubagentError } from "@deepseek-ai/dsh-subagent";
|
|
4
|
-
import { freezeSettings } from "./settings.js";
|
|
5
|
-
import { isDsmmRoleId } from "./roles.js";
|
|
6
|
-
function unauthorized() { throw new SubagentError("Child history does not prove its direct native identity", "UNAUTHORIZED"); }
|
|
7
|
-
/** Exact public catalog and replay-validated physical cuts; never resumes an Agent. */
|
|
8
|
-
export class NativeChildEvidenceReader {
|
|
9
|
-
ctx;
|
|
10
|
-
assertTicket;
|
|
11
|
-
history;
|
|
12
|
-
constructor(ctx, assertTicket, history) {
|
|
13
|
-
this.ctx = ctx;
|
|
14
|
-
this.assertTicket = assertTicket;
|
|
15
|
-
this.history = history;
|
|
16
|
-
}
|
|
17
|
-
async read(ticket, childId, callerSignal) {
|
|
18
|
-
const signal = AbortSignal.any([ticket.signal, callerSignal]);
|
|
19
|
-
const check = () => {
|
|
20
|
-
signal.throwIfAborted();
|
|
21
|
-
this.assertTicket(ticket);
|
|
22
|
-
const current = this.ctx.get("sessionQuery");
|
|
23
|
-
if (current === undefined || (Reflect.get(current, symbols.original) ?? current) !== (Reflect.get(this.history, symbols.original) ?? this.history))
|
|
24
|
-
unauthorized();
|
|
25
|
-
};
|
|
26
|
-
check();
|
|
27
|
-
if (this.ctx.agents.get(ticket.parent.id) !== ticket.parent || childId === ticket.parent.id)
|
|
28
|
-
unauthorized();
|
|
29
|
-
const rows = await this.ctx.subagents.listChildren(ticket.parent.id, signal);
|
|
30
|
-
check();
|
|
31
|
-
const matches = rows.filter(row => row.id === childId);
|
|
32
|
-
if (matches.length !== 1 || matches[0].mode !== "continuable")
|
|
33
|
-
unauthorized();
|
|
34
|
-
const observation = await this.history.observeSession(SessionId(childId), { signal, projectionMode: "none" });
|
|
35
|
-
try {
|
|
36
|
-
check();
|
|
37
|
-
const facts = readFacts(ticket.parent, childId, observation);
|
|
38
|
-
const catalog = matches[0];
|
|
39
|
-
if (catalog.createdAt !== observation.header.createdAt || catalog.mode !== facts.descriptor.mode || catalog.label !== facts.descriptor.label)
|
|
40
|
-
unauthorized();
|
|
41
|
-
check();
|
|
42
|
-
return facts;
|
|
43
|
-
}
|
|
44
|
-
finally {
|
|
45
|
-
observation[Symbol.dispose]();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function readFacts(parent, childId, observation) {
|
|
50
|
-
const header = observation.header;
|
|
51
|
-
if (header.version !== 4 || header.id !== childId || header.parentSession !== parent.id || header.origin !== "subagent"
|
|
52
|
-
|| !Number.isSafeInteger(header.delegationDepth) || header.delegationDepth <= (parent.session.header.delegationDepth ?? 0)
|
|
53
|
-
|| typeof header.cwd !== "string")
|
|
54
|
-
unauthorized();
|
|
55
|
-
const inherited = observation.inheritedEventCount;
|
|
56
|
-
if (!Number.isSafeInteger(inherited) || inherited < 0 || inherited > observation.events.length)
|
|
57
|
-
unauthorized();
|
|
58
|
-
const own = observation.events.slice(inherited);
|
|
59
|
-
// The catalog projection is display data; a second descriptor cannot replace the establishing composition.
|
|
60
|
-
if (own.filter(event => event.type === "subagent/descriptor").length !== 1)
|
|
61
|
-
unauthorized();
|
|
62
|
-
const descriptor = foldSubagentDescriptor(own);
|
|
63
|
-
if (descriptor?.mode !== "continuable" || !descriptor.provider.startsWith("dsmm-role-"))
|
|
64
|
-
unauthorized();
|
|
65
|
-
const role = `dsmm-${descriptor.provider.slice("dsmm-role-".length)}`;
|
|
66
|
-
if (!isDsmmRoleId(role) || role === "dsmm-orchestrator" || descriptor.agentProvider === undefined || descriptor.agentModel === undefined)
|
|
67
|
-
unauthorized();
|
|
68
|
-
let active;
|
|
69
|
-
for (const event of own) {
|
|
70
|
-
if (event.type === "dsmm/role-policy") {
|
|
71
|
-
const data = event.data;
|
|
72
|
-
if (data === null || typeof data !== "object" || Array.isArray(data) || Object.keys(data).length !== 3
|
|
73
|
-
|| data.version !== 1 || data.role !== role || data.policy !== null && (typeof data.policy !== "string" || !/^[a-f0-9]{64}$/u.test(data.policy)))
|
|
74
|
-
unauthorized();
|
|
75
|
-
}
|
|
76
|
-
else if (event.type === "deepwork/mode") {
|
|
77
|
-
const data = event.data;
|
|
78
|
-
if (data === null || typeof data !== "object" || Array.isArray(data) || Object.keys(data).length !== 1 || typeof data.active !== "boolean")
|
|
79
|
-
unauthorized();
|
|
80
|
-
active = data.active;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return freezeSettings({ childSessionId: childId, parentSessionId: parent.id, depth: header.delegationDepth, role, descriptor,
|
|
84
|
-
...(active === undefined ? {} : { active }), requestBudgetObserved: own.some(hasRequestBudget) });
|
|
85
|
-
}
|
|
86
|
-
function hasRequestBudget(event) {
|
|
87
|
-
if (event.type !== "request/header")
|
|
88
|
-
return false;
|
|
89
|
-
return event.data.header.config.maxTokens !== undefined;
|
|
90
|
-
}
|
|
91
|
-
/** Capture evidence must agree with the child's establishing descriptor, not current parent routing. */
|
|
92
|
-
export function assertNativeChildCapture(capture, facts) {
|
|
93
|
-
const route = capture.invocation.initialRoute, descriptor = facts.descriptor;
|
|
94
|
-
if (capture.childSessionId !== facts.childSessionId || capture.parentSessionId !== facts.parentSessionId || capture.role !== facts.role
|
|
95
|
-
|| facts.depth > capture.authorityCeiling.maxDepth || descriptor.agentProvider !== route.provider || descriptor.agentModel !== route.model
|
|
96
|
-
|| descriptor.agentReasoningEffort !== route.reasoningEffort)
|
|
97
|
-
unauthorized();
|
|
98
|
-
const ceiling = capture.authorityCeiling.toolFilter, native = descriptor.toolFilter;
|
|
99
|
-
if (native?.allow !== undefined && (ceiling?.allow === undefined || ceiling.allow.some(name => !native.allow.includes(name))))
|
|
100
|
-
unauthorized();
|
|
101
|
-
if (native?.deny?.some(name => ceiling?.allow?.includes(name) || ceiling?.allow === undefined && !ceiling?.deny?.includes(name)))
|
|
102
|
-
unauthorized();
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=native-child-evidence.js.map
|
package/lib/role-runs.d.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
-
import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
3
|
-
import type { ContentBlock, ToolCallId } from "@deepseek-ai/dsh-llm";
|
|
4
|
-
import type { SessionId } from "@deepseek-ai/dsh-session";
|
|
5
|
-
import type { SubagentActivation } from "@deepseek-ai/dsh-subagent";
|
|
6
|
-
import type { JobRegistry } from "@deepseek-ai/dsh-jobs";
|
|
7
|
-
declare module "@deepseek-ai/dsh-jobs/view" {
|
|
8
|
-
interface JobKindMap {
|
|
9
|
-
subagent: "subagent";
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export type RoleRunState = "starting" | "running" | "background" | "settled" | "cancelled";
|
|
13
|
-
export type RoleRunJobId = ReturnType<JobRegistry["start"]>;
|
|
14
|
-
export interface RoleRunAddress {
|
|
15
|
-
readonly sessionId: SessionId;
|
|
16
|
-
readonly toolCallId: ToolCallId;
|
|
17
|
-
/** Public role-run address is the activation childId, never lifecycle-event runId. */
|
|
18
|
-
readonly runId: SubagentActivation["childId"];
|
|
19
|
-
}
|
|
20
|
-
/** Host-only identity. Capture/projection are the borrowed original admitted objects. */
|
|
21
|
-
export interface RoleRunInvocation<C = unknown, P = unknown> extends RoleRunAddress {
|
|
22
|
-
readonly parent: Agent;
|
|
23
|
-
readonly owner: object;
|
|
24
|
-
readonly admissionEpoch: string;
|
|
25
|
-
readonly capture: C;
|
|
26
|
-
readonly projection: P;
|
|
27
|
-
readonly mode: "one-shot";
|
|
28
|
-
readonly childId?: SessionId;
|
|
29
|
-
}
|
|
30
|
-
export interface RoleRunForeground<C = unknown, P = unknown> {
|
|
31
|
-
readonly kind: "foreground";
|
|
32
|
-
readonly runId: SubagentActivation["childId"];
|
|
33
|
-
readonly invocation: RoleRunInvocation<C, P>;
|
|
34
|
-
readonly output: readonly ContentBlock[];
|
|
35
|
-
}
|
|
36
|
-
export interface RoleRunBackground<C = unknown, P = unknown> {
|
|
37
|
-
readonly kind: "background";
|
|
38
|
-
readonly jobId: RoleRunJobId;
|
|
39
|
-
readonly invocation: RoleRunInvocation<C, P>;
|
|
40
|
-
}
|
|
41
|
-
export type RoleRunTransition<C = unknown, P = unknown> = {
|
|
42
|
-
readonly status: "background" | "already-background";
|
|
43
|
-
readonly receipt: RoleRunBackground<C, P>;
|
|
44
|
-
} | {
|
|
45
|
-
readonly status: "already-settled" | "starting" | "cancelled";
|
|
46
|
-
};
|
|
47
|
-
export interface RoleRunBackgroundRequest extends RoleRunAddress {
|
|
48
|
-
readonly parent: Agent;
|
|
49
|
-
readonly owner: object;
|
|
50
|
-
readonly expectedAdmissionEpoch: string;
|
|
51
|
-
}
|
|
52
|
-
export interface RoleRunTeardown {
|
|
53
|
-
/** Supply the stable Host authority's revokeParent, never an epoch-only abort. */
|
|
54
|
-
revokeParent(agent: Agent, reason: string): void;
|
|
55
|
-
/** Invoke the exact activation disposer, whose runtime boundary revokes its tree. */
|
|
56
|
-
disposeRun(run: SubagentActivation): Promise<void>;
|
|
57
|
-
}
|
|
58
|
-
export interface RoleRunCollaborators<C = unknown, P = unknown> {
|
|
59
|
-
/** Synchronous exact-parent/entry-owner check plus the current stable epoch. */
|
|
60
|
-
currentEpoch(parent: Agent, owner: object): string;
|
|
61
|
-
/** Trusted admission/operator adapter; no UI/RPC protocol is synthesized here. */
|
|
62
|
-
canBackground(parent: Agent, identity: RoleRunInvocation<C, P>, currentEpoch: string): boolean;
|
|
63
|
-
readonly teardown: RoleRunTeardown;
|
|
64
|
-
}
|
|
65
|
-
export interface RoleRunStart<C = unknown, P = unknown> {
|
|
66
|
-
readonly parent: Agent;
|
|
67
|
-
readonly owner: object;
|
|
68
|
-
readonly sessionId: SessionId;
|
|
69
|
-
readonly toolCallId: ToolCallId;
|
|
70
|
-
readonly admissionEpoch: string;
|
|
71
|
-
readonly capture: C;
|
|
72
|
-
readonly projection: P;
|
|
73
|
-
readonly label: string;
|
|
74
|
-
readonly callerAbort: AbortSignal;
|
|
75
|
-
readonly jobs?: JobRegistry;
|
|
76
|
-
/** Call native startActivation exactly once, forwarding this holder signal. */
|
|
77
|
-
start(signal: AbortSignal): Promise<SubagentActivation>;
|
|
78
|
-
}
|
|
79
|
-
/** One foreground call's real native run and its revocable caller-cancel relay. */
|
|
80
|
-
export declare class RoleRunHolder<C = unknown, P = unknown> {
|
|
81
|
-
private readonly controller;
|
|
82
|
-
private readonly readyResult;
|
|
83
|
-
private readonly foregroundResult;
|
|
84
|
-
private readonly drainedResult;
|
|
85
|
-
private currentState;
|
|
86
|
-
private identity?;
|
|
87
|
-
private receipt?;
|
|
88
|
-
private outcome?;
|
|
89
|
-
private disposeActivation?;
|
|
90
|
-
private terminal;
|
|
91
|
-
private finished;
|
|
92
|
-
private registering;
|
|
93
|
-
private committing;
|
|
94
|
-
private detachParent;
|
|
95
|
-
private readonly callerRelay;
|
|
96
|
-
readonly ready: Promise<RoleRunInvocation<C, P>>;
|
|
97
|
-
readonly foreground: Promise<RoleRunBackground<C, P> | RoleRunForeground<C, P>>;
|
|
98
|
-
/** Quiescence, preserving typed result and aggregate cleanup errors even in background. */
|
|
99
|
-
readonly drained: Promise<void>;
|
|
100
|
-
private readonly request;
|
|
101
|
-
private readonly collaborators;
|
|
102
|
-
private readonly release;
|
|
103
|
-
constructor(request: RoleRunStart<C, P>, collaborators: RoleRunCollaborators<C, P>, release: () => void);
|
|
104
|
-
get state(): RoleRunState;
|
|
105
|
-
get owner(): object;
|
|
106
|
-
get sessionId(): SessionId;
|
|
107
|
-
get toolCallId(): ToolCallId;
|
|
108
|
-
get invocation(): RoleRunInvocation<C, P> | undefined;
|
|
109
|
-
get holderSignal(): AbortSignal;
|
|
110
|
-
cancel(reason?: unknown): void;
|
|
111
|
-
background(request: RoleRunBackgroundRequest): RoleRunTransition<C, P>;
|
|
112
|
-
private assertAddress;
|
|
113
|
-
private assertAuthorization;
|
|
114
|
-
private begin;
|
|
115
|
-
private observed;
|
|
116
|
-
}
|
|
117
|
-
/** Current process-local calls only; native jobs remain the sole background registry. */
|
|
118
|
-
export declare class RoleRunRegistry<C = unknown, P = unknown> {
|
|
119
|
-
private readonly calls;
|
|
120
|
-
private closed;
|
|
121
|
-
private readonly collaborators;
|
|
122
|
-
/** ctx is the stable Host-owned scope, not a reinstalled profile entry. */
|
|
123
|
-
constructor(ctx: Context, collaborators: RoleRunCollaborators<C, P>);
|
|
124
|
-
start(request: RoleRunStart<C, P>): RoleRunHolder<C, P>;
|
|
125
|
-
/** Host-only lookup; C3 must authorize operator/session/epoch before exposing a view. */
|
|
126
|
-
get(parent: Agent, owner: object, address: RoleRunAddress): RoleRunHolder<C, P> | undefined;
|
|
127
|
-
/** Host-only active-call inventory, including starting calls without invented run ids. */
|
|
128
|
-
list(parent: Agent, owner: object): readonly RoleRunHolder<C, P>[];
|
|
129
|
-
/**
|
|
130
|
-
* Trusted parent teardown first revokes C1 authority, then awaits this before
|
|
131
|
-
* the original AgentHandle.dispose. Already-revoked tickets are not reacquired.
|
|
132
|
-
*/
|
|
133
|
-
drainParent(parent: Agent, owner: object, reason: string): Promise<void>;
|
|
134
|
-
close(reason: string): void;
|
|
135
|
-
drain(): Promise<void>;
|
|
136
|
-
private awaitHolders;
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=role-runs.d.ts.map
|