@namzu/sdk 69.0.0 → 69.2.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.
Files changed (316) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/dist/agents/QueryAgent.d.ts.map +1 -1
  3. package/dist/agents/QueryAgent.js +2 -0
  4. package/dist/agents/QueryAgent.js.map +1 -1
  5. package/dist/authorization/skill-grant.d.ts.map +1 -1
  6. package/dist/authorization/skill-grant.js +1 -0
  7. package/dist/authorization/skill-grant.js.map +1 -1
  8. package/dist/bridge/acp/permission.d.ts +10 -0
  9. package/dist/bridge/acp/permission.d.ts.map +1 -1
  10. package/dist/bridge/acp/permission.js.map +1 -1
  11. package/dist/bridge/acp/server.d.ts.map +1 -1
  12. package/dist/bridge/acp/server.js +1 -0
  13. package/dist/bridge/acp/server.js.map +1 -1
  14. package/dist/connector/index.d.ts +2 -2
  15. package/dist/connector/index.d.ts.map +1 -1
  16. package/dist/connector/index.js +1 -1
  17. package/dist/connector/index.js.map +1 -1
  18. package/dist/connector/mcp/client.d.ts +29 -0
  19. package/dist/connector/mcp/client.d.ts.map +1 -1
  20. package/dist/connector/mcp/client.js +59 -2
  21. package/dist/connector/mcp/client.js.map +1 -1
  22. package/dist/connector/mcp/errors.d.ts +7 -0
  23. package/dist/connector/mcp/errors.d.ts.map +1 -1
  24. package/dist/connector/mcp/errors.js +14 -0
  25. package/dist/connector/mcp/errors.js.map +1 -1
  26. package/dist/connector/mcp/index.d.ts +5 -1
  27. package/dist/connector/mcp/index.d.ts.map +1 -1
  28. package/dist/connector/mcp/index.js +3 -1
  29. package/dist/connector/mcp/index.js.map +1 -1
  30. package/dist/connector/mcp/skill-source.d.ts +144 -0
  31. package/dist/connector/mcp/skill-source.d.ts.map +1 -0
  32. package/dist/connector/mcp/skill-source.js +375 -0
  33. package/dist/connector/mcp/skill-source.js.map +1 -0
  34. package/dist/connector/mcp/skills.d.ts +137 -0
  35. package/dist/connector/mcp/skills.d.ts.map +1 -0
  36. package/dist/connector/mcp/skills.js +303 -0
  37. package/dist/connector/mcp/skills.js.map +1 -0
  38. package/dist/network/audit.d.ts +1 -1
  39. package/dist/network/audit.d.ts.map +1 -1
  40. package/dist/network/audit.js +2 -0
  41. package/dist/network/audit.js.map +1 -1
  42. package/dist/network/computer.d.ts +107 -0
  43. package/dist/network/computer.d.ts.map +1 -0
  44. package/dist/network/computer.js +250 -0
  45. package/dist/network/computer.js.map +1 -0
  46. package/dist/network/index.d.ts +2 -0
  47. package/dist/network/index.d.ts.map +1 -1
  48. package/dist/network/index.js +1 -0
  49. package/dist/network/index.js.map +1 -1
  50. package/dist/network/join.d.ts +3 -1
  51. package/dist/network/join.d.ts.map +1 -1
  52. package/dist/network/join.js +6 -3
  53. package/dist/network/join.js.map +1 -1
  54. package/dist/network/roster.d.ts +5 -0
  55. package/dist/network/roster.d.ts.map +1 -1
  56. package/dist/network/roster.js.map +1 -1
  57. package/dist/network/service.d.ts +12 -2
  58. package/dist/network/service.d.ts.map +1 -1
  59. package/dist/network/service.js +377 -52
  60. package/dist/network/service.js.map +1 -1
  61. package/dist/network/store.d.ts +10 -0
  62. package/dist/network/store.d.ts.map +1 -1
  63. package/dist/network/store.js +25 -3
  64. package/dist/network/store.js.map +1 -1
  65. package/dist/network/wire.d.ts +2 -0
  66. package/dist/network/wire.d.ts.map +1 -1
  67. package/dist/network/wire.js +5 -0
  68. package/dist/network/wire.js.map +1 -1
  69. package/dist/persona/assembler.d.ts.map +1 -1
  70. package/dist/persona/assembler.js +7 -1
  71. package/dist/persona/assembler.js.map +1 -1
  72. package/dist/plugin/shell-hook-tool-names.d.ts.map +1 -1
  73. package/dist/plugin/shell-hook-tool-names.js +1 -0
  74. package/dist/plugin/shell-hook-tool-names.js.map +1 -1
  75. package/dist/plugin/shell-hook.d.ts +8 -3
  76. package/dist/plugin/shell-hook.d.ts.map +1 -1
  77. package/dist/plugin/shell-hook.js +132 -7
  78. package/dist/plugin/shell-hook.js.map +1 -1
  79. package/dist/provider/fallback.d.ts.map +1 -1
  80. package/dist/provider/fallback.js +4 -0
  81. package/dist/provider/fallback.js.map +1 -1
  82. package/dist/provider/idle-timeout.d.ts.map +1 -1
  83. package/dist/provider/idle-timeout.js +3 -0
  84. package/dist/provider/idle-timeout.js.map +1 -1
  85. package/dist/provider/model-window-suffix.d.ts.map +1 -1
  86. package/dist/provider/model-window-suffix.js +1 -0
  87. package/dist/provider/model-window-suffix.js.map +1 -1
  88. package/dist/provider/retry.d.ts.map +1 -1
  89. package/dist/provider/retry.js +3 -0
  90. package/dist/provider/retry.js.map +1 -1
  91. package/dist/public-runtime.d.ts +9 -6
  92. package/dist/public-runtime.d.ts.map +1 -1
  93. package/dist/public-runtime.js +11 -4
  94. package/dist/public-runtime.js.map +1 -1
  95. package/dist/public-tools.d.ts +7 -4
  96. package/dist/public-tools.d.ts.map +1 -1
  97. package/dist/public-tools.js +9 -3
  98. package/dist/public-tools.js.map +1 -1
  99. package/dist/public-types.d.ts +3 -1
  100. package/dist/public-types.d.ts.map +1 -1
  101. package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
  102. package/dist/runtime/query/executor/tool-call-admission.js +10 -1
  103. package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
  104. package/dist/runtime/query/executor.d.ts +12 -0
  105. package/dist/runtime/query/executor.d.ts.map +1 -1
  106. package/dist/runtime/query/executor.js +43 -9
  107. package/dist/runtime/query/executor.js.map +1 -1
  108. package/dist/runtime/query/index.d.ts +4 -0
  109. package/dist/runtime/query/index.d.ts.map +1 -1
  110. package/dist/runtime/query/index.js +32 -0
  111. package/dist/runtime/query/index.js.map +1 -1
  112. package/dist/runtime/query/review-policy.d.ts +2 -2
  113. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  114. package/dist/runtime/query/review-policy.js +2 -2
  115. package/dist/runtime/query/review-policy.js.map +1 -1
  116. package/dist/runtime/query/shell-line-escalation.d.ts +24 -0
  117. package/dist/runtime/query/shell-line-escalation.d.ts.map +1 -0
  118. package/dist/runtime/query/shell-line-escalation.js +38 -0
  119. package/dist/runtime/query/shell-line-escalation.js.map +1 -0
  120. package/dist/runtime/query/tooling.d.ts +7 -0
  121. package/dist/runtime/query/tooling.d.ts.map +1 -1
  122. package/dist/runtime/query/tooling.js +2 -0
  123. package/dist/runtime/query/tooling.js.map +1 -1
  124. package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
  125. package/dist/runtime/query/turn/outcome-ledger.js +11 -0
  126. package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
  127. package/dist/scheduler/local.d.ts.map +1 -1
  128. package/dist/scheduler/local.js +3 -1
  129. package/dist/scheduler/local.js.map +1 -1
  130. package/dist/skills/index.d.ts +4 -0
  131. package/dist/skills/index.d.ts.map +1 -1
  132. package/dist/skills/index.js +2 -0
  133. package/dist/skills/index.js.map +1 -1
  134. package/dist/skills/inline-shell-host.d.ts +103 -0
  135. package/dist/skills/inline-shell-host.d.ts.map +1 -0
  136. package/dist/skills/inline-shell-host.js +238 -0
  137. package/dist/skills/inline-shell-host.js.map +1 -0
  138. package/dist/skills/inline-shell.d.ts +176 -0
  139. package/dist/skills/inline-shell.d.ts.map +1 -0
  140. package/dist/skills/inline-shell.js +646 -0
  141. package/dist/skills/inline-shell.js.map +1 -0
  142. package/dist/store/index.d.ts +2 -0
  143. package/dist/store/index.d.ts.map +1 -1
  144. package/dist/store/index.js +1 -0
  145. package/dist/store/index.js.map +1 -1
  146. package/dist/store/task/file.d.ts +124 -0
  147. package/dist/store/task/file.d.ts.map +1 -0
  148. package/dist/store/task/file.js +498 -0
  149. package/dist/store/task/file.js.map +1 -0
  150. package/dist/teams/backend.d.ts +28 -0
  151. package/dist/teams/backend.d.ts.map +1 -0
  152. package/dist/teams/backend.js +2 -0
  153. package/dist/teams/backend.js.map +1 -0
  154. package/dist/teams/fs-sync.d.ts +19 -0
  155. package/dist/teams/fs-sync.d.ts.map +1 -0
  156. package/dist/teams/fs-sync.js +81 -0
  157. package/dist/teams/fs-sync.js.map +1 -0
  158. package/dist/teams/index.d.ts +14 -0
  159. package/dist/teams/index.d.ts.map +1 -0
  160. package/dist/teams/index.js +11 -0
  161. package/dist/teams/index.js.map +1 -0
  162. package/dist/teams/names.d.ts +15 -0
  163. package/dist/teams/names.d.ts.map +1 -0
  164. package/dist/teams/names.js +43 -0
  165. package/dist/teams/names.js.map +1 -0
  166. package/dist/teams/store.d.ts +133 -0
  167. package/dist/teams/store.d.ts.map +1 -0
  168. package/dist/teams/store.js +536 -0
  169. package/dist/teams/store.js.map +1 -0
  170. package/dist/teams/types.d.ts +97 -0
  171. package/dist/teams/types.d.ts.map +1 -0
  172. package/dist/teams/types.js +70 -0
  173. package/dist/teams/types.js.map +1 -0
  174. package/dist/tools/admit-facts.d.ts.map +1 -1
  175. package/dist/tools/admit-facts.js +9 -1
  176. package/dist/tools/admit-facts.js.map +1 -1
  177. package/dist/tools/builtins/atomic-write-file.d.ts +19 -3
  178. package/dist/tools/builtins/atomic-write-file.d.ts.map +1 -1
  179. package/dist/tools/builtins/atomic-write-file.js +56 -3
  180. package/dist/tools/builtins/atomic-write-file.js.map +1 -1
  181. package/dist/tools/builtins/computer-use.d.ts +56 -2
  182. package/dist/tools/builtins/computer-use.d.ts.map +1 -1
  183. package/dist/tools/builtins/computer-use.js +604 -90
  184. package/dist/tools/builtins/computer-use.js.map +1 -1
  185. package/dist/tools/builtins/index.d.ts +1 -1
  186. package/dist/tools/builtins/index.d.ts.map +1 -1
  187. package/dist/tools/builtins/index.js.map +1 -1
  188. package/dist/tools/builtins/skill.d.ts +31 -0
  189. package/dist/tools/builtins/skill.d.ts.map +1 -1
  190. package/dist/tools/builtins/skill.js +232 -88
  191. package/dist/tools/builtins/skill.js.map +1 -1
  192. package/dist/tools/task/create.d.ts.map +1 -1
  193. package/dist/tools/task/create.js +11 -2
  194. package/dist/tools/task/create.js.map +1 -1
  195. package/dist/tools/task/get.d.ts +8 -0
  196. package/dist/tools/task/get.d.ts.map +1 -0
  197. package/dist/tools/task/get.js +51 -0
  198. package/dist/tools/task/get.js.map +1 -0
  199. package/dist/tools/task/index.d.ts +7 -0
  200. package/dist/tools/task/index.d.ts.map +1 -1
  201. package/dist/tools/task/index.js +10 -2
  202. package/dist/tools/task/index.js.map +1 -1
  203. package/dist/tools/task/list.d.ts.map +1 -1
  204. package/dist/tools/task/list.js +10 -2
  205. package/dist/tools/task/list.js.map +1 -1
  206. package/dist/tools/task/number.d.ts +13 -0
  207. package/dist/tools/task/number.d.ts.map +1 -0
  208. package/dist/tools/task/number.js +30 -0
  209. package/dist/tools/task/number.js.map +1 -0
  210. package/dist/tools/task/present.d.ts.map +1 -1
  211. package/dist/tools/task/present.js +17 -3
  212. package/dist/tools/task/present.js.map +1 -1
  213. package/dist/tools/task/update.d.ts +2 -1
  214. package/dist/tools/task/update.d.ts.map +1 -1
  215. package/dist/tools/task/update.js +86 -19
  216. package/dist/tools/task/update.js.map +1 -1
  217. package/dist/types/acp/index.d.ts +10 -0
  218. package/dist/types/acp/index.d.ts.map +1 -1
  219. package/dist/types/agent/base.d.ts +4 -0
  220. package/dist/types/agent/base.d.ts.map +1 -1
  221. package/dist/types/agent/scheduler.d.ts +9 -0
  222. package/dist/types/agent/scheduler.d.ts.map +1 -1
  223. package/dist/types/computer-use/index.d.ts +7 -0
  224. package/dist/types/computer-use/index.d.ts.map +1 -1
  225. package/dist/types/computer-use/index.js.map +1 -1
  226. package/dist/types/connector/mcp.d.ts +10 -0
  227. package/dist/types/connector/mcp.d.ts.map +1 -1
  228. package/dist/types/permission/index.d.ts +20 -0
  229. package/dist/types/permission/index.d.ts.map +1 -1
  230. package/dist/types/permission/index.js +25 -0
  231. package/dist/types/permission/index.js.map +1 -1
  232. package/dist/types/plugin/index.d.ts +47 -3
  233. package/dist/types/plugin/index.d.ts.map +1 -1
  234. package/dist/types/plugin/index.js +4 -0
  235. package/dist/types/plugin/index.js.map +1 -1
  236. package/dist/types/provider/interface.d.ts +6 -0
  237. package/dist/types/provider/interface.d.ts.map +1 -1
  238. package/dist/types/skills/index.d.ts +7 -0
  239. package/dist/types/skills/index.d.ts.map +1 -1
  240. package/dist/types/skills/index.js.map +1 -1
  241. package/dist/types/tool/index.d.ts +28 -2
  242. package/dist/types/tool/index.d.ts.map +1 -1
  243. package/dist/types/tool/index.js.map +1 -1
  244. package/dist/types/tool/presentation.d.ts +4 -0
  245. package/dist/types/tool/presentation.d.ts.map +1 -1
  246. package/package.json +1 -1
  247. package/src/agents/QueryAgent.ts +2 -0
  248. package/src/authorization/skill-grant.ts +1 -0
  249. package/src/bridge/acp/permission.ts +11 -1
  250. package/src/bridge/acp/server.ts +1 -0
  251. package/src/connector/index.ts +27 -0
  252. package/src/connector/mcp/client.ts +71 -2
  253. package/src/connector/mcp/errors.ts +14 -0
  254. package/src/connector/mcp/index.ts +36 -0
  255. package/src/connector/mcp/skill-source.ts +499 -0
  256. package/src/connector/mcp/skills.ts +367 -0
  257. package/src/network/audit.ts +2 -0
  258. package/src/network/computer.ts +347 -0
  259. package/src/network/index.ts +20 -0
  260. package/src/network/join.ts +4 -2
  261. package/src/network/roster.ts +5 -0
  262. package/src/network/service.ts +492 -75
  263. package/src/network/store.ts +29 -3
  264. package/src/network/wire.ts +5 -0
  265. package/src/persona/assembler.ts +7 -1
  266. package/src/plugin/shell-hook-tool-names.ts +1 -0
  267. package/src/plugin/shell-hook.ts +144 -7
  268. package/src/provider/fallback.ts +4 -0
  269. package/src/provider/idle-timeout.ts +3 -0
  270. package/src/provider/model-window-suffix.ts +1 -0
  271. package/src/provider/retry.ts +3 -0
  272. package/src/public-runtime.ts +99 -0
  273. package/src/public-tools.ts +15 -0
  274. package/src/public-types.ts +28 -0
  275. package/src/runtime/query/executor/tool-call-admission.ts +10 -1
  276. package/src/runtime/query/executor.ts +57 -8
  277. package/src/runtime/query/index.ts +43 -0
  278. package/src/runtime/query/review-policy.ts +7 -1
  279. package/src/runtime/query/shell-line-escalation.ts +49 -0
  280. package/src/runtime/query/tooling.ts +6 -0
  281. package/src/runtime/query/turn/outcome-ledger.ts +11 -0
  282. package/src/scheduler/local.ts +3 -1
  283. package/src/skills/index.ts +43 -0
  284. package/src/skills/inline-shell-host.ts +303 -0
  285. package/src/skills/inline-shell.ts +765 -0
  286. package/src/store/index.ts +8 -0
  287. package/src/store/task/file.ts +641 -0
  288. package/src/teams/backend.ts +29 -0
  289. package/src/teams/fs-sync.ts +91 -0
  290. package/src/teams/index.ts +47 -0
  291. package/src/teams/names.ts +49 -0
  292. package/src/teams/store.ts +607 -0
  293. package/src/teams/types.ts +102 -0
  294. package/src/tools/admit-facts.ts +9 -1
  295. package/src/tools/builtins/atomic-write-file.ts +73 -5
  296. package/src/tools/builtins/computer-use.ts +689 -95
  297. package/src/tools/builtins/index.ts +1 -0
  298. package/src/tools/builtins/skill.ts +291 -95
  299. package/src/tools/task/create.ts +11 -2
  300. package/src/tools/task/get.ts +53 -0
  301. package/src/tools/task/index.ts +14 -2
  302. package/src/tools/task/list.ts +10 -2
  303. package/src/tools/task/number.ts +32 -0
  304. package/src/tools/task/present.ts +18 -3
  305. package/src/tools/task/update.ts +93 -19
  306. package/src/types/acp/index.ts +11 -1
  307. package/src/types/agent/base.ts +6 -0
  308. package/src/types/agent/scheduler.ts +9 -0
  309. package/src/types/computer-use/index.ts +7 -0
  310. package/src/types/connector/mcp.ts +10 -0
  311. package/src/types/permission/index.ts +29 -0
  312. package/src/types/plugin/index.ts +95 -39
  313. package/src/types/provider/interface.ts +7 -0
  314. package/src/types/skills/index.ts +8 -0
  315. package/src/types/tool/index.ts +23 -2
  316. 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
