@namzu/sdk 73.0.0 → 74.0.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 (208) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +34 -34
  3. package/dist/authorization/protected-paths.d.ts +7 -0
  4. package/dist/authorization/protected-paths.d.ts.map +1 -1
  5. package/dist/authorization/protected-paths.js +7 -0
  6. package/dist/authorization/protected-paths.js.map +1 -1
  7. package/dist/authorization/readonly-commands.d.ts +23 -0
  8. package/dist/authorization/readonly-commands.d.ts.map +1 -1
  9. package/dist/authorization/readonly-commands.js +89 -3
  10. package/dist/authorization/readonly-commands.js.map +1 -1
  11. package/dist/authorization/shell-paths.d.ts +8 -0
  12. package/dist/authorization/shell-paths.d.ts.map +1 -1
  13. package/dist/authorization/shell-paths.js +125 -2
  14. package/dist/authorization/shell-paths.js.map +1 -1
  15. package/dist/bridge/acp/permission.d.ts +6 -0
  16. package/dist/bridge/acp/permission.d.ts.map +1 -1
  17. package/dist/bridge/acp/permission.js.map +1 -1
  18. package/dist/bridge/acp/server.d.ts.map +1 -1
  19. package/dist/bridge/acp/server.js +21 -3
  20. package/dist/bridge/acp/server.js.map +1 -1
  21. package/dist/compaction/context-window.d.ts.map +1 -1
  22. package/dist/compaction/context-window.js +11 -0
  23. package/dist/compaction/context-window.js.map +1 -1
  24. package/dist/compaction/manual.d.ts.map +1 -1
  25. package/dist/compaction/manual.js +15 -8
  26. package/dist/compaction/manual.js.map +1 -1
  27. package/dist/compaction/plan.d.ts +2 -1
  28. package/dist/compaction/plan.d.ts.map +1 -1
  29. package/dist/compaction/plan.js +6 -5
  30. package/dist/compaction/plan.js.map +1 -1
  31. package/dist/compaction/retained-images.d.ts +16 -0
  32. package/dist/compaction/retained-images.d.ts.map +1 -0
  33. package/dist/compaction/retained-images.js +113 -0
  34. package/dist/compaction/retained-images.js.map +1 -0
  35. package/dist/compaction/token-estimate.d.ts +8 -3
  36. package/dist/compaction/token-estimate.d.ts.map +1 -1
  37. package/dist/compaction/token-estimate.js +76 -8
  38. package/dist/compaction/token-estimate.js.map +1 -1
  39. package/dist/compaction/tool-result-editing.d.ts.map +1 -1
  40. package/dist/compaction/tool-result-editing.js +15 -8
  41. package/dist/compaction/tool-result-editing.js.map +1 -1
  42. package/dist/constants/acp/index.d.ts +2 -0
  43. package/dist/constants/acp/index.d.ts.map +1 -1
  44. package/dist/constants/acp/index.js +2 -0
  45. package/dist/constants/acp/index.js.map +1 -1
  46. package/dist/pricing/catalogue.generated.d.ts.map +1 -1
  47. package/dist/pricing/catalogue.generated.js +178 -1
  48. package/dist/pricing/catalogue.generated.js.map +1 -1
  49. package/dist/provider/attribution.js +1 -1
  50. package/dist/provider/attribution.js.map +1 -1
  51. package/dist/public-runtime.d.ts +4 -2
  52. package/dist/public-runtime.d.ts.map +1 -1
  53. package/dist/public-runtime.js +7 -1
  54. package/dist/public-runtime.js.map +1 -1
  55. package/dist/rag/embedding.d.ts +5 -1
  56. package/dist/rag/embedding.d.ts.map +1 -1
  57. package/dist/rag/embedding.js +22 -7
  58. package/dist/rag/embedding.js.map +1 -1
  59. package/dist/runtime/query/abandon-turn.d.ts.map +1 -1
  60. package/dist/runtime/query/abandon-turn.js +9 -0
  61. package/dist/runtime/query/abandon-turn.js.map +1 -1
  62. package/dist/runtime/query/compact-session.d.ts +10 -3
  63. package/dist/runtime/query/compact-session.d.ts.map +1 -1
  64. package/dist/runtime/query/compact-session.js +24 -14
  65. package/dist/runtime/query/compact-session.js.map +1 -1
  66. package/dist/runtime/query/index.d.ts.map +1 -1
  67. package/dist/runtime/query/index.js +1 -0
  68. package/dist/runtime/query/index.js.map +1 -1
  69. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  70. package/dist/runtime/query/iteration/index.js +14 -0
  71. package/dist/runtime/query/iteration/index.js.map +1 -1
  72. package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
  73. package/dist/runtime/query/iteration/phases/compaction.js +60 -5
  74. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  75. package/dist/runtime/query/iteration/phases/context.d.ts +2 -0
  76. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  77. package/dist/runtime/query/iteration/phases/context.js +1 -0
  78. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  79. package/dist/runtime/query/iteration/request-prefix.d.ts +21 -0
  80. package/dist/runtime/query/iteration/request-prefix.d.ts.map +1 -0
  81. package/dist/runtime/query/iteration/request-prefix.js +111 -0
  82. package/dist/runtime/query/iteration/request-prefix.js.map +1 -0
  83. package/dist/runtime/query/review-policy.d.ts +11 -3
  84. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  85. package/dist/runtime/query/review-policy.js +54 -3
  86. package/dist/runtime/query/review-policy.js.map +1 -1
  87. package/dist/sandbox/exec-stdin.d.ts +21 -0
  88. package/dist/sandbox/exec-stdin.d.ts.map +1 -0
  89. package/dist/sandbox/exec-stdin.js +40 -0
  90. package/dist/sandbox/exec-stdin.js.map +1 -0
  91. package/dist/sandbox/file-walk.d.ts +12 -7
  92. package/dist/sandbox/file-walk.d.ts.map +1 -1
  93. package/dist/sandbox/file-walk.js +13 -4
  94. package/dist/sandbox/file-walk.js.map +1 -1
  95. package/dist/sandbox/ignore-matcher.d.ts +1 -0
  96. package/dist/sandbox/ignore-matcher.d.ts.map +1 -1
  97. package/dist/sandbox/ignore-matcher.js.map +1 -1
  98. package/dist/sandbox/ignore-source.js +1 -1
  99. package/dist/sandbox/index.d.ts +3 -2
  100. package/dist/sandbox/index.d.ts.map +1 -1
  101. package/dist/sandbox/index.js +2 -1
  102. package/dist/sandbox/index.js.map +1 -1
  103. package/dist/sandbox/provider/local.d.ts.map +1 -1
  104. package/dist/sandbox/provider/local.js +2 -0
  105. package/dist/sandbox/provider/local.js.map +1 -1
  106. package/dist/session/paths.d.ts +6 -0
  107. package/dist/session/paths.d.ts.map +1 -1
  108. package/dist/session/paths.js +7 -0
  109. package/dist/session/paths.js.map +1 -1
  110. package/dist/session-query/index.d.ts +1 -0
  111. package/dist/session-query/index.d.ts.map +1 -1
  112. package/dist/session-query/index.js +26 -15
  113. package/dist/session-query/index.js.map +1 -1
  114. package/dist/store/evidence/disk.js +3 -1
  115. package/dist/store/evidence/disk.js.map +1 -1
  116. package/dist/store/evidence/index-page.d.ts +1 -0
  117. package/dist/store/evidence/index-page.d.ts.map +1 -1
  118. package/dist/store/evidence/index-page.js +8 -0
  119. package/dist/store/evidence/index-page.js.map +1 -1
  120. package/dist/store/memory/operation-lock.d.ts.map +1 -1
  121. package/dist/store/memory/operation-lock.js +15 -1
  122. package/dist/store/memory/operation-lock.js.map +1 -1
  123. package/dist/store/session-log/core.d.ts.map +1 -1
  124. package/dist/store/session-log/core.js +23 -0
  125. package/dist/store/session-log/core.js.map +1 -1
  126. package/dist/tools/builtins/computer-use-image.d.ts +9 -0
  127. package/dist/tools/builtins/computer-use-image.d.ts.map +1 -1
  128. package/dist/tools/builtins/computer-use-image.js +21 -0
  129. package/dist/tools/builtins/computer-use-image.js.map +1 -1
  130. package/dist/tools/builtins/computer-use.d.ts +1 -9
  131. package/dist/tools/builtins/computer-use.d.ts.map +1 -1
  132. package/dist/tools/builtins/computer-use.js +2 -22
  133. package/dist/tools/builtins/computer-use.js.map +1 -1
  134. package/dist/toolsets/manager.d.ts +7 -3
  135. package/dist/toolsets/manager.d.ts.map +1 -1
  136. package/dist/toolsets/manager.js +7 -3
  137. package/dist/toolsets/manager.js.map +1 -1
  138. package/dist/types/common/index.d.ts +20 -0
  139. package/dist/types/common/index.d.ts.map +1 -1
  140. package/dist/types/common/index.js +4 -1
  141. package/dist/types/common/index.js.map +1 -1
  142. package/dist/types/hitl/index.d.ts +11 -0
  143. package/dist/types/hitl/index.d.ts.map +1 -1
  144. package/dist/types/hitl/index.js.map +1 -1
  145. package/dist/types/rag/embedding.d.ts +4 -0
  146. package/dist/types/rag/embedding.d.ts.map +1 -1
  147. package/dist/types/sandbox/index.d.ts +19 -0
  148. package/dist/types/sandbox/index.d.ts.map +1 -1
  149. package/dist/types/sandbox/index.js.map +1 -1
  150. package/dist/types/session/events.d.ts +48 -0
  151. package/dist/types/session/events.d.ts.map +1 -1
  152. package/dist/types/session/events.js.map +1 -1
  153. package/dist/types/session/records.d.ts +2 -0
  154. package/dist/types/session/records.d.ts.map +1 -1
  155. package/dist/types/session/records.js +9 -0
  156. package/dist/types/session/records.js.map +1 -1
  157. package/dist/utils/cost.d.ts +15 -0
  158. package/dist/utils/cost.d.ts.map +1 -1
  159. package/dist/utils/cost.js +24 -1
  160. package/dist/utils/cost.js.map +1 -1
  161. package/package.json +2 -2
  162. package/src/authorization/protected-paths.ts +7 -0
  163. package/src/authorization/readonly-commands.ts +85 -3
  164. package/src/authorization/shell-paths.ts +141 -3
  165. package/src/bridge/acp/permission.ts +6 -0
  166. package/src/bridge/acp/server.ts +20 -1
  167. package/src/compaction/context-window.ts +11 -0
  168. package/src/compaction/manual.ts +23 -8
  169. package/src/compaction/plan.ts +11 -5
  170. package/src/compaction/retained-images.ts +130 -0
  171. package/src/compaction/token-estimate.ts +86 -8
  172. package/src/compaction/tool-result-editing.ts +20 -8
  173. package/src/constants/acp/index.ts +2 -0
  174. package/src/pricing/catalogue.generated.ts +178 -1
  175. package/src/pricing/rates.source.json +155 -2
  176. package/src/provider/attribution.ts +1 -1
  177. package/src/public-runtime.ts +21 -0
  178. package/src/rag/embedding.ts +23 -7
  179. package/src/runtime/query/abandon-turn.ts +9 -0
  180. package/src/runtime/query/compact-session.ts +50 -15
  181. package/src/runtime/query/index.ts +1 -0
  182. package/src/runtime/query/iteration/index.ts +14 -0
  183. package/src/runtime/query/iteration/phases/compaction.ts +77 -5
  184. package/src/runtime/query/iteration/phases/context.ts +3 -0
  185. package/src/runtime/query/iteration/request-prefix.ts +161 -0
  186. package/src/runtime/query/review-policy.ts +79 -11
  187. package/src/sandbox/exec-stdin.ts +54 -0
  188. package/src/sandbox/file-walk.ts +25 -18
  189. package/src/sandbox/ignore-matcher.ts +1 -0
  190. package/src/sandbox/ignore-source.ts +1 -1
  191. package/src/sandbox/index.ts +8 -2
  192. package/src/sandbox/provider/local.ts +2 -0
  193. package/src/session/paths.ts +9 -0
  194. package/src/session-query/index.ts +23 -14
  195. package/src/store/evidence/disk.ts +3 -1
  196. package/src/store/evidence/index-page.ts +11 -0
  197. package/src/store/memory/operation-lock.ts +19 -1
  198. package/src/store/session-log/core.ts +26 -0
  199. package/src/tools/builtins/computer-use-image.ts +20 -0
  200. package/src/tools/builtins/computer-use.ts +1 -20
  201. package/src/toolsets/manager.ts +7 -3
  202. package/src/types/common/index.ts +26 -1
  203. package/src/types/hitl/index.ts +11 -0
  204. package/src/types/rag/embedding.ts +7 -0
  205. package/src/types/sandbox/index.ts +19 -0
  206. package/src/types/session/events.ts +49 -0
  207. package/src/types/session/records.ts +14 -0
  208. package/src/utils/cost.ts +44 -1
