@songsid/agend 2.1.4-beta.6 → 2.1.4-beta.60

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 (185) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -1
  3. package/dist/agent-cli-instructions.md +2 -2
  4. package/dist/agent-endpoint.js +1 -1
  5. package/dist/agent-endpoint.js.map +1 -1
  6. package/dist/backend/antigravity.d.ts +12 -8
  7. package/dist/backend/antigravity.js +189 -42
  8. package/dist/backend/antigravity.js.map +1 -1
  9. package/dist/backend/claude-code.d.ts +87 -23
  10. package/dist/backend/claude-code.js +361 -46
  11. package/dist/backend/claude-code.js.map +1 -1
  12. package/dist/backend/codex.d.ts +18 -0
  13. package/dist/backend/codex.js +143 -7
  14. package/dist/backend/codex.js.map +1 -1
  15. package/dist/backend/gemini-cli.js +2 -2
  16. package/dist/backend/gemini-cli.js.map +1 -1
  17. package/dist/backend/grok.js +2 -2
  18. package/dist/backend/grok.js.map +1 -1
  19. package/dist/backend/kiro.d.ts +52 -2
  20. package/dist/backend/kiro.js +267 -12
  21. package/dist/backend/kiro.js.map +1 -1
  22. package/dist/backend/opencode.js +17 -4
  23. package/dist/backend/opencode.js.map +1 -1
  24. package/dist/backend/types.d.ts +122 -3
  25. package/dist/backend/types.js +5 -1
  26. package/dist/backend/types.js.map +1 -1
  27. package/dist/backend-outage.d.ts +61 -0
  28. package/dist/backend-outage.js +71 -0
  29. package/dist/backend-outage.js.map +1 -0
  30. package/dist/channel/adapters/discord.d.ts +44 -2
  31. package/dist/channel/adapters/discord.js +529 -89
  32. package/dist/channel/adapters/discord.js.map +1 -1
  33. package/dist/channel/adapters/telegram.d.ts +30 -0
  34. package/dist/channel/adapters/telegram.js +221 -19
  35. package/dist/channel/adapters/telegram.js.map +1 -1
  36. package/dist/channel/agy-mcp-launcher.d.ts +2 -0
  37. package/dist/channel/agy-mcp-launcher.js +28 -0
  38. package/dist/channel/agy-mcp-launcher.js.map +1 -0
  39. package/dist/channel/ipc-bridge.d.ts +2 -1
  40. package/dist/channel/ipc-bridge.js +33 -4
  41. package/dist/channel/ipc-bridge.js.map +1 -1
  42. package/dist/channel/markdown-chunk.d.ts +42 -0
  43. package/dist/channel/markdown-chunk.js +205 -0
  44. package/dist/channel/markdown-chunk.js.map +1 -0
  45. package/dist/channel/mcp-server.js +28 -25
  46. package/dist/channel/mcp-server.js.map +1 -1
  47. package/dist/channel/mcp-tools.js +6 -4
  48. package/dist/channel/mcp-tools.js.map +1 -1
  49. package/dist/channel/message-queue.js +64 -8
  50. package/dist/channel/message-queue.js.map +1 -1
  51. package/dist/channel/types.d.ts +31 -1
  52. package/dist/classic-channel-manager.d.ts +65 -0
  53. package/dist/classic-channel-manager.js +172 -3
  54. package/dist/classic-channel-manager.js.map +1 -1
  55. package/dist/cli.js +124 -83
  56. package/dist/cli.js.map +1 -1
  57. package/dist/config-validator.js +16 -0
  58. package/dist/config-validator.js.map +1 -1
  59. package/dist/config.d.ts +4 -0
  60. package/dist/config.js +12 -1
  61. package/dist/config.js.map +1 -1
  62. package/dist/cross-instance-envelope.d.ts +6 -0
  63. package/dist/cross-instance-envelope.js +30 -0
  64. package/dist/cross-instance-envelope.js.map +1 -0
  65. package/dist/daemon.d.ts +506 -11
  66. package/dist/daemon.js +2162 -313
  67. package/dist/daemon.js.map +1 -1
  68. package/dist/doctor.d.ts +41 -0
  69. package/dist/doctor.js +267 -0
  70. package/dist/doctor.js.map +1 -0
  71. package/dist/fleet-context.d.ts +63 -0
  72. package/dist/fleet-context.js.map +1 -1
  73. package/dist/fleet-manager.d.ts +422 -12
  74. package/dist/fleet-manager.js +2961 -635
  75. package/dist/fleet-manager.js.map +1 -1
  76. package/dist/fleet-yaml-slim.d.ts +10 -0
  77. package/dist/fleet-yaml-slim.js +59 -0
  78. package/dist/fleet-yaml-slim.js.map +1 -0
  79. package/dist/general-knowledge/skills/backend-providers/SKILL.md +114 -0
  80. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +4 -1
  81. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +52 -0
  82. package/dist/general-knowledge/skills/development-workflow/SKILL.md +28 -0
  83. package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -0
  84. package/dist/general-knowledge/skills/fleet-health/SKILL.md +1 -0
  85. package/dist/general-knowledge/skills/fleet-restart/SKILL.md +1 -0
  86. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -0
  87. package/dist/general-knowledge/skills/model-discovery/SKILL.md +64 -16
  88. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -0
  89. package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -0
  90. package/dist/general-knowledge/skills/session-management/SKILL.md +172 -8
  91. package/dist/general-knowledge/skills/tui-effort/SKILL.md +1 -0
  92. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +30 -0
  93. package/dist/instance-lifecycle.d.ts +99 -0
  94. package/dist/instance-lifecycle.js +357 -11
  95. package/dist/instance-lifecycle.js.map +1 -1
  96. package/dist/instructions.d.ts +12 -0
  97. package/dist/instructions.js +74 -3
  98. package/dist/instructions.js.map +1 -1
  99. package/dist/locale.js +1022 -310
  100. package/dist/locale.js.map +1 -1
  101. package/dist/login-flows.d.ts +91 -0
  102. package/dist/login-flows.js +170 -0
  103. package/dist/login-flows.js.map +1 -0
  104. package/dist/login-manager.d.ts +63 -0
  105. package/dist/login-manager.js +134 -0
  106. package/dist/login-manager.js.map +1 -0
  107. package/dist/network-family.d.ts +18 -0
  108. package/dist/network-family.js +20 -0
  109. package/dist/network-family.js.map +1 -0
  110. package/dist/outbound-handlers.d.ts +16 -1
  111. package/dist/outbound-handlers.js +174 -40
  112. package/dist/outbound-handlers.js.map +1 -1
  113. package/dist/outbound-schemas.d.ts +11 -3
  114. package/dist/outbound-schemas.js +11 -0
  115. package/dist/outbound-schemas.js.map +1 -1
  116. package/dist/pane-input-residue.d.ts +52 -0
  117. package/dist/pane-input-residue.js +107 -0
  118. package/dist/pane-input-residue.js.map +1 -0
  119. package/dist/process-memory.d.ts +6 -0
  120. package/dist/process-memory.js +45 -0
  121. package/dist/process-memory.js.map +1 -1
  122. package/dist/reply-dedup.d.ts +7 -8
  123. package/dist/reply-dedup.js +0 -0
  124. package/dist/reply-dedup.js.map +1 -1
  125. package/dist/restart-progress.d.ts +2 -0
  126. package/dist/restart-progress.js +3 -0
  127. package/dist/restart-progress.js.map +1 -1
  128. package/dist/scheduler/db.d.ts +12 -0
  129. package/dist/scheduler/db.js +59 -0
  130. package/dist/scheduler/db.js.map +1 -1
  131. package/dist/service-installer.d.ts +11 -0
  132. package/dist/service-installer.js +84 -18
  133. package/dist/service-installer.js.map +1 -1
  134. package/dist/settings-api.js +1 -1
  135. package/dist/settings-api.js.map +1 -1
  136. package/dist/setup-wizard.js +2 -2
  137. package/dist/setup-wizard.js.map +1 -1
  138. package/dist/spawn-gate.d.ts +30 -0
  139. package/dist/spawn-gate.js +79 -0
  140. package/dist/spawn-gate.js.map +1 -0
  141. package/dist/steer-capability.d.ts +1 -0
  142. package/dist/steer-capability.js +6 -0
  143. package/dist/steer-capability.js.map +1 -0
  144. package/dist/storm-window.d.ts +83 -0
  145. package/dist/storm-window.js +251 -0
  146. package/dist/storm-window.js.map +1 -0
  147. package/dist/tips.d.ts +44 -0
  148. package/dist/tips.js +355 -0
  149. package/dist/tips.js.map +1 -0
  150. package/dist/tmux-manager.d.ts +16 -0
  151. package/dist/tmux-manager.js +110 -25
  152. package/dist/tmux-manager.js.map +1 -1
  153. package/dist/tool-progress.d.ts +40 -0
  154. package/dist/tool-progress.js +289 -0
  155. package/dist/tool-progress.js.map +1 -0
  156. package/dist/topic-commands.d.ts +45 -6
  157. package/dist/topic-commands.js +394 -66
  158. package/dist/topic-commands.js.map +1 -1
  159. package/dist/transcript-monitor.d.ts +15 -2
  160. package/dist/transcript-monitor.js +63 -17
  161. package/dist/transcript-monitor.js.map +1 -1
  162. package/dist/transcript-sources.d.ts +131 -0
  163. package/dist/transcript-sources.js +580 -0
  164. package/dist/transcript-sources.js.map +1 -0
  165. package/dist/types.d.ts +11 -0
  166. package/dist/ui/dashboard.html +55 -32
  167. package/dist/ui/settings.html +200 -60
  168. package/dist/ui/view.html +147 -30
  169. package/dist/usage/format-rich.d.ts +1 -1
  170. package/dist/usage/format-rich.js +28 -24
  171. package/dist/usage/format-rich.js.map +1 -1
  172. package/dist/usage/i18n-keys.d.ts +7 -0
  173. package/dist/usage/i18n-keys.js +34 -0
  174. package/dist/usage/i18n-keys.js.map +1 -0
  175. package/dist/usage/i18n.d.ts +5 -0
  176. package/dist/usage/i18n.js +27 -0
  177. package/dist/usage/i18n.js.map +1 -0
  178. package/dist/usage/providers.d.ts +21 -0
  179. package/dist/usage/providers.js +153 -75
  180. package/dist/usage/providers.js.map +1 -1
  181. package/dist/usage/usage-api.d.ts +11 -3
  182. package/dist/usage/usage-api.js +61 -24
  183. package/dist/usage/usage-api.js.map +1 -1
  184. package/dist/workflow-templates/default.md +2 -1
  185. package/package.json +2 -2
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: worker-collaboration
3
+ description: Complete assigned fleet work as a worker, report the result to the assigning instance, and request missing information without taking over coordinator duties.
4
+ roles: [worker]
5
+ ---
6
+
7
+ # Worker Collaboration
8
+
9
+ ## Complete assigned work
10
+
11
+ - Treat the assignment as the full scope unless the sender explicitly expands it.
12
+ - Work without acknowledgment-only messages. Silence means the task is in progress.
13
+ - Do not call `delegate_task`; delegation and fleet orchestration belong to General.
14
+
15
+ ## Request missing information
16
+
17
+ Use `request_information` only when a concrete missing fact blocks safe progress. Ask the assigning instance one focused question and preserve the task correlation ID when the tool supports it.
18
+
19
+ Do not resend after a timeout without checking delivery evidence. A timeout can mean the request was queued or delivered while the caller stopped waiting.
20
+
21
+ ## Report the result
22
+
23
+ Call `report_result` exactly once when the assignment is complete or genuinely blocked. Send it to the assigning instance with the original correlation ID. Include:
24
+
25
+ - the conclusion or delivered artifact;
26
+ - material changes and file paths;
27
+ - tests or checks run and their results;
28
+ - remaining risk, blocker, or follow-up, if any.
29
+
30
+ Do not put user-facing results only in terminal text; the fleet report is the delivery channel.
@@ -5,6 +5,10 @@ import type { IpcClient } from "./channel/ipc-bridge.js";
5
5
  import type { EventLog } from "./event-log.js";
