@theokit/sdk 2.27.0 → 2.29.0

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 (55) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/a2a/index.cjs +373 -17
  3. package/dist/a2a/index.cjs.map +1 -1
  4. package/dist/a2a/index.js +373 -17
  5. package/dist/a2a/index.js.map +1 -1
  6. package/dist/{cron-BR1NCSk1.d.cts → cron-COSAehOL.d.ts} +110 -3
  7. package/dist/{cron-DgEQCJ2i.d.ts → cron-yJoNUZxe.d.cts} +110 -3
  8. package/dist/cron.cjs +914 -508
  9. package/dist/cron.cjs.map +1 -1
  10. package/dist/cron.d.cts +2 -2
  11. package/dist/cron.d.ts +2 -2
  12. package/dist/cron.js +915 -509
  13. package/dist/cron.js.map +1 -1
  14. package/dist/{errors-CbY3pxY7.d.ts → errors-BxMIlgLP.d.ts} +1 -1
  15. package/dist/{errors-DLMNb4Ka.d.cts → errors-tP-8O-hR.d.cts} +1 -1
  16. package/dist/errors.d.cts +2 -2
  17. package/dist/eval.cjs +914 -508
  18. package/dist/eval.cjs.map +1 -1
  19. package/dist/eval.js +915 -509
  20. package/dist/eval.js.map +1 -1
  21. package/dist/filesystem/index.cjs +304 -0
  22. package/dist/filesystem/index.cjs.map +1 -0
  23. package/dist/filesystem/index.d.cts +12 -0
  24. package/dist/filesystem/index.d.ts +12 -0
  25. package/dist/filesystem/index.js +295 -0
  26. package/dist/filesystem/index.js.map +1 -0
  27. package/dist/filesystem/local-filesystem.d.cts +36 -0
  28. package/dist/filesystem/local-filesystem.d.ts +36 -0
  29. package/dist/filesystem/types.d.cts +118 -0
  30. package/dist/filesystem/types.d.ts +118 -0
  31. package/dist/index.cjs +973 -570
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +13 -7
  34. package/dist/index.d.ts +13 -7
  35. package/dist/index.js +972 -568
  36. package/dist/index.js.map +1 -1
  37. package/dist/internal/persistence/conversation-storage-fs.d.cts +4 -0
  38. package/dist/internal/persistence/conversation-storage-fs.d.ts +4 -0
  39. package/dist/internal/persistence/conversation-storage-memory.d.cts +4 -0
  40. package/dist/internal/persistence/conversation-storage-memory.d.ts +4 -0
  41. package/dist/internal/persistence/objective-coerce.d.cts +9 -0
  42. package/dist/internal/persistence/objective-coerce.d.ts +9 -0
  43. package/dist/internal/runtime/lifecycle/wrap-completion-check-run.d.ts +30 -0
  44. package/dist/internal/runtime/local-agent/local-agent-goal-extensions.d.ts +80 -0
  45. package/dist/internal/runtime/objective/objective-store.d.ts +33 -0
  46. package/dist/{run-CdWiihyU.d.cts → run-q_P0vHlY.d.cts} +71 -2
  47. package/dist/{run-CdWiihyU.d.ts → run-q_P0vHlY.d.ts} +71 -2
  48. package/dist/types/agent.d.ts +32 -1
  49. package/dist/types/conversation-storage.d.ts +23 -0
  50. package/dist/types/goal-events.d.ts +7 -0
  51. package/dist/types/index.d.ts +1 -0
  52. package/dist/types/objective.d.ts +45 -0
  53. package/dist/types/run-events.d.ts +12 -1
  54. package/dist/types/run.d.ts +58 -0
  55. package/package.json +11 -1
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * @public
18
18
  */
19
- export type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent | RunTripwireEvent;
19
+ export type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent | RunTripwireEvent | RunCompletionCheckEvent;
20
20
  /**
21
21
  * SE24 — a guardrail processor called `abort()`; the run stops with a tripwire.
22
22
  * Delivered via {@link SendOptions.onRunEvent} (mirrors the `RunResult.tripwire`
@@ -73,6 +73,17 @@ export interface RunTaskCompletedEvent {
73
73
  readonly taskId: string;
74
74
  readonly status: "completed" | "failed" | "stopped";
75
75
  }
76
+ /**
77
+ * SE34 — the per-send completion check (`isTaskComplete`) produced a verdict.
78
+ * Emitted once, after a finished run's reply is judged against
79
+ * {@link SendOptions.completionCheck}. Distinct from `task_completed` (which is
80
+ * background-task/subagent lifecycle). Mirrors {@link RunResult.completionCheck}.
81
+ */
82
+ export interface RunCompletionCheckEvent {
83
+ readonly type: "completion_check";
84
+ readonly complete: boolean;
85
+ readonly reason: string;
86
+ }
76
87
  /** The conversation crossed a compaction boundary (history was summarized). */
