@deepstrike/sdk 0.1.16 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collaboration/harness.d.ts +4 -1
- package/dist/collaboration/harness.js +20 -6
- package/dist/collaboration/modes/creator-verifier.d.ts +8 -2
- package/dist/collaboration/modes/creator-verifier.js +9 -3
- package/dist/collaboration/pool.d.ts +24 -3
- package/dist/collaboration/pool.js +65 -5
- package/dist/harness/harness.d.ts +5 -1
- package/dist/harness/harness.js +23 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +5 -0
- package/dist/kernel.d.ts +12 -43
- package/dist/kernel.js +1 -1
- package/dist/providers/anthropic.js +3 -1
- package/dist/runtime/archive.d.ts +15 -0
- package/dist/runtime/archive.js +35 -0
- package/dist/runtime/execution-plane.js +30 -6
- package/dist/runtime/filtered-plane.d.ts +14 -0
- package/dist/runtime/filtered-plane.js +45 -0
- package/dist/runtime/kernel-step.d.ts +88 -0
- package/dist/runtime/kernel-step.js +262 -0
- package/dist/runtime/process-sandbox-plane.d.ts +4 -4
- package/dist/runtime/process-sandbox-plane.js +5 -5
- package/dist/runtime/provider-replay.js +7 -2
- package/dist/runtime/replay-sanitize.d.ts +5 -0
- package/dist/runtime/replay-sanitize.js +25 -0
- package/dist/runtime/runner.d.ts +60 -4
- package/dist/runtime/runner.js +589 -86
- package/dist/runtime/session-log.d.ts +93 -1
- package/dist/runtime/session-repair.d.ts +37 -0
- package/dist/runtime/session-repair.js +77 -0
- package/dist/runtime/sub-agent-orchestrator.d.ts +19 -0
- package/dist/runtime/sub-agent-orchestrator.js +114 -0
- package/dist/skills/watcher.d.ts +19 -0
- package/dist/skills/watcher.js +38 -0
- package/dist/tools/index.d.ts +4 -1
- package/dist/tools/index.js +82 -11
- package/dist/types/agent.d.ts +68 -0
- package/dist/types/agent.js +78 -0
- package/dist/types.d.ts +27 -0
- package/package.json +2 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export function agentIdentitySub(agentId, sessionId, parentSessionId) {
|
|
2
|
+
return {
|
|
3
|
+
agentId,
|
|
4
|
+
sessionId,
|
|
5
|
+
isSubAgent: true,
|
|
6
|
+
...(parentSessionId ? { parentSessionId } : {}),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function agentRunSpecToKernel(spec) {
|
|
10
|
+
const out = {
|
|
11
|
+
identity: {
|
|
12
|
+
agent_id: spec.identity.agentId,
|
|
13
|
+
session_id: spec.identity.sessionId,
|
|
14
|
+
is_sub_agent: spec.identity.isSubAgent,
|
|
15
|
+
...(spec.identity.parentSessionId ? { parent_session_id: spec.identity.parentSessionId } : {}),
|
|
16
|
+
},
|
|
17
|
+
role: spec.role,
|
|
18
|
+
isolation: spec.isolation ?? "shared",
|
|
19
|
+
goal: spec.goal,
|
|
20
|
+
capability_filter: {
|
|
21
|
+
allowed_kinds: spec.capabilityFilter?.allowedKinds ?? [],
|
|
22
|
+
allowed_ids: spec.capabilityFilter?.allowedIds ?? [],
|
|
23
|
+
},
|
|
24
|
+
metadata: spec.metadata ?? null,
|
|
25
|
+
};
|
|
26
|
+
if (spec.verificationContractId)
|
|
27
|
+
out.verification_contract_id = spec.verificationContractId;
|
|
28
|
+
if (spec.milestones)
|
|
29
|
+
out.milestones = milestoneContractToKernel(spec.milestones);
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
export function milestoneContractToKernel(contract) {
|
|
33
|
+
return {
|
|
34
|
+
phases: contract.phases.map(phase => ({
|
|
35
|
+
id: phase.id,
|
|
36
|
+
criteria: phase.criteria ?? [],
|
|
37
|
+
unlocks: phase.unlocks ?? [],
|
|
38
|
+
...(phase.verifier ? { verifier: phase.verifier } : {}),
|
|
39
|
+
required_evidence: phase.requiredEvidence ?? [],
|
|
40
|
+
})),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function milestoneCheckResultToKernel(result) {
|
|
44
|
+
return {
|
|
45
|
+
phase_id: result.phaseId,
|
|
46
|
+
passed: result.passed,
|
|
47
|
+
...(result.reason ? { reason: result.reason } : {}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function subAgentResultToKernel(result) {
|
|
51
|
+
const finalMessage = result.result.finalMessage;
|
|
52
|
+
return {
|
|
53
|
+
agent_id: result.agentId,
|
|
54
|
+
result: {
|
|
55
|
+
termination: result.result.termination,
|
|
56
|
+
final_message: finalMessage
|
|
57
|
+
? {
|
|
58
|
+
role: finalMessage.role,
|
|
59
|
+
content: finalMessage.content,
|
|
60
|
+
tool_calls: (finalMessage.toolCalls ?? []).map(tc => ({
|
|
61
|
+
id: tc.id,
|
|
62
|
+
name: tc.name,
|
|
63
|
+
arguments: JSON.parse(tc.arguments || "{}"),
|
|
64
|
+
})),
|
|
65
|
+
...(finalMessage.tokenCount !== undefined ? { token_count: finalMessage.tokenCount } : {}),
|
|
66
|
+
}
|
|
67
|
+
: null,
|
|
68
|
+
turns_used: result.result.turnsUsed,
|
|
69
|
+
total_tokens_used: result.result.totalTokensUsed,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function milestoneCheckPass(phaseId) {
|
|
74
|
+
return { phaseId, passed: true };
|
|
75
|
+
}
|
|
76
|
+
export function milestoneCheckFail(phaseId, reason) {
|
|
77
|
+
return { phaseId, passed: false, reason };
|
|
78
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -41,10 +41,13 @@ export interface ToolCall {
|
|
|
41
41
|
name: string;
|
|
42
42
|
arguments: string;
|
|
43
43
|
}
|
|
44
|
+
export type ToolErrorKind = "recoverable" | "fatal" | "governance_denied" | "provider_failure" | "timeout" | "user_interrupt";
|
|
44
45
|
export interface ToolResult {
|
|
45
46
|
callId: string;
|
|
46
47
|
output: string;
|
|
47
48
|
isError: boolean;
|
|
49
|
+
isFatal?: boolean;
|
|
50
|
+
errorKind?: ToolErrorKind;
|
|
48
51
|
tokenCount?: number;
|
|
49
52
|
}
|
|
50
53
|
export interface ToolSchema {
|
|
@@ -110,17 +113,27 @@ export interface ToolResultEvent extends StreamEvent {
|
|
|
110
113
|
name: string;
|
|
111
114
|
content: string;
|
|
112
115
|
isError: boolean;
|
|
116
|
+
isFatal?: boolean;
|
|
117
|
+
errorKind?: ToolErrorKind;
|
|
113
118
|
}
|
|
114
119
|
export interface DoneEvent extends StreamEvent {
|
|
115
120
|
type: "done";
|
|
116
121
|
iterations: number;
|
|
117
122
|
totalTokens: number;
|
|
118
123
|
status: string;
|
|
124
|
+
dreamResult?: import("./memory/protocols.js").DreamResult;
|
|
119
125
|
}
|
|
120
126
|
export interface ErrorEvent extends StreamEvent {
|
|
121
127
|
type: "error";
|
|
122
128
|
message: string;
|
|
123
129
|
}
|
|
130
|
+
export interface ToolArgumentRepairedEvent extends StreamEvent {
|
|
131
|
+
type: "tool_argument_repaired";
|
|
132
|
+
callId: string;
|
|
133
|
+
name: string;
|
|
134
|
+
originalArguments: string;
|
|
135
|
+
repairedArguments: string;
|
|
136
|
+
}
|
|
124
137
|
export interface PermissionRequestEvent extends StreamEvent {
|
|
125
138
|
type: "permission_request";
|
|
126
139
|
callId: string;
|
|
@@ -128,6 +141,12 @@ export interface PermissionRequestEvent extends StreamEvent {
|
|
|
128
141
|
arguments: string;
|
|
129
142
|
reason: string;
|
|
130
143
|
}
|
|
144
|
+
export interface ToolDeniedEvent extends StreamEvent {
|
|
145
|
+
type: "tool_denied";
|
|
146
|
+
callId: string;
|
|
147
|
+
toolName: string;
|
|
148
|
+
reason: string;
|
|
149
|
+
}
|
|
131
150
|
export interface TokenUsage {
|
|
132
151
|
inputTokens: number;
|
|
133
152
|
outputTokens: number;
|
|
@@ -194,3 +213,11 @@ export interface LLMProvider {
|
|
|
194
213
|
complete(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): Promise<Message>;
|
|
195
214
|
stream(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>, state?: ProviderRunState): AsyncIterable<StreamEvent>;
|
|
196
215
|
}
|
|
216
|
+
export interface TaskUpdate {
|
|
217
|
+
plan?: string[];
|
|
218
|
+
currentStep?: number;
|
|
219
|
+
progress?: string;
|
|
220
|
+
scratchpad?: string;
|
|
221
|
+
blockedOn?: string[];
|
|
222
|
+
preservedRefs?: string[];
|
|
223
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepstrike/sdk",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "DeepStrike Node.js SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@anthropic-ai/sdk": "^0.39.0",
|
|
20
|
-
"@deepstrike/core": "0.1
|
|
20
|
+
"@deepstrike/core": "0.2.1",
|
|
21
21
|
"@google/generative-ai": "^0.24.1",
|
|
22
22
|
"openai": "^4.77.0"
|
|
23
23
|
},
|