@theokit/sdk 5.13.0 → 5.14.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 (107) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{agent-iW5kPpfT.d.cts → agent-DExqjqYy.d.cts} +9 -1
  3. package/dist/{agent-DSMuwADp.d.ts → agent-Dfw3VsIX.d.ts} +9 -1
  4. package/dist/{agent-5DSDDH7K.js → agent-T34LCGQM.js} +11 -11
  5. package/dist/{agent-5DSDDH7K.js.map → agent-T34LCGQM.js.map} +1 -1
  6. package/dist/{agent-WOMRT3KX.cjs → agent-TL4K7BTG.cjs} +12 -12
  7. package/dist/{agent-WOMRT3KX.cjs.map → agent-TL4K7BTG.cjs.map} +1 -1
  8. package/dist/auth/index.cjs +17 -16
  9. package/dist/auth/index.cjs.map +1 -1
  10. package/dist/auth/index.js +5 -4
  11. package/dist/auth/index.js.map +1 -1
  12. package/dist/{chunk-NHOEXFZT.js → chunk-2HXTNVLM.js} +5 -2
  13. package/dist/chunk-2HXTNVLM.js.map +1 -0
  14. package/dist/{chunk-KL7ZUMK3.cjs → chunk-2WY2OFSC.cjs} +146 -77
  15. package/dist/chunk-2WY2OFSC.cjs.map +1 -0
  16. package/dist/{chunk-3FSBE4PS.js → chunk-3GTN4HOO.js} +10 -6
  17. package/dist/chunk-3GTN4HOO.js.map +1 -0
  18. package/dist/{chunk-XOYNB3YN.js → chunk-3ONIVO2I.js} +3 -3
  19. package/dist/{chunk-XOYNB3YN.js.map → chunk-3ONIVO2I.js.map} +1 -1
  20. package/dist/{chunk-7WARNHWW.cjs → chunk-3UMPP553.cjs} +5 -2
  21. package/dist/chunk-3UMPP553.cjs.map +1 -0
  22. package/dist/{chunk-NWWTYBD3.cjs → chunk-4KBI37F3.cjs} +5 -5
  23. package/dist/{chunk-NWWTYBD3.cjs.map → chunk-4KBI37F3.cjs.map} +1 -1
  24. package/dist/{chunk-S46WJTDL.cjs → chunk-4TEGFMSP.cjs} +6 -6
  25. package/dist/{chunk-S46WJTDL.cjs.map → chunk-4TEGFMSP.cjs.map} +1 -1
  26. package/dist/{chunk-QISSETTG.cjs → chunk-5645PMVU.cjs} +6 -4
  27. package/dist/chunk-5645PMVU.cjs.map +1 -0
  28. package/dist/{chunk-5A4UFBHW.cjs → chunk-A77UMVMD.cjs} +15 -11
  29. package/dist/chunk-A77UMVMD.cjs.map +1 -0
  30. package/dist/{chunk-47EACDOC.cjs → chunk-BZK5QL3N.cjs} +4 -4
  31. package/dist/{chunk-47EACDOC.cjs.map → chunk-BZK5QL3N.cjs.map} +1 -1
  32. package/dist/{chunk-5HSMH2ZZ.js → chunk-CJN5CEI3.js} +4 -4
  33. package/dist/{chunk-5HSMH2ZZ.js.map → chunk-CJN5CEI3.js.map} +1 -1
  34. package/dist/{chunk-JX4LB6XO.js → chunk-GARVAUCU.js} +93 -24
  35. package/dist/chunk-GARVAUCU.js.map +1 -0
  36. package/dist/{chunk-DVP3YMDA.cjs → chunk-LXG6VL6R.cjs} +3 -3
  37. package/dist/{chunk-DVP3YMDA.cjs.map → chunk-LXG6VL6R.cjs.map} +1 -1
  38. package/dist/{chunk-ZTP6ZACR.js → chunk-NAVUTK6X.js} +3 -3
  39. package/dist/{chunk-ZTP6ZACR.js.map → chunk-NAVUTK6X.js.map} +1 -1
  40. package/dist/{chunk-2SFLLOMN.js → chunk-NVQSBRG6.js} +3 -3
  41. package/dist/{chunk-2SFLLOMN.js.map → chunk-NVQSBRG6.js.map} +1 -1
  42. package/dist/{chunk-MS3TQSXU.js → chunk-QD6B6W6I.js} +6 -4
  43. package/dist/chunk-QD6B6W6I.js.map +1 -0
  44. package/dist/chunk-R5UQL2R5.cjs +18 -0
  45. package/dist/{chunk-LO6LIUZ6.cjs.map → chunk-R5UQL2R5.cjs.map} +1 -1
  46. package/dist/{chunk-4UYHP6NF.cjs → chunk-SNVYOX46.cjs} +28 -28
  47. package/dist/{chunk-4UYHP6NF.cjs.map → chunk-SNVYOX46.cjs.map} +1 -1
  48. package/dist/{chunk-NKQVLWDF.js → chunk-ULEK4OM4.js} +3 -3
  49. package/dist/{chunk-NKQVLWDF.js.map → chunk-ULEK4OM4.js.map} +1 -1
  50. package/dist/{chunk-2PRGRYEQ.js → chunk-ZOL3L4EH.js} +4 -4
  51. package/dist/{chunk-2PRGRYEQ.js.map → chunk-ZOL3L4EH.js.map} +1 -1
  52. package/dist/{compact-session-B7P6EU3Z.cjs → compact-session-D2MQDB6G.cjs} +15 -15
  53. package/dist/{compact-session-B7P6EU3Z.cjs.map → compact-session-D2MQDB6G.cjs.map} +1 -1
  54. package/dist/{compact-session-5HMX6KYT.js → compact-session-N2PPHQO6.js} +6 -6
  55. package/dist/{compact-session-5HMX6KYT.js.map → compact-session-N2PPHQO6.js.map} +1 -1
  56. package/dist/{cron-DdKzwJqK.d.ts → cron-BubDpFJG.d.ts} +2 -2
  57. package/dist/{cron-BvxrLW5J.d.cts → cron-CK2v0VWA.d.cts} +2 -2
  58. package/dist/cron.cjs +11 -11
  59. package/dist/cron.d.cts +3 -3
  60. package/dist/cron.d.ts +3 -3
  61. package/dist/cron.js +10 -10
  62. package/dist/eval.cjs +10 -10
  63. package/dist/eval.js +9 -9
  64. package/dist/index.cjs +69 -53
  65. package/dist/index.cjs.map +1 -1
  66. package/dist/index.d.cts +9 -6
  67. package/dist/index.d.ts +9 -6
  68. package/dist/index.js +38 -22
  69. package/dist/index.js.map +1 -1
  70. package/dist/{inject-session-WOH7TPDX.cjs → inject-session-3ICZIJ2N.cjs} +4 -4
  71. package/dist/{inject-session-WOH7TPDX.cjs.map → inject-session-3ICZIJ2N.cjs.map} +1 -1
  72. package/dist/{inject-session-75L3NCNL.js → inject-session-J26SHHIO.js} +3 -3
  73. package/dist/{inject-session-75L3NCNL.js.map → inject-session-J26SHHIO.js.map} +1 -1
  74. package/dist/internal/agent-loop/prune-tool-results.d.ts +37 -0
  75. package/dist/internal/auth/credential-store.d.ts +1 -1
  76. package/dist/internal/auth/types.d.ts +4 -0
  77. package/dist/internal/runtime/skills/binary-on-path.d.ts +1 -0
  78. package/dist/internal/runtime/skills/discover-skills.d.ts +2 -0
  79. package/dist/mcp-auth.cjs +2 -2
  80. package/dist/mcp-auth.js +1 -1
  81. package/dist/models.cjs +11 -11
  82. package/dist/models.js +4 -4
  83. package/dist/providers.cjs +6 -6
  84. package/dist/providers.js +4 -4
  85. package/dist/{sdk-agent-4-dXI2GS.d.cts → sdk-agent-DwzHcuxy.d.cts} +28 -3
  86. package/dist/{sdk-agent-CTOJlWA_.d.ts → sdk-agent-a3fW1xUK.d.ts} +28 -3
  87. package/dist/skills.cjs +4 -4
  88. package/dist/skills.js +1 -1
  89. package/dist/subagents-loader.d.cts +2 -2
  90. package/dist/subagents-loader.d.ts +2 -2
  91. package/dist/types/agent.d.ts +6 -0
  92. package/dist/types/run.d.ts +27 -2
  93. package/dist/workflow.d.cts +1 -1
  94. package/dist/workflow.d.ts +1 -1
  95. package/docs/adr/mutation-testing-scope.md +56 -0
  96. package/docs/error-codes.md +8 -6
  97. package/docs/harness-capability-map.md +29 -1
  98. package/package.json +1 -1
  99. package/dist/chunk-3FSBE4PS.js.map +0 -1
  100. package/dist/chunk-5A4UFBHW.cjs.map +0 -1
  101. package/dist/chunk-7WARNHWW.cjs.map +0 -1
  102. package/dist/chunk-JX4LB6XO.js.map +0 -1
  103. package/dist/chunk-KL7ZUMK3.cjs.map +0 -1
  104. package/dist/chunk-LO6LIUZ6.cjs +0 -18
  105. package/dist/chunk-MS3TQSXU.js.map +0 -1
  106. package/dist/chunk-NHOEXFZT.js.map +0 -1
  107. package/dist/chunk-QISSETTG.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkDVP3YMDA_cjs = require('./chunk-DVP3YMDA.cjs');