6
6
  import type { TmuxControlClient } from "./tmux-control.js";
7
7
  import type { FleetInstructionsParams } from "./instructions.js";
8
+ import { type ProviderUsage } from "./usage/providers.js";
9
+ import type { SpawnGate } from "./spawn-gate.js";
10
+ import type { StormWindow } from "./storm-window.js";
11
+ import type { BackendOutageTracker } from "./backend-outage.js";
8
12
  export { isFleetStartCommandLine } from "./fleet-lock.js";
9
13
  export interface BackendInstallationInfo {
10
14
  binary: string;
@@ -34,7 +38,21 @@ export interface LifecycleContext {
34
38
  readonly sessionRegistry: Map<string, string>;
35
39
  readonly eventLog: EventLog | null;
36
40
  readonly controlClient: TmuxControlClient | null;
41
+ readonly spawnGate?: SpawnGate;
42
+ readonly stormWindow?: StormWindow;
43
+ /** Fleet-level backend reachability memory (see backend-outage.ts). */
44
+ readonly backendOutage?: BackendOutageTracker;
37
45
  getInstanceDir(name: string): string;
46
+ /** Fleet-level (General topic) notification, throttled per message text. */
47
+ notifyFleetError?(text: string): void;
48
+ /** Hand a failed/blocked instance to the fleet's delayed automatic startup retry. */
49
+ scheduleStartupRetry?(name: string, attempt: number): void;
50
+ /**
51
+ * Stop THIS daemon (identity-checked) and schedule the delayed startup retry,
52
+ * serialized against operator stop/restart so neither can be undone by the
53
+ * other. Fleet-owned; the lifecycle falls back to stopIfCurrent without it.
54
+ */
55
+ handOffToStartupRetry?(name: string, daemon: unknown): Promise<void>;
38
56
  saveFleetConfig(): void;
39
57
  /** Full stop+start. freshStart forces the respawn to skip session resume. */
40
58
  restartSingleInstance(name: string, opts?: {
@@ -57,6 +75,8 @@ export interface LifecycleContext {
57
75
  isClassicInstance?(name: string): boolean;
58
76
  /** True while the fleet is stopping on purpose or an `agend update` is running. */
59
77
  isPlannedRestart(): boolean;
78
+ /** Suppress only incident kinds caused by the active tmux server storm. */
79
+ stormSuppressed?(kind: string): boolean;
60
80
  /** List claimed tasks for an instance (from task board). Returns empty array if unavailable. */
61
81
  listClaimedTasks(assignee: string): Array<{
62
82
  id: string;
@@ -66,6 +86,10 @@ export interface LifecycleContext {
66
86
  checkModelFailover(name: string, fiveHourPct: number): void;
67
87
  /** Retire (delete) any pending Cancel button for an instance. No-op if none. */
68
88
  clearCancelButton(name: string): void;
89
+ /** Test/integration seam for the non-LLM Codex quota second opinion. */
90
+ verifyCodexQuota?(): Promise<CodexQuotaVerdict>;
91
+ /** Test/integration seam for the non-LLM Claude quota second opinion. */
92
+ verifyClaudeQuota?(): Promise<ClaudeQuotaVerdict>;
69
93
  startStatuslineWatcher(name: string): void;
70
94
  stopStatuslineWatcher(name: string): void;
71
95
  reactMessageStatus(instanceName: string, chatId: string, messageId: string, emoji: string): void;
@@ -88,6 +112,8 @@ export interface LifecycleCreateArgs {
88
112
  description?: string;
89
113
  model?: string;
90
114
  backend?: string;
115
+ /** Backend-specific launch options, e.g. { codex: { provider: "glm" } }. */
116
+ backend_options?: Record<string, Record<string, unknown>>;
91
117
  branch?: string;
92
118
  detach?: boolean;
93
119
  worktree_path?: string;
@@ -111,12 +137,45 @@ export interface LifecycleReplaceArgs {
111
137
  name: string;
112
138
  reason?: string;
113
139
  }
140
+ export type CodexQuotaVerdict = "available" | "exhausted" | "unknown";
141
+ type CodexUsageResult = Omit<ProviderUsage, "id" | "name">;
142
+ export type ClaudeQuotaVerdict = "available" | "exhausted" | "unknown";
143
+ type ClaudeUsageResult = Omit<ProviderUsage, "id" | "name">;
144
+ /**
145
+ * Convert the live Codex usage row into a conservative quota verdict. A
146
+ * successful response with at least one window below 100% proves that stale
147
+ * terminal text is no longer current only when no other window is exhausted.
148
+ * Missing credentials, API errors, and metric-less responses prove nothing.
149
+ */
150
+ export declare function codexQuotaVerdictFromUsage(usage: CodexUsageResult): CodexQuotaVerdict;
151
+ /** Run only the Codex usage provider, bounded independently of its network timeout. */
152
+ export declare function verifyCodexQuotaStatus(fetchUsage?: () => Promise<CodexUsageResult>, timeoutMs?: number): Promise<CodexQuotaVerdict>;
153
+ /**
154
+ * Convert a LIVE Claude usage API row into a conservative verdict. The
155
+ * provider can degrade to statusline data when the network/API is unavailable;
156
+ * that fallback is intentionally unknown because stale local limits cannot
157
+ * disprove a current API credit-balance error.
158
+ */
159
+ export declare function claudeQuotaVerdictFromUsage(usage: ClaudeUsageResult): ClaudeQuotaVerdict;
160
+ /** Run only the Claude usage provider, bounded independently of its network timeout. */
161
+ export declare function verifyClaudeQuotaStatus(fetchUsage?: () => Promise<ClaudeUsageResult>, timeoutMs?: number): Promise<ClaudeQuotaVerdict>;
114
162
  export declare class InstanceLifecycle {
115
163
  private ctx;
116
164
  /** Active daemon processes: instanceName → Daemon */
117
165
  readonly daemons: Map<string, import("./daemon.js").Daemon>;
118
166
  /** backend → last auth-error alert time, so one expiry sends one alert. */
119
167
  private lastAuthAlertAt;
168
+ /**
169
+ * backend → cached token-free auth verification (see AUTH_VERIFY_CACHE_MS).
170
+ * The PROMISE is cached, not the result: a shared credential expiring makes
171
+ * every instance of the backend fire in the same tick, and they must join
172
+ * one in-flight check instead of each spawning their own.
173
+ */
174
+ private authVerifyCache;
175
+ /** Same-tick Codex quota alerts join one live usage probe. */
176
+ private codexQuotaVerifyInFlight;
177
+ /** Same-tick Claude quota alerts join one live usage probe. */
178
+ private claudeQuotaVerifyInFlight;
120
179
  /**
121
180
  * Minimum gap between MCP-revival auto-restarts of one instance. Kept here —
122
181
  * not in the daemon — because each restart replaces the daemon object, which
@@ -143,6 +202,27 @@ export declare class InstanceLifecycle {
143
202
  private notifyIncident;
144
203
  /** Backend a running instance uses (config → fleet default). */
145
204
  private backendOf;
205
+ /**
206
+ * Confirm a pane-detected auth error with the backend's token-free status
207
+ * probe before pausing anything: pattern matching over terminal text also
208
+ * fires on an agent DISCUSSING a 401. "valid" means false positive — ignore.
209
+ * "invalid" and "unknown" (timeout, missing binary) both pause: for a
210
+ * suspected expiry, pausing too much is recoverable, delivering into a dead
211
+ * CLI is not. Cached per backend so simultaneous alerts run one check.
212
+ */
213
+ private verifyAuthError;
214
+ private verifyCodexQuota;
215
+ private verifyClaudeQuota;
216
+ /** Same verification keyed by backend (used by startup pre-flight priming). */
217
+ verifyBackendAuth(backend: string): Promise<"valid" | "invalid" | "unknown">;
218
+ /**
219
+ * Startup pre-flight: warm the per-backend auth verification cache so the
220
+ * detectors that fire seconds later (login-screen scan, MCP-died gate) get an
221
+ * instant answer. Advisory only — a pre-flight result alone never pauses
222
+ * anything, because e.g. codex on a custom provider runs fine while
223
+ * `codex login status` reports logged out (live-verified on this fleet).
224
+ */
225
+ primeAuthVerification(backends: Iterable<string>): void;
146
226
  /**
147
227
  * One alert per backend per cooldown, naming every affected instance — a CLI's
148
228
  * credentials are shared, so N instances failing is ONE problem with ONE fix
@@ -150,6 +230,13 @@ export declare class InstanceLifecycle {
150
230
  * instances, so the fleet-level map does it here.
151
231
  */
152
232
  private notifyAuthErrorOnce;
233
+ /**
234
+ * A fleet-wide backend outage (see backend-outage.ts): record the sighting so
235
+ * startup stops spending `--resume` attempts on it, and notify ONCE per
236
+ * outage at fleet level — kiro prints the line every 10s on every instance,
237
+ * so per-instance incidents would be N × (one message per cooldown).
238
+ */
239
+ private noteBackendOutage;
153
240
  /**
154
241
  * System errors from a ClassicBot belong in the operator's General topic,
155
242
  * never in the end user's chat channel. Fleet-topic instances retain their
@@ -169,6 +256,18 @@ export declare class InstanceLifecycle {
169
256
  getLastPausedAt(name: string): number | null;
170
257
  pause(name: string): Promise<void>;
171
258
  wake(name: string, timeoutMs?: number): Promise<void>;
259
+ /**
260
+ * Ownership boundary for a daemon that is not yet registered: if start()
261
+ * rejects, nothing else will ever dispose it, so do it here before
262
+ * rethrowing. The abort is best-effort — the start error is the one to
263
+ * surface.
264
+ */
265
+ static startOrDispose(daemon: {
266
+ start(): Promise<void>;
267
+ abortStartup(): Promise<void>;
268
+ }, name: string, logger: Logger): Promise<void>;
269
+ /** Stop the registered daemon only if it is still `daemon` (a concurrent restart may have replaced it). */
270
+ stopIfCurrent(name: string, daemon: unknown): Promise<boolean>;
172
271
  stop(name: string): Promise<void>;
173
272
  remove(name: string): Promise<void>;
174
273
  /** Handle create_instance tool call from a daemon. */