@theokit/sdk 4.33.1 → 4.34.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 (70) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{agent-LIVADAZ4.js → agent-EQQA5VGX.js} +8 -8
  3. package/dist/{agent-LIVADAZ4.js.map → agent-EQQA5VGX.js.map} +1 -1
  4. package/dist/{agent-T2AIB3EV.cjs → agent-W6NI3HY4.cjs} +9 -9
  5. package/dist/{agent-T2AIB3EV.cjs.map → agent-W6NI3HY4.cjs.map} +1 -1
  6. package/dist/{chunk-3CMIY3N7.js → chunk-5QMXYX3X.js} +3 -3
  7. package/dist/{chunk-3CMIY3N7.js.map → chunk-5QMXYX3X.js.map} +1 -1
  8. package/dist/{chunk-SDYJESYZ.js → chunk-7BTE3RXJ.js} +13 -9
  9. package/dist/{chunk-SDYJESYZ.js.map → chunk-7BTE3RXJ.js.map} +1 -1
  10. package/dist/{chunk-E33A7YIR.cjs → chunk-G4WI3VW2.cjs} +12 -8
  11. package/dist/chunk-G4WI3VW2.cjs.map +1 -0
  12. package/dist/{chunk-2BYBFBNH.cjs → chunk-IAZX7RZM.cjs} +24 -7
  13. package/dist/chunk-IAZX7RZM.cjs.map +1 -0
  14. package/dist/{chunk-TOVGIP4L.js → chunk-IPHW3VKP.js} +14 -6
  15. package/dist/chunk-IPHW3VKP.js.map +1 -0
  16. package/dist/{chunk-KT6SWUY6.js → chunk-IX2LKBCD.js} +3 -3
  17. package/dist/{chunk-KT6SWUY6.js.map → chunk-IX2LKBCD.js.map} +1 -1
  18. package/dist/{chunk-WKSVAP6H.cjs → chunk-IZFZ6RHA.cjs} +5 -5
  19. package/dist/{chunk-WKSVAP6H.cjs.map → chunk-IZFZ6RHA.cjs.map} +1 -1
  20. package/dist/{chunk-NEPJ3TC4.cjs → chunk-JYMBHNNU.cjs} +13 -5
  21. package/dist/chunk-JYMBHNNU.cjs.map +1 -0
  22. package/dist/{chunk-FX2DAR5R.cjs → chunk-M2PU44HP.cjs} +3 -3
  23. package/dist/{chunk-FX2DAR5R.cjs.map → chunk-M2PU44HP.cjs.map} +1 -1
  24. package/dist/{chunk-GBCQ5742.js → chunk-RKG6QFCJ.js} +3 -3
  25. package/dist/{chunk-GBCQ5742.js.map → chunk-RKG6QFCJ.js.map} +1 -1
  26. package/dist/{chunk-4LXCZSIC.js → chunk-TPTHVSIG.js} +23 -9
  27. package/dist/chunk-TPTHVSIG.js.map +1 -0
  28. package/dist/{chunk-SIJZVUUD.cjs → chunk-TS6IPRME.cjs} +56 -42
  29. package/dist/chunk-TS6IPRME.cjs.map +1 -0
  30. package/dist/{chunk-F5RLC6ZH.js → chunk-VQ6NY4F5.js} +23 -6
  31. package/dist/chunk-VQ6NY4F5.js.map +1 -0
  32. package/dist/{chunk-FTRNHGAD.cjs → chunk-WEHUJ7ZS.cjs} +8 -8
  33. package/dist/{chunk-FTRNHGAD.cjs.map → chunk-WEHUJ7ZS.cjs.map} +1 -1
  34. package/dist/{compact-session-J7VNCICZ.js → compact-session-5BDD4HIB.js} +4 -4
  35. package/dist/{compact-session-J7VNCICZ.js.map → compact-session-5BDD4HIB.js.map} +1 -1
  36. package/dist/{compact-session-24PK2G4M.cjs → compact-session-BEA3IOON.cjs} +12 -12
  37. package/dist/{compact-session-24PK2G4M.cjs.map → compact-session-BEA3IOON.cjs.map} +1 -1
  38. package/dist/compaction.cjs +14 -14
  39. package/dist/compaction.d.cts +9 -4
  40. package/dist/compaction.d.ts +9 -4
  41. package/dist/compaction.js +1 -1
  42. package/dist/cron.cjs +8 -8
  43. package/dist/cron.js +7 -7
  44. package/dist/eval.cjs +7 -7
  45. package/dist/eval.js +6 -6
  46. package/dist/{fs-session-store-ENQIIMIR.cjs → fs-session-store-QS763E3Y.cjs} +5 -5
  47. package/dist/{fs-session-store-ENQIIMIR.cjs.map → fs-session-store-QS763E3Y.cjs.map} +1 -1
  48. package/dist/fs-session-store-SJ3RA5I2.js +10 -0
  49. package/dist/{fs-session-store-RKLORRCG.js.map → fs-session-store-SJ3RA5I2.js.map} +1 -1
  50. package/dist/index.cjs +29 -29
  51. package/dist/index.js +9 -9
  52. package/dist/{inject-session-343WIDCM.cjs → inject-session-SMH56NXP.cjs} +4 -4
  53. package/dist/{inject-session-343WIDCM.cjs.map → inject-session-SMH56NXP.cjs.map} +1 -1
  54. package/dist/{inject-session-RZEDWO53.js → inject-session-V5FTK72N.js} +3 -3
  55. package/dist/{inject-session-RZEDWO53.js.map → inject-session-V5FTK72N.js.map} +1 -1
  56. package/dist/internal/persistence/fs-session-store.d.cts +15 -0
  57. package/dist/internal/persistence/fs-session-store.d.ts +15 -0
  58. package/dist/internal/persistence/session-writer.d.cts +14 -4
  59. package/dist/internal/persistence/session-writer.d.ts +14 -4
  60. package/dist/persistence.cjs +3 -3
  61. package/dist/persistence.js +1 -1
  62. package/package.json +1 -1
  63. package/dist/chunk-2BYBFBNH.cjs.map +0 -1
  64. package/dist/chunk-4LXCZSIC.js.map +0 -1
  65. package/dist/chunk-E33A7YIR.cjs.map +0 -1
  66. package/dist/chunk-F5RLC6ZH.js.map +0 -1
  67. package/dist/chunk-NEPJ3TC4.cjs.map +0 -1
  68. package/dist/chunk-SIJZVUUD.cjs.map +0 -1
  69. package/dist/chunk-TOVGIP4L.js.map +0 -1
  70. package/dist/fs-session-store-RKLORRCG.js +0 -10