3
+ var chunkLXG6VL6R_cjs = require('./chunk-LXG6VL6R.cjs');
4
4
  var chunkYJNYDJ2T_cjs = require('./chunk-YJNYDJ2T.cjs');
5
5
  require('./chunk-MSW7LB2V.cjs');
6
6
  var chunk3WKWBYPO_cjs = require('./chunk-3WKWBYPO.cjs');
@@ -10,7 +10,7 @@ require('./chunk-RNXXYF22.cjs');
10
10
 
11
11
  // src/internal/session/inject-session.ts
12
12
  async function injectSessionTurn(opts) {
13
- await chunkDVP3YMDA_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
13
+ await chunkLXG6VL6R_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
14
14
  const prior = await opts.store.readRecords(opts.loc.agentId);
15
15
  const transcript = chunk3WKWBYPO_cjs.SessionTranscript.fromRecords(prior, {
16
16
  cwd: opts.loc.cwd,
@@ -25,5 +25,5 @@ async function injectSessionTurn(opts) {
25
25
  }
26
26
 
27
27
  exports.injectSessionTurn = injectSessionTurn;
28
- //# sourceMappingURL=inject-session-WOH7TPDX.cjs.map
29
- //# sourceMappingURL=inject-session-WOH7TPDX.cjs.map
28
+ //# sourceMappingURL=inject-session-3ICZIJ2N.cjs.map
29
+ //# sourceMappingURL=inject-session-3ICZIJ2N.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-WOH7TPDX.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-3ICZIJ2N.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { enqueueSessionWrite } from './chunk-XOYNB3YN.js';
1
+ import { enqueueSessionWrite } from './chunk-3ONIVO2I.js';
2
2
  import { invalidateSessionCache } from './chunk-2XC6KDJM.js';
3
3
  import './chunk-AGO5S5WD.js';
4
4
  import { SessionTranscript } from './chunk-XESYJ4JC.js';
@@ -23,5 +23,5 @@ async function injectSessionTurn(opts) {
23
23
  }
24
24
 
25
25
  export { injectSessionTurn };
26
- //# sourceMappingURL=inject-session-75L3NCNL.js.map
27
- //# sourceMappingURL=inject-session-75L3NCNL.js.map
26
+ //# sourceMappingURL=inject-session-J26SHHIO.js.map
27
+ //# sourceMappingURL=inject-session-J26SHHIO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-75L3NCNL.js","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-J26SHHIO.js","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * B-564 — opt-in pruning of aged tool results from the next LLM request.
3
+ *
4
+ * The loop resends every tool result of a run on every later call; with
5
+ * `SendOptions.pruneToolResults` set, results older than `olderThanRounds` tool rounds are
6
+ * replaced by a short stub in the REQUEST copy only. The transcript the loop keeps, persists and
7
+ * resumes from is never touched, so a pruned result can always be recovered (plan D1).
8
+ *
9
+ * Position among tool-result messages is the round distance: at call n the newest tool-result
10
+ * message is round n - 1. So no round counter is threaded through the loop. Text-only feedback
11
+ * messages the loop pushes between rounds carry no `tool_result` part and do not count.
12
+ *
13
+ * A pruned part keeps its `toolUseId` and `isError`: every `tool_use` must still have a paired
14
+ * `tool_result` on both wires, so the result is shortened, never removed.
15
+ */
16
+ import type { PruneToolResultsOptions } from "../../types/run.js";
17
+ import type { LlmMessage } from "../llm/types.js";
18
+ export type { PruneToolResultsOptions } from "../../types/run.js";
19
+ /**
20
+ * Build the messages for one LLM request with aged tool results replaced by a stub.
21
+ *
22
+ * Each new round stubs one more previously sent result, so on providers that cache message
23
+ * prefixes the cached prefix ends earlier; that cost was not measured.
24
+ *
25
+ * @param messages - The loop transcript. Never mutated.
26
+ * @param options - Absent means no pruning: the input array itself is returned, so the
27
+ * option-off request is byte-identical to the transcript.
28
+ * @returns A new array when `options` is set; untouched messages are the same objects.
29
+ */
30
+ export declare function pruneToolResultsForRequest(messages: LlmMessage[], options: PruneToolResultsOptions | undefined): LlmMessage[];
31
+ /**
32
+ * Fail fast on an option that cannot describe an age in rounds.
33
+ *
34
+ * @throws ConfigurationError with code `invalid_prune_tool_results` when `olderThanRounds` is
35
+ * not an integer of at least 1.
36
+ */
37
+ export declare function validatePruneToolResults(options: PruneToolResultsOptions | undefined): void;
@@ -69,7 +69,7 @@ export declare function readStoredOAuth(config: CredentialStoreConfig, env?: Rec
69
69
  * file in the same directory with `wx` (O_EXCL), fsync, close, chmod, then `rename` (atomic on POSIX) —
70
70
  * so a crash mid-write leaves whatever was there untouched, and a pre-planted symlink cannot capture the
71
71
  * key. The api variant persists the unchanged `{provider, api_key}` (back-compat, no `type` key); the
72
- * oauth variant persists `{type:'oauth', provider, access, refresh, expires, account_id?}`.
72
+ * oauth variant persists `{type:'oauth', provider, access, refresh, expires, account_id?, id_token?}`.
73
73
  */
74
74
  export declare function writeCredential(cred: {
75
75
  provider: string;
@@ -109,6 +109,8 @@ export interface StoredOAuthCredential {
109
109
  /** Epoch ms the access token expires. */
110
110
  expires: number;
111
111
  account_id?: string;
112
+ /** The provider's OpenID ID token, when its token endpoint returned one (#821). */
113
+ id_token?: string;
112
114
  }
113
115
  /**
114
116
  * Whatever the credential file turned out to hold — the two variants are discriminated by `type`.
@@ -137,6 +139,8 @@ export interface OAuthTokens {
137
139
  /** Epoch ms the access token expires. */
138
140
  expires: number;
139
141
  accountId?: string;
142
+ /** The OpenID ID token, when the token endpoint returned one (#821). */
143
+ idToken?: string;
140
144
  }
141
145
  /** Injected HTTP + clock effects — deterministic in tests, real in production. */
142
146
  export interface HttpDeps {
@@ -0,0 +1 @@
1
+ export {};
@@ -13,6 +13,8 @@ export interface Skill {
13
13
  source: string;
14
14
  category?: string;
15
15
  dependencies?: string[];
16
+ /** `requires-bins` — executables that must be on PATH for the model to be offered this skill. */
17
+ requiresBins?: string[];
16
18
  /** `disable-model-invocation: true` — the model is never told this skill exists. */
17
19
  disableModelInvocation?: boolean;
18
20
  /** `user-invocable: false` — carried for a host that has a picker; this SDK has no such surface. */
package/dist/mcp-auth.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkZOFRNNZD_cjs = require('./chunk-ZOFRNNZD.cjs');
4
- var chunkQISSETTG_cjs = require('./chunk-QISSETTG.cjs');
4
+ var chunk5645PMVU_cjs = require('./chunk-5645PMVU.cjs');
5
5
  var chunkCEGU5AVD_cjs = require('./chunk-CEGU5AVD.cjs');
6
6
  var chunkRNXXYF22_cjs = require('./chunk-RNXXYF22.cjs');
7
7
  var crypto = require('crypto');
@@ -92,7 +92,7 @@ async function getTokens(serverName) {
92
92
  }
93
93
  const filePath = storeFilePath();
94
94
  if (!fs.existsSync(filePath)) return void 0;
95
- chunkQISSETTG_cjs.assertSecureModes(path.dirname(filePath), filePath);
95
+ chunk5645PMVU_cjs.assertSecureModes(path.dirname(filePath), filePath);
96
96
  try {
97
97
  const all = JSON.parse(fs.readFileSync(filePath, "utf8"));
98
98
  return all[serverName];
package/dist/mcp-auth.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { atomicWriteJson } from './chunk-M4U24U6G.js';
2
- import { assertSecureModes } from './chunk-MS3TQSXU.js';
2
+ import { assertSecureModes } from './chunk-QD6B6W6I.js';
3
3
  import { ConfigurationError } from './chunk-TNFOU6SB.js';
4
4
  import { diag } from './chunk-3OY6H3I7.js';
5
5
  import { randomBytes, createHash } from 'crypto';
package/dist/models.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var chunk7INPXUJI_cjs = require('./chunk-7INPXUJI.cjs');
4
- var chunkNWWTYBD3_cjs = require('./chunk-NWWTYBD3.cjs');
4
+ var chunk4KBI37F3_cjs = require('./chunk-4KBI37F3.cjs');
5
5
  var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
6
- var chunkS46WJTDL_cjs = require('./chunk-S46WJTDL.cjs');
6
+ var chunk4TEGFMSP_cjs = require('./chunk-4TEGFMSP.cjs');
7
7
  require('./chunk-NVXXWAU7.cjs');
8
- require('./chunk-5A4UFBHW.cjs');
9
- require('./chunk-QISSETTG.cjs');
8
+ require('./chunk-A77UMVMD.cjs');
9
+ require('./chunk-5645PMVU.cjs');
10
10
  require('./chunk-IOFMRS6T.cjs');
11
11
  var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
12
12
  require('./chunk-CEGU5AVD.cjs');
@@ -85,7 +85,7 @@ function catalogTargets() {
85
85
  if (_catalogTargets !== void 0) return _catalogTargets;
86
86
  _catalogTargets = /* @__PURE__ */ new Map();
87
87
  try {
88
- for (const entry of Object.values(chunkS46WJTDL_cjs.loadProviderCatalog())) {
88
+ for (const entry of Object.values(chunk4TEGFMSP_cjs.loadProviderCatalog())) {
89
89
  const keys = [entry.id, ...entry.aliases ?? []];
90
90
  for (const k of keys) {
91
91
  if (!_catalogTargets.has(k)) _catalogTargets.set(k, { keys });
@@ -99,7 +99,7 @@ function resolvePatchKeys(externalId) {
99
99
  const mapped = MODELS_DEV_ID_MAP[externalId] ?? externalId;
100
100
  const fromCatalog = catalogTargets().get(mapped);
101
101
  if (fromCatalog !== void 0) return fromCatalog.keys;
102
- const profile = chunkS46WJTDL_cjs.getProviderProfile(mapped);
102
+ const profile = chunk4TEGFMSP_cjs.getProviderProfile(mapped);
103
103
  if (profile !== void 0) return [profile.name, ...profile.aliases ?? []];
104
104
  return void 0;
105
105
  }
@@ -116,9 +116,9 @@ function patchIndexFromApiJson(raw) {
116
116
  continue;
117
117
  }
118
118
  for (const [modelId, rawModel] of Object.entries(models)) {
119
- const parsed = chunkS46WJTDL_cjs.catalogModelSchema.safeParse(rawModel);
119
+ const parsed = chunk4TEGFMSP_cjs.catalogModelSchema.safeParse(rawModel);
120
120
  if (!parsed.success) continue;
121
- for (const key of keys) chunkS46WJTDL_cjs.patchModelInfo(`${key}/${modelId}`, parsed.data);
121
+ for (const key of keys) chunk4TEGFMSP_cjs.patchModelInfo(`${key}/${modelId}`, parsed.data);
122
122
  patched++;
123
123
  }
124
124
  }
@@ -218,7 +218,7 @@ function persistAndPatch(path, body) {
218
218
  }
219
219
  }
220
220
  async function refreshModelCatalog(opts = {}) {
221
- chunkS46WJTDL_cjs.registerBuiltins();
221
+ chunk4TEGFMSP_cjs.registerBuiltins();
222
222
  if (fetchDisabledByEnv()) return { source: "skipped", models: 0 };
223
223
  const url = opts.url ?? process.env.THEOKIT_MODELS_URL ?? DEFAULT_URL;
224
224
  const path = cachePathFor(url);
@@ -232,12 +232,12 @@ async function refreshModelCatalog(opts = {}) {
232
232
  return persistAndPatch(path, body);
233
233
  }
234
234
  function getModelInfo(modelId) {
235
- return chunkS46WJTDL_cjs.getCatalogModelInfo(modelId);
235
+ return chunk4TEGFMSP_cjs.getCatalogModelInfo(modelId);
236
236
  }
237
237
 
238
238
  Object.defineProperty(exports, "resolveModelCapabilities", {
239
239
  enumerable: true,
240
- get: function () { return chunkNWWTYBD3_cjs.resolveModelCapabilities; }
240
+ get: function () { return chunk4KBI37F3_cjs.resolveModelCapabilities; }
241
241
  });
242
242
  Object.defineProperty(exports, "parseModelId", {
243
243
  enumerable: true,
package/dist/models.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { Retry } from './chunk-2S4HQCDF.js';
2
- export { resolveModelCapabilities } from './chunk-2SFLLOMN.js';
2
+ export { resolveModelCapabilities } from './chunk-NVQSBRG6.js';
3
3
  import { parseModelId } from './chunk-R7WIIPUR.js';
4
4
  export { parseModelId } from './chunk-R7WIIPUR.js';
5
- import { registerBuiltins, getCatalogModelInfo, catalogModelSchema, patchModelInfo, getProviderProfile, loadProviderCatalog } from './chunk-5HSMH2ZZ.js';
5
+ import { registerBuiltins, getCatalogModelInfo, catalogModelSchema, patchModelInfo, getProviderProfile, loadProviderCatalog } from './chunk-CJN5CEI3.js';
6
6
  import './chunk-AGACYRJ2.js';
7
- import './chunk-3FSBE4PS.js';
8
- import './chunk-MS3TQSXU.js';
7
+ import './chunk-3GTN4HOO.js';
8
+ import './chunk-QD6B6W6I.js';
9
9
  import './chunk-5IUDICRK.js';
10
10
  import { boundFetch } from './chunk-Q7GYMXVC.js';
11
11
  import './chunk-TNFOU6SB.js';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkLO6LIUZ6_cjs = require('./chunk-LO6LIUZ6.cjs');
4
- require('./chunk-S46WJTDL.cjs');
3
+ var chunkR5UQL2R5_cjs = require('./chunk-R5UQL2R5.cjs');
4
+ require('./chunk-4TEGFMSP.cjs');
5
5
  require('./chunk-NVXXWAU7.cjs');
6
- require('./chunk-5A4UFBHW.cjs');
7
- require('./chunk-QISSETTG.cjs');
6
+ require('./chunk-A77UMVMD.cjs');
7
+ require('./chunk-5645PMVU.cjs');
8
8
  require('./chunk-IOFMRS6T.cjs');
9
9
  require('./chunk-EHD25JBZ.cjs');
10
10
  require('./chunk-CEGU5AVD.cjs');
@@ -14,11 +14,11 @@ require('./chunk-RNXXYF22.cjs');
14
14
 
15
15
  Object.defineProperty(exports, "getProviderProfile", {
16
16
  enumerable: true,
17
- get: function () { return chunkLO6LIUZ6_cjs.getProviderProfile; }
17
+ get: function () { return chunkR5UQL2R5_cjs.getProviderProfile; }
18
18
  });
19
19
  Object.defineProperty(exports, "listProviders", {
20
20
  enumerable: true,
21
- get: function () { return chunkLO6LIUZ6_cjs.listProviders; }
21
+ get: function () { return chunkR5UQL2R5_cjs.listProviders; }
22
22
  });
23
23
  //# sourceMappingURL=providers.cjs.map
24
24
  //# sourceMappingURL=providers.cjs.map
package/dist/providers.js CHANGED
@@ -1,8 +1,8 @@
1
- export { getProviderProfile, listProviders } from './chunk-NKQVLWDF.js';
2
- import './chunk-5HSMH2ZZ.js';
1
+ export { getProviderProfile, listProviders } from './chunk-ULEK4OM4.js';
2
+ import './chunk-CJN5CEI3.js';
3
3
  import './chunk-AGACYRJ2.js';
4
- import './chunk-3FSBE4PS.js';
5
- import './chunk-MS3TQSXU.js';
4
+ import './chunk-3GTN4HOO.js';
5
+ import './chunk-QD6B6W6I.js';
6
6
  import './chunk-5IUDICRK.js';
7
7
  import './chunk-Q7GYMXVC.js';
8
8
  import './chunk-TNFOU6SB.js';
@@ -1577,6 +1577,17 @@ interface ToolResultGuardOptions {
1577
1577
  /** Redact common PII patterns (email, phone) in tool-result content. */
1578
1578
  redactPii?: boolean;
1579
1579
  }
1580
+ /**
1581
+ * B-564 — how old a tool result may get, in tool rounds, before its content is pruned from the
1582
+ * next LLM request (`SendOptions.pruneToolResults`). Contract type owned by `types/`; the
1583
+ * implementation lives in `internal/agent-loop/prune-tool-results.ts`, which re-exports this.
1584
+ *
1585
+ * @public
1586
+ */
1587
+ interface PruneToolResultsOptions {
1588
+ /** Keep the newest `olderThanRounds` tool rounds whole; an integer of at least 1. */
1589
+ olderThanRounds: number;
1590
+ }
1580
1591
  /**
1581
1592
  * Lifecycle status of a {@link Run}.
1582
1593
  *
@@ -1868,7 +1879,7 @@ interface SDKUserMessage {
1868
1879
  *
1869
1880
  * ## Which options do I need?
1870
1881
  *
1871
- * Twenty-one optional fields with genuinely different audiences, so most callers read all of them to
1882
+ * Twenty-two optional fields with genuinely different audiences, so most callers read all of them to
1872
1883
  * find their two. This table is the fix that was chosen; the alternative — nesting the groups under
1873
1884
  * `observe?` and `toolPolicy?` and carrying the flat keys as deprecated aliases for one major — would
1874
1885
  * have added surface to remove surface, and the harm here is the READING cost, not a representable
@@ -1878,7 +1889,7 @@ interface SDKUserMessage {
1878
1889
  * | If you are… | you want |
1879
1890
  * |---|---|
1880
1891
  * | rendering a live UI | `onDelta`, `onStep`, `onRunEvent` |
1881
- * | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `perToolTimeoutMs` |
1892
+ * | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `pruneToolResults`, `perToolTimeoutMs` |
1882
1893
  * | running an eval or a harness | `maxIterations`, `completionCheck`, `doomLoop`, `signal` |
1883
1894
  * | orchestrating agents | `origin`, `task`, `context` |
1884
1895
  * | overriding this one send | `model`, `systemPrompt`, `tools`, `mcpServers`, `contextPaths`, `local` |
@@ -2023,6 +2034,20 @@ interface SendOptions {
2023
2034
  * @public
2024
2035
  */
2025
2036
  toolResultGuard?: ToolResultGuardOptions;
2037
+ /**
2038
+ * B-564 — opt-in pruning of aged tool results. With `{ olderThanRounds: n }`, the content of
2039
+ * every tool result older than `n` tool rounds is replaced by a short stub in each request the
2040
+ * run's agent loop sends (its `toolUseId` and `isError` kept; session compaction is not pruned); the transcript the run keeps, persists and resumes
2041
+ * from stays whole. `olderThanRounds` must be an integer of at least 1, else the send fails
2042
+ * with `ConfigurationError` code `invalid_prune_tool_results` before any provider call.
2043
+ * Undefined = no pruning (the request is unchanged). Pruning trades request size against
2044
+ * prefix-cache reuse: each new round turns one more previously sent result into a stub, so the
2045
+ * request prefix changes from that message onward on providers that cache message prefixes.
2046
+ * The cache-hit cost was not measured.
2047
+ *
2048
+ * @public
2049
+ */
2050
+ pruneToolResults?: PruneToolResultsOptions;
2026
2051
  /**
2027
2052
  * Opt-in task wrapping (ADRs D363, D374). When truthy, the entire
2028
2053
  * run is registered as a `Task` in the SDK's observable registry —
@@ -2557,4 +2582,4 @@ interface InvalidateCacheOptions {
2557
2582
  applyNow?: boolean;
2558
2583
  }
2559
2584
 
2560
- export type { OutputProcessorContext as $, AgentConversationTurn as A, GenerateRunResult as B, ContextSettings as C, DoomLoopThresholds as D, EnvPolicy as E, ForkOptions as F, GoalOptions as G, InteractionUpdate as H, InputProcessorContext as I, JudgeResult as J, InvalidateCacheOptions as K, McpAuthConfig as L, McpServerConfig as M, McpHttpServerConfig as N, McpOAuthConfig as O, ProviderRoutingSettings as P, McpStdioServerConfig as Q, RunResult as R, SDKAgent as S, MemoryAdapter as T, MemoryAdapterCapabilities as U, MemoryContext as V, MemoryFact as W, MemoryRevision as X, MemoryToolSchema as Y, MemoryTurnMessage as Z, MessageOrigin as _, PluginsSettings as a, ToolCall as a$, PartialToolCallUpdate as a0, PersonalityPreset as a1, ProcessorControls as a2, ProcessorTripwire as a3, ProcessorViolation as a4, ProviderCapability as a5, ProviderRoute as a6, ResolvedProviderRoute as a7, RunCompactBoundaryEvent as a8, RunCompletionCheckEvent as a9, SDKProvidersManager as aA, SDKRequestMessage as aB, SDKStatusMessage as aC, SDKSystemMessage as aD, SDKTaskMessage as aE, SDKThinkingMessage as aF, SDKToolUseMessage as aG, SDKUserMessage as aH, SDKUserMessageEvent as aI, SendOptions as aJ, ShellCommand as aK, ShellConversationTurn as aL, ShellOutput as aM, ShellOutputDeltaUpdate as aN, StepCompletedUpdate as aO, StepStartedUpdate as aP, StreamToCompletionResult as aQ, SummaryCompletedUpdate as aR, SummaryStartedUpdate as aS, SummaryUpdate as aT, SystemPromptSkillRef as aU, TextDeltaUpdate as aV, ThinkingCompletedUpdate as aW, ThinkingDeltaUpdate as aX, ThinkingMessage as aY, TokenDeltaUpdate as aZ, TokenUsage as a_, RunErrorDetail as aa, RunEvent as ab, RunGitInfo as ac, RunMemoryDegradedEvent as ad, RunPermissionDeniedEvent as ae, RunRateLimitEvent as af, RunStatus as ag, RunTaskCompletedEvent as ah, RunTaskStartedEvent as ai, RunTaskUpdatedEvent as aj, RunTimelineEvent as ak, RunToCompletionOptions as al, RunToCompletionResult as am, RunToolProgressEvent as an, RunTripwireEvent as ao, RunUntilIterator as ap, SDKAgentPlugins as aq, SDKAgentSkillDetail as ar, SDKAgentSkills as as, SDKArtifact as at, SDKAssistantMessage as au, SDKContextManager as av, SDKImage as aw, SDKImageDimension as ax, SDKObjectDelta as ay, SDKPluginMetadata as az, Run as b, ToolCallCompletedUpdate as b0, ToolCallStartedUpdate as b1, ToolResult as b2, ToolResultGuardOptions as b3, ToolUseBlock as b4, TurnEndedUpdate as b5, UserMessage as b6, UserMessageAppendedUpdate as b7, Verdict as b8, Processor as c, GoalEvent as d, GoalResult as e, MemoryId as f, RunEventSink as g, SDKProvider as h, SDKMessage as i, AgentMemory as j, AgentOperation as k, AssistantMessage as l, CompletionCheck as m, CompletionCheckResult as n, ContextBudget as o, ContextManagerKind as p, ContextSnapshot as q, ContextSource as r, ContextSourceStatus as s, ConversationStep as t, ConversationTurn as u, CostBreakdown as v, CostSource as w, CostStatus as x, ForkResult as y, GenerateOptions as z };
2585
+ export type { OutputProcessorContext as $, AgentConversationTurn as A, GenerateRunResult as B, ContextSettings as C, DoomLoopThresholds as D, EnvPolicy as E, ForkOptions as F, GoalOptions as G, InteractionUpdate as H, InputProcessorContext as I, JudgeResult as J, InvalidateCacheOptions as K, McpAuthConfig as L, McpServerConfig as M, McpHttpServerConfig as N, McpOAuthConfig as O, ProviderRoutingSettings as P, McpStdioServerConfig as Q, RunResult as R, SDKAgent as S, MemoryAdapter as T, MemoryAdapterCapabilities as U, MemoryContext as V, MemoryFact as W, MemoryRevision as X, MemoryToolSchema as Y, MemoryTurnMessage as Z, MessageOrigin as _, PluginsSettings as a, TokenUsage as a$, PartialToolCallUpdate as a0, PersonalityPreset as a1, ProcessorControls as a2, ProcessorTripwire as a3, ProcessorViolation as a4, ProviderCapability as a5, ProviderRoute as a6, PruneToolResultsOptions as a7, ResolvedProviderRoute as a8, RunCompactBoundaryEvent as a9, SDKPluginMetadata as aA, SDKProvidersManager as aB, SDKRequestMessage as aC, SDKStatusMessage as aD, SDKSystemMessage as aE, SDKTaskMessage as aF, SDKThinkingMessage as aG, SDKToolUseMessage as aH, SDKUserMessage as aI, SDKUserMessageEvent as aJ, SendOptions as aK, ShellCommand as aL, ShellConversationTurn as aM, ShellOutput as aN, ShellOutputDeltaUpdate as aO, StepCompletedUpdate as aP, StepStartedUpdate as aQ, StreamToCompletionResult as aR, SummaryCompletedUpdate as aS, SummaryStartedUpdate as aT, SummaryUpdate as aU, SystemPromptSkillRef as aV, TextDeltaUpdate as aW, ThinkingCompletedUpdate as aX, ThinkingDeltaUpdate as aY, ThinkingMessage as aZ, TokenDeltaUpdate as a_, RunCompletionCheckEvent as aa, RunErrorDetail as ab, RunEvent as ac, RunGitInfo as ad, RunMemoryDegradedEvent as ae, RunPermissionDeniedEvent as af, RunRateLimitEvent as ag, RunStatus as ah, RunTaskCompletedEvent as ai, RunTaskStartedEvent as aj, RunTaskUpdatedEvent as ak, RunTimelineEvent as al, RunToCompletionOptions as am, RunToCompletionResult as an, RunToolProgressEvent as ao, RunTripwireEvent as ap, RunUntilIterator as aq, SDKAgentPlugins as ar, SDKAgentSkillDetail as as, SDKAgentSkills as at, SDKArtifact as au, SDKAssistantMessage as av, SDKContextManager as aw, SDKImage as ax, SDKImageDimension as ay, SDKObjectDelta as az, Run as b, ToolCall as b0, ToolCallCompletedUpdate as b1, ToolCallStartedUpdate as b2, ToolResult as b3, ToolResultGuardOptions as b4, ToolUseBlock as b5, TurnEndedUpdate as b6, UserMessage as b7, UserMessageAppendedUpdate as b8, Verdict as b9, Processor as c, GoalEvent as d, GoalResult as e, MemoryId as f, RunEventSink as g, SDKProvider as h, SDKMessage as i, AgentMemory as j, AgentOperation as k, AssistantMessage as l, CompletionCheck as m, CompletionCheckResult as n, ContextBudget as o, ContextManagerKind as p, ContextSnapshot as q, ContextSource as r, ContextSourceStatus as s, ConversationStep as t, ConversationTurn as u, CostBreakdown as v, CostSource as w, CostStatus as x, ForkResult as y, GenerateOptions as z };
@@ -1577,6 +1577,17 @@ interface ToolResultGuardOptions {
1577
1577
  /** Redact common PII patterns (email, phone) in tool-result content. */
1578
1578
  redactPii?: boolean;
1579
1579
  }
1580
+ /**
1581
+ * B-564 — how old a tool result may get, in tool rounds, before its content is pruned from the
1582
+ * next LLM request (`SendOptions.pruneToolResults`). Contract type owned by `types/`; the
1583
+ * implementation lives in `internal/agent-loop/prune-tool-results.ts`, which re-exports this.
1584
+ *
1585
+ * @public
1586
+ */
1587
+ interface PruneToolResultsOptions {
1588
+ /** Keep the newest `olderThanRounds` tool rounds whole; an integer of at least 1. */
1589
+ olderThanRounds: number;
1590
+ }
1580
1591
  /**
1581
1592
  * Lifecycle status of a {@link Run}.
1582
1593
  *
@@ -1868,7 +1879,7 @@ interface SDKUserMessage {
1868
1879
  *
1869
1880
  * ## Which options do I need?
1870
1881
  *
1871
- * Twenty-one optional fields with genuinely different audiences, so most callers read all of them to
1882
+ * Twenty-two optional fields with genuinely different audiences, so most callers read all of them to
1872
1883
  * find their two. This table is the fix that was chosen; the alternative — nesting the groups under
1873
1884
  * `observe?` and `toolPolicy?` and carrying the flat keys as deprecated aliases for one major — would
1874
1885
  * have added surface to remove surface, and the harm here is the READING cost, not a representable
@@ -1878,7 +1889,7 @@ interface SDKUserMessage {
1878
1889
  * | If you are… | you want |
1879
1890
  * |---|---|
1880
1891
  * | rendering a live UI | `onDelta`, `onStep`, `onRunEvent` |
1881
- * | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `perToolTimeoutMs` |
1892
+ * | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `pruneToolResults`, `perToolTimeoutMs` |
1882
1893
  * | running an eval or a harness | `maxIterations`, `completionCheck`, `doomLoop`, `signal` |
1883
1894
  * | orchestrating agents | `origin`, `task`, `context` |
1884
1895
  * | overriding this one send | `model`, `systemPrompt`, `tools`, `mcpServers`, `contextPaths`, `local` |
@@ -2023,6 +2034,20 @@ interface SendOptions {
2023
2034
  * @public
2024
2035
  */
2025
2036
  toolResultGuard?: ToolResultGuardOptions;
2037
+ /**
2038
+ * B-564 — opt-in pruning of aged tool results. With `{ olderThanRounds: n }`, the content of
2039
+ * every tool result older than `n` tool rounds is replaced by a short stub in each request the
2040
+ * run's agent loop sends (its `toolUseId` and `isError` kept; session compaction is not pruned); the transcript the run keeps, persists and resumes
2041
+ * from stays whole. `olderThanRounds` must be an integer of at least 1, else the send fails
2042
+ * with `ConfigurationError` code `invalid_prune_tool_results` before any provider call.
2043
+ * Undefined = no pruning (the request is unchanged). Pruning trades request size against
2044
+ * prefix-cache reuse: each new round turns one more previously sent result into a stub, so the
2045
+ * request prefix changes from that message onward on providers that cache message prefixes.
2046
+ * The cache-hit cost was not measured.
2047
+ *
2048
+ * @public
2049
+ */
2050
+ pruneToolResults?: PruneToolResultsOptions;
2026
2051
  /**
2027
2052
  * Opt-in task wrapping (ADRs D363, D374). When truthy, the entire
2028
2053
  * run is registered as a `Task` in the SDK's observable registry —
@@ -2557,4 +2582,4 @@ interface InvalidateCacheOptions {
2557
2582
  applyNow?: boolean;
2558
2583
  }
2559
2584
 
2560
- export type { OutputProcessorContext as $, AgentConversationTurn as A, GenerateRunResult as B, ContextSettings as C, DoomLoopThresholds as D, EnvPolicy as E, ForkOptions as F, GoalOptions as G, InteractionUpdate as H, InputProcessorContext as I, JudgeResult as J, InvalidateCacheOptions as K, McpAuthConfig as L, McpServerConfig as M, McpHttpServerConfig as N, McpOAuthConfig as O, ProviderRoutingSettings as P, McpStdioServerConfig as Q, RunResult as R, SDKAgent as S, MemoryAdapter as T, MemoryAdapterCapabilities as U, MemoryContext as V, MemoryFact as W, MemoryRevision as X, MemoryToolSchema as Y, MemoryTurnMessage as Z, MessageOrigin as _, PluginsSettings as a, ToolCall as a$, PartialToolCallUpdate as a0, PersonalityPreset as a1, ProcessorControls as a2, ProcessorTripwire as a3, ProcessorViolation as a4, ProviderCapability as a5, ProviderRoute as a6, ResolvedProviderRoute as a7, RunCompactBoundaryEvent as a8, RunCompletionCheckEvent as a9, SDKProvidersManager as aA, SDKRequestMessage as aB, SDKStatusMessage as aC, SDKSystemMessage as aD, SDKTaskMessage as aE, SDKThinkingMessage as aF, SDKToolUseMessage as aG, SDKUserMessage as aH, SDKUserMessageEvent as aI, SendOptions as aJ, ShellCommand as aK, ShellConversationTurn as aL, ShellOutput as aM, ShellOutputDeltaUpdate as aN, StepCompletedUpdate as aO, StepStartedUpdate as aP, StreamToCompletionResult as aQ, SummaryCompletedUpdate as aR, SummaryStartedUpdate as aS, SummaryUpdate as aT, SystemPromptSkillRef as aU, TextDeltaUpdate as aV, ThinkingCompletedUpdate as aW, ThinkingDeltaUpdate as aX, ThinkingMessage as aY, TokenDeltaUpdate as aZ, TokenUsage as a_, RunErrorDetail as aa, RunEvent as ab, RunGitInfo as ac, RunMemoryDegradedEvent as ad, RunPermissionDeniedEvent as ae, RunRateLimitEvent as af, RunStatus as ag, RunTaskCompletedEvent as ah, RunTaskStartedEvent as ai, RunTaskUpdatedEvent as aj, RunTimelineEvent as ak, RunToCompletionOptions as al, RunToCompletionResult as am, RunToolProgressEvent as an, RunTripwireEvent as ao, RunUntilIterator as ap, SDKAgentPlugins as aq, SDKAgentSkillDetail as ar, SDKAgentSkills as as, SDKArtifact as at, SDKAssistantMessage as au, SDKContextManager as av, SDKImage as aw, SDKImageDimension as ax, SDKObjectDelta as ay, SDKPluginMetadata as az, Run as b, ToolCallCompletedUpdate as b0, ToolCallStartedUpdate as b1, ToolResult as b2, ToolResultGuardOptions as b3, ToolUseBlock as b4, TurnEndedUpdate as b5, UserMessage as b6, UserMessageAppendedUpdate as b7, Verdict as b8, Processor as c, GoalEvent as d, GoalResult as e, MemoryId as f, RunEventSink as g, SDKProvider as h, SDKMessage as i, AgentMemory as j, AgentOperation as k, AssistantMessage as l, CompletionCheck as m, CompletionCheckResult as n, ContextBudget as o, ContextManagerKind as p, ContextSnapshot as q, ContextSource as r, ContextSourceStatus as s, ConversationStep as t, ConversationTurn as u, CostBreakdown as v, CostSource as w, CostStatus as x, ForkResult as y, GenerateOptions as z };
2585
+ export type { OutputProcessorContext as $, AgentConversationTurn as A, GenerateRunResult as B, ContextSettings as C, DoomLoopThresholds as D, EnvPolicy as E, ForkOptions as F, GoalOptions as G, InteractionUpdate as H, InputProcessorContext as I, JudgeResult as J, InvalidateCacheOptions as K, McpAuthConfig as L, McpServerConfig as M, McpHttpServerConfig as N, McpOAuthConfig as O, ProviderRoutingSettings as P, McpStdioServerConfig as Q, RunResult as R, SDKAgent as S, MemoryAdapter as T, MemoryAdapterCapabilities as U, MemoryContext as V, MemoryFact as W, MemoryRevision as X, MemoryToolSchema as Y, MemoryTurnMessage as Z, MessageOrigin as _, PluginsSettings as a, TokenUsage as a$, PartialToolCallUpdate as a0, PersonalityPreset as a1, ProcessorControls as a2, ProcessorTripwire as a3, ProcessorViolation as a4, ProviderCapability as a5, ProviderRoute as a6, PruneToolResultsOptions as a7, ResolvedProviderRoute as a8, RunCompactBoundaryEvent as a9, SDKPluginMetadata as aA, SDKProvidersManager as aB, SDKRequestMessage as aC, SDKStatusMessage as aD, SDKSystemMessage as aE, SDKTaskMessage as aF, SDKThinkingMessage as aG, SDKToolUseMessage as aH, SDKUserMessage as aI, SDKUserMessageEvent as aJ, SendOptions as aK, ShellCommand as aL, ShellConversationTurn as aM, ShellOutput as aN, ShellOutputDeltaUpdate as aO, StepCompletedUpdate as aP, StepStartedUpdate as aQ, StreamToCompletionResult as aR, SummaryCompletedUpdate as aS, SummaryStartedUpdate as aT, SummaryUpdate as aU, SystemPromptSkillRef as aV, TextDeltaUpdate as aW, ThinkingCompletedUpdate as aX, ThinkingDeltaUpdate as aY, ThinkingMessage as aZ, TokenDeltaUpdate as a_, RunCompletionCheckEvent as aa, RunErrorDetail as ab, RunEvent as ac, RunGitInfo as ad, RunMemoryDegradedEvent as ae, RunPermissionDeniedEvent as af, RunRateLimitEvent as ag, RunStatus as ah, RunTaskCompletedEvent as ai, RunTaskStartedEvent as aj, RunTaskUpdatedEvent as ak, RunTimelineEvent as al, RunToCompletionOptions as am, RunToCompletionResult as an, RunToolProgressEvent as ao, RunTripwireEvent as ap, RunUntilIterator as aq, SDKAgentPlugins as ar, SDKAgentSkillDetail as as, SDKAgentSkills as at, SDKArtifact as au, SDKAssistantMessage as av, SDKContextManager as aw, SDKImage as ax, SDKImageDimension as ay, SDKObjectDelta as az, Run as b, ToolCall as b0, ToolCallCompletedUpdate as b1, ToolCallStartedUpdate as b2, ToolResult as b3, ToolResultGuardOptions as b4, ToolUseBlock as b5, TurnEndedUpdate as b6, UserMessage as b7, UserMessageAppendedUpdate as b8, Verdict as b9, Processor as c, GoalEvent as d, GoalResult as e, MemoryId as f, RunEventSink as g, SDKProvider as h, SDKMessage as i, AgentMemory as j, AgentOperation as k, AssistantMessage as l, CompletionCheck as m, CompletionCheckResult as n, ContextBudget as o, ContextManagerKind as p, ContextSnapshot as q, ContextSource as r, ContextSourceStatus as s, ConversationStep as t, ConversationTurn as u, CostBreakdown as v, CostSource as w, CostStatus as x, ForkResult as y, GenerateOptions as z };
package/dist/skills.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk7WARNHWW_cjs = require('./chunk-7WARNHWW.cjs');
3
+ var chunk3UMPP553_cjs = require('./chunk-3UMPP553.cjs');
4
4
  require('./chunk-3KIUY67P.cjs');
5
5
  require('./chunk-SA6K24NB.cjs');
6
6
  require('./chunk-6XQLTQB6.cjs');
@@ -11,15 +11,15 @@ require('./chunk-RNXXYF22.cjs');
11
11
 
12
12
  Object.defineProperty(exports, "buildSkillsBlock", {
13
13
  enumerable: true,
14
- get: function () { return chunk7WARNHWW_cjs.buildSkillsBlock; }
14
+ get: function () { return chunk3UMPP553_cjs.buildSkillsBlock; }
15
15
  });
16
16
  Object.defineProperty(exports, "discoverSkills", {
17
17
  enumerable: true,
18
- get: function () { return chunk7WARNHWW_cjs.discoverSkills; }
18
+ get: function () { return chunk3UMPP553_cjs.discoverSkills; }
19
19
  });
20
20
  Object.defineProperty(exports, "loadSkillInstructions", {
21
21
  enumerable: true,
22
- get: function () { return chunk7WARNHWW_cjs.loadSkillInstructions; }
22
+ get: function () { return chunk3UMPP553_cjs.loadSkillInstructions; }
23
23
  });
24
24
  //# sourceMappingURL=skills.cjs.map
25
25
  //# sourceMappingURL=skills.cjs.map
package/dist/skills.js CHANGED
@@ -1,4 +1,4 @@
1
- export { buildSkillsBlock, discoverSkills, loadSkillInstructions } from './chunk-NHOEXFZT.js';
1
+ export { buildSkillsBlock, discoverSkills, loadSkillInstructions } from './chunk-2HXTNVLM.js';
2
2
  import './chunk-PKRPV3R7.js';
3
3
  import './chunk-UKMBRMGT.js';
4
4
  import './chunk-Q7UG242V.js';
@@ -1,5 +1,5 @@
1
- import { a as AgentDefinition } from './agent-iW5kPpfT.cjs';
2
- import './sdk-agent-4-dXI2GS.cjs';
1
+ import { a as AgentDefinition } from './agent-DExqjqYy.cjs';
2
+ import './sdk-agent-DwzHcuxy.cjs';
3
3
  import './agent-prims-CZyxfCmS.cjs';
4
4
  import 'zod';
5
5
  import './errors-base-B5g01neU.cjs';
@@ -1,5 +1,5 @@
1
- import { a as AgentDefinition } from './agent-DSMuwADp.js';
2
- import './sdk-agent-CTOJlWA_.js';
1
+ import { a as AgentDefinition } from './agent-Dfw3VsIX.js';
2
+ import './sdk-agent-a3fW1xUK.js';
3
3
  import './agent-prims-CZyxfCmS.js';
4
4
  import 'zod';
5
5
  import './errors-base-B5g01neU.js';
@@ -344,6 +344,12 @@ export interface SkillsSettings {
344
344
  * default `<cwd>/.theokit/skills`. Absent ⇒ the default root.
345
345
  */
346
346
  skillsDir?: string;
347
+ /**
348
+ * B-546 — directories (each containing `<name>/SKILL.md`) an application ships inside its own
349
+ * package. They are read AFTER the project roots and plugin bundles, so a workspace skill of the
350
+ * same name always wins, and they are kept even when `skillsDir` replaces the default roots.
351
+ */
352
+ bundledDirs?: string[];
347
353
  /**
348
354
  * M22 — code-defined skills (from `createSkill`) merged with the discovered ones. An inline skill
349
355
  * overrides a discovered file skill of the same name.
@@ -24,6 +24,17 @@ export interface ToolResultGuardOptions {
24
24
  /** Redact common PII patterns (email, phone) in tool-result content. */
25
25
  redactPii?: boolean;
26
26
  }
27
+ /**
28
+ * B-564 — how old a tool result may get, in tool rounds, before its content is pruned from the
29
+ * next LLM request (`SendOptions.pruneToolResults`). Contract type owned by `types/`; the
30
+ * implementation lives in `internal/agent-loop/prune-tool-results.ts`, which re-exports this.
31
+ *
32
+ * @public
33
+ */
34
+ export interface PruneToolResultsOptions {
35
+ /** Keep the newest `olderThanRounds` tool rounds whole; an integer of at least 1. */
36
+ olderThanRounds: number;
37
+ }
27
38
  /**
28
39
  * Lifecycle status of a {@link Run}.
29
40
  *
@@ -315,7 +326,7 @@ export interface SDKUserMessage {
315
326
  *
316
327
  * ## Which options do I need?
317
328
  *
318
- * Twenty-one optional fields with genuinely different audiences, so most callers read all of them to
329
+ * Twenty-two optional fields with genuinely different audiences, so most callers read all of them to
319
330
  * find their two. This table is the fix that was chosen; the alternative — nesting the groups under
320
331
  * `observe?` and `toolPolicy?` and carrying the flat keys as deprecated aliases for one major — would
321
332
  * have added surface to remove surface, and the harm here is the READING cost, not a representable
@@ -325,7 +336,7 @@ export interface SDKUserMessage {
325
336
  * | If you are… | you want |
326
337
  * |---|---|
327
338
  * | rendering a live UI | `onDelta`, `onStep`, `onRunEvent` |
328
- * | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `perToolTimeoutMs` |
339
+ * | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `pruneToolResults`, `perToolTimeoutMs` |
329
340
  * | running an eval or a harness | `maxIterations`, `completionCheck`, `doomLoop`, `signal` |
330
341
  * | orchestrating agents | `origin`, `task`, `context` |
331
342
  * | overriding this one send | `model`, `systemPrompt`, `tools`, `mcpServers`, `contextPaths`, `local` |
@@ -470,6 +481,20 @@ export interface SendOptions {
470
481
  * @public
471
482
  */
472
483
  toolResultGuard?: ToolResultGuardOptions;
484
+ /**
485
+ * B-564 — opt-in pruning of aged tool results. With `{ olderThanRounds: n }`, the content of
486
+ * every tool result older than `n` tool rounds is replaced by a short stub in each request the
487
+ * run's agent loop sends (its `toolUseId` and `isError` kept; session compaction is not pruned); the transcript the run keeps, persists and resumes
488
+ * from stays whole. `olderThanRounds` must be an integer of at least 1, else the send fails
489
+ * with `ConfigurationError` code `invalid_prune_tool_results` before any provider call.
490
+ * Undefined = no pruning (the request is unchanged). Pruning trades request size against
491
+ * prefix-cache reuse: each new round turns one more previously sent result into a stub, so the
492
+ * request prefix changes from that message onward on providers that cache message prefixes.
493
+ * The cache-hit cost was not measured.
494
+ *
495
+ * @public
496
+ */
497
+ pruneToolResults?: PruneToolResultsOptions;
473
498
  /**
474
499
  * Opt-in task wrapping (ADRs D363, D374). When truthy, the entire
475
500
  * run is registered as a `Task` in the SDK's observable registry —
@@ -1,5 +1,5 @@
1
1
  import { ZodType, z } from 'zod';
2
- import { S as SDKAgent, _ as MessageOrigin } from './sdk-agent-4-dXI2GS.cjs';
2
+ import { S as SDKAgent, _ as MessageOrigin } from './sdk-agent-DwzHcuxy.cjs';
3
3
  import { T as TheokitAgentError } from './errors-base-B5g01neU.cjs';
4
4
  import { C as CustomTool } from './agent-prims-CZyxfCmS.cjs';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { ZodType, z } from 'zod';
2
- import { S as SDKAgent, _ as MessageOrigin } from './sdk-agent-CTOJlWA_.js';
2
+ import { S as SDKAgent, _ as MessageOrigin } from './sdk-agent-a3fW1xUK.js';
3
3
  import { T as TheokitAgentError } from './errors-base-B5g01neU.js';
4
4
  import { C as CustomTool } from './agent-prims-CZyxfCmS.js';
5
5