77
88
  export interface RunCompactBoundaryEvent {
78
89
  readonly type: "compact_boundary";
@@ -155,6 +155,13 @@ export interface RunResult {
155
155
  * @public
156
156
  */
157
157
  stoppedByDoomLoop?: boolean;
158
+ /**
159
+ * SE34 — the per-send completion verdict, populated when
160
+ * {@link SendOptions.completionCheck} was set AND the run finished. Absent on
161
+ * non-finished runs and when no completion check was requested. Reuses the
162
+ * shipped LLM-as-judge (same one `runUntil` drives). @public
163
+ */
164
+ completionCheck?: CompletionCheckResult;
158
165
  }
159
166
  /**
160
167
  * Doom-loop guard thresholds (see {@link SendOptions.doomLoop}). Both are counts of CONSECUTIVE
@@ -427,6 +434,57 @@ export interface SendOptions {
427
434
  * @public
428
435
  */
429
436
  maxIterations?: number;
437
+ /**
438
+ * SE34 — per-send completion check (`isTaskComplete`). After this single
439
+ * `send()` reaches a terminal `finished` state, the shipped LLM-as-judge
440
+ * scores the final reply against `criteria` and surfaces the verdict on
441
+ * {@link RunResult.completionCheck} + a `completion_check` run-event. This is
442
+ * the finer-grained, single-`send()` gate (contrast `runUntil`, which judges
443
+ * the FULL response BETWEEN sends). Opt-in — absent ⇒ the send is byte-identical
444
+ * to today (no extra judge call). Non-finished runs skip the check. The judge
445
+ * runs when `wait()` is called on the returned `Run`; a stream-only consumer
446
+ * must call `wait()` to trigger the verdict + the `completion_check` event.
447
+ *
448
+ * @public
449
+ */
450
+ completionCheck?: CompletionCheck;
451
+ /**
452
+ * SE34 — project the standing durable objective (SE33) for this `threadId`
453
+ * into the model context for this send as `<current-objective>…`, so the
454
+ * model always sees what it is working toward. Opt-in — absent ⇒ the assembled
455
+ * system prompt is byte-identical to today. Only an ACTIVE objective is
456
+ * projected (`done`/`paused` ⇒ nothing injected). Reuses the SE33 objective
457
+ * store + the system-prompt assembly seam (no general signal framework — YAGNI).
458
+ *
459
+ * @public
460
+ */
461
+ objectiveThreadId?: string;
462
+ }
463
+ /**
464
+ * SE34 — the per-send completion criterion (see {@link SendOptions.completionCheck}).
465
+ *
466
+ * @public
467
+ */
468
+ export interface CompletionCheck {
469
+ /** What "complete" means for this send — fed to the judge as the goal. */
470
+ criteria: string;
471
+ /** Judge model identifier. Default `"openai/gpt-4o-mini"`. */
472
+ judgeModel?: string;
473
+ /** Override env for the judge auxiliary agent. Default `OPENROUTER_API_KEY`. */
474
+ apiKey?: string;
475
+ }
476
+ /**
477
+ * SE34 — the resolved per-send completion verdict (see {@link RunResult.completionCheck}).
478
+ *
479
+ * @public
480
+ */
481
+ export interface CompletionCheckResult {
482
+ /** `true` when the judge ruled the send's reply satisfies the criteria. */
483
+ complete: boolean;
484
+ /** The judge's stated reason. */
485
+ reason: string;
486
+ /** `true` when the judge output could not be parsed — fail-safe `complete: false`. */
487
+ parseFailed: boolean;
430
488
  }
431
489
  /**
432
490
  * Handle to a single prompt submission.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "2.27.0",
3
+ "version": "2.29.0",
4
4
  "description": "TypeScript SDK for the Theo agent harness — same surface, local or cloud.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/usetheo/theokit-sdk#readme",
@@ -268,6 +268,16 @@
268
268
  "default": "./dist/sandbox/index.cjs"
269
269
  }
270
270
  },
271
+ "./filesystem": {
272
+ "import": {
273
+ "types": "./dist/filesystem/index.d.ts",
274
+ "default": "./dist/filesystem/index.js"
275
+ },
276
+ "require": {
277
+ "types": "./dist/filesystem/index.d.cts",
278
+ "default": "./dist/filesystem/index.cjs"
279
+ }
280
+ },
271
281
  "./package.json": "./package.json"
272
282
  },
273
283
  "files": [