@songsid/agend 2.4.0-beta.13 → 2.4.0-beta.14

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 (172) hide show
  1. package/dist/agent-endpoint.js +28 -6
  2. package/dist/agent-endpoint.js.map +1 -1
  3. package/dist/backend/claude-code.d.ts +9 -0
  4. package/dist/backend/claude-code.js +60 -4
  5. package/dist/backend/claude-code.js.map +1 -1
  6. package/dist/backend/grok.js +11 -0
  7. package/dist/backend/grok.js.map +1 -1
  8. package/dist/backend/types.d.ts +3 -0
  9. package/dist/backend/types.js.map +1 -1
  10. package/dist/backend-availability.d.ts +1 -16
  11. package/dist/backend-availability.js +2 -91
  12. package/dist/backend-availability.js.map +1 -1
  13. package/dist/backend-version-static.d.ts +15 -0
  14. package/dist/backend-version-static.js +95 -0
  15. package/dist/backend-version-static.js.map +1 -0
  16. package/dist/build-provenance.json +1 -1
  17. package/dist/channel/adapters/telegram.js +3 -1
  18. package/dist/channel/adapters/telegram.js.map +1 -1
  19. package/dist/channel/mcp-server.js +18 -1
  20. package/dist/channel/mcp-server.js.map +1 -1
  21. package/dist/channel/tool-router.d.ts +4 -0
  22. package/dist/channel/tool-router.js +43 -19
  23. package/dist/channel/tool-router.js.map +1 -1
  24. package/dist/classic-channel-manager.d.ts +3 -0
  25. package/dist/classic-channel-manager.js +18 -0
  26. package/dist/classic-channel-manager.js.map +1 -1
  27. package/dist/classic-cli-guard.d.ts +66 -0
  28. package/dist/classic-cli-guard.js +209 -0
  29. package/dist/classic-cli-guard.js.map +1 -0
  30. package/dist/cli-audited.js +7 -5
  31. package/dist/cli-audited.js.map +1 -1
  32. package/dist/config-validator.js +3 -0
  33. package/dist/config-validator.js.map +1 -1
  34. package/dist/contact-auth-api.d.ts +16 -0
  35. package/dist/contact-auth-api.js +78 -0
  36. package/dist/contact-auth-api.js.map +1 -0
  37. package/dist/contact-auth-files.d.ts +6 -0
  38. package/dist/contact-auth-files.js +29 -0
  39. package/dist/contact-auth-files.js.map +1 -0
  40. package/dist/contact-auth-policy.d.ts +75 -0
  41. package/dist/contact-auth-policy.js +23 -0
  42. package/dist/contact-auth-policy.js.map +1 -0
  43. package/dist/contact-auth-service.d.ts +32 -0
  44. package/dist/contact-auth-service.js +99 -0
  45. package/dist/contact-auth-service.js.map +1 -0
  46. package/dist/contact-auth-store.d.ts +75 -0
  47. package/dist/contact-auth-store.js +295 -0
  48. package/dist/contact-auth-store.js.map +1 -0
  49. package/dist/contact-auth-types.d.ts +170 -0
  50. package/dist/contact-auth-types.js +7 -0
  51. package/dist/contact-auth-types.js.map +1 -0
  52. package/dist/daemon.d.ts +8 -0
  53. package/dist/daemon.js +93 -4
  54. package/dist/daemon.js.map +1 -1
  55. package/dist/delivery-outbox.d.ts +6 -0
  56. package/dist/delivery-outbox.js +19 -0
  57. package/dist/delivery-outbox.js.map +1 -1
  58. package/dist/fleet-manager.d.ts +40 -0
  59. package/dist/fleet-manager.js +429 -22
  60. package/dist/fleet-manager.js.map +1 -1
  61. package/dist/general-knowledge/skills/concepts/SKILL.md +18 -0
  62. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +5 -0
  63. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +28 -0
  64. package/dist/general-knowledge/skills/hub/SKILL.md +6 -0
  65. package/dist/hub/audit/index.d.ts +3 -1
  66. package/dist/hub/audit/index.js +35 -3
  67. package/dist/hub/audit/index.js.map +1 -1
  68. package/dist/hub/catalog.d.ts +8 -0
  69. package/dist/hub/catalog.js +39 -4
  70. package/dist/hub/catalog.js.map +1 -1
  71. package/dist/hub/compose/server.d.ts +2 -0
  72. package/dist/hub/compose/server.js +11 -1
  73. package/dist/hub/compose/server.js.map +1 -1
  74. package/dist/hub/directory/directory.js +5 -2
  75. package/dist/hub/directory/directory.js.map +1 -1
  76. package/dist/hub/directory/types.d.ts +5 -1
  77. package/dist/hub/directory/types.js.map +1 -1
  78. package/dist/hub/group-policy/resources.d.ts +1 -1
  79. package/dist/hub/http/compose.d.ts +2 -0
  80. package/dist/hub/http/compose.js +123 -6
  81. package/dist/hub/http/compose.js.map +1 -1
  82. package/dist/hub/http/deps.d.ts +2 -0
  83. package/dist/hub/http/schema.js +6 -1
  84. package/dist/hub/http/schema.js.map +1 -1
  85. package/dist/hub/invitations.js +15 -7
  86. package/dist/hub/invitations.js.map +1 -1
  87. package/dist/hub/roles/cutover-inventory.d.ts +3 -0
  88. package/dist/hub/roles/cutover-inventory.js +20 -4
  89. package/dist/hub/roles/cutover-inventory.js.map +1 -1
  90. package/dist/hub/roles/cutover-marker.d.ts +18 -2
  91. package/dist/hub/roles/cutover-marker.js +6 -2
  92. package/dist/hub/roles/cutover-marker.js.map +1 -1
  93. package/dist/hub/room-agent-discovery-model.d.ts +29 -0
  94. package/dist/hub/room-agent-discovery-model.js +33 -0
  95. package/dist/hub/room-agent-discovery-model.js.map +1 -0
  96. package/dist/hub/room-agent-discovery.d.ts +14 -0
  97. package/dist/hub/room-agent-discovery.js +65 -0
  98. package/dist/hub/room-agent-discovery.js.map +1 -0
  99. package/dist/hub/room-agent-requests.d.ts +71 -0
  100. package/dist/hub/room-agent-requests.js +377 -0
  101. package/dist/hub/room-agent-requests.js.map +1 -0
  102. package/dist/hub/rooms/directory.d.ts +13 -0
  103. package/dist/hub/rooms/directory.js +12 -3
  104. package/dist/hub/rooms/directory.js.map +1 -1
  105. package/dist/hub/rooms/schema.d.ts +5 -0
  106. package/dist/hub/rooms/schema.js +9 -0
  107. package/dist/hub/rooms/schema.js.map +1 -1
  108. package/dist/hub/rooms/service.d.ts +43 -19
  109. package/dist/hub/rooms/service.js +67 -11
  110. package/dist/hub/rooms/service.js.map +1 -1
  111. package/dist/hub/rooms/types.d.ts +1 -1
  112. package/dist/instance-lifecycle.d.ts +3 -1
  113. package/dist/instance-lifecycle.js +4 -1
  114. package/dist/instance-lifecycle.js.map +1 -1
  115. package/dist/locale.js +28 -4
  116. package/dist/locale.js.map +1 -1
  117. package/dist/needs-you-hub.d.ts +1 -0
  118. package/dist/needs-you-hub.js +6 -0
  119. package/dist/needs-you-hub.js.map +1 -1
  120. package/dist/needs-you.d.ts +10 -2
  121. package/dist/needs-you.js.map +1 -1
  122. package/dist/outbound-handlers.d.ts +9 -0
  123. package/dist/outbound-handlers.js +46 -10
  124. package/dist/outbound-handlers.js.map +1 -1
  125. package/dist/runtime-cli-install.js +7 -7
  126. package/dist/runtime-cli-install.js.map +1 -1
  127. package/dist/topic-commands.d.ts +1 -1
  128. package/dist/topic-commands.js +4 -6
  129. package/dist/topic-commands.js.map +1 -1
  130. package/dist/ui/agent-details-settings.js +7 -5
  131. package/dist/ui/contact-auth-client.js +48 -0
  132. package/dist/ui/contact-auth-strings.js +164 -0
  133. package/dist/ui/contact-authorizations.js +125 -0
  134. package/dist/ui/contact-needs.js +84 -0
  135. package/dist/ui/contact-permissions.js +193 -0
  136. package/dist/ui/contact-ticket-badge.js +54 -0
  137. package/dist/ui/hub-client.js +30 -7
  138. package/dist/ui/hub-invitations.js +5 -1
  139. package/dist/ui/hub-room-new.js +10 -3
  140. package/dist/ui/hub-room-owner-requests-strings.js +114 -0
  141. package/dist/ui/hub-room-owner-requests.js +264 -0
  142. package/dist/ui/hub-room-pins.js +43 -0
  143. package/dist/ui/hub-room-settings.js +11 -2
  144. package/dist/ui/hub-room-strings.js +3 -0
  145. package/dist/ui/hub-room-thread.js +47 -5
  146. package/dist/ui/panel-chat.js +2 -0
  147. package/dist/ui/panel-details.js +2 -0
  148. package/dist/ui/panel-fleet.js +3 -2
  149. package/dist/ui/panel-hub.js +7 -1
  150. package/dist/ui/panel-needs.js +5 -1
  151. package/dist/ui/panel-settings.js +3 -0
  152. package/dist/ui/shared/app-route.js +1 -1
  153. package/dist/ui/shared/app-shell.js +2 -0
  154. package/dist/ui/shared/app-stream.js +3 -1
  155. package/dist/ui/shared/app.css +31 -0
  156. package/dist/ui/shared/chat-quote.js +26 -2
  157. package/dist/ui/shared/chat-thread.js +6 -2
  158. package/dist/ui/shared/hub-rooms-u2.css +22 -0
  159. package/dist/ui/shared/text-undo.js +17 -3
  160. package/dist/web-api.d.ts +9 -0
  161. package/dist/web-api.js +55 -3
  162. package/dist/web-api.js.map +1 -1
  163. package/dist/web-chat-history.d.ts +5 -0
  164. package/dist/web-chat-history.js +26 -0
  165. package/dist/web-chat-history.js.map +1 -1
  166. package/dist/web-reply-files.d.ts +1 -0
  167. package/dist/web-reply-files.js +2 -0
  168. package/dist/web-reply-files.js.map +1 -1
  169. package/dist/web-shell-routes.d.ts +1 -1
  170. package/dist/web-shell-routes.js +2 -1
  171. package/dist/web-shell-routes.js.map +1 -1
  172. package/package.json +1 -1
