@songsid/agend 2.4.0-beta.5 → 2.4.0-beta.7

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 (120) hide show
  1. package/dist/agent-cli-instructions.md +2 -0
  2. package/dist/app-message-origin.d.ts +2 -0
  3. package/dist/app-message-origin.js +3 -0
  4. package/dist/app-message-origin.js.map +1 -0
  5. package/dist/auth-api.js +2 -0
  6. package/dist/auth-api.js.map +1 -1
  7. package/dist/backend-availability.d.ts +22 -0
  8. package/dist/backend-availability.js +71 -2
  9. package/dist/backend-availability.js.map +1 -1
  10. package/dist/build-provenance.json +1 -1
  11. package/dist/channel/adapters/telegram.d.ts +2 -0
  12. package/dist/channel/adapters/telegram.js +3 -0
  13. package/dist/channel/adapters/telegram.js.map +1 -1
  14. package/dist/cli-capability.d.ts +3 -0
  15. package/dist/cli-capability.js.map +1 -1
  16. package/dist/cli-registry-check.js +1 -1
  17. package/dist/cli-registry-check.js.map +1 -1
  18. package/dist/cli-registry.d.ts +1 -0
  19. package/dist/cli-spec-antigravity.d.ts +1 -0
  20. package/dist/cli-spec-antigravity.js +3 -1
  21. package/dist/cli-spec-antigravity.js.map +1 -1
  22. package/dist/cli.js +8 -0
  23. package/dist/cli.js.map +1 -1
  24. package/dist/connect/control.d.ts +20 -0
  25. package/dist/connect/control.js +236 -0
  26. package/dist/connect/control.js.map +1 -0
  27. package/dist/connect/install.d.ts +13 -0
  28. package/dist/connect/install.js +12 -0
  29. package/dist/connect/install.js.map +1 -0
  30. package/dist/connect/protocol.d.ts +38 -0
  31. package/dist/connect/protocol.js +36 -0
  32. package/dist/connect/protocol.js.map +1 -0
  33. package/dist/connect/service.d.ts +19 -0
  34. package/dist/connect/service.js +79 -0
  35. package/dist/connect/service.js.map +1 -0
  36. package/dist/connect/stdio-entry.d.ts +1 -0
  37. package/dist/connect/stdio-entry.js +6 -0
  38. package/dist/connect/stdio-entry.js.map +1 -0
  39. package/dist/connect/stdio.d.ts +5 -0
  40. package/dist/connect/stdio.js +39 -0
  41. package/dist/connect/stdio.js.map +1 -0
  42. package/dist/daemon.js +2 -0
  43. package/dist/daemon.js.map +1 -1
  44. package/dist/fleet-manager.d.ts +12 -1
  45. package/dist/fleet-manager.js +75 -11
  46. package/dist/fleet-manager.js.map +1 -1
  47. package/dist/fleet-windows-runtime.js +4 -2
  48. package/dist/fleet-windows-runtime.js.map +1 -1
  49. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +2 -0
  50. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +15 -1
  51. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +2 -0
  52. package/dist/hub/group-policy/model.d.ts +23 -0
  53. package/dist/hub/group-policy/model.js +3 -3
  54. package/dist/hub/group-policy/model.js.map +1 -1
  55. package/dist/hub/group-policy/store.js +3 -3
  56. package/dist/hub/group-policy/store.js.map +1 -1
  57. package/dist/hub/group-policy/team-subjects.d.ts +1 -1
  58. package/dist/hub/group-policy/team-subjects.js +1 -1
  59. package/dist/hub/group-policy/team-subjects.js.map +1 -1
  60. package/dist/hub/http/compose.js +3 -0
  61. package/dist/hub/http/compose.js.map +1 -1
  62. package/dist/hub/roles/change.js +4 -0
  63. package/dist/hub/roles/change.js.map +1 -1
  64. package/dist/hub/roles/convert.js +1 -1
  65. package/dist/hub/roles/convert.js.map +1 -1
  66. package/dist/hub/roles/delegation.js +4 -0
  67. package/dist/hub/roles/delegation.js.map +1 -1
  68. package/dist/hub/roles/evaluate.d.ts +2 -1
  69. package/dist/hub/roles/evaluate.js +14 -0
  70. package/dist/hub/roles/evaluate.js.map +1 -1
  71. package/dist/hub/roles/model.d.ts +23 -0
  72. package/dist/hub/roles/model.js +7 -2
  73. package/dist/hub/roles/model.js.map +1 -1
  74. package/dist/human-delivery-receipts.js +8 -0
  75. package/dist/human-delivery-receipts.js.map +1 -1
  76. package/dist/instructions.js +3 -0
  77. package/dist/instructions.js.map +1 -1
  78. package/dist/locale.js +50 -0
  79. package/dist/locale.js.map +1 -1
  80. package/dist/runtime-personal-answer.d.ts +25 -0
  81. package/dist/runtime-personal-answer.js +115 -0
  82. package/dist/runtime-personal-answer.js.map +1 -0
  83. package/dist/runtime-personal-profile.d.ts +34 -0
  84. package/dist/runtime-personal-profile.js +61 -0
  85. package/dist/runtime-personal-profile.js.map +1 -0
  86. package/dist/settings-api.js +5 -0
  87. package/dist/settings-api.js.map +1 -1
  88. package/dist/tool-progress.d.ts +9 -0
  89. package/dist/tool-progress.js +141 -32
  90. package/dist/tool-progress.js.map +1 -1
  91. package/dist/turn-reply-guard.d.ts +2 -2
  92. package/dist/turn-reply-guard.js +3 -3
  93. package/dist/turn-reply-guard.js.map +1 -1
  94. package/dist/ui/fleet-office-skin.js +1 -1
  95. package/dist/ui/hub-quick-pairing.js +7 -2
  96. package/dist/ui/panel-settings.js +2 -1
  97. package/dist/ui/settings-connector-strings.js +23 -0
  98. package/dist/ui/settings-connector.js +39 -0
  99. package/dist/ui/shared/app-shell.js +28 -8
  100. package/dist/ui/shared/app-themes.js +2 -2
  101. package/dist/ui/shared/app.css +207 -139
  102. package/dist/ui/shared/chat-composer.js +23 -2
  103. package/dist/ui/shared/chat-thread.js +3 -3
  104. package/dist/ui/shared/chat-work-bar.css +9 -1
  105. package/dist/ui/shared/connector-prompt.d.ts +2 -0
  106. package/dist/ui/shared/connector-prompt.js +10 -0
  107. package/dist/ui/shared/hub-chat.css +1 -1
  108. package/dist/ui/shared/hub-owner.css +1 -1
  109. package/dist/ui/shared/hub.css +5 -0
  110. package/dist/ui/shared/image-lightbox.js +35 -10
  111. package/dist/ui/shared/image-zoom.js +61 -9
  112. package/dist/ui/shared/instance-nav.js +35 -6
  113. package/dist/ui/shared/settings-connector.css +7 -0
  114. package/dist/ui/shared/theme.js +52 -0
  115. package/dist/ui/shared/tokens.css +27 -10
  116. package/dist/ui/shared/view-strings.js +6 -0
  117. package/dist/web-icons.js +3 -3
  118. package/dist/web-icons.js.map +1 -1
  119. package/dist/web-theme.js +2 -2
  120. package/package.json +1 -1