@@ -1,8 +1,8 @@
1
1
  import { extractCodePlugins } from './chunk-2SFBB54R.js';
2
2
  import { submit, emitRunEvent } from './chunk-HRA3CPGG.js';
3
- import { enqueueSessionWrite, hydrateSession, flushSessionWrites, descartarSessao, persistTurnToTranscript, appendSessionMessage, getSessionMessages, clearSession } from './chunk-SDYJESYZ.js';
4
- import { FsSessionStore } from './chunk-F5RLC6ZH.js';
5
- import { discoverProviderPlugins, CircuitBreaker, buildDefaultSummarizer, parseSseStream, resolveProviderChain, inferProviderFromApiKey, detectPrimaryProvider, tryFirstEvent, relayStream, mapOpenAICompatibleError, renderToolResultContentText } from './chunk-KT6SWUY6.js';
3
+ import { enqueueSessionWrite, hydrateSession, flushSessionWrites, descartarSessao, persistTurnToTranscript, appendSessionMessage, getSessionMessages, clearSession } from './chunk-7BTE3RXJ.js';
4
+ import { FsSessionStore } from './chunk-VQ6NY4F5.js';
5
+ import { discoverProviderPlugins, CircuitBreaker, buildDefaultSummarizer, parseSseStream, resolveProviderChain, inferProviderFromApiKey, detectPrimaryProvider, tryFirstEvent, relayStream, mapOpenAICompatibleError, renderToolResultContentText } from './chunk-IX2LKBCD.js';
6
6
  import { IndexManager, writeSessionSummary, memoryDir, globalEmbeddingCache, appendFact, readFacts, legacyMemoryJsonPath, memoryMdPath, appendFactToMarkdown } from './chunk-XAUBQMQU.js';
7
7
  import { loadHookConfig, warnOnce, currentPersonalityContext, warnPersonalitySwitchInsideFork } from './chunk-XIG2IE3L.js';
8
8
  import { resolveChildEnv } from './chunk-7GFX45DD.js';
@@ -19,7 +19,7 @@ import { defaultBaseDir, expandTilde } from './chunk-Q56IYTBZ.js';
19
19
  import { toJsonSchema } from './chunk-4VPXM6UU.js';
