@theokit/sdk-tools 0.16.0 → 0.17.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c98c40a: Add `createUpdatePlanTool` — a Codex-faithful `update_plan` built-in. The model posts a DECLARATIVE plan
8
+ (an ordered list of steps, each `pending | in_progress | completed`) and refreshes it as work proceeds.
9
+ Surface-agnostic by design: returns STRUCTURED `{ ok, explanation, steps, warning? }` so each surface
10
+ renders the checklist itself (no hard-coded glyphs). Follows Codex's "exactly one step in_progress"
11
+ invariant as a non-fatal `warning` (never rejects), so the agent self-corrects on the next update.
12
+ Distinct from the imperative `createTodolistTool` (add/complete by id) and `createPlanModeTool` (mode
13
+ toggle) — this is the declarative full-plan post.
14
+
3
15
  ## 0.16.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -2297,6 +2297,27 @@ function truncateOutput(output, opts) {
2297
2297
  overflowPath
2298
2298
  };
2299
2299
  }
2300
+ var STATUS = ["pending", "in_progress", "completed"];
2301
+ var planStepSchema = zod.z.object({
2302
+ step: zod.z.string().min(1).max(100).describe("A short step, \u2264 ~7 words."),
2303
+ status: zod.z.enum(STATUS)
2304
+ });
2305
+ function createUpdatePlanTool() {
2306
+ return sdk.Tool.create({
2307
+ name: "update_plan",
2308
+ description: "Post or refresh a short plan so the user sees your progress on a multi-step task. Pass an ordered `plan` of steps, each with a status (pending | in_progress | completed); keep exactly one step in_progress at a time and mark steps completed as you finish. Returns { ok, steps, warning? } as a JSON string \u2014 the surface renders the checklist. A `warning` is returned (not an error) if the one-in_progress invariant is violated, so you can self-correct on the next update.",
2309
+ inputSchema: zod.z.object({
2310
+ explanation: zod.z.string().max(200).optional().describe("One line on what changed / why (optional)."),
2311
+ plan: zod.z.array(planStepSchema).min(1).describe("The ordered steps.")
2312
+ }),
2313
+ handler: ({ explanation, plan }) => {
2314
+ const inProgress = plan.filter((s) => s.status === "in_progress").length;
2315
+ const allDone = plan.every((s) => s.status === "completed");
2316
+ const warning = !allDone && inProgress !== 1 ? `keep exactly one step in_progress until all are completed \u2014 found ${inProgress}` : void 0;
2317
+ return JSON.stringify({ ok: true, explanation: explanation ?? null, steps: plan, warning });
2318
+ }
2319
+ });
2320
+ }
2300
2321
  var DEFAULT_TIMEOUT_MS4 = 3e4;
2301
2322
  var MAX_BODY_BYTES = 1 * 1024 * 1024;
2302
2323
  function createWebFetchTool(opts) {
@@ -2627,6 +2648,7 @@ exports.createSearchTextTool = createSearchTextTool;
2627
2648
  exports.createSessionArtifactStore = createSessionArtifactStore;
2628
2649
  exports.createShellTool = createShellTool;
2629
2650
  exports.createTodolistTool = createTodolistTool;
2651
+ exports.createUpdatePlanTool = createUpdatePlanTool;
2630
2652
  exports.createWebFetchTool = createWebFetchTool;
2631
2653
  exports.createWebSearchTool = createWebSearchTool;
2632
2654
  exports.createWriteFileTool = createWriteFileTool;