@@ -5,6 +5,7 @@ import {
5
5
  } from '../runtime/query/tool-output-budget.js'
6
6
  import { toolResultToText } from '../types/message/content.js'
7
7
  import type { Message, ToolMessage, ToolResultBlock } from '../types/message/index.js'
8
+ import { compactedImageMarker } from './retained-images.js'
8
9
  import { findRetainedIndices } from './retention.js'
9
10
  import { estimateMessageTokens } from './token-estimate.js'
10
11
 
@@ -143,6 +144,21 @@ export function clearToolResult(
143
144
  toolName: string,
144
145
  ): { readonly message: ToolMessage; readonly charsReclaimed: number } {
145
146
  const size = measureContent(tool.content)
147
+ if (
148
+ typeof tool.content !== 'string' &&
149
+ tool.content.some((block) => block.type === 'image' && !block.modelOmission)
150
+ ) {
151
+ const content = tool.content.map(
152
+ (block): ToolResultBlock =>
153
+ block.type === 'image' && !block.modelOmission
154
+ ? { type: 'text', text: compactedImageMarker(block, toolName) }
155
+ : block,
156
+ )
157
+ return {
158
+ message: { ...tool, content },
159
+ charsReclaimed: Math.max(0, size - measureContent(content)),
160
+ }
161
+ }
146
162
  const content = clearedPlaceholder(tool.content, toolName, size)
147
163
  return { message: { ...tool, content }, charsReclaimed: Math.max(0, size - content.length) }
148
164
  }
