@theokit/sdk-tools 0.10.0 → 0.11.1

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,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 453ad2d: SE43 — system-design audit fixes (public-surface changes).
8
+
9
+ - **`@theokit/sdk` (minor):** the shared persistence kernel is now reachable from the sanctioned public `@theokit/sdk/persistence` barrel — `withCwdMutex`, `sanitizeFts5Query`, and `PersistenceSchema` are added (joining `replaceFileAtomic` / `openSqliteResilient` / `atomicWriteText` / `atomicWriteJson`). The `@theokit/sdk/internal/persistence` export is now **deprecated**: it re-exports its full surface unchanged for one release (back-compat) and is scheduled for removal in a future major. No breaking change; existing imports keep working.
10
+ - **Satellites (patch):** `sdk-tools` / `sdk-memory` / `sdk-cache` / `sdk-handoff` / `sdk-budget` tightened their `@theokit/sdk` peer-range floor from `>=1.7.0` to `>=4.0.0`, matching the v4-only surfaces they import (prevents a non-workspace install resolving an incompatible old sdk).
11
+
12
+ ## 0.11.0
13
+
14
+ ### Minor Changes
15
+
16
+ - SE38 (#119) — `createTodolistTool()` is now session-aware: it scopes its items by the
17
+ run's `ctx.threadId`, so one tool object served to many sessions from a single process
18
+ (the multi-tenant server shape) no longer leaks one session's list into another. When no
19
+ `threadId` is present (single-session CLI usage) every call shares one default session, so
20
+ existing behavior is unchanged. `handler` accepts an optional 2nd `ctx` argument and
21
+ `getItems(threadId?)` is session-scoped — both additive/back-compatible.
22
+
3
23
  ## 0.10.0
4
24
 
5
25
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -5,8 +5,8 @@ var path = require('path');
5
5
  var sdk = require('@theokit/sdk');
6
6
  var zod = require('zod');
7
7
  var fs = require('fs');
8
- var persistence = require('@theokit/sdk/internal/persistence');
9
8
  var pathSafety = require('@theokit/sdk/path-safety');
9
+ var persistence = require('@theokit/sdk/persistence');
10
10
  var child_process = require('child_process');
11
11
  var promises$1 = require('dns/promises');
12
12
  var net = require('net');
@@ -1803,7 +1803,7 @@ function requireId(input) {
1803
1803
  if (!("id" in input) || !input.id) return null;
1804
1804
  return input.id;
1805
1805
  }
1806
- function createTodolistTool() {
1806
+ function makeSessionOps() {
1807
1807
  const items = [];
1808
1808
  let nextId = 1;
1809
1809
  function genId() {
@@ -1872,6 +1872,26 @@ ${done}/${items.length} done | ${inProg} in progress | ${pending} pending`);
1872
1872
  list: () => listResult({}),
1873
1873
  clear_completed: handleClearCompleted
1874
1874
  };
1875
+ return {
1876
+ handle: (input) => {
1877
+ const action = actions[input.action];
1878
+ if (!action) return fail({ error: "invalid_action" });
1879
+ return action(input);
1880
+ },
1881
+ getItems: () => [...items]
1882
+ };
1883
+ }
1884
+ function createTodolistTool() {
1885
+ const sessions = /* @__PURE__ */ new Map();
1886
+ function ops(threadId) {
1887
+ const key = threadId ?? "__default__";
1888
+ let session = sessions.get(key);
1889
+ if (session === void 0) {
1890
+ session = makeSessionOps();
1891
+ sessions.set(key, session);
1892
+ }
1893
+ return session;
1894
+ }
1875
1895
  return {
1876
1896
  name: "todolist",
1877
1897
  description: "Create and maintain a structured task list for the current session \u2014 tracks progress and keeps a multi-step plan visible across turns. Use it proactively when the work has 3+ steps or the user gave multiple tasks; skip it for a single trivial step. Keep exactly ONE item 'in_progress' at a time, and mark 'complete' only after the work is actually done. Actions: 'add' (create with title), 'in_progress' (mark started by id), 'complete' (mark done by id), 'remove' (delete by id), 'list' (show all), 'clear_completed' (remove done items). Returns { ok, items, items_summary } (items = structured array; items_summary = formatted text).",
@@ -1894,12 +1914,8 @@ ${done}/${items.length} done | ${inProg} in progress | ${pending} pending`);
1894
1914
  },
1895
1915
  required: ["action"]
1896
1916
  },
1897
- handler: (input) => {
1898
- const action = actions[input.action];
1899
- if (!action) return fail({ error: "invalid_action" });
1900
- return action(input);
1901
- },
1902
- getItems: () => [...items]
1917
+ handler: (input, ctx) => ops(ctx?.threadId).handle(input),
1918
+ getItems: (threadId) => ops(threadId).getItems()
1903
1919
  };
1904
1920
  }
1905
1921
  function truncateOutput(output, opts) {