@namzu/sdk 69.0.0 → 69.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 +61 -0
- package/dist/agents/QueryAgent.d.ts.map +1 -1
- package/dist/agents/QueryAgent.js +2 -0
- package/dist/agents/QueryAgent.js.map +1 -1
- package/dist/authorization/skill-grant.d.ts.map +1 -1
- package/dist/authorization/skill-grant.js +1 -0
- package/dist/authorization/skill-grant.js.map +1 -1
- package/dist/bridge/acp/permission.d.ts +10 -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 +1 -0
- package/dist/bridge/acp/server.js.map +1 -1
- package/dist/connector/index.d.ts +2 -2
- package/dist/connector/index.d.ts.map +1 -1
- package/dist/connector/index.js +1 -1
- package/dist/connector/index.js.map +1 -1
- package/dist/connector/mcp/client.d.ts +29 -0
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +59 -2
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/mcp/errors.d.ts +7 -0
- package/dist/connector/mcp/errors.d.ts.map +1 -1
- package/dist/connector/mcp/errors.js +14 -0
- package/dist/connector/mcp/errors.js.map +1 -1
- package/dist/connector/mcp/index.d.ts +5 -1
- package/dist/connector/mcp/index.d.ts.map +1 -1
- package/dist/connector/mcp/index.js +3 -1
- package/dist/connector/mcp/index.js.map +1 -1
- package/dist/connector/mcp/skill-source.d.ts +144 -0
- package/dist/connector/mcp/skill-source.d.ts.map +1 -0
- package/dist/connector/mcp/skill-source.js +375 -0
- package/dist/connector/mcp/skill-source.js.map +1 -0
- package/dist/connector/mcp/skills.d.ts +137 -0
- package/dist/connector/mcp/skills.d.ts.map +1 -0
- package/dist/connector/mcp/skills.js +303 -0
- package/dist/connector/mcp/skills.js.map +1 -0
- package/dist/network/audit.d.ts +1 -1
- package/dist/network/audit.d.ts.map +1 -1
- package/dist/network/audit.js +2 -0
- package/dist/network/audit.js.map +1 -1
- package/dist/network/computer.d.ts +107 -0
- package/dist/network/computer.d.ts.map +1 -0
- package/dist/network/computer.js +250 -0
- package/dist/network/computer.js.map +1 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.d.ts.map +1 -1
- package/dist/network/index.js +1 -0
- package/dist/network/index.js.map +1 -1
- package/dist/network/join.d.ts +3 -1
- package/dist/network/join.d.ts.map +1 -1
- package/dist/network/join.js +6 -3
- package/dist/network/join.js.map +1 -1
- package/dist/network/roster.d.ts +5 -0
- package/dist/network/roster.d.ts.map +1 -1
- package/dist/network/roster.js.map +1 -1
- package/dist/network/service.d.ts +12 -2
- package/dist/network/service.d.ts.map +1 -1
- package/dist/network/service.js +377 -52
- package/dist/network/service.js.map +1 -1
- package/dist/network/store.d.ts +10 -0
- package/dist/network/store.d.ts.map +1 -1
- package/dist/network/store.js +25 -3
- package/dist/network/store.js.map +1 -1
- package/dist/network/wire.d.ts +2 -0
- package/dist/network/wire.d.ts.map +1 -1
- package/dist/network/wire.js +5 -0
- package/dist/network/wire.js.map +1 -1
- package/dist/plugin/shell-hook-tool-names.d.ts.map +1 -1
- package/dist/plugin/shell-hook-tool-names.js +1 -0
- package/dist/plugin/shell-hook-tool-names.js.map +1 -1
- package/dist/plugin/shell-hook.d.ts +8 -3
- package/dist/plugin/shell-hook.d.ts.map +1 -1
- package/dist/plugin/shell-hook.js +132 -7
- package/dist/plugin/shell-hook.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +4 -0
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/idle-timeout.d.ts.map +1 -1
- package/dist/provider/idle-timeout.js +3 -0
- package/dist/provider/idle-timeout.js.map +1 -1
- package/dist/provider/model-window-suffix.d.ts.map +1 -1
- package/dist/provider/model-window-suffix.js +1 -0
- package/dist/provider/model-window-suffix.js.map +1 -1
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +3 -0
- package/dist/provider/retry.js.map +1 -1
- package/dist/public-runtime.d.ts +9 -6
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +11 -4
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +5 -4
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +5 -3
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +3 -1
- package/dist/public-types.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.js +10 -1
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +12 -0
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +43 -9
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +4 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +32 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +2 -2
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +2 -2
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/shell-line-escalation.d.ts +24 -0
- package/dist/runtime/query/shell-line-escalation.d.ts.map +1 -0
- package/dist/runtime/query/shell-line-escalation.js +38 -0
- package/dist/runtime/query/shell-line-escalation.js.map +1 -0
- package/dist/runtime/query/tooling.d.ts +7 -0
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +2 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.js +11 -0
- package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
- package/dist/scheduler/local.d.ts.map +1 -1
- package/dist/scheduler/local.js +3 -1
- package/dist/scheduler/local.js.map +1 -1
- package/dist/skills/index.d.ts +4 -0
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +2 -0
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/inline-shell-host.d.ts +103 -0
- package/dist/skills/inline-shell-host.d.ts.map +1 -0
- package/dist/skills/inline-shell-host.js +238 -0
- package/dist/skills/inline-shell-host.js.map +1 -0
- package/dist/skills/inline-shell.d.ts +176 -0
- package/dist/skills/inline-shell.d.ts.map +1 -0
- package/dist/skills/inline-shell.js +646 -0
- package/dist/skills/inline-shell.js.map +1 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +1 -0
- package/dist/store/index.js.map +1 -1
- package/dist/store/task/file.d.ts +124 -0
- package/dist/store/task/file.d.ts.map +1 -0
- package/dist/store/task/file.js +498 -0
- package/dist/store/task/file.js.map +1 -0
- package/dist/teams/backend.d.ts +28 -0
- package/dist/teams/backend.d.ts.map +1 -0
- package/dist/teams/backend.js +2 -0
- package/dist/teams/backend.js.map +1 -0
- package/dist/teams/fs-sync.d.ts +19 -0
- package/dist/teams/fs-sync.d.ts.map +1 -0
- package/dist/teams/fs-sync.js +81 -0
- package/dist/teams/fs-sync.js.map +1 -0
- package/dist/teams/index.d.ts +14 -0
- package/dist/teams/index.d.ts.map +1 -0
- package/dist/teams/index.js +11 -0
- package/dist/teams/index.js.map +1 -0
- package/dist/teams/names.d.ts +15 -0
- package/dist/teams/names.d.ts.map +1 -0
- package/dist/teams/names.js +43 -0
- package/dist/teams/names.js.map +1 -0
- package/dist/teams/store.d.ts +133 -0
- package/dist/teams/store.d.ts.map +1 -0
- package/dist/teams/store.js +536 -0
- package/dist/teams/store.js.map +1 -0
- package/dist/teams/types.d.ts +97 -0
- package/dist/teams/types.d.ts.map +1 -0
- package/dist/teams/types.js +70 -0
- package/dist/teams/types.js.map +1 -0
- package/dist/tools/admit-facts.d.ts.map +1 -1
- package/dist/tools/admit-facts.js +9 -1
- package/dist/tools/admit-facts.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +56 -2
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +604 -90
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/index.d.ts +1 -1
- package/dist/tools/builtins/index.d.ts.map +1 -1
- package/dist/tools/builtins/index.js.map +1 -1
- package/dist/tools/builtins/skill.d.ts +31 -0
- package/dist/tools/builtins/skill.d.ts.map +1 -1
- package/dist/tools/builtins/skill.js +232 -88
- package/dist/tools/builtins/skill.js.map +1 -1
- package/dist/tools/task/create.d.ts.map +1 -1
- package/dist/tools/task/create.js +11 -2
- package/dist/tools/task/create.js.map +1 -1
- package/dist/tools/task/get.d.ts +8 -0
- package/dist/tools/task/get.d.ts.map +1 -0
- package/dist/tools/task/get.js +51 -0
- package/dist/tools/task/get.js.map +1 -0
- package/dist/tools/task/index.d.ts +7 -0
- package/dist/tools/task/index.d.ts.map +1 -1
- package/dist/tools/task/index.js +10 -2
- package/dist/tools/task/index.js.map +1 -1
- package/dist/tools/task/list.d.ts.map +1 -1
- package/dist/tools/task/list.js +10 -2
- package/dist/tools/task/list.js.map +1 -1
- package/dist/tools/task/number.d.ts +13 -0
- package/dist/tools/task/number.d.ts.map +1 -0
- package/dist/tools/task/number.js +30 -0
- package/dist/tools/task/number.js.map +1 -0
- package/dist/tools/task/present.d.ts.map +1 -1
- package/dist/tools/task/present.js +17 -3
- package/dist/tools/task/present.js.map +1 -1
- package/dist/tools/task/update.d.ts +2 -1
- package/dist/tools/task/update.d.ts.map +1 -1
- package/dist/tools/task/update.js +86 -19
- package/dist/tools/task/update.js.map +1 -1
- package/dist/types/acp/index.d.ts +10 -0
- package/dist/types/acp/index.d.ts.map +1 -1
- package/dist/types/agent/base.d.ts +4 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/scheduler.d.ts +9 -0
- package/dist/types/agent/scheduler.d.ts.map +1 -1
- package/dist/types/computer-use/index.d.ts +7 -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/connector/mcp.d.ts +10 -0
- package/dist/types/connector/mcp.d.ts.map +1 -1
- package/dist/types/permission/index.d.ts +20 -0
- package/dist/types/permission/index.d.ts.map +1 -1
- package/dist/types/permission/index.js +25 -0
- package/dist/types/permission/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +47 -3
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js +4 -0
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/provider/interface.d.ts +6 -0
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +28 -2
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/tool/presentation.d.ts +4 -0
- package/dist/types/tool/presentation.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agents/QueryAgent.ts +2 -0
- package/src/authorization/skill-grant.ts +1 -0
- package/src/bridge/acp/permission.ts +11 -1
- package/src/bridge/acp/server.ts +1 -0
- package/src/connector/index.ts +27 -0
- package/src/connector/mcp/client.ts +71 -2
- package/src/connector/mcp/errors.ts +14 -0
- package/src/connector/mcp/index.ts +36 -0
- package/src/connector/mcp/skill-source.ts +499 -0
- package/src/connector/mcp/skills.ts +367 -0
- package/src/network/audit.ts +2 -0
- package/src/network/computer.ts +347 -0
- package/src/network/index.ts +20 -0
- package/src/network/join.ts +4 -2
- package/src/network/roster.ts +5 -0
- package/src/network/service.ts +492 -75
- package/src/network/store.ts +29 -3
- package/src/network/wire.ts +5 -0
- package/src/plugin/shell-hook-tool-names.ts +1 -0
- package/src/plugin/shell-hook.ts +144 -7
- package/src/provider/fallback.ts +4 -0
- package/src/provider/idle-timeout.ts +3 -0
- package/src/provider/model-window-suffix.ts +1 -0
- package/src/provider/retry.ts +3 -0
- package/src/public-runtime.ts +99 -0
- package/src/public-tools.ts +9 -0
- package/src/public-types.ts +28 -0
- package/src/runtime/query/executor/tool-call-admission.ts +10 -1
- package/src/runtime/query/executor.ts +57 -8
- package/src/runtime/query/index.ts +43 -0
- package/src/runtime/query/review-policy.ts +7 -1
- package/src/runtime/query/shell-line-escalation.ts +49 -0
- package/src/runtime/query/tooling.ts +6 -0
- package/src/runtime/query/turn/outcome-ledger.ts +11 -0
- package/src/scheduler/local.ts +3 -1
- package/src/skills/index.ts +43 -0
- package/src/skills/inline-shell-host.ts +303 -0
- package/src/skills/inline-shell.ts +765 -0
- package/src/store/index.ts +8 -0
- package/src/store/task/file.ts +641 -0
- package/src/teams/backend.ts +29 -0
- package/src/teams/fs-sync.ts +91 -0
- package/src/teams/index.ts +47 -0
- package/src/teams/names.ts +49 -0
- package/src/teams/store.ts +607 -0
- package/src/teams/types.ts +102 -0
- package/src/tools/admit-facts.ts +9 -1
- package/src/tools/builtins/computer-use.ts +689 -95
- package/src/tools/builtins/index.ts +1 -0
- package/src/tools/builtins/skill.ts +291 -95
- package/src/tools/task/create.ts +11 -2
- package/src/tools/task/get.ts +53 -0
- package/src/tools/task/index.ts +14 -2
- package/src/tools/task/list.ts +10 -2
- package/src/tools/task/number.ts +32 -0
- package/src/tools/task/present.ts +18 -3
- package/src/tools/task/update.ts +93 -19
- package/src/types/acp/index.ts +11 -1
- package/src/types/agent/base.ts +6 -0
- package/src/types/agent/scheduler.ts +9 -0
- package/src/types/computer-use/index.ts +7 -0
- package/src/types/connector/mcp.ts +10 -0
- package/src/types/permission/index.ts +29 -0
- package/src/types/plugin/index.ts +95 -39
- package/src/types/provider/interface.ts +7 -0
- package/src/types/tool/index.ts +23 -2
- package/src/types/tool/presentation.ts +2 -0
package/src/public-types.ts
CHANGED
|
@@ -325,6 +325,13 @@ export type {
|
|
|
325
325
|
export type { TaskContextScope } from './store/task/context.js'
|
|
326
326
|
|
|
327
327
|
export type { TaskToolScope } from './tools/task/index.js'
|
|
328
|
+
export type {
|
|
329
|
+
ClaimableTaskStore,
|
|
330
|
+
FileTaskStoreConfig,
|
|
331
|
+
TaskClaimFailure,
|
|
332
|
+
TaskClaimResult,
|
|
333
|
+
TaskListErrorCode,
|
|
334
|
+
} from './store/task/file.js'
|
|
328
335
|
|
|
329
336
|
export type { MappedStreamEvent } from './bridge/sse/index.js'
|
|
330
337
|
|
|
@@ -777,6 +784,9 @@ export type {
|
|
|
777
784
|
HeldMail,
|
|
778
785
|
HostPort,
|
|
779
786
|
ListenAddress,
|
|
787
|
+
ComputerSecretRead,
|
|
788
|
+
ComputerSecretSource,
|
|
789
|
+
ReadSecretOptions,
|
|
780
790
|
LocalSession,
|
|
781
791
|
MailDecision,
|
|
782
792
|
MailDecisionInput,
|
|
@@ -803,6 +813,8 @@ export type {
|
|
|
803
813
|
PendingJoin,
|
|
804
814
|
PrivateInterfaceOptions,
|
|
805
815
|
RemoteMail,
|
|
816
|
+
ResolveSecretDeps,
|
|
817
|
+
ResolveSecretInput,
|
|
806
818
|
Revocation,
|
|
807
819
|
RosterMachineView,
|
|
808
820
|
RosterSession,
|
|
@@ -881,3 +893,19 @@ export type {
|
|
|
881
893
|
} from './pals/activity/subscription-policy.js'
|
|
882
894
|
export type { PalActivitySubscriptionRunnerOptions } from './pals/activity/subscriptions.js'
|
|
883
895
|
export type { PalActivityCausalityOptions } from './pals/activity/causality.js'
|
|
896
|
+
|
|
897
|
+
export type {
|
|
898
|
+
CreateTeamInput,
|
|
899
|
+
MailDraft,
|
|
900
|
+
MailEntry,
|
|
901
|
+
MailKind,
|
|
902
|
+
MailReadOptions,
|
|
903
|
+
ReserveMemberInput,
|
|
904
|
+
TeamBackendKind,
|
|
905
|
+
TeamConfig,
|
|
906
|
+
TeamMember,
|
|
907
|
+
TeamStoreErrorCode,
|
|
908
|
+
TeamStoreOptions,
|
|
909
|
+
TeammateBackend,
|
|
910
|
+
TeammateStartSpec,
|
|
911
|
+
} from './teams/index.js'
|
|
@@ -135,7 +135,16 @@ async function runTaskHook(
|
|
|
135
135
|
const results = await awaitWithAbort(
|
|
136
136
|
manager.executeHooks(
|
|
137
137
|
event,
|
|
138
|
-
{
|
|
138
|
+
{
|
|
139
|
+
sessionId: host.config.sessionId,
|
|
140
|
+
turnId: host.config.turnId,
|
|
141
|
+
task,
|
|
142
|
+
// A task a teammate makes or completes names the teammate and its team.
|
|
143
|
+
...(host.config.teammate
|
|
144
|
+
? { teammateName: host.config.teammate.name, teamName: host.config.teammate.team }
|
|
145
|
+
: {}),
|
|
146
|
+
signal,
|
|
147
|
+
},
|
|
139
148
|
host.emitEvent,
|
|
140
149
|
),
|
|
141
150
|
signal,
|
|
@@ -26,6 +26,7 @@ import { isAlwaysDestructive } from '../../tools/defineTool.js'
|
|
|
26
26
|
import { createFileReadTracker } from '../../tools/file-read-tracker.js'
|
|
27
27
|
import { pathOutsideRoots, resolveWithinAnyReal, toolRoots } from '../../tools/paths.js'
|
|
28
28
|
import { resolveRetainedOutput } from '../../tools/retained-output.js'
|
|
29
|
+
import { isTrustedReadOnly } from '../../tools/trusted-read-only.js'
|
|
29
30
|
import type { ToolManager } from '../../toolsets/manager.js'
|
|
30
31
|
import type { ToolSourceRef } from '../../toolsets/types.js'
|
|
31
32
|
import type { ToolResultGuardrailSpec } from '../../types/guardrail/index.js'
|
|
@@ -50,6 +51,7 @@ import {
|
|
|
50
51
|
PLAN_MODE_REFUSAL_WITH_PLAN_FILE,
|
|
51
52
|
type PermissionMode,
|
|
52
53
|
STRICT_MODE_REFUSAL,
|
|
54
|
+
nestedCallModeRefusal,
|
|
53
55
|
} from '../../types/permission/index.js'
|
|
54
56
|
import type { PluginHookPermission, PluginHookResult } from '../../types/plugin/index.js'
|
|
55
57
|
import type { ChatCompletionResponse } from '../../types/provider/index.js'
|
|
@@ -485,6 +487,8 @@ export interface ToolExecutorConfig {
|
|
|
485
487
|
web?: ToolContext['web']
|
|
486
488
|
invocationState?: InvocationState
|
|
487
489
|
pluginManager?: PluginLifecycleManager
|
|
490
|
+
/** Set for a teammate's turn: the task hooks name it. */
|
|
491
|
+
teammate?: { readonly name: string; readonly team: string }
|
|
488
492
|
/** Turn-level default deadline; per-tool `timeoutMs` overrides it. */
|
|
489
493
|
toolTimeoutMs?: number
|
|
490
494
|
/**
|
|
@@ -578,6 +582,13 @@ export interface ToolExecutorConfig {
|
|
|
578
582
|
* grants nothing, and its tool says so.
|
|
579
583
|
*/
|
|
580
584
|
skillGrants?: SkillGrantSet
|
|
585
|
+
/**
|
|
586
|
+
* The review mode this turn is decided under right now (`plan`, `strict`, …),
|
|
587
|
+
* read at each nested call. A call a tool makes from inside itself never goes
|
|
588
|
+
* to the review policy, so the mode's refusals are applied to it here. Absent
|
|
589
|
+
* or not a mode name: the mode has nothing to say about nested calls.
|
|
590
|
+
*/
|
|
591
|
+
reviewMode?: () => string | undefined
|
|
581
592
|
}
|
|
582
593
|
|
|
583
594
|
/**
|
|
@@ -2357,14 +2368,42 @@ export class ToolExecutor {
|
|
|
2357
2368
|
}
|
|
2358
2369
|
this.admitScratchpad(preparedCall)
|
|
2359
2370
|
const nestedEscalation = await this.escalationOrUnfinished(preparedCall)
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2371
|
+
// A host-owned pre-approval for this one dispatch (a skill's `allowed-tools`
|
|
2372
|
+
// while its text loads) answers only what no rule decided: a call a rule
|
|
2373
|
+
// denied, or sent to review on purpose, or that the dangerous-command floor
|
|
2374
|
+
// stopped, stays stopped.
|
|
2375
|
+
// The mode the turn is decided under answers a nested call as it answers the same
|
|
2376
|
+
// call made directly: the tool that made this one reads, so the policy never saw it.
|
|
2377
|
+
// Asked only when there is a mode to answer to: with none, the call is decided as before.
|
|
2378
|
+
const reviewMode = this.config.reviewMode?.()
|
|
2379
|
+
const modeRefusal =
|
|
2380
|
+
reviewMode === undefined
|
|
2381
|
+
? undefined
|
|
2382
|
+
: nestedCallModeRefusal(reviewMode, {
|
|
2383
|
+
readOnly: isTrustedReadOnly(nestedTool, preparedInput, this.toolSource(name)),
|
|
2384
|
+
allowedByRule: gateResult?.decision === 'allow' && gateResult.matchedRule !== null,
|
|
2385
|
+
})
|
|
2386
|
+
const runGranted =
|
|
2387
|
+
modeRefusal === undefined &&
|
|
2388
|
+
gateResult?.decision === 'review' &&
|
|
2389
|
+
gateResult.matchedRule === null &&
|
|
2390
|
+
options?.allow?.({ name, input: preparedInput }) === true
|
|
2391
|
+
if (
|
|
2392
|
+
nestedEscalation ||
|
|
2393
|
+
needsApproval ||
|
|
2394
|
+
modeRefusal !== undefined ||
|
|
2395
|
+
(gateResult && gateResult.decision !== 'allow' && !runGranted)
|
|
2396
|
+
) {
|
|
2397
|
+
const reason =
|
|
2398
|
+
modeRefusal !== undefined
|
|
2399
|
+
? `Blocked: ${modeRefusal}.`
|
|
2400
|
+
: nestedEscalation
|
|
2401
|
+
? 'Blocked: this nested call reaches a protected path, removal floor, outside-root boundary or another safety escalation. Call it directly so it can be reviewed.'
|
|
2402
|
+
: needsApproval
|
|
2403
|
+
? `Blocked: "${name}" requires the person's approval for every call, and an approval cannot be requested from inside another tool. Call it directly.`
|
|
2404
|
+
: gateResult?.decision === 'deny'
|
|
2405
|
+
? `Blocked by the authorization gate: ${gateResult.reason}`
|
|
2406
|
+
: `Blocked by the authorization gate: this nested call requires an explicit allow rule because an operator review cannot be opened from inside another tool. ${gateResult?.reason}`
|
|
2368
2407
|
const output = deniedToolOutput(name, reason)
|
|
2369
2408
|
// Same fail-closed durability rule as a direct gate denial: if the
|
|
2370
2409
|
// configured session log cannot record the refusal, do not quietly carry
|
|
@@ -2440,6 +2479,16 @@ export class ToolExecutor {
|
|
|
2440
2479
|
|
|
2441
2480
|
const nestedCwd = this.preparedBashDirectories.get(preparedCall)
|
|
2442
2481
|
if (nestedCwd !== undefined) pinBashWorkingDirectory(childContext, nestedCwd)
|
|
2482
|
+
// The caller's last word, after every rule has allowed the call and before
|
|
2483
|
+
// anything starts: a refusal here is an answer, not a failure of the tool.
|
|
2484
|
+
if (options?.beforeRun) {
|
|
2485
|
+
const refusal = await options.beforeRun({ name, input: preparedInput, toolUseId: nestedId })
|
|
2486
|
+
signal.throwIfAborted()
|
|
2487
|
+
if (refusal !== undefined) {
|
|
2488
|
+
await progress.close()
|
|
2489
|
+
return { success: false, output: '', error: refusal }
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2443
2492
|
await this.emitEvent({
|
|
2444
2493
|
type: 'tool_executing',
|
|
2445
2494
|
turnId: this.config.turnId,
|
|
@@ -835,6 +835,12 @@ export interface QueryParams {
|
|
|
835
835
|
|
|
836
836
|
taskStore?: TaskStore
|
|
837
837
|
|
|
838
|
+
/** The member name the task tools claim under when `taskStore` is a list a team shares. */
|
|
839
|
+
taskMember?: string
|
|
840
|
+
|
|
841
|
+
/** The team a teammate belongs to; with `taskMember` it names the teammate on the task hooks. */
|
|
842
|
+
taskTeam?: string
|
|
843
|
+
|
|
838
844
|
runtimeToolOverrides?: RuntimeToolOverrides
|
|
839
845
|
|
|
840
846
|
runtimeContext?: AgentRuntimeContext
|
|
@@ -1301,6 +1307,7 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1301
1307
|
const taskTools = buildTaskTools(params.taskStore, {
|
|
1302
1308
|
sessionId: ctx.sessionId,
|
|
1303
1309
|
turnId: ctx.turnId,
|
|
1310
|
+
...(params.taskMember !== undefined ? { member: params.taskMember } : {}),
|
|
1304
1311
|
// A resumed turn began when its `turn_started` was recorded, maybe
|
|
1305
1312
|
// in another process: tasks it closed before the pause are still
|
|
1306
1313
|
// "closed in this turn".
|
|
@@ -1449,6 +1456,36 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1449
1456
|
})
|
|
1450
1457
|
}
|
|
1451
1458
|
|
|
1459
|
+
// The person's own picture, on a model known to read text only, is refused
|
|
1460
|
+
// before anything is sent: leaving it out would answer a question about a
|
|
1461
|
+
// picture the model never saw, with nothing on screen to say so. Images a
|
|
1462
|
+
// tool returned are another matter (they are left out quietly beside the
|
|
1463
|
+
// text the tool gave), and so is a driver that declares no vision at all.
|
|
1464
|
+
// Only when that message is the last one: a run continuing after it (a
|
|
1465
|
+
// resume past an approval pause) answers with the picture already left
|
|
1466
|
+
// out, and refusing there would block a turn the person did not start.
|
|
1467
|
+
if (
|
|
1468
|
+
textOnlyModel &&
|
|
1469
|
+
latestUser !== undefined &&
|
|
1470
|
+
latestUser === params.messages[params.messages.length - 1] &&
|
|
1471
|
+
carries(latestUser, 'image')
|
|
1472
|
+
) {
|
|
1473
|
+
const alternative = params.provider.imageModelFor?.(turnConfig.model)
|
|
1474
|
+
throw new NamzuError({
|
|
1475
|
+
code: 'capability_unavailable',
|
|
1476
|
+
message: `Model '${turnConfig.model}' does not accept image input. ${
|
|
1477
|
+
alternative
|
|
1478
|
+
? `Select '${alternative}' or remove the images.`
|
|
1479
|
+
: 'Select a model that reads images or remove the images.'
|
|
1480
|
+
}`,
|
|
1481
|
+
details: {
|
|
1482
|
+
providerId: params.provider.id,
|
|
1483
|
+
capability: 'vision',
|
|
1484
|
+
model: turnConfig.model,
|
|
1485
|
+
},
|
|
1486
|
+
})
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1452
1489
|
if (attachmentMessageCount > 0) {
|
|
1453
1490
|
const message = textOnlyModel
|
|
1454
1491
|
? `Model '${turnConfig.model}' on provider '${params.provider.id}' reads text only but ${attachmentMessageCount} user message(s) carry image attachments — they are left out of its requests, so the model never sees the images. Pass strictCapabilities: true to fail instead, or use a model that reads images.`
|
|
@@ -1657,6 +1694,9 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1657
1694
|
const toolExecutor = ToolingBootstrap.init(
|
|
1658
1695
|
{
|
|
1659
1696
|
skillGrants,
|
|
1697
|
+
// A host names its approval policy for the mode it implements, so the name is
|
|
1698
|
+
// the live mode; a name that is not a mode says nothing about nested calls.
|
|
1699
|
+
reviewMode: () => approvalPolicy.current.name,
|
|
1660
1700
|
tools: toolManager,
|
|
1661
1701
|
...(params.structuredOutput?.toolResultRetention === 'durable' && structuredOutputTool
|
|
1662
1702
|
? { durableStructuredOutputTool: structuredOutputTool }
|
|
@@ -1683,6 +1723,9 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1683
1723
|
allowedTools: effectiveAllowedTools,
|
|
1684
1724
|
invocationState: params.invocationState,
|
|
1685
1725
|
pluginManager: params.pluginManager,
|
|
1726
|
+
...(params.taskTeam !== undefined && params.taskMember !== undefined
|
|
1727
|
+
? { teammate: { name: params.taskMember, team: params.taskTeam } }
|
|
1728
|
+
: {}),
|
|
1686
1729
|
...(params.backgroundJobs ? { backgroundJobs: params.backgroundJobs } : {}),
|
|
1687
1730
|
...(params.backgroundJobOwner ? { backgroundJobOwner: params.backgroundJobOwner } : {}),
|
|
1688
1731
|
...(awaitedJobs ? { onJobAwaited: (id: string) => awaitedJobs.expect(id) } : {}),
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
PLAN_MODE_REFUSAL,
|
|
51
51
|
PLAN_MODE_REFUSAL_WITH_PLAN_FILE,
|
|
52
52
|
STRICT_MODE_REFUSAL,
|
|
53
|
+
nestedCallModeRefusal,
|
|
53
54
|
} from '../../types/permission/index.js'
|
|
54
55
|
import type { AutoReviewClassifier, AutoReviewDecision } from './auto-review/classifier.js'
|
|
55
56
|
import {
|
|
@@ -149,7 +150,12 @@ export function isReviewMode(value: unknown): value is ReviewMode {
|
|
|
149
150
|
return typeof value === 'string' && (REVIEW_MODES as readonly string[]).includes(value)
|
|
150
151
|
}
|
|
151
152
|
|
|
152
|
-
export {
|
|
153
|
+
export {
|
|
154
|
+
PLAN_MODE_REFUSAL,
|
|
155
|
+
PLAN_MODE_REFUSAL_WITH_PLAN_FILE,
|
|
156
|
+
STRICT_MODE_REFUSAL,
|
|
157
|
+
nestedCallModeRefusal,
|
|
158
|
+
}
|
|
153
159
|
|
|
154
160
|
/** The tools `accept-edits` approves without asking. Everything else prompts. */
|
|
155
161
|
export const ACCEPT_EDITS_TOOLS: ReadonlySet<string> = new Set(['edit', 'write'])
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a shell line reaches that no rule and no skill grant may approve in
|
|
3
|
+
* advance, asked outside a turn. The executor asks the same questions of a
|
|
4
|
+
* nested call (`escalationOf`); a host that runs a command without an
|
|
5
|
+
* executor (a command a person typed, a headless prompt) asks them here, so
|
|
6
|
+
* the two routes refuse the same lines.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { unknownProgramInLine } from '../../authorization/program.js'
|
|
10
|
+
import type { ShellDialect } from '../../authorization/shell-lexer.js'
|
|
11
|
+
import { shellEscalations } from './path-escalation.js'
|
|
12
|
+
|
|
13
|
+
export interface ShellLineEscalationContext {
|
|
14
|
+
/** The working directory first, then the added directories. */
|
|
15
|
+
readonly roots: readonly string[]
|
|
16
|
+
/** Where the line starts, when that is not the first root. */
|
|
17
|
+
readonly cwd?: string
|
|
18
|
+
/** Whether the line runs in a sandbox (paths there are the guest's). */
|
|
19
|
+
readonly sandboxed: boolean
|
|
20
|
+
readonly dialect?: ShellDialect
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The reason a shell line must go to a person, or `undefined` when it reaches
|
|
25
|
+
* nothing past the roots. A check that throws is answered as an unfinished
|
|
26
|
+
* check, never as "nothing found".
|
|
27
|
+
*/
|
|
28
|
+
export async function shellLineEscalation(
|
|
29
|
+
line: string,
|
|
30
|
+
context: ShellLineEscalationContext,
|
|
31
|
+
): Promise<string | undefined> {
|
|
32
|
+
const dialect = context.dialect ?? 'sh'
|
|
33
|
+
try {
|
|
34
|
+
const found = await shellEscalations(line, dialect, {
|
|
35
|
+
roots: context.roots,
|
|
36
|
+
...(context.cwd !== undefined ? { cwd: context.cwd } : {}),
|
|
37
|
+
reviewOutside: !context.sandboxed,
|
|
38
|
+
topLevel: !context.sandboxed,
|
|
39
|
+
})
|
|
40
|
+
if (found.protectedPaths.length > 0) return 'it writes to a protected path'
|
|
41
|
+
if (found.dangerousRemoval !== undefined) return 'it removes more than a command may'
|
|
42
|
+
if (found.outsidePaths.length > 0) return 'it reaches outside the working folders'
|
|
43
|
+
if (unknownProgramInLine(line, dialect) !== undefined)
|
|
44
|
+
return 'it runs a program Namzu cannot read'
|
|
45
|
+
return undefined
|
|
46
|
+
} catch {
|
|
47
|
+
return 'the safety checks did not finish'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -48,6 +48,8 @@ export interface ToolingBootstrapConfig {
|
|
|
48
48
|
allowedTools?: readonly string[]
|
|
49
49
|
invocationState?: InvocationState
|
|
50
50
|
pluginManager?: PluginLifecycleManager
|
|
51
|
+
/** Set for a teammate's turn: the task hooks name it. */
|
|
52
|
+
teammate?: { readonly name: string; readonly team: string }
|
|
51
53
|
toolTimeoutMs?: number
|
|
52
54
|
/** Host-owned and shared; the executor binds it to this turn. */
|
|
53
55
|
backgroundJobs?: BackgroundJobRegistry
|
|
@@ -92,6 +94,8 @@ export interface ToolingBootstrapConfig {
|
|
|
92
94
|
toolPause?: (toolUseId: string) => RequestToolPause
|
|
93
95
|
/** The turn's skill pre-approvals; see the executor's own field. */
|
|
94
96
|
skillGrants?: SkillGrantSet
|
|
97
|
+
/** See `ExecutorConfig.reviewMode`. */
|
|
98
|
+
reviewMode?: () => string | undefined
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
export class ToolingBootstrap {
|
|
@@ -126,6 +130,7 @@ export class ToolingBootstrap {
|
|
|
126
130
|
invocationState: config.invocationState,
|
|
127
131
|
captureSessionEvidence: config.captureSessionEvidence,
|
|
128
132
|
pluginManager: config.pluginManager,
|
|
133
|
+
...(config.teammate ? { teammate: config.teammate } : {}),
|
|
129
134
|
...(config.backgroundJobs ? { backgroundJobs: config.backgroundJobs } : {}),
|
|
130
135
|
...(config.backgroundJobOwner ? { backgroundJobOwner: config.backgroundJobOwner } : {}),
|
|
131
136
|
...(config.onJobAwaited ? { onJobAwaited: config.onJobAwaited } : {}),
|
|
@@ -178,6 +183,7 @@ export class ToolingBootstrap {
|
|
|
178
183
|
: {}),
|
|
179
184
|
...(config.toolPause !== undefined ? { toolPause: config.toolPause } : {}),
|
|
180
185
|
...(config.skillGrants !== undefined ? { skillGrants: config.skillGrants } : {}),
|
|
186
|
+
...(config.reviewMode !== undefined ? { reviewMode: config.reviewMode } : {}),
|
|
181
187
|
},
|
|
182
188
|
activityStore,
|
|
183
189
|
emitEvent,
|
|
@@ -359,6 +359,14 @@ function runsRecognisedCheck(line: string, hostIsCheck?: (command: string) => bo
|
|
|
359
359
|
return false
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
+
/** Tools that only write to the task list or to the mail between agents. */
|
|
363
|
+
const COORDINATION_TOOLS: ReadonlySet<string> = new Set([
|
|
364
|
+
'task_create',
|
|
365
|
+
'task_update',
|
|
366
|
+
'send_message',
|
|
367
|
+
'stop_task',
|
|
368
|
+
])
|
|
369
|
+
|
|
362
370
|
export class OutcomeLedger {
|
|
363
371
|
private readonly config: TurnOutcomeConfig
|
|
364
372
|
private started = false
|
|
@@ -446,6 +454,9 @@ export class OutcomeLedger {
|
|
|
446
454
|
*/
|
|
447
455
|
private couldChange(call: PendingOutcomeCall): boolean {
|
|
448
456
|
if (call.readOnly === true) return false
|
|
457
|
+
// These keep the plan and the team's mail: they write to the task list and the mailboxes, never to
|
|
458
|
+
// the workspace, so a turn that only used them has nothing it could have changed unseen.
|
|
459
|
+
if (COORDINATION_TOOLS.has(call.toolName)) return false
|
|
449
460
|
if (call.toolName === 'bash') {
|
|
450
461
|
const command = commandOf(call.input)
|
|
451
462
|
if (command !== undefined && isReadOnlyCommandLine(command)) return false
|
package/src/scheduler/local.ts
CHANGED
|
@@ -135,7 +135,9 @@ export class LocalTaskScheduler implements TaskScheduler {
|
|
|
135
135
|
input: {
|
|
136
136
|
messages: [...(options.inheritedMessages ?? []), createUserMessage(options.prompt)],
|
|
137
137
|
workingDirectory: options.workingDirectory,
|
|
138
|
-
taskStore: this.parentInput?.taskStore,
|
|
138
|
+
taskStore: options.taskStore ?? this.parentInput?.taskStore,
|
|
139
|
+
...(options.taskMember !== undefined ? { taskMember: options.taskMember } : {}),
|
|
140
|
+
...(options.taskTeam !== undefined ? { taskTeam: options.taskTeam } : {}),
|
|
139
141
|
runtimeToolOverrides: this.parentInput?.runtimeToolOverrides,
|
|
140
142
|
runtimeContext: options.runtimeContext ?? this.parentInput?.runtimeContext,
|
|
141
143
|
},
|
package/src/skills/index.ts
CHANGED
|
@@ -9,3 +9,46 @@ export {
|
|
|
9
9
|
discoverSkills,
|
|
10
10
|
} from './loader.js'
|
|
11
11
|
export { SkillCollisionError, SkillRegistry, resolveSkillChain } from './registry.js'
|
|
12
|
+
export {
|
|
13
|
+
INLINE_SHELL_COMMAND_SHOWN_CHARS,
|
|
14
|
+
INLINE_SHELL_MAX_COMMANDS,
|
|
15
|
+
INLINE_SHELL_MAX_COMMAND_CHARS,
|
|
16
|
+
INLINE_SHELL_MAX_OUTPUT_CHARS,
|
|
17
|
+
INLINE_SHELL_REASON_CHARS,
|
|
18
|
+
InlineShellError,
|
|
19
|
+
SHELL_OFF_PLACEHOLDER,
|
|
20
|
+
SHELL_PRELOAD_PLACEHOLDER,
|
|
21
|
+
SHELL_REMOTE_PLACEHOLDER,
|
|
22
|
+
SHELL_UNTRUSTED_PLACEHOLDER,
|
|
23
|
+
escapeInlineShell,
|
|
24
|
+
expandInlineShell,
|
|
25
|
+
findInlineShell,
|
|
26
|
+
normalizeInlineShellText,
|
|
27
|
+
shapeShellOutput,
|
|
28
|
+
splitShellToolOutput,
|
|
29
|
+
substituteEscaped,
|
|
30
|
+
} from './inline-shell.js'
|
|
31
|
+
export type {
|
|
32
|
+
InlineShellBlock,
|
|
33
|
+
InlineShellHookVerdict,
|
|
34
|
+
InlineShellHost,
|
|
35
|
+
InlineShellKind,
|
|
36
|
+
InlineShellMarker,
|
|
37
|
+
InlineShellOptions,
|
|
38
|
+
InlineShellOutcome,
|
|
39
|
+
} from './inline-shell.js'
|
|
40
|
+
export {
|
|
41
|
+
PRE_SKILL_SHELL_COMMAND_EVENT,
|
|
42
|
+
SKILL_SHELL_TOOL_NAME,
|
|
43
|
+
createPreToolUseShellHook,
|
|
44
|
+
createSkillShellHook,
|
|
45
|
+
createToolSkillShellHost,
|
|
46
|
+
outcomeOf as skillShellOutcomeOf,
|
|
47
|
+
skillShellAllow,
|
|
48
|
+
skillShellHookVerdict,
|
|
49
|
+
} from './inline-shell-host.js'
|
|
50
|
+
export type {
|
|
51
|
+
PreToolUseShellHookOptions,
|
|
52
|
+
SkillShellHookOptions,
|
|
53
|
+
ToolSkillShellHostOptions,
|
|
54
|
+
} from './inline-shell-host.js'
|