@@ -1199,6 +1199,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1199
1199
  private settingsRuntimeRevision;
1200
1200
  private settingsConfirmation;
1201
1201
  private settingsControl;
1202
+ private ownerAppControl;
1202
1203
  private settingsJobSettlements;
1203
1204
  private classicSettingsOwners;
1204
1205
  private queueSettingsOperation;
@@ -1484,6 +1485,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1484
1485
  private handleKiroReconcileCallback;
1485
1486
  private handleSettingsChangeCallback;
1486
1487
  startSettingsConfirmationControl(): Promise<void>;
1488
+ /** A person's local app gets a private, read/chat-only surface, never an instance's tool permissions. */
1489
+ startOwnerAppControl(): Promise<void>;
1487
1490
  private get webToken();
1488
1491
  /**
1489
1492
  * Server-side web sessions (see web-session.ts). Created with the token, not per
@@ -3055,7 +3058,15 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
3055
3058
  * copies retain their permissive handling when that identity is unknown.
3056
3059
  */
3057
3060
  private isOwnerCommandCopy;
3058
- /** File a Telegram update that was too old to inject; Needs you lists it until Acknowledge. */
3061
+ /**
3062
+ * Who a Telegram update that was too old to inject would have gone to live (handleInboundMessageCore), or null when live
3063
+ * delivery would not have taken it — then it is not "missed". A topic of the fleet group: its instance (an unbound topic
3064
+ * only gets the bind prompt live, so nobody). The fleet group's root: general ("" when none is configured). Any other chat
3065
+ * is a ClassicBot candidate: its registered room — in a group only when the message @mentions the bot — and otherwise
3066
+ * nobody (live, an unregistered chat is ignored, and an @mention there only gets the no-agent reply).
3067
+ */
3068
+ private missedOfflineInstance;
3069
+ /** File a Telegram update that was too old to inject, where live delivery would have taken it; Needs you lists it until Acknowledge. */
3059
3070
  private recordMissedOffline;
