@namzu/sdk 36.0.0 → 37.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.
- package/CHANGELOG.md +180 -0
- package/README.md +68 -41
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +2 -0
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +2 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/compaction/extractor.d.ts +1 -1
- package/dist/compaction/extractor.d.ts.map +1 -1
- package/dist/compaction/extractor.js +15 -7
- package/dist/compaction/extractor.js.map +1 -1
- package/dist/compaction/manager.d.ts +2 -0
- package/dist/compaction/manager.d.ts.map +1 -1
- package/dist/compaction/manager.js +12 -1
- package/dist/compaction/manager.js.map +1 -1
- package/dist/compaction/verifier.d.ts.map +1 -1
- package/dist/compaction/verifier.js +82 -15
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/contracts/schemas.d.ts +10 -10
- package/dist/eval/harness-verification.d.ts +63 -0
- package/dist/eval/harness-verification.d.ts.map +1 -0
- package/dist/eval/harness-verification.js +165 -0
- package/dist/eval/harness-verification.js.map +1 -0
- package/dist/eval/index.d.ts +2 -0
- package/dist/eval/index.d.ts.map +1 -1
- package/dist/eval/index.js +1 -0
- package/dist/eval/index.js.map +1 -1
- package/dist/execution/code-runtime/json-value.d.ts +10 -0
- package/dist/execution/code-runtime/json-value.d.ts.map +1 -0
- package/dist/execution/code-runtime/json-value.js +89 -0
- package/dist/execution/code-runtime/json-value.js.map +1 -0
- package/dist/execution/code-runtime/worker-program.d.ts +8 -0
- package/dist/execution/code-runtime/worker-program.d.ts.map +1 -0
- package/dist/execution/code-runtime/worker-program.js +240 -0
- package/dist/execution/code-runtime/worker-program.js.map +1 -0
- package/dist/execution/code-runtime/worker.d.ts +22 -0
- package/dist/execution/code-runtime/worker.d.ts.map +1 -1
- package/dist/execution/code-runtime/worker.js +148 -111
- package/dist/execution/code-runtime/worker.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts +12 -0
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +306 -37
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +2 -0
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +6 -0
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/provider/capabilities.d.ts +3 -1
- package/dist/provider/capabilities.d.ts.map +1 -1
- package/dist/provider/capabilities.js +13 -0
- package/dist/provider/capabilities.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +2 -0
- package/dist/provider/fallback.js.map +1 -1
- package/dist/public-runtime.d.ts +3 -1
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +2 -1
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +1 -1
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +1 -1
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +1 -0
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/tool/execute.d.ts +3 -0
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +11 -80
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/run/command-gate.d.ts.map +1 -1
- package/dist/run/command-gate.js +65 -12
- package/dist/run/command-gate.js.map +1 -1
- package/dist/run/index.d.ts +2 -0
- package/dist/run/index.d.ts.map +1 -1
- package/dist/run/index.js +1 -0
- package/dist/run/index.js.map +1 -1
- package/dist/run/memory-promoter.d.ts +3 -35
- package/dist/run/memory-promoter.d.ts.map +1 -1
- package/dist/run/memory-promoter.js +32 -40
- package/dist/run/memory-promoter.js.map +1 -1
- package/dist/run/memory-recall.d.ts +25 -0
- package/dist/run/memory-recall.d.ts.map +1 -0
- package/dist/run/memory-recall.js +228 -0
- package/dist/run/memory-recall.js.map +1 -0
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js +1 -0
- package/dist/run/reporter.js.map +1 -1
- package/dist/run/token-budget.d.ts +2 -0
- package/dist/run/token-budget.d.ts.map +1 -1
- package/dist/run/token-budget.js +4 -0
- package/dist/run/token-budget.js.map +1 -1
- package/dist/run/workspace-fingerprint.d.ts +10 -3
- package/dist/run/workspace-fingerprint.d.ts.map +1 -1
- package/dist/run/workspace-fingerprint.js +17 -8
- package/dist/run/workspace-fingerprint.js.map +1 -1
- package/dist/runtime/query/checkpoint.d.ts +14 -0
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +82 -1
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +5 -0
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +70 -14
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +5 -8
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +54 -7
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +10 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +325 -36
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/native-output.d.ts +10 -0
- package/dist/runtime/query/iteration/native-output.d.ts.map +1 -0
- package/dist/runtime/query/iteration/native-output.js +32 -0
- package/dist/runtime/query/iteration/native-output.js.map +1 -0
- package/dist/runtime/query/iteration/phases/advisory.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.js +18 -13
- package/dist/runtime/query/iteration/phases/advisory.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts +2 -0
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +32 -11
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +9 -0
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/phases/working-memory.d.ts +1 -1
- package/dist/runtime/query/iteration/phases/working-memory.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/working-memory.js +23 -6
- package/dist/runtime/query/iteration/phases/working-memory.js.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +2 -0
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/steering.d.ts +6 -2
- package/dist/runtime/query/steering.d.ts.map +1 -1
- package/dist/runtime/query/steering.js +17 -2
- package/dist/runtime/query/steering.js.map +1 -1
- package/dist/runtime/query/tool-call-budget.d.ts +19 -0
- package/dist/runtime/query/tool-call-budget.d.ts.map +1 -0
- package/dist/runtime/query/tool-call-budget.js +110 -0
- package/dist/runtime/query/tool-call-budget.js.map +1 -0
- package/dist/runtime/query/tooling.d.ts +2 -0
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +4 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/scheduler/local.d.ts.map +1 -1
- package/dist/scheduler/local.js +1 -0
- package/dist/scheduler/local.js.map +1 -1
- package/dist/session/handoff/capacity.d.ts +2 -2
- package/dist/session/handoff/capacity.d.ts.map +1 -1
- package/dist/session/handoff/capacity.js +3 -2
- package/dist/session/handoff/capacity.js.map +1 -1
- package/dist/store/memory/disk.d.ts +6 -2
- package/dist/store/memory/disk.d.ts.map +1 -1
- package/dist/store/memory/disk.js +42 -25
- package/dist/store/memory/disk.js.map +1 -1
- package/dist/store/memory/index.d.ts +4 -0
- package/dist/store/memory/index.d.ts.map +1 -1
- package/dist/store/memory/index.js +55 -19
- package/dist/store/memory/index.js.map +1 -1
- package/dist/store/memory/memory.d.ts +3 -2
- package/dist/store/memory/memory.d.ts.map +1 -1
- package/dist/store/memory/memory.js +11 -2
- package/dist/store/memory/memory.js.map +1 -1
- package/dist/store/memory/operation-lock.d.ts +11 -0
- package/dist/store/memory/operation-lock.d.ts.map +1 -0
- package/dist/store/memory/operation-lock.js +94 -0
- package/dist/store/memory/operation-lock.js.map +1 -0
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +60 -10
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/run-code.d.ts +6 -0
- package/dist/tools/builtins/run-code.d.ts.map +1 -1
- package/dist/tools/builtins/run-code.js +15 -4
- package/dist/tools/builtins/run-code.js.map +1 -1
- package/dist/tools/builtins/search-tools.d.ts.map +1 -1
- package/dist/tools/builtins/search-tools.js +14 -2
- package/dist/tools/builtins/search-tools.js.map +1 -1
- package/dist/tools/defineTool.d.ts +2 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +3 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/memory/delete.d.ts +4 -0
- package/dist/tools/memory/delete.d.ts.map +1 -0
- package/dist/tools/memory/delete.js +26 -0
- package/dist/tools/memory/delete.js.map +1 -0
- package/dist/tools/memory/index.d.ts +2 -0
- package/dist/tools/memory/index.d.ts.map +1 -1
- package/dist/tools/memory/index.js +6 -0
- package/dist/tools/memory/index.js.map +1 -1
- package/dist/tools/memory/save.d.ts.map +1 -1
- package/dist/tools/memory/save.js +3 -2
- package/dist/tools/memory/save.js.map +1 -1
- package/dist/tools/memory/search.d.ts.map +1 -1
- package/dist/tools/memory/search.js +12 -5
- package/dist/tools/memory/search.js.map +1 -1
- package/dist/tools/memory/update.d.ts +4 -0
- package/dist/tools/memory/update.d.ts.map +1 -0
- package/dist/tools/memory/update.js +47 -0
- package/dist/tools/memory/update.js.map +1 -0
- package/dist/types/agent/scheduler.d.ts +5 -0
- package/dist/types/agent/scheduler.d.ts.map +1 -1
- package/dist/types/agent/task.d.ts +10 -0
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/computer-use/index.d.ts +6 -0
- package/dist/types/computer-use/index.d.ts.map +1 -1
- package/dist/types/computer-use/index.js.map +1 -1
- package/dist/types/errors/catalog.js +1 -1
- package/dist/types/errors/catalog.js.map +1 -1
- package/dist/types/hitl/index.d.ts +11 -1
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/memory/index.d.ts +14 -1
- package/dist/types/memory/index.d.ts.map +1 -1
- package/dist/types/project/entity.d.ts +1 -0
- package/dist/types/project/entity.d.ts.map +1 -1
- package/dist/types/provider/config.d.ts +2 -0
- package/dist/types/provider/config.d.ts.map +1 -1
- package/dist/types/provider/model.d.ts +4 -0
- package/dist/types/provider/model.d.ts.map +1 -1
- package/dist/types/run/answer-review.d.ts +2 -0
- package/dist/types/run/answer-review.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +9 -0
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/run/prepare-step.d.ts +19 -1
- package/dist/types/run/prepare-step.d.ts.map +1 -1
- package/dist/types/structured-output/index.d.ts +8 -2
- package/dist/types/structured-output/index.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +15 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/utils/json-snapshot.d.ts +3 -0
- package/dist/utils/json-snapshot.d.ts.map +1 -0
- package/dist/utils/json-snapshot.js +79 -0
- package/dist/utils/json-snapshot.js.map +1 -0
- package/package.json +4 -2
- package/src/bridge/a2a/mapper.ts +2 -0
- package/src/bridge/sse/mapper.ts +2 -0
- package/src/compaction/extractor.ts +21 -8
- package/src/compaction/manager.ts +11 -1
- package/src/compaction/verifier.ts +80 -18
- package/src/eval/harness-verification.ts +270 -0
- package/src/eval/index.ts +10 -0
- package/src/execution/code-runtime/json-value.ts +82 -0
- package/src/execution/code-runtime/worker-program.ts +239 -0
- package/src/execution/code-runtime/worker.ts +164 -111
- package/src/manager/agent/lifecycle.ts +340 -45
- package/src/manager/run/persistence.ts +7 -0
- package/src/provider/capabilities.ts +25 -1
- package/src/provider/fallback.ts +2 -0
- package/src/public-runtime.ts +4 -0
- package/src/public-tools.ts +5 -1
- package/src/public-types.ts +1 -0
- package/src/registry/tool/execute.ts +17 -79
- package/src/run/command-gate.ts +61 -13
- package/src/run/index.ts +2 -0
- package/src/run/memory-promoter.ts +32 -40
- package/src/run/memory-recall.ts +254 -0
- package/src/run/reporter.ts +1 -0
- package/src/run/token-budget.ts +4 -0
- package/src/run/workspace-fingerprint.ts +17 -8
- package/src/runtime/query/checkpoint.ts +96 -2
- package/src/runtime/query/executor.ts +77 -14
- package/src/runtime/query/index.ts +73 -16
- package/src/runtime/query/iteration/index.ts +377 -44
- package/src/runtime/query/iteration/native-output.ts +35 -0
- package/src/runtime/query/iteration/phases/advisory.ts +21 -11
- package/src/runtime/query/iteration/phases/compaction.ts +36 -14
- package/src/runtime/query/iteration/phases/context.ts +9 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +5 -1
- package/src/runtime/query/iteration/phases/working-memory.ts +23 -5
- package/src/runtime/query/iteration/stream-turn.ts +2 -0
- package/src/runtime/query/steering.ts +19 -2
- package/src/runtime/query/tool-call-budget.ts +115 -0
- package/src/runtime/query/tooling.ts +6 -0
- package/src/scheduler/local.ts +1 -0
- package/src/session/handoff/capacity.ts +7 -3
- package/src/store/memory/disk.ts +52 -30
- package/src/store/memory/index.ts +75 -27
- package/src/store/memory/memory.ts +18 -6
- package/src/store/memory/operation-lock.ts +99 -0
- package/src/tools/builtins/computer-use.ts +61 -7
- package/src/tools/builtins/run-code.ts +24 -5
- package/src/tools/builtins/search-tools.ts +18 -3
- package/src/tools/defineTool.ts +5 -0
- package/src/tools/memory/delete.ts +29 -0
- package/src/tools/memory/index.ts +6 -0
- package/src/tools/memory/save.ts +4 -2
- package/src/tools/memory/search.ts +12 -5
- package/src/tools/memory/update.ts +50 -0
- package/src/types/agent/scheduler.ts +6 -0
- package/src/types/agent/task.ts +13 -0
- package/src/types/computer-use/index.ts +6 -0
- package/src/types/errors/catalog.ts +1 -1
- package/src/types/hitl/index.ts +11 -1
- package/src/types/memory/index.ts +16 -1
- package/src/types/project/entity.ts +1 -0
- package/src/types/provider/config.ts +2 -0
- package/src/types/provider/model.ts +4 -0
- package/src/types/run/answer-review.ts +2 -0
- package/src/types/run/events.ts +10 -0
- package/src/types/run/prepare-step.ts +19 -1
- package/src/types/structured-output/index.ts +15 -2
- package/src/types/tool/index.ts +16 -0
- package/src/utils/json-snapshot.ts +76 -0
package/src/types/agent/task.ts
CHANGED
|
@@ -122,6 +122,7 @@ export interface AgentTask {
|
|
|
122
122
|
agentId: string
|
|
123
123
|
agent: Agent<BaseAgentConfig, BaseAgentResult>
|
|
124
124
|
childAbortController: AbortController
|
|
125
|
+
/** While pending admission this is the submitting authority; admitted tasks receive child scope. */
|
|
125
126
|
context: AgentTaskContext
|
|
126
127
|
state: AgentTaskState
|
|
127
128
|
result?: BaseAgentResult
|
|
@@ -142,6 +143,12 @@ export interface AgentTask {
|
|
|
142
143
|
* WorkspaceRef triple atomically on every spawn.
|
|
143
144
|
*/
|
|
144
145
|
export interface SendMessageOptions {
|
|
146
|
+
/**
|
|
147
|
+
* Revalidate host authority before admission, including after a capacity wait.
|
|
148
|
+
* Queue retries may invoke this more than once; checks must tolerate repeated calls.
|
|
149
|
+
*/
|
|
150
|
+
readonly beforeStart?: () => Promise<void>
|
|
151
|
+
|
|
145
152
|
/** See {@link import('./scheduler.js').CreateTaskOptions.toolScope}. Deny-only. */
|
|
146
153
|
readonly toolScope?: { readonly deny: readonly string[] }
|
|
147
154
|
/** See {@link import('./scheduler.js').CreateTaskOptions.personaOverride}. */
|
|
@@ -179,6 +186,12 @@ export interface SendMessageOptions {
|
|
|
179
186
|
}
|
|
180
187
|
|
|
181
188
|
export interface AgentManagerConfig {
|
|
189
|
+
/** Reject a full parent immediately (default), or retain bounded pending task handles. */
|
|
190
|
+
capacityBehavior?: 'reject' | 'queue'
|
|
191
|
+
|
|
192
|
+
/** Maximum tasks awaiting admission across this manager. Defaults to 128. */
|
|
193
|
+
maxPendingTasks?: number
|
|
194
|
+
|
|
182
195
|
maxDepth: number
|
|
183
196
|
|
|
184
197
|
evictionMs: number
|
|
@@ -30,6 +30,12 @@ export interface ComputerUseCapabilities {
|
|
|
30
30
|
readonly keyboard: boolean
|
|
31
31
|
readonly cursorPosition: boolean
|
|
32
32
|
readonly clipboard: boolean
|
|
33
|
+
/** Exact action subset when known. Refines the broad flags; absent retains their legacy interpretation. */
|
|
34
|
+
readonly supportedActions?: readonly ComputerUseAction['type'][]
|
|
35
|
+
/** Supported click buttons; absent leaves button admission to the host. */
|
|
36
|
+
readonly mouseClickButtons?: readonly MouseButton[]
|
|
37
|
+
/** Supported drag buttons; absent leaves button admission to the host. */
|
|
38
|
+
readonly mouseDragButtons?: readonly MouseButton[]
|
|
33
39
|
/**
|
|
34
40
|
* Why every flag above is false, when a host loaded but the desktop did
|
|
35
41
|
* not answer — a WSL process with PowerShell and no interactive Windows
|
|
@@ -157,7 +157,7 @@ export const DEFAULT_ERROR_RULES: readonly ErrorCatalogRule[] = [
|
|
|
157
157
|
id: 'provider.rate_limit',
|
|
158
158
|
when: (facts) => facts.code === 'rate_limit' || facts.status === 429,
|
|
159
159
|
message: 'The provider is rate limiting this run.',
|
|
160
|
-
hint: '
|
|
160
|
+
hint: 'Respect the provider retry delay when reported. Lower concurrency, or wait for the quota window to reset before resuming.',
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
id: 'provider.context_overflow',
|
package/src/types/hitl/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { WorkingStateSnapshot } from '../../compaction/wire.js'
|
|
|
2
2
|
import type { SerializedSpanContext } from '../../telemetry/attributes.js'
|
|
3
3
|
import type { CostInfo, TokenUsage } from '../common/index.js'
|
|
4
4
|
import type { CheckpointId, PlanId, RunId } from '../ids/index.js'
|
|
5
|
-
import type { Message } from '../message/index.js'
|
|
5
|
+
import type { Message, UserMessage } from '../message/index.js'
|
|
6
6
|
import type { PlanStatus } from '../plan/index.js'
|
|
7
7
|
import type { TokenBudgetBinding } from '../run/token-budget-store.js'
|
|
8
8
|
|
|
@@ -212,6 +212,16 @@ export interface IterationCheckpoint {
|
|
|
212
212
|
runId: RunId
|
|
213
213
|
iteration: number
|
|
214
214
|
messages: Message[]
|
|
215
|
+
/**
|
|
216
|
+
* Current operator/goal/steering text and provenance, independent of
|
|
217
|
+
* compacted history. Attachments are not duplicated here. Older
|
|
218
|
+
* checkpoints omit this field and use surviving history on resume.
|
|
219
|
+
*/
|
|
220
|
+
latestUserMessage?: UserMessage
|
|
221
|
+
/** Structured host-review rejections consumed at this checkpoint, independent of compacted messages. */
|
|
222
|
+
structuredReviewAttempts?: number
|
|
223
|
+
/** Native structured-output corrections consumed independently of message history. */
|
|
224
|
+
nativeStructuredAttempts?: number
|
|
215
225
|
tokenUsage: TokenUsage
|
|
216
226
|
costInfo: CostInfo
|
|
217
227
|
/**
|
|
@@ -31,11 +31,19 @@ export interface MemoryContent {
|
|
|
31
31
|
readonly metadata?: Record<string, unknown>
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** Metadata and body observed together at one store read boundary. */
|
|
35
|
+
export interface MemoryRecord {
|
|
36
|
+
readonly entry: MemoryIndexEntry
|
|
37
|
+
readonly content: MemoryContent
|
|
38
|
+
}
|
|
39
|
+
|
|
34
40
|
export interface MemorySearchParams {
|
|
35
41
|
readonly query?: string
|
|
36
42
|
readonly tags?: string[]
|
|
37
43
|
readonly status?: MemoryStatus
|
|
38
44
|
readonly limit?: number
|
|
45
|
+
/** Match at least one exact normalized word token before limiting results. Empty means no constraint. */
|
|
46
|
+
readonly requiredIdentifiers?: readonly string[]
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
export interface MemorySearchResult {
|
|
@@ -52,10 +60,17 @@ export interface CreateMemoryParams {
|
|
|
52
60
|
readonly metadata?: Record<string, unknown>
|
|
53
61
|
}
|
|
54
62
|
|
|
63
|
+
/** Change a memory's content or explicitly archive/reactivate it. */
|
|
64
|
+
export interface UpdateMemoryParams extends Partial<CreateMemoryParams> {
|
|
65
|
+
readonly status?: MemoryStatus
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
export interface MemoryStore {
|
|
56
69
|
create(params: CreateMemoryParams): Promise<{ entry: MemoryIndexEntry; content: MemoryContent }>
|
|
57
70
|
get(id: MemoryId): Promise<MemoryContent | undefined>
|
|
58
|
-
|
|
71
|
+
/** Current metadata/body snapshot; supports rechecking status after search. */
|
|
72
|
+
getRecord?(id: MemoryId): Promise<MemoryRecord | undefined>
|
|
73
|
+
update(id: MemoryId, updates: UpdateMemoryParams): Promise<MemoryIndexEntry | undefined>
|
|
59
74
|
delete(id: MemoryId): Promise<boolean>
|
|
60
75
|
list(params?: MemorySearchParams): Promise<MemorySearchResult>
|
|
61
76
|
}
|
|
@@ -18,6 +18,7 @@ import type { ProjectId } from '../session/ids.js'
|
|
|
18
18
|
*/
|
|
19
19
|
export interface ProjectConfig {
|
|
20
20
|
maxDelegationDepth: number
|
|
21
|
+
/** Maximum pending or active direct delegations; completed history does not consume capacity. */
|
|
21
22
|
maxDelegationWidth: number
|
|
22
23
|
maxInterventionDepth: number
|
|
23
24
|
sharedMemoryStores?: readonly MemoryStoreRef[]
|
|
@@ -121,6 +121,8 @@ export interface MockProviderConfig extends MockScript {
|
|
|
121
121
|
* degradation is loud instead of silent.
|
|
122
122
|
*/
|
|
123
123
|
export interface ProviderCapabilities {
|
|
124
|
+
/** Native JSON Schema response-format mapping. Absent means unsupported. */
|
|
125
|
+
supportsNativeStructuredOutput?: boolean
|
|
124
126
|
supportsTools: boolean
|
|
125
127
|
supportsStreaming: boolean
|
|
126
128
|
supportsFunctionCalling: boolean
|
|
@@ -14,6 +14,10 @@ export interface ModelInfo {
|
|
|
14
14
|
* the answer; it must not be read as text-only.
|
|
15
15
|
*/
|
|
16
16
|
inputModalities?: readonly ModelInputModality[]
|
|
17
|
+
/** Exact selectable effort levels for this model and route. Absent means unknown; [] means unsupported. */
|
|
18
|
+
reasoningEffortLevels?: readonly import('./chat.js').ReasoningEffort[]
|
|
19
|
+
/** Published default, when established; must belong to reasoningEffortLevels when both are present. */
|
|
20
|
+
reasoningEffortDefault?: import('./chat.js').ReasoningEffort
|
|
17
21
|
/**
|
|
18
22
|
* Tokens the model's context holds, when the driver knows.
|
|
19
23
|
*
|
|
@@ -29,6 +29,8 @@ export type AnswerReview =
|
|
|
29
29
|
export interface AnswerReviewContext {
|
|
30
30
|
readonly runId: RunId
|
|
31
31
|
readonly iteration: number
|
|
32
|
+
/** Run cancellation; reviewers should forward it to verification operations. */
|
|
33
|
+
readonly signal?: AbortSignal
|
|
32
34
|
/** The full history, so a reviewer can see how the answer was reached. */
|
|
33
35
|
readonly messages: readonly Message[]
|
|
34
36
|
}
|
package/src/types/run/events.ts
CHANGED
|
@@ -101,6 +101,16 @@ interface RunEventEnvelope {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
type CoreRunEvent =
|
|
104
|
+
| {
|
|
105
|
+
type: 'tool_calls_admitted'
|
|
106
|
+
runId: RunId
|
|
107
|
+
kind: 'initialize' | 'batch' | 'nested' | 'retry'
|
|
108
|
+
/** Newly reserved attempts; zero only for ledger initialization. */
|
|
109
|
+
count: number
|
|
110
|
+
/** Cumulative reserved attempts, including abandoned reservations. */
|
|
111
|
+
used: number
|
|
112
|
+
limit: number
|
|
113
|
+
}
|
|
104
114
|
| { type: 'run_started'; runId: RunId; systemPrompt?: string }
|
|
105
115
|
| { type: 'iteration_started'; runId: RunId; iteration: number }
|
|
106
116
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RunId } from '../ids/index.js'
|
|
2
|
-
import type { Message } from '../message/index.js'
|
|
2
|
+
import type { Message, UserMessage } from '../message/index.js'
|
|
3
3
|
import type { ToolChoice } from '../provider/chat.js'
|
|
4
4
|
import type { Skill } from '../skills/index.js'
|
|
5
5
|
import type { StepResult } from './step.js'
|
|
@@ -21,6 +21,24 @@ export interface PrepareStepContext {
|
|
|
21
21
|
readonly stepNumber: number
|
|
22
22
|
/** Full history as it stands, so a decision can read what happened. */
|
|
23
23
|
readonly messages: readonly Message[]
|
|
24
|
+
/**
|
|
25
|
+
* Latest operator, goal-round, or steering input accepted by this run,
|
|
26
|
+
* retained even when compaction removes it from `messages`. Project
|
|
27
|
+
* instructions and task-completion context do not replace operator intent.
|
|
28
|
+
*/
|
|
29
|
+
readonly latestUserMessage?: UserMessage
|
|
30
|
+
/** The run's cancellation signal, for bounded asynchronous preparation. */
|
|
31
|
+
readonly signal?: AbortSignal
|
|
32
|
+
/**
|
|
33
|
+
* Estimated room for additional step context after existing messages,
|
|
34
|
+
* earlier stages' system/skills, and a response reserve. Recomputed for
|
|
35
|
+
* each stage and its selected model; not a billing limit or fit guarantee.
|
|
36
|
+
* `beforeStep` observes its existing boundary before compaction runs.
|
|
37
|
+
*/
|
|
38
|
+
readonly contextBudget?: {
|
|
39
|
+
readonly remainingTokens: number
|
|
40
|
+
readonly windowTokens: number
|
|
41
|
+
}
|
|
24
42
|
/** Every completed step, in order. */
|
|
25
43
|
readonly steps: readonly StepResult[]
|
|
26
44
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { z } from 'zod'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Configuration for
|
|
4
|
+
* Configuration for validated output via tool constraint or native JSON Schema.
|
|
5
5
|
*
|
|
6
6
|
* This configuration allows an agent to produce validated, typed output by
|
|
7
|
-
* presenting the output schema as a
|
|
7
|
+
* presenting the output schema as a tool by default, or as a native response format.
|
|
8
8
|
*/
|
|
9
9
|
export interface StructuredOutputConfig<TSchema extends z.ZodType = z.ZodType> {
|
|
10
10
|
/**
|
|
@@ -13,6 +13,9 @@ export interface StructuredOutputConfig<TSchema extends z.ZodType = z.ZodType> {
|
|
|
13
13
|
*/
|
|
14
14
|
schema: TSchema
|
|
15
15
|
|
|
16
|
+
/** Default tool constraint, or native JSON schema on an explicitly capable driver. */
|
|
17
|
+
mode?: 'tool' | 'native'
|
|
18
|
+
|
|
16
19
|
/**
|
|
17
20
|
* Turns spent re-prompting when the model answers in prose or fails
|
|
18
21
|
* validation. Defaults to {@link DEFAULT_STRUCTURED_OUTPUT_RETRIES}.
|
|
@@ -21,6 +24,16 @@ export interface StructuredOutputConfig<TSchema extends z.ZodType = z.ZodType> {
|
|
|
21
24
|
* than iterating against `maxIterations`.
|
|
22
25
|
*/
|
|
23
26
|
maxRetries?: number
|
|
27
|
+
|
|
28
|
+
/** Review the JSON-decoded result before settlement. Narrow the value before use: serialization may change schema output types. Exceptions fail the run; cancellation is propagated. */
|
|
29
|
+
review?: (
|
|
30
|
+
output: unknown,
|
|
31
|
+
context: import('../run/answer-review.js').AnswerReviewContext,
|
|
32
|
+
) =>
|
|
33
|
+
| import('../run/answer-review.js').AnswerReview
|
|
34
|
+
| Promise<import('../run/answer-review.js').AnswerReview>
|
|
35
|
+
/** Corrections allowed after host rejection, separate from schema retries. Default 3; zero allows no correction. */
|
|
36
|
+
maxReviews?: number
|
|
24
37
|
}
|
|
25
38
|
|
|
26
39
|
/**
|
package/src/types/tool/index.ts
CHANGED
|
@@ -14,6 +14,8 @@ import type { ToolPresentation } from './presentation.js'
|
|
|
14
14
|
|
|
15
15
|
export interface ToolRegistryRef {
|
|
16
16
|
searchDeferred(query: string): ToolDefinition[]
|
|
17
|
+
/** Ranked active matches, when this registry supports active-tool discovery. */
|
|
18
|
+
searchActive?(query: string): ToolDefinition[]
|
|
17
19
|
activate(names: string[]): void
|
|
18
20
|
getAvailability(name: string): ToolAvailability
|
|
19
21
|
}
|
|
@@ -633,6 +635,18 @@ export interface ToolDefinition<TInput = unknown> extends ToolPresentation<TInpu
|
|
|
633
635
|
isDestructive?(input: TInput): boolean
|
|
634
636
|
isConcurrencySafe?(input: TInput): boolean
|
|
635
637
|
|
|
638
|
+
/**
|
|
639
|
+
* Opt-in ordering boundary in a direct model tool-call batch. Earlier
|
|
640
|
+
* calls settle before this call starts; later calls wait for this call
|
|
641
|
+
* to settle (including failed results). Defaults to false. Independent
|
|
642
|
+
* calls between barriers retain their existing concurrency-safe behavior.
|
|
643
|
+
* Nested dispatch is owned by its enclosing call, not separately queued;
|
|
644
|
+
* mark the enclosing tool as a barrier to isolate its nested operations.
|
|
645
|
+
* Deadlines still abandon uncooperative tools: settlement does not prove
|
|
646
|
+
* their external effects have stopped, and does not imply success.
|
|
647
|
+
*/
|
|
648
|
+
executionBarrier?: boolean
|
|
649
|
+
|
|
636
650
|
/**
|
|
637
651
|
* Where this tool came from, when it did not come from here.
|
|
638
652
|
*
|
|
@@ -763,6 +777,8 @@ export interface ToolRegistryContract {
|
|
|
763
777
|
suspendAll(): void
|
|
764
778
|
hasSuspended(): boolean
|
|
765
779
|
searchDeferred(query: string): ToolDefinition[]
|
|
780
|
+
/** Ranked active matches, when this registry supports active-tool discovery. */
|
|
781
|
+
searchActive?(query: string): ToolDefinition[]
|
|
766
782
|
getCallableTools(toolNames?: string[]): ToolDefinition[]
|
|
767
783
|
|
|
768
784
|
/**
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Clone JSON data without invoking getters or silently dropping values. */
|
|
2
|
+
export function cloneJsonValue(value: unknown, freeze: boolean, path = '$'): unknown {
|
|
3
|
+
const active = new WeakSet<object>()
|
|
4
|
+
const copies = new WeakMap<object, object>()
|
|
5
|
+
|
|
6
|
+
const clone = (candidate: unknown, at: string): unknown => {
|
|
7
|
+
if (candidate === null || typeof candidate === 'string' || typeof candidate === 'boolean') {
|
|
8
|
+
return candidate
|
|
9
|
+
}
|
|
10
|
+
if (typeof candidate === 'number') {
|
|
11
|
+
if (!Number.isFinite(candidate) || Object.is(candidate, -0)) {
|
|
12
|
+
throw new TypeError(`${at} must be a finite JSON number`)
|
|
13
|
+
}
|
|
14
|
+
return candidate
|
|
15
|
+
}
|
|
16
|
+
if (typeof candidate !== 'object') {
|
|
17
|
+
throw new TypeError(`${at} must be a JSON value, not ${typeof candidate}`)
|
|
18
|
+
}
|
|
19
|
+
if (active.has(candidate)) throw new TypeError(`${at} contains a cycle`)
|
|
20
|
+
const existing = copies.get(candidate)
|
|
21
|
+
if (existing) return existing
|
|
22
|
+
|
|
23
|
+
active.add(candidate)
|
|
24
|
+
try {
|
|
25
|
+
if (Array.isArray(candidate)) {
|
|
26
|
+
const extra = Reflect.ownKeys(candidate).filter(
|
|
27
|
+
(key) => key !== 'length' && (typeof key !== 'string' || !/^(0|[1-9]\d*)$/.test(key)),
|
|
28
|
+
)
|
|
29
|
+
if (extra.length > 0) throw new TypeError(`${at} has non-JSON array properties`)
|
|
30
|
+
const result: unknown[] = new Array(candidate.length)
|
|
31
|
+
copies.set(candidate, result)
|
|
32
|
+
for (let index = 0; index < candidate.length; index++) {
|
|
33
|
+
const descriptor = Object.getOwnPropertyDescriptor(candidate, String(index))
|
|
34
|
+
if (!descriptor) throw new TypeError(`${at}[${index}] is a sparse array hole`)
|
|
35
|
+
if (!descriptor.enumerable || !('value' in descriptor)) {
|
|
36
|
+
throw new TypeError(`${at}[${index}] must be an enumerable data property`)
|
|
37
|
+
}
|
|
38
|
+
result[index] = clone(descriptor.value, `${at}[${index}]`)
|
|
39
|
+
}
|
|
40
|
+
if (freeze) Object.freeze(result)
|
|
41
|
+
return result
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const prototype = Object.getPrototypeOf(candidate)
|
|
45
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
46
|
+
throw new TypeError(`${at} must be a plain JSON object`)
|
|
47
|
+
}
|
|
48
|
+
// JSON does not preserve prototypes. Canonicalize both admitted plain
|
|
49
|
+
// shapes to an ordinary object so a disk checkpoint round-trip compares
|
|
50
|
+
// equal to a fresh preparation of the same semantic value. Properties
|
|
51
|
+
// are still defined explicitly, so a literal "__proto__" key remains
|
|
52
|
+
// data rather than changing this object's prototype.
|
|
53
|
+
const result: Record<string, unknown> = {}
|
|
54
|
+
copies.set(candidate, result)
|
|
55
|
+
for (const key of Reflect.ownKeys(candidate)) {
|
|
56
|
+
if (typeof key !== 'string') throw new TypeError(`${at} has a symbol property`)
|
|
57
|
+
const descriptor = Object.getOwnPropertyDescriptor(candidate, key)
|
|
58
|
+
if (!descriptor?.enumerable || !('value' in descriptor)) {
|
|
59
|
+
throw new TypeError(`${at}.${key} must be an enumerable data property`)
|
|
60
|
+
}
|
|
61
|
+
Object.defineProperty(result, key, {
|
|
62
|
+
value: clone(descriptor.value, `${at}.${key}`),
|
|
63
|
+
enumerable: true,
|
|
64
|
+
writable: !freeze,
|
|
65
|
+
configurable: !freeze,
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
if (freeze) Object.freeze(result)
|
|
69
|
+
return result
|
|
70
|
+
} finally {
|
|
71
|
+
active.delete(candidate)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return clone(value, path)
|
|
76
|
+
}
|