@songsid/agend 2.1.4-beta.2 → 2.1.4-beta.21

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 (128) hide show
  1. package/dist/agent-endpoint.js +1 -1
  2. package/dist/agent-endpoint.js.map +1 -1
  3. package/dist/backend/antigravity.d.ts +1 -0
  4. package/dist/backend/antigravity.js +4 -0
  5. package/dist/backend/antigravity.js.map +1 -1
  6. package/dist/backend/claude-code.js +23 -2
  7. package/dist/backend/claude-code.js.map +1 -1
  8. package/dist/backend/codex.d.ts +17 -0
  9. package/dist/backend/codex.js +122 -7
  10. package/dist/backend/codex.js.map +1 -1
  11. package/dist/backend/kiro.d.ts +1 -0
  12. package/dist/backend/kiro.js +14 -0
  13. package/dist/backend/kiro.js.map +1 -1
  14. package/dist/backend/opencode.d.ts +27 -11
  15. package/dist/backend/opencode.js +48 -37
  16. package/dist/backend/opencode.js.map +1 -1
  17. package/dist/backend/types.d.ts +14 -0
  18. package/dist/backend/types.js +7 -0
  19. package/dist/backend/types.js.map +1 -1
  20. package/dist/channel/adapters/discord.js +76 -25
  21. package/dist/channel/adapters/discord.js.map +1 -1
  22. package/dist/channel/adapters/telegram.js +5 -3
  23. package/dist/channel/adapters/telegram.js.map +1 -1
  24. package/dist/channel/mcp-server.js +6 -20
  25. package/dist/channel/mcp-server.js.map +1 -1
  26. package/dist/channel/mcp-tools.js +4 -2
  27. package/dist/channel/mcp-tools.js.map +1 -1
  28. package/dist/channel/types.d.ts +1 -1
  29. package/dist/classic-channel-manager.d.ts +40 -3
  30. package/dist/classic-channel-manager.js +218 -31
  31. package/dist/classic-channel-manager.js.map +1 -1
  32. package/dist/cli.js +159 -36
  33. package/dist/cli.js.map +1 -1
  34. package/dist/completion-install.d.ts +70 -0
  35. package/dist/completion-install.js +152 -0
  36. package/dist/completion-install.js.map +1 -0
  37. package/dist/completion.d.ts +7 -1
  38. package/dist/completion.js +14 -4
  39. package/dist/completion.js.map +1 -1
  40. package/dist/config-validator.js +38 -7
  41. package/dist/config-validator.js.map +1 -1
  42. package/dist/config.d.ts +2 -0
  43. package/dist/config.js +10 -1
  44. package/dist/config.js.map +1 -1
  45. package/dist/daemon.d.ts +171 -5
  46. package/dist/daemon.js +696 -82
  47. package/dist/daemon.js.map +1 -1
  48. package/dist/doctor.d.ts +26 -0
  49. package/dist/doctor.js +216 -0
  50. package/dist/doctor.js.map +1 -0
  51. package/dist/fleet-context.d.ts +16 -0
  52. package/dist/fleet-manager.d.ts +233 -10
  53. package/dist/fleet-manager.js +1828 -493
  54. package/dist/fleet-manager.js.map +1 -1
  55. package/dist/fleet-yaml-slim.d.ts +10 -0
  56. package/dist/fleet-yaml-slim.js +59 -0
  57. package/dist/fleet-yaml-slim.js.map +1 -0
  58. package/dist/general-knowledge/skills/backend-providers/SKILL.md +114 -0
  59. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +3 -1
  60. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +52 -0
  61. package/dist/general-knowledge/skills/development-workflow/SKILL.md +28 -0
  62. package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -0
  63. package/dist/general-knowledge/skills/fleet-health/SKILL.md +1 -0
  64. package/dist/general-knowledge/skills/fleet-restart/SKILL.md +1 -0
  65. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -0
  66. package/dist/general-knowledge/skills/model-discovery/SKILL.md +64 -16
  67. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -0
  68. package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -0
  69. package/dist/general-knowledge/skills/session-management/SKILL.md +1 -0
  70. package/dist/general-knowledge/skills/tui-effort/SKILL.md +1 -0
  71. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +30 -0
  72. package/dist/instance-lifecycle.d.ts +8 -0
  73. package/dist/instance-lifecycle.js +46 -25
  74. package/dist/instance-lifecycle.js.map +1 -1
  75. package/dist/instructions.d.ts +12 -0
  76. package/dist/instructions.js +33 -0
  77. package/dist/instructions.js.map +1 -1
  78. package/dist/locale.js +656 -220
  79. package/dist/locale.js.map +1 -1
  80. package/dist/outbound-handlers.d.ts +8 -0
  81. package/dist/outbound-handlers.js +44 -5
  82. package/dist/outbound-handlers.js.map +1 -1
  83. package/dist/outbound-schemas.d.ts +5 -0
  84. package/dist/outbound-schemas.js +7 -0
  85. package/dist/outbound-schemas.js.map +1 -1
  86. package/dist/quickstart.js +25 -0
  87. package/dist/quickstart.js.map +1 -1
  88. package/dist/restart-progress.d.ts +9 -1
  89. package/dist/restart-progress.js +30 -6
  90. package/dist/restart-progress.js.map +1 -1
  91. package/dist/scheduler/db.d.ts +5 -0
  92. package/dist/scheduler/db.js +35 -0
  93. package/dist/scheduler/db.js.map +1 -1
  94. package/dist/service-installer.d.ts +11 -0
  95. package/dist/service-installer.js +84 -18
  96. package/dist/service-installer.js.map +1 -1
  97. package/dist/settings-api.js +1 -1
  98. package/dist/settings-api.js.map +1 -1
  99. package/dist/tips.d.ts +39 -0
  100. package/dist/tips.js +351 -0
  101. package/dist/tips.js.map +1 -0
  102. package/dist/tool-progress.d.ts +40 -0
  103. package/dist/tool-progress.js +289 -0
  104. package/dist/tool-progress.js.map +1 -0
  105. package/dist/topic-commands.d.ts +28 -4
  106. package/dist/topic-commands.js +227 -65
  107. package/dist/topic-commands.js.map +1 -1
  108. package/dist/transcript-monitor.d.ts +15 -2
  109. package/dist/transcript-monitor.js +63 -17
  110. package/dist/transcript-monitor.js.map +1 -1
  111. package/dist/transcript-sources.d.ts +106 -0
  112. package/dist/transcript-sources.js +428 -0
  113. package/dist/transcript-sources.js.map +1 -0
  114. package/dist/types.d.ts +11 -0
  115. package/dist/ui/dashboard.html +55 -32
  116. package/dist/ui/settings.html +120 -51
  117. package/dist/ui/view.html +23 -15
  118. package/dist/update-marker.d.ts +30 -0
  119. package/dist/update-marker.js +71 -20
  120. package/dist/update-marker.js.map +1 -1
  121. package/dist/update-progress.d.ts +6 -0
  122. package/dist/update-progress.js +29 -0
  123. package/dist/update-progress.js.map +1 -0
  124. package/dist/usage/usage-api.d.ts +8 -2
  125. package/dist/usage/usage-api.js +24 -3
  126. package/dist/usage/usage-api.js.map +1 -1
  127. package/dist/workflow-templates/default.md +2 -1
  128. package/package.json +1 -1