3060
3071
  /**
3061
3072
  * #1085: coincident topic numbers must not route across Telegram groups.
@@ -106,7 +106,7 @@ import { getEffectiveInstanceDefaults, loadFleetConfig, loadRawFleetConfig, load
106
106
  import { EventLog } from "./event-log.js";
107
107
  import { binaryProbe } from "./binary-probe.js";
108
108
  import { deletePlannedTopic, planInstanceTopicDelete, topicDestination, topicMustStay } from "./instance-topic-delete.js";
109
- import { AVAILABILITY_STALE_MS, BackendAvailabilityStore, versionAtLeast, hostAvailabilityProbes, findExecutableIn, resolveBackendBinary } from "./backend-availability.js";
109
+ import { AVAILABILITY_STALE_MS, BackendAvailabilityStore, structuredSignInReady, hostAvailabilityProbes, findExecutableIn, resolveBackendBinary } from "./backend-availability.js";
110
110
  import { classifySqliteOpenError } from "./sqlite-open-errors.js";
111
111
  import { OutboxOpenError } from "./outbox-open-error.js";
112
112
  import { AdapterWorld } from "./adapter-world.js";
@@ -3891,6 +3891,7 @@ export class FleetManager {
3891
3891
  settingsRuntimeRevision = 0;
3892
3892
  settingsConfirmation = null;
3893
3893
  settingsControl = null;
3894
+ ownerAppControl = null;
3894
3895
  settingsJobSettlements = new Map();
3895
3896
  classicSettingsOwners = new WeakMap();
3896
3897
  queueSettingsOperation(job, resources, execution, run) {
@@ -5145,6 +5146,45 @@ export class FleetManager {
5145
5146
  throw err;
5146
5147
  }
5147
5148
  }
5149
+ /** A person's local app gets a private, read/chat-only surface, never an instance's tool permissions. */
5150
+ async startOwnerAppControl() {
5151
+ if (this.shuttingDown || this.ownerAppControl)
5152
+ return;
5153
+ const [{ OwnerAppControl }, { createOwnerAppService }] = await Promise.all([import("./connect/control.js"), import("./connect/service.js")]);
5154
+ if (this.shuttingDown || this.ownerAppControl)
5155
+ return;
5156
+ const service = createOwnerAppService({
5157
+ current: () => !this.shuttingDown && !!this.fleetConfig,
5158
+ agents: () => Object.entries(this.fleetConfig?.instances ?? {}).map(([name, config]) => ({ name,
5159
+ display_name: config.display_name, backend: config.backend ?? "claude-code", status: this.getInstanceStatus(name) })),
5160
+ identity: name => this.fleetConfig?.instances[name],
5161
+ history: this.webChatHistory,
5162
+ board: () => this.scheduler?.db.board ?? null,
5163
+ deliver: async (name, text, messageId, current) => {
5164
+ if (!current())
5165
+ return false;
5166
+ const config = this.fleetConfig.instances[name];
5167
+ const adapter = this.getAdapterForInstance(name);
5168
+ const result = await this.deliverHumanToInstance(name, { type: "fleet_inbound", targetSession: name, content: text,
5169
+ meta: { chat_id: String(this.getGroupIdForInstance(name) ?? ""), thread_id: String(config.topic_id ?? ""),
5170
+ message_id: messageId, user: "Local app", user_id: "local-connector", source: "app", adapter_id: adapter?.id,
5171
+ ts: new Date().toISOString() } }, undefined, text, { stillCurrent: current, authorityCurrent: () => !this.shuttingDown && this.fleetConfig?.instances[name] === config });
5172
+ // No web-verified origin or human receipt authority is manufactured for an external app.
5173
+ if (result !== false)
5174
+ this.emitSseEvent("message", { instance: name, sender: "Local app", role: "user", text, messageId, ts: new Date().toISOString() });
5175
+ return result;
5176
+ },
5177
+ });
5178
+ const control = this.ownerAppControl = new OwnerAppControl(this.dataDir, service);
5179
+ try {
5180
+ await control.listen();
5181
+ }
5182
+ catch (error) {
5183
+ if (this.ownerAppControl === control)
5184
+ this.ownerAppControl = null;
5185
+ throw error;
5186
+ }
5187
+ }
5148
5188
  get webToken() { return readWebToken(this.dataDir); }