@@ -209,17 +225,13 @@ export function clearStaleToolResults(
209
225
  const toolName = toolNameByCallId.get(tool.toolCallId) ?? 'unknown'
210
226
  if (preserve.has(toolName)) return msg
211
227
 
212
- const size = measureContent(tool.content)
213
228
  if (estimateMessageTokens(tool) * CHARS_PER_TOKEN < minChars) return msg
214
229
 
215
- const content = clearedPlaceholder(tool.content, toolName, size)
216
- if (estimateMessageTokens({ ...tool, content }) >= estimateMessageTokens(tool)) return msg
230
+ const cleared = clearToolResult(tool, toolName)
231
+ if (estimateMessageTokens(cleared.message) >= estimateMessageTokens(tool)) return msg
217
232
  clearedCount++
218
- charsReclaimed += size - content.length
219
- return {
220
- ...tool,
221
- content,
222
- } satisfies ToolMessage
233
+ charsReclaimed += cleared.charsReclaimed
234
+ return cleared.message
223
235
  })
224
236
 
225
237
  return { messages: edited, clearedCount, charsReclaimed: Math.max(0, charsReclaimed) }
@@ -50,6 +50,8 @@ export type AcpMethod = (typeof ACP_METHODS)[keyof typeof ACP_METHODS]
50
50
  export const ACP_CLIENT_NOTIFICATIONS = {
51
51
  SESSION_UPDATE: 'session/update',
52
52
  TASK_UPDATE: 'namzu/tasks/update',
53
+ /** The agent takes back a request it made (an approval the person no longer needs to answer). */
54
+ CANCEL_REQUEST: '$/cancel_request',
53
55
  } as const
