@deepstrike/core 0.2.6 → 0.2.7

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 +82 -0
  2. package/package.json +8 -8
package/index.d.ts CHANGED
@@ -231,6 +231,50 @@ export interface EvalPipelineAction {
231
231
  details?: Array<CriterionResult>
232
232
  skillCandidate?: SkillCandidate
233
233
  }
234
+ /** One pairwise match-up in a round. */
235
+ export interface TournamentMatch {
236
+ /** Index of this match within its round (0-based). */
237
+ id: number
238
+ left: string
239
+ right: string
240
+ }
241
+ /**
242
+ * Discriminated union returned by `Tournament` methods. Inspect `kind`:
243
+ * - `"judgeRound"` → `round`, `matches` (run one fresh-context judge per match, in
244
+ * parallel, then call `feedRound` with the winners)
245
+ * - `"done"` → `winner`, `roundsUsed`
246
+ */
247
+ export interface TournamentAction {
248
+ kind: string
249
+ round?: number
250
+ matches?: Array<TournamentMatch>
251
+ winner?: string
252
+ roundsUsed?: number
253
+ }
254
+ /**
255
+ * A single stop predicate. `kind` is one of `"noNewFindings"`, `"noErrors"`, `"maxRounds"`;
256
+ * `maxRounds` is required only when `kind === "maxRounds"`.
257
+ */
258
+ export interface StopConditionSpec {
259
+ kind: string
260
+ maxRounds?: number
261
+ }
262
+ /** What the SDK reports after running a round's worker. */
263
+ export interface RoundReport {
264
+ newFindings: number
265
+ errors: number
266
+ }
267
+ /**
268
+ * Discriminated union returned by `LoopUntilDone` methods. Inspect `kind`:
269
+ * - `"spawn"` → `round` (spawn that round's worker, then call `feed` with its report)
270
+ * - `"done"` → `roundsUsed`, `reason` (`"noNewFindings"` | `"noErrors"` | `"maxRounds"`)
271
+ */
272
+ export interface LoopAction {
273
+ kind: string
274
+ round?: number
275
+ roundsUsed?: number
276
+ reason?: string
277
+ }
234
278
  /**
235
279
  * Versioned kernel ABI runtime. Accepts/returns JSON encoded
236
280
  * `KernelInput`/`KernelStep` payloads from deepstrike-core.
@@ -330,3 +374,41 @@ export declare class IdlePipeline {
330
374
  /** Reset to `Idle` after handling `CommitMemories` to allow the next cycle. */
331
375
  reset(): void
332
376
  }
377
+ /**
378
+ * Single-elimination tournament control state machine.
379
+ *
380
+ * Drive it like this:
381
+ * 1. `new(entrants)` (throws if empty)
382
+ * 2. `start()` → `"judgeRound"` (or `"done"` for a single entrant)
383
+ * 3. Run one fresh-context pairwise judge per `action.matches`, collect the winner of each
384
+ * 4. `feedRound(winners)` → next `"judgeRound"` or `"done"`
385
+ */
386
+ export declare class Tournament {
387
+ constructor(entrants: Array<string>)
388
+ /** Begin the tournament — emits the first round (or `"done"` for a single entrant). */
389
+ start(): TournamentAction
390
+ /**
391
+ * Report the winners of the round last emitted by `"judgeRound"`. `winners` must align
392
+ * one-to-one with that round's `matches`; each must be a participant in its match.
393
+ */
394
+ feedRound(winners: Array<string>): TournamentAction
395
+ isDone(): boolean
396
+ }
397
+ /**
398
+ * Loop-until-done control state machine.
399
+ *
400
+ * Construct with an ordered list of stop conditions (first match wins). A `maxRounds`
401
+ * backstop is injected automatically if you provide none, so the loop always terminates.
402
+ *
403
+ * 1. `new(conditions)`
404
+ * 2. `start()` → `"spawn"` (round 1)
405
+ * 3. Run the round's worker, then `feed({ newFindings, errors })` → next `"spawn"` or `"done"`
406
+ */
407
+ export declare class LoopUntilDone {
408
+ constructor(conditions: Array<StopConditionSpec>)
409
+ /** Begin the loop — always emits `"spawn"` for round 1. */
410
+ start(): LoopAction
411
+ /** Feed the just-completed round's report and get the next action. */
412
+ feed(report: RoundReport): LoopAction
413
+ isDone(): boolean
414
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepstrike/core",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
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.2.6",
27
- "@deepstrike/core-darwin-x64": "0.2.6",
28
- "@deepstrike/core-linux-arm64-gnu": "0.2.6",
29
- "@deepstrike/core-linux-arm64-musl": "0.2.6",
30
- "@deepstrike/core-linux-x64-gnu": "0.2.6",
31
- "@deepstrike/core-linux-x64-musl": "0.2.6",
32
- "@deepstrike/core-win32-x64-msvc": "0.2.6"
26
+ "@deepstrike/core-darwin-arm64": "0.2.7",
27
+ "@deepstrike/core-darwin-x64": "0.2.7",
28
+ "@deepstrike/core-linux-arm64-gnu": "0.2.7",
29
+ "@deepstrike/core-linux-arm64-musl": "0.2.7",
30
+ "@deepstrike/core-linux-x64-gnu": "0.2.7",
31
+ "@deepstrike/core-linux-x64-musl": "0.2.7",
32
+ "@deepstrike/core-win32-x64-msvc": "0.2.7"
33
33
  }
34
34
  }