@namzu/sdk 52.3.0 → 52.5.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 +41 -0
- package/dist/authorization/gate.d.ts +11 -0
- package/dist/authorization/gate.d.ts.map +1 -1
- package/dist/authorization/gate.js +35 -0
- package/dist/authorization/gate.js.map +1 -1
- package/dist/authorization/removal.js +11 -6
- package/dist/authorization/removal.js.map +1 -1
- package/dist/authorization/rules.d.ts.map +1 -1
- package/dist/authorization/rules.js +30 -2
- package/dist/authorization/rules.js.map +1 -1
- package/dist/authorization/shell-paths.d.ts +20 -0
- package/dist/authorization/shell-paths.d.ts.map +1 -1
- package/dist/authorization/shell-paths.js +254 -52
- package/dist/authorization/shell-paths.js.map +1 -1
- package/dist/bridge/acp/server.d.ts +8 -0
- package/dist/bridge/acp/server.d.ts.map +1 -1
- package/dist/bridge/acp/server.js +7 -0
- package/dist/bridge/acp/server.js.map +1 -1
- package/dist/connector/web/guarded-fetch.d.ts.map +1 -1
- package/dist/connector/web/guarded-fetch.js +44 -0
- package/dist/connector/web/guarded-fetch.js.map +1 -1
- package/dist/manager/resident/outbox.d.ts +4 -4
- package/dist/process/kill-tree.d.ts +3 -2
- package/dist/process/kill-tree.d.ts.map +1 -1
- package/dist/process/kill-tree.js.map +1 -1
- package/dist/public-runtime.d.ts +3 -2
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +4 -1
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +2 -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/runtime/jobs/registry.d.ts +80 -2
- package/dist/runtime/jobs/registry.d.ts.map +1 -1
- package/dist/runtime/jobs/registry.js +70 -5
- package/dist/runtime/jobs/registry.js.map +1 -1
- package/dist/runtime/jobs/websocket-source.d.ts +120 -0
- package/dist/runtime/jobs/websocket-source.d.ts.map +1 -0
- package/dist/runtime/jobs/websocket-source.js +379 -0
- package/dist/runtime/jobs/websocket-source.js.map +1 -0
- package/dist/runtime/query/auto-review/classifier.d.ts +130 -0
- package/dist/runtime/query/auto-review/classifier.d.ts.map +1 -0
- package/dist/runtime/query/auto-review/classifier.js +244 -0
- package/dist/runtime/query/auto-review/classifier.js.map +1 -0
- package/dist/runtime/query/auto-review/index.d.ts +7 -0
- package/dist/runtime/query/auto-review/index.d.ts.map +1 -0
- package/dist/runtime/query/auto-review/index.js +4 -0
- package/dist/runtime/query/auto-review/index.js.map +1 -0
- package/dist/runtime/query/auto-review/prompt.d.ts +20 -0
- package/dist/runtime/query/auto-review/prompt.d.ts.map +1 -0
- package/dist/runtime/query/auto-review/prompt.js +89 -0
- package/dist/runtime/query/auto-review/prompt.js.map +1 -0
- package/dist/runtime/query/auto-review/rules.d.ts +49 -0
- package/dist/runtime/query/auto-review/rules.d.ts.map +1 -0
- package/dist/runtime/query/auto-review/rules.js +81 -0
- package/dist/runtime/query/auto-review/rules.js.map +1 -0
- package/dist/runtime/query/auto-review/transcript.d.ts +59 -0
- package/dist/runtime/query/auto-review/transcript.d.ts.map +1 -0
- package/dist/runtime/query/auto-review/transcript.js +116 -0
- package/dist/runtime/query/auto-review/transcript.js.map +1 -0
- package/dist/runtime/query/auto-review/verdict.d.ts +21 -0
- package/dist/runtime/query/auto-review/verdict.d.ts.map +1 -0
- package/dist/runtime/query/auto-review/verdict.js +45 -0
- package/dist/runtime/query/auto-review/verdict.js.map +1 -0
- package/dist/runtime/query/executor.d.ts +7 -0
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +26 -2
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.js +2 -2
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +0 -9
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js +11 -2
- 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 +39 -0
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/path-escalation.d.ts.map +1 -1
- package/dist/runtime/query/path-escalation.js +43 -10
- package/dist/runtime/query/path-escalation.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +14 -0
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +88 -1
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +504 -11
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/steering.d.ts +2 -2
- package/dist/runtime/query/steering.d.ts.map +1 -1
- package/dist/runtime/query/steering.js +16 -3
- package/dist/runtime/query/steering.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +2 -0
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/classifier-input.d.ts +9 -0
- package/dist/tools/builtins/classifier-input.d.ts.map +1 -0
- package/dist/tools/builtins/classifier-input.js +20 -0
- package/dist/tools/builtins/classifier-input.js.map +1 -0
- package/dist/tools/builtins/code-analysis.d.ts +2 -0
- package/dist/tools/builtins/code-analysis.d.ts.map +1 -1
- package/dist/tools/builtins/code-analysis.js +196 -119
- package/dist/tools/builtins/code-analysis.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +10 -10
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +12 -0
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/monitor.d.ts +38 -4
- package/dist/tools/builtins/monitor.d.ts.map +1 -1
- package/dist/tools/builtins/monitor.js +239 -97
- package/dist/tools/builtins/monitor.js.map +1 -1
- package/dist/tools/builtins/web.d.ts.map +1 -1
- package/dist/tools/builtins/web.js +3 -0
- package/dist/tools/builtins/web.js.map +1 -1
- package/dist/tools/builtins/write-file.d.ts.map +1 -1
- package/dist/tools/builtins/write-file.js +6 -0
- package/dist/tools/builtins/write-file.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 +1 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/types/acp/index.d.ts +7 -0
- package/dist/types/acp/index.d.ts.map +1 -1
- package/dist/types/code-analysis/index.d.ts +54 -3
- package/dist/types/code-analysis/index.d.ts.map +1 -1
- package/dist/types/hitl/index.d.ts +45 -1
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/sandbox/index.d.ts +10 -0
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/tool/index.d.ts +51 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/package.json +4 -2
- package/src/authorization/gate.ts +35 -0
- package/src/authorization/removal.ts +12 -6
- package/src/authorization/rules.ts +27 -2
- package/src/authorization/shell-paths.ts +264 -51
- package/src/bridge/acp/server.ts +20 -0
- package/src/connector/web/guarded-fetch.ts +41 -0
- package/src/process/kill-tree.ts +4 -2
- package/src/public-runtime.ts +19 -1
- package/src/public-tools.ts +3 -0
- package/src/public-types.ts +11 -0
- package/src/runtime/jobs/registry.ts +162 -13
- package/src/runtime/jobs/websocket-source.ts +438 -0
- package/src/runtime/query/auto-review/classifier.ts +404 -0
- package/src/runtime/query/auto-review/index.ts +23 -0
- package/src/runtime/query/auto-review/prompt.ts +97 -0
- package/src/runtime/query/auto-review/rules.ts +106 -0
- package/src/runtime/query/auto-review/transcript.ts +159 -0
- package/src/runtime/query/auto-review/verdict.ts +50 -0
- package/src/runtime/query/executor.ts +29 -2
- package/src/runtime/query/index.ts +2 -2
- package/src/runtime/query/iteration/phases/context.ts +17 -3
- package/src/runtime/query/iteration/phases/tool-review.ts +41 -0
- package/src/runtime/query/path-escalation.ts +44 -9
- package/src/runtime/query/resume-pending.ts +14 -0
- package/src/runtime/query/review-policy.ts +591 -14
- package/src/runtime/query/steering.ts +32 -6
- package/src/tools/builtins/bash.ts +3 -0
- package/src/tools/builtins/classifier-input.ts +19 -0
- package/src/tools/builtins/code-analysis.ts +211 -119
- package/src/tools/builtins/edit.ts +13 -0
- package/src/tools/builtins/monitor.ts +297 -123
- package/src/tools/builtins/web.ts +3 -0
- package/src/tools/builtins/write-file.ts +6 -0
- package/src/tools/defineTool.ts +3 -0
- package/src/types/acp/index.ts +7 -0
- package/src/types/code-analysis/index.ts +51 -3
- package/src/types/hitl/index.ts +49 -1
- package/src/types/sandbox/index.ts +10 -0
- package/src/types/tool/index.ts +44 -0
package/src/types/hitl/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CostInfo, TokenUsage } from '../common/index.js'
|
|
2
2
|
import type { CheckpointId, PlanId, SessionId, TurnId } from '../ids/index.js'
|
|
3
|
+
import type { Message } from '../message/index.js'
|
|
3
4
|
|
|
4
5
|
export type { CheckpointId }
|
|
5
6
|
|
|
@@ -139,7 +140,28 @@ export type HITLDecisionRequest =
|
|
|
139
140
|
question: UserQuestionData
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
|
|
143
|
+
/**
|
|
144
|
+
* What the turn offers a resume handler besides the request, in memory only.
|
|
145
|
+
*
|
|
146
|
+
* Kept out of {@link HITLDecisionRequest} on purpose: the request is written
|
|
147
|
+
* to the session log when a decision takes long, and a transcript does not
|
|
148
|
+
* belong there. A handler that does not need it ignores the argument; one that
|
|
149
|
+
* wraps another passes it on.
|
|
150
|
+
*/
|
|
151
|
+
export interface ResumeContext {
|
|
152
|
+
/**
|
|
153
|
+
* The conversation as it stands now, the batch under review included.
|
|
154
|
+
* Read on demand; the array is the turn's own, so a caller must not change it.
|
|
155
|
+
*/
|
|
156
|
+
readonly transcript: () => readonly Message[]
|
|
157
|
+
/** The turn's cancellation signal, when it has one. */
|
|
158
|
+
readonly signal?: AbortSignal
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export type ResumeHandler = (
|
|
162
|
+
request: HITLDecisionRequest,
|
|
163
|
+
context?: ResumeContext,
|
|
164
|
+
) => Promise<HITLResumeDecision>
|
|
143
165
|
|
|
144
166
|
export interface ToolCallSummary {
|
|
145
167
|
id: string
|
|
@@ -158,6 +180,24 @@ export interface ToolCallSummary {
|
|
|
158
180
|
reason?: string
|
|
159
181
|
/** A matching rule requested review; read-only exemptions must not bypass it. */
|
|
160
182
|
explicitReview?: true
|
|
183
|
+
/**
|
|
184
|
+
* A rule written to ask a person (a `review` rule), or a hook that asked
|
|
185
|
+
* for one, requested this review. Unlike {@link explicitReview} it is not
|
|
186
|
+
* set when an `allow` rule was demoted to review because the call reaches
|
|
187
|
+
* past its boundary. `bypass` and `classify` keep this question for a
|
|
188
|
+
* person; they answer the demoted kind themselves.
|
|
189
|
+
*/
|
|
190
|
+
askRule?: true
|
|
191
|
+
/**
|
|
192
|
+
* How wide the `allow` rule that settled this call is. `tool` means the
|
|
193
|
+
* rule names the whole tool, a category, a tier or a source, or its
|
|
194
|
+
* pattern matches every input; `pattern` means it matches some inputs
|
|
195
|
+
* only. Present only when `decision` is `allow` and a rule (not the
|
|
196
|
+
* read-only allowance) decided it. The `classify` review mode reads it:
|
|
197
|
+
* a whole-tool allow for a shell tool would let the classifier never
|
|
198
|
+
* see a command.
|
|
199
|
+
*/
|
|
200
|
+
allowScope?: 'tool' | 'pattern'
|
|
161
201
|
}
|
|
162
202
|
/**
|
|
163
203
|
* What this call reaches beyond the turn's ordinary boundary, as the
|
|
@@ -278,6 +318,14 @@ export interface ToolCallEscalation {
|
|
|
278
318
|
* tool that declares `commandArgument`.
|
|
279
319
|
*/
|
|
280
320
|
dangerousRemoval?: string
|
|
321
|
+
/**
|
|
322
|
+
* Why the kernel could not finish looking at this call: the check that
|
|
323
|
+
* finds the escalations above threw, so none of them is known to be
|
|
324
|
+
* absent. Treated as the most serious escalation there is, because the
|
|
325
|
+
* safety checks did not run: a person is asked in every mode, `bypass`
|
|
326
|
+
* and `classify` included, and it is refused when nobody can be asked.
|
|
327
|
+
*/
|
|
328
|
+
unfinishedCheck?: string
|
|
281
329
|
}
|
|
282
330
|
|
|
283
331
|
export interface ToolModification {
|
|
@@ -334,6 +334,16 @@ export interface Sandbox {
|
|
|
334
334
|
readonly status: SandboxStatus
|
|
335
335
|
readonly rootDir: string
|
|
336
336
|
readonly environment: SandboxEnvironment
|
|
337
|
+
/**
|
|
338
|
+
* The network policy in force right now, when the backend can say.
|
|
339
|
+
*
|
|
340
|
+
* Optional, and absent does NOT mean open: a caller that needs to know
|
|
341
|
+
* whether a host is reachable (the host process opening a connection on a
|
|
342
|
+
* turn's behalf, outside the boundary) treats absence as "not allowed" on a
|
|
343
|
+
* tier that isolates the network. A backend that enforces
|
|
344
|
+
* {@link setNetworkPolicy} should report what it enforces here.
|
|
345
|
+
*/
|
|
346
|
+
readonly networkPolicy?: SandboxNetworkPolicy
|
|
337
347
|
exec(command: string, args?: string[], opts?: SandboxExecOptions): Promise<SandboxExecResult>
|
|
338
348
|
|
|
339
349
|
/**
|
package/src/types/tool/index.ts
CHANGED
|
@@ -105,6 +105,20 @@ export interface SkillRegistryRef {
|
|
|
105
105
|
names(): readonly string[]
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Where a WebSocket monitor connects, already checked.
|
|
110
|
+
*
|
|
111
|
+
* `addresses` are what the caller verified are outside the host's own
|
|
112
|
+
* network; the connection is pinned to them and never resolves the name
|
|
113
|
+
* itself. A caller that did not check must not hand it a target: the registry
|
|
114
|
+
* trusts it, as it trusts a spawn it is given.
|
|
115
|
+
*/
|
|
116
|
+
export interface MonitorWebSocketTarget {
|
|
117
|
+
readonly url: string
|
|
118
|
+
readonly protocols?: readonly string[]
|
|
119
|
+
readonly addresses: readonly { readonly address: string; readonly family: 4 | 6 }[]
|
|
120
|
+
}
|
|
121
|
+
|
|
108
122
|
/**
|
|
109
123
|
* The slice of the background job registry a tool is given.
|
|
110
124
|
*
|
|
@@ -135,6 +149,19 @@ export interface BackgroundJobRegistryRef {
|
|
|
135
149
|
timeoutMs: number
|
|
136
150
|
workingDirectory?: string
|
|
137
151
|
}): { job: { id: string; status: string }; timeoutMs: number }
|
|
152
|
+
/**
|
|
153
|
+
* Start a monitor whose source is a WebSocket connection. Separate from
|
|
154
|
+
* {@link startMonitor} so a host that implements that one for commands is
|
|
155
|
+
* not handed an input it was not written for; a host without this method
|
|
156
|
+
* refuses a `ws` call with a plain message. The target's addresses are
|
|
157
|
+
* already checked; see {@link MonitorWebSocketTarget}.
|
|
158
|
+
*/
|
|
159
|
+
startWebSocketMonitor?(params: {
|
|
160
|
+
description: string
|
|
161
|
+
timeoutMs: number
|
|
162
|
+
workingDirectory?: string
|
|
163
|
+
webSocket: MonitorWebSocketTarget
|
|
164
|
+
}): { job: { id: string; status: string }; timeoutMs: number }
|
|
138
165
|
get(id: string): {
|
|
139
166
|
id: string
|
|
140
167
|
status: string
|
|
@@ -1151,6 +1178,23 @@ export interface ToolDefinition<TInput = unknown> extends ToolPresentation<TInpu
|
|
|
1151
1178
|
*/
|
|
1152
1179
|
requiresApproval?(input: TInput): boolean
|
|
1153
1180
|
|
|
1181
|
+
/**
|
|
1182
|
+
* What the auto-mode safety classifier is shown of this call.
|
|
1183
|
+
*
|
|
1184
|
+
* The classifier (`createAutoReviewClassifier`, review mode `classify`)
|
|
1185
|
+
* reads a compact transcript, not raw tool arguments: a tool knows which
|
|
1186
|
+
* part of its own input says what the call DOES. A shell tool returns the
|
|
1187
|
+
* command, a file tool the path and a short summary of the change, a fetch
|
|
1188
|
+
* the address. The string should be short and carry no content the model
|
|
1189
|
+
* could not already be trusted with; the runtime caps its length.
|
|
1190
|
+
*
|
|
1191
|
+
* Absent, the classifier is shown the input as compact JSON. A tool whose
|
|
1192
|
+
* input is large or opaque (a file body, a binary payload) should declare
|
|
1193
|
+
* this so the classifier judges the action rather than the bulk. Never
|
|
1194
|
+
* called with a tool RESULT: results are untrusted and are not shown.
|
|
1195
|
+
*/
|
|
1196
|
+
classifierInput?(input: TInput): string
|
|
1197
|
+
|
|
1154
1198
|
/**
|
|
1155
1199
|
* Free-form, tool-author-declared data for filtering and behaviour
|
|
1156
1200
|
* customization — never a classification the runtime itself reads.
|