@@ -0,0 +1,10 @@
1
+ import type { RawFleetConfig } from "./types.js";
2
+ /**
3
+ * Instance identity/routing fields remain explicit even when they currently
4
+ * equal a fleet default. Removing one of these makes the YAML harder to audit
5
+ * and can change which external resource an instance represents.
6
+ */
7
+ export declare const PRESERVED_INSTANCE_FIELDS: Set<string>;
8
+ export type FleetConfigPath = Array<string | number>;
9
+ /** Return raw YAML leaf paths that are redundant with effective defaults. */
10
+ export declare function collectRedundantInstanceDefaultPaths(raw: RawFleetConfig): FleetConfigPath[];
@@ -0,0 +1,59 @@
1
+ import { isDeepStrictEqual } from "node:util";
2
+ import { getEffectiveInstanceDefaults } from "./config.js";
3
+ /**
4
+ * Instance identity/routing fields remain explicit even when they currently
5
+ * equal a fleet default. Removing one of these makes the YAML harder to audit
6
+ * and can change which external resource an instance represents.
7
+ */
8
+ export const PRESERVED_INSTANCE_FIELDS = new Set([
9
+ "working_directory",
10
+ "topic_id",
11
+ "channel_id",
12
+ "general_topic",
13
+ "description",
14
+ "tags",
15
+ "model",
16
+ "backend",
17
+ "backend_options",
18
+ "display_name",
19
+ "systemPrompt",
20
+ "worktree_source",
21
+ "profile",
22
+ ]);
23
+ function isRecord(value) {
24
+ return typeof value === "object" && value !== null && !Array.isArray(value);
25
+ }
26
+ function collectMatchingLeaves(value, inherited, path, output) {
27
+ if (isRecord(value) && isRecord(inherited)) {
28
+ for (const [key, child] of Object.entries(value)) {
29
+ if (Object.prototype.hasOwnProperty.call(inherited, key)) {
30
+ collectMatchingLeaves(child, inherited[key], [...path, key], output);
31
+ }
32
+ }
33
+ return;
34
+ }
35
+ // Arrays are leaf values here: a partial array cannot inherit safely.
36
+ if (isDeepStrictEqual(value, inherited))
37
+ output.push(path);
38
+ }
39
+ /** Return raw YAML leaf paths that are redundant with effective defaults. */
40
+ export function collectRedundantInstanceDefaultPaths(raw) {
41
+ const instances = raw.instances;
42
+ if (!instances || !isRecord(instances))
43
+ return [];
44
+ const effectiveDefaults = getEffectiveInstanceDefaults((raw.defaults ?? {}));
45
+ const redundant = [];
46
+ for (const [name, instance] of Object.entries(instances)) {
47
+ if (!isRecord(instance))
48
+ continue;
49
+ for (const [key, value] of Object.entries(instance)) {
50
+ if (PRESERVED_INSTANCE_FIELDS.has(key))
51
+ continue;
52
+ if (!Object.prototype.hasOwnProperty.call(effectiveDefaults, key))
53
+ continue;
54
+ collectMatchingLeaves(value, effectiveDefaults[key], ["instances", name, key], redundant);
55
+ }
56
+ }
57
+ return redundant;
58
+ }
59
+ //# sourceMappingURL=fleet-yaml-slim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleet-yaml-slim.js","sourceRoot":"","sources":["../src/fleet-yaml-slim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAG3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IAC/C,mBAAmB;IACnB,UAAU;IACV,YAAY;IACZ,eAAe;IACf,aAAa;IACb,MAAM;IACN,OAAO;IACP,SAAS;IACT,iBAAiB;IACjB,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,SAAS;CACV,CAAC,CAAC;AAIH,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,qBAAqB,CAC5B,KAAc,EACd,SAAkB,EAClB,IAAqB,EACrB,MAAyB;IAEzB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC;gBACzD,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;QACD,OAAO;IACT,CAAC;IAED,sEAAsE;IACtE,IAAI,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC;QAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,oCAAoC,CAClD,GAAmB;IAEnB,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;IAChC,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,EAAE,CAAC;IAElD,MAAM,iBAAiB,GAAG,4BAA4B,CACpD,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAA4B,CACrB,CAAC;IAC7B,MAAM,SAAS,GAAsB,EAAE,CAAC;IAExC,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACzD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,SAAS;QAClC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,IAAI,yBAAyB,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,SAAS;YACjD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC;gBAAE,SAAS;YAC5E,qBAAqB,CACnB,KAAK,EACL,iBAAiB,CAAC,GAAG,CAAC,EACtB,CAAC,WAAW,EAAE,IAAI,EAAE,GAAG,CAAC,EACxB,SAAS,CACV,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: backend-providers
3
+ description: Configure custom model providers when creating or editing AgEnD Codex or OpenCode instances. Use for local, OpenAI-compatible, GLM, or other non-default provider endpoints and for backend_options provider selection.
4
+ roles: [general]
5
+ ---
6
+
7
+ # Backend Providers
8
+
9
+ AgEnD selects a provider; the backend CLI owns endpoint and credential definitions.
10
+
11
+ ## Choose the backend
12
+
13
+ | Backend | Provider configuration |
14
+ |---|---|
15
+ | Codex | Select with `backend_options.codex.provider`; define the provider in Codex `config.toml`. |
16
+ | OpenCode | Define the provider in `opencode.json`; use model ID `<provider>/<model>`. |
17
+ | Claude Code, Kiro CLI, Antigravity, Grok | Provider is fixed by the CLI; do not set `backend_options` for provider selection. |
18
+
19
+ ## Create a Codex custom-provider instance
20
+
21
+ 1. Define the provider in the fleet user's `~/.codex/config.toml`. The table name is the provider ID used by AgEnD:
22
+
23
+ ```toml
24
+ [model_providers.glm]
25
+ name = "GLM"
26
+ base_url = "https://provider.example.com/v1"
27
+ env_key = "GLM_API_KEY"
28
+ ```
29
+
30
+ Keep credentials out of `config.toml`. `env_key` names an environment variable; it is not the secret itself.
31
+
32
+ 2. Put the credential in the fleet process environment before startup. `~/.agend/.env` is the usual location:
33
+
34
+ ```dotenv
35
+ GLM_API_KEY=replace-with-the-real-secret
36
+ ```
37
+
38
+ Restart the fleet after changing its environment. Exporting a variable in an unrelated shell after the fleet has started does not update the running fleet process.
39
+
40
+ 3. Create the instance with the MCP tool:
41
+
42
+ ```json
43
+ {
44
+ "directory": "/home/user/projects/my-project",
45
+ "topic_name": "glm-worker",
46
+ "backend": "codex",
47
+ "model": "GLM-5.2",
48
+ "backend_options": {
49
+ "codex": {
50
+ "provider": "glm"
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ The equivalent per-instance fleet.yaml override is:
57
+
58
+ ```yaml
59
+ instances:
60
+ glm-worker:
61
+ working_directory: /home/user/projects/my-project
62
+ backend: codex
63
+ model: GLM-5.2
64
+ backend_options:
65
+ codex:
66
+ provider: glm
67
+ ```
68
+
69
+ AgEnD copies the user's Codex settings into the instance-isolated `CODEX_HOME`, then launches Codex with `model_provider="glm"`. Provider IDs may contain only letters, digits, `_`, and `-`.
70
+
71
+ ## Configure OpenCode
72
+
73
+ Define the endpoint, SDK adapter, credentials, and models in OpenCode's `opencode.json` provider block:
74
+
75
+ ```json
76
+ {
77
+ "$schema": "https://opencode.ai/config.json",
78
+ "provider": {
79
+ "glm": {
80
+ "npm": "@ai-sdk/openai-compatible",
81
+ "name": "GLM",
82
+ "options": {
83
+ "baseURL": "https://provider.example.com/v1",
84
+ "apiKey": "{env:GLM_API_KEY}"
85
+ },
86
+ "models": {
87
+ "GLM-5.2": {
88
+ "name": "GLM-5.2"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ Then use the fully qualified model ID in AgEnD:
97
+
98
+ ```yaml
99
+ instances:
100
+ glm-opencode:
101
+ working_directory: /home/user/projects/my-project
102
+ backend: opencode
103
+ model: glm/GLM-5.2
104
+ ```
105
+
106
+ OpenCode provider IDs and model IDs come from its own config. Do not use `backend_options.codex.provider` for OpenCode.
107
+
108
+ ## Verify and troubleshoot
109
+
110
+ - Run `validate_config` before reload or restart.
111
+ - Use `describe_instance` to verify the effective backend and model after creation.
112
+ - If Codex says the provider is unknown, verify the `[model_providers.<id>]` table is in `~/.codex/config.toml` before the instance starts.
113
+ - If authentication fails, verify the variable named by `env_key` exists in the fleet process environment; never paste the secret into fleet.yaml or `backend_options`.
114
+ - A model-metadata fallback warning can be normal for a custom model with no built-in metadata. Provider connection, authentication, or unsupported-model errors are not normal and should still be investigated.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: cross-instance-messaging
3
3
  description: Fire-and-queue cross-instance tools — send once, never resend on queued
4
+ roles: [general, worker]
4
5
  ---
5
6
 
6
7
  ## How to send
@@ -18,5 +19,6 @@ Use fleet tools only (`send_to_instance`, `delegate_task`, `request_information`
18
19
 
19
20
  ## Task flow
20
21
 
21
- - `delegate_task` → silent work → `report_result` (zero ack-only pings)
22
+ - Coordinator flow: `delegate_task` → silent work → `report_result` (zero ack-only pings).
23
+ - Worker flow: finish with `report_result`, or use `request_information` when blocked. A normal worker must not call `delegate_task` or re-delegate work.
22
24
  - Cross-instance traffic is `[from:name]` → answer with `send_to_instance` / `report_result`, never `reply`
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: delegation-playbook
3
+ description: Delegation protocol, loop prevention, parallel vs sequential execution, result/failure handling, team management, and instance configuration tips for the fleet coordinator
4
+ roles: [general]
5
+ ---
6
+
7
+ ## Delegation Protocol
8
+
9
+ Every delegation via send_to_instance() MUST include:
10
+
11
+ 1. Task scope — what exactly to do, bounded clearly
12
+ 2. Expected output — what to return and in what form
13
+ 3. Policy reminder — "Follow Development Workflow policy" (for code tasks)
14
+
15
+ ### Loop Prevention
16
+
17
+ - Never re-delegate a task back to the instance that sent it to you
18
+ - If a task has bounced 3 times, stop and solve locally or reduce scope
19
+
20
+ ### Execution Strategy
21
+
22
+ - Parallel — use only when tasks are independent with no shared state
23
+ - Sequential — use when one task's output feeds into the next
24
+
25
+ ## Result Handling
26
+
27
+ When an instance reports back, classify the outcome:
28
+
29
+ - Success → Summarize key results for user. Omit internal coordination noise.
30
+ - Partial → State what succeeded, what remains, proposed next steps.
31
+ - Failure → Retry up to 2 times. If still failing: try alternative instance, reduce scope, or return partial result clearly marked.
32
+ - No response → Ping again after reasonable wait. If still silent: report to user with options.
33
+
34
+ ## Shared Decisions
35
+
36
+ Use post_decision() / list_decisions() for any choice that affects more than 1 instance, changes an API contract, introduces a new dependency, or alters deployment process.
37
+
38
+ When instances disagree, collect both viewpoints, make a decision, and record it via post_decision.
39
+
40
+ ## Team Management
41
+
42
+ - Always check existing teams before creating new ones
43
+ - Default to ephemeral teams (created for a specific task, dissolved after completion)
44
+ - Clean up ephemeral teams and instances after task completion
45
+
46
+ ## Instance Configuration Tips
47
+
48
+ When users create specialized instances, suggest these configurations:
49
+
50
+ - **Reviewer instances**: Add `pre_task_command: "/chat load reviewer-base"` to reset context before each review, preventing influence from previous conversations.
51
+ - **Collab mode**: For multi-bot channels, use `/collab` to enable @mention-based triggering.
52
+ - **Cost control**: Set per-instance `cost_guard` for expensive backends.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: development-workflow
3
+ description: The fleet-wide code-change policy the coordinator enforces when delegating code tasks — stages, review pairing, merge conditions
4
+ roles: [general]
5
+ ---
6
+
7
+ All code changes across the fleet should follow this workflow.
8
+ The coordinator enforces compliance but does not perform these steps directly.
9
+ Remind instances of this policy when delegating code tasks.
10
+
11
+ ## Workflow Stages
12
+
13
+ Design Proposed → Design Approved → Implementation → Submit for Review → Under Review → Approved → Merge
14
+
15
+ ## Policy Rules
16
+
17
+ 1. Design before code — developer sends design proposal to reviewer before implementation. Consensus required before proceeding.
18
+ 2. Challenger pairing — every code task should have a developer + reviewer. Reviewer actively questions decisions and finds risks.
19
+ 3. Verify by execution — backend/CLI changes must be tested by running them. Do not trust documentation alone.
20
+ 4. Independent review — every merge requires code review from someone other than the author.
21
+ 5. Root cause first — bug fixes require confirmed root cause before proposing a fix.
22
+ 6. Merge conditions: tests pass, reviewer approved, branch and worktree cleaned up.
23
+
24
+ ## Specialist Instance Rules
25
+
26
+ - Execute within defined scope only
27
+ - Return structured output: result, assumptions, uncertainties, verification status
28
+ - Do NOT create new instances without coordinator approval
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: fleet-config
3
3
  description: fleet.yaml and classicBot.yaml structure, validation, common mistakes
4
+ roles: [general]
4
5
  ---
5
6
 
6
7
  ## Configuration Quick Reference
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: fleet-health
3
3
  description: Check instance health and what an agent is doing; recover a stuck instance
4
+ roles: [general]
4
5
  ---
5
6
 
6
7
  ## Check health
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: fleet-restart
3
3
  description: Fleet restart types, recovery from tmux crash, rate limit handling, safe update
4
+ roles: [general]
4
5
  ---
5
6
 
6
7
  ## Fleet Restart & Recovery
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: instance-lifecycle
3
3
  description: restart vs replace vs pause/wake; when to use each
4
+ roles: [general]
4
5
  ---
5
6
 
6
7
  ## Restart vs Replace
@@ -1,27 +1,75 @@
1
1
  ---
2
2
  name: model-discovery
3
- description: Set and discover models — pass-through to the CLI, no AgEnD allowlist gate
3
+ description: Choose and discover models — when to omit, per-backend defaults, pass-through
4
+ roles: [general, worker]
4
5
  ---
5
6
 
6
- ## How to set a model
7
+ ## Omit the model unless you have a reason
7
8
 
8
- - fleet.yaml: `defaults.model` or per-instance `model`
9
- - **Pass-through:** AgEnD no longer blocks unknown model ids — it may **warn**, then still pass the string to the CLI
10
- - **CLI is source of truth** — if the model is invalid, the backend CLI errors (fix the name there)
9
+ Precedence: **explicit arg > `fleet.defaults.model` > CLI/account default**
10
+
11
+ Omitting is the default answer. It inherits the fleet default, or the CLI's own —
12
+ which is the account's current best model and stays right as the vendor ships new
13
+ ones. A model you pin today is a model someone has to un-pin later.
14
+
15
+ Pass a model only when: the user named one, the instance needs a *specific*
16
+ capability (cheap/fast vs deep reasoning), or the backend needs one to behave
17
+ (see kiro below).
18
+
19
+ ## Per-backend default behaviour
20
+
21
+ | Backend | Omit `model` means | Notes |
22
+ |---|---|---|
23
+ | kiro-cli | account default | **`model: auto`** lets kiro pick per turn — usually what you want |
24
+ | claude-code | account default | ids are aliases: `sonnet`, `opus`, `haiku`, `opusplan`, `default` |
25
+ | codex | account default | |
26
+ | grok | account default | |
27
+ | antigravity | account default | |
28
+ | opencode | provider default | ids are **`provider/model`**, e.g. `opencode/big-pickle` |
11
29
 
12
30
  ## Discover real names
13
31
 
14
- | Backend | How |
15
- |---------|-----|
16
- | kiro-cli | In pane: `/model` (gpt-*, deepseek-*, minimax-*, glm-*, qwen* supported) |
17
- | claude-code | `sonnet` / `opus` / `haiku` / `opusplan` / `Fable` / aliases |
18
- | codex | pane `/model` or docs (`gpt-*`, `o*`) |
32
+ **Use the `list_models` tool** — it reads the fleet's probe cache (refreshed every
33
+ 24h) and falls back to a live probe:
34
+
35
+ - `list_models({ backend: "kiro-cli" })` → the account catalog
36
+ - `list_models({ instance_name: "x" })` → read through **that instance's** config
37
+
38
+ Check `scope` in the reply. An instance on a custom provider can offer a
39
+ different catalog than the account (a Codex instance with `provider: glm` reads
40
+ its own catalog), so `scope: "instance"` is authoritative for that instance and
41
+ `scope: "global"` is only the account-wide list. `source` tells you `cache` /
42
+ `live` / `fallback`.
43
+
44
+ An empty list is **not** a failure — see pass-through below.
45
+
46
+ Underlying commands, if you need them by hand:
47
+
48
+ | Backend | Command |
49
+ |---|---|
50
+ | kiro-cli | `kiro-cli --list-models` |
19
51
  | grok | `grok models` |
20
- | antigravity | `agy models` — set **base name only** (drop `(Medium)` / `(Thinking)` effort suffix) |
21
52
  | opencode | `opencode models` |
53
+ | antigravity | `agy models` |
54
+ | codex | **no command** — the CLI writes `models_cache.json` in its CODEX_HOME |
55
+ | claude-code | fixed alias set (no command) |
56
+
57
+ ## Setting one on create_instance
58
+
59
+ - No specific need → **omit `model`**
60
+ - Kiro, want per-turn selection → `model: "auto"`
61
+ - Custom provider → pass the **full id** and set `backend_options`, e.g.
62
+ `backend: "codex"`, `backend_options: { codex: { provider: "glm" } }`
63
+ - opencode → always `provider/model`, never a bare model name
64
+
65
+ ## Two traps
66
+
67
+ **antigravity: keep the effort suffix.** The suffix is part of the selectable id,
68
+ not decoration — `gemini-3.6-flash-medium` and `gemini-3.6-flash-low` are
69
+ different models. Take the id from `list_models`, not the display label the TUI
70
+ shows (`Gemini 3.5 Flash (Medium)`).
22
71
 
23
- ```yaml
24
- defaults:
25
- backend: kiro-cli
26
- model: claude-sonnet-4-20250514
27
- ```
72
+ **Pass-through: AgEnD does not gate model names.** An unknown id is warned about,
73
+ then handed to the CLI anyway. So a name missing from `list_models` may still be
74
+ valid, and a typo fails *in the CLI at launch*, not at config time — if an
75
+ instance won't start after a model change, suspect the name first.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: multi-channel
3
3
  description: Setting up multiple platforms (Telegram + Discord) with proper general routing
4
+ roles: [general]
4
5
  ---
5
6
 
6
7
  ## Multi-Channel Setup
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: scheduling
3
3
  description: Cron, one-shot, and silent schedules via the schedule MCP tools
4
+ roles: [general, worker]
4
5
  ---
5
6
 
6
7
  ## Tools
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: session-management
3
3
  description: Session stores, forking, and auth-pause recovery
4
+ roles: [general]
4
5
  ---
5
6
 
6
7
  ## Auth failure (auto-pause)
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: tui-effort
3
3
  description: 在 Kiro CLI TUI instance 中,透過 tmux 查看或設定模型的 reasoning effort
4
+ roles: [general]
4
5
  ---
5
6
 
6
7
  # Kiro TUI Effort
@@ -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.
@@ -51,6 +51,8 @@ export interface LifecycleContext {
51
51
  notifyInstanceTopic(name: string, text: string): void;
52
52
  /** Notify the blocked instance and offer an interactive assist action in General. */
53
53
  notifyInteractivePrompt(name: string, kind: string): Promise<void>;
54
+ /** Notify a clean CLI exit and offer an admin-only restart action in General. */
55
+ notifyNormalExit(name: string): Promise<void>;
54
56
  /** True for a dynamic ClassicBot channel instance (not a fleet topic). */
55
57
  isClassicInstance?(name: string): boolean;
56
58
  /** True while the fleet is stopping on purpose or an `agend update` is running. */
@@ -73,6 +75,10 @@ export interface LifecycleContext {
73
75
  export interface IncidentEventSource {
74
76
  on(event: string, handler: (...args: any[]) => void): unknown;
75
77
  requestPauseWhenIdle(): void;
78
+ /** Present on real daemons; hang buttons attach only when it returns one. */
79
+ getHangDetector?(): {
80
+ on(event: string, handler: (...args: any[]) => void): unknown;
81
+ } | null;
76
82
  }
77
83
  /** Arguments accepted by handleCreate — mirrors CreateInstanceArgs in outbound-schemas.ts
78
84
  * plus internal-only fields forwarded by deploy_template (profile-derived). */
@@ -82,6 +88,8 @@ export interface LifecycleCreateArgs {
82
88
  description?: string;
83
89
  model?: string;
84
90
  backend?: string;
91
+ /** Backend-specific launch options, e.g. { codex: { provider: "glm" } }. */
92
+ backend_options?: Record<string, Record<string, unknown>>;
85
93
  branch?: string;
86
94
  detach?: boolean;
87
95
  worktree_path?: string;
@@ -165,6 +165,39 @@ export class InstanceLifecycle {
165
165
  * means a real tmux window, which is why this rule went untested before.
166
166
  */
167
167
  attachIncidentHandlers(name, daemon) {
168
+ const hangDetector = daemon.getHangDetector?.();
169
+ if (hangDetector) {
170
+ hangDetector.on("hang", safeHandler(async (data) => {
171
+ this.ctx.eventLog?.insert(name, "hang_detected", {});
172
+ this.ctx.logger.warn({ name }, "Instance appears hung");
173
+ if (this.ctx.isPlannedRestart()) {
174
+ // A graceful stop makes every pane look frozen; alerting on that (with
175
+ // a restart button, no less) during `agend update` is pure noise. The
176
+ // same suppression interactive-prompt and normal-exit already apply.
177
+ // Checked BEFORE the task nudge: injecting new work into a CLI that is
178
+ // being shut down would only delay the stop.
179
+ this.ctx.logger.info({ name }, "Hang notification suppressed — planned restart in progress");
180
+ return;
181
+ }
182
+ // Check if instance has claimed tasks — nudge it to continue
183
+ const claimedTasks = this.ctx.listClaimedTasks(name);
184
+ if (claimedTasks.length > 0) {
185
+ const task = claimedTasks[0];
186
+ this.ctx.eventLog?.insert(name, "idle_task_nudge", { taskId: task.id, taskTitle: task.title });
187
+ // Inject nudge message into the instance's CLI session
188
+ const ipc = this.ctx.instanceIpcClients.get(name);
189
+ if (ipc?.connected) {
190
+ ipc.send({
191
+ type: "fleet_inbound",
192
+ content: `[system] You have a claimed task: "${task.title}" (#${task.id}). Continue working on it, or use task(done) / task(update, status=blocked) to update status.`,
193
+ meta: { chat_id: "", thread_id: "", ts: new Date().toISOString() },
194
+ });
195
+ }
196
+ }
197
+ await this.ctx.sendHangNotification(name, data?.unchangedForMs);
198
+ this.ctx.webhookEmit("hang", name);
199
+ }, this.ctx.logger, `hangDetector[${name}]`));
200
+ }
168
201
  daemon.on("crash_respawn", safeHandler(() => {
169
202
  this.ctx.eventLog?.insert(name, "crash_respawn", {});
170
203
  this.ctx.logger.warn({ name }, "Instance crashed and respawned");
@@ -178,11 +211,22 @@ export class InstanceLifecycle {
178
211
  this.ctx.eventLog?.insert(name, "snapshot_failed", {});
179
212
  this.notifyIncident(name, "snapshot_failed", t("inst.restarted_no_context", name));
180
213
  }, this.ctx.logger, `daemon.snapshot_failed[${name}]`));
181
- daemon.on("supervision_ended", safeHandler((data) => {
214
+ daemon.on("supervision_ended", safeHandler(async (data) => {
182
215
  // The instance is dead and nothing will restart it. Say so where the operator
183
216
  // is looking, and mark the topic — otherwise messages routed here just queue
184
217
  // or fail with a bare ❌ and the dashboard still looks normal.
185
218
  this.ctx.eventLog?.insert(name, "supervision_ended", { reason: data.reason });
219
+ if (data.exitCode === 0) {
220
+ this.ctx.logger.info({ name, exitCode: data.exitCode }, "CLI exited normally and will not restart automatically");
221
+ if (this.ctx.isPlannedRestart()) {
222
+ this.ctx.logger.info({ name }, "Normal-exit controls suppressed — planned restart in progress");
223
+ }
224
+ else {
225
+ await this.ctx.notifyNormalExit(name);
226
+ }
227
+ this.ctx.setTopicIcon(name, "red");
228
+ return;
229
+ }
186
230
  this.ctx.logger.error({ name, reason: data.reason }, "Instance is no longer supervised");
187
231
  this.notifyIncident(name, "supervision_ended", `🛑 ${name} is no longer running and will not be restarted automatically — ${data.reason}.\n${data.remedy}`);
188
232
  this.ctx.setTopicIcon(name, "red");
@@ -349,30 +393,6 @@ export class InstanceLifecycle {
349
393
  });
350
394
  await daemon.start();
351
395
  this.daemons.set(name, daemon);
352
- const hangDetector = daemon.getHangDetector();
353
- if (hangDetector) {
354
- hangDetector.on("hang", safeHandler(async (data) => {
355
- this.ctx.eventLog?.insert(name, "hang_detected", {});
356
- this.ctx.logger.warn({ name }, "Instance appears hung");
357
- // Check if instance has claimed tasks — nudge it to continue
358
- const claimedTasks = this.ctx.listClaimedTasks(name);
359
- if (claimedTasks.length > 0) {
360
- const task = claimedTasks[0];
361
- this.ctx.eventLog?.insert(name, "idle_task_nudge", { taskId: task.id, taskTitle: task.title });
362
- // Inject nudge message into the instance's CLI session
363
- const ipc = this.ctx.instanceIpcClients.get(name);
364
- if (ipc?.connected) {
365
- ipc.send({
366
- type: "fleet_inbound",
367
- content: `[system] You have a claimed task: "${task.title}" (#${task.id}). Continue working on it, or use task(done) / task(update, status=blocked) to update status.`,
368
- meta: { chat_id: "", thread_id: "", ts: new Date().toISOString() },
369
- });
370
- }
371
- }
372
- await this.ctx.sendHangNotification(name, data?.unchangedForMs);
373
- this.ctx.webhookEmit("hang", name);
374
- }, this.ctx.logger, `hangDetector[${name}]`));
375
- }
376
396
  daemon.on("auto_pause_requested", safeHandler(async () => {
377
397
  await this.pause(name);
378
398
  }, this.ctx.logger, `autoPause[${name}]`));
@@ -782,6 +802,7 @@ export class InstanceLifecycle {
782
802
  ...(systemPrompt ? { systemPrompt } : {}),
783
803
  ...(args.model ? { model: args.model } : {}),
784
804
  ...(args.backend ? { backend: args.backend } : {}),
805
+ ...(args.backend_options ? { backend_options: args.backend_options } : {}),
785
806
  ...(args.model_failover ? { model_failover: args.model_failover } : {}),
786
807
  ...(args.tool_set ? { tool_set: args.tool_set } : {}),
787
808
  ...(args.skipPermissions != null ? { skipPermissions: args.skipPermissions } : {}),