@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
|
@@ -27,7 +27,16 @@ function activity(label: string): ToolCallView {
|
|
|
27
27
|
return { kind: 'generic', presentation: 'activity', label }
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/**
|
|
30
|
+
/** The number a team's screens call the task by, when its receipt carries one. */
|
|
31
|
+
function numberOf(result: ToolResult): number | undefined {
|
|
32
|
+
const number = (result.data as { number?: unknown } | undefined)?.number
|
|
33
|
+
return typeof number === 'number' ? number : undefined
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A successful receipt: the call row already said it. A task of a team's list has a number the
|
|
38
|
+
* rest of the screen uses (`task #2`), so there the receipt says which one.
|
|
39
|
+
*/
|
|
31
40
|
const HIDDEN_RESULT: ToolResultView = {
|
|
32
41
|
kind: 'generic',
|
|
33
42
|
label: '',
|
|
@@ -57,7 +66,8 @@ export function presentTaskCreateCall(input: {
|
|
|
57
66
|
|
|
58
67
|
export function presentTaskCreateResult(_input: unknown, result: ToolResult): ToolResultView {
|
|
59
68
|
if (!result.success) return failure(result, 'The task was not added')
|
|
60
|
-
|
|
69
|
+
const number = numberOf(result)
|
|
70
|
+
return number === undefined ? HIDDEN_RESULT : { kind: 'generic', label: `Task #${number} added` }
|
|
61
71
|
}
|
|
62
72
|
|
|
63
73
|
/** The verb for a `task_update` call, from the status it asks for. */
|
|
@@ -104,7 +114,12 @@ export function presentTaskUpdateResult(_input: unknown, result: ToolResult): To
|
|
|
104
114
|
}
|
|
105
115
|
return failure(result, 'The task was not changed')
|
|
106
116
|
}
|
|
107
|
-
|
|
117
|
+
const number = numberOf(result)
|
|
118
|
+
if (number === undefined) return HIDDEN_RESULT
|
|
119
|
+
const status = (result.data as { status?: unknown } | undefined)?.status
|
|
120
|
+
const said =
|
|
121
|
+
status === 'in_progress' ? 'started' : typeof status === 'string' ? status : 'updated'
|
|
122
|
+
return { kind: 'generic', label: `Task #${number} ${said}` }
|
|
108
123
|
}
|
|
109
124
|
|
|
110
125
|
export function presentTaskListCall(): ToolCallView {
|
package/src/tools/task/update.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
|
+
import { TaskListError, isClaimableTaskStore } from '../../store/task/file.js'
|
|
2
3
|
import type { TaskStore } from '../../types/task/index.js'
|
|
3
4
|
import type { ToolDefinition } from '../../types/tool/index.js'
|
|
4
5
|
import { asTaskId } from '../../utils/id.js'
|
|
5
6
|
import { defineTool } from '../defineTool.js'
|
|
7
|
+
import type { TaskToolScope } from './index.js'
|
|
8
|
+
import { taskNumbers } from './number.js'
|
|
6
9
|
import { presentTaskUpdateCall, presentTaskUpdateResult } from './present.js'
|
|
7
10
|
|
|
8
|
-
export function buildTaskUpdateTool(
|
|
11
|
+
export function buildTaskUpdateTool(
|
|
12
|
+
taskStore: TaskStore,
|
|
13
|
+
scope?: Pick<TaskToolScope, 'member'>,
|
|
14
|
+
): ToolDefinition {
|
|
9
15
|
return defineTool({
|
|
10
16
|
name: 'task_update',
|
|
11
17
|
description:
|
|
@@ -52,37 +58,104 @@ export function buildTaskUpdateTool(taskStore: TaskStore): ToolDefinition {
|
|
|
52
58
|
// which tells the model its task disappeared rather than that it
|
|
53
59
|
// named the wrong thing.
|
|
54
60
|
const taskId = asTaskId(id)
|
|
61
|
+
// A team's list numbers its tasks; the screen says `#2`, so the receipt does too and keeps the id beside it.
|
|
62
|
+
const number = (await taskNumbers(taskStore)).get(taskId)
|
|
63
|
+
const named = number === undefined ? `${id}` : `#${number} (id ${id})`
|
|
55
64
|
|
|
56
65
|
if (status === 'deleted') {
|
|
57
66
|
const deleted = await taskStore.delete(taskId)
|
|
58
67
|
return {
|
|
59
68
|
success: deleted,
|
|
60
|
-
output: deleted ? `Task ${
|
|
69
|
+
output: deleted ? `Task ${named} deleted` : `Task ${named} not found`,
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
// Only a list several sessions share can refuse an edge or a claim, and only it is asked to.
|
|
74
|
+
const shared = isClaimableTaskStore(taskStore) ? taskStore : undefined
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
if (addBlocks) {
|
|
78
|
+
for (const blockedId of addBlocks) {
|
|
79
|
+
await taskStore.block(taskId, asTaskId(blockedId))
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (addBlockedBy) {
|
|
83
|
+
for (const blockerId of addBlockedBy) {
|
|
84
|
+
await taskStore.block(asTaskId(blockerId), taskId)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (shared && error instanceof TaskListError) {
|
|
89
|
+
return { success: false, output: error.message }
|
|
90
|
+
}
|
|
91
|
+
throw error
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Moving a shared task to in_progress is a claim: it goes to one owner, and a task that is
|
|
95
|
+
// owned, closed or still waiting on a blocker says so instead of being taken.
|
|
96
|
+
let claimed: Awaited<ReturnType<TaskStore['get']>>
|
|
97
|
+
if (shared && status === 'in_progress') {
|
|
98
|
+
const claimant = owner ?? scope?.member
|
|
99
|
+
if (claimant === undefined) {
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
output: `Task ${named} cannot move to in_progress without an owner; pass owner (your member name).`,
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
{
|
|
106
|
+
const result = await shared.claimTask(taskId, claimant)
|
|
107
|
+
if (!result.ok) {
|
|
108
|
+
const reason: Record<typeof result.code, string> = {
|
|
109
|
+
not_found: `Task ${named} not found`,
|
|
110
|
+
already_claimed: `Task ${named} is already claimed by ${result.task?.owner ?? 'another member'}`,
|
|
111
|
+
already_resolved: `Task ${named} is already ${result.task?.status ?? 'closed'}; create a follow-up task instead`,
|
|
112
|
+
blocked: `Task ${named} is blocked by ${result.blockedBy?.join(', ') ?? 'another task'}; finish those first`,
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
success: false,
|
|
116
|
+
output: reason[result.code],
|
|
117
|
+
data: { code: result.code },
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
claimed = result.task
|
|
67
121
|
}
|
|
68
122
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
123
|
+
|
|
124
|
+
// One member does not close another's task.
|
|
125
|
+
if (
|
|
126
|
+
shared &&
|
|
127
|
+
scope?.member !== undefined &&
|
|
128
|
+
(status === 'completed' || status === 'failed')
|
|
129
|
+
) {
|
|
130
|
+
const current = await shared.get(taskId)
|
|
131
|
+
if (current?.owner !== undefined && current.owner !== scope.member) {
|
|
132
|
+
return {
|
|
133
|
+
success: false,
|
|
134
|
+
output: `Task ${named} is owned by ${current.owner}; only its owner closes it.`,
|
|
135
|
+
data: { code: 'already_claimed' },
|
|
136
|
+
}
|
|
72
137
|
}
|
|
73
138
|
}
|
|
74
139
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
140
|
+
let updated: Awaited<ReturnType<TaskStore['update']>>
|
|
141
|
+
try {
|
|
142
|
+
updated = await taskStore.update(taskId, {
|
|
143
|
+
subject,
|
|
144
|
+
description,
|
|
145
|
+
activeForm,
|
|
146
|
+
status: claimed && status === 'in_progress' ? undefined : status,
|
|
147
|
+
owner: claimed ? undefined : owner,
|
|
148
|
+
metadata,
|
|
149
|
+
})
|
|
150
|
+
} catch (error) {
|
|
151
|
+
if (shared && error instanceof TaskListError) {
|
|
152
|
+
return { success: false, output: error.message, data: { code: error.code } }
|
|
153
|
+
}
|
|
154
|
+
throw error
|
|
155
|
+
}
|
|
83
156
|
|
|
84
157
|
if (!updated) {
|
|
85
|
-
return { success: false, output: `Task ${
|
|
158
|
+
return { success: false, output: `Task ${named} not found` }
|
|
86
159
|
}
|
|
87
160
|
|
|
88
161
|
// Stores can retain the old status while applying other edits. The
|
|
@@ -92,10 +165,11 @@ export function buildTaskUpdateTool(taskStore: TaskStore): ToolDefinition {
|
|
|
92
165
|
return {
|
|
93
166
|
success: statusApplied,
|
|
94
167
|
output: statusApplied
|
|
95
|
-
? `Task ${
|
|
96
|
-
: `Task ${
|
|
168
|
+
? `Task ${named} updated — status: ${updated.status}`
|
|
169
|
+
: `Task ${named} requested status "${status}" could not be confirmed; returned status is "${updated.status}". Other requested edits may have applied. Inspect the task and create a new task for follow-up work.`,
|
|
97
170
|
data: {
|
|
98
171
|
id: updated.id,
|
|
172
|
+
...(number === undefined ? {} : { number }),
|
|
99
173
|
subject: updated.subject,
|
|
100
174
|
status: updated.status,
|
|
101
175
|
owner: updated.owner,
|
package/src/types/acp/index.ts
CHANGED
|
@@ -133,6 +133,11 @@ export interface AcpFileChangePreview {
|
|
|
133
133
|
/** What the agent asks the client before running a tool batch. */
|
|
134
134
|
export interface AcpRequestPermissionParams {
|
|
135
135
|
readonly sessionId: string
|
|
136
|
+
/**
|
|
137
|
+
* Present when the ask is a teammate's: its name and team. A client names the member in the
|
|
138
|
+
* question ("<name> wants to run ..."). Absent on the session's own calls and from an older agent.
|
|
139
|
+
*/
|
|
140
|
+
readonly teammate?: { readonly name: string; readonly team: string }
|
|
136
141
|
readonly toolCalls: readonly {
|
|
137
142
|
readonly id: string
|
|
138
143
|
readonly name: string
|
|
@@ -152,7 +157,12 @@ export interface AcpRequestPermissionParams {
|
|
|
152
157
|
* was allowed (it closes, deletes, sends or submits). Absent on other calls
|
|
153
158
|
* and from an older agent.
|
|
154
159
|
*/
|
|
155
|
-
readonly computer?: {
|
|
160
|
+
readonly computer?: {
|
|
161
|
+
readonly app?: string
|
|
162
|
+
readonly consequence?: string
|
|
163
|
+
/** Browsers this call acts in that the engine will put its own question about. */
|
|
164
|
+
readonly browserAsk?: readonly string[]
|
|
165
|
+
}
|
|
156
166
|
}[]
|
|
157
167
|
}
|
|
158
168
|
|
package/src/types/agent/base.ts
CHANGED
|
@@ -401,6 +401,12 @@ export interface AgentInput {
|
|
|
401
401
|
|
|
402
402
|
taskStore?: TaskStore
|
|
403
403
|
|
|
404
|
+
/** The member name the task tools claim under when `taskStore` is a list a team shares. */
|
|
405
|
+
taskMember?: string
|
|
406
|
+
|
|
407
|
+
/** The team a teammate belongs to; with `taskMember` it names the teammate on the task hooks. */
|
|
408
|
+
taskTeam?: string
|
|
409
|
+
|
|
404
410
|
runtimeToolOverrides?: RuntimeToolOverrides
|
|
405
411
|
|
|
406
412
|
runtimeContext?: AgentRuntimeContext
|
|
@@ -35,6 +35,15 @@ export interface TaskHandle {
|
|
|
35
35
|
export type SiblingFailurePolicy = 'continue' | 'cancel-siblings'
|
|
36
36
|
|
|
37
37
|
export interface CreateTaskOptions {
|
|
38
|
+
/**
|
|
39
|
+
* The task list this one child works from, in place of the scheduler's own. A team's members each
|
|
40
|
+
* get the team's shared list this way.
|
|
41
|
+
*/
|
|
42
|
+
readonly taskStore?: import('../task/index.js').TaskStore
|
|
43
|
+
/** The member name this child's task tools claim under when the list is shared by a team. */
|
|
44
|
+
readonly taskMember?: string
|
|
45
|
+
/** The team that member belongs to: with `taskMember` it names the teammate on the task hooks. */
|
|
46
|
+
readonly taskTeam?: string
|
|
38
47
|
/**
|
|
39
48
|
* Continue a child conversation under a NEW task, with this invocation's
|
|
40
49
|
* parent authority, budget and configuration. Local managers accept only
|
|
@@ -301,6 +301,8 @@ export interface UiSnapshot {
|
|
|
301
301
|
readonly region?: boolean
|
|
302
302
|
/** For a region listed in pages: the `offset` that reads the page after this one. */
|
|
303
303
|
readonly next?: number
|
|
304
|
+
/** The text selected in the window, when the host could read it. */
|
|
305
|
+
readonly selectedText?: string
|
|
304
306
|
}
|
|
305
307
|
|
|
306
308
|
/**
|
|
@@ -315,6 +317,11 @@ export interface UiSnapshotOptions {
|
|
|
315
317
|
readonly offset?: number
|
|
316
318
|
/** Only controls whose text contains this (case-insensitive), with the elements above them. */
|
|
317
319
|
readonly query?: string
|
|
320
|
+
/**
|
|
321
|
+
* Only controls of this role (case-insensitive; several may be joined with
|
|
322
|
+
* a comma), with the elements above them. Combines with `query`.
|
|
323
|
+
*/
|
|
324
|
+
readonly role?: string
|
|
318
325
|
}
|
|
319
326
|
|
|
320
327
|
/** Why a ref could not be acted on, as a typed failure. */
|
|
@@ -518,6 +518,16 @@ export interface MCPClientConfig {
|
|
|
518
518
|
* nothing, so a server never returns a task to this client.
|
|
519
519
|
*/
|
|
520
520
|
tasks?: boolean
|
|
521
|
+
/**
|
|
522
|
+
* Take part in the skills extension (2026-07-28). Default `false`.
|
|
523
|
+
*
|
|
524
|
+
* Server-supplied skills are server-supplied instructions, so a host opts
|
|
525
|
+
* in per server. When `true` and the server advertises
|
|
526
|
+
* `io.modelcontextprotocol/skills`, the client declares it on each
|
|
527
|
+
* request and `listSkillPage` and `getSkill` ask the server. `false`
|
|
528
|
+
* declares nothing and sends neither method.
|
|
529
|
+
*/
|
|
530
|
+
skills?: boolean
|
|
521
531
|
/**
|
|
522
532
|
* Answer a server's `elicitation/create` (form mode) by asking the person.
|
|
523
533
|
*
|
|
@@ -28,3 +28,32 @@ export const STRICT_MODE_REFUSAL =
|
|
|
28
28
|
*/
|
|
29
29
|
export const PLAN_MODE_REFUSAL_WITH_PLAN_FILE =
|
|
30
30
|
'Refused: plan mode is read-only. Explore with the reading tools (read, glob, grep, and shell commands that only read; run git on its own, not after cd), write the plan to the plan file, then call exit_plan_mode so the user can approve it. Change nothing else before then.'
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Why a call made from inside another tool (a command a skill holds, run while
|
|
34
|
+
* it loads) may not run under a mode, or `undefined` when the mode has nothing
|
|
35
|
+
* to say about it.
|
|
36
|
+
*
|
|
37
|
+
* The tool that makes the call is read-only (the `skill` tool), so the mode
|
|
38
|
+
* never saw the call and the nested one has to be answered here, the way the
|
|
39
|
+
* mode answers the same call made directly:
|
|
40
|
+
*
|
|
41
|
+
* - `plan` runs only calls that read, whatever a rule or a skill's grant says.
|
|
42
|
+
* - `strict` runs only calls a rule allowed (or that only read). A skill's
|
|
43
|
+
* grant is not a rule, so it never lifts this.
|
|
44
|
+
*
|
|
45
|
+
* Every other mode answers a call that no rule decided by asking a person or a
|
|
46
|
+
* classifier, which a load cannot do; that stays the caller's refusal.
|
|
47
|
+
*/
|
|
48
|
+
export function nestedCallModeRefusal(
|
|
49
|
+
mode: string | undefined,
|
|
50
|
+
call: { readonly readOnly: boolean; readonly allowedByRule: boolean },
|
|
51
|
+
): string | undefined {
|
|
52
|
+
if (mode === 'plan' && !call.readOnly) {
|
|
53
|
+
return 'plan mode only runs commands that read, and this one can change something'
|
|
54
|
+
}
|
|
55
|
+
if (mode === 'strict' && !call.readOnly && !call.allowedByRule) {
|
|
56
|
+
return 'strict mode only runs what a rule allows by name or pattern, and no rule covers this (a skill’s allowed-tools is not a rule)'
|
|
57
|
+
}
|
|
58
|
+
return undefined
|
|
59
|
+
}
|
|
@@ -226,6 +226,15 @@ export type PluginHookEvent =
|
|
|
226
226
|
* command expanded to. `skip` stops it, and `annotate` adds context.
|
|
227
227
|
*/
|
|
228
228
|
| 'user_prompt_expansion'
|
|
229
|
+
/**
|
|
230
|
+
* A shell command written inside a skill or a custom command is about to run
|
|
231
|
+
* while that text loads (`!`cmd`` or a fenced block opened with three backticks
|
|
232
|
+
* and a bang), after the permission check allowed it and before it starts.
|
|
233
|
+
* Carries `toolName`, `toolInput` (`command`), `toolCallId` (new for each
|
|
234
|
+
* command) and `skillShell`. `skip` refuses that one command, which stays
|
|
235
|
+
* out of the text; `continue` with `halt` stops the whole load.
|
|
236
|
+
*/
|
|
237
|
+
| 'pre_skill_shell_command'
|
|
229
238
|
/**
|
|
230
239
|
* A task is being created (`task_create`), before it is. Carries `task`.
|
|
231
240
|
* `skip` refuses it, and the reason reaches the model.
|
|
@@ -237,6 +246,16 @@ export type PluginHookEvent =
|
|
|
237
246
|
* reason reaches the model.
|
|
238
247
|
*/
|
|
239
248
|
| 'task_completed'
|
|
249
|
+
/**
|
|
250
|
+
* A teammate has finished its turn and is about to go idle. Carries
|
|
251
|
+
* `teammateName` and `teamName`. `skip` keeps it working: the reason is sent
|
|
252
|
+
* to it as feedback (shell exit code 2).
|
|
253
|
+
*/
|
|
254
|
+
| 'teammate_idle'
|
|
255
|
+
/** A teammate was started. Carries `teammateName` and `teamName`. Observational. */
|
|
256
|
+
| 'teammate_start'
|
|
257
|
+
/** A teammate left the team (shut down, stopped or ended). Carries `teammateName` and `teamName`. Observational. */
|
|
258
|
+
| 'teammate_stop'
|
|
240
259
|
| 'pre_llm_call'
|
|
241
260
|
| 'post_llm_call'
|
|
242
261
|
| 'iteration_start'
|
|
@@ -287,8 +306,12 @@ export function assertPluginHookEvent(event: PluginHookEvent): void {
|
|
|
287
306
|
case 'directory_added':
|
|
288
307
|
case 'instructions_loaded':
|
|
289
308
|
case 'user_prompt_expansion':
|
|
309
|
+
case 'pre_skill_shell_command':
|
|
290
310
|
case 'task_created':
|
|
291
311
|
case 'task_completed':
|
|
312
|
+
case 'teammate_idle':
|
|
313
|
+
case 'teammate_start':
|
|
314
|
+
case 'teammate_stop':
|
|
292
315
|
case 'pre_llm_call':
|
|
293
316
|
case 'post_llm_call':
|
|
294
317
|
case 'iteration_start':
|
|
@@ -483,6 +506,22 @@ export interface PluginPromptExpansionInfo {
|
|
|
483
506
|
readonly commandSource?: string
|
|
484
507
|
}
|
|
485
508
|
|
|
509
|
+
/** Who asked for a skill or command to load, on `pre_skill_shell_command`. */
|
|
510
|
+
export type PluginSkillShellInvoker = 'user' | 'model' | 'other'
|
|
511
|
+
|
|
512
|
+
/** What a `pre_skill_shell_command` hook is shown beside the command itself. */
|
|
513
|
+
export interface PluginSkillShellInfo {
|
|
514
|
+
/** The skill or command whose text holds the shell command, without the slash. */
|
|
515
|
+
readonly commandName: string
|
|
516
|
+
/** Where it came from (`user`, `project`, `plugin`, `skill`, `system`), when known. */
|
|
517
|
+
readonly commandSource?: string
|
|
518
|
+
/**
|
|
519
|
+
* `user` for a command the person typed, `model` for the skill tool, `other`
|
|
520
|
+
* for a preload into a sub-agent or anything not known.
|
|
521
|
+
*/
|
|
522
|
+
readonly invokedBy: PluginSkillShellInvoker
|
|
523
|
+
}
|
|
524
|
+
|
|
486
525
|
/** What a task hook is shown. */
|
|
487
526
|
export interface PluginTaskInfo {
|
|
488
527
|
/** Absent on `task_created`: the task has no id yet. */
|
|
@@ -538,8 +577,17 @@ export interface PluginHookContext {
|
|
|
538
577
|
readonly instructions?: PluginInstructionsInfo
|
|
539
578
|
/** The command that expanded, on `user_prompt_expansion`. */
|
|
540
579
|
readonly expansion?: PluginPromptExpansionInfo
|
|
580
|
+
/** The skill or command that holds the shell command, on `pre_skill_shell_command`. */
|
|
581
|
+
readonly skillShell?: PluginSkillShellInfo
|
|
541
582
|
/** The task, on `task_created` and `task_completed`. */
|
|
542
583
|
readonly task?: PluginTaskInfo
|
|
584
|
+
/**
|
|
585
|
+
* The teammate's name, on `teammate_idle`, `teammate_start` and `teammate_stop`, and on
|
|
586
|
+
* `task_created` and `task_completed` when a teammate makes or completes the task.
|
|
587
|
+
*/
|
|
588
|
+
readonly teammateName?: string
|
|
589
|
+
/** The team that teammate belongs to; present wherever `teammateName` is. */
|
|
590
|
+
readonly teamName?: string
|
|
543
591
|
/** The pass, on `pre_compact` and `post_compact`. */
|
|
544
592
|
readonly compaction?: PluginCompactionInfo
|
|
545
593
|
readonly toolName?: string
|
|
@@ -761,46 +809,54 @@ export type PluginHookResultFor<E extends PluginHookEvent> = E extends 'user_pro
|
|
|
761
809
|
? Extract<PluginHookResult, { action: 'continue' | 'annotate' | 'skip' | 'error' }>
|
|
762
810
|
: E extends 'user_prompt_expansion'
|
|
763
811
|
? Extract<PluginHookResult, { action: 'continue' | 'annotate' | 'skip' | 'error' }>
|
|
764
|
-
: E extends
|
|
765
|
-
| 'pre_model_switch'
|
|
766
|
-
| 'elicitation'
|
|
767
|
-
| 'elicitation_result'
|
|
768
|
-
| 'task_created'
|
|
769
|
-
| 'task_completed'
|
|
812
|
+
: E extends 'pre_skill_shell_command'
|
|
770
813
|
? Extract<PluginHookResult, { action: 'continue' | 'skip' | 'error' }>
|
|
771
|
-
: E extends
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
:
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
814
|
+
: E extends
|
|
815
|
+
| 'pre_model_switch'
|
|
816
|
+
| 'elicitation'
|
|
817
|
+
| 'elicitation_result'
|
|
818
|
+
| 'task_created'
|
|
819
|
+
| 'task_completed'
|
|
820
|
+
| 'teammate_idle'
|
|
821
|
+
? Extract<PluginHookResult, { action: 'continue' | 'skip' | 'error' }>
|
|
822
|
+
: E extends 'post_model_switch'
|
|
823
|
+
? Extract<PluginHookResult, { action: 'continue' | 'annotate' | 'error' }>
|
|
824
|
+
: E extends 'directory_added' | 'instructions_loaded'
|
|
825
|
+
? Extract<PluginHookResult, { action: 'continue' }>
|
|
826
|
+
: E extends 'subagent_start'
|
|
827
|
+
? Extract<PluginHookResult, { action: 'continue' | 'annotate' | 'error' }>
|
|
828
|
+
: E extends 'pre_tool_use'
|
|
829
|
+
? Extract<PluginHookResult, { action: 'continue' | 'skip' | 'modify' | 'error' }>
|
|
830
|
+
: E extends 'post_tool_use'
|
|
831
|
+
? Extract<
|
|
832
|
+
PluginHookResult,
|
|
833
|
+
{ action: 'continue' | 'replace' | 'retry' | 'error' }
|
|
834
|
+
>
|
|
835
|
+
: E extends 'post_tool_use_failure'
|
|
836
|
+
? Extract<PluginHookResult, { action: 'continue' | 'error' }>
|
|
837
|
+
: E extends 'permission_request'
|
|
838
|
+
? Extract<PluginHookResult, { action: 'continue' | 'skip' }>
|
|
839
|
+
: E extends 'pre_compact'
|
|
840
|
+
? Extract<
|
|
841
|
+
PluginHookResult,
|
|
842
|
+
{ action: 'continue' | 'annotate' | 'skip' | 'error' }
|
|
843
|
+
>
|
|
844
|
+
: E extends 'turn_end' | 'subagent_stop'
|
|
845
|
+
? Extract<PluginHookResult, { action: 'continue' | 'skip' | 'error' }>
|
|
846
|
+
: E extends 'session_start'
|
|
847
|
+
? Extract<PluginHookResult, { action: 'continue' | 'annotate' }>
|
|
848
|
+
: E extends
|
|
849
|
+
| 'turn_interrupt'
|
|
850
|
+
| 'session_end'
|
|
851
|
+
| 'notification'
|
|
852
|
+
| 'turn_failure'
|
|
853
|
+
| 'permission_denied'
|
|
854
|
+
| 'file_changed'
|
|
855
|
+
| 'cwd_changed'
|
|
856
|
+
| 'teammate_start'
|
|
857
|
+
| 'teammate_stop'
|
|
858
|
+
? Extract<PluginHookResult, { action: 'continue' }>
|
|
859
|
+
: Extract<PluginHookResult, { action: 'continue' | 'error' }>
|
|
804
860
|
|
|
805
861
|
/** The event and its handler verdict stay correlated, including in hook arrays. */
|
|
806
862
|
export type PluginHookDefinition<E extends PluginHookEvent = PluginHookEvent> =
|
|
@@ -36,6 +36,13 @@ export interface LLMProvider {
|
|
|
36
36
|
*/
|
|
37
37
|
supportsImageInputFor?(model: string): boolean
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* A model of this driver that reads images, offered to a person whose own
|
|
41
|
+
* attachment `model` cannot read ("Select 'x'"). Absent, or `undefined`, when
|
|
42
|
+
* the driver has none to name; the refusal then names no model.
|
|
43
|
+
*/
|
|
44
|
+
imageModelFor?(model: string): string | undefined
|
|
45
|
+
|
|
39
46
|
/**
|
|
40
47
|
* Retry behaviour this DRIVER wants, when the generic default is wrong
|
|
41
48
|
* for the vendor behind it.
|
package/src/types/tool/index.ts
CHANGED
|
@@ -189,8 +189,12 @@ export interface SkillHooksPlan {
|
|
|
189
189
|
* belong to one run; a skill whose hooks are switched off).
|
|
190
190
|
*/
|
|
191
191
|
readonly resumable?: boolean
|
|
192
|
-
/**
|
|
193
|
-
|
|
192
|
+
/**
|
|
193
|
+
* Make the hooks live. Idempotent for a skill already attached to the
|
|
194
|
+
* conversation. A forked skill's host may be told the delegated prompt here,
|
|
195
|
+
* when it was not known to {@link SkillRegistryRef.prepareHooks}.
|
|
196
|
+
*/
|
|
197
|
+
attach(late?: { readonly prompt?: string }): SkillHooksHandle
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
/** What {@link SkillHooksPlan.attach} gives back. */
|
|
@@ -626,6 +630,23 @@ export type ToolCallSource =
|
|
|
626
630
|
export interface ToolDispatchOptions {
|
|
627
631
|
readonly signal?: AbortSignal
|
|
628
632
|
readonly runtimeToolCallId?: string
|
|
633
|
+
/**
|
|
634
|
+
* A pre-approval that holds for this one dispatch only. It answers a call no
|
|
635
|
+
* rule decided (the gate said "review" with no rule matched); it never
|
|
636
|
+
* reopens a call a rule denied or sent to review, or the dangerous-command
|
|
637
|
+
* floor stopped, and never covers a call the tool declares needs approval.
|
|
638
|
+
*/
|
|
639
|
+
readonly allow?: (call: { readonly name: string; readonly input: unknown }) => boolean
|
|
640
|
+
/**
|
|
641
|
+
* Asked after the call is allowed and before it starts. Returns `undefined`
|
|
642
|
+
* to let it run, or the reason it is not to run, which comes back as the
|
|
643
|
+
* dispatch's failure with nothing started and no tool event written.
|
|
644
|
+
*/
|
|
645
|
+
readonly beforeRun?: (call: {
|
|
646
|
+
readonly name: string
|
|
647
|
+
readonly input: unknown
|
|
648
|
+
readonly toolUseId: string
|
|
649
|
+
}) => Promise<string | undefined>
|
|
629
650
|
}
|
|
630
651
|
|
|
631
652
|
export interface ToolContext {
|
|
@@ -230,6 +230,8 @@ export type ToolFacts =
|
|
|
230
230
|
}[]
|
|
231
231
|
/** One line saying what they are. */
|
|
232
232
|
readonly caption?: string
|
|
233
|
+
/** The one file is an image the agent made: the prompt it was made from. A host draws the picture itself. */
|
|
234
|
+
readonly generatedImage?: { readonly prompt: string }
|
|
233
235
|
}
|
|
234
236
|
| {
|
|
235
237
|
readonly kind: 'failure'
|