20
20
  import { atomicWriteJson } from './chunk-S2BBRVQX.js';
21
21
  import { loadSubagents } from './chunk-BNIFFFH3.js';
22
- import { resolveEffectiveContextWindow, CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN } from './chunk-GBCQ5742.js';
22
+ import { resolveEffectiveContextWindow, CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN } from './chunk-RKG6QFCJ.js';
23
23
  import { parseModelId } from './chunk-X2FR4OIT.js';
24
24
  import { getCatalogModelInfo, registerBuiltins, getProviderProfile, registerProvider, isPatchedModelKey } from './chunk-KAP4GJHO.js';
25
25
  import { escapeBlockBody, buildSkillsBlock, discoverSkills, stripSkillFrontmatter } from './chunk-5IB2UKSN.js';
@@ -9509,6 +9509,19 @@ function registerRunAsTask(run, agentId, taskOpt, userText) {
9509
9509
  }
9510
9510
 
9511
9511
  // src/internal/local-agent/local-agent.ts
9512
+ async function adquirirLeaseSePossivel(store, agentId) {
9513
+ const a = store.acquire;
9514
+ if (typeof a !== "function") return;
9515
+ try {
9516
+ await a.call(store, agentId);
9517
+ } catch (err) {
9518
+ if (err instanceof Error && err.name === "SessionBusyError") throw err;
9519
+ process.stderr.write(
9520
+ `[theokit-sdk] writer lease unavailable for ${agentId} (${err instanceof Error ? err.message : String(err)}) \u2014 proceeding without single-writer protection
9521
+ `
9522
+ );
9523
+ }
9524
+ }
9512
9525
  async function disposeSessionStore(store) {
9513
9526
  const d = store.dispose;
9514
9527
  if (typeof d === "function") await d.call(store);
@@ -9624,6 +9637,7 @@ var LocalAgent = class {
9624
9637
  this.settingSourcesIncludeProject,
9625
9638
  this.options.agents
9626
9639
  );
9640
+ await adquirirLeaseSePossivel(this.sessionStore, this.agentId);
9627
9641
  await hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9628
9642
  await this.personalityStore.hydrate(this.agentId);
9629
9643
  }
@@ -10424,7 +10438,7 @@ var Agent = class _Agent {
10424
10438
  `No local agent "${agentId}" registered \u2014 compact targets local sessions.`
10425
10439
  );
10426
10440
  }
10427
- const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-J7VNCICZ.js');
10441
+ const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-5BDD4HIB.js');
10428
10442
  const { cwd, model, store } = await abrirStoreLocal(reg);
10429
10443
  return enqueueSessionWrite(
10430
10444
  cwd,
@@ -10460,7 +10474,7 @@ var Agent = class _Agent {
10460
10474
  `No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
10461
10475
  );
10462
10476
  }
10463
- const { injectSessionTurn } = await import('./inject-session-RZEDWO53.js');
10477
+ const { injectSessionTurn } = await import('./inject-session-V5FTK72N.js');
10464
10478
  const { cwd, model, store } = await abrirStoreLocal(reg);
10465
10479
  await injectSessionTurn({
10466
10480
  store,
@@ -10507,12 +10521,12 @@ async function abrirStoreLocal(reg) {
10507
10521
  const cwd = reg.cwd ?? process.cwd();
10508
10522
  const optModel = reg.options.model;
10509
10523
  const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
10510
- const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-RKLORRCG.js');
10524
+ const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-SJ3RA5I2.js');
10511
10525
  const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-F2ANTA2M.js');
10512
10526
  const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
10513
10527
  return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
10514
10528
  }
10515
10529
 
10516
10530
  export { Agent, AgentBuilder, DEFAULT_AGENTIC_MODEL_ID, MEMORY_EMBEDDING_ADAPTERS, Tool, ToolError, UsageAccumulator, computeCost, generateCronId, getPricingEntry, httpRequest, isFixtureApiKey, openRouterMemoryEmbeddingProviderAdapter, resolveApiKey, shouldUseFixtureMode };
10517
- //# sourceMappingURL=chunk-4LXCZSIC.js.map
10518
- //# sourceMappingURL=chunk-4LXCZSIC.js.map
10531
+ //# sourceMappingURL=chunk-TPTHVSIG.js.map
10532
+ //# sourceMappingURL=chunk-TPTHVSIG.js.map