@dsmm/dsmm 0.3.29 → 0.3.31
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/docs/compatibility.md +4 -2
- package/docs/testing.md +2 -0
- package/docs/web-fetch-fakeip.md +2 -2
- package/dsh-plugin.json +1 -1
- package/lib/agent-prompt-scope.d.ts +3 -2
- package/lib/agent-prompt-scope.js +11 -16
- package/lib/client/children-locales.d.ts +4 -4
- package/lib/client/role-call-observations.js +2 -2
- package/lib/client.js +414 -1288
- package/lib/core-permission-authority.js +4 -0
- package/lib/host-llm.d.ts +5 -0
- package/lib/host-llm.js +9 -0
- package/lib/index.js +13 -16
- package/lib/live-pi-ai-owner.d.ts +1 -0
- package/lib/live-pi-ai-owner.js +2 -1
- package/lib/mode.d.ts +3 -2
- package/lib/mode.js +8 -12
- package/lib/model-routing.js +2 -2
- package/lib/native-admission.d.ts +2 -0
- package/lib/native-admission.js +80 -24
- package/lib/native-pi-ai-wire.js +2 -2
- package/lib/native-scope.d.ts +3 -3
- package/lib/native-scope.js +5 -6
- package/lib/permission-schema.d.ts +40 -0
- package/lib/permission-schema.js +13 -0
- package/lib/permission-settings.d.ts +0 -38
- package/lib/permission-settings.js +23 -18
- package/lib/preset-skills.d.ts +3 -2
- package/lib/preset-skills.js +12 -14
- package/lib/profile-diagnostics.js +1 -11
- package/lib/resident-root.d.ts +10 -0
- package/lib/resident-root.js +151 -0
- package/lib/role-identity.d.ts +2 -2
- package/lib/role-identity.js +1 -5
- package/lib/role-llm-runtime.d.ts +12 -2
- package/lib/role-llm-runtime.js +28 -18
- package/lib/role-llm.d.ts +2 -0
- package/lib/role-llm.js +1 -0
- package/lib/role-policy.d.ts +2 -0
- package/lib/role-policy.js +10 -10
- package/lib/role-routing.d.ts +1 -1
- package/lib/role-routing.js +4 -3
- package/lib/role-subagents.d.ts +2 -2
- package/lib/role-subagents.js +43 -63
- package/lib/settings.js +2 -1
- package/package.json +6 -51
|
@@ -4,6 +4,7 @@ import { scopeLifetime } from "./lifetime.js";
|
|
|
4
4
|
import { PermissionRefusal, permissionOriginal } from "./permission-control.js";
|
|
5
5
|
import { DSMM_DISPATCHER_ROLE, DSMM_ROLES, isRootRole } from "./roles.js";
|
|
6
6
|
import { capturedRoleInvocation } from "./role-invocation.js";
|
|
7
|
+
import { assertResidentRootCurrent } from "./resident-root.js";
|
|
7
8
|
function sameFacts(a, b) {
|
|
8
9
|
return a.length === b.length && a.every((value, index) => value === b[index]);
|
|
9
10
|
}
|
|
@@ -60,6 +61,7 @@ export function createCorePermissionAuthority(ctx, options) {
|
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
63
|
const coreDomain = (agent) => {
|
|
64
|
+
assertResidentRootCurrent(agent, integration());
|
|
63
65
|
const core = ctx.get("dsmmCoreLlmOwner"), profiles = ctx.get("dsmmProfileRuntime");
|
|
64
66
|
const ownerCore = coreOwner.get("dsmmCoreLlmOwner"), realmCore = agent.ctx.get("dsmmCoreLlmOwner");
|
|
65
67
|
if (core === undefined || ownerCore === undefined || realmCore === undefined || profiles === undefined
|
|
@@ -170,6 +172,8 @@ export function createCorePermissionAuthority(ctx, options) {
|
|
|
170
172
|
current,
|
|
171
173
|
captureIntegrity(exec) {
|
|
172
174
|
const chain = ancestry(exec), realms = chain.map(agent => agent.ctx);
|
|
175
|
+
for (const agent of chain)
|
|
176
|
+
assertResidentRootCurrent(agent, integration());
|
|
173
177
|
const signals = chain.map(agent => {
|
|
174
178
|
let signal = physicalLifetimes.get(agent);
|
|
175
179
|
if (signal === undefined) {
|
package/lib/host-llm.d.ts
CHANGED
|
@@ -57,10 +57,14 @@ export declare function snapshotDsmmCall(config: DsmmLlmCallConfig): DsmmLlmCall
|
|
|
57
57
|
export declare function preparedConfigMatches(request: GenerateOptions, config: DsmmLlmCallConfig): boolean;
|
|
58
58
|
/** Consumption is synchronous, including rejected dispatches and streams never iterated. */
|
|
59
59
|
export declare function singleUsePreparedStream(dispatch: PreparedLlmCall["stream"]): PreparedLlmCall["stream"];
|
|
60
|
+
declare const requestOwnerRuntime: unique symbol;
|
|
61
|
+
/** The marker selects the request preparation hook; admission still checks the exact owner. */
|
|
62
|
+
export declare function isDsmmAwareLlmRuntime(value: unknown): boolean;
|
|
60
63
|
/** Native execution service; an optional stock collaborator supports explicit isolated hosts. */
|
|
61
64
|
export declare class DsmmAwareLlmRuntime extends LlmRuntime {
|
|
62
65
|
readonly stock: LlmRuntime | undefined;
|
|
63
66
|
private readonly requestOwner;
|
|
67
|
+
readonly [requestOwnerRuntime] = true;
|
|
64
68
|
private readonly calls;
|
|
65
69
|
private readonly admitted;
|
|
66
70
|
private readonly preparedRequests;
|
|
@@ -95,4 +99,5 @@ export declare class DsmmAwareLlmRuntime extends LlmRuntime {
|
|
|
95
99
|
imageRequestPricing(...args: Parameters<LlmRuntime["imageRequestPricing"]>): import("@deepseek-ai/dsh-llm").LlmImageRequestPricing | undefined;
|
|
96
100
|
fileRequestText(...args: Parameters<LlmRuntime["fileRequestText"]>): string;
|
|
97
101
|
}
|
|
102
|
+
export {};
|
|
98
103
|
//# sourceMappingURL=host-llm.d.ts.map
|
package/lib/host-llm.js
CHANGED
|
@@ -5,6 +5,7 @@ import { isDeepStrictEqual } from "node:util";
|
|
|
5
5
|
import { copyRouteJson } from "./route-json.js";
|
|
6
6
|
import { modelRouteFromCall } from "./role-llm.js";
|
|
7
7
|
import { classifyDsmmAgent } from "./runtime-integration.js";
|
|
8
|
+
import { assertResidentRootCurrent } from "./resident-root.js";
|
|
8
9
|
import { latestNativeModelSelection } from "./role-routing.js";
|
|
9
10
|
import { capturedRoleInvocation } from "./role-invocation.js";
|
|
10
11
|
export function captureDsmmEffortSource(agent) {
|
|
@@ -66,10 +67,16 @@ export function singleUsePreparedStream(dispatch) {
|
|
|
66
67
|
return dispatch(request);
|
|
67
68
|
};
|
|
68
69
|
}
|
|
70
|
+
const requestOwnerRuntime = Symbol.for("@dsmm/dsmm/request-owner-runtime");
|
|
71
|
+
/** The marker selects the request preparation hook; admission still checks the exact owner. */
|
|
72
|
+
export function isDsmmAwareLlmRuntime(value) {
|
|
73
|
+
return value instanceof LlmRuntime && Reflect.get(value, requestOwnerRuntime) === true;
|
|
74
|
+
}
|
|
69
75
|
/** Native execution service; an optional stock collaborator supports explicit isolated hosts. */
|
|
70
76
|
export class DsmmAwareLlmRuntime extends LlmRuntime {
|
|
71
77
|
stock;
|
|
72
78
|
requestOwner;
|
|
79
|
+
[requestOwnerRuntime] = true;
|
|
73
80
|
calls = new WeakMap();
|
|
74
81
|
admitted = new WeakSet();
|
|
75
82
|
preparedRequests = new WeakSet();
|
|
@@ -176,6 +183,8 @@ export class DsmmAwareLlmRuntime extends LlmRuntime {
|
|
|
176
183
|
&& (fallback ? isDeepStrictEqual(config, native.config) : proposal === native.config);
|
|
177
184
|
if (requiresDsmmCallAdmission(config, classifier, classified ? undefined : agent))
|
|
178
185
|
throw new LlmError("Enhanced requests require their exact Host proposal", "INVALID_PREPARED_CALL");
|
|
186
|
+
if (agent !== undefined)
|
|
187
|
+
assertResidentRootCurrent(agent, this.ctx.get("dsmmNativeAdmission"));
|
|
179
188
|
return config;
|
|
180
189
|
}
|
|
181
190
|
async prepareCall(proposal, signal, configure) {
|
package/lib/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { hasShellGuardConstraint, registerSafetyGuards } from "./guards.js";
|
|
|
4
4
|
import { registerDeepworkPrompt } from "./mode.js";
|
|
5
5
|
import { registerAgentSkills } from "./preset-skills.js";
|
|
6
6
|
import { prepareAdmissionModelRoute, registerModelRouting } from "./model-routing.js";
|
|
7
|
+
import { bindCoreLlmAdmission } from "./role-llm-runtime.js";
|
|
7
8
|
import { registerHeadlessRoleTools, registerNativeSubagentControls } from "./role-subagents.js";
|
|
8
9
|
import { registerRolePresets } from "./preset-registry.js";
|
|
9
10
|
import { registerRoleProviders } from "./role-providers.js";
|
|
@@ -112,7 +113,7 @@ export async function apply(input, config = {}, startupOptions = {}) {
|
|
|
112
113
|
}
|
|
113
114
|
};
|
|
114
115
|
assertCurrent();
|
|
115
|
-
return
|
|
116
|
+
return bindCoreLlmAdmission(frame, { agent: frame.agent, admission: captured, capture: captured, epoch: captured.epoch, signal, assertCurrent });
|
|
116
117
|
} });
|
|
117
118
|
const nativeAdmission = admission;
|
|
118
119
|
if (startup.settings.modules.deepwork.enabled) {
|
|
@@ -137,26 +138,21 @@ export async function apply(input, config = {}, startupOptions = {}) {
|
|
|
137
138
|
await registerLspRuntime(ctx, startup.settings.lsp, getSettings);
|
|
138
139
|
lifetime.signal.throwIfAborted();
|
|
139
140
|
const installed = new WeakSet();
|
|
140
|
-
admission.activate(async (agent, candidate) => {
|
|
141
|
+
admission.activate(async (agent, candidate, scope) => {
|
|
141
142
|
candidate.subagentRuntime = () => runtimeAdmissionView(ctx);
|
|
142
|
-
|
|
143
|
-
registerAgentPromptScope(ctx, controller, candidate, policy, agent, nativeAdmission.lifetime.signal);
|
|
143
|
+
registerAgentPromptScope(scope, controller, candidate, policy, agent);
|
|
144
144
|
if (startup.settings.modules.deepwork.enabled) {
|
|
145
|
-
registerAgentSkills(scope, controller, candidate, agent,
|
|
146
|
-
registerDeepworkPrompt(scope, controller, candidate, { section: startup.profile.section ?? startup.global.section }, agent
|
|
145
|
+
registerAgentSkills(scope, controller, candidate, agent, () => !nativeAdmission.isSelecting(agent));
|
|
146
|
+
registerDeepworkPrompt(scope, controller, candidate, { section: startup.profile.section ?? startup.global.section }, agent);
|
|
147
147
|
}
|
|
148
|
-
if (installed.has(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
if (!installed.has(scope)) {
|
|
149
|
+
registerModelRouting(scope, controller, candidate, agent);
|
|
150
|
+
registerSafetyGuards(scope, controller, candidate, policy, commandApprovals);
|
|
151
|
+
installed.add(scope);
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (startup.settings.modules.deepwork.enabled) {
|
|
156
|
-
if (ctx.get("subagents") !== undefined)
|
|
157
|
-
await registerHeadlessRoleTools(scope, controller, candidate, policy, nativeAdmission, agent);
|
|
153
|
+
if (startup.settings.modules.deepwork.enabled && scope.get("subagents") !== undefined) {
|
|
154
|
+
registerHeadlessRoleTools(scope, controller, candidate, policy, nativeAdmission, agent);
|
|
158
155
|
}
|
|
159
|
-
installed.add(agent);
|
|
160
156
|
});
|
|
161
157
|
registerDsmmTuiAdapter(ctx, { controller, getSettings, profiles, deployment });
|
|
162
158
|
ctx.inject(["typert"], scope => { registerConfigRpc(scope, deployment, startup.settings, () => profiles, startup.sources, mountedPermission); new DsmmProfilesHost(scope, profiles); registerRoleControlRpc(scope, nativeAdmission); });
|
|
@@ -175,6 +171,7 @@ export async function apply(input, config = {}, startupOptions = {}) {
|
|
|
175
171
|
return; detach(); if (!lifetime.signal.aborted)
|
|
176
172
|
installPermissions(); }, { global: true });
|
|
177
173
|
}
|
|
174
|
+
await admission.restoreResidentRoots();
|
|
178
175
|
}
|
|
179
176
|
export default { name, inject, Config, apply };
|
|
180
177
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,6 +6,7 @@ type RegistrationHandle = ReturnType<LlmRuntime["registerAdapter"]>;
|
|
|
6
6
|
/** Captures public registering-fiber provenance; the native runtime remains the sole registry. */
|
|
7
7
|
export declare class LivePiAiOwner implements DsmmLlmRouteResolver {
|
|
8
8
|
private readonly native;
|
|
9
|
+
readonly isMissingProviderError: (error: unknown) => boolean;
|
|
9
10
|
private readonly registrations;
|
|
10
11
|
constructor(_ctx: Context, native: LlmRuntime);
|
|
11
12
|
supportsNativeStop(provider: string): boolean;
|
package/lib/live-pi-ai-owner.js
CHANGED
|
@@ -6,7 +6,7 @@ import { brandString } from "@deepseek-ai/dsh-brand";
|
|
|
6
6
|
import { isDeepStrictEqual } from "node:util";
|
|
7
7
|
import { createDsmmPiAiProviderOwner } from "./native-pi-ai-wire.js";
|
|
8
8
|
import { snapshotDsmmCall } from "./host-llm.js";
|
|
9
|
-
import { DsmmMissingProviderError, modelRouteToCall } from "./role-llm.js";
|
|
9
|
+
import { DsmmMissingProviderError, isMissingProviderError, modelRouteToCall } from "./role-llm.js";
|
|
10
10
|
import { normalizeModelRouteJson } from "./route-json.js";
|
|
11
11
|
const original = (value) => Reflect.get(value, symbols.original) ?? value;
|
|
12
12
|
const providerConfig = (scope) => {
|
|
@@ -16,6 +16,7 @@ const providerConfig = (scope) => {
|
|
|
16
16
|
/** Captures public registering-fiber provenance; the native runtime remains the sole registry. */
|
|
17
17
|
export class LivePiAiOwner {
|
|
18
18
|
native;
|
|
19
|
+
isMissingProviderError = isMissingProviderError;
|
|
19
20
|
registrations = new Map();
|
|
20
21
|
constructor(_ctx, native) {
|
|
21
22
|
this.native = native;
|
package/lib/mode.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { DshAgent } from "./dsh-types.js";
|
|
2
3
|
import type { Config } from "./index.js";
|
|
3
4
|
import type { DsmmSettingsGetter } from "./settings.js";
|
|
4
5
|
import type { DeepworkModeController } from "./state.js";
|
|
5
6
|
/** The admission installer owns scope selection; assembly reads the immutable Agent configuration. */
|
|
6
|
-
export declare function registerDeepworkPrompt(
|
|
7
|
+
export declare function registerDeepworkPrompt(ctx: Context, controller: DeepworkModeController, getSettings: DsmmSettingsGetter, config: Config, agent: DshAgent): void;
|
|
7
8
|
//# sourceMappingURL=mode.d.ts.map
|
package/lib/mode.js
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { agentForScope, nativeAgentContext } from "./native-scope.js";
|
|
1
|
+
import { agentScopeService } from "./native-scope.js";
|
|
3
2
|
import { buildDeepworkPrompt } from "./prompts.js";
|
|
4
3
|
import { resolveAdmittedDsmmRole } from "./role-policy.js";
|
|
5
4
|
const bindings = new WeakMap();
|
|
6
5
|
/** The admission installer owns scope selection; assembly reads the immutable Agent configuration. */
|
|
7
|
-
export function registerDeepworkPrompt(
|
|
8
|
-
const refresh = bindings.get(
|
|
6
|
+
export function registerDeepworkPrompt(ctx, controller, getSettings, config, agent) {
|
|
7
|
+
const refresh = bindings.get(ctx);
|
|
9
8
|
if (refresh) {
|
|
10
9
|
refresh();
|
|
11
10
|
return;
|
|
12
11
|
}
|
|
13
|
-
const ctx = nativeAgentContext(agent);
|
|
14
12
|
let dispose;
|
|
15
13
|
const reconcile = () => {
|
|
16
14
|
dispose?.();
|
|
17
|
-
const registry = ctx
|
|
15
|
+
const registry = agentScopeService(ctx, "systemPrompt");
|
|
18
16
|
if (!registry)
|
|
19
17
|
throw new Error("Deepwork requires the native system prompt service");
|
|
20
|
-
dispose =
|
|
18
|
+
dispose = registry.section({ name: "dsmm:deepwork", order: getSettings(agent).promptOrder, interpolate: false, text: "" });
|
|
21
19
|
};
|
|
22
20
|
// Native selection writes this step's variables on the return path of the waterfall.
|
|
23
21
|
const stopAssembly = ctx.on("system-prompt/assemble", async (_assembly, context, next) => {
|
|
24
22
|
const assembled = await next();
|
|
25
|
-
if (context.scope !== agent
|
|
23
|
+
if (context.scope !== agent)
|
|
26
24
|
return assembled;
|
|
27
25
|
if (context.signal?.aborted || getSettings.subagentRuntime?.().deliveryFenceReady === false)
|
|
28
26
|
return assembled;
|
|
@@ -44,10 +42,8 @@ export function registerDeepworkPrompt(readyCtx, controller, getSettings, config
|
|
|
44
42
|
}
|
|
45
43
|
return assembled;
|
|
46
44
|
}, { prepend: true });
|
|
47
|
-
bindings.set(
|
|
48
|
-
|
|
49
|
-
lifetime.addEventListener("abort", retire, { once: true });
|
|
50
|
-
ctx.effect(() => retire);
|
|
45
|
+
bindings.set(ctx, reconcile);
|
|
46
|
+
ctx.effect(() => () => { stopAssembly(); dispose?.(); bindings.delete(ctx); });
|
|
51
47
|
reconcile();
|
|
52
48
|
}
|
|
53
49
|
//# sourceMappingURL=mode.js.map
|
package/lib/model-routing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LlmError } from "@deepseek-ai/dsh-llm";
|
|
2
|
-
import {
|
|
2
|
+
import { isDsmmAwareLlmRuntime } from "./host-llm.js";
|
|
3
3
|
import { applyModelRoute, clearRoleRouteLock, currentRolePolicyState, currentRoleRouteLock, effectiveRoleFallbackRoutes, establishRolePolicy, hostModelSelection, latestModelSelectionSeq, latestNativeModelSelection, liveRolePolicyIdentity, nativeModelSelectionWasAccepted, orderedModelRoutes, persistedRoleRoute, pinRoleRoute, restoreRolePolicyAndLock, roleRouteLock, selectInitialModelRoute, selectInitialModelRouteChoice, selectModelRouteForNextStep, sameExactModelRoute, sameModelRoute, takeAdmittedRecoveryRoute } from "./role-routing.js";
|
|
4
4
|
import { childOwnedSessionEvents, sessionEvents } from "./session-scope.js";
|
|
5
5
|
import { isCurrentRecoveryStep } from "./recovery-policy.js";
|
|
@@ -27,7 +27,7 @@ export function registerModelRouting(ctx, controller, getSettings, agent) {
|
|
|
27
27
|
const assembledSelections = new WeakMap();
|
|
28
28
|
let dispose, disposeAgent, disposeAssembly, disposeFence;
|
|
29
29
|
try {
|
|
30
|
-
const owned = agent !== undefined && readyCtx.get?.("llm")
|
|
30
|
+
const owned = agent !== undefined && isDsmmAwareLlmRuntime(readyCtx.get?.("llm"));
|
|
31
31
|
let recovery;
|
|
32
32
|
registerRuntimeRecovery(readyCtx, controller, getSettings, prepare => { recovery = prepare; });
|
|
33
33
|
disposeAssembly = readyCtx.on("system-prompt/assemble", async (_assembly, context, next) => {
|
|
@@ -56,10 +56,12 @@ export declare class NativeAdmission {
|
|
|
56
56
|
private readonly admissionRouteFailures;
|
|
57
57
|
private readonly setupSelectionCursors;
|
|
58
58
|
private ready;
|
|
59
|
+
private readonly scopes;
|
|
59
60
|
private install?;
|
|
60
61
|
private admissionModelSelection?;
|
|
61
62
|
constructor(ctx: Context, profiles: DsmmProfileRuntime, policy: DsmmRolePolicy, configurationCommitted?: (agents: readonly Agent[]) => void);
|
|
62
63
|
activate(install: NonNullable<NativeAdmission["install"]>): void;
|
|
64
|
+
restoreResidentRoots(): Promise<void>;
|
|
63
65
|
/** Bind asynchronous metadata preparation; later lifecycle callbacks only install its immutable result. */
|
|
64
66
|
bindAdmissionModelSelection(hook: (agent: Agent, info: DsmmAdmissionRouteInfo) => Promise<DsmmPreparedAdmissionRoute | undefined>): void;
|
|
65
67
|
private callsFor;
|
package/lib/native-admission.js
CHANGED
|
@@ -7,6 +7,7 @@ import { SubagentError, delegationDepthOf, foldSubagentDescriptor } from "@deeps
|
|
|
7
7
|
import { freezeSettings } from "./settings.js";
|
|
8
8
|
import { invocationView } from "./role-invocation.js";
|
|
9
9
|
import { scopeLifetime } from "./lifetime.js";
|
|
10
|
+
import { assertResidentRootCurrent, captureResidentTool, guardResidentRealm, markResidentAgent, publishResidentAgent, restoreResidentRoot } from "./resident-root.js";
|
|
10
11
|
import { sessionEvents, childOwnedSessionEvents } from "./session-scope.js";
|
|
11
12
|
import { scopeParentOf, scopeOf } from "./native-scope.js";
|
|
12
13
|
import { bindNativeParent, nativeIsOwnedBy, nativeRoots, nativeTreeRoot } from "./native-ownership.js";
|
|
@@ -98,6 +99,7 @@ export class NativeAdmission {
|
|
|
98
99
|
admissionRouteFailures = new WeakMap();
|
|
99
100
|
setupSelectionCursors = new WeakMap();
|
|
100
101
|
ready = false;
|
|
102
|
+
scopes = new Map();
|
|
101
103
|
install;
|
|
102
104
|
admissionModelSelection;
|
|
103
105
|
constructor(ctx, profiles, policy, configurationCommitted = () => { }) {
|
|
@@ -119,6 +121,8 @@ export class NativeAdmission {
|
|
|
119
121
|
});
|
|
120
122
|
ctx.effect(() => async () => {
|
|
121
123
|
const results = await Promise.allSettled([...this.activations].map(activation => activation.dispose()));
|
|
124
|
+
const scopes = await Promise.allSettled([...this.scopes.values()].map(scope => scope.fiber.dispose()));
|
|
125
|
+
results.push(...scopes);
|
|
122
126
|
await Promise.allSettled(this.activities.keys());
|
|
123
127
|
const errors = results.flatMap(result => result.status === "rejected" ? [result.reason] : []);
|
|
124
128
|
if (errors.length)
|
|
@@ -180,10 +184,21 @@ export class NativeAdmission {
|
|
|
180
184
|
ctx.on("agent/request", async (frame, next) => { await this.guardExecution(frame.agent); return next(); }, { global: true, prepend: true });
|
|
181
185
|
ctx.on("tools/execute", async (exec, next) => {
|
|
182
186
|
const native = exec.agent && await this.guardExecution(exec.agent) === "native";
|
|
183
|
-
|
|
187
|
+
if (native)
|
|
188
|
+
return this.nativeToolExecution.run(exec.token, next);
|
|
189
|
+
const caller = exec.signal;
|
|
190
|
+
if (exec.agent)
|
|
191
|
+
exec.signal = AbortSignal.any([caller, this.lifetime.signal, this.agentLifetimes.get(exec.agent).signal]);
|
|
192
|
+
try {
|
|
193
|
+
return await this.nativeToolExecution.run(exec.token, () => policy.duringToolExecution(exec, next));
|
|
194
|
+
}
|
|
195
|
+
finally {
|
|
196
|
+
exec.signal = caller;
|
|
197
|
+
}
|
|
184
198
|
}, { global: true, prepend: true });
|
|
185
199
|
ctx.on("tools/pre-execute", async (exec, next) => {
|
|
186
200
|
if (exec.agent) {
|
|
201
|
+
captureResidentTool(exec.agent, this, exec.token);
|
|
187
202
|
this.trackExecution(exec);
|
|
188
203
|
await this.guardExecution(exec.agent);
|
|
189
204
|
this.beginNativeToolObservation(exec);
|
|
@@ -209,6 +224,30 @@ export class NativeAdmission {
|
|
|
209
224
|
this.install = install;
|
|
210
225
|
this.ready = true;
|
|
211
226
|
}
|
|
227
|
+
async restoreResidentRoots() {
|
|
228
|
+
if (this.ctx.fiber.state === 1) {
|
|
229
|
+
// Own services become visible on ACTIVE, after the apply callback returns.
|
|
230
|
+
// Claim idle roots' native maintenance slots in that same status dispatch.
|
|
231
|
+
const detach = this.ctx.on("internal/status", fiber => {
|
|
232
|
+
if (fiber.ctx !== this.ctx.fiber.ctx || fiber.state !== 2)
|
|
233
|
+
return;
|
|
234
|
+
detach();
|
|
235
|
+
return this.restoreResidentRoots();
|
|
236
|
+
}, { global: true });
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (!this.isReady)
|
|
240
|
+
throw new SubagentError("DSMM owner is not ready for resident admission", "UNAUTHORIZED");
|
|
241
|
+
await Promise.all(nativeRoots(this.ctx.agents).map(async (agent) => {
|
|
242
|
+
try {
|
|
243
|
+
await restoreResidentRoot(agent, this, signal => this.created(agent, "startup", signal, true));
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
if (!this.lifetime.signal.aborted)
|
|
247
|
+
this.ctx.logger.warn("Resident root %s remains revoked: %s", agent.id, error);
|
|
248
|
+
}
|
|
249
|
+
}));
|
|
250
|
+
}
|
|
212
251
|
/** Bind asynchronous metadata preparation; later lifecycle callbacks only install its immutable result. */
|
|
213
252
|
bindAdmissionModelSelection(hook) {
|
|
214
253
|
this.admissionModelSelection = hook;
|
|
@@ -577,6 +616,7 @@ export class NativeAdmission {
|
|
|
577
616
|
/** Exact process-local capture, retained after retirement so stale objects never become native. */
|
|
578
617
|
owns(agent) { return this.agentLifetimes.has(agent); }
|
|
579
618
|
async guardExecution(agent) {
|
|
619
|
+
assertResidentRootCurrent(agent, this);
|
|
580
620
|
await this.awaitingPublication.get(agent)?.promise;
|
|
581
621
|
if (!this.owns(agent)) {
|
|
582
622
|
const registry = agent.ctx.get("agents");
|
|
@@ -741,7 +781,7 @@ export class NativeAdmission {
|
|
|
741
781
|
}
|
|
742
782
|
}
|
|
743
783
|
};
|
|
744
|
-
const install = (admission) => this.installing.run({ agent, admission }, () => this.install(agent, this.getter(agent)));
|
|
784
|
+
const install = (admission) => this.installing.run({ agent, admission }, () => this.install(agent, this.getter(agent), this.scopes.get(agent)));
|
|
745
785
|
return {
|
|
746
786
|
assertCurrent,
|
|
747
787
|
prepare: async (admission, describe) => {
|
|
@@ -935,7 +975,7 @@ export class NativeAdmission {
|
|
|
935
975
|
if (this.lifetime.signal.aborted)
|
|
936
976
|
void activation.dispose().catch(error => this.ctx.logger.error(error));
|
|
937
977
|
}
|
|
938
|
-
guardTools(agent) {
|
|
978
|
+
guardTools(agent, scope) {
|
|
939
979
|
const tools = agent.ctx.get("agentPresets")?.serviceFor(agent, "tools") ?? agent.ctx.get("tools");
|
|
940
980
|
if (!tools)
|
|
941
981
|
return;
|
|
@@ -944,7 +984,7 @@ export class NativeAdmission {
|
|
|
944
984
|
return;
|
|
945
985
|
installed.add(identity);
|
|
946
986
|
this.guardedTools.set(agent, installed);
|
|
947
|
-
getTraceable(
|
|
987
|
+
getTraceable(scope, tools).guard(exec => {
|
|
948
988
|
if (exec.agent !== agent)
|
|
949
989
|
return;
|
|
950
990
|
this.assert(agent);
|
|
@@ -988,20 +1028,23 @@ export class NativeAdmission {
|
|
|
988
1028
|
return;
|
|
989
1029
|
if (this.selecting.has(agent))
|
|
990
1030
|
throw new SubagentError("Session configuration maintenance owns the blank composition", "UNAUTHORIZED");
|
|
991
|
-
if (previous.parent || (this.calls.get(agent) ?? 0) !== 0 || [...this.pending.values()].some(row => row.parent === agent)
|
|
1031
|
+
if (previous.parent || previous.owner || (this.calls.get(agent) ?? 0) !== 0 || [...this.pending.values()].some(row => row.parent === agent)
|
|
992
1032
|
|| this.ctx.agents.list().some(child => nativeIsOwnedBy(this.ctx.agents, child.id, agent)) || sessionEvents(agent.session).some(event => event.type === "turn/start"))
|
|
993
1033
|
throw new SubagentError("Preset change requires a new session", "UNAUTHORIZED");
|
|
994
1034
|
this.policy.validateRootRole(agent, previous.admission);
|
|
995
1035
|
const preset = agent.ctx.get("agentPresets")?.composedPreset(agent.ctx), scopeParent = scopeParentOf(agent);
|
|
996
|
-
this.
|
|
997
|
-
|
|
1036
|
+
const scope = this.scopes.get(agent);
|
|
1037
|
+
guardResidentRealm(agent);
|
|
1038
|
+
this.guardTools(agent, scope);
|
|
1039
|
+
await this.install(agent, this.getter(agent), scope);
|
|
998
1040
|
this.lifetime.signal.throwIfAborted();
|
|
999
1041
|
this.agentLifetimes.get(agent).signal.throwIfAborted();
|
|
1000
1042
|
if (!this.isReady || this.ctx.agents.get(agent.id) !== agent || this.live.get(agent) !== previous || scopeParentOf(agent) !== scopeParent)
|
|
1001
1043
|
throw new SubagentError("Composition changed during blank admission", "UNAUTHORIZED");
|
|
1002
1044
|
this.live.set(agent, Object.freeze({ ...previous, preset, scopeParent, dependencies: this.dependencies(agent) }));
|
|
1045
|
+
publishResidentAgent(agent, this);
|
|
1003
1046
|
}
|
|
1004
|
-
async created(agent, source, creationSignal) {
|
|
1047
|
+
async created(agent, source, creationSignal, restoring = false) {
|
|
1005
1048
|
if (this.owns(agent)) {
|
|
1006
1049
|
this.assert(agent);
|
|
1007
1050
|
return;
|
|
@@ -1040,16 +1083,26 @@ export class NativeAdmission {
|
|
|
1040
1083
|
throw new SubagentError("Delegation ceiling identity mismatch", "UNAUTHORIZED");
|
|
1041
1084
|
if (!parent && !owner && (!nativeRoots(this.ctx.agents).includes(agent) || agent.session.header.origin === "subagent" || descriptor !== undefined))
|
|
1042
1085
|
throw new SubagentError("Child requires its native creator or ceiling", "UNAUTHORIZED");
|
|
1086
|
+
const isRoot = !owner && !parent;
|
|
1087
|
+
if (restoring && !isRoot)
|
|
1088
|
+
throw new SubagentError("Resident root ownership changed", "UNAUTHORIZED");
|
|
1043
1089
|
if (owner)
|
|
1044
1090
|
this.assert(owner);
|
|
1091
|
+
if (restoring)
|
|
1092
|
+
guardResidentRealm(agent);
|
|
1093
|
+
else
|
|
1094
|
+
markResidentAgent(agent, this, isRoot);
|
|
1095
|
+
const scope = agent.ctx.plugin(function dsmmAgentGeneration() { }).ctx;
|
|
1096
|
+
this.scopes.set(agent, scope);
|
|
1045
1097
|
this.agentLifetimes.set(agent, new AbortController());
|
|
1046
1098
|
signal = AbortSignal.any([signal, this.agentLifetimes.get(agent).signal, ...owner ? [this.agentLifetimes.get(owner).signal] : []]);
|
|
1047
|
-
scopeLifetime(
|
|
1048
|
-
|
|
1099
|
+
scopeLifetime(scope, "dsmm: retire exact Agent work", () => { void this.retireAgent(agent).catch(() => { }); });
|
|
1100
|
+
scope.effect(() => async () => {
|
|
1049
1101
|
try {
|
|
1050
1102
|
await this.retireAgent(agent);
|
|
1051
1103
|
}
|
|
1052
1104
|
finally {
|
|
1105
|
+
this.scopes.delete(agent);
|
|
1053
1106
|
this.live.delete(agent);
|
|
1054
1107
|
this.candidates.delete(agent);
|
|
1055
1108
|
this.admissionRoutes.delete(agent);
|
|
@@ -1068,6 +1121,7 @@ export class NativeAdmission {
|
|
|
1068
1121
|
if (!this.isReady || this.ctx.agents.get(agent.id) !== agent || this.ctx.get("sessions")?.get(agent.id) !== agent.session
|
|
1069
1122
|
|| scopeOf(agent.ctx) !== agent || original(agent.ctx.get("agents")) !== original(this.ctx.agents)
|
|
1070
1123
|
|| this.dependencies(agent).some((value, index) => value !== dependencies[index]) || scopeParentOf(agent) !== presetScope || preset !== agent.ctx.get("agentPresets")?.composedPreset(agent.ctx)
|
|
1124
|
+
|| isRoot && !nativeRoots(this.ctx.agents).includes(agent)
|
|
1071
1125
|
|| owner && (this.assert(owner) !== ownerAdmission || (root === undefined ? !nativeIsOwnedBy(this.ctx.agents, agent.id, owner) : nativeTreeRoot(this.ctx.agents, agent) !== owner))
|
|
1072
1126
|
|| pending && parent && (this.assert(parent) !== parentAdmission || !nativeIsOwnedBy(this.ctx.agents, agent.id, parent)))
|
|
1073
1127
|
throw new SubagentError("Activation owner changed", "UNAUTHORIZED");
|
|
@@ -1177,12 +1231,7 @@ export class NativeAdmission {
|
|
|
1177
1231
|
}
|
|
1178
1232
|
this.candidates.set(agent, admission);
|
|
1179
1233
|
this.agents.add(agent);
|
|
1180
|
-
|
|
1181
|
-
agent.ctx.on("agent/pre-step", async (frame, next) => { if (frame.agent === agent)
|
|
1182
|
-
await this.ensure(agent); return next(); }, { prepend: true });
|
|
1183
|
-
agent.ctx.on("agent/request", async (frame, next) => { if (frame.agent === agent)
|
|
1184
|
-
await this.ensure(agent); return next(); }, { prepend: true });
|
|
1185
|
-
this.guardTools(agent);
|
|
1234
|
+
this.guardTools(agent, scope);
|
|
1186
1235
|
try {
|
|
1187
1236
|
if (pending)
|
|
1188
1237
|
this.policy.bindChild(agent, parent, admission, pending.invocation, pending.maxDepth, pending.toolFilter);
|
|
@@ -1202,7 +1251,7 @@ export class NativeAdmission {
|
|
|
1202
1251
|
provider: descriptor.provider, ...(pending ? { role: pending.invocation.target, level: pending.invocation.effectiveLevel } : { role: null, level: null }),
|
|
1203
1252
|
profileId: admission.profile?.id ?? null, ...this.policy.delegationCeiling(agent) });
|
|
1204
1253
|
}
|
|
1205
|
-
await this.install(agent, this.getter(agent));
|
|
1254
|
+
await this.install(agent, this.getter(agent), scope);
|
|
1206
1255
|
check();
|
|
1207
1256
|
await this.profiles.revalidateActivation(admission);
|
|
1208
1257
|
check();
|
|
@@ -1211,13 +1260,17 @@ export class NativeAdmission {
|
|
|
1211
1260
|
if (continuationProvider && this.ctx.get("subagents").getProvider(continuationProvider.name) !== continuationProvider)
|
|
1212
1261
|
throw new SubagentError("Role provider changed", "UNAUTHORIZED");
|
|
1213
1262
|
// Occupancy precedes the installed guards' async policy and approval work.
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1263
|
+
scope.on("tools/pre-execute", async (exec, next) => {
|
|
1264
|
+
if (exec.agent === agent) {
|
|
1265
|
+
captureResidentTool(agent, this, exec.token);
|
|
1266
|
+
this.trackExecution(exec);
|
|
1267
|
+
await this.ensure(agent);
|
|
1268
|
+
const denial = this.policy.preToolDenial(agent, exec.name, undefined, exec);
|
|
1269
|
+
if (denial)
|
|
1270
|
+
return { kind: "deny", reason: denial };
|
|
1271
|
+
}
|
|
1272
|
+
return next();
|
|
1273
|
+
}, { prepend: true });
|
|
1221
1274
|
const routeCandidate = await this.admissionModelSelection?.(agent, {
|
|
1222
1275
|
settings: admission.settings, epoch: admission.epoch, admission, signal, assertCurrent: check,
|
|
1223
1276
|
});
|
|
@@ -1231,15 +1284,18 @@ export class NativeAdmission {
|
|
|
1231
1284
|
const published = this.profiles.admission(agent);
|
|
1232
1285
|
this.live.set(agent, Object.freeze({ admission: published, preset, scopeParent: scopeParentOf(agent), parent, owner, creatorId: agent.session.header.parentSession,
|
|
1233
1286
|
invocation: pending?.invocation ?? continuation, dependencies, provider: pending?.provider ?? continuationProvider }));
|
|
1287
|
+
publishResidentAgent(agent, this);
|
|
1234
1288
|
if (pending) {
|
|
1235
1289
|
this.bindObservedChild(pending.observation, agent, published);
|
|
1236
1290
|
this.pending.delete(agent.id);
|
|
1237
1291
|
}
|
|
1238
1292
|
}
|
|
1239
1293
|
catch (error) {
|
|
1294
|
+
this.failedInstallations.add(agent);
|
|
1240
1295
|
this.admissionRoutes.delete(agent);
|
|
1241
1296
|
this.admissionRouteFailures.delete(agent);
|
|
1242
1297
|
this.policy.release(agent);
|
|
1298
|
+
await scope.fiber.dispose();
|
|
1243
1299
|
throw error;
|
|
1244
1300
|
}
|
|
1245
1301
|
finally {
|
package/lib/native-pi-ai-wire.js
CHANGED
|
@@ -7,7 +7,7 @@ import { getBuiltinModels, getBuiltinProviders } from "@earendil-works/pi-ai/pro
|
|
|
7
7
|
import { buildBaseOptions } from "@earendil-works/pi-ai/api/simple-options";
|
|
8
8
|
import { LlmError, ReasoningEffortId, assertUsableApiKey, attributionHeaders, freezeMessage, resolveImageAttachmentAccess, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
|
|
9
9
|
import { singleUsePreparedStream, snapshotDsmmCall } from "./host-llm.js";
|
|
10
|
-
import { DsmmMissingProviderError, modelRouteToCall } from "./role-llm.js";
|
|
10
|
+
import { DsmmMissingProviderError, isMissingProviderError, modelRouteToCall } from "./role-llm.js";
|
|
11
11
|
import { normalizeModelRouteJson } from "./route-json.js";
|
|
12
12
|
function imageOffloadProfileFields(profile) {
|
|
13
13
|
const extended = profile;
|
|
@@ -215,7 +215,7 @@ export function createDsmmPiAiProviderOwner(ctx, options, borrowed) {
|
|
|
215
215
|
const models = createModels(options.auth);
|
|
216
216
|
for (const profile of profiles.values())
|
|
217
217
|
models.setProvider(profile.piProvider);
|
|
218
|
-
const owner = Object.freeze({ stockAdapter, providers,
|
|
218
|
+
const owner = Object.freeze({ stockAdapter, providers, isMissingProviderError,
|
|
219
219
|
requiresRaw: (config) => config.customParameters !== undefined || config.stop !== undefined && profiles.has(config.provider),
|
|
220
220
|
supportsNativeStop: (provider) => !profiles.has(provider),
|
|
221
221
|
async resolveRoute(input, signal) {
|
package/lib/native-scope.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
-
import type { DshAgent,
|
|
2
|
+
import type { DshAgent, DshSystemPromptContext } from "./dsh-types.js";
|
|
3
3
|
type NativeScopeKey = NonNullable<DshSystemPromptContext["scope"]>;
|
|
4
4
|
export declare const scopeOf: (ctx: Context) => NativeScopeKey | undefined, scopeParentOf: (key: NativeScopeKey) => NativeScopeKey | undefined;
|
|
5
5
|
export declare function nativeAgentContext(agent: DshAgent): Context;
|
|
6
|
-
/**
|
|
7
|
-
export declare function
|
|
6
|
+
/** Select the retained preset's implementation, but register effects on the caller's Agent layer. */
|
|
7
|
+
export declare function agentScopeService<K extends "systemPrompt" | "skills" | "tools">(ctx: Context, name: K): Context[K] | undefined;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=native-scope.d.ts.map
|
package/lib/native-scope.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context } from "@deepseek-ai/cordis";
|
|
1
|
+
import { Context, getTraceable, symbols } from "@deepseek-ai/cordis";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
// Resolve through the declared SDK peer, not a developer/global installation.
|
|
4
4
|
const require = createRequire(import.meta.url);
|
|
@@ -11,10 +11,9 @@ export function nativeAgentContext(agent) {
|
|
|
11
11
|
}
|
|
12
12
|
return agent.ctx;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
export function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return ctx.get?.("agents")?.list().find((agent) => agent === key);
|
|
14
|
+
/** Select the retained preset's implementation, but register effects on the caller's Agent layer. */
|
|
15
|
+
export function agentScopeService(ctx, name) {
|
|
16
|
+
const preset = ctx.get("agentPresets")?.serviceFor({ ctx }, name);
|
|
17
|
+
return preset === undefined ? ctx.get(name) : getTraceable(ctx, Reflect.get(preset, symbols.original) ?? preset);
|
|
19
18
|
}
|
|
20
19
|
//# sourceMappingURL=native-scope.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import type { PermissionControlSettings } from "./permission-settings.js";
|
|
3
|
+
export declare const nativeCommandMatchSchema: z<Schemastery.ObjectS<NoInfer<{
|
|
4
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
5
|
+
workingDirectory: z<string, string, "defined">;
|
|
6
|
+
commandPattern: z<string, string, "defined">;
|
|
7
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
8
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
9
|
+
workingDirectory: z<string, string, "defined">;
|
|
10
|
+
commandPattern: z<string, string, "defined">;
|
|
11
|
+
}>>, "defined">;
|
|
12
|
+
export declare const nativeCommandEntrySchema: z<Schemastery.ObjectS<NoInfer<{
|
|
13
|
+
id: z<string, string, "defined">;
|
|
14
|
+
mode: z<"allow" | "ask", "allow" | "ask", "defined">;
|
|
15
|
+
match: z<Schemastery.ObjectS<NoInfer<{
|
|
16
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
17
|
+
workingDirectory: z<string, string, "defined">;
|
|
18
|
+
commandPattern: z<string, string, "defined">;
|
|
19
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
20
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
21
|
+
workingDirectory: z<string, string, "defined">;
|
|
22
|
+
commandPattern: z<string, string, "defined">;
|
|
23
|
+
}>>, "defined">;
|
|
24
|
+
sandboxMode: z<"workspace-write" | "danger-full-access", "workspace-write" | "danger-full-access", "defined">;
|
|
25
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
26
|
+
id: z<string, string, "defined">;
|
|
27
|
+
mode: z<"allow" | "ask", "allow" | "ask", "defined">;
|
|
28
|
+
match: z<Schemastery.ObjectS<NoInfer<{
|
|
29
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
30
|
+
workingDirectory: z<string, string, "defined">;
|
|
31
|
+
commandPattern: z<string, string, "defined">;
|
|
32
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
33
|
+
tool: z<"bash" | "pwsh", "bash" | "pwsh", "defined">;
|
|
34
|
+
workingDirectory: z<string, string, "defined">;
|
|
35
|
+
commandPattern: z<string, string, "defined">;
|
|
36
|
+
}>>, "defined">;
|
|
37
|
+
sandboxMode: z<"workspace-write" | "danger-full-access", "workspace-write" | "danger-full-access", "defined">;
|
|
38
|
+
}>>, "defined">;
|
|
39
|
+
export declare const permissionControlSchema: z<PermissionControlSettings>;
|
|
40
|
+
//# sourceMappingURL=permission-schema.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { parseNativeCommands } from "./permission-settings.js";
|
|
3
|
+
import { parsePermissionRules } from "./permission-rules.js";
|
|
4
|
+
export const nativeCommandMatchSchema = z.object({ tool: z.union(["bash", "pwsh"]).required(), workingDirectory: z.string().required(), commandPattern: z.string().required() }).required();
|
|
5
|
+
export const nativeCommandEntrySchema = z.object({
|
|
6
|
+
id: z.string().required(), mode: z.union(["ask", "allow"]).required(), match: nativeCommandMatchSchema, sandboxMode: z.union(["workspace-write", "danger-full-access"]).required(),
|
|
7
|
+
}).required();
|
|
8
|
+
const nativeCommands = z.object({ enabled: z.boolean().default(false), entries: z.array(z.union([z.string(), nativeCommandEntrySchema])).default([]) });
|
|
9
|
+
const action = () => z.union(["inherit", "allow", "ask", "deny"]).default("inherit");
|
|
10
|
+
const web = () => z.object({ enabled: z.boolean().default(true), rule: action() }).default({});
|
|
11
|
+
export const permissionControlSchema = z.transform(z.object({ enabled: z.boolean().default(true), outsideReads: action(), webSearch: web(), webFetch: web(),
|
|
12
|
+
nativeCommands, rules: z.array(z.any()).default([]) }), input => Object.freeze({ ...input, webSearch: Object.freeze(input.webSearch), webFetch: Object.freeze(input.webFetch), rules: parsePermissionRules(input.rules), nativeCommands: parseNativeCommands(input.nativeCommands) }), true);
|
|
13
|
+
//# sourceMappingURL=permission-schema.js.map
|