@deepstrike/core 0.1.10 → 0.1.12

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.
Files changed (2) hide show
  1. package/index.d.ts +85 -4
  2. package/package.json +8 -8
package/index.d.ts CHANGED
@@ -48,6 +48,38 @@ export interface ToolSchema {
48
48
  export interface RuntimeTask {
49
49
  goal: string
50
50
  criteria?: Array<string>
51
+ /** `"orchestrate"` | `"implement"` (default) | `"retrieve"` | `"verify"` */
52
+ lane?: string
53
+ }
54
+ export interface AcceptanceCriterion {
55
+ id: string
56
+ text: string
57
+ required: boolean
58
+ weight: number
59
+ machineCheckable: boolean
60
+ }
61
+ export interface VerificationContract {
62
+ id: string
63
+ goal: string
64
+ acceptance: Array<AcceptanceCriterion>
65
+ antiPatterns: Array<string>
66
+ evidenceRequired: Array<string>
67
+ }
68
+ export interface ContractCheckResult {
69
+ criterionId: string
70
+ passed: boolean
71
+ evidence?: string
72
+ }
73
+ export interface HandoffArtifact {
74
+ goal: string
75
+ sprint: number
76
+ progressSummary: string
77
+ openTasks: Array<string>
78
+ /** JSON-encoded context snapshot. */
79
+ contextSnapshot: string
80
+ contractStatus: Array<ContractCheckResult>
81
+ driftRate24H: number
82
+ blockedOn: Array<string>
51
83
  }
52
84
  export interface LoopPolicy {
53
85
  maxTokens: number
@@ -84,15 +116,33 @@ export interface SkillMetadata {
84
116
  effort?: number
85
117
  estimatedTokens: number
86
118
  }
119
+ /**
120
+ * Structured context for a provider call — emitted with `kind === "call_llm"`.
121
+ * Separates system configuration from the conversation transcript so providers
122
+ * can map each field to their own API contract without role-filtering.
123
+ */
124
+ export interface RenderedContext {
125
+ /**
126
+ * Combined system text: system partition + dashboard (when non-empty).
127
+ * Anthropic → `system` param · OpenAI → `messages[0]` system role ·
128
+ * Gemini → `systemInstruction`.
129
+ */
130
+ systemText: string
131
+ /**
132
+ * Strictly alternating user / assistant / tool turns.
133
+ * Working-partition signals are already folded into the first user turn.
134
+ */
135
+ turns: Array<Message>
136
+ }
87
137
  /**
88
138
  * Discriminated union. Inspect `kind`:
89
- * - `"call_llm"` → `messages`, `tools` (includes `skill` meta-tool when skills are registered)
139
+ * - `"call_llm"` → `context` (RenderedContext), `tools`
90
140
  * - `"execute_tools"` → `calls`
91
141
  * - `"done"` → `result`
92
142
  */
93
143
  export interface LoopAction {
94
144
  kind: string
95
- messages?: Array<Message>
145
+ context?: RenderedContext
96
146
  tools?: Array<ToolSchema>
97
147
  calls?: Array<ToolCall>
98
148
  result?: LoopResult
@@ -100,12 +150,21 @@ export interface LoopAction {
100
150
  /**
101
151
  * Discriminated union for observations:
102
152
  * - `"compressed"` → `action`, `rho_after`
153
+ * - `"renewed"` → `sprint`
103
154
  */
104
155
  export interface LoopObservation {
105
156
  kind: string
106
157
  action?: string
107
158
  rhoAfter?: number
159
+ /** Sprint number after renewal. Set when `kind === "renewed"`. */
160
+ sprint?: number
108
161
  }
162
+ /**
163
+ * Format a VerificationContract as a markdown string suitable for injection
164
+ * into an agent's system prompt. The returned string is ready to pass to
165
+ * `LoopStateMachine.addSystemMessage()` or `LoopStateMachine.setContract()`.
166
+ */
167
+ export declare function formatContractForSystemPrompt(contract: VerificationContract): string
109
168
  /** JS-friendly governance verdict returned by `Governance.evaluate`. */
110
169
  export interface GovernanceVerdict {
111
170
  /** `"allow"` | `"deny"` | `"rate_limited"` | `"ask_user"` */
@@ -210,7 +269,7 @@ export declare class ContextEngine {
210
269
  * Returns tokens saved.
211
270
  */
212
271
  compress(): number
213
- render(): Array<Message>
272
+ render(): RenderedContext
214
273
  /**
215
274
  * Replace the available-skills set with frontmatter-only metadata.
216
275
  * The kernel will auto-inject the `skill` meta-tool into every `CallLLM` action.
@@ -246,6 +305,18 @@ export declare class LoopStateMachine {
246
305
  * `tokens` is a caller-supplied estimate; pass at least 1.
247
306
  */
248
307
  addMemoryMessage(content: string, tokens: number): void
308
+ /**
309
+ * Pre-populate the history partition with a prior transcript message.
310
+ * Must be called before `start`.
311
+ */
312
+ addHistoryMessage(message: Message, tokens: number): void
313
+ /**
314
+ * Inject a VerificationContract into the system partition.
315
+ * The contract is formatted as markdown and pushed to the `system` partition
316
+ * (Priority::Critical) so it survives context renewal and compression.
317
+ * Call before `start()`.
318
+ */
319
+ setContract(contract: VerificationContract): void
249
320
  setTools(tools: Array<ToolSchema>): void
250
321
  start(task: RuntimeTask): LoopAction
251
322
  feedLlmResponse(message: Message): LoopAction
@@ -256,7 +327,17 @@ export declare class LoopStateMachine {
256
327
  pressure(): number
257
328
  /** Drain observations emitted during the most recent feed call. */
258
329
  takeObservations(): Array<LoopObservation>
259
- render(): Array<Message>
330
+ /**
331
+ * Pre-populate history with messages from a prior session.
332
+ * Call before `start()` to restore conversational continuity across runs.
333
+ */
334
+ preloadHistory(messages: Array<Message>): void
335
+ /**
336
+ * Return only messages added during the current run (since the last `preload_history`
337
+ * or construction). Use this to persist the session delta to `SessionStore.saveSession`.
338
+ */
339
+ drainNewMessages(): Array<Message>
340
+ render(): RenderedContext
260
341
  }
261
342
  export declare class SignalRouter {
262
343
  constructor(maxQueueSize: number)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepstrike/core",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "DeepStrike kernel — pre-built native addon",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -23,12 +23,12 @@
23
23
  ]
24
24
  },
25
25
  "optionalDependencies": {
26
- "@deepstrike/core-darwin-arm64": "0.1.10",
27
- "@deepstrike/core-darwin-x64": "0.1.10",
28
- "@deepstrike/core-linux-arm64-gnu": "0.1.10",
29
- "@deepstrike/core-linux-arm64-musl": "0.1.10",
30
- "@deepstrike/core-linux-x64-gnu": "0.1.10",
31
- "@deepstrike/core-linux-x64-musl": "0.1.10",
32
- "@deepstrike/core-win32-x64-msvc": "0.1.10"
26
+ "@deepstrike/core-darwin-arm64": "0.1.12",
27
+ "@deepstrike/core-darwin-x64": "0.1.12",
28
+ "@deepstrike/core-linux-arm64-gnu": "0.1.12",
29
+ "@deepstrike/core-linux-arm64-musl": "0.1.12",
30
+ "@deepstrike/core-linux-x64-gnu": "0.1.12",
31
+ "@deepstrike/core-linux-x64-musl": "0.1.12",
32
+ "@deepstrike/core-win32-x64-msvc": "0.1.12"
33
33
  }
34
34
  }