@songsid/agend 2.4.0-beta.22 → 2.4.0-beta.24

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 (284) hide show
  1. package/dist/agent-cli-instructions.md +4 -3
  2. package/dist/agent-cli.js +32 -2
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/agent-file-read.js +2 -2
  5. package/dist/agent-file-read.js.map +1 -1
  6. package/dist/agent-whats-new.js +17 -1
  7. package/dist/agent-whats-new.js.map +1 -1
  8. package/dist/auth-api.d.ts +2 -0
  9. package/dist/auth-api.js +5 -2
  10. package/dist/auth-api.js.map +1 -1
  11. package/dist/authority/web-authority.d.ts +17 -3
  12. package/dist/authority/web-authority.js +56 -3
  13. package/dist/authority/web-authority.js.map +1 -1
  14. package/dist/backend/claude-code.d.ts +15 -0
  15. package/dist/backend/claude-code.js +8 -3
  16. package/dist/backend/claude-code.js.map +1 -1
  17. package/dist/backend/claude-mcp-carry.d.ts +63 -0
  18. package/dist/backend/claude-mcp-carry.js +242 -0
  19. package/dist/backend/claude-mcp-carry.js.map +1 -0
  20. package/dist/build-provenance.json +1 -1
  21. package/dist/channel/mcp-tools.js +15 -7
  22. package/dist/channel/mcp-tools.js.map +1 -1
  23. package/dist/classic-channel-manager.d.ts +1 -1
  24. package/dist/classic-channel-manager.js +2 -2
  25. package/dist/classic-channel-manager.js.map +1 -1
  26. package/dist/config-validator.js +6 -0
  27. package/dist/config-validator.js.map +1 -1
  28. package/dist/contact-auth-api.js +3 -1
  29. package/dist/contact-auth-api.js.map +1 -1
  30. package/dist/contact-auth-service.js +1 -1
  31. package/dist/contact-auth-service.js.map +1 -1
  32. package/dist/contact-auth-store.d.ts +28 -2
  33. package/dist/contact-auth-store.js +72 -4
  34. package/dist/contact-auth-store.js.map +1 -1
  35. package/dist/contact-change-proposals.d.ts +18 -1
  36. package/dist/contact-change-proposals.js +38 -4
  37. package/dist/contact-change-proposals.js.map +1 -1
  38. package/dist/contact-state-view.d.ts +103 -0
  39. package/dist/contact-state-view.js +80 -0
  40. package/dist/contact-state-view.js.map +1 -0
  41. package/dist/daemon.d.ts +11 -0
  42. package/dist/daemon.js +66 -15
  43. package/dist/daemon.js.map +1 -1
  44. package/dist/dashboard-permissions.d.ts +8 -0
  45. package/dist/dashboard-permissions.js +8 -0
  46. package/dist/dashboard-permissions.js.map +1 -1
  47. package/dist/delivery-outbox.d.ts +15 -1
  48. package/dist/delivery-outbox.js +60 -2
  49. package/dist/delivery-outbox.js.map +1 -1
  50. package/dist/fleet-manager.d.ts +157 -15
  51. package/dist/fleet-manager.js +522 -78
  52. package/dist/fleet-manager.js.map +1 -1
  53. package/dist/general-knowledge/skills/admin/SKILL.md +52 -0
  54. package/dist/general-knowledge/skills/concepts/SKILL.md +31 -21
  55. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +6 -0
  56. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +6 -3
  57. package/dist/general-knowledge/skills/fleet-config/SKILL.md +3 -3
  58. package/dist/general-knowledge/skills/hub/SKILL.md +6 -1
  59. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -1
  60. package/dist/general-knowledge/skills/task-board/SKILL.md +17 -0
  61. package/dist/general-knowledge/skills/web-appearance/SKILL.md +4 -0
  62. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +75 -12
  63. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
  64. package/dist/general-role.d.ts +1 -1
  65. package/dist/general-role.js +1 -0
  66. package/dist/general-role.js.map +1 -1
  67. package/dist/hub/client.js +6 -1
  68. package/dist/hub/client.js.map +1 -1
  69. package/dist/hub/compose/member.d.ts +2 -1
  70. package/dist/hub/compose/member.js +3 -2
  71. package/dist/hub/compose/member.js.map +1 -1
  72. package/dist/hub/compose/server.js +2 -1
  73. package/dist/hub/compose/server.js.map +1 -1
  74. package/dist/hub/http/compose.js +5 -0
  75. package/dist/hub/http/compose.js.map +1 -1
  76. package/dist/hub/protocol.d.ts +21 -0
  77. package/dist/hub/protocol.js +3 -0
  78. package/dist/hub/protocol.js.map +1 -1
  79. package/dist/hub/question-close-model.d.ts +17 -0
  80. package/dist/hub/question-close-model.js +7 -0
  81. package/dist/hub/question-close-model.js.map +1 -0
  82. package/dist/hub/representative.d.ts +5 -0
  83. package/dist/hub/representative.js +51 -1
  84. package/dist/hub/representative.js.map +1 -1
  85. package/dist/hub/rooms/direct-view.js +1 -0
  86. package/dist/hub/rooms/direct-view.js.map +1 -1
  87. package/dist/hub/rooms/types.d.ts +1 -1
  88. package/dist/hub/rooms.d.ts +3 -0
  89. package/dist/hub/rooms.js +27 -1
  90. package/dist/hub/rooms.js.map +1 -1
  91. package/dist/hub/server.js +6 -1
  92. package/dist/hub/server.js.map +1 -1
  93. package/dist/hub/types.d.ts +2 -2
  94. package/dist/human-delivery-receipts.d.ts +12 -2
  95. package/dist/human-delivery-receipts.js +19 -4
  96. package/dist/human-delivery-receipts.js.map +1 -1
  97. package/dist/instance-lifecycle.d.ts +2 -0
  98. package/dist/instance-lifecycle.js +29 -1
  99. package/dist/instance-lifecycle.js.map +1 -1
  100. package/dist/instructions.d.ts +1 -1
  101. package/dist/instructions.js +1 -1
  102. package/dist/instructions.js.map +1 -1
  103. package/dist/locale.js +110 -12
  104. package/dist/locale.js.map +1 -1
  105. package/dist/needs-you-hub.d.ts +3 -0
  106. package/dist/needs-you-hub.js +31 -5
  107. package/dist/needs-you-hub.js.map +1 -1
  108. package/dist/needs-you.d.ts +16 -1
  109. package/dist/needs-you.js +7 -1
  110. package/dist/needs-you.js.map +1 -1
  111. package/dist/office-share-page.js +2 -2
  112. package/dist/office-share-page.js.map +1 -1
  113. package/dist/office-share.js +2 -1
  114. package/dist/office-share.js.map +1 -1
  115. package/dist/outbound-handlers.d.ts +4 -0
  116. package/dist/outbound-handlers.js +69 -11
  117. package/dist/outbound-handlers.js.map +1 -1
  118. package/dist/outbound-schemas.d.ts +5 -1
  119. package/dist/outbound-schemas.js +10 -7
  120. package/dist/outbound-schemas.js.map +1 -1
  121. package/dist/public-web-gateway.js +21 -0
  122. package/dist/public-web-gateway.js.map +1 -1
  123. package/dist/reply-buttons-controller.d.ts +2 -1
  124. package/dist/reply-buttons-controller.js +1 -1
  125. package/dist/reply-buttons-controller.js.map +1 -1
  126. package/dist/request-context-compatibility.d.ts +20 -0
  127. package/dist/request-context-compatibility.js +74 -0
  128. package/dist/request-context-compatibility.js.map +1 -0
  129. package/dist/request-context-protocol.d.ts +137 -0
  130. package/dist/request-context-protocol.js +38 -0
  131. package/dist/request-context-protocol.js.map +1 -0
  132. package/dist/request-context-store.d.ts +25 -0
  133. package/dist/request-context-store.js +137 -0
  134. package/dist/request-context-store.js.map +1 -0
  135. package/dist/scheduler/db.js +26 -0
  136. package/dist/scheduler/db.js.map +1 -1
  137. package/dist/scheduler/task-board-text.d.ts +2 -0
  138. package/dist/scheduler/task-board-text.js +12 -0
  139. package/dist/scheduler/task-board-text.js.map +1 -1
  140. package/dist/scheduler/task-board.d.ts +102 -2
  141. package/dist/scheduler/task-board.js +242 -24
  142. package/dist/scheduler/task-board.js.map +1 -1
  143. package/dist/scheduler/task-files.d.ts +80 -0
  144. package/dist/scheduler/task-files.js +357 -0
  145. package/dist/scheduler/task-files.js.map +1 -0
  146. package/dist/settings-api.d.ts +2 -0
  147. package/dist/settings-api.js +6 -1
  148. package/dist/settings-api.js.map +1 -1
  149. package/dist/settings-baseline.d.ts +1 -0
  150. package/dist/settings-baseline.js +1 -1
  151. package/dist/settings-baseline.js.map +1 -1
  152. package/dist/settings-effect.d.ts +2 -0
  153. package/dist/settings-effect.js +5 -1
  154. package/dist/settings-effect.js.map +1 -1
  155. package/dist/task-attach-client.d.ts +43 -0
  156. package/dist/task-attach-client.js +125 -0
  157. package/dist/task-attach-client.js.map +1 -0
  158. package/dist/task-board-tool.d.ts +12 -0
  159. package/dist/task-board-tool.js +107 -6
  160. package/dist/task-board-tool.js.map +1 -1
  161. package/dist/task-file-limits.d.ts +15 -0
  162. package/dist/task-file-limits.js +21 -0
  163. package/dist/task-file-limits.js.map +1 -0
  164. package/dist/tool-permissions.d.ts +32 -0
  165. package/dist/tool-permissions.js +64 -1
  166. package/dist/tool-permissions.js.map +1 -1
  167. package/dist/types.d.ts +6 -0
  168. package/dist/ui/accounts-keepalive.js +2 -1
  169. package/dist/ui/agent-details-settings.js +7 -5
  170. package/dist/ui/agent-who-can-use-strings.js +125 -0
  171. package/dist/ui/agent-who-can-use.js +238 -0
  172. package/dist/ui/chat-activity.js +2 -1
  173. package/dist/ui/chat-pins.js +2 -1
  174. package/dist/ui/claude-credentials.js +2 -1
  175. package/dist/ui/contact-auth-strings.js +28 -17
  176. package/dist/ui/contact-authorizations.js +6 -4
  177. package/dist/ui/contact-needs.js +6 -1
  178. package/dist/ui/contact-permissions.js +6 -4
  179. package/dist/ui/contact-tool-groups.js +1 -1
  180. package/dist/ui/contact-verify-need.js +46 -0
  181. package/dist/ui/fleet-cache.js +2 -1
  182. package/dist/ui/fleet-office-card.js +23 -5
  183. package/dist/ui/fleet-office-editor.js +5 -5
  184. package/dist/ui/fleet-office-pack.d.ts +10 -0
  185. package/dist/ui/fleet-office-pack.js +65 -2
  186. package/dist/ui/fleet-office-skin.js +52 -14
  187. package/dist/ui/fleet-office-store.js +33 -2
  188. package/dist/ui/fleet-office-vehicles.js +130 -0
  189. package/dist/ui/fleet-office-zones.js +27 -10
  190. package/dist/ui/fleet-office.js +128 -40
  191. package/dist/ui/fleet-org.js +6 -1
  192. package/dist/ui/fleet-tab-icons.js +19 -0
  193. package/dist/ui/fleet-task-activity.js +11 -83
  194. package/dist/ui/fleet-task-archive.js +111 -0
  195. package/dist/ui/fleet-task-card.js +6 -4
  196. package/dist/ui/fleet-task-common.js +2 -2
  197. package/dist/ui/fleet-task-edit.js +8 -1
  198. package/dist/ui/fleet-task-files.js +196 -0
  199. package/dist/ui/fleet-task-md.js +98 -0
  200. package/dist/ui/fleet-task-menu.js +1 -1
  201. package/dist/ui/fleet-task-stats.js +2 -2
  202. package/dist/ui/fleet-task-view.js +14 -9
  203. package/dist/ui/fleet-tasks.js +42 -18
  204. package/dist/ui/fleet-usage.js +2 -1
  205. package/dist/ui/hub-admin-overview.js +2 -1
  206. package/dist/ui/hub-agent-intro.js +2 -1
  207. package/dist/ui/hub-assistant-admin.js +2 -1
  208. package/dist/ui/hub-directory-notices.js +2 -1
  209. package/dist/ui/hub-enrolment-code.js +2 -1
  210. package/dist/ui/hub-my-agents.js +2 -1
  211. package/dist/ui/hub-quick-pairing.js +2 -1
  212. package/dist/ui/hub-role-audit.js +2 -1
  213. package/dist/ui/hub-role-forms.js +3 -2
  214. package/dist/ui/hub-role-view.js +3 -2
  215. package/dist/ui/hub-roles.js +2 -1
  216. package/dist/ui/hub-room-agent-strings.js +2 -1
  217. package/dist/ui/hub-room-list.js +2 -1
  218. package/dist/ui/hub-room-owner-requests.js +2 -1
  219. package/dist/ui/hub-room-pins.js +2 -1
  220. package/dist/ui/hub-room-strings.js +2 -2
  221. package/dist/ui/hub-room-thread.js +1 -1
  222. package/dist/ui/log-row.js +4 -3
  223. package/dist/ui/office-share-dialog.js +2 -1
  224. package/dist/ui/office-share-page.js +2 -1
  225. package/dist/ui/page-share-dialog.js +3 -2
  226. package/dist/ui/panel-chat.js +2 -1
  227. package/dist/ui/panel-details.js +5 -2
  228. package/dist/ui/panel-fleet.js +10 -5
  229. package/dist/ui/panel-hub.js +2 -1
  230. package/dist/ui/panel-needs.js +34 -6
  231. package/dist/ui/panel-notices.js +2 -1
  232. package/dist/ui/panel-runtimes.js +2 -1
  233. package/dist/ui/panel-settings.js +15 -1
  234. package/dist/ui/panel-windows-cli.js +3 -2
  235. package/dist/ui/runtime-cli-install.js +2 -1
  236. package/dist/ui/settings-appearance.js +2 -1
  237. package/dist/ui/settings-guests.js +4 -3
  238. package/dist/ui/settings-hub-member-address.js +2 -1
  239. package/dist/ui/settings-hub-setup.js +2 -1
  240. package/dist/ui/settings-hub-web-address.js +2 -1
  241. package/dist/ui/settings-hub.js +2 -1
  242. package/dist/ui/settings-registry.js +1 -0
  243. package/dist/ui/settings-shared-strings.js +9 -0
  244. package/dist/ui/settings-shared.js +6 -1
  245. package/dist/ui/settings-update.js +2 -1
  246. package/dist/ui/settings-web-authority.js +2 -1
  247. package/dist/ui/shared/agent-sheet.js +2 -1
  248. package/dist/ui/shared/app-i18n.js +2 -2
  249. package/dist/ui/shared/app-needs.js +8 -1
  250. package/dist/ui/shared/app-session.js +4 -3
  251. package/dist/ui/shared/app-shell.js +6 -2
  252. package/dist/ui/shared/app.css +93 -11
  253. package/dist/ui/shared/chat-strings.js +4 -4
  254. package/dist/ui/shared/chat-time.js +7 -4
  255. package/dist/ui/shared/clock-text.js +57 -0
  256. package/dist/ui/shared/device-roles.js +6 -5
  257. package/dist/ui/shared/instance-nav.js +17 -22
  258. package/dist/ui/shared/task-board.css +64 -0
  259. package/dist/ui/shared/usage-dialog.js +2 -1
  260. package/dist/ui/shared/view-strings.js +0 -14
  261. package/dist/ui/shared/web-authorize.js +3 -2
  262. package/dist/ui/subagent-row.js +2 -1
  263. package/dist/web-api.d.ts +18 -2
  264. package/dist/web-api.js +159 -27
  265. package/dist/web-api.js.map +1 -1
  266. package/dist/web-login.d.ts +6 -1
  267. package/dist/web-login.js +8 -3
  268. package/dist/web-login.js.map +1 -1
  269. package/dist/web-office-acts.d.ts +16 -0
  270. package/dist/web-office-acts.js +27 -9
  271. package/dist/web-office-acts.js.map +1 -1
  272. package/dist/web-office-pack-read.js +1 -1
  273. package/dist/web-office-pack-read.js.map +1 -1
  274. package/dist/web-office-skins.d.ts +5 -3
  275. package/dist/web-office-skins.js +20 -16
  276. package/dist/web-office-skins.js.map +1 -1
  277. package/dist/web-session-authorization.d.ts +3 -0
  278. package/dist/web-session-authorization.js +1 -1
  279. package/dist/web-session-authorization.js.map +1 -1
  280. package/dist/web-settings-patch.d.ts +27 -0
  281. package/dist/web-settings-patch.js +67 -0
  282. package/dist/web-settings-patch.js.map +1 -1
  283. package/dist/workflow-templates/default.md +1 -0
  284. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { ProposeContactChangeArgs } from "./contact-change-proposals.js";
1
+ import { ProposeContactChangeArgs, ContactStateArgs, contactProposalRefusal } from "./contact-change-proposals.js";
2
2
  import { compactDeliveryStatus, compactSendAck } from "./tool-receipt-output.js";
3
3
  import { ContactHeldError } from "./contact-auth-service.js";
4
4
  import { KNOWN_BACKENDS, validateFleetConfig } from "./config-validator.js";
@@ -8,6 +8,7 @@ import { randomUUID } from "node:crypto";
8
8
  import { isWindowsInstance, WINDOWS_CONFIG_REFUSED, WINDOWS_CREATE_REFUSED } from "./native-instance-registry.js";
9
9
  import { deliveryContentDigest, deliveryStatusSelector } from "./delivery-outbox.js";
10
10
  import { GENERAL_PAUSE_ERROR, isGeneralInstance } from "./general-instance.js";
11
+ import { resolveToolSet, toolSetGrantRefusal } from "./tool-permissions.js";
11
12
  import { DEFAULT_MAX_CROSS_INSTANCE_MESSAGE_BYTES, DEFAULT_LIST_INSTANCES_OUTPUT_BUDGET, MAX_INSTANCE_LOG_LINES, getEffectiveInstanceDefaults } from "./config.js";
12
13
  import { t } from "./locale.js";
