@theokit/sdk 2.2.0 → 2.4.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 (85) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/dist/a2a/index.cjs +191 -48
  3. package/dist/a2a/index.cjs.map +1 -1
  4. package/dist/a2a/index.js +192 -49
  5. package/dist/a2a/index.js.map +1 -1
  6. package/dist/compaction.cjs +78 -0
  7. package/dist/compaction.cjs.map +1 -0
  8. package/dist/compaction.d.cts +76 -0
  9. package/dist/compaction.d.ts +76 -0
  10. package/dist/compaction.js +70 -0
  11. package/dist/compaction.js.map +1 -0
  12. package/dist/{cron-JSPSFczQ.d.cts → cron-B656C3iq.d.cts} +28 -2
  13. package/dist/{cron-Aksw2Hy4.d.ts → cron-CM2M9mhB.d.ts} +28 -2
  14. package/dist/cron.cjs +192 -57
  15. package/dist/cron.cjs.map +1 -1
  16. package/dist/cron.d.cts +2 -2
  17. package/dist/cron.d.ts +2 -2
  18. package/dist/cron.js +192 -57
  19. package/dist/cron.js.map +1 -1
  20. package/dist/{errors-Bcw_Pakm.d.ts → errors-DG_7CAUg.d.ts} +1 -1
  21. package/dist/{errors-Vhg6ZV4o.d.cts → errors-QDYUPABr.d.cts} +1 -1
  22. package/dist/errors.d.cts +2 -2
  23. package/dist/eval.cjs +192 -57
  24. package/dist/eval.cjs.map +1 -1
  25. package/dist/eval.js +192 -57
  26. package/dist/eval.js.map +1 -1
  27. package/dist/index.cjs +275 -68
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +50 -7
  30. package/dist/index.d.ts +50 -7
  31. package/dist/index.js +275 -69
  32. package/dist/index.js.map +1 -1
  33. package/dist/internal/agent-loop/loop.d.ts +5 -0
  34. package/dist/internal/llm/model-capabilities.d.ts +40 -0
  35. package/dist/internal/llm/model-identifier.d.ts +9 -1
  36. package/dist/internal/llm/model-option.d.ts +38 -0
  37. package/dist/internal/runtime/compression/compression-attempt.d.ts +24 -0
  38. package/dist/internal/runtime/compression/compression-config.d.ts +33 -0
  39. package/dist/internal/runtime/compression/compression-decision.d.ts +10 -0
  40. package/dist/internal/runtime/compression/compression-helpers.d.ts +18 -0
  41. package/dist/internal/runtime/compression/compression-model-registry.d.ts +41 -0
  42. package/dist/internal/runtime/compression/compression-summarizer.d.ts +29 -0
  43. package/dist/internal/runtime/context/project-instructions.d.ts +66 -0
  44. package/dist/internal/runtime/context/replay-history.d.ts +43 -0
  45. package/dist/internal/runtime/hooks/hooks-frontmatter.d.ts +1 -1
  46. package/dist/internal/runtime/lifecycle/run-to-completion.d.ts +22 -0
  47. package/dist/internal/runtime/skills/discover-skills.d.ts +68 -0
  48. package/dist/internal/runtime/skills/skills-block.d.ts +18 -0
  49. package/dist/internal/runtime/skills/subagent-tool-scope.d.ts +25 -0
  50. package/dist/messages.cjs +24 -0
  51. package/dist/messages.cjs.map +1 -0
  52. package/dist/messages.d.cts +33 -0
  53. package/dist/messages.d.ts +33 -0
  54. package/dist/messages.js +20 -0
  55. package/dist/messages.js.map +1 -0
  56. package/dist/models.cjs +233 -0
  57. package/dist/models.cjs.map +1 -0
  58. package/dist/models.d.cts +16 -0
  59. package/dist/models.d.ts +16 -0
  60. package/dist/models.js +228 -0
  61. package/dist/models.js.map +1 -0
  62. package/dist/project.cjs +149 -0
  63. package/dist/project.cjs.map +1 -0
  64. package/dist/project.d.cts +14 -0
  65. package/dist/project.d.ts +14 -0
  66. package/dist/project.js +146 -0
  67. package/dist/project.js.map +1 -0
  68. package/dist/{run-ekGKZlmg.d.cts → run-BPRYG1Id.d.cts} +55 -2
  69. package/dist/{run-ekGKZlmg.d.ts → run-BPRYG1Id.d.ts} +55 -2
  70. package/dist/skills.cjs +282 -0
  71. package/dist/skills.cjs.map +1 -0
  72. package/dist/skills.d.cts +19 -0
  73. package/dist/skills.d.ts +19 -0
  74. package/dist/skills.js +279 -0
  75. package/dist/skills.js.map +1 -0
  76. package/dist/subagents.cjs +24 -0
  77. package/dist/subagents.cjs.map +1 -0
  78. package/dist/subagents.d.cts +14 -0
  79. package/dist/subagents.d.ts +14 -0
  80. package/dist/subagents.js +21 -0
  81. package/dist/subagents.js.map +1 -0
  82. package/dist/types/agent.d.ts +22 -0
  83. package/dist/types/conversation-storage.d.ts +5 -1
  84. package/dist/types/run.d.ts +54 -1
  85. package/package.json +62 -2
@@ -19,7 +19,7 @@ export type RunStatus = "running" | "finished" | "error" | "cancelled";
19
19
  *
20
20
  * @public
21
21
  */