5149
5189
  /**
5150
5190
  * Server-side web sessions (see web-session.ts). Created with the token, not per
@@ -14048,7 +14088,27 @@ export class FleetManager {
14048
14088
  }
14049
14089
  return true;
14050
14090
  }
14051
- /** File a Telegram update that was too old to inject; Needs you lists it until Acknowledge. */
14091
+ /**
14092
+ * Who a Telegram update that was too old to inject would have gone to live (handleInboundMessageCore), or null when live
14093
+ * delivery would not have taken it — then it is not "missed". A topic of the fleet group: its instance (an unbound topic
14094
+ * only gets the bind prompt live, so nobody). The fleet group's root: general ("" when none is configured). Any other chat
14095
+ * is a ClassicBot candidate: its registered room — in a group only when the message @mentions the bot — and otherwise
14096
+ * nobody (live, an unregistered chat is ignored, and an @mention there only gets the no-agent reply).
14097
+ */
14098
+ missedOfflineInstance(ev, stub) {
14099
+ const threadId = this.inboundRouteThreadId(stub);
14100
+ if (threadId)
14101
+ return this.resolveInboundTarget(stub, threadId)?.name ?? null;
14102
+ if (ev.chatId !== String(this.getChannelConfig(ev.adapterId)?.group_id ?? "")) {
14103
+ const room = this.classicChannels?.getInstanceByChannel(ev.chatId, ev.adapterId);
14104
+ if (!room)
14105
+ return null;
14106
+ const isPrivateChat = !ev.chatId.startsWith("-");
14107
+ return isPrivateChat || ev.mentionsBot ? room : null;
14108
+ }
14109
+ return Object.entries(this.fleetConfig?.instances ?? {}).find(([name, cfg]) => cfg.general_topic && this.getInstanceAdapterId(name) === ev.adapterId)?.[0] ?? "";
14110
+ }
14111
+ /** File a Telegram update that was too old to inject, where live delivery would have taken it; Needs you lists it until Acknowledge. */
14052
14112
  recordMissedOffline(ev) {
14053
14113
  if (!this.missedOfflineStore)
14054
14114
  this.missedOfflineStore = new MissedOfflineStore(this.dataDir);
@@ -14057,11 +14117,10 @@ export class FleetManager {
14057
14117
  messageId: ev.messageId, userId: ev.userId, username: ev.username, text: ev.preview,
14058
14118
  timestamp: ev.timestamp, isBotMessage: false,
14059
14119
  };
14060
- const threadId = this.inboundRouteThreadId(stub);
14061
- const target = threadId ? this.resolveInboundTarget(stub, threadId) : undefined;
14062
- let instance = target?.name ?? "";
14063
- if (!instance) {
14064
- instance = Object.entries(this.fleetConfig?.instances ?? {}).find(([name, cfg]) => cfg.general_topic && this.getInstanceAdapterId(name) === ev.adapterId)?.[0] ?? "";
14120
+ const instance = this.missedOfflineInstance(ev, stub);
14121
+ if (instance === null) {
14122
+ this.logger.debug({ adapterId: ev.adapterId, updateId: ev.updateId, chatId: ev.chatId, threadId: ev.threadId }, "Telegram message from while AgEnD was offline is not for this fleet — not filed");
14123
+ return;
14065
14124
  }
14066
14125
  const place = [ev.chatTitle, ev.threadId ? `#${ev.threadId}` : ""].filter(Boolean).join(" · ") || ev.chatId;
14067
14126
  this.missedOfflineStore.add({
@@ -22052,7 +22111,7 @@ export class FleetManager {
22052
22111
  * so claiming every retained checkpoint is "completed" would be false. */
22053
22112
  composeRetiredBubbleText(entry) {
22054
22113
  const elapsed = FleetManager.formatProgressElapsed(Date.now() - (entry.startedAt ?? Date.now()));
22055
- return `🧾 工具歷程 (記錄至 ${elapsed})\n${entry.toolProgress}`;
22114
+ return `${t("progress.trace_title", elapsed)}\n${entry.toolProgress}`;
22056
22115
  }
22057
22116
  /**
22058
22117
  * Make a tool summary safe to paste into a channel message.
@@ -23367,7 +23426,7 @@ export class FleetManager {
23367
23426
  if (!structuredSignInSupported(backend) || !STRUCTURED_PROFILE_BACKENDS.has(backend))
23368
23427
  return false;
23369
23428
  const row = this.backendAvailabilityRows().find(r => r.backend === backend);
23370
- return !!row && row.state !== "not_installed" && row.state !== "too_old" && versionAtLeast(row.version, hostFacts(backend, "structuredSignIn")?.minVersion);
23429
+ return !!row && row.state !== "not_installed" && row.state !== "too_old" && structuredSignInReady(row, hostFacts(backend, "structuredSignIn")?.minVersion);
23371
23430
  }
23372
23431
  backendSignInTargets() {
23373
23432
  const out = [];
@@ -23378,10 +23437,11 @@ export class FleetManager {
23378
23437
  // whether it is over, and then it is not signed in (never the other way: the file can't vouch for a login).
23379
23438
  const ended = row.state === "usable" && this.claudeSignInEnded(row.backend, null);
23380
23439
  // A CLI the dashboard drives with the structured sign-in (registry: `host.structuredSignIn`) although chat's /login and the browser terminal decline it (Antigravity: `agy acp --login`, agy
23381
- // >= its `minVersion`) is signed in from Settings → Accounts. A CLI that is older, or whose version is not known, keeps "Sign in on the host" and is told to update.
23440
+ // >= its `minVersion`, or — AGEND-274, only while the version is unknown — its file holds the command's `marker`) is signed in from Settings → Accounts. A CLI that is older, or whose version is not
23441
+ // known and whose file was not seen to hold the marker, keeps "Sign in on the host" (told to update only when the version is known to be older).
23382
23442
  const structured = hostFacts(row.backend, "structuredSignIn");
23383
23443
  const viaStructured = !!structured && flow?.remoteLogin === "unsupported" && row.state !== "not_installed";
23384
- const structuredSignIn = viaStructured && versionAtLeast(row.version, structured.minVersion);
23444
+ const structuredSignIn = viaStructured && structuredSignInReady(row, structured.minVersion);
23385
23445
  // Told to update only when the version is KNOWN to be older: a version that was not read yet is not "too old".
23386
23446
  const structuredUpdate = viaStructured && !structuredSignIn && typeof row.version === "string" && /\d/.test(row.version);
23387
23447
  out.push({
@@ -28002,6 +28062,9 @@ export class FleetManager {
28002
28062
  const settingsControl = this.settingsControl;
28003
28063
  this.settingsControl = null;
28004
28064
  const settingsControlStopped = settingsControl?.close();
28065
+ const ownerAppControl = this.ownerAppControl;
28066
+ this.ownerAppControl = null;
28067
+ const ownerAppStopped = ownerAppControl?.close();
28005
28068
  this.publicLinkAutoOpen?.stop();
28006
28069
  const publicStopped = this.publicWebLink?.close("fleet shutdown");
28007
28070
  this.webRemoteAccessState?.close(); // #3008: an unsaved switch gets its last write
@@ -28068,6 +28131,7 @@ export class FleetManager {
28068
28131
  await hubStopped;
28069
28132
  await needsStopped;
28070
28133
  await settingsControlStopped;
28134
+ await ownerAppStopped;
28071
28135
  await cacheStopped;
28072
28136
  await quotaNoticesStopped;
28073
28137
  this.quotaNotices = null;