13
14
  import { presentationState, interactionSummary } from "./interaction-observation.js";
@@ -1013,9 +1014,10 @@ const kiroEngineStatusHandler = (ctx, rawArgs, respond) => {
1013
1014
  };
1014
1015
  /** General proposes; only the system platform callback can confirm. */
1015
1016
  const proposeContactChange = async (ctx, raw, respond, meta) => {
1016
- const parsed = validateArgs(ProposeContactChangeArgs, raw, "propose_contact_change");
1017
- if (!parsed.ok) {
1018
- respond(null, parsed.error);
1017
+ // Prism #4436 P3: field errors get the same localized sentence and next step as every other refusal.
1018
+ const parsed = ProposeContactChangeArgs.safeParse(raw);
1019
+ if (!parsed.success) {
1020
+ respond(null, contactProposalRefusal(parsed.error));
1019
1021
  return;
1020
1022
  }
1021
1023
  if (!meta?.instanceName || ctx.fleetConfig?.instances[meta.instanceName]?.general_topic !== true || !meta.callerCurrent?.()) {
@@ -1030,7 +1032,29 @@ const proposeContactChange = async (ctx, raw, respond, meta) => {
1030
1032
  respond(await ctx.requestContactChange(meta.instanceName, parsed.data.change, meta.callerCurrent));
1031
1033
  }
1032
1034
  catch (error) {
1033
- respond(null, `Contact proposal not applied: ${error.message}`);
1035
+ respond(null, contactProposalRefusal(error));
1036
+ }
1037
+ };
1038
+ /** M-3693: General reads what contact permissions hold (read-only). */
1039
+ const contactState = async (ctx, raw, respond, meta) => {
1040
+ const parsed = validateArgs(ContactStateArgs, raw, "contact_state");
1041
+ if (!parsed.ok) {
1042
+ respond(null, parsed.error);
1043
+ return;
1044
+ }
1045
+ if (!meta?.instanceName || ctx.fleetConfig?.instances[meta.instanceName]?.general_topic !== true) {
1046
+ respond(null, "Only this fleet's configured General may read contact permissions");
1047
+ return;
1048
+ }
1049
+ if (!ctx.contactState) {
1050
+ respond(null, "Contact permissions are unavailable here; the admin can see them in the web dashboard's Permissions / Authorizations pages");
1051
+ return;
1052
+ }
1053
+ try {
1054
+ respond(ctx.contactState(parsed.data.agent));
1055
+ }
1056
+ catch (error) {
1057
+ respond(null, `Could not read contact permissions (${error.message}); the admin can see them in the web dashboard's Permissions / Authorizations pages`);
1034
1058
  }
1035
1059
  };
1036
1060
  /** #2598 B2: a fleet admin confirms the kiro classic → TUI move. */
@@ -1350,8 +1374,9 @@ function introducedErrors(before, after) {
1350
1374
  return after.errors.filter(issue => !had.has(`${issue.path}\u0000${issue.message}`));
1351
1375
  }
1352
1376
  const updateInstanceConfig = async (ctx, rawArgs, respond, meta) => {
1353
- // Check raw fields before Zod strips them. Decision 36525f1b exempts only
1354
- // the authenticated General identity for tool_set, never skipPermissions.
1377
+ // Check raw fields before Zod strips them. skipPermissions stays refused for
1378
+ // everyone. Changing an existing agent's tool_set stays General-only (#814).
1379
+ // create_instance and deploy_template keep the creator cap.
1355
1380
  if (rawArgs?.config?.skipPermissions !== undefined) {
1356
1381
  respond(null, "skipPermissions can only be changed by an administrator via Settings or fleet.yaml (privilege boundary, #804/#814)");
1357
1382
  return;
@@ -1873,11 +1898,22 @@ function windowsRequestAnswer(view) {
1873
1898
  ? `This identical request is already ${view.state}; nothing more is needed.`
1874
1899
  : `This identical request was already ${view.state}. Asking the same thing again gets the same answer: change something (the name, the folder or the model) to ask again, or try again in about ten minutes.` };
1875
1900
  }
1901
+ /** Caller profile vs the profile this write would leave behind. General is uncapped. */
1902
+ function toolSetGrantError(ctx, caller, explicit, defaultsToolSet) {
1903
+ const instances = ctx.fleetConfig?.instances;
1904
+ const creatorConfig = caller && instances && Object.hasOwn(instances, caller) ? instances[caller] : undefined;
1905
+ return toolSetGrantRefusal({
1906
+ caller,
1907
+ creator: caller ? resolveToolSet(creatorConfig, caller) : undefined,
1908
+ explicit,
1909
+ defaultsToolSet,
1910
+ isGeneral: !!caller && isGeneralInstance(ctx.fleetConfig, caller),
1911
+ });
1912
+ }
1876
1913
  const createInstance = async (ctx, rawArgs, respond, meta) => {
1877
- // Decision 36525f1b: only General may supply tool_set. Raw skipPermissions
1878
- // stays refused for everyone before passthrough can reach the lifecycle.
1879
- if (rawArgs?.skipPermissions !== undefined ||
1880
- (rawArgs?.tool_set !== undefined && !isGeneralInstance(ctx.fleetConfig, meta?.instanceName ?? ""))) {
1914
+ // skipPermissions stays refused for everyone, before passthrough can reach the
1915
+ // lifecycle. tool_set may be set up to the caller's own profile.
1916
+ if (rawArgs?.skipPermissions !== undefined) {
1881
1917
  respond(null, "tool_set and skipPermissions can only be changed by an administrator via Settings or fleet.yaml (privilege boundary, #804/#814)");
1882
1918
  return;
1883
1919
  }
@@ -1899,6 +1935,12 @@ const createInstance = async (ctx, rawArgs, respond, meta) => {
1899
1935
  }
1900
1936
  return;
1901
1937
  }
1938
+ const createCaller = meta?.instanceName ?? "";
1939
+ const createGrant = toolSetGrantError(ctx, createCaller, rawArgs?.tool_set, ctx.fleetConfig?.defaults?.tool_set);
1940
+ if (createGrant) {
1941
+ respond(null, createGrant);
1942
+ return;
1943
+ }
1902
1944
  // M-2239 P1-1: sandbox is the Windows runtime's alone; without that runtime it is refused as before.
1903
1945
  if (rawArgs?.sandbox !== undefined) {
1904
1946
  respond(null, WINDOWS_CREATE_REFUSED);
@@ -2313,6 +2355,10 @@ const deployTemplate = async (ctx, rawArgs, respond, meta) => {
2313
2355
  if (instanceDef.lightweight == null && profile.lightweight != null)
2314
2356
  instanceDef.lightweight = profile.lightweight;
2315
2357
  }
2358
+ const deployCaller = meta?.instanceName ?? "";
2359
+ const deployGrant = toolSetGrantError(ctx, deployCaller, instanceDef.tool_set, ctx.fleetConfig.defaults?.tool_set);
2360
+ if (deployGrant)
2361
+ throw new Error(`role "${role}": ${deployGrant}`);
2316
2362
  const topicName = `${deploymentName}-${role}`;
2317
2363
  const deploymentTags = [
2318
2364
  `deployment:${deploymentName}`,
@@ -2510,6 +2556,17 @@ const deliveryStatus = (ctx, rawArgs, respond, meta) => {
2510
2556
  respond(null, t("delivery.not_found"));
2511
2557
  return;
2512
2558
  }
2559
+ if (v.data.held_requests) {
2560
+ // M-3716: only the authenticated caller's own requests; no argument names another agent.
2561
+ try {
2562
+ respond(ctx.ownContactRequests?.(meta.instanceName) ?? { requests: [], note: "Contact requests are unavailable here." });
2563
+ }
2564
+ catch (err) {
2565
+ ctx.logger.warn({ err, caller: meta.instanceName }, "Held request status failed");
2566
+ respond(null, t("delivery.unavailable"));
2567
+ }
2568
+ return;
2569
+ }
2513
2570
  const selector = deliveryStatusSelector(v.data);
2514
2571
  try {
2515
2572
  // `meta.instanceName` is populated from the owning daemon socket / HTTP
@@ -2613,6 +2670,7 @@ export const outboundHandlers = new Map([
2613
2670
  ["close_poll", closePoll],
2614
2671
  ["kiro_engine_status", kiroEngineStatusHandler],
2615
2672
  ["propose_contact_change", proposeContactChange],
2673
+ ["contact_state", contactState],
2616
2674
  ["migrate_kiro_instance", migrateKiroInstance],
2617
2675
  ["reconcile_kiro_instance", reconcileKiroInstance],
2618
2676
  ["get_usage", getUsage],