54
56
 
55
57
  /**
@@ -5,7 +5,7 @@
5
5
  // CI re-runs the generator and fails on any difference, so a hand edit here is
6
6
  // reverted by the next run at best and reported as drift at worst.
7
7
  //
8
- // 4 vendors, 40 priced models.
8
+ // 4 vendors, 52 priced models.
9
9
 
10
10
  import type { ModelPricing } from '../utils/cost.js'
11
11
 
@@ -64,6 +64,22 @@ export const VENDOR_RATES: readonly VendorRates[] = [
64
64
  webSearchCostPer1000: 10,
65
65
  },
66
66
  ],
67
+ [
68
+ 'claude-haiku-5-5',
69
+ {
70
+ inputCostPer1M: 0.1,
71
+ outputCostPer1M: 0.5,
72
+ cache: { promptIncludesCacheReads: false, readCostPer1M: 0.01, writeCostPer1M: 0.125 },
73
+ longContext: {
74
+ aboveInputTokens: 100000,
75
+ inputCostPer1M: 0.5,
76
+ outputCostPer1M: 2.5,
77
+ cacheReadCostPer1M: 0.05,
78
+ cacheWriteCostPer1M: 0.625,
79
+ },
80
+ webSearchCostPer1000: 10,
81
+ },
82
+ ],
67
83
  [
68
84
  'claude-mythos-5',
69
85
  {
@@ -365,6 +381,167 @@ export const VENDOR_RATES: readonly VendorRates[] = [
365
381
  fastMultiplier: 2,
366
382
  },
367
383
  ],
384
+ [
385
+ 'gpt-6-astra',
386
+ {
387
+ inputCostPer1M: 10,
388
+ outputCostPer1M: 50,
389
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 1 },
390
+ fastMultiplier: 2,
391
+ longContext: {
392
+ aboveInputTokens: 272000,
393
+ inputCostPer1M: 20,
394
+ outputCostPer1M: 75,
395
+ cacheReadCostPer1M: 2,
396
+ },
397
+ },
398
+ ],
399
+ [
400
+ 'gpt-6-astra-healthcare',
401
+ {
402
+ inputCostPer1M: 10,
403
+ outputCostPer1M: 50,
404
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 1 },
405
+ longContext: {
406
+ aboveInputTokens: 272000,
407
+ inputCostPer1M: 20,
408
+ outputCostPer1M: 75,
409
+ cacheReadCostPer1M: 2,
410
+ },
411
+ },
412
+ ],
413
+ [
414
+ 'gpt-6-luna',
415
+ {
416
+ inputCostPer1M: 0.1,
417
+ outputCostPer1M: 0.5,
418
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.01 },
419
+ fastMultiplier: 2,
420
+ longContext: {
421
+ aboveInputTokens: 272000,
422
+ inputCostPer1M: 0.2,
423
+ outputCostPer1M: 0.75,
424
+ cacheReadCostPer1M: 0.02,
425
+ },
426
+ },
427
+ ],
428
+ [
429
+ 'gpt-6-sol',
430
+ {
431
+ inputCostPer1M: 2,
432
+ outputCostPer1M: 10,
433
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.2 },
434
+ fastMultiplier: 2,
435
+ longContext: {
436
+ aboveInputTokens: 272000,
437
+ inputCostPer1M: 4,
438
+ outputCostPer1M: 15,
439
+ cacheReadCostPer1M: 0.4,
440
+ },
441
+ },
442
+ ],
443
+ [
444
+ 'gpt-6.1-sol',
445
+ {
446
+ inputCostPer1M: 2,
447
+ outputCostPer1M: 10,
448
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.1 },
449
+ fastMultiplier: 2,
450
+ longContext: {
451
+ aboveInputTokens: 272000,
452
+ inputCostPer1M: 4,
453
+ outputCostPer1M: 15,
454
+ cacheReadCostPer1M: 0.2,
455
+ },
456
+ },
457
+ ],
458
+ [
459
+ 'gpt-6.1-sol-healthcare',
460
+ {
461
+ inputCostPer1M: 2,
462
+ outputCostPer1M: 10,
463
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.1 },
464
+ longContext: {
465
+ aboveInputTokens: 272000,
466
+ inputCostPer1M: 4,
467
+ outputCostPer1M: 15,
468
+ cacheReadCostPer1M: 0.2,
469
+ },
470
+ },
471
+ ],
472
+ [
473
+ 'gpt-6.1-terra',
474
+ {
475
+ inputCostPer1M: 1,
476
+ outputCostPer1M: 5,
477
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.05 },
478
+ fastMultiplier: 2,
479
+ longContext: {
480
+ aboveInputTokens: 272000,
481
+ inputCostPer1M: 2,
482
+ outputCostPer1M: 7.5,
483
+ cacheReadCostPer1M: 0.1,
484
+ },
485
+ },
486
+ ],
487
+ [
488
+ 'gpt-6.2-astra',
489
+ {
490
+ inputCostPer1M: 8,
491
+ outputCostPer1M: 40,
492
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.4 },
493
+ fastMultiplier: 2,
494
+ longContext: {
495
+ aboveInputTokens: 272000,
496
+ inputCostPer1M: 16,
497
+ outputCostPer1M: 60,
498
+ cacheReadCostPer1M: 0.8,
499
+ },
500
+ },
501
+ ],
502
+ [
503
+ 'gpt-6.2-astra-healthcare',
504
+ {
505
+ inputCostPer1M: 8,
506
+ outputCostPer1M: 40,
507
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.4 },
508
+ longContext: {
509
+ aboveInputTokens: 272000,
510
+ inputCostPer1M: 16,
511
+ outputCostPer1M: 60,
512
+ cacheReadCostPer1M: 0.8,
513
+ },
514
+ },
515
+ ],
516
+ [
517
+ 'gpt-6.2-sol',
518
+ {
519
+ inputCostPer1M: 2,
520
+ outputCostPer1M: 10,
521
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.1 },
522
+ fastMultiplier: 2,
523
+ longContext: {
524
+ aboveInputTokens: 272000,
525
+ inputCostPer1M: 4,
526
+ outputCostPer1M: 15,
527
+ cacheReadCostPer1M: 0.2,
528
+ },
529
+ },
530
+ ],
531
+ [
532
+ 'gpt-6.2-sol-healthcare',
533
+ {
534
+ inputCostPer1M: 2,
535
+ outputCostPer1M: 10,
536
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.1 },
537
+ longContext: {
538
+ aboveInputTokens: 272000,
539
+ inputCostPer1M: 4,
540
+ outputCostPer1M: 15,
541
+ cacheReadCostPer1M: 0.2,
542
+ },
543
+ },
544
+ ],
368
545
  [
369
546
  'o1',
370
547
  {
@@ -71,7 +71,7 @@
71
71
  "promptIncludesCacheReads": false,
72
72
  "reportsCacheWrites": true,
73
73
  "webSearchPer1000": 10,
74
- "note": "The last two rows exist because the driver's own offline catalogue offers those models and this table did not price them — a lookup-key gap that reads as `cost unknown` and is invisible to the generator's own check, which only proves the module matches this file. `providers/anthropic` asserts the two lists agree. Vendor list prices, every row checked against its pricing page on the `verified` date. Cache read is the vendor's published 0.1x of the input rate, except on the six models it prices differently: 0.05x on claude-opus-5-5 and claude-sonnet-5-5 and 0.025x on claude-fable-5-1, claude-mythos-5-1, claude-fable-5-2 and claude-mythos-5-2, entered at the published rate rather than derived. claude-haiku-5-5 has no row on purpose: the vendor prices it by prompt length ($0.10 in / $0.50 out up to 100,000 prompt tokens, $0.50 / $2.50 above, cache counted in the length), this table holds one rate per model, and either single rate would be wrong for the other half of requests, so its cost reports unknown. Cache write is its published 1.25x for the five-minute entry, which is the default TTL and the one the driver's `cacheControl: { type: 'auto' }` asks for. claude-sonnet-5 launched at an introductory $2/$10 with $3/$15 scheduled from 2026-09-01, and this table recorded the scheduled rate; the vendor has since made $2/$10 the standard price and cancelled the increase. The table has no time dimension, so a future promotional window is still recorded at the list rate and over-reported rather than mis-modelled.",
74
+ "note": "The last two rows exist because the driver's own offline catalogue offers those models and this table did not price them — a lookup-key gap that reads as `cost unknown` and is invisible to the generator's own check, which only proves the module matches this file. `providers/anthropic` asserts the two lists agree. Vendor list prices, every row checked against its pricing page on the `verified` date. Cache read is the vendor's published 0.1x of the input rate, except on the six models it prices differently: 0.05x on claude-opus-5-5 and claude-sonnet-5-5 and 0.025x on claude-fable-5-1, claude-mythos-5-1, claude-fable-5-2 and claude-mythos-5-2, entered at the published rate rather than derived. The claude-haiku-5-5 tiers were checked on 2026-12-04 at https://platform.claude.com/docs/en/about-claude/pricing. The higher rates apply to the whole request above 100,000 prompt tokens, including cache reads and writes in the threshold count. Cache write is its published 1.25x for the five-minute entry, which is the default TTL and the one the driver's `cacheControl: { type: 'auto' }` asks for. claude-sonnet-5 launched at an introductory $2/$10 with $3/$15 scheduled from 2026-09-01, and this table recorded the scheduled rate; the vendor has since made $2/$10 the standard price and cancelled the increase. The table has no time dimension, so a future promotional window is still recorded at the list rate and over-reported rather than mis-modelled.",
75
75
  "models": [
76
76
  {
77
77
  "id": "claude-fable-5-2",
@@ -176,6 +176,20 @@
176
176
  "cacheReadPer1M": 0.3,
177
177
  "cacheWritePer1M": 3.75
178
178
  },
179
+ {
180
+ "id": "claude-haiku-5-5",
181
+ "inputPer1M": 0.1,
182
+ "outputPer1M": 0.5,
183
+ "cacheReadPer1M": 0.01,
184
+ "cacheWritePer1M": 0.125,
185
+ "longContext": {
186
+ "aboveInputTokens": 100000,
187
+ "inputPer1M": 0.5,
188
+ "outputPer1M": 2.5,
189
+ "cacheReadPer1M": 0.05,
190
+ "cacheWritePer1M": 0.625
191
+ }
192
+ },
179
193
  {
180
194
  "id": "claude-haiku-4-5",
181
195
  "inputPer1M": 1,
@@ -219,8 +233,147 @@
219
233
  "verified": "2026-08-10",
220
234
  "promptIncludesCacheReads": true,
221
235
  "reportsCacheWrites": false,
222
- "note": "Vendor list prices for text models, cached-input rate included. The driver hard-codes cacheWriteTokens to zero, so no write rate is carried. Embedding models are omitted (no output rate, and a chat turn never reaches one), as are models whose cached-input rate was not published alongside the others — an unestablished rate is left out rather than approximated, which is the rule this whole file follows. gpt-6-astra has no row on purpose: the vendor prices it by input length (read 2026-11-11 on its pricing page, $10 in / $1 cached / $50 out up to 272,000 input tokens, $20 / $2 / $75 above), this table holds one rate per model, and either single rate would be wrong for the other half of requests, so its cost reports unknown. The fastMultiplier on six rows is the vendor's fast-mode multiple read on its API pricing page on 2026-11-22: 2 for gpt-5.4, gpt-5.4-mini and the gpt-5.6 models, 2.5 for gpt-5.5 (fast is $12.50 in / $75 out, standard is $5 in / $30 out). The gpt-6 family has no row, so its fast usage reports unknown.",
236
+ "note": "Vendor list prices for text models, cached-input rate included. The driver hard-codes cacheWriteTokens to zero, so no write rate is carried. Embedding models are omitted (no output rate, and a chat turn never reaches one), as are models whose cached-input rate was not published alongside the others — an unestablished rate is left out rather than approximated, which is the rule this whole file follows. The gpt-6 rows (read 2026-12-04 on https://developers.openai.com/api/docs/pricing) carry the vendor's length tiers: the standard rate up to 272,000 input tokens and the `longContext` rate for the whole of a request whose prompt is longer. Fast mode is 2x for every one of them on that page. Ultrafast has no row (the page prices it 3x then 6x on a date), so ultrafast usage reports unknown. The healthcare rows are listed on that page at the same rates as their base model; they carry no fastMultiplier because the driver's fast table does not name them. The gpt-6-cyber, gpt-6-rosalind and gpt-6-*-law configurations are left out: the page lists them but the API's model list does not. The fastMultiplier on six rows is the vendor's fast-mode multiple read on its API pricing page on 2026-11-22: 2 for gpt-5.4, gpt-5.4-mini and the gpt-5.6 models, 2.5 for gpt-5.5 (fast is $12.50 in / $75 out, standard is $5 in / $30 out).",
223
237
  "models": [
238
+ {
239
+ "id": "gpt-6.2-astra",
240
+ "inputPer1M": 8,
241
+ "outputPer1M": 40,
242
+ "cacheReadPer1M": 0.4,
243
+ "fastMultiplier": 2,
244
+ "longContext": {
245
+ "aboveInputTokens": 272000,
246
+ "inputPer1M": 16,
247
+ "outputPer1M": 60,
248
+ "cacheReadPer1M": 0.8
249
+ }
250
+ },
251
+ {
252
+ "id": "gpt-6.2-astra-healthcare",
253
+ "inputPer1M": 8,
254
+ "outputPer1M": 40,
255
+ "cacheReadPer1M": 0.4,
256
+ "longContext": {
257
+ "aboveInputTokens": 272000,
258
+ "inputPer1M": 16,
259
+ "outputPer1M": 60,
260
+ "cacheReadPer1M": 0.8
261
+ }
262
+ },
263
+ {
264
+ "id": "gpt-6.2-sol",
265
+ "inputPer1M": 2,
266
+ "outputPer1M": 10,
267
+ "cacheReadPer1M": 0.1,
268
+ "fastMultiplier": 2,
269
+ "longContext": {
270
+ "aboveInputTokens": 272000,
271
+ "inputPer1M": 4,
272
+ "outputPer1M": 15,
273
+ "cacheReadPer1M": 0.2
274
+ }
275
+ },
276
+ {
277
+ "id": "gpt-6.2-sol-healthcare",
278
+ "inputPer1M": 2,
279
+ "outputPer1M": 10,
280
+ "cacheReadPer1M": 0.1,
281
+ "longContext": {
282
+ "aboveInputTokens": 272000,
283
+ "inputPer1M": 4,
284
+ "outputPer1M": 15,
285
+ "cacheReadPer1M": 0.2
286
+ }
287
+ },
288
+ {
289
+ "id": "gpt-6.1-sol",
290
+ "inputPer1M": 2,
291
+ "outputPer1M": 10,
292
+ "cacheReadPer1M": 0.1,
293
+ "fastMultiplier": 2,
294
+ "longContext": {
295
+ "aboveInputTokens": 272000,
296
+ "inputPer1M": 4,
297
+ "outputPer1M": 15,
298
+ "cacheReadPer1M": 0.2
299
+ }
300
+ },
301
+ {
302
+ "id": "gpt-6.1-sol-healthcare",
303
+ "inputPer1M": 2,
304
+ "outputPer1M": 10,
305
+ "cacheReadPer1M": 0.1,
306
+ "longContext": {
307
+ "aboveInputTokens": 272000,
308
+ "inputPer1M": 4,
309
+ "outputPer1M": 15,
310
+ "cacheReadPer1M": 0.2
311
+ }
312
+ },
313
+ {
314
+ "id": "gpt-6.1-terra",
315
+ "inputPer1M": 1,
316
+ "outputPer1M": 5,
317
+ "cacheReadPer1M": 0.05,
318
+ "fastMultiplier": 2,
319
+ "longContext": {
320
+ "aboveInputTokens": 272000,
321
+ "inputPer1M": 2,
322
+ "outputPer1M": 7.5,
323
+ "cacheReadPer1M": 0.1
324
+ }
325
+ },
326
+ {
327
+ "id": "gpt-6-astra",
328
+ "inputPer1M": 10,
329
+ "outputPer1M": 50,
330
+ "cacheReadPer1M": 1,
331
+ "fastMultiplier": 2,
332
+ "longContext": {
333
+ "aboveInputTokens": 272000,
334
+ "inputPer1M": 20,
335
+ "outputPer1M": 75,
336
+ "cacheReadPer1M": 2
337
+ }
338
+ },
339
+ {
340
+ "id": "gpt-6-astra-healthcare",
341
+ "inputPer1M": 10,
342
+ "outputPer1M": 50,
343
+ "cacheReadPer1M": 1,
344
+ "longContext": {
345
+ "aboveInputTokens": 272000,
346
+ "inputPer1M": 20,
347
+ "outputPer1M": 75,
348
+ "cacheReadPer1M": 2
349
+ }
350
+ },
351
+ {
352
+ "id": "gpt-6-luna",
353
+ "inputPer1M": 0.1,
354
+ "outputPer1M": 0.5,
355
+ "cacheReadPer1M": 0.01,
356
+ "fastMultiplier": 2,
357
+ "longContext": {
358
+ "aboveInputTokens": 272000,
359
+ "inputPer1M": 0.2,
360
+ "outputPer1M": 0.75,
361
+ "cacheReadPer1M": 0.02
362
+ }
363
+ },
364
+ {
365
+ "id": "gpt-6-sol",
366
+ "inputPer1M": 2,
367
+ "outputPer1M": 10,
368
+ "cacheReadPer1M": 0.2,
369
+ "fastMultiplier": 2,
370
+ "longContext": {
371
+ "aboveInputTokens": 272000,
372
+ "inputPer1M": 4,
373
+ "outputPer1M": 15,
374
+ "cacheReadPer1M": 0.4
375
+ }
376
+ },
224
377
  {
225
378
  "id": "gpt-5.6-sol",
226
379
  "inputPer1M": 5,
@@ -40,7 +40,7 @@ export interface AppIdentity {
40
40
  export const NAMZU_APP_IDENTITY: AppIdentity = {
41
41
  product: 'namzu',
42
42
  version: VERSION,
43
- url: 'https://github.com/cogitave/namzu',
43
+ url: 'https://github.com/bahadirarda/namzu',
44
44
  }
45
45
 
46
46
  /**
@@ -1059,11 +1059,17 @@ export {
1059
1059
  describeIsolation,
1060
1060
  isolationOf,
1061
1061
  LocalSandboxProvider,
1062
+ execStdinOf,
1062
1063
  missingIsolation,
1064
+ refuseExecStdin,
1065
+ SANDBOX_EXEC_STDIN_MAX_BYTES,
1066
+ SandboxExecStdinError,
1063
1067
  SandboxProviderFactory,
1068
+ walkFilesLocally,
1064
1069
  walkFilesViaExec,
1065
1070
  } from './sandbox/index.js'
1066
1071
  export type {
1072
+ LocalFileWalkOptions,
1067
1073
  LocalSandboxProviderOptions,
1068
1074
  SandboxFileWalkExec,
1069
1075
  } from './sandbox/index.js'
@@ -1346,6 +1352,21 @@ export {
1346
1352
  export { writesThroughRedirection } from './authorization/command-line.js'
1347
1353
  export { isReadOnlyCommandLine } from './authorization/readonly-commands.js'
1348
1354
 
1355
+ // The question the kernel asks before it lets a write through in any mode: is
1356
+ // this path one of the protected kinds (hooks, shell rc files, credential
1357
+ // homes, skill folders)? A host that runs a command in its own isolated
1358
+ // environment and copies the file changes back asks it here, with the same
1359
+ // name lists and the same path folding the kernel uses.
1360
+ export {
1361
+ isProtectedPath,
1362
+ PROJECT_DIRECTORY_AUTHORED_FOLDERS,
1363
+ PROTECTED_DIRECTORIES,
1364
+ PROTECTED_FILE_NAMES,
1365
+ PROTECTED_NESTED_DIRECTORIES,
1366
+ PROTECTED_ROOT_DIRECTORIES,
1367
+ } from './authorization/protected-paths.js'
1368
+ export type { ProtectedPathOptions } from './authorization/protected-paths.js'
1369
+
1349
1370
  // Where a command line actually execs a program — unwrapping `sudo`, `env`,
1350
1371
  // `nice`, `timeout` and the rest of a re-exec chain with their own real
1351
1372
  // option grammars, rather than assuming the program sits right after the
@@ -63,16 +63,26 @@ function stripTrailingSlashes(value: string): string {
63
63
  export class HttpEmbeddingProvider implements EmbeddingProvider {
64
64
  readonly id = 'http-embedding'
65
65
  readonly model: string
66
- readonly dimensions: number
66
+ private observedDimensions: number | undefined
67
+
68
+ get dimensions(): number {
69
+ return this.observedDimensions ?? this.expectedDimensions
70
+ }
71
+
72
+ private readonly expectedDimensions: number
67
73
 
68
74
  private readonly apiKey: string
69
75
  private readonly baseUrl: string
70
76
  private readonly batchSize: number
77
+ private readonly useModelDimensions: boolean
78
+ private readonly fetch: NonNullable<HttpEmbeddingConfig['fetch']>
71
79
  private readonly requestTimeoutMs: number
72
80
 
73
81
  constructor(config: HttpEmbeddingConfig) {
74
82
  this.model = config.model
75
- this.dimensions = resolveDimensions(config.dimensions)
83
+ this.expectedDimensions = resolveDimensions(config.dimensions)
84
+ this.useModelDimensions = config.useModelDimensions === true
85
+ this.fetch = config.fetch ?? ((url, init) => fetch(url, init))
76
86
  this.apiKey = config.apiKey
77
87
  this.baseUrl = stripTrailingSlashes(config.baseUrl)
78
88
  this.batchSize = resolveBatchSize(config.batchSize)
@@ -156,16 +166,18 @@ export class HttpEmbeddingProvider implements EmbeddingProvider {
156
166
  }
157
167
 
158
168
  private async performEmbeddingRequest(texts: string[], signal: AbortSignal): Promise<number[][]> {
159
- const response = await fetch(`${this.baseUrl}/embeddings`, {
169
+ const response = await this.fetch(`${this.baseUrl}/embeddings`, {
160
170
  method: 'POST',
161
171
  headers: {
162
172
  'Content-Type': 'application/json',
163
- Authorization: `Bearer ${this.apiKey}`,
173
+ ...(!this.useModelDimensions || this.apiKey
174
+ ? { Authorization: `Bearer ${this.apiKey}` }
175
+ : {}),
164
176
  },
165
177
  body: JSON.stringify({
166
178
  model: this.model,
167
179
  input: texts,
168
- dimensions: this.dimensions,
180
+ ...(!this.useModelDimensions ? { dimensions: this.dimensions } : {}),
169
181
  }),
170
182
  signal,
171
183
  })
@@ -190,6 +202,7 @@ export class HttpEmbeddingProvider implements EmbeddingProvider {
190
202
 
191
203
  const embeddings = new Array<number[]>(expectedCount)
192
204
  const seen = new Set<number>()
205
+ let width = this.useModelDimensions ? this.observedDimensions : this.dimensions
193
206
  for (const item of value.data) {
194
207
  if (!isRecord(item) || !Number.isSafeInteger(item.index)) {
195
208
  throw new Error('Embedding API response contains a non-integer index')
@@ -203,20 +216,23 @@ export class HttpEmbeddingProvider implements EmbeddingProvider {
203
216
  }
204
217
  if (
205
218
  !Array.isArray(item.embedding) ||
206
- item.embedding.length !== this.dimensions ||
219
+ item.embedding.length === 0 ||
220
+ (width !== undefined && item.embedding.length !== width) ||
207
221
  !item.embedding.every(
208
222
  (coordinate) => typeof coordinate === 'number' && Number.isFinite(coordinate),
209
223
  )
210
224
  ) {
211
225
  throw new Error(
212
- `Embedding API response index ${index} must contain ${this.dimensions} finite numbers`,
226
+ `Embedding API response index ${index} must contain ${width ?? 'a nonempty array of'} finite numbers`,
213
227
  )
214
228
  }
215
229
 
230
+ width ??= item.embedding.length
216
231
  seen.add(index)
217
232
  embeddings[index] = item.embedding
218
233
  }
219
234
 
235
+ if (this.useModelDimensions) this.observedDimensions = width
220
236
  return embeddings
221
237
  }
222
238
  }
@@ -8,6 +8,7 @@ import {
8
8
  } from '../../store/session-log/index.js'
9
9
  import { NamzuError } from '../../types/errors/index.js'
10
10
  import type { SessionId, TurnId } from '../../types/ids/index.js'
11
+ import { TurnInProgressError } from '../../types/session/turn.js'
11
12
 
12
13
  /** How a session-level operation finds the session's log. */
13
14
  export interface SessionLocatorOptions {
@@ -91,6 +92,14 @@ export async function withSessionLease<T>(
91
92
  ttlMs: OPERATION_LEASE_TTL_MS,
92
93
  })
93
94
  if (!claimed) {
95
+ const active = await log.activeTurn()
96
+ if (active?.state === 'running') {
97
+ throw new TurnInProgressError({
98
+ sessionId: log.sessionId,
99
+ activeTurnId: active.turnId,
100
+ state: active.state,
101
+ })
102
+ }
94
103
  throw new NamzuError({
95
104
  code: 'invalid_config',
96
105
  message: `Session ${log.sessionId} is leased by a live writer; pass its lease, or wait for it to finish.`,