@deepstrike/sdk 0.2.5 → 0.2.6
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 +19 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/kernel.d.ts +43 -0
- package/dist/memory/agent.d.ts +2 -47
- package/dist/runtime/os-profile.d.ts +12 -0
- package/dist/runtime/os-profile.js +24 -0
- package/dist/runtime/runner.d.ts +20 -3
- package/dist/runtime/runner.js +41 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -222,6 +222,23 @@ const runner = new RuntimeRunner({
|
|
|
222
222
|
timeoutMs: 60_000,
|
|
223
223
|
schedulerBudget: { maxWallMs: 300_000 },
|
|
224
224
|
|
|
225
|
+
// Resource quotas (M2) — enforced at the kernel syscall trap. Opt-in; omit for unbounded.
|
|
226
|
+
resourceQuota: {
|
|
227
|
+
maxConcurrentSubagents: 4, // deny spawn while at cap
|
|
228
|
+
maxSpawnDepth: 2, // deny spawn past nesting depth
|
|
229
|
+
memoryWritesPerWindow: { maxWrites: 20, windowMs: 60_000 }, // rate-limit writeMemory
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
// Long-term memory policy (set_memory_policy) — opt-in, kernel-enforced; omit for defaults.
|
|
233
|
+
memoryPolicy: {
|
|
234
|
+
memoryPath: "./.memory", // where the SDK persists/scans memories (SDK-consumed)
|
|
235
|
+
staleWarningDays: 30, // flag recalled memories older than this (SDK-consumed)
|
|
236
|
+
retrievalTopK: 5, // kernel caps query_memory requested_k to this
|
|
237
|
+
validationEnabled: true, // false → admit writes without validation
|
|
238
|
+
maxContentBytes: 10_000, // override write_memory content-size limit
|
|
239
|
+
maxNameLength: 100, // override write_memory name-length limit
|
|
240
|
+
},
|
|
241
|
+
|
|
225
242
|
// Agent OS native profile (defaults shown)
|
|
226
243
|
governancePolicy: DEFAULT_NATIVE_GOVERNANCE_POLICY,
|
|
227
244
|
attentionPolicy: DEFAULT_NATIVE_ATTENTION_POLICY, // SignalRouter queue size 64
|
|
@@ -260,6 +277,8 @@ const runner = new RuntimeRunner({
|
|
|
260
277
|
|--------|---------|
|
|
261
278
|
| `governancePolicy` | Declarative deny / ask_user / rate-limit / param rules loaded into the kernel before `start_run` |
|
|
262
279
|
| `attentionPolicy` | In-kernel signal router queue size (default 64) |
|
|
280
|
+
| `resourceQuota` | M2 declarative limits — `maxConcurrentSubagents` / `maxSpawnDepth` / `memoryWritesPerWindow` — enforced at the kernel syscall trap (`set_resource_quota`); over-quota spawns roll back, over-rate writes surface as `memory_validation_failed` |
|
|
281
|
+
| `memoryPolicy` | Long-term memory config sent as `set_memory_policy` and **kernel-enforced**: `validationEnabled: false` admits writes without validation, `maxContentBytes` / `maxNameLength` override validation limits, `retrievalTopK` caps `query_memory` breadth; `memoryPath` / `staleWarningDays` are SDK-consumed (requires `dreamStore` + `agentId` to enable memory) |
|
|
263
282
|
| `onPermissionRequest` | Resolves `tool_gated` + `suspended` → kernel `resume` with approved/denied call IDs |
|
|
264
283
|
| `compressionStore` | Writes archived messages on `compressed` observations |
|
|
265
284
|
| `asyncSummarizer` | Background LLM summary after compression; stored as `summary_upgraded` |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { RuntimeRunner, collectText } from "./runtime/runner.js";
|
|
2
|
-
export type { RuntimeOptions } from "./runtime/runner.js";
|
|
2
|
+
export type { RuntimeOptions, SchedulerBudget } from "./runtime/runner.js";
|
|
3
|
+
export type { MemoryPolicy, MemoryWriteRateLimit, ResourceQuota } from "./kernel.js";
|
|
3
4
|
export { KernelPrimitivesDashboard } from "./runtime/kernel-primitives-dashboard.js";
|
|
4
5
|
export { FilteredExecutionPlane } from "./runtime/filtered-plane.js";
|
|
5
6
|
export { SubAgentOrchestrator, defaultSubAgentOrchestrator, spawnStandalone } from "./runtime/sub-agent-orchestrator.js";
|
|
@@ -8,7 +9,8 @@ export { LocalExecutionPlane } from "./runtime/execution-plane.js";
|
|
|
8
9
|
export type { ExecutionPlane, RunContext } from "./runtime/execution-plane.js";
|
|
9
10
|
export { InMemorySessionLog, FileSessionLog } from "./runtime/session-log.js";
|
|
10
11
|
export type { SessionLog, SessionEvent } from "./runtime/session-log.js";
|
|
11
|
-
export { DEFAULT_NATIVE_ATTENTION_POLICY, DEFAULT_NATIVE_GOVERNANCE_POLICY, } from "./runtime/os-profile.js";
|
|
12
|
+
export { DEFAULT_NATIVE_ATTENTION_POLICY, DEFAULT_NATIVE_GOVERNANCE_POLICY, assertNativeProfile, osProfile, } from "./runtime/os-profile.js";
|
|
13
|
+
export type { NativeOsProfile, OsProfileId } from "./runtime/os-profile.js";
|
|
12
14
|
export { rebuildOsSnapshotFromSessionEvents, sessionLogHasRequiredCategories, } from "./runtime/os-snapshot.js";
|
|
13
15
|
export type { OsSnapshot } from "./runtime/os-snapshot.js";
|
|
14
16
|
export { categoryForKind, kernelObservationToSessionEvent } from "./runtime/kernel-event-log.js";
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { FilteredExecutionPlane } from "./runtime/filtered-plane.js";
|
|
|
5
5
|
export { SubAgentOrchestrator, defaultSubAgentOrchestrator, spawnStandalone } from "./runtime/sub-agent-orchestrator.js";
|
|
6
6
|
export { LocalExecutionPlane } from "./runtime/execution-plane.js";
|
|
7
7
|
export { InMemorySessionLog, FileSessionLog } from "./runtime/session-log.js";
|
|
8
|
-
export { DEFAULT_NATIVE_ATTENTION_POLICY, DEFAULT_NATIVE_GOVERNANCE_POLICY, } from "./runtime/os-profile.js";
|
|
8
|
+
export { DEFAULT_NATIVE_ATTENTION_POLICY, DEFAULT_NATIVE_GOVERNANCE_POLICY, assertNativeProfile, osProfile, } from "./runtime/os-profile.js";
|
|
9
9
|
export { rebuildOsSnapshotFromSessionEvents, sessionLogHasRequiredCategories, } from "./runtime/os-snapshot.js";
|
|
10
10
|
export { categoryForKind, kernelObservationToSessionEvent } from "./runtime/kernel-event-log.js";
|
|
11
11
|
export { NullArchiveStore, FileArchiveStore } from "./runtime/archive.js";
|
package/dist/kernel.d.ts
CHANGED
|
@@ -4,6 +4,49 @@ export interface GovernanceVerdict {
|
|
|
4
4
|
reason?: string;
|
|
5
5
|
retryAfterMs?: number;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* M2 资源配额 — declarative resource limits enforced at the kernel's single syscall trap.
|
|
9
|
+
*
|
|
10
|
+
* Installed through the versioned JSON event ABI (`set_resource_quota`), not a side-channel
|
|
11
|
+
* setter, so quota config is replayable and session-loggable like governance/scheduler config.
|
|
12
|
+
* Every field is optional; an omitted field imposes no limit, and omitting the quota entirely
|
|
13
|
+
* preserves the pre-M2 behavior of admitting all spawn / memory-write syscalls.
|
|
14
|
+
*/
|
|
15
|
+
export interface MemoryWriteRateLimit {
|
|
16
|
+
maxWrites: number;
|
|
17
|
+
windowMs: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ResourceQuota {
|
|
20
|
+
/** Max sub-agents in the `running` state at once; further spawns are denied while at cap. */
|
|
21
|
+
maxConcurrentSubagents?: number;
|
|
22
|
+
/** Max sub-agent nesting depth (direct children of the root loop are depth 1). */
|
|
23
|
+
maxSpawnDepth?: number;
|
|
24
|
+
/** Rolling-window memory-write rate limit: at most `maxWrites` per any `windowMs` span. */
|
|
25
|
+
memoryWritesPerWindow?: MemoryWriteRateLimit;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Long-term memory policy — declarative knobs for the kernel's memory subsystem.
|
|
29
|
+
*
|
|
30
|
+
* Installed through the versioned JSON event ABI (`set_memory_policy`), the same channel as
|
|
31
|
+
* governance / scheduler / quota config, so memory configuration is replayable and
|
|
32
|
+
* session-loggable rather than a side-channel setter. Installing the policy is opt-in and
|
|
33
|
+
* kernel-enforced; omitted fields fall back to the kernel defaults (empty path, 2-day stale
|
|
34
|
+
* warning, top-5 retrieval, validation on). Enabling memory is still `dreamStore` + `agentId`.
|
|
35
|
+
*/
|
|
36
|
+
export interface MemoryPolicy {
|
|
37
|
+
/** Filesystem root the SDK uses to persist/scan memories; carried for SDK recall I/O. */
|
|
38
|
+
memoryPath?: string;
|
|
39
|
+
/** Age after which a recalled memory is flagged stale (days); consumed SDK-side. */
|
|
40
|
+
staleWarningDays?: number;
|
|
41
|
+
/** Upper bound on retrieval breadth: the kernel clamps `query_memory` top-k to this. */
|
|
42
|
+
retrievalTopK?: number;
|
|
43
|
+
/** When false, the kernel admits every `write_memory` without validation. */
|
|
44
|
+
validationEnabled?: boolean;
|
|
45
|
+
/** Override the kernel's `write_memory` content-size limit (bytes). */
|
|
46
|
+
maxContentBytes?: number;
|
|
47
|
+
/** Override the kernel's `write_memory` name-length limit. */
|
|
48
|
+
maxNameLength?: number;
|
|
49
|
+
}
|
|
7
50
|
export interface GovernanceInstance {
|
|
8
51
|
setIdentity(agentId: string, sessionId: string): void;
|
|
9
52
|
addPermissionRule(pattern: string, action: "allow" | "deny" | "ask_user"): void;
|
package/dist/memory/agent.d.ts
CHANGED
|
@@ -10,53 +10,8 @@
|
|
|
10
10
|
* - SDK performs I/O and selection
|
|
11
11
|
* - LLM (Sonnet) acts as selector, not vector similarity
|
|
12
12
|
*/
|
|
13
|
-
import type { SessionData, MemoryEntry } from "./protocols.js";
|
|
14
|
-
|
|
15
|
-
* Memory metadata (matches kernel MemoryMetadata structure).
|
|
16
|
-
*/
|
|
17
|
-
export interface MemoryMetadata {
|
|
18
|
-
name: string;
|
|
19
|
-
description: string;
|
|
20
|
-
kind?: MemoryKind;
|
|
21
|
-
created_at: number;
|
|
22
|
-
updated_at: number;
|
|
23
|
-
session_id?: string;
|
|
24
|
-
user_role?: string;
|
|
25
|
-
expertise_level?: string;
|
|
26
|
-
preference_rule?: string;
|
|
27
|
-
approved_pattern?: string;
|
|
28
|
-
project_phase?: string;
|
|
29
|
-
relative_date?: string;
|
|
30
|
-
external_url?: string;
|
|
31
|
-
ticket_ref?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Memory kind (4 types, mirroring Claude Code).
|
|
35
|
-
*/
|
|
36
|
-
export type MemoryKind = "user" | "feedback" | "project" | "reference";
|
|
37
|
-
/**
|
|
38
|
-
* Memory write request (SDK → kernel).
|
|
39
|
-
*/
|
|
40
|
-
export interface MemoryWriteRequest {
|
|
41
|
-
metadata: MemoryMetadata;
|
|
42
|
-
content: string;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Memory query request (kernel → SDK).
|
|
46
|
-
*/
|
|
47
|
-
export interface MemoryQuery {
|
|
48
|
-
current_context: string;
|
|
49
|
-
active_tools: string[];
|
|
50
|
-
already_surfaced: string[];
|
|
51
|
-
top_k: number;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Memory retrieval response (SDK → kernel).
|
|
55
|
-
*/
|
|
56
|
-
export interface MemoryRetrieval {
|
|
57
|
-
selected_memory_ids: string[];
|
|
58
|
-
selection_rationale: string;
|
|
59
|
-
}
|
|
13
|
+
import type { SessionData, MemoryEntry, MemoryKind, MemoryMetadata, MemoryWriteRequest, MemoryQuery, MemoryRetrieval } from "./protocols.js";
|
|
14
|
+
export type { MemoryKind, MemoryMetadata, MemoryWriteRequest, MemoryQuery, MemoryRetrieval, } from "./protocols.js";
|
|
60
15
|
/**
|
|
61
16
|
* Memory index entry (from MEMORY.md).
|
|
62
17
|
*/
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { GovernancePolicy } from "../governance.js";
|
|
2
|
+
export type OsProfileId = "native";
|
|
3
|
+
export interface NativeOsProfile {
|
|
4
|
+
id: OsProfileId;
|
|
5
|
+
attentionPolicy: {
|
|
6
|
+
maxQueueSize?: number;
|
|
7
|
+
};
|
|
8
|
+
governancePolicy: GovernancePolicy;
|
|
9
|
+
}
|
|
2
10
|
/** Default attention policy for native profile smoke tests. */
|
|
3
11
|
export declare const DEFAULT_NATIVE_ATTENTION_POLICY: {
|
|
4
12
|
maxQueueSize: number;
|
|
@@ -7,6 +15,10 @@ export declare const DEFAULT_NATIVE_ATTENTION_POLICY: {
|
|
|
7
15
|
export declare const DEFAULT_NATIVE_GOVERNANCE_POLICY: GovernancePolicy;
|
|
8
16
|
/** Default restrictive sandbox policy template requiring confirmation for modification/execution. */
|
|
9
17
|
export declare const DEFAULT_SANDBOX_POLICY: GovernancePolicy;
|
|
18
|
+
/** Resolve a named OS profile into concrete kernel-owned policy defaults. */
|
|
19
|
+
export declare function osProfile(profile?: OsProfileId | NativeOsProfile): NativeOsProfile;
|
|
20
|
+
/** Assert that a runtime is using a valid native microkernel policy profile. */
|
|
21
|
+
export declare function assertNativeProfile(profile?: OsProfileId | NativeOsProfile): NativeOsProfile;
|
|
10
22
|
/**
|
|
11
23
|
* Validates the declarative policies statically to prevent runtime crashes when loaded into the microkernel.
|
|
12
24
|
*/
|
|
@@ -13,6 +13,30 @@ export const DEFAULT_SANDBOX_POLICY = {
|
|
|
13
13
|
{ pattern: "*", action: "deny" },
|
|
14
14
|
],
|
|
15
15
|
};
|
|
16
|
+
/** Resolve a named OS profile into concrete kernel-owned policy defaults. */
|
|
17
|
+
export function osProfile(profile = "native") {
|
|
18
|
+
if (typeof profile !== "string")
|
|
19
|
+
return profile;
|
|
20
|
+
if (profile !== "native")
|
|
21
|
+
throw new Error(`Unsupported OS profile: ${profile}`);
|
|
22
|
+
return {
|
|
23
|
+
id: "native",
|
|
24
|
+
attentionPolicy: DEFAULT_NATIVE_ATTENTION_POLICY,
|
|
25
|
+
governancePolicy: DEFAULT_NATIVE_GOVERNANCE_POLICY,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** Assert that a runtime is using a valid native microkernel policy profile. */
|
|
29
|
+
export function assertNativeProfile(profile = "native") {
|
|
30
|
+
const resolved = osProfile(profile);
|
|
31
|
+
if (resolved.id !== "native") {
|
|
32
|
+
throw new Error(`Unsupported OS profile: ${resolved.id}`);
|
|
33
|
+
}
|
|
34
|
+
const validation = validateDeclarativePolicy(resolved.governancePolicy, resolved.attentionPolicy);
|
|
35
|
+
if (!validation.valid) {
|
|
36
|
+
throw new Error(`Invalid native OS profile: ${validation.errors.join("; ")}`);
|
|
37
|
+
}
|
|
38
|
+
return resolved;
|
|
39
|
+
}
|
|
16
40
|
/**
|
|
17
41
|
* Validates the declarative policies statically to prevent runtime crashes when loaded into the microkernel.
|
|
18
42
|
*/
|
package/dist/runtime/runner.d.ts
CHANGED
|
@@ -5,10 +5,15 @@ import type { SignalSource } from "../signals/types.js";
|
|
|
5
5
|
import type { SessionLog, SessionEvent } from "./session-log.js";
|
|
6
6
|
import type { ArchiveStore } from "./archive.js";
|
|
7
7
|
import type { ExecutionPlane } from "./execution-plane.js";
|
|
8
|
+
import { type MemoryPolicy, type ResourceQuota } from "../kernel.js";
|
|
8
9
|
import type { AgentRunSpec, MilestoneCheckResult, MilestoneContract, MilestonePolicy } from "../types/agent.js";
|
|
9
10
|
import { type SubAgentOrchestrator } from "./sub-agent-orchestrator.js";
|
|
10
11
|
import { type GovernancePolicy } from "../governance.js";
|
|
12
|
+
import { type NativeOsProfile, type OsProfileId } from "./os-profile.js";
|
|
11
13
|
import { LargeResultSpool } from "./large-result-spool.js";
|
|
14
|
+
export interface SchedulerBudget {
|
|
15
|
+
maxWallMs?: number;
|
|
16
|
+
}
|
|
12
17
|
export interface RuntimeOptions {
|
|
13
18
|
provider: LLMProvider;
|
|
14
19
|
sessionLog: SessionLog;
|
|
@@ -24,6 +29,8 @@ export interface RuntimeOptions {
|
|
|
24
29
|
knowledgeSource?: KnowledgeSource;
|
|
25
30
|
signalSource?: SignalSource;
|
|
26
31
|
extensions?: Record<string, unknown>;
|
|
32
|
+
/** Named or concrete OS profile. Defaults to the native microkernel profile. */
|
|
33
|
+
osProfile?: OsProfileId | NativeOsProfile;
|
|
27
34
|
/**
|
|
28
35
|
* Declarative governance policy loaded into the kernel (`load_governance_policy`).
|
|
29
36
|
* The kernel enforces deny/veto/rate-limit/param-constraint before tools execute;
|
|
@@ -44,9 +51,19 @@ export interface RuntimeOptions {
|
|
|
44
51
|
* in milliseconds; when set, the kernel terminates the run when exceeded.
|
|
45
52
|
* Other axes (maxTurns, maxTokens) are set via RuntimeOptions directly.
|
|
46
53
|
*/
|
|
47
|
-
schedulerBudget?:
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
schedulerBudget?: SchedulerBudget;
|
|
55
|
+
/**
|
|
56
|
+
* Optional declarative resource quotas (`set_resource_quota`). Bounds spawn concurrency /
|
|
57
|
+
* nesting depth and memory-write rate at the kernel's single syscall trap. When unset, spawn
|
|
58
|
+
* and memory-write syscalls are admitted unconditionally (pre-M2 behavior).
|
|
59
|
+
*/
|
|
60
|
+
resourceQuota?: ResourceQuota;
|
|
61
|
+
/**
|
|
62
|
+
* Optional long-term memory policy (`set_memory_policy`). Tunes the kernel's memory subsystem
|
|
63
|
+
* (retrieval top-k, stale-warning age, write validation, memory path). Unset leaves the kernel
|
|
64
|
+
* defaults. Enabling memory still requires `dreamStore` + `agentId`.
|
|
65
|
+
*/
|
|
66
|
+
memoryPolicy?: MemoryPolicy;
|
|
50
67
|
tokenizer?: string;
|
|
51
68
|
enablePlanTool?: boolean;
|
|
52
69
|
/**
|
package/dist/runtime/runner.js
CHANGED
|
@@ -10,7 +10,7 @@ import { agentRunSpecToKernel, findSpawnProcessObservation, milestoneCheckPass,
|
|
|
10
10
|
import { defaultSubAgentOrchestrator } from "./sub-agent-orchestrator.js";
|
|
11
11
|
import { governancePolicyToKernelEvent } from "../governance.js";
|
|
12
12
|
import { kernelObservationToSessionEvent, withCategory } from "./kernel-event-log.js";
|
|
13
|
-
import {
|
|
13
|
+
import { assertNativeProfile } from "./os-profile.js";
|
|
14
14
|
import { LargeResultSpool } from "./large-result-spool.js";
|
|
15
15
|
export class RuntimeRunner {
|
|
16
16
|
opts;
|
|
@@ -504,6 +504,20 @@ export class RuntimeRunner {
|
|
|
504
504
|
if (this.opts.dreamStore && this.opts.agentId) {
|
|
505
505
|
kernelApply(runtime, this.pendingObservations, { kind: "set_memory_enabled", enabled: true });
|
|
506
506
|
}
|
|
507
|
+
// Install optional memory policy. Maps the ergonomic camelCase option onto the kernel's
|
|
508
|
+
// snake_case `set_memory_policy` event; omitted fields fall back to kernel defaults.
|
|
509
|
+
if (this.opts.memoryPolicy) {
|
|
510
|
+
const m = this.opts.memoryPolicy;
|
|
511
|
+
kernelApply(runtime, this.pendingObservations, {
|
|
512
|
+
kind: "set_memory_policy",
|
|
513
|
+
...(m.memoryPath !== undefined ? { memory_path: m.memoryPath } : {}),
|
|
514
|
+
...(m.staleWarningDays !== undefined ? { stale_warning_days: m.staleWarningDays } : {}),
|
|
515
|
+
...(m.retrievalTopK !== undefined ? { retrieval_top_k: m.retrievalTopK } : {}),
|
|
516
|
+
...(m.validationEnabled !== undefined ? { validation_enabled: m.validationEnabled } : {}),
|
|
517
|
+
...(m.maxContentBytes !== undefined ? { max_content_bytes: m.maxContentBytes } : {}),
|
|
518
|
+
...(m.maxNameLength !== undefined ? { max_name_length: m.maxNameLength } : {}),
|
|
519
|
+
});
|
|
520
|
+
}
|
|
507
521
|
if (this.opts.knowledgeSource) {
|
|
508
522
|
kernelApply(runtime, this.pendingObservations, { kind: "set_knowledge_enabled", enabled: true });
|
|
509
523
|
}
|
|
@@ -542,8 +556,9 @@ export class RuntimeRunner {
|
|
|
542
556
|
if (this.opts.runSpec) {
|
|
543
557
|
startPayload.run_spec = agentRunSpecToKernel(this.opts.runSpec);
|
|
544
558
|
}
|
|
545
|
-
const
|
|
546
|
-
const
|
|
559
|
+
const osProfile = assertNativeProfile(this.opts.osProfile ?? "native");
|
|
560
|
+
const attentionPolicy = this.opts.attentionPolicy ?? osProfile.attentionPolicy;
|
|
561
|
+
const governancePolicy = this.opts.governancePolicy ?? osProfile.governancePolicy;
|
|
547
562
|
// Load the declarative governance policy into the kernel before the run starts,
|
|
548
563
|
// so the in-kernel gate enforces deny/veto/rate-limit/param before any tool runs.
|
|
549
564
|
kernelApply(runtime, this.pendingObservations, governancePolicyToKernelEvent(governancePolicy));
|
|
@@ -563,6 +578,29 @@ export class RuntimeRunner {
|
|
|
563
578
|
: {}),
|
|
564
579
|
});
|
|
565
580
|
}
|
|
581
|
+
// Install optional resource quotas at the syscall trap (M2). Maps the ergonomic camelCase
|
|
582
|
+
// option onto the kernel's snake_case quota shape; the write-rate window is the serde tuple
|
|
583
|
+
// `[maxWrites, windowMs]`. Omitting the option leaves spawn / memory writes unbounded.
|
|
584
|
+
if (this.opts.resourceQuota) {
|
|
585
|
+
const q = this.opts.resourceQuota;
|
|
586
|
+
kernelApply(runtime, this.pendingObservations, {
|
|
587
|
+
kind: "set_resource_quota",
|
|
588
|
+
quota: {
|
|
589
|
+
...(q.maxConcurrentSubagents !== undefined
|
|
590
|
+
? { max_concurrent_subagents: q.maxConcurrentSubagents }
|
|
591
|
+
: {}),
|
|
592
|
+
...(q.maxSpawnDepth !== undefined ? { max_spawn_depth: q.maxSpawnDepth } : {}),
|
|
593
|
+
...(q.memoryWritesPerWindow !== undefined
|
|
594
|
+
? {
|
|
595
|
+
memory_writes_per_window: [
|
|
596
|
+
q.memoryWritesPerWindow.maxWrites,
|
|
597
|
+
q.memoryWritesPerWindow.windowMs,
|
|
598
|
+
],
|
|
599
|
+
}
|
|
600
|
+
: {}),
|
|
601
|
+
},
|
|
602
|
+
});
|
|
603
|
+
}
|
|
566
604
|
let action = resumeMidRun
|
|
567
605
|
? kernelAction(runtime, this.pendingObservations, { kind: "resume" })
|
|
568
606
|
: kernelAction(runtime, this.pendingObservations, startPayload);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepstrike/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "DeepStrike Node.js SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@anthropic-ai/sdk": "^0.99.0",
|
|
23
|
-
"@deepstrike/core": "0.2.
|
|
23
|
+
"@deepstrike/core": "0.2.6",
|
|
24
24
|
"@google/generative-ai": "^0.24.1",
|
|
25
25
|
"openai": "^5.23.2"
|
|
26
26
|
},
|