- /** A successful receipt: the call row already said it. */
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
- return HIDDEN_RESULT
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
- return HIDDEN_RESULT
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 {
@@ -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(taskStore: TaskStore): ToolDefinition {
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 ${id} deleted` : `Task ${id} not found`,
69
+ output: deleted ? `Task ${named} deleted` : `Task ${named} not found`,
61
70
  }
62
71
  }
63
72
 
64
- if (addBlocks) {
65
- for (const blockedId of addBlocks) {
66
- await taskStore.block(taskId, asTaskId(blockedId))
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
- if (addBlockedBy) {
70
- for (const blockerId of addBlockedBy) {
71
- await taskStore.block(asTaskId(blockerId), taskId)
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
- const updated = await taskStore.update(taskId, {
76
- subject,
77
- description,
78
- activeForm,
79
- status,
80
- owner,
81
- metadata,
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 ${id} not found` }
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 ${id} updated — status: ${updated.status}`
96
- : `Task ${id} 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.`,
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,
@@ -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?: { readonly app?: string; readonly consequence?: string }
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
 
@@ -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 'post_model_switch'
772
- ? Extract<PluginHookResult, { action: 'continue' | 'annotate' | 'error' }>
773
- : E extends 'directory_added' | 'instructions_loaded'
774
- ? Extract<PluginHookResult, { action: 'continue' }>
775
- : E extends 'subagent_start'
776
- ? Extract<PluginHookResult, { action: 'continue' | 'annotate' | 'error' }>
777
- : E extends 'pre_tool_use'
778
- ? Extract<PluginHookResult, { action: 'continue' | 'skip' | 'modify' | 'error' }>
779
- : E extends 'post_tool_use'
780
- ? Extract<PluginHookResult, { action: 'continue' | 'replace' | 'retry' | 'error' }>
781
- : E extends 'post_tool_use_failure'
782
- ? Extract<PluginHookResult, { action: 'continue' | 'error' }>
783
- : E extends 'permission_request'
784
- ? Extract<PluginHookResult, { action: 'continue' | 'skip' }>
785
- : E extends 'pre_compact'
786
- ? Extract<
787
- PluginHookResult,
788
- { action: 'continue' | 'annotate' | 'skip' | 'error' }
789
- >
790
- : E extends 'turn_end' | 'subagent_stop'
791
- ? Extract<PluginHookResult, { action: 'continue' | 'skip' | 'error' }>
792
- : E extends 'session_start'
793
- ? Extract<PluginHookResult, { action: 'continue' | 'annotate' }>
794
- : E extends
795
- | 'turn_interrupt'
796
- | 'session_end'
797
- | 'notification'
798
- | 'turn_failure'
799
- | 'permission_denied'
800
- | 'file_changed'
801
- | 'cwd_changed'
802
- ? Extract<PluginHookResult, { action: 'continue' }>
803
- : Extract<PluginHookResult, { action: 'continue' | 'error' }>
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.
@@ -38,6 +38,14 @@ export interface SkillMetadata {
38
38
  */
39
39
  invocation?: SkillInvocation
40
40
 
41
+ /**
42
+ * How much of the skill the prompt's manifest lists. `name-only` lists the
43
+ * name and where the skill lives but leaves its description out, so the
44
+ * skill costs a few tokens a turn and the model still can load it by name.
45
+ * Absent means the whole entry. A host sets this; a `SKILL.md` does not.
46
+ */
47
+ listing?: 'full' | 'name-only'
48
+
41
49
  metadata?: Record<string, string>
42
50
 
43
51
  /**
@@ -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
- /** Make the hooks live. Idempotent for a skill already attached to the conversation. */
193
- attach(): SkillHooksHandle
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'