@namzu/sdk 73.0.0 → 74.1.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.
- package/CHANGELOG.md +56 -0
- package/README.md +34 -34
- package/dist/authorization/protected-paths.d.ts +7 -0
- package/dist/authorization/protected-paths.d.ts.map +1 -1
- package/dist/authorization/protected-paths.js +7 -0
- package/dist/authorization/protected-paths.js.map +1 -1
- package/dist/authorization/readonly-commands.d.ts +23 -0
- package/dist/authorization/readonly-commands.d.ts.map +1 -1
- package/dist/authorization/readonly-commands.js +89 -3
- package/dist/authorization/readonly-commands.js.map +1 -1
- package/dist/authorization/shell-paths.d.ts +8 -0
- package/dist/authorization/shell-paths.d.ts.map +1 -1
- package/dist/authorization/shell-paths.js +125 -2
- package/dist/authorization/shell-paths.js.map +1 -1
- package/dist/bridge/acp/permission.d.ts +6 -0
- package/dist/bridge/acp/permission.d.ts.map +1 -1
- package/dist/bridge/acp/permission.js.map +1 -1
- package/dist/bridge/acp/server.d.ts.map +1 -1
- package/dist/bridge/acp/server.js +21 -3
- package/dist/bridge/acp/server.js.map +1 -1
- package/dist/compaction/context-window.d.ts.map +1 -1
- package/dist/compaction/context-window.js +11 -0
- package/dist/compaction/context-window.js.map +1 -1
- package/dist/compaction/manual.d.ts.map +1 -1
- package/dist/compaction/manual.js +15 -8
- package/dist/compaction/manual.js.map +1 -1
- package/dist/compaction/plan.d.ts +2 -1
- package/dist/compaction/plan.d.ts.map +1 -1
- package/dist/compaction/plan.js +6 -5
- package/dist/compaction/plan.js.map +1 -1
- package/dist/compaction/retained-images.d.ts +16 -0
- package/dist/compaction/retained-images.d.ts.map +1 -0
- package/dist/compaction/retained-images.js +113 -0
- package/dist/compaction/retained-images.js.map +1 -0
- package/dist/compaction/token-estimate.d.ts +8 -3
- package/dist/compaction/token-estimate.d.ts.map +1 -1
- package/dist/compaction/token-estimate.js +76 -8
- package/dist/compaction/token-estimate.js.map +1 -1
- package/dist/compaction/tool-result-editing.d.ts.map +1 -1
- package/dist/compaction/tool-result-editing.js +15 -8
- package/dist/compaction/tool-result-editing.js.map +1 -1
- package/dist/config/runtime.d.ts +3 -3
- package/dist/constants/acp/index.d.ts +2 -0
- package/dist/constants/acp/index.d.ts.map +1 -1
- package/dist/constants/acp/index.js +2 -0
- package/dist/constants/acp/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/manager/session/turn-recorder.d.ts +1 -0
- package/dist/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +31 -7
- package/dist/manager/session/turn-recorder.js.map +1 -1
- package/dist/pricing/catalogue.generated.d.ts.map +1 -1
- package/dist/pricing/catalogue.generated.js +353 -21
- package/dist/pricing/catalogue.generated.js.map +1 -1
- package/dist/provider/attribution.js +1 -1
- package/dist/provider/attribution.js.map +1 -1
- package/dist/public-runtime.d.ts +5 -2
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +8 -1
- package/dist/public-runtime.js.map +1 -1
- package/dist/rag/embedding.d.ts +5 -1
- package/dist/rag/embedding.d.ts.map +1 -1
- package/dist/rag/embedding.js +22 -7
- package/dist/rag/embedding.js.map +1 -1
- package/dist/runtime/query/abandon-turn.d.ts.map +1 -1
- package/dist/runtime/query/abandon-turn.js +9 -0
- package/dist/runtime/query/abandon-turn.js.map +1 -1
- package/dist/runtime/query/compact-session.d.ts +10 -3
- package/dist/runtime/query/compact-session.d.ts.map +1 -1
- package/dist/runtime/query/compact-session.js +24 -14
- package/dist/runtime/query/compact-session.js.map +1 -1
- package/dist/runtime/query/guard.d.ts.map +1 -1
- package/dist/runtime/query/guard.js +12 -2
- package/dist/runtime/query/guard.js.map +1 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +2 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +3 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +46 -11
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.js +2 -2
- package/dist/runtime/query/iteration/phases/advisory.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +60 -5
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +2 -0
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js +1 -0
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/request-prefix.d.ts +21 -0
- package/dist/runtime/query/iteration/request-prefix.d.ts.map +1 -0
- package/dist/runtime/query/iteration/request-prefix.js +111 -0
- package/dist/runtime/query/iteration/request-prefix.js.map +1 -0
- package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
- package/dist/runtime/query/prepare-turn.js +1 -1
- package/dist/runtime/query/prepare-turn.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +11 -3
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +54 -3
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/sandbox/exec-stdin.d.ts +21 -0
- package/dist/sandbox/exec-stdin.d.ts.map +1 -0
- package/dist/sandbox/exec-stdin.js +40 -0
- package/dist/sandbox/exec-stdin.js.map +1 -0
- package/dist/sandbox/file-walk-program.js +1 -1
- package/dist/sandbox/file-walk.d.ts +12 -7
- package/dist/sandbox/file-walk.d.ts.map +1 -1
- package/dist/sandbox/file-walk.js +13 -4
- package/dist/sandbox/file-walk.js.map +1 -1
- package/dist/sandbox/ignore-matcher.d.ts +3 -0
- package/dist/sandbox/ignore-matcher.d.ts.map +1 -1
- package/dist/sandbox/ignore-matcher.js +8 -2
- package/dist/sandbox/ignore-matcher.js.map +1 -1
- package/dist/sandbox/ignore-source.d.ts.map +1 -1
- package/dist/sandbox/ignore-source.js +52 -8
- package/dist/sandbox/ignore-source.js.map +1 -1
- package/dist/sandbox/index.d.ts +3 -2
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/index.js +2 -1
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/limit-error.d.ts +7 -0
- package/dist/sandbox/limit-error.d.ts.map +1 -0
- package/dist/sandbox/limit-error.js +13 -0
- package/dist/sandbox/limit-error.js.map +1 -0
- package/dist/sandbox/provider/local.d.ts +1 -0
- package/dist/sandbox/provider/local.d.ts.map +1 -1
- package/dist/sandbox/provider/local.js +52 -13
- package/dist/sandbox/provider/local.js.map +1 -1
- package/dist/session/paths.d.ts +6 -0
- package/dist/session/paths.d.ts.map +1 -1
- package/dist/session/paths.js +7 -0
- package/dist/session/paths.js.map +1 -1
- package/dist/session-query/index.d.ts +1 -0
- package/dist/session-query/index.d.ts.map +1 -1
- package/dist/session-query/index.js +26 -15
- package/dist/session-query/index.js.map +1 -1
- package/dist/store/budget/ledger.d.ts +15 -1
- package/dist/store/budget/ledger.d.ts.map +1 -1
- package/dist/store/budget/ledger.js +80 -1
- package/dist/store/budget/ledger.js.map +1 -1
- package/dist/store/evidence/disk.js +3 -1
- package/dist/store/evidence/disk.js.map +1 -1
- package/dist/store/evidence/index-page.d.ts +1 -0
- package/dist/store/evidence/index-page.d.ts.map +1 -1
- package/dist/store/evidence/index-page.js +8 -0
- package/dist/store/evidence/index-page.js.map +1 -1
- package/dist/store/evidence/source-text.d.ts +1 -1
- package/dist/store/memory/operation-lock.d.ts.map +1 -1
- package/dist/store/memory/operation-lock.js +15 -1
- package/dist/store/memory/operation-lock.js.map +1 -1
- package/dist/store/session-log/core.d.ts.map +1 -1
- package/dist/store/session-log/core.js +23 -0
- package/dist/store/session-log/core.js.map +1 -1
- package/dist/tools/builtins/atomic-write-file.d.ts +2 -0
- package/dist/tools/builtins/atomic-write-file.d.ts.map +1 -1
- package/dist/tools/builtins/atomic-write-file.js +37 -8
- package/dist/tools/builtins/atomic-write-file.js.map +1 -1
- package/dist/tools/builtins/computer-use-image.d.ts +9 -0
- package/dist/tools/builtins/computer-use-image.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use-image.js +21 -0
- package/dist/tools/builtins/computer-use-image.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +1 -9
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +2 -22
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/read-file.d.ts.map +1 -1
- package/dist/tools/builtins/read-file.js +20 -12
- package/dist/tools/builtins/read-file.js.map +1 -1
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +4 -3
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/tool-is-available.d.ts +4 -0
- package/dist/tools/tool-is-available.d.ts.map +1 -0
- package/dist/tools/tool-is-available.js +8 -0
- package/dist/tools/tool-is-available.js.map +1 -0
- package/dist/toolsets/manager.d.ts +7 -3
- package/dist/toolsets/manager.d.ts.map +1 -1
- package/dist/toolsets/manager.js +7 -3
- package/dist/toolsets/manager.js.map +1 -1
- package/dist/types/common/index.d.ts +26 -0
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/common/index.js +17 -1
- package/dist/types/common/index.js.map +1 -1
- package/dist/types/hitl/index.d.ts +11 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/rag/embedding.d.ts +4 -0
- package/dist/types/rag/embedding.d.ts.map +1 -1
- package/dist/types/sandbox/index.d.ts +32 -2
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/session/checkpoint.d.ts +4 -0
- package/dist/types/session/checkpoint.d.ts.map +1 -1
- package/dist/types/session/checkpoint.js +2 -0
- package/dist/types/session/checkpoint.js.map +1 -1
- package/dist/types/session/events.d.ts +49 -0
- package/dist/types/session/events.d.ts.map +1 -1
- package/dist/types/session/events.js.map +1 -1
- package/dist/types/session/records.d.ts +44 -6
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +10 -0
- package/dist/types/session/records.js.map +1 -1
- package/dist/utils/cost.d.ts +32 -0
- package/dist/utils/cost.d.ts.map +1 -1
- package/dist/utils/cost.js +101 -8
- package/dist/utils/cost.js.map +1 -1
- package/package.json +2 -2
- package/src/authorization/protected-paths.ts +7 -0
- package/src/authorization/readonly-commands.ts +85 -3
- package/src/authorization/shell-paths.ts +141 -3
- package/src/bridge/acp/permission.ts +6 -0
- package/src/bridge/acp/server.ts +20 -1
- package/src/compaction/context-window.ts +11 -0
- package/src/compaction/manual.ts +23 -8
- package/src/compaction/plan.ts +11 -5
- package/src/compaction/retained-images.ts +130 -0
- package/src/compaction/token-estimate.ts +86 -8
- package/src/compaction/tool-result-editing.ts +20 -8
- package/src/constants/acp/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/manager/session/turn-recorder.ts +31 -7
- package/src/pricing/catalogue.generated.ts +353 -21
- package/src/pricing/rates.source.json +254 -26
- package/src/provider/attribution.ts +1 -1
- package/src/public-runtime.ts +22 -0
- package/src/rag/embedding.ts +23 -7
- package/src/runtime/query/abandon-turn.ts +9 -0
- package/src/runtime/query/compact-session.ts +50 -15
- package/src/runtime/query/guard.ts +13 -2
- package/src/runtime/query/index.ts +2 -0
- package/src/runtime/query/iteration/index.ts +46 -11
- package/src/runtime/query/iteration/phases/advisory.ts +2 -2
- package/src/runtime/query/iteration/phases/compaction.ts +77 -5
- package/src/runtime/query/iteration/phases/context.ts +3 -0
- package/src/runtime/query/iteration/request-prefix.ts +161 -0
- package/src/runtime/query/prepare-turn.ts +2 -1
- package/src/runtime/query/review-policy.ts +79 -11
- package/src/sandbox/exec-stdin.ts +54 -0
- package/src/sandbox/file-walk-program.ts +1 -1
- package/src/sandbox/file-walk.ts +25 -18
- package/src/sandbox/ignore-matcher.ts +13 -3
- package/src/sandbox/ignore-source.ts +52 -8
- package/src/sandbox/index.ts +8 -2
- package/src/sandbox/limit-error.ts +10 -0
- package/src/sandbox/provider/local.ts +56 -23
- package/src/session/paths.ts +9 -0
- package/src/session-query/index.ts +23 -14
- package/src/store/budget/ledger.ts +93 -2
- package/src/store/evidence/disk.ts +3 -1
- package/src/store/evidence/index-page.ts +11 -0
- package/src/store/memory/operation-lock.ts +19 -1
- package/src/store/session-log/core.ts +26 -0
- package/src/tools/builtins/atomic-write-file.ts +49 -7
- package/src/tools/builtins/computer-use-image.ts +20 -0
- package/src/tools/builtins/computer-use.ts +1 -20
- package/src/tools/builtins/read-file.ts +34 -12
- package/src/tools/defineTool.ts +4 -3
- package/src/tools/tool-is-available.ts +11 -0
- package/src/toolsets/manager.ts +7 -3
- package/src/types/common/index.ts +50 -1
- package/src/types/hitl/index.ts +11 -0
- package/src/types/rag/embedding.ts +7 -0
- package/src/types/sandbox/index.ts +31 -1
- package/src/types/session/checkpoint.ts +2 -0
- package/src/types/session/events.ts +50 -0
- package/src/types/session/records.ts +15 -0
- package/src/utils/cost.ts +144 -8
|
@@ -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
|
|
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. The one-hour rate is 2x input. The direct API applies a 1.1x US-only surcharge on eligible models. 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",
|
|
@@ -79,7 +79,9 @@
|
|
|
79
79
|
"outputPer1M": 40,
|
|
80
80
|
"cacheReadPer1M": 0.2,
|
|
81
81
|
"cacheWritePer1M": 10,
|
|
82
|
-
"fastMultiplier": 2
|
|
82
|
+
"fastMultiplier": 2,
|
|
83
|
+
"cacheWrite1hPer1M": 16,
|
|
84
|
+
"usMultiplier": 1.1
|
|
83
85
|
},
|
|
84
86
|
{
|
|
85
87
|
"id": "claude-mythos-5-2",
|
|
@@ -87,21 +89,27 @@
|
|
|
87
89
|
"outputPer1M": 40,
|
|
88
90
|
"cacheReadPer1M": 0.2,
|
|
89
91
|
"cacheWritePer1M": 10,
|
|
90
|
-
"fastMultiplier": 2
|
|
92
|
+
"fastMultiplier": 2,
|
|
93
|
+
"cacheWrite1hPer1M": 16,
|
|
94
|
+
"usMultiplier": 1.1
|
|
91
95
|
},
|
|
92
96
|
{
|
|
93
97
|
"id": "claude-fable-5-1",
|
|
94
98
|
"inputPer1M": 10,
|
|
95
99
|
"outputPer1M": 50,
|
|
96
100
|
"cacheReadPer1M": 0.25,
|
|
97
|
-
"cacheWritePer1M": 12.5
|
|
101
|
+
"cacheWritePer1M": 12.5,
|
|
102
|
+
"cacheWrite1hPer1M": 20,
|
|
103
|
+
"usMultiplier": 1.1
|
|
98
104
|
},
|
|
99
105
|
{
|
|
100
106
|
"id": "claude-mythos-5-1",
|
|
101
107
|
"inputPer1M": 10,
|
|
102
108
|
"outputPer1M": 50,
|
|
103
109
|
"cacheReadPer1M": 0.25,
|
|
104
|
-
"cacheWritePer1M": 12.5
|
|
110
|
+
"cacheWritePer1M": 12.5,
|
|
111
|
+
"cacheWrite1hPer1M": 20,
|
|
112
|
+
"usMultiplier": 1.1
|
|
105
113
|
},
|
|
106
114
|
{
|
|
107
115
|
"id": "claude-opus-5-5",
|
|
@@ -109,28 +117,36 @@
|
|
|
109
117
|
"outputPer1M": 20,
|
|
110
118
|
"cacheReadPer1M": 0.2,
|
|
111
119
|
"cacheWritePer1M": 5,
|
|
112
|
-
"fastMultiplier": 2
|
|
120
|
+
"fastMultiplier": 2,
|
|
121
|
+
"cacheWrite1hPer1M": 8,
|
|
122
|
+
"usMultiplier": 1.1
|
|
113
123
|
},
|
|
114
124
|
{
|
|
115
125
|
"id": "claude-sonnet-5-5",
|
|
116
126
|
"inputPer1M": 2,
|
|
117
127
|
"outputPer1M": 10,
|
|
118
128
|
"cacheReadPer1M": 0.1,
|
|
119
|
-
"cacheWritePer1M": 2.5
|
|
129
|
+
"cacheWritePer1M": 2.5,
|
|
130
|
+
"cacheWrite1hPer1M": 4,
|
|
131
|
+
"usMultiplier": 1.1
|
|
120
132
|
},
|
|
121
133
|
{
|
|
122
134
|
"id": "claude-fable-5",
|
|
123
135
|
"inputPer1M": 10,
|
|
124
136
|
"outputPer1M": 50,
|
|
125
137
|
"cacheReadPer1M": 1,
|
|
126
|
-
"cacheWritePer1M": 12.5
|
|
138
|
+
"cacheWritePer1M": 12.5,
|
|
139
|
+
"cacheWrite1hPer1M": 20,
|
|
140
|
+
"usMultiplier": 1.1
|
|
127
141
|
},
|
|
128
142
|
{
|
|
129
143
|
"id": "claude-mythos-5",
|
|
130
144
|
"inputPer1M": 10,
|
|
131
145
|
"outputPer1M": 50,
|
|
132
146
|
"cacheReadPer1M": 1,
|
|
133
|
-
"cacheWritePer1M": 12.5
|
|
147
|
+
"cacheWritePer1M": 12.5,
|
|
148
|
+
"cacheWrite1hPer1M": 20,
|
|
149
|
+
"usMultiplier": 1.1
|
|
134
150
|
},
|
|
135
151
|
{
|
|
136
152
|
"id": "claude-opus-5",
|
|
@@ -138,7 +154,9 @@
|
|
|
138
154
|
"outputPer1M": 25,
|
|
139
155
|
"cacheReadPer1M": 0.5,
|
|
140
156
|
"cacheWritePer1M": 6.25,
|
|
141
|
-
"fastMultiplier": 2
|
|
157
|
+
"fastMultiplier": 2,
|
|
158
|
+
"cacheWrite1hPer1M": 10,
|
|
159
|
+
"usMultiplier": 1.1
|
|
142
160
|
},
|
|
143
161
|
{
|
|
144
162
|
"id": "claude-opus-4-8",
|
|
@@ -146,70 +164,101 @@
|
|
|
146
164
|
"outputPer1M": 25,
|
|
147
165
|
"cacheReadPer1M": 0.5,
|
|
148
166
|
"cacheWritePer1M": 6.25,
|
|
149
|
-
"
|
|
167
|
+
"cacheWrite1hPer1M": 10,
|
|
168
|
+
"usMultiplier": 1.1
|
|
150
169
|
},
|
|
151
170
|
{
|
|
152
171
|
"id": "claude-opus-4-7",
|
|
153
172
|
"inputPer1M": 5,
|
|
154
173
|
"outputPer1M": 25,
|
|
155
174
|
"cacheReadPer1M": 0.5,
|
|
156
|
-
"cacheWritePer1M": 6.25
|
|
175
|
+
"cacheWritePer1M": 6.25,
|
|
176
|
+
"cacheWrite1hPer1M": 10,
|
|
177
|
+
"usMultiplier": 1.1
|
|
157
178
|
},
|
|
158
179
|
{
|
|
159
180
|
"id": "claude-opus-4-6",
|
|
160
181
|
"inputPer1M": 5,
|
|
161
182
|
"outputPer1M": 25,
|
|
162
183
|
"cacheReadPer1M": 0.5,
|
|
163
|
-
"cacheWritePer1M": 6.25
|
|
184
|
+
"cacheWritePer1M": 6.25,
|
|
185
|
+
"cacheWrite1hPer1M": 10,
|
|
186
|
+
"usMultiplier": 1.1
|
|
164
187
|
},
|
|
165
188
|
{
|
|
166
189
|
"id": "claude-sonnet-5",
|
|
167
190
|
"inputPer1M": 2,
|
|
168
191
|
"outputPer1M": 10,
|
|
169
192
|
"cacheReadPer1M": 0.2,
|
|
170
|
-
"cacheWritePer1M": 2.5
|
|
193
|
+
"cacheWritePer1M": 2.5,
|
|
194
|
+
"cacheWrite1hPer1M": 4,
|
|
195
|
+
"usMultiplier": 1.1
|
|
171
196
|
},
|
|
172
197
|
{
|
|
173
198
|
"id": "claude-sonnet-4-6",
|
|
174
199
|
"inputPer1M": 3,
|
|
175
200
|
"outputPer1M": 15,
|
|
176
201
|
"cacheReadPer1M": 0.3,
|
|
177
|
-
"cacheWritePer1M": 3.75
|
|
202
|
+
"cacheWritePer1M": 3.75,
|
|
203
|
+
"cacheWrite1hPer1M": 6,
|
|
204
|
+
"usMultiplier": 1.1
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"id": "claude-haiku-5-5",
|
|
208
|
+
"inputPer1M": 0.1,
|
|
209
|
+
"outputPer1M": 0.5,
|
|
210
|
+
"cacheReadPer1M": 0.01,
|
|
211
|
+
"cacheWritePer1M": 0.125,
|
|
212
|
+
"cacheWrite1hPer1M": 0.2,
|
|
213
|
+
"usMultiplier": 1.1,
|
|
214
|
+
"longContext": {
|
|
215
|
+
"aboveInputTokens": 100000,
|
|
216
|
+
"inputPer1M": 0.5,
|
|
217
|
+
"outputPer1M": 2.5,
|
|
218
|
+
"cacheReadPer1M": 0.05,
|
|
219
|
+
"cacheWritePer1M": 0.625,
|
|
220
|
+
"cacheWrite1hPer1M": 1
|
|
221
|
+
}
|
|
178
222
|
},
|
|
179
223
|
{
|
|
180
224
|
"id": "claude-haiku-4-5",
|
|
181
225
|
"inputPer1M": 1,
|
|
182
226
|
"outputPer1M": 5,
|
|
183
227
|
"cacheReadPer1M": 0.1,
|
|
184
|
-
"cacheWritePer1M": 1.25
|
|
228
|
+
"cacheWritePer1M": 1.25,
|
|
229
|
+
"cacheWrite1hPer1M": 2
|
|
185
230
|
},
|
|
186
231
|
{
|
|
187
232
|
"id": "claude-sonnet-4",
|
|
188
233
|
"inputPer1M": 3,
|
|
189
234
|
"outputPer1M": 15,
|
|
190
235
|
"cacheReadPer1M": 0.3,
|
|
191
|
-
"cacheWritePer1M": 3.75
|
|
236
|
+
"cacheWritePer1M": 3.75,
|
|
237
|
+
"cacheWrite1hPer1M": 6
|
|
192
238
|
},
|
|
193
239
|
{
|
|
194
240
|
"id": "claude-sonnet-4-5",
|
|
195
241
|
"inputPer1M": 3,
|
|
196
242
|
"outputPer1M": 15,
|
|
197
243
|
"cacheReadPer1M": 0.3,
|
|
198
|
-
"cacheWritePer1M": 3.75
|
|
244
|
+
"cacheWritePer1M": 3.75,
|
|
245
|
+
"cacheWrite1hPer1M": 6
|
|
199
246
|
},
|
|
200
247
|
{
|
|
201
248
|
"id": "claude-opus-4",
|
|
202
249
|
"inputPer1M": 15,
|
|
203
250
|
"outputPer1M": 75,
|
|
204
251
|
"cacheReadPer1M": 1.5,
|
|
205
|
-
"cacheWritePer1M": 18.75
|
|
252
|
+
"cacheWritePer1M": 18.75,
|
|
253
|
+
"cacheWrite1hPer1M": 30
|
|
206
254
|
},
|
|
207
255
|
{
|
|
208
256
|
"id": "claude-opus-4-1",
|
|
209
257
|
"inputPer1M": 15,
|
|
210
258
|
"outputPer1M": 75,
|
|
211
259
|
"cacheReadPer1M": 1.5,
|
|
212
|
-
"cacheWritePer1M": 18.75
|
|
260
|
+
"cacheWritePer1M": 18.75,
|
|
261
|
+
"cacheWrite1hPer1M": 30
|
|
213
262
|
}
|
|
214
263
|
]
|
|
215
264
|
},
|
|
@@ -219,42 +268,221 @@
|
|
|
219
268
|
"verified": "2026-08-10",
|
|
220
269
|
"promptIncludesCacheReads": true,
|
|
221
270
|
"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
|
|
271
|
+
"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
272
|
"models": [
|
|
273
|
+
{
|
|
274
|
+
"id": "gpt-6.2-astra",
|
|
275
|
+
"inputPer1M": 8,
|
|
276
|
+
"outputPer1M": 40,
|
|
277
|
+
"cacheReadPer1M": 0.4,
|
|
278
|
+
"fastMultiplier": 2,
|
|
279
|
+
"longContext": {
|
|
280
|
+
"aboveInputTokens": 272000,
|
|
281
|
+
"inputPer1M": 16,
|
|
282
|
+
"outputPer1M": 60,
|
|
283
|
+
"cacheReadPer1M": 0.8,
|
|
284
|
+
"fastMultiplier": 2
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"id": "gpt-6.2-astra-healthcare",
|
|
289
|
+
"inputPer1M": 8,
|
|
290
|
+
"outputPer1M": 40,
|
|
291
|
+
"cacheReadPer1M": 0.4,
|
|
292
|
+
"longContext": {
|
|
293
|
+
"aboveInputTokens": 272000,
|
|
294
|
+
"inputPer1M": 16,
|
|
295
|
+
"outputPer1M": 60,
|
|
296
|
+
"cacheReadPer1M": 0.8
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"id": "gpt-6.2-sol",
|
|
301
|
+
"inputPer1M": 2,
|
|
302
|
+
"outputPer1M": 10,
|
|
303
|
+
"cacheReadPer1M": 0.1,
|
|
304
|
+
"fastMultiplier": 2,
|
|
305
|
+
"longContext": {
|
|
306
|
+
"aboveInputTokens": 272000,
|
|
307
|
+
"inputPer1M": 4,
|
|
308
|
+
"outputPer1M": 15,
|
|
309
|
+
"cacheReadPer1M": 0.2,
|
|
310
|
+
"fastMultiplier": 2
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"id": "gpt-6.2-sol-healthcare",
|
|
315
|
+
"inputPer1M": 2,
|
|
316
|
+
"outputPer1M": 10,
|
|
317
|
+
"cacheReadPer1M": 0.1,
|
|
318
|
+
"longContext": {
|
|
319
|
+
"aboveInputTokens": 272000,
|
|
320
|
+
"inputPer1M": 4,
|
|
321
|
+
"outputPer1M": 15,
|
|
322
|
+
"cacheReadPer1M": 0.2
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"id": "gpt-6.1-sol",
|
|
327
|
+
"inputPer1M": 2,
|
|
328
|
+
"outputPer1M": 10,
|
|
329
|
+
"cacheReadPer1M": 0.1,
|
|
330
|
+
"fastMultiplier": 2,
|
|
331
|
+
"longContext": {
|
|
332
|
+
"aboveInputTokens": 272000,
|
|
333
|
+
"inputPer1M": 4,
|
|
334
|
+
"outputPer1M": 15,
|
|
335
|
+
"cacheReadPer1M": 0.2,
|
|
336
|
+
"fastMultiplier": 2
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"id": "gpt-6.1-sol-healthcare",
|
|
341
|
+
"inputPer1M": 2,
|
|
342
|
+
"outputPer1M": 10,
|
|
343
|
+
"cacheReadPer1M": 0.1,
|
|
344
|
+
"longContext": {
|
|
345
|
+
"aboveInputTokens": 272000,
|
|
346
|
+
"inputPer1M": 4,
|
|
347
|
+
"outputPer1M": 15,
|
|
348
|
+
"cacheReadPer1M": 0.2
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"id": "gpt-6.1-terra",
|
|
353
|
+
"inputPer1M": 1,
|
|
354
|
+
"outputPer1M": 5,
|
|
355
|
+
"cacheReadPer1M": 0.05,
|
|
356
|
+
"fastMultiplier": 2,
|
|
357
|
+
"longContext": {
|
|
358
|
+
"aboveInputTokens": 272000,
|
|
359
|
+
"inputPer1M": 2,
|
|
360
|
+
"outputPer1M": 7.5,
|
|
361
|
+
"cacheReadPer1M": 0.1,
|
|
362
|
+
"fastMultiplier": 2
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"id": "gpt-6-astra",
|
|
367
|
+
"inputPer1M": 10,
|
|
368
|
+
"outputPer1M": 50,
|
|
369
|
+
"cacheReadPer1M": 1,
|
|
370
|
+
"fastMultiplier": 2,
|
|
371
|
+
"longContext": {
|
|
372
|
+
"aboveInputTokens": 272000,
|
|
373
|
+
"inputPer1M": 20,
|
|
374
|
+
"outputPer1M": 75,
|
|
375
|
+
"cacheReadPer1M": 2,
|
|
376
|
+
"fastMultiplier": 2
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"id": "gpt-6-astra-healthcare",
|
|
381
|
+
"inputPer1M": 10,
|
|
382
|
+
"outputPer1M": 50,
|
|
383
|
+
"cacheReadPer1M": 1,
|
|
384
|
+
"longContext": {
|
|
385
|
+
"aboveInputTokens": 272000,
|
|
386
|
+
"inputPer1M": 20,
|
|
387
|
+
"outputPer1M": 75,
|
|
388
|
+
"cacheReadPer1M": 2
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"id": "gpt-6-luna",
|
|
393
|
+
"inputPer1M": 0.1,
|
|
394
|
+
"outputPer1M": 0.5,
|
|
395
|
+
"cacheReadPer1M": 0.01,
|
|
396
|
+
"fastMultiplier": 2,
|
|
397
|
+
"longContext": {
|
|
398
|
+
"aboveInputTokens": 272000,
|
|
399
|
+
"inputPer1M": 0.2,
|
|
400
|
+
"outputPer1M": 0.75,
|
|
401
|
+
"cacheReadPer1M": 0.02,
|
|
402
|
+
"fastMultiplier": 2
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"id": "gpt-6-sol",
|
|
407
|
+
"inputPer1M": 2,
|
|
408
|
+
"outputPer1M": 10,
|
|
409
|
+
"cacheReadPer1M": 0.2,
|
|
410
|
+
"fastMultiplier": 2,
|
|
411
|
+
"longContext": {
|
|
412
|
+
"aboveInputTokens": 272000,
|
|
413
|
+
"inputPer1M": 4,
|
|
414
|
+
"outputPer1M": 15,
|
|
415
|
+
"cacheReadPer1M": 0.4,
|
|
416
|
+
"fastMultiplier": 2
|
|
417
|
+
}
|
|
418
|
+
},
|
|
224
419
|
{
|
|
225
420
|
"id": "gpt-5.6-sol",
|
|
226
421
|
"inputPer1M": 5,
|
|
227
422
|
"outputPer1M": 30,
|
|
228
423
|
"cacheReadPer1M": 0.5,
|
|
229
|
-
"fastMultiplier": 2
|
|
424
|
+
"fastMultiplier": 2,
|
|
425
|
+
"longContext": {
|
|
426
|
+
"aboveInputTokens": 272000,
|
|
427
|
+
"inputPer1M": 10,
|
|
428
|
+
"outputPer1M": 45,
|
|
429
|
+
"cacheReadPer1M": 1,
|
|
430
|
+
"fastMultiplier": 2
|
|
431
|
+
}
|
|
230
432
|
},
|
|
231
433
|
{
|
|
232
434
|
"id": "gpt-5.6-terra",
|
|
233
435
|
"inputPer1M": 2,
|
|
234
436
|
"outputPer1M": 12,
|
|
235
437
|
"cacheReadPer1M": 0.2,
|
|
236
|
-
"fastMultiplier": 2
|
|
438
|
+
"fastMultiplier": 2,
|
|
439
|
+
"longContext": {
|
|
440
|
+
"aboveInputTokens": 272000,
|
|
441
|
+
"inputPer1M": 4,
|
|
442
|
+
"outputPer1M": 18,
|
|
443
|
+
"cacheReadPer1M": 0.4,
|
|
444
|
+
"fastMultiplier": 2
|
|
445
|
+
}
|
|
237
446
|
},
|
|
238
447
|
{
|
|
239
448
|
"id": "gpt-5.6-luna",
|
|
240
449
|
"inputPer1M": 0.2,
|
|
241
450
|
"outputPer1M": 1.2,
|
|
242
451
|
"cacheReadPer1M": 0.02,
|
|
243
|
-
"fastMultiplier": 2
|
|
452
|
+
"fastMultiplier": 2,
|
|
453
|
+
"longContext": {
|
|
454
|
+
"aboveInputTokens": 272000,
|
|
455
|
+
"inputPer1M": 0.4,
|
|
456
|
+
"outputPer1M": 1.8,
|
|
457
|
+
"cacheReadPer1M": 0.04,
|
|
458
|
+
"fastMultiplier": 2
|
|
459
|
+
}
|
|
244
460
|
},
|
|
245
461
|
{
|
|
246
462
|
"id": "gpt-5.5",
|
|
247
463
|
"inputPer1M": 5,
|
|
248
464
|
"outputPer1M": 30,
|
|
249
465
|
"cacheReadPer1M": 0.5,
|
|
250
|
-
"fastMultiplier": 2.5
|
|
466
|
+
"fastMultiplier": 2.5,
|
|
467
|
+
"longContext": {
|
|
468
|
+
"aboveInputTokens": 272000,
|
|
469
|
+
"inputPer1M": 10,
|
|
470
|
+
"outputPer1M": 45,
|
|
471
|
+
"cacheReadPer1M": 1
|
|
472
|
+
}
|
|
251
473
|
},
|
|
252
474
|
{
|
|
253
475
|
"id": "gpt-5.4",
|
|
254
476
|
"inputPer1M": 2.5,
|
|
255
477
|
"outputPer1M": 15,
|
|
256
478
|
"cacheReadPer1M": 0.25,
|
|
257
|
-
"fastMultiplier": 2
|
|
479
|
+
"fastMultiplier": 2,
|
|
480
|
+
"longContext": {
|
|
481
|
+
"aboveInputTokens": 272000,
|
|
482
|
+
"inputPer1M": 5,
|
|
483
|
+
"outputPer1M": 22.5,
|
|
484
|
+
"cacheReadPer1M": 0.5
|
|
485
|
+
}
|
|
258
486
|
},
|
|
259
487
|
{
|
|
260
488
|
"id": "gpt-5.4-mini",
|
package/src/public-runtime.ts
CHANGED
|
@@ -1059,14 +1059,21 @@ 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'
|
|
1076
|
+
export { SandboxLimitError } from './sandbox/limit-error.js'
|
|
1070
1077
|
|
|
1071
1078
|
// The classified provider-failure surface: a driver states what went wrong
|
|
1072
1079
|
// first-hand, and the turn boundary reads it to choose between a pause and a
|
|
@@ -1346,6 +1353,21 @@ export {
|
|
|
1346
1353
|
export { writesThroughRedirection } from './authorization/command-line.js'
|
|
1347
1354
|
export { isReadOnlyCommandLine } from './authorization/readonly-commands.js'
|
|
1348
1355
|
|
|
1356
|
+
// The question the kernel asks before it lets a write through in any mode: is
|
|
1357
|
+
// this path one of the protected kinds (hooks, shell rc files, credential
|
|
1358
|
+
// homes, skill folders)? A host that runs a command in its own isolated
|
|
1359
|
+
// environment and copies the file changes back asks it here, with the same
|
|
1360
|
+
// name lists and the same path folding the kernel uses.
|
|
1361
|
+
export {
|
|
1362
|
+
isProtectedPath,
|
|
1363
|
+
PROJECT_DIRECTORY_AUTHORED_FOLDERS,
|
|
1364
|
+
PROTECTED_DIRECTORIES,
|
|
1365
|
+
PROTECTED_FILE_NAMES,
|
|
1366
|
+
PROTECTED_NESTED_DIRECTORIES,
|
|
1367
|
+
PROTECTED_ROOT_DIRECTORIES,
|
|
1368
|
+
} from './authorization/protected-paths.js'
|
|
1369
|
+
export type { ProtectedPathOptions } from './authorization/protected-paths.js'
|
|
1370
|
+
|
|
1349
1371
|
// Where a command line actually execs a program — unwrapping `sudo`, `env`,
|
|
1350
1372
|
// `nice`, `timeout` and the rest of a re-exec chain with their own real
|
|
1351
1373
|
// option grammars, rather than assuming the program sits right after the
|
package/src/rag/embedding.ts
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
|
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 ${
|
|
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.`,
|