@@ -156,14 +156,23 @@ export function installTextUndo({ doc = document, win = typeof window !== "undef
156
156
  // The browser's own undo or redo went ahead (one it could not cancel, or a script's execCommand("undo"), which has no
157
157
  // beforeinput): what it left is a change of its own — the history starts afresh.
158
158
  if (h.native || e.inputType === "historyUndo" || e.inputType === "historyRedo") { h.native = false; h.undo = []; h.redo = []; h.kind = null; }
159
- h.last = snap(el); // mid-composition too: the value the next edit starts from
159
+ // M-3356 (the user, iPhone, 注音: the candidate bar blanked on every key): never read the field's selection while an
160
+ // IME composes — iOS redraws its candidate bar when the page asks. compositionend (and WebKit's input after it) take
161
+ // the value the next edit starts from.
162
+ if (h.composing || e.isComposing) return;
163
+ h.last = snap(el);
160
164
  };
161
165
  const onCompStart = (e) => {
162
166
  const el = field(e);
163
167
  if (!el) return;
164
168
  const h = historyFor(el);
165
- sync(el, h);
166
- push(h.undo, snap(el)); h.redo = [];
169
+ // M-3356: the step a composition begins is the field as the last edit left it (already read, outside the composition);
170
+ // only a field a script changed since is read again. The price (#4208 review F2): a caret moved since without an
171
+ // edit (a tap elsewhere) is not in that step, so undoing the composition puts the caret where the last edit ended —
172
+ // the value is right. Reading it here is what iOS answers with a candidate-bar redraw.
173
+ if (String(el.value ?? "") === h.last.v) { h.marked = null; push(h.undo, h.last); }
174
+ else { sync(el, h); push(h.undo, snap(el)); }
175
+ h.redo = [];
167
176
  h.composing = true; h.kind = null;
168
177
  };
169
178
  const onCompEnd = (e) => {
@@ -173,6 +182,9 @@ export function installTextUndo({ doc = document, win = typeof window !== "undef
173
182
  h.composing = false;
174
183
  h.last = snap(el); // WebKit's last input comes after compositionend: onInput updates it again
175
184
  };
185
+ // M-3356: a field's history starts when it takes the focus — its first read is never inside a composition (a first key
186
+ // that starts an IME would otherwise read the selection there).
187
+ const onFocus = (e) => { const el = field(e); if (el) historyFor(el); };
176
188
  const onKey = (e) => {
177
189
  const el = field(e);
178
190
  if (!el) return;
@@ -181,6 +193,7 @@ export function installTextUndo({ doc = document, win = typeof window !== "undef
181
193
  e.preventDefault(); // never the browser's page-wide stack, even when this field has no step
182
194
  step(el, which === "redo", win);
183
195
  };
196
+ doc.addEventListener("focusin", onFocus, true);
184
197
  doc.addEventListener("beforeinput", onBefore, true);
185
198
  doc.addEventListener("input", onInput, true);
186
199
  doc.addEventListener("compositionstart", onCompStart, true);
@@ -188,6 +201,7 @@ export function installTextUndo({ doc = document, win = typeof window !== "undef
188
201
  doc.addEventListener("keydown", onKey, true);
189
202
  return () => {
190
203
  doc.removeEventListener("beforeinput", onBefore, true);
204
+ doc.removeEventListener("focusin", onFocus, true);
191
205
  doc.removeEventListener("input", onInput, true);
192
206
  doc.removeEventListener("compositionstart", onCompStart, true);
193
207
  doc.removeEventListener("compositionend", onCompEnd, true);
package/dist/web-api.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type ContactApiHost } from "./contact-auth-api.js";
1
2
  import { type HumanOrigin } from "./human-delivery-receipts.js";
2
3
  import { type HumanAuthority, type WebAuthorityResult, type WebPeer } from "./authority/web-authority.js";
3
4
  import type { CachedImage } from "./web-images.js";
@@ -57,6 +58,14 @@ export type AccountWriteResult = {
57
58
  message?: string;
58
59
  };
59
60
  export interface WebApiContext {
61
+ contactPermissions?: ContactApiHost["contactPermissions"];
62
+ writeContactPermissions?: ContactApiHost["writeContactPermissions"];
63
+ contactAuthorization?: ContactApiHost["contactAuthorization"];
64
+ contactAuthorizations?: ContactApiHost["contactAuthorizations"];
65
+ decideContactAuthorization?: ContactApiHost["decideContactAuthorization"];
66
+ contactActor?(req: IncomingMessage, url: URL): import("./contact-auth-types.js").ContactPerson | null;
67
+ contactNeeds?(actor: import("./contact-auth-types.js").ContactPerson): unknown[];
68
+ acknowledgeContactSuggestion?(instance: string, actor: import("./contact-auth-types.js").ContactPerson): void;
60
69
  recoverNativePane?(name: string, launchId: string, authorized: () => boolean): Promise<void>;
61
70
  startFreshNativePane?(name: string, launchId: string, sessionId: string | null, authorized: () => boolean): Promise<void>;
62
71
  nativeInstanceRuntime?(): import("./fleet-windows-runtime.js").FleetWindowsRuntime;
package/dist/web-api.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { pipeline } from "node:stream/promises";
2
+ import { handleContactAuthorizationApi } from "./contact-auth-api.js";
2
3
  import { buildAgentExport, parseAgentExport } from "./agent-export.js";
3
4
  import { STRUCTURED_PROFILE_BACKENDS } from "./structured-signin-transport.js";
4
5
  import { hubModeOf, hubNameOf } from "./hub-mode.js";
@@ -218,6 +219,12 @@ const safeInstanceSegment = (name) => /^[^\\/\x00]+$/.test(name) && name !== "."
218
219
  */
219
220
  /** #1920 phase 1b: the open streams that are a guest's, and whose — each event is projected for them (guestFrameData). */
220
221
  const streamGuests = new WeakMap();
222
+ const streamContactProjection = new WeakMap();
223
+ function contactNeedsFor(req, url, ctx, base) {
224
+ const ordinary = base.filter(item => !item || typeof item !== "object" || item.type !== "contact");
225
+ const actor = ctx.contactActor?.(req, url);
226
+ return actor && ctx.contactNeeds ? [...ordinary, ...ctx.contactNeeds(actor)] : ordinary;
227
+ }
221
228
  /**
222
229
  * The task board's rule over the public link: an instance kept out of sight (cross_instance_visibility: hidden) is not
223
230
  * shown, nor a card that names one as its assignee, creator or dispatcher. Off the link nothing is hidden. Read when
@@ -334,7 +341,10 @@ export function broadcastSseEvent(clients, event, data, onError, id) {
334
341
  client.write(sseFrame(event, shown));
335
342
  continue;
336
343
  }
337
- client.write(payload);
344
+ const project = streamContactProjection.get(client);
345
+ const shown = project ? project(event, data) : data;
346
+ if (shown !== undefined)
347
+ client.write(shown === data ? payload : sseFrame(event, shown, id));
338
348
  }
339
349
  catch (err) {
340
350
  dead.push(client);
@@ -2649,6 +2659,9 @@ export function handleWebRequest(req, res, url, ctx) {
2649
2659
  }
2650
2660
  if (handleAgentRuntimeChange(req, res, url, ctx))
2651
2661
  return true;
2662
+ if (ctx.contactPermissions && ctx.writeContactPermissions && ctx.contactAuthorization && ctx.contactAuthorizations && ctx.decideContactAuthorization && ctx.contactActor
2663
+ && handleContactAuthorizationApi(req, res, url, ctx))
2664
+ return true;
2652
2665
  if (handleNativeInstanceRequest(req, res, url, ctx))
2653
2666
  return true;
2654
2667
  if (handleWindowsCliRequest(req, res, url, ctx))
@@ -2993,7 +3006,7 @@ export function handleWebRequest(req, res, url, ctx) {
2993
3006
  prompts: ctx.listWebPrompts?.() ?? [],
2994
3007
  // #1386: "Needs you" rides the passive channels only — no endpoint of its own to poll. Over the public link,
2995
3008
  // without the task board's hidden cards (#2306 review).
2996
- needs: visibleNeeds(ctx, linkRestricted(req, url, ctx), ctx.needsYouItems?.() ?? []),
3009
+ needs: visibleNeeds(ctx, linkRestricted(req, url, ctx), contactNeedsFor(req, url, ctx, ctx.needsYouItems?.() ?? [])),
2997
3010
  // #1577: the newest message this answer accounts for — after a restart, the last restored one until this process
2998
3011
  // records its own (`<boot>-0` would be after(0): the whole restored history again on every poll).
2999
3012
  cursor: history ? history.pollCursor() : null,
@@ -3035,6 +3048,30 @@ export function handleWebRequest(req, res, url, ctx) {
3035
3048
  streamGuests.set(res, guest);
3036
3049
  guest.streamOpened?.();
3037
3050
  }
3051
+ if (!guest && ctx.contactActor)
3052
+ streamContactProjection.set(res, (event, value) => {
3053
+ if (event === "needs")
3054
+ return { items: contactNeedsFor(req, url, ctx, (value && typeof value === "object" && Array.isArray(value.items)) ? value.items : []) };
3055
+ if (event === "contact-auth") {
3056
+ const actor = ctx.contactActor?.(req, url);
3057
+ if (!actor || !value || typeof value !== "object")
3058
+ return undefined;
3059
+ const change = value;
3060
+ try {
3061
+ if (change.ticketId)
3062
+ ctx.contactAuthorization?.(change.ticketId, actor);
3063
+ else if (change.instance)
3064
+ ctx.contactPermissions?.(change.instance, actor);
3065
+ else
3066
+ return undefined;
3067
+ return value;
3068
+ }
3069
+ catch {
3070
+ return undefined;
3071
+ }
3072
+ }
3073
+ return value;
3074
+ });
3038
3075
  const statusFrame = () => `event: status\ndata: ${JSON.stringify(guest ? guestStatus(ctx.getUiStatus(), guest.scope()) : ctx.getUiStatus())}\n\n`;
3039
3076
  res.write(`${statusFrame()}${sseClock()}`);
3040
3077
  // An EventSource that reconnects says what it last saw: send what it missed, before anything new.
@@ -3062,7 +3099,7 @@ export function handleWebRequest(req, res, url, ctx) {
3062
3099
  res.write(`event: prompts\ndata: ${JSON.stringify(ctx.listWebPrompts())}\n\n`);
3063
3100
  // #1386: and "Needs you" as it is now; changes follow as `needs` events.
3064
3101
  if (!guest && ctx.needsYouItems)
3065
- res.write(`event: needs\ndata: ${JSON.stringify({ items: ctx.needsYouItems() })}\n\n`);
3102
+ res.write(`event: needs\ndata: ${JSON.stringify({ items: contactNeedsFor(req, url, ctx, ctx.needsYouItems()) })}\n\n`);
3066
3103
  ctx.sseClients.add(res);
3067
3104
  // #1956: the heartbeat's status comes from the one build every open stream shares each tick (statusTick), with
3068
3105
  // this stream's own projection; this stream's checks stay its own.
@@ -4617,6 +4654,21 @@ export function handleWebRequest(req, res, url, ctx) {
4617
4654
  json(res, 400, { error: "id required" });
4618
4655
  return;
4619
4656
  }
4657
+ if (id.startsWith("contact-suggest:")) {
4658
+ const actor = ctx.contactActor?.(req, url);
4659
+ if (!actor || !ctx.acknowledgeContactSuggestion) {
4660
+ json(res, 403, { error: "forbidden" });
4661
+ return;
4662
+ }
4663
+ try {
4664
+ ctx.acknowledgeContactSuggestion(id.slice("contact-suggest:".length), actor);
4665
+ json(res, 200, { acknowledged: true });
4666
+ }
4667
+ catch {
4668
+ json(res, 403, { error: "forbidden" });
4669
+ }
4670
+ return;
4671
+ }
4620
4672
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
4621
4673
  if (verdict.kind !== "allow") {
4622
4674
  json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });