@theokit/sdk 5.3.0 → 5.3.2

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 (46) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/dist/{agent-CvmTR9uf.d.ts → agent-CTbU0O1R.d.ts} +20 -1
  3. package/dist/{agent-GACKKINM.cjs → agent-KJLAWKZB.cjs} +5 -5
  4. package/dist/{agent-GACKKINM.cjs.map → agent-KJLAWKZB.cjs.map} +1 -1
  5. package/dist/{agent-VUNM33WJ.js → agent-PNYJ5S2Y.js} +4 -4
  6. package/dist/{agent-VUNM33WJ.js.map → agent-PNYJ5S2Y.js.map} +1 -1
  7. package/dist/{agent-C3KO5LKm.d.cts → agent-QLwxhXY3.d.cts} +20 -1
  8. package/dist/agent.d.ts +20 -2
  9. package/dist/{chunk-43H4EBS2.js → chunk-363RBGIR.js} +37 -9
  10. package/dist/chunk-363RBGIR.js.map +1 -0
  11. package/dist/{chunk-SSIRPWWD.cjs → chunk-65UMH5V3.cjs} +9 -7
  12. package/dist/chunk-65UMH5V3.cjs.map +1 -0
  13. package/dist/{chunk-AI4MXACC.js → chunk-7L3MIW2F.js} +9 -7
  14. package/dist/chunk-7L3MIW2F.js.map +1 -0
  15. package/dist/{chunk-PEAOQMWE.cjs → chunk-L4XENLQO.cjs} +4 -4
  16. package/dist/{chunk-PEAOQMWE.cjs.map → chunk-L4XENLQO.cjs.map} +1 -1
  17. package/dist/{chunk-DEJCKB65.cjs → chunk-Y46VI73J.cjs} +54 -26
  18. package/dist/chunk-Y46VI73J.cjs.map +1 -0
  19. package/dist/{chunk-WHTMFN4Q.js → chunk-ZITYGJOD.js} +3 -3
  20. package/dist/{chunk-WHTMFN4Q.js.map → chunk-ZITYGJOD.js.map} +1 -1
  21. package/dist/{context-XNREEC7M.js → context-BUIE52VH.js} +3 -3
  22. package/dist/{context-XNREEC7M.js.map → context-BUIE52VH.js.map} +1 -1
  23. package/dist/{context-3YMZDEX5.cjs → context-FCCJQ3FN.cjs} +6 -6
  24. package/dist/{context-3YMZDEX5.cjs.map → context-FCCJQ3FN.cjs.map} +1 -1
  25. package/dist/{cron-crfMMdAw.d.ts → cron-Cl8FrK3D.d.ts} +1 -1
  26. package/dist/{cron-C3PhZED0.d.cts → cron-Dz8AOpy3.d.cts} +1 -1
  27. package/dist/cron.cjs +4 -4
  28. package/dist/cron.d.cts +2 -2
  29. package/dist/cron.d.ts +2 -2
  30. package/dist/cron.js +3 -3
  31. package/dist/eval.cjs +3 -3
  32. package/dist/eval.js +2 -2
  33. package/dist/index.cjs +19 -19
  34. package/dist/index.d.cts +23 -5
  35. package/dist/index.d.ts +23 -5
  36. package/dist/index.js +5 -5
  37. package/dist/subagents-loader.d.cts +1 -1
  38. package/dist/subagents-loader.d.ts +1 -1
  39. package/dist/types/plugin.d.ts +20 -1
  40. package/docs/error-codes.md +2 -2
  41. package/docs/harness-capability-map.md +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunk-43H4EBS2.js.map +0 -1
  44. package/dist/chunk-AI4MXACC.js.map +0 -1
  45. package/dist/chunk-DEJCKB65.cjs.map +0 -1
  46. package/dist/chunk-SSIRPWWD.cjs.map +0 -1
@@ -3,7 +3,7 @@
3
3
  var chunkKVSAY6NZ_cjs = require('./chunk-KVSAY6NZ.cjs');
4
4
  var chunkY2KYR2ED_cjs = require('./chunk-Y2KYR2ED.cjs');
5
5
  var chunkZ2JFX372_cjs = require('./chunk-Z2JFX372.cjs');
6
- var chunkSSIRPWWD_cjs = require('./chunk-SSIRPWWD.cjs');
6
+ var chunk65UMH5V3_cjs = require('./chunk-65UMH5V3.cjs');
7
7
  var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
8
8
  var chunkD6POWE7E_cjs = require('./chunk-D6POWE7E.cjs');
9
9
  var chunkTMKTSYDS_cjs = require('./chunk-TMKTSYDS.cjs');
@@ -2122,14 +2122,14 @@ async function readState(filePath) {
2122
2122
  try {
2123
2123
  parsed = JSON.parse(raw);
2124
2124
  } catch {
2125
- chunkSSIRPWWD_cjs.warnOnce(
2125
+ chunk65UMH5V3_cjs.warnOnce(
2126
2126
  "personality-store-json-parse",
2127
2127
  "[theokit-sdk] personality.json is malformed; treating as empty"
2128
2128
  );
2129
2129
  return emptyState();
2130
2130
  }
2131
2131
  if (!isStateV1(parsed)) {
2132
- chunkSSIRPWWD_cjs.warnOnce(
2132
+ chunk65UMH5V3_cjs.warnOnce(
2133
2133
  "personality-store-bad-version",
2134
2134
  `[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
2135
2135
  );
@@ -2160,7 +2160,7 @@ var PersonalityStore = class {
2160
2160
  try {
2161
2161
  await this.#persist(agentId, slug);
2162
2162
  } catch (err) {
2163
- chunkSSIRPWWD_cjs.warnOnce(
2163
+ chunk65UMH5V3_cjs.warnOnce(
2164
2164
  `personality-store-persist-failure-${agentId}`,
2165
2165
  `[theokit-sdk] personality persist failed for ${chunk6LHQPOMI_cjs.redactSecrets(agentId)}: ${chunk6LHQPOMI_cjs.redactSecrets(
2166
2166
  err.message
@@ -2177,7 +2177,7 @@ var PersonalityStore = class {
2177
2177
  try {
2178
2178
  state = await readState(filePath);
2179
2179
  } catch (err) {
2180
- chunkSSIRPWWD_cjs.warnOnce(
2180
+ chunk65UMH5V3_cjs.warnOnce(
2181
2181
  `personality-store-hydrate-failure-${agentId}`,
2182
2182
  `[theokit-sdk] personality hydrate failed for ${chunk6LHQPOMI_cjs.redactSecrets(agentId)}: ${chunk6LHQPOMI_cjs.redactSecrets(
2183
2183
  err.message
@@ -2615,7 +2615,7 @@ var HooksExecutor = class {
2615
2615
  this.config = {};
2616
2616
  return;
2617
2617
  }
2618
- this.config = await chunkSSIRPWWD_cjs.loadHookConfig(this.cwd, this.compatSources);
2618
+ this.config = await chunk65UMH5V3_cjs.loadHookConfig(this.cwd, this.compatSources);
2619
2619
  }
2620
2620
  /** Fire every hook registered for `event` and aggregate the decisions. */
2621
2621
  async run(payload) {
@@ -3440,7 +3440,7 @@ var HISTOGRAM_NAMES = {
3440
3440
  };
3441
3441
  function safeRequire(moduleName) {
3442
3442
  try {
3443
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-DEJCKB65.cjs', document.baseURI).href)));
3443
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-Y46VI73J.cjs', document.baseURI).href)));
3444
3444
  return r(moduleName);
3445
3445
  } catch {
3446
3446
  return void 0;
@@ -3683,7 +3683,7 @@ var cachedOtel;
3683
3683
  function loadOtel() {
3684
3684
  if (cachedOtel === void 0) {
3685
3685
  try {
3686
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-DEJCKB65.cjs', document.baseURI).href)));
3686
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-Y46VI73J.cjs', document.baseURI).href)));
3687
3687
  const mod = r("@opentelemetry/api");
3688
3688
  cachedOtel = mod;
3689
3689
  } catch {
@@ -4147,7 +4147,7 @@ async function loadContextConfig(cwd) {
4147
4147
  });
4148
4148
  if (mdEntities.length > 0) {
4149
4149
  if (fs.existsSync(jsonPath)) {
4150
- chunkSSIRPWWD_cjs.warnOnce(
4150
+ chunk65UMH5V3_cjs.warnOnce(
4151
4151
  "context-both-present",
4152
4152
  "[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
4153
4153
  );
@@ -4157,7 +4157,7 @@ async function loadContextConfig(cwd) {
4157
4157
  };
4158
4158
  }
4159
4159
  if (!fs.existsSync(jsonPath)) return { sources: [] };
4160
- chunkSSIRPWWD_cjs.warnOnce(
4160
+ chunk65UMH5V3_cjs.warnOnce(
4161
4161
  "context-json-deprecated",
4162
4162
  // Names no command: `theokit-migrate-config` was unpublished with the `bin` entry, and a warning
4163
4163
  // that tells you to run something the package does not ship is worse than one that tells you
@@ -4320,13 +4320,13 @@ var PluginsManager = class {
4320
4320
  const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
4321
4321
  const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(this.cwd, pluginsRoot, folderName) : await loadPluginManifestFromJson(this.cwd, jsonPath, folderName);
4322
4322
  if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4323
- chunkSSIRPWWD_cjs.warnOnce(
4323
+ chunk65UMH5V3_cjs.warnOnce(
4324
4324
  `plugin-${folderName}-both`,
4325
4325
  `[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
4326
4326
  );
4327
4327
  }
4328
4328
  if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4329
- chunkSSIRPWWD_cjs.warnOnce(
4329
+ chunk65UMH5V3_cjs.warnOnce(
4330
4330
  "plugin-json-deprecated",
4331
4331
  // Same reason as the context.json warning: the CLI it used to name is no longer published.
4332
4332
  "[theokit-sdk] plugin.json manifests are deprecated; replace each with a PLUGIN.md"
@@ -4456,7 +4456,13 @@ function registerLocalAgent(args) {
4456
4456
  agentId: args.agentId,
4457
4457
  runtime: "local",
4458
4458
  name: args.options.name,
4459
- summary: "Local contract fixture",
4459
+ // #611 — a runtime label, not a fixture name. `SDKAgentInfo.summary` is `@public` and required,
4460
+ // `AgentOptions` has no `summary` for a consumer to override, and this line was unconditional —
4461
+ // so "Local contract fixture" was the only value the field could hold for a local agent, and it
4462
+ // was measured reaching a user's session record on disk. The cloud sibling already guards its
4463
+ // own fixture string behind `isFixtureMode()`; there is no local equivalent to port, so the
4464
+ // local branch simply takes the non-fixture value.
4465
+ summary: "Local agent",
4460
4466
  model: args.model,
4461
4467
  createdAt: Date.now(),
4462
4468
  lastModified: Date.now(),
@@ -7210,7 +7216,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
7210
7216
  if (exposedSet.has(name)) continue;
7211
7217
  const hint = suggestClosest(name, exposedSet);
7212
7218
  const message = hint !== void 0 ? `[theokit-sdk] personality "${opts?.personalityName ?? "?"}" references unknown tool "${name}"; did you mean "${hint}"?` : `[theokit-sdk] personality "${opts?.personalityName ?? "?"}" references unknown tool "${name}" (not exposed)`;
7213
- chunkSSIRPWWD_cjs.warnOnce(
7219
+ chunk65UMH5V3_cjs.warnOnce(
7214
7220
  `personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
7215
7221
  message
7216
7222
  );
@@ -8987,7 +8993,7 @@ function addEntity(byName, entity, origin, collisionMap) {
8987
8993
  );
8988
8994
  }
8989
8995
  if (origin === "project" && collisionMap?.has(fm.name)) {
8990
- chunkSSIRPWWD_cjs.warnOnce(
8996
+ chunk65UMH5V3_cjs.warnOnce(
8991
8997
  `personality-collision-${fm.name}`,
8992
8998
  `[theokit-sdk] personality "${fm.name}" overridden by project preset`
8993
8999
  );
@@ -9037,14 +9043,14 @@ async function performPersonalitySwitch(args) {
9037
9043
 
9038
9044
  // src/internal/local-agent/local-agent-personality-extensions.ts
9039
9045
  function resolveActivePersonalityPreset(args) {
9040
- const forkCtx = chunkSSIRPWWD_cjs.currentPersonalityContext();
9046
+ const forkCtx = chunk65UMH5V3_cjs.currentPersonalityContext();
9041
9047
  const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
9042
9048
  if (slug === void 0) return void 0;
9043
9049
  return args.personalityRegistry?.get(slug);
9044
9050
  }
9045
9051
  async function ensurePersonalityRegistryIfNeeded(args) {
9046
9052
  if (args.personalityRegistry !== void 0) return args.personalityRegistry;
9047
- const forkSlug = chunkSSIRPWWD_cjs.currentPersonalityContext()?.slug;
9053
+ const forkSlug = chunk65UMH5V3_cjs.currentPersonalityContext()?.slug;
9048
9054
  const ownSlug = args.personalityStore.active(args.agentId);
9049
9055
  if (forkSlug === void 0 && ownSlug === void 0) return void 0;
9050
9056
  return await PersonalityRegistry.load(args.workspaceCwd);
@@ -9057,8 +9063,8 @@ function applyPersonalityOverlay(preset, base) {
9057
9063
  ${preset.systemPrompt}`;
9058
9064
  }
9059
9065
  async function localAgentUsePersonality(agent, name, opts) {
9060
- if (chunkSSIRPWWD_cjs.currentPersonalityContext() !== void 0) {
9061
- chunkSSIRPWWD_cjs.warnPersonalitySwitchInsideFork(agent.agentId);
9066
+ if (chunk65UMH5V3_cjs.currentPersonalityContext() !== void 0) {
9067
+ chunk65UMH5V3_cjs.warnPersonalitySwitchInsideFork(agent.agentId);
9062
9068
  return null;
9063
9069
  }
9064
9070
  if (agent.personalityRegistry === void 0) {
@@ -9119,7 +9125,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
9119
9125
  async function localAgentFork(parent, options) {
9120
9126
  const { forkAgentImpl } = await import('./fork-agent-WAEQI2DL.cjs');
9121
9127
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9122
- const { withPersonalityContext } = await import('./context-3YMZDEX5.cjs');
9128
+ const { withPersonalityContext } = await import('./context-FCCJQ3FN.cjs');
9123
9129
  const create = getAgentFacade().create;
9124
9130
  return withPersonalityContext(
9125
9131
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -10424,14 +10430,17 @@ function commonAgentInfo(agent, fallbackSummary) {
10424
10430
  }
10425
10431
  function toLocalAgentInfo(agent) {
10426
10432
  return {
10427
- ...commonAgentInfo(agent, "Local contract fixture"),
10433
+ ...commonAgentInfo(agent, "Local agent"),
10428
10434
  runtime: "local",
10429
10435
  ...agent.cwd !== void 0 ? { cwd: agent.cwd } : {}
10430
10436
  };
10431
10437
  }
10432
10438
  function toCloudAgentInfo(agent) {
10433
10439
  return {
10434
- ...commonAgentInfo(agent, "Cloud contract fixture"),
10440
+ // Same fallback, same reason (#611). The cloud REGISTRATION already guards its fixture string
10441
+ // behind `isFixtureMode()`, so this line only answers for a record that carries no summary —
10442
+ // and a fixture name is the wrong answer for that record whichever runtime it came from.
10443
+ ...commonAgentInfo(agent, "Cloud agent"),
10435
10444
  archived: agent.archived,
10436
10445
  runtime: "cloud",
10437
10446
  env: { type: "cloud" },
@@ -10923,11 +10932,30 @@ var Agent = class _Agent {
10923
10932
  };
10924
10933
  }
10925
10934
  /**
10926
- * Permanently delete a cloud agent.
10935
+ * Permanently delete a registered agent — local or cloud.
10936
+ *
10937
+ * #612 — this HYDRATES before removing, and until it did the method was a no-op against the
10938
+ * persisted registry whenever the agent was not already in this process's memory. Which is every
10939
+ * agent in a freshly started process: `removeRegisteredAgent` only schedules a save when the entry
10940
+ * was in the Map, so `agents.delete()` returned `false`, nothing was scheduled, and
10941
+ * `flushRegistrySaves()` flushed an empty queue. The entry survived and this returned normally.
10942
+ *
10943
+ * Every neighbouring mutator already did this — `rename` and `archive` reach
10944
+ * `getRegisteredAgentOrThrow`, which hydrates on a miss. `delete` was the only one that did not.
10945
+ *
10946
+ * `options.cwd` is read rather than defaulted away: it is declared on `AgentOperationOptions`, and
10947
+ * hydrating `process.cwd()` unconditionally is the B-115 defect — an option that compiles and does
10948
+ * nothing — on the one path that is supposed to remove data.
10949
+ *
10950
+ * Deleting an unknown id still resolves rather than throwing, deliberately. `rename` throws
10951
+ * `UnknownAgentError` and matching it here is defensible, but it is a breaking change for callers
10952
+ * that delete idempotently, and an entry and its transcript can legitimately outlive one another
10953
+ * in both directions. That decision belongs to its own change, not to a persistence fix.
10927
10954
  *
10928
10955
  * @public
10929
10956
  */
10930
- static async delete(agentId, _options = {}) {
10957
+ static async delete(agentId, options = {}) {
10958
+ await hydrateRegistryFromDisk(options.cwd ?? process.cwd());
10931
10959
  removeRegisteredAgent(agentId);
10932
10960
  await flushRegistrySaves();
10933
10961
  }
@@ -10991,5 +11019,5 @@ exports.generateCronId = generateCronId;
10991
11019
  exports.getPricingEntry = getPricingEntry;
10992
11020
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
10993
11021
  exports.resolveSessionDir = resolveSessionDir;
10994
- //# sourceMappingURL=chunk-DEJCKB65.cjs.map
10995
- //# sourceMappingURL=chunk-DEJCKB65.cjs.map
11022
+ //# sourceMappingURL=chunk-Y46VI73J.cjs.map
11023
+ //# sourceMappingURL=chunk-Y46VI73J.cjs.map