@dsmm/dsmm 0.3.25 → 0.3.27
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 +21 -8
- package/docs/agent-presets.md +7 -7
- package/docs/agent-teams.md +27 -0
- package/docs/compatibility.md +7 -5
- package/docs/lsp.md +10 -12
- package/docs/maintenance.md +29 -0
- package/docs/roadmap.md +25 -9
- package/docs/runtime-recovery.md +3 -3
- package/docs/testing.md +2 -1
- package/docs/web-fetch-fakeip.md +1 -1
- package/dsh-plugin.json +1 -1
- package/lib/client/NativeToolView-data.d.ts +8 -0
- package/lib/client/NativeToolView-data.js +19 -0
- package/lib/client/NativeToolView.d.ts +19 -0
- package/lib/client/NativeToolView.js +46 -0
- package/lib/client/RoleToolView-data.js +1 -1
- package/lib/client/RoleToolView-locales.d.ts +7 -0
- package/lib/client/RoleToolView-locales.js +6 -0
- package/lib/client/RoleToolView.js +2 -0
- package/lib/client/children-locales.d.ts +5 -5
- package/lib/client/controller.js +20 -0
- package/lib/client.js +347 -186
- package/lib/core-permission-authority.js +19 -8
- package/lib/deployment-permission-rules.js +2 -1
- package/lib/dsh-types.d.ts +2 -2
- package/lib/mode.js +2 -2
- package/lib/native-admission.d.ts +8 -0
- package/lib/native-admission.js +285 -48
- package/lib/native-ownership.d.ts +20 -0
- package/lib/native-ownership.js +92 -0
- package/lib/native-subagents.d.ts +21 -0
- package/lib/native-subagents.js +31 -0
- package/lib/permission-rpc.js +3 -2
- package/lib/preset-registry.js +2 -1
- package/lib/profile-rpc.js +4 -3
- package/lib/profile-runtime.d.ts +1 -1
- package/lib/profile-runtime.js +2 -1
- package/lib/prompts.d.ts +2 -0
- package/lib/prompts.js +14 -8
- package/lib/role-control-remote.js +19 -8
- package/lib/role-control-rpc.js +11 -9
- package/lib/role-control-types.d.ts +18 -5
- package/lib/role-identity.js +3 -19
- package/lib/role-invocation.d.ts +1 -1
- package/lib/role-policy.d.ts +11 -3
- package/lib/role-policy.js +64 -23
- package/lib/role-subagents.js +26 -6
- package/lib/session-metadata.d.ts +27 -1
- package/lib/session-metadata.js +46 -0
- package/lib/session-scope.d.ts +1 -1
- package/lib/session-scope.js +2 -2
- package/package.json +116 -114
- package/prompts/source/deepwork/general.md +19 -0
- package/prompts/source/shared/native-teams.md +11 -0
package/lib/native-admission.js
CHANGED
|
@@ -9,6 +9,9 @@ import { invocationView } from "./role-invocation.js";
|
|
|
9
9
|
import { scopeLifetime } from "./lifetime.js";
|
|
10
10
|
import { sessionEvents, childOwnedSessionEvents } from "./session-scope.js";
|
|
11
11
|
import { scopeParentOf, scopeOf } from "./native-scope.js";
|
|
12
|
+
import { bindNativeParent, nativeIsOwnedBy, nativeRoots, nativeTreeRoot } from "./native-ownership.js";
|
|
13
|
+
import { appendDelegationCeiling, readDelegationCeiling } from "./session-metadata.js";
|
|
14
|
+
import { listNativeChildren } from "./native-subagents.js";
|
|
12
15
|
import { DsmmProfileError } from "./profiles.js";
|
|
13
16
|
import { roleProviderName } from "./roles.js";
|
|
14
17
|
import { resolveRoleInvocation } from "./role-invocation.js";
|
|
@@ -72,6 +75,7 @@ export class NativeAdmission {
|
|
|
72
75
|
activities = new Map();
|
|
73
76
|
calls = new Map();
|
|
74
77
|
rebindings = new WeakMap();
|
|
78
|
+
awaitingPublication = new WeakMap();
|
|
75
79
|
guardedTools = new WeakMap();
|
|
76
80
|
agentLifetimes = new WeakMap();
|
|
77
81
|
retirements = new WeakMap();
|
|
@@ -86,6 +90,8 @@ export class NativeAdmission {
|
|
|
86
90
|
ambiguousCallIds = new WeakMap();
|
|
87
91
|
observedCallTokens = new Map();
|
|
88
92
|
observedCallChildren = new Map();
|
|
93
|
+
nativeToolObservations = new Map();
|
|
94
|
+
nativeToolExecution = new AsyncLocalStorage();
|
|
89
95
|
observedCallRuns = new Map();
|
|
90
96
|
callSubscribers = new Set();
|
|
91
97
|
providerScopes = new Map();
|
|
@@ -109,6 +115,7 @@ export class NativeAdmission {
|
|
|
109
115
|
this.observedCallTokens.clear();
|
|
110
116
|
this.observedCallChildren.clear();
|
|
111
117
|
this.observedCallRuns.clear();
|
|
118
|
+
this.nativeToolObservations.clear();
|
|
112
119
|
for (const agent of this.agents)
|
|
113
120
|
agent.cancel({ kind: "disposed" });
|
|
114
121
|
});
|
|
@@ -134,13 +141,19 @@ export class NativeAdmission {
|
|
|
134
141
|
for (const agent of ctx.agents.list())
|
|
135
142
|
this.opaqueAgents.add(agent);
|
|
136
143
|
observeProviders();
|
|
137
|
-
ctx.on("subagent/start", info => { this.startObservedActivation(info); }, { global: true });
|
|
144
|
+
ctx.on("subagent/start", info => { this.admitPublishedChild(info); this.startObservedActivation(info); }, { global: true });
|
|
138
145
|
ctx.on("subagent/end", info => { this.endObservedActivation(info); }, { global: true });
|
|
139
146
|
ctx.on("session/created", session => {
|
|
140
147
|
this.setupSelectionCursors.set(session, latestModelSelectionSeq({ session }));
|
|
141
148
|
}, { global: true });
|
|
142
149
|
ctx.on("session/disposed", session => { this.setupSelectionCursors.delete(session); }, { global: true });
|
|
143
|
-
ctx.on("agent/created", async (frame) => {
|
|
150
|
+
ctx.on("agent/created", async (frame) => {
|
|
151
|
+
if (typeof ctx.agents.isOwnedBy !== "function" && frame.agent.session.header.origin === "subagent") {
|
|
152
|
+
this.awaitChildPublication(frame.agent, frame.source, frame.signal);
|
|
153
|
+
}
|
|
154
|
+
else
|
|
155
|
+
await this.created(frame.agent, frame.source, frame.signal);
|
|
156
|
+
}, { global: true, prepend: true });
|
|
144
157
|
ctx.on("agent/status", ({ agent, status }) => { if (status === "running")
|
|
145
158
|
this.installCachedAdmissionRouteSafely(agent); }, { global: true });
|
|
146
159
|
ctx.on("agent/inbox/claimed", ({ agent }) => { this.installCachedAdmissionRouteSafely(agent); }, { global: true });
|
|
@@ -183,15 +196,14 @@ export class NativeAdmission {
|
|
|
183
196
|
ctx.on("agent/pre-step", async (frame, next) => { await this.guardExecution(frame.agent); return next(); }, { global: true, prepend: true });
|
|
184
197
|
ctx.on("agent/request", async (frame, next) => { await this.guardExecution(frame.agent); return next(); }, { global: true, prepend: true });
|
|
185
198
|
ctx.on("tools/execute", async (exec, next) => {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return policy.duringToolExecution(exec, next);
|
|
199
|
+
const native = exec.agent && await this.guardExecution(exec.agent) === "native";
|
|
200
|
+
return this.nativeToolExecution.run(exec.token, () => native ? next() : policy.duringToolExecution(exec, next));
|
|
189
201
|
}, { global: true, prepend: true });
|
|
190
202
|
ctx.on("tools/pre-execute", async (exec, next) => {
|
|
191
203
|
if (exec.agent) {
|
|
192
204
|
this.trackExecution(exec);
|
|
193
|
-
|
|
194
|
-
|
|
205
|
+
await this.guardExecution(exec.agent);
|
|
206
|
+
this.beginNativeToolObservation(exec);
|
|
195
207
|
}
|
|
196
208
|
return next();
|
|
197
209
|
}, { global: true, prepend: true });
|
|
@@ -239,14 +251,18 @@ export class NativeAdmission {
|
|
|
239
251
|
...(route.reasoningEffort === undefined ? {} : { reasoningEffort: route.reasoningEffort }) });
|
|
240
252
|
}
|
|
241
253
|
observedCall(record) {
|
|
242
|
-
|
|
254
|
+
const common = { parentSessionId: record.parent.id, parentAdmissionEpoch: record.parentAdmission.epoch,
|
|
243
255
|
...(record.childAdmission === undefined ? {} : { childAdmissionEpoch: record.childAdmission.epoch }),
|
|
244
256
|
callId: record.callId, rootCallId: record.rootCallId, childId: record.childId,
|
|
245
|
-
...(record.runId === undefined ? {} : { runId: record.runId }),
|
|
246
|
-
level: record.invocation.effectiveLevel, routeSource: record.invocation.routeSource,
|
|
247
|
-
initialRoute: Object.freeze({ status: "known", source: "invocation-capture", route: this.observationRoute(record.invocation.initialRoute) }),
|
|
257
|
+
...(record.runId === undefined ? {} : { runId: record.runId }),
|
|
248
258
|
actualRoute: record.actualRoute, phase: record.phase, delivery: record.delivery,
|
|
249
|
-
...(record.stopReason === undefined ? {} : { stopReason: record.stopReason }) }
|
|
259
|
+
...(record.stopReason === undefined ? {} : { stopReason: record.stopReason }) };
|
|
260
|
+
return record.kind === "native"
|
|
261
|
+
? Object.freeze({ ...common, kind: "native", toolName: record.toolName, provider: record.provider,
|
|
262
|
+
...(record.nativeName === undefined ? {} : { nativeName: record.nativeName }),
|
|
263
|
+
initialRoute: Object.freeze({ status: "unknown", reason: "missing-invocation-capture" }) })
|
|
264
|
+
: Object.freeze({ ...common, role: record.role, level: record.invocation.effectiveLevel, routeSource: record.invocation.routeSource,
|
|
265
|
+
initialRoute: Object.freeze({ status: "known", source: "invocation-capture", route: this.observationRoute(record.invocation.initialRoute) }) });
|
|
250
266
|
}
|
|
251
267
|
publishObservedCall(record) {
|
|
252
268
|
if (this.observedCalls.get(record.parent)?.get(record.callId) !== record || this.ambiguousCallIds.get(record.parent)?.has(record.callId))
|
|
@@ -270,7 +286,70 @@ export class NativeAdmission {
|
|
|
270
286
|
routeComparison: { childId: record.childId, initialRoute: call.initialRoute, liveRoute: call.actualRoute },
|
|
271
287
|
delivery: record.delivery, phase: record.phase, ...(record.stopReason === undefined ? {} : { stopReason: record.stopReason }) };
|
|
272
288
|
}
|
|
289
|
+
awaitChildPublication(agent, source, signal) {
|
|
290
|
+
if (this.awaitingPublication.has(agent))
|
|
291
|
+
throw new SubagentError("Child publication is already pending", "UNAUTHORIZED");
|
|
292
|
+
let resolve, rejectAdmission;
|
|
293
|
+
const promise = new Promise((done, reject) => { resolve = done; rejectAdmission = reject; });
|
|
294
|
+
const waiting = { source, signal, promise, resolve, reject: rejectAdmission, started: false };
|
|
295
|
+
this.awaitingPublication.set(agent, waiting);
|
|
296
|
+
void waiting.promise.catch(() => { });
|
|
297
|
+
const closed = AbortSignal.any([this.lifetime.signal, ...signal ? [signal] : []]);
|
|
298
|
+
const reject = () => waiting.reject(new SubagentError("Child admission was cancelled", "UNAUTHORIZED"));
|
|
299
|
+
closed.addEventListener("abort", reject, { once: true });
|
|
300
|
+
if (closed.aborted)
|
|
301
|
+
reject();
|
|
302
|
+
scopeLifetime(agent.ctx, "dsmm: reject unpublished child admission", reject);
|
|
303
|
+
void waiting.promise.finally(() => closed.removeEventListener("abort", reject)).catch(() => { });
|
|
304
|
+
// The native manager publishes ancestry after agent/created returns. No
|
|
305
|
+
// model request or tool can cross that interval, including after owner unload.
|
|
306
|
+
agent.ctx.on("agent/pre-step", async (frame, next) => { if (frame.agent === agent)
|
|
307
|
+
await waiting.promise; return next(); }, { prepend: true });
|
|
308
|
+
agent.ctx.on("agent/request", async (frame, next) => { if (frame.agent === agent)
|
|
309
|
+
await waiting.promise; return next(); }, { prepend: true });
|
|
310
|
+
agent.ctx.on("tools/pre-execute", async (exec, next) => { if (exec.agent === agent)
|
|
311
|
+
await waiting.promise; return next(); }, { prepend: true });
|
|
312
|
+
}
|
|
313
|
+
admitPublishedChild(info) {
|
|
314
|
+
if (!info.local)
|
|
315
|
+
return;
|
|
316
|
+
const child = this.ctx.agents.get(info.id), waiting = child && this.awaitingPublication.get(child);
|
|
317
|
+
if (!child || !waiting || waiting.started)
|
|
318
|
+
return;
|
|
319
|
+
waiting.started = true;
|
|
320
|
+
const admission = async () => {
|
|
321
|
+
this.lifetime.signal.throwIfAborted();
|
|
322
|
+
waiting.signal?.throwIfAborted();
|
|
323
|
+
const parent = info.parentSessionId === undefined ? undefined : this.ctx.agents.get(info.parentSessionId);
|
|
324
|
+
const pending = this.pending.get(child.id);
|
|
325
|
+
if (pending && (pending.parent !== parent || pending.provider.name !== info.provider))
|
|
326
|
+
throw new SubagentError("Published child differs from its pending invocation", "UNAUTHORIZED");
|
|
327
|
+
if (parent !== undefined)
|
|
328
|
+
bindNativeParent(this.ctx.agents, child, parent);
|
|
329
|
+
else {
|
|
330
|
+
const ceiling = readDelegationCeiling(child.session);
|
|
331
|
+
if (waiting.source !== "resume" || ceiling === undefined || ceiling.creatorId !== info.parentSessionId
|
|
332
|
+
|| ceiling.provider !== info.provider)
|
|
333
|
+
throw new SubagentError("Child requires its verified creator evidence", "UNAUTHORIZED");
|
|
334
|
+
}
|
|
335
|
+
await this.created(child, waiting.source, waiting.signal);
|
|
336
|
+
};
|
|
337
|
+
void admission().then(waiting.resolve, error => {
|
|
338
|
+
this.failedInstallations.add(child);
|
|
339
|
+
waiting.reject(error);
|
|
340
|
+
child.cancel({ kind: "disposed" });
|
|
341
|
+
});
|
|
342
|
+
}
|
|
273
343
|
startObservedActivation(info) {
|
|
344
|
+
const child = this.ctx.agents.get(info.id), token = this.nativeToolExecution.getStore();
|
|
345
|
+
const pending = token === undefined ? undefined : this.nativeToolObservations.get(token);
|
|
346
|
+
const parentId = info.parentSessionId;
|
|
347
|
+
if (info.local && child !== undefined && pending !== undefined && pending.admission === this.get(pending.parent)
|
|
348
|
+
&& (parentId === undefined || parentId === pending.parent.id)
|
|
349
|
+
&& child.session.header.origin === "subagent" && child.session.header.parentSession === pending.parent.id
|
|
350
|
+
&& nativeIsOwnedBy(this.ctx.agents, child.id, pending.parent) && !pending.activations.has(info.id)) {
|
|
351
|
+
pending.activations.set(info.id, { info, child, childAdmission: this.get(child) });
|
|
352
|
+
}
|
|
274
353
|
const record = this.observedCallChildren.get(info.id);
|
|
275
354
|
if (record === undefined || info.provider !== record.provider || !info.local || record.phase === "settled")
|
|
276
355
|
return;
|
|
@@ -282,8 +361,16 @@ export class NativeAdmission {
|
|
|
282
361
|
this.publishObservedCall(record);
|
|
283
362
|
}
|
|
284
363
|
endObservedActivation(info) {
|
|
364
|
+
const parentId = info.parentSessionId;
|
|
365
|
+
for (const pending of this.nativeToolObservations.values()) {
|
|
366
|
+
const evidence = pending.activations.get(info.id);
|
|
367
|
+
if (evidence?.info.runId === info.runId && evidence.info.provider === info.provider && info.local
|
|
368
|
+
&& (parentId === undefined || parentId === pending.parent.id))
|
|
369
|
+
evidence.end = info;
|
|
370
|
+
}
|
|
285
371
|
const record = this.observedCallRuns.get(info.runId);
|
|
286
|
-
if (record === undefined || record.childId !== info.id || record.provider !== info.provider || !info.local
|
|
372
|
+
if (record === undefined || record.childId !== info.id || record.provider !== info.provider || !info.local
|
|
373
|
+
|| parentId !== undefined && parentId !== record.parent.id)
|
|
287
374
|
return;
|
|
288
375
|
this.settleObservedActivation(record, info.stopReason);
|
|
289
376
|
}
|
|
@@ -311,9 +398,19 @@ export class NativeAdmission {
|
|
|
311
398
|
}
|
|
312
399
|
observeCallRequestHeader(session, value) {
|
|
313
400
|
const record = this.observedCallChildren.get(session.id), child = this.ctx.agents.get(session.id);
|
|
401
|
+
for (const pending of this.nativeToolObservations.values()) {
|
|
402
|
+
const evidence = pending.activations.get(session.id);
|
|
403
|
+
if (evidence !== undefined && evidence.end === undefined && evidence.child === child && child.session === session
|
|
404
|
+
&& pending.admission === this.get(pending.parent))
|
|
405
|
+
evidence.header = { config: value };
|
|
406
|
+
}
|
|
314
407
|
if (record === undefined || child === undefined || child !== record.child || child.session !== session
|
|
315
408
|
|| record.parentAdmission !== this.get(record.parent) || record.childAdmission !== this.get(child) || record.phase === "settled")
|
|
316
409
|
return;
|
|
410
|
+
this.setObservedRoute(record, value);
|
|
411
|
+
this.publishObservedCall(record);
|
|
412
|
+
}
|
|
413
|
+
setObservedRoute(record, value) {
|
|
317
414
|
const config = typeof value === "object" && value !== null ? value : undefined;
|
|
318
415
|
if (typeof config?.provider !== "string" || typeof config.model !== "string"
|
|
319
416
|
|| config.reasoningEffort !== undefined && typeof config.reasoningEffort !== "string") {
|
|
@@ -329,9 +426,84 @@ export class NativeAdmission {
|
|
|
329
426
|
record.actualRoute = Object.freeze({ status: "unknown", reason: "invalid-own-request-header" });
|
|
330
427
|
}
|
|
331
428
|
}
|
|
332
|
-
|
|
429
|
+
}
|
|
430
|
+
beginNativeToolObservation(exec) {
|
|
431
|
+
const parent = exec.agent, admission = parent && this.get(parent);
|
|
432
|
+
if (parent === undefined || admission === undefined)
|
|
433
|
+
return;
|
|
434
|
+
const tools = this.ctx.get("agentPresets")?.serviceFor(parent, "tools") ?? parent.ctx.tools;
|
|
435
|
+
const definition = tools.get(exec.name, parent), schema = definition?.output.schema;
|
|
436
|
+
const identity = schema?.properties?.name !== undefined ? "name" : "subagentId";
|
|
437
|
+
if (definition === undefined || schema?.type !== "object" || schema.additionalProperties !== false
|
|
438
|
+
|| schema.properties?.kind?.const !== "activation" || schema.properties[identity]?.type !== "string"
|
|
439
|
+
|| !schema.required?.includes("kind") || !schema.required.includes(identity)
|
|
440
|
+
|| Object.keys(schema.properties).length !== 2)
|
|
441
|
+
return;
|
|
442
|
+
this.nativeToolObservations.set(exec.token, { parent, admission, definition, execute: definition.execute, activations: new Map() });
|
|
443
|
+
}
|
|
444
|
+
async finishNativeToolObservation(exec, result, pending) {
|
|
445
|
+
try {
|
|
446
|
+
if (pending.activations.size === 0 || result.isError || typeof result.value !== "object" || result.value === null || Array.isArray(result.value)
|
|
447
|
+
|| result.value.kind !== "activation")
|
|
448
|
+
return;
|
|
449
|
+
const nativeName = typeof result.value.name === "string" && result.value.name.length > 0 ? result.value.name : undefined;
|
|
450
|
+
const runtime = this.ctx.get("subagents");
|
|
451
|
+
const childId = nativeName === undefined
|
|
452
|
+
? typeof result.value.subagentId === "string" && result.value.subagentId.length > 0 ? SessionId(result.value.subagentId) : undefined
|
|
453
|
+
: await runtime?.resolveName?.(pending.parent, nativeName, this.lifetime.signal);
|
|
454
|
+
const tools = this.ctx.get("agentPresets")?.serviceFor(pending.parent, "tools") ?? pending.parent.ctx.tools;
|
|
455
|
+
const evidence = childId === undefined ? undefined : pending.activations.get(childId);
|
|
456
|
+
if (this.nativeToolObservations.get(exec.token) !== pending || this.lifetime.signal.aborted
|
|
457
|
+
|| this.get(pending.parent) !== pending.admission || this.ctx.agents.get(pending.parent.id) !== pending.parent
|
|
458
|
+
|| exec.agent !== pending.parent || tools.get(exec.name, pending.parent) !== pending.definition
|
|
459
|
+
|| pending.definition.execute !== pending.execute || evidence === undefined || childId === undefined)
|
|
460
|
+
return;
|
|
461
|
+
if (evidence.end === undefined && (this.ctx.agents.get(childId) !== evidence.child
|
|
462
|
+
|| !nativeIsOwnedBy(this.ctx.agents, childId, pending.parent)))
|
|
463
|
+
return;
|
|
464
|
+
const record = { kind: "native", parent: pending.parent, parentAdmission: pending.admission,
|
|
465
|
+
token: exec.token, callId: String(exec.callId), rootCallId: String(exec.rootCallId), childId,
|
|
466
|
+
toolName: exec.name, provider: evidence.info.provider, ...(nativeName === undefined ? {} : { nativeName }),
|
|
467
|
+
child: evidence.child, childAdmission: this.get(evidence.child) ?? evidence.childAdmission,
|
|
468
|
+
runId: evidence.info.runId, phase: "active", delivery: "parent", actualRoute: { status: "unknown", reason: "no-own-request-header" } };
|
|
469
|
+
if (evidence.header !== undefined)
|
|
470
|
+
this.setObservedRoute(record, evidence.header.config);
|
|
471
|
+
const calls = this.callsFor(pending.parent);
|
|
472
|
+
let ambiguous = this.ambiguousCallIds.get(pending.parent);
|
|
473
|
+
if (ambiguous === undefined) {
|
|
474
|
+
ambiguous = new Set();
|
|
475
|
+
this.ambiguousCallIds.set(pending.parent, ambiguous);
|
|
476
|
+
}
|
|
477
|
+
const duplicate = calls.has(record.callId) || ambiguous.has(record.callId);
|
|
478
|
+
this.recordsFor(pending.parent).add(record);
|
|
479
|
+
if (duplicate) {
|
|
480
|
+
ambiguous.add(record.callId);
|
|
481
|
+
calls.delete(record.callId);
|
|
482
|
+
this.publishObservedRemoval(pending.parent, pending.admission, record.callId);
|
|
483
|
+
}
|
|
484
|
+
else
|
|
485
|
+
calls.set(record.callId, record);
|
|
486
|
+
if (evidence.end !== undefined)
|
|
487
|
+
this.settleObservedActivation(record, evidence.end.stopReason);
|
|
488
|
+
else {
|
|
489
|
+
this.observedCallChildren.set(childId, record);
|
|
490
|
+
this.observedCallRuns.set(evidence.info.runId, record);
|
|
491
|
+
this.publishObservedCall(record);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
catch (error) {
|
|
495
|
+
if (!this.lifetime.signal.aborted)
|
|
496
|
+
this.ctx.logger.debug("Native call observation unavailable: %s", error instanceof Error ? error.message : String(error));
|
|
497
|
+
}
|
|
498
|
+
finally {
|
|
499
|
+
if (this.nativeToolObservations.get(exec.token) === pending)
|
|
500
|
+
this.nativeToolObservations.delete(exec.token);
|
|
501
|
+
}
|
|
333
502
|
}
|
|
334
503
|
finishObservedTool(exec, result) {
|
|
504
|
+
const native = this.nativeToolObservations.get(exec.token);
|
|
505
|
+
if (native !== undefined)
|
|
506
|
+
void this.finishNativeToolObservation(exec, result, native);
|
|
335
507
|
const record = this.observedCallTokens.get(exec.token);
|
|
336
508
|
if (record === undefined)
|
|
337
509
|
return;
|
|
@@ -342,6 +514,9 @@ export class NativeAdmission {
|
|
|
342
514
|
}
|
|
343
515
|
}
|
|
344
516
|
retireObservedParent(parent) {
|
|
517
|
+
for (const [token, pending] of this.nativeToolObservations)
|
|
518
|
+
if (pending.parent === parent)
|
|
519
|
+
this.nativeToolObservations.delete(token);
|
|
345
520
|
for (const record of this.observedCallRecords.get(parent) ?? []) {
|
|
346
521
|
this.observedCallTokens.delete(record.token);
|
|
347
522
|
if (this.observedCallChildren.get(record.childId) === record)
|
|
@@ -419,10 +594,11 @@ export class NativeAdmission {
|
|
|
419
594
|
/** Exact process-local capture, retained after retirement so stale objects never become native. */
|
|
420
595
|
owns(agent) { return this.agentLifetimes.has(agent); }
|
|
421
596
|
async guardExecution(agent) {
|
|
597
|
+
await this.awaitingPublication.get(agent)?.promise;
|
|
422
598
|
if (!this.owns(agent)) {
|
|
423
599
|
const registry = agent.ctx.get("agents");
|
|
424
600
|
if (registry && original(registry) === original(this.ctx.agents) && scopeOf(agent.ctx) === agent && registry.get(agent.id) !== agent
|
|
425
|
-
|| this.ctx.agents.list().some(parent => this.owns(parent) && this.ctx.agents
|
|
601
|
+
|| this.ctx.agents.list().some(parent => this.owns(parent) && nativeIsOwnedBy(this.ctx.agents, agent.id, parent))) {
|
|
426
602
|
throw new SubagentError("Native child admission is incomplete", "UNAUTHORIZED");
|
|
427
603
|
}
|
|
428
604
|
return "native";
|
|
@@ -456,7 +632,7 @@ export class NativeAdmission {
|
|
|
456
632
|
presets?.serviceFor(agent, "skills") ?? agent.ctx.get("skills")].map(service => service === undefined ? undefined : original(service));
|
|
457
633
|
}
|
|
458
634
|
invocation(agent) { return this.live.get(agent)?.invocation; }
|
|
459
|
-
async ensure(agent) { await this.rebindings.get(agent); return this.assert(agent); }
|
|
635
|
+
async ensure(agent) { await this.awaitingPublication.get(agent)?.promise; await this.rebindings.get(agent); return this.assert(agent); }
|
|
460
636
|
assert(agent) {
|
|
461
637
|
return this.assertBinding(agent);
|
|
462
638
|
}
|
|
@@ -481,17 +657,25 @@ export class NativeAdmission {
|
|
|
481
657
|
throw new SubagentError("Native admission dependencies changed", "UNAUTHORIZED");
|
|
482
658
|
if (live.preset !== agent.ctx.get("agentPresets")?.composedPreset(agent.ctx) || live.scopeParent !== scopeParentOf(agent))
|
|
483
659
|
throw new SubagentError("Preset composition changed; create a new session", "UNAUTHORIZED");
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
this.
|
|
660
|
+
const owner = live.owner ?? live.parent;
|
|
661
|
+
if (owner) {
|
|
662
|
+
const root = nativeTreeRoot(this.ctx.agents, agent);
|
|
663
|
+
if (this.ctx.agents.get(owner.id) !== owner || (root === undefined ? !nativeIsOwnedBy(this.ctx.agents, agent.id, owner) : root !== owner)
|
|
664
|
+
|| agent.session.header.parentSession !== live.creatorId)
|
|
665
|
+
throw new SubagentError("Admission owner changed", "UNAUTHORIZED");
|
|
666
|
+
this.assertBinding(owner, maintenanceRoot);
|
|
667
|
+
}
|
|
488
668
|
this.policy.assertModuleAdmission(agent);
|
|
489
669
|
return live.admission;
|
|
490
670
|
}
|
|
491
671
|
residentTree(agent) {
|
|
492
|
-
const
|
|
672
|
+
const residents = this.ctx.agents.list();
|
|
673
|
+
if (nativeTreeRoot(this.ctx.agents, agent) === agent) {
|
|
674
|
+
return [agent, ...residents.filter(member => member !== agent && nativeTreeRoot(this.ctx.agents, member) === agent).sort((a, b) => a.id.localeCompare(b.id))];
|
|
675
|
+
}
|
|
676
|
+
const tree = [agent];
|
|
493
677
|
for (let index = 0; index < tree.length; index++) {
|
|
494
|
-
for (const child of residents.filter(child => this.ctx.agents
|
|
678
|
+
for (const child of residents.filter(child => nativeIsOwnedBy(this.ctx.agents, child.id, tree[index])).sort((a, b) => a.id.localeCompare(b.id))) {
|
|
495
679
|
if (tree.includes(child))
|
|
496
680
|
throw new SubagentError("Invalid native ownership tree", "UNAUTHORIZED");
|
|
497
681
|
tree.push(child);
|
|
@@ -509,7 +693,9 @@ export class NativeAdmission {
|
|
|
509
693
|
const agents = scope.get("agents", false), runtime = scope.get("subagents", false);
|
|
510
694
|
if (agents === undefined || original(agents) !== registry || runtime === undefined || current.has(original(runtime)))
|
|
511
695
|
continue;
|
|
512
|
-
|
|
696
|
+
// Hosts without provider enumeration cannot prove that external starts are absent.
|
|
697
|
+
current.set(original(runtime), typeof runtime.list !== "function"
|
|
698
|
+
|| runtime.list().some(name => runtime.getProvider(name)?.prepareContinuable === undefined));
|
|
513
699
|
}
|
|
514
700
|
// Any native service sharing this registry may accept these exact parents,
|
|
515
701
|
// including isolated services the Agent's own context does not resolve.
|
|
@@ -523,7 +709,7 @@ export class NativeAdmission {
|
|
|
523
709
|
this.providerScopes.set(runtime, opaque);
|
|
524
710
|
}
|
|
525
711
|
blankReason(agent, allowQueued = false) {
|
|
526
|
-
if (!this.isReady || this.failedInstallations.has(agent) || this.ctx.agents.get(agent.id) !== agent || !this.ctx.agents
|
|
712
|
+
if (!this.isReady || this.failedInstallations.has(agent) || this.ctx.agents.get(agent.id) !== agent || !nativeRoots(this.ctx.agents).includes(agent) || this.dependencies(agent).some(value => value === undefined))
|
|
527
713
|
return "runtime-unavailable";
|
|
528
714
|
const live = this.live.get(agent);
|
|
529
715
|
if (!live || live.parent || agent.session.header.origin === "subagent")
|
|
@@ -615,18 +801,6 @@ export class NativeAdmission {
|
|
|
615
801
|
throw new DsmmProfileError("activation", "An enabled role has no admitted native provider.");
|
|
616
802
|
return [name, provider];
|
|
617
803
|
}));
|
|
618
|
-
for (const role of targets) {
|
|
619
|
-
const routing = admission.settings.roleRouting[role];
|
|
620
|
-
if (routing?.primary !== undefined || routing?.fallbackRoutes !== undefined) {
|
|
621
|
-
await resolveRoleInvocation(agent, role, admission.settings, preparationSignal, {}, undefined, resolvedModelParameterPolicy(admission));
|
|
622
|
-
assertCurrent();
|
|
623
|
-
}
|
|
624
|
-
for (const level of ["low", "high", "max"])
|
|
625
|
-
if (routing?.levels?.[level] !== undefined) {
|
|
626
|
-
await resolveRoleInvocation(agent, role, admission.settings, preparationSignal, { level }, undefined, resolvedModelParameterPolicy(admission));
|
|
627
|
-
assertCurrent();
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
804
|
});
|
|
631
805
|
assertCurrent();
|
|
632
806
|
const candidate = await this.admissionModelSelection?.(agent, { settings: admission.settings, epoch: admission.epoch,
|
|
@@ -739,7 +913,7 @@ export class NativeAdmission {
|
|
|
739
913
|
ambiguous.add(callId);
|
|
740
914
|
calls.delete(callId);
|
|
741
915
|
}
|
|
742
|
-
const observation = { parent, parentAdmission, token: exec.token, callId, rootCallId, childId, invocation, role,
|
|
916
|
+
const observation = { kind: "role", parent, parentAdmission, token: exec.token, callId, rootCallId, childId, invocation, role,
|
|
743
917
|
label, provider: provider.name, delivery, phase: "reserved", actualRoute: Object.freeze({ status: "unknown", reason: "not-observed" }) };
|
|
744
918
|
const pending = Object.freeze({ childId, parent, parentAdmission, callId: exec.callId, invocation, admission, provider, expectedPreset, presetScope, signal, maxDepth, toolFilter, observation });
|
|
745
919
|
this.recordsFor(parent).add(observation);
|
|
@@ -832,7 +1006,10 @@ export class NativeAdmission {
|
|
|
832
1006
|
if (existing)
|
|
833
1007
|
return existing;
|
|
834
1008
|
this.agentLifetimes.get(agent)?.abort();
|
|
835
|
-
const children = new Set([...this.agents].filter(child =>
|
|
1009
|
+
const children = new Set([...this.agents].filter(child => {
|
|
1010
|
+
const live = this.live.get(child);
|
|
1011
|
+
return (live?.owner ?? live?.parent) === agent;
|
|
1012
|
+
}));
|
|
836
1013
|
for (const child of children)
|
|
837
1014
|
child.cancel({ kind: "disposed" });
|
|
838
1015
|
const receipts = [...this.activations].filter(activation => [...children].some(child => child.id === activation.childId));
|
|
@@ -858,7 +1035,7 @@ export class NativeAdmission {
|
|
|
858
1035
|
if (this.selecting.has(agent))
|
|
859
1036
|
throw new SubagentError("Session configuration maintenance owns the blank composition", "UNAUTHORIZED");
|
|
860
1037
|
if (previous.parent || (this.calls.get(agent) ?? 0) !== 0 || [...this.pending.values()].some(row => row.parent === agent)
|
|
861
|
-
|| this.ctx.agents.list().some(child => this.ctx.agents
|
|
1038
|
+
|| this.ctx.agents.list().some(child => nativeIsOwnedBy(this.ctx.agents, child.id, agent)) || sessionEvents(agent.session).some(event => event.type === "turn/start"))
|
|
862
1039
|
throw new SubagentError("Preset change requires a new session", "UNAUTHORIZED");
|
|
863
1040
|
this.policy.validateRootRole(agent, previous.admission);
|
|
864
1041
|
const preset = agent.ctx.get("agentPresets")?.composedPreset(agent.ctx), scopeParent = scopeParentOf(agent);
|
|
@@ -883,7 +1060,7 @@ export class NativeAdmission {
|
|
|
883
1060
|
this.observeProviders();
|
|
884
1061
|
let signal = AbortSignal.any([...creationSignal ? [creationSignal] : [], this.lifetime.signal]);
|
|
885
1062
|
signal.throwIfAborted();
|
|
886
|
-
const parents = this.ctx.agents.list().filter(parent => parent !== agent && this.ctx.agents
|
|
1063
|
+
const parents = this.ctx.agents.list().filter(parent => parent !== agent && nativeIsOwnedBy(this.ctx.agents, agent.id, parent));
|
|
887
1064
|
const parent = parents[0], preset = agent.ctx.get("agentPresets")?.composedPreset(agent.ctx), presetScope = scopeParentOf(agent);
|
|
888
1065
|
if (parents.length > 1 || this.ctx.agents.get(agent.id) !== agent || this.ctx.get("sessions")?.get(agent.id) !== agent.session
|
|
889
1066
|
|| agent.session.id !== agent.id || agent.session.header.id !== agent.id || scopeOf(agent.ctx) !== agent
|
|
@@ -901,10 +1078,19 @@ export class NativeAdmission {
|
|
|
901
1078
|
throw new SubagentError("Role continuation requires an admitted parent", "UNAUTHORIZED");
|
|
902
1079
|
return;
|
|
903
1080
|
}
|
|
904
|
-
|
|
905
|
-
|
|
1081
|
+
const ceiling = source === "resume" ? readDelegationCeiling(agent.session) : undefined;
|
|
1082
|
+
const root = nativeTreeRoot(this.ctx.agents, agent);
|
|
1083
|
+
const owner = parent ? root ?? parent : ceiling !== undefined && root !== agent ? root : undefined;
|
|
1084
|
+
if (ceiling !== undefined && (root?.id !== ceiling.rootId || agent.id !== ceiling.childId
|
|
1085
|
+
|| agent.session.header.parentSession !== ceiling.creatorId || descriptor?.provider !== ceiling.provider
|
|
1086
|
+
|| (roleFromProviderName(descriptor.provider) ?? null) !== ceiling.role))
|
|
1087
|
+
throw new SubagentError("Delegation ceiling identity mismatch", "UNAUTHORIZED");
|
|
1088
|
+
if (!parent && !owner && (!nativeRoots(this.ctx.agents).includes(agent) || agent.session.header.origin === "subagent" || descriptor !== undefined))
|
|
1089
|
+
throw new SubagentError("Child requires its native creator or ceiling", "UNAUTHORIZED");
|
|
1090
|
+
if (owner)
|
|
1091
|
+
this.assert(owner);
|
|
906
1092
|
this.agentLifetimes.set(agent, new AbortController());
|
|
907
|
-
signal = AbortSignal.any([signal, this.agentLifetimes.get(agent).signal, ...
|
|
1093
|
+
signal = AbortSignal.any([signal, this.agentLifetimes.get(agent).signal, ...owner ? [this.agentLifetimes.get(owner).signal] : []]);
|
|
908
1094
|
scopeLifetime(agent.ctx, "dsmm: retire exact Agent work", () => { void this.retireAgent(agent).catch(() => { }); });
|
|
909
1095
|
agent.ctx.effect(() => async () => {
|
|
910
1096
|
try {
|
|
@@ -922,18 +1108,56 @@ export class NativeAdmission {
|
|
|
922
1108
|
});
|
|
923
1109
|
const dependencies = this.dependencies(agent);
|
|
924
1110
|
const parentAdmission = parent ? this.assert(parent) : undefined;
|
|
1111
|
+
const ownerAdmission = owner ? this.assert(owner) : undefined;
|
|
925
1112
|
const check = () => {
|
|
926
1113
|
signal.throwIfAborted();
|
|
927
1114
|
this.agentLifetimes.get(agent).signal.throwIfAborted();
|
|
928
1115
|
if (!this.isReady || this.ctx.agents.get(agent.id) !== agent || this.ctx.get("sessions")?.get(agent.id) !== agent.session
|
|
929
1116
|
|| scopeOf(agent.ctx) !== agent || original(agent.ctx.get("agents")) !== original(this.ctx.agents)
|
|
930
1117
|
|| this.dependencies(agent).some((value, index) => value !== dependencies[index]) || scopeParentOf(agent) !== presetScope || preset !== agent.ctx.get("agentPresets")?.composedPreset(agent.ctx)
|
|
931
|
-
||
|
|
1118
|
+
|| owner && (this.assert(owner) !== ownerAdmission || (root === undefined ? !nativeIsOwnedBy(this.ctx.agents, agent.id, owner) : nativeTreeRoot(this.ctx.agents, agent) !== owner))
|
|
1119
|
+
|| pending && parent && (this.assert(parent) !== parentAdmission || !nativeIsOwnedBy(this.ctx.agents, agent.id, parent)))
|
|
932
1120
|
throw new SubagentError("Activation owner changed", "UNAUTHORIZED");
|
|
933
1121
|
};
|
|
934
1122
|
let continuation, independent = false, continuationProvider;
|
|
935
1123
|
let admission;
|
|
936
|
-
if (
|
|
1124
|
+
if (ceiling !== undefined) {
|
|
1125
|
+
if (!owner || descriptor?.mode !== "continuable" || agent.session.header.origin !== "subagent")
|
|
1126
|
+
throw new SubagentError("Cold child is not continuable", "NOT_RESUMABLE");
|
|
1127
|
+
const subagents = this.ctx.get("subagents");
|
|
1128
|
+
const rows = await subagents.listDescendants(owner.id, signal);
|
|
1129
|
+
check();
|
|
1130
|
+
const row = rows.find(row => row.id === agent.id);
|
|
1131
|
+
if (!row || row.kind === "diagnostic" || row.parentId !== ceiling.creatorId || row.mode !== "continuable")
|
|
1132
|
+
throw new SubagentError("Native child catalog mismatch", "UNAUTHORIZED");
|
|
1133
|
+
const metadata = { childSessionId: ceiling.childId, parentSessionId: ceiling.creatorId, role: ceiling.role,
|
|
1134
|
+
profileId: ceiling.profileId, level: ceiling.level };
|
|
1135
|
+
const previous = await this.profiles.readChildIdentity(agent.id, ceiling.creatorId);
|
|
1136
|
+
if (previous && (previous.role !== metadata.role || previous.profileId !== metadata.profileId || previous.level !== metadata.level))
|
|
1137
|
+
throw new SubagentError("Child selection identity conflict", "UNAUTHORIZED");
|
|
1138
|
+
const ownPreset = own.find(event => event.type === "agent-preset/selected" || event.type === "subagent/descriptor");
|
|
1139
|
+
independent = ownPreset?.type === "agent-preset/selected";
|
|
1140
|
+
if (!independent && (preset !== owner.ctx.get("agentPresets")?.composedPreset(owner.ctx) || presetScope !== scopeParentOf(owner)))
|
|
1141
|
+
throw new SubagentError("Inherited composition changed", "UNAUTHORIZED");
|
|
1142
|
+
continuationProvider = ceiling.role === null ? subagents.getProvider(ceiling.provider) : this.providers.get(roleProviderName(ceiling.role));
|
|
1143
|
+
const currentProvider = continuationProvider && subagents.getProvider(continuationProvider.name);
|
|
1144
|
+
if (!continuationProvider || !currentProvider || original(currentProvider) !== original(continuationProvider))
|
|
1145
|
+
throw new SubagentError("Native provider is unavailable", "UNAUTHORIZED");
|
|
1146
|
+
admission = await this.profiles.prepareChild(agent, ownerAdmission, signal, { profileId: ceiling.profileId });
|
|
1147
|
+
check();
|
|
1148
|
+
if (ceiling.role !== null) {
|
|
1149
|
+
if (!admission.settings.modules.deepwork.enabled || !admission.settings.roles[ceiling.role])
|
|
1150
|
+
throw new SubagentError("Role is disabled", "UNAUTHORIZED");
|
|
1151
|
+
this.policy.assertDelegation(owner, ceiling.role);
|
|
1152
|
+
const manual = latestNativeModelSelection(agent)?.route;
|
|
1153
|
+
continuation = await resolveRoleInvocation(owner, ceiling.role, admission.settings, signal, { level: ceiling.level }, manual === undefined ? undefined : { provider: manual.provider, model: manual.model,
|
|
1154
|
+
...(manual.reasoningEffort === undefined ? {} : { reasoningEffort: ReasoningEffortId(manual.reasoningEffort) }) }, resolvedModelParameterPolicy(admission));
|
|
1155
|
+
check();
|
|
1156
|
+
}
|
|
1157
|
+
else if (isDsmmRoleId(preset))
|
|
1158
|
+
throw new SubagentError("Native continuation cannot acquire a DSMM role", "UNAUTHORIZED");
|
|
1159
|
+
}
|
|
1160
|
+
else if (parent) {
|
|
937
1161
|
const parentAdmission = this.assert(parent), controlled = this.policy.identity(parent).role !== undefined;
|
|
938
1162
|
if (agent.session.header.parentSession !== parent.id || agent.session.header.origin !== "subagent")
|
|
939
1163
|
throw new SubagentError("Invalid native child header", "UNAUTHORIZED");
|
|
@@ -950,7 +1174,7 @@ export class NativeAdmission {
|
|
|
950
1174
|
if (descriptor?.mode !== "continuable")
|
|
951
1175
|
throw new SubagentError("Native child is not continuable", "NOT_RESUMABLE");
|
|
952
1176
|
const subagents = this.ctx.get("subagents");
|
|
953
|
-
const rows = await subagents
|
|
1177
|
+
const rows = await listNativeChildren(subagents, parent.id, signal);
|
|
954
1178
|
check();
|
|
955
1179
|
const row = rows.find(row => row.id === agent.id);
|
|
956
1180
|
if (!row || row.mode !== "continuable")
|
|
@@ -1009,10 +1233,22 @@ export class NativeAdmission {
|
|
|
1009
1233
|
try {
|
|
1010
1234
|
if (pending)
|
|
1011
1235
|
this.policy.bindChild(agent, parent, admission, pending.invocation, pending.maxDepth, pending.toolFilter);
|
|
1236
|
+
else if (ceiling)
|
|
1237
|
+
this.policy.bindContinuedChild(agent, owner, admission, continuation, ceiling, ceiling.role === null ? admission.settings.subagents.maxDepth : this.ctx.get("subagents").resolveMaxDepth(admission.settings.subagents.maxDepth), independent);
|
|
1012
1238
|
else if (continuation)
|
|
1013
1239
|
this.policy.bindChild(agent, parent, admission, continuation, this.ctx.get("subagents").resolveMaxDepth(admission.settings.subagents.maxDepth), this.policy.visibleToolCeiling(parent), independent);
|
|
1014
1240
|
else if (parent)
|
|
1015
|
-
this.policy.bindInheritedChild(agent, parent, admission, source === "resume");
|
|
1241
|
+
this.policy.bindInheritedChild(agent, parent, admission, source === "resume", admission.settings.subagents.maxDepth);
|
|
1242
|
+
if (parent && root && source !== "resume" && descriptor) {
|
|
1243
|
+
const provider = this.ctx.get("subagents").getProvider(descriptor.provider);
|
|
1244
|
+
if (!provider)
|
|
1245
|
+
throw new SubagentError("Native provider is unavailable", "UNAUTHORIZED");
|
|
1246
|
+
if (!pending)
|
|
1247
|
+
continuationProvider = provider;
|
|
1248
|
+
appendDelegationCeiling(agent.session, { version: 1, childId: agent.id, creatorId: parent.id, rootId: root.id,
|
|
1249
|
+
provider: descriptor.provider, ...(pending ? { role: pending.invocation.target, level: pending.invocation.effectiveLevel } : { role: null, level: null }),
|
|
1250
|
+
profileId: admission.profile?.id ?? null, ...this.policy.delegationCeiling(agent) });
|
|
1251
|
+
}
|
|
1016
1252
|
await this.install(agent, this.getter(agent));
|
|
1017
1253
|
check();
|
|
1018
1254
|
await this.profiles.revalidateActivation(admission);
|
|
@@ -1040,7 +1276,8 @@ export class NativeAdmission {
|
|
|
1040
1276
|
check();
|
|
1041
1277
|
this.profiles.publish(agent, admission);
|
|
1042
1278
|
const published = this.profiles.admission(agent);
|
|
1043
|
-
this.live.set(agent, Object.freeze({ admission: published, preset, scopeParent: scopeParentOf(agent), parent,
|
|
1279
|
+
this.live.set(agent, Object.freeze({ admission: published, preset, scopeParent: scopeParentOf(agent), parent, owner, creatorId: agent.session.header.parentSession,
|
|
1280
|
+
invocation: pending?.invocation ?? continuation, dependencies, provider: pending?.provider ?? continuationProvider }));
|
|
1044
1281
|
if (pending) {
|
|
1045
1282
|
this.bindObservedChild(pending.observation, agent, published);
|
|
1046
1283
|
this.pending.delete(agent.id);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface OwnershipAgent {
|
|
2
|
+
readonly id?: string;
|
|
3
|
+
}
|
|
4
|
+
export interface NativeOwnershipRegistry<A extends OwnershipAgent> {
|
|
5
|
+
get(id: string): A | undefined;
|
|
6
|
+
list(): A[];
|
|
7
|
+
roots?(): A[];
|
|
8
|
+
isOwnedBy?(id: string, parent: A): boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Root membership is native runtime evidence, never durable session lineage. */
|
|
11
|
+
export declare function nativeRoots<A extends OwnershipAgent>(registry: NativeOwnershipRegistry<A>): A[];
|
|
12
|
+
/** A tree root is authority only while both exact objects remain registered. */
|
|
13
|
+
export declare function nativeTreeRoot<A extends OwnershipAgent>(registry: NativeOwnershipRegistry<A>, agent: A): A | undefined;
|
|
14
|
+
export declare function nativeSameTree<A extends OwnershipAgent>(registry: NativeOwnershipRegistry<A>, left: A, right: A): boolean;
|
|
15
|
+
/** New runtimes require an authenticated creation edge in addition to native tree residency. */
|
|
16
|
+
export declare function nativeIsOwnedBy<A extends OwnershipAgent>(registry: NativeOwnershipRegistry<A> | undefined, childId: string, parent: A): boolean;
|
|
17
|
+
/** Call only after authenticating the native start's direct creator, not from a session header. */
|
|
18
|
+
export declare function bindNativeParent<A extends OwnershipAgent>(registry: NativeOwnershipRegistry<A>, child: A, parent: A): void;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=native-ownership.d.ts.map
|