22
- export type RunOperation = "stream" | "wait" | "cancel" | "conversation" | "listArtifacts" | "downloadArtifact" | "runUntil" | "fork" | "usePersonality" | "workflow";
22
+ export type RunOperation = "stream" | "wait" | "cancel" | "conversation" | "listArtifacts" | "downloadArtifact" | "runUntil" | "runToCompletion" | "fork" | "usePersonality" | "workflow";
23
23
  /**
24
24
  * Git metadata attached to cloud runs.
25
25
  *
@@ -82,6 +82,59 @@ export interface RunResult {
82
82
  */
83
83
  stoppedAtIterationLimit?: boolean;
84
84
  }
85
+ /**
86
+ * Options for {@link SDKAgent.runToCompletion} (M1 Phase 3 — continuation driver).
87
+ *
88
+ * @public
89
+ */
90
+ export interface RunToCompletionOptions {
91
+ /**
92
+ * Maximum number of continuation rounds (re-sends) before giving up with
93
+ * `terminal: "step_limit"`. Default 5. A hard ceiling that prevents a
94
+ * runaway loop when the model keeps truncating.
95
+ */
96
+ maxRounds?: number;
97
+ /**
98
+ * The short prompt re-sent after a truncated round to make the (stateful)
99
+ * agent resume. Defaults to a generic "continue" instruction. The original
100
+ * conversation is preserved by the agent's session, so this need not repeat
101
+ * the task.
102
+ */
103
+ continuationPrompt?: string;
104
+ /** Called once per truncated round that triggers a re-send (for metrics/logging). */
105
+ onTruncated?: (event: {
106
+ round: number;
107
+ }) => void | Promise<void>;
108
+ /** Abort signal; checked between rounds — once aborted, no further round starts. */
109
+ signal?: AbortSignal;
110
+ /** Per-send options forwarded to each underlying `send()` (e.g. `maxIterations`). */
111
+ sendOptions?: SendOptions;
112
+ }
113
+ /**
114
+ * Result of {@link SDKAgent.runToCompletion}.
115
+ *
116
+ * @public
117
+ */
118
+ export interface RunToCompletionResult {
119
+ /**
120
+ * Why the driver stopped:
121
+ * - `"done"` — a round finished without truncating (the model is done).
122
+ * - `"step_limit"` — `maxRounds` exhausted (or aborted) while still truncating.
123
+ * - `"no_progress"` — two consecutive rounds produced empty output.
124
+ */
125
+ terminal: "done" | "step_limit" | "no_progress";
126
+ /**
127
+ * Index of the final round. Round 0 is the initial `send`; rounds ≥ 1 are
128
+ * continuation re-sends. So `terminal: "done"` with `rounds: 0` means the
129
+ * first send finished without truncating; `rounds: N` means N continuation
130
+ * re-sends happened. For `step_limit`, `rounds` equals `maxRounds`.
131
+ */
132
+ rounds: number;
133
+ /** The `RunResult` of the final round. */
134
+ lastResult: RunResult;
135
+ /** Token usage summed across all rounds; `undefined` when no round reported usage. */
136
+ usage?: TokenUsage;
137
+ }
85
138
  /**
86
139
  * Structured error attached to a {@link RunResult} when the underlying run
87
140
  * transitioned to `"error"` status. `message` is always present; `code` is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "2.2.0",
3
+ "version": "2.4.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",
@@ -48,6 +48,66 @@
48
48
  "default": "./dist/errors.cjs"
49
49
  }
50
50
  },
51
+ "./compaction": {
52
+ "import": {
53
+ "types": "./dist/compaction.d.ts",
54
+ "default": "./dist/compaction.js"
55
+ },
56
+ "require": {
57
+ "types": "./dist/compaction.d.cts",
58
+ "default": "./dist/compaction.cjs"
59
+ }
60
+ },
61
+ "./messages": {
62
+ "import": {
63
+ "types": "./dist/messages.d.ts",
64
+ "default": "./dist/messages.js"
65
+ },
66
+ "require": {
67
+ "types": "./dist/messages.d.cts",
68
+ "default": "./dist/messages.cjs"
69
+ }
70
+ },
71
+ "./models": {
72
+ "import": {
73
+ "types": "./dist/models.d.ts",
74
+ "default": "./dist/models.js"
75
+ },
76
+ "require": {
77
+ "types": "./dist/models.d.cts",
78
+ "default": "./dist/models.cjs"
79
+ }
80
+ },
81
+ "./skills": {
82
+ "import": {
83
+ "types": "./dist/skills.d.ts",
84
+ "default": "./dist/skills.js"
85
+ },
86
+ "require": {
87
+ "types": "./dist/skills.d.cts",
88
+ "default": "./dist/skills.cjs"
89
+ }
90
+ },
91
+ "./project": {
92
+ "import": {
93
+ "types": "./dist/project.d.ts",
94
+ "default": "./dist/project.js"
95
+ },
96
+ "require": {
97
+ "types": "./dist/project.d.cts",
98
+ "default": "./dist/project.cjs"
99
+ }
100
+ },
101
+ "./subagents": {
102
+ "import": {
103
+ "types": "./dist/subagents.d.ts",
104
+ "default": "./dist/subagents.js"
105
+ },
106
+ "require": {
107
+ "types": "./dist/subagents.d.cts",
108
+ "default": "./dist/subagents.cjs"
109
+ }
110
+ },
51
111
  "./path-safety": {
52
112
  "import": {
53
113
  "types": "./dist/path-safety.d.ts",
@@ -295,7 +355,7 @@
295
355
  "ws": "^8.18.0",
296
356
  "zod": "^4.0.0",
297
357
  "@theokit/sdk-handoff": "0.1.0",
298
- "@theokit/sdk-memory": "0.1.0"
358
+ "@theokit/sdk-memory": "0.2.0"
299
359
  },
300
360
  "scripts": {
301
361
  "build": "tsup && cp src/internal/providers/provider-catalog.json dist/provider-catalog.json",