@songsid/agend 2.1.4-beta.4 → 2.1.4-beta.41
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.
- package/README.md +1 -1
- package/README.zh-TW.md +1 -1
- package/dist/agent-endpoint.js +1 -1
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/backend/antigravity.d.ts +9 -5
- package/dist/backend/antigravity.js +156 -31
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/claude-code.d.ts +62 -23
- package/dist/backend/claude-code.js +296 -43
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex.d.ts +18 -0
- package/dist/backend/codex.js +148 -8
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/gemini-cli.js +2 -2
- package/dist/backend/gemini-cli.js.map +1 -1
- package/dist/backend/grok.js +2 -2
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/kiro.d.ts +2 -0
- package/dist/backend/kiro.js +24 -3
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/opencode.d.ts +27 -11
- package/dist/backend/opencode.js +65 -41
- package/dist/backend/opencode.js.map +1 -1
- package/dist/backend/types.d.ts +45 -3
- package/dist/backend/types.js +12 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +44 -2
- package/dist/channel/adapters/discord.js +526 -78
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +30 -0
- package/dist/channel/adapters/telegram.js +212 -18
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/agy-mcp-launcher.d.ts +2 -0
- package/dist/channel/agy-mcp-launcher.js +28 -0
- package/dist/channel/agy-mcp-launcher.js.map +1 -0
- package/dist/channel/ipc-bridge.d.ts +2 -1
- package/dist/channel/ipc-bridge.js +33 -4
- package/dist/channel/ipc-bridge.js.map +1 -1
- package/dist/channel/mcp-server.js +28 -25
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.js +4 -2
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/message-queue.js +62 -1
- package/dist/channel/message-queue.js.map +1 -1
- package/dist/channel/types.d.ts +31 -1
- package/dist/classic-channel-manager.d.ts +40 -3
- package/dist/classic-channel-manager.js +218 -31
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/cli.js +109 -37
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +48 -7
- package/dist/config-validator.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js +12 -1
- package/dist/config.js.map +1 -1
- package/dist/cross-instance-envelope.d.ts +6 -0
- package/dist/cross-instance-envelope.js +30 -0
- package/dist/cross-instance-envelope.js.map +1 -0
- package/dist/daemon.d.ts +319 -9
- package/dist/daemon.js +1402 -255
- package/dist/daemon.js.map +1 -1
- package/dist/doctor.d.ts +41 -0
- package/dist/doctor.js +267 -0
- package/dist/doctor.js.map +1 -0
- package/dist/fleet-context.d.ts +47 -0
- package/dist/fleet-manager.d.ts +265 -11
- package/dist/fleet-manager.js +2273 -455
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-yaml-slim.d.ts +10 -0
- package/dist/fleet-yaml-slim.js +59 -0
- package/dist/fleet-yaml-slim.js.map +1 -0
- package/dist/general-knowledge/skills/backend-providers/SKILL.md +114 -0
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +3 -1
- package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +52 -0
- package/dist/general-knowledge/skills/development-workflow/SKILL.md +28 -0
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -0
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +1 -0
- package/dist/general-knowledge/skills/fleet-restart/SKILL.md +1 -0
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -0
- package/dist/general-knowledge/skills/model-discovery/SKILL.md +64 -16
- package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -0
- package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -0
- package/dist/general-knowledge/skills/session-management/SKILL.md +1 -0
- package/dist/general-knowledge/skills/tui-effort/SKILL.md +1 -0
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +30 -0
- package/dist/instance-lifecycle.d.ts +67 -0
- package/dist/instance-lifecycle.js +273 -8
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +12 -0
- package/dist/instructions.js +35 -1
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +966 -288
- package/dist/locale.js.map +1 -1
- package/dist/login-flows.d.ts +91 -0
- package/dist/login-flows.js +170 -0
- package/dist/login-flows.js.map +1 -0
- package/dist/login-manager.d.ts +63 -0
- package/dist/login-manager.js +134 -0
- package/dist/login-manager.js.map +1 -0
- package/dist/network-family.d.ts +18 -0
- package/dist/network-family.js +20 -0
- package/dist/network-family.js.map +1 -0
- package/dist/outbound-handlers.d.ts +8 -0
- package/dist/outbound-handlers.js +101 -18
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +7 -1
- package/dist/outbound-schemas.js +9 -0
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/reply-dedup.d.ts +7 -8
- package/dist/reply-dedup.js +0 -0
- package/dist/reply-dedup.js.map +1 -1
- package/dist/restart-progress.d.ts +2 -0
- package/dist/restart-progress.js +3 -0
- package/dist/restart-progress.js.map +1 -1
- package/dist/scheduler/db.d.ts +12 -0
- package/dist/scheduler/db.js +59 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/service-installer.d.ts +11 -0
- package/dist/service-installer.js +84 -18
- package/dist/service-installer.js.map +1 -1
- package/dist/settings-api.js +1 -1
- package/dist/settings-api.js.map +1 -1
- package/dist/setup-wizard.js +2 -2
- package/dist/setup-wizard.js.map +1 -1
- package/dist/spawn-gate.d.ts +30 -0
- package/dist/spawn-gate.js +79 -0
- package/dist/spawn-gate.js.map +1 -0
- package/dist/storm-window.d.ts +83 -0
- package/dist/storm-window.js +251 -0
- package/dist/storm-window.js.map +1 -0
- package/dist/tips.d.ts +44 -0
- package/dist/tips.js +355 -0
- package/dist/tips.js.map +1 -0
- package/dist/tmux-manager.d.ts +16 -0
- package/dist/tmux-manager.js +110 -25
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tool-progress.d.ts +40 -0
- package/dist/tool-progress.js +289 -0
- package/dist/tool-progress.js.map +1 -0
- package/dist/topic-commands.d.ts +42 -4
- package/dist/topic-commands.js +361 -67
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-monitor.d.ts +15 -2
- package/dist/transcript-monitor.js +63 -17
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-sources.d.ts +131 -0
- package/dist/transcript-sources.js +580 -0
- package/dist/transcript-sources.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/ui/dashboard.html +55 -32
- package/dist/ui/settings.html +200 -60
- package/dist/ui/view.html +147 -30
- package/dist/usage/format-rich.js +24 -23
- package/dist/usage/format-rich.js.map +1 -1
- package/dist/usage/i18n-keys.d.ts +7 -0
- package/dist/usage/i18n-keys.js +34 -0
- package/dist/usage/i18n-keys.js.map +1 -0
- package/dist/usage/i18n.d.ts +5 -0
- package/dist/usage/i18n.js +27 -0
- package/dist/usage/i18n.js.map +1 -0
- package/dist/usage/providers.d.ts +19 -0
- package/dist/usage/providers.js +150 -74
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.d.ts +8 -2
- package/dist/usage/usage-api.js +45 -23
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/workflow-templates/default.md +2 -1
- package/package.json +2 -2
|
@@ -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,27 +1,75 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: model-discovery
|
|
3
|
-
description:
|
|
3
|
+
description: Choose and discover models — when to omit, per-backend defaults, pass-through
|
|
4
|
+
roles: [general, worker]
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
##
|
|
7
|
+
## Omit the model unless you have a reason
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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.
|
|
@@ -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,9 @@ 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";
|
|
8
11
|
export { isFleetStartCommandLine } from "./fleet-lock.js";
|
|
9
12
|
export interface BackendInstallationInfo {
|
|
10
13
|
binary: string;
|
|
@@ -34,6 +37,8 @@ export interface LifecycleContext {
|
|
|
34
37
|
readonly sessionRegistry: Map<string, string>;
|
|
35
38
|
readonly eventLog: EventLog | null;
|
|
36
39
|
readonly controlClient: TmuxControlClient | null;
|
|
40
|
+
readonly spawnGate?: SpawnGate;
|
|
41
|
+
readonly stormWindow?: StormWindow;
|
|
37
42
|
getInstanceDir(name: string): string;
|
|
38
43
|
saveFleetConfig(): void;
|
|
39
44
|
/** Full stop+start. freshStart forces the respawn to skip session resume. */
|
|
@@ -57,6 +62,8 @@ export interface LifecycleContext {
|
|
|
57
62
|
isClassicInstance?(name: string): boolean;
|
|
58
63
|
/** True while the fleet is stopping on purpose or an `agend update` is running. */
|
|
59
64
|
isPlannedRestart(): boolean;
|
|
65
|
+
/** Suppress only incident kinds caused by the active tmux server storm. */
|
|
66
|
+
stormSuppressed?(kind: string): boolean;
|
|
60
67
|
/** List claimed tasks for an instance (from task board). Returns empty array if unavailable. */
|
|
61
68
|
listClaimedTasks(assignee: string): Array<{
|
|
62
69
|
id: string;
|
|
@@ -66,6 +73,10 @@ export interface LifecycleContext {
|
|
|
66
73
|
checkModelFailover(name: string, fiveHourPct: number): void;
|
|
67
74
|
/** Retire (delete) any pending Cancel button for an instance. No-op if none. */
|
|
68
75
|
clearCancelButton(name: string): void;
|
|
76
|
+
/** Test/integration seam for the non-LLM Codex quota second opinion. */
|
|
77
|
+
verifyCodexQuota?(): Promise<CodexQuotaVerdict>;
|
|
78
|
+
/** Test/integration seam for the non-LLM Claude quota second opinion. */
|
|
79
|
+
verifyClaudeQuota?(): Promise<ClaudeQuotaVerdict>;
|
|
69
80
|
startStatuslineWatcher(name: string): void;
|
|
70
81
|
stopStatuslineWatcher(name: string): void;
|
|
71
82
|
reactMessageStatus(instanceName: string, chatId: string, messageId: string, emoji: string): void;
|
|
@@ -88,6 +99,8 @@ export interface LifecycleCreateArgs {
|
|
|
88
99
|
description?: string;
|
|
89
100
|
model?: string;
|
|
90
101
|
backend?: string;
|
|
102
|
+
/** Backend-specific launch options, e.g. { codex: { provider: "glm" } }. */
|
|
103
|
+
backend_options?: Record<string, Record<string, unknown>>;
|
|
91
104
|
branch?: string;
|
|
92
105
|
detach?: boolean;
|
|
93
106
|
worktree_path?: string;
|
|
@@ -111,12 +124,45 @@ export interface LifecycleReplaceArgs {
|
|
|
111
124
|
name: string;
|
|
112
125
|
reason?: string;
|
|
113
126
|
}
|
|
127
|
+
export type CodexQuotaVerdict = "available" | "exhausted" | "unknown";
|
|
128
|
+
type CodexUsageResult = Omit<ProviderUsage, "id" | "name">;
|
|
129
|
+
export type ClaudeQuotaVerdict = "available" | "exhausted" | "unknown";
|
|
130
|
+
type ClaudeUsageResult = Omit<ProviderUsage, "id" | "name">;
|
|
131
|
+
/**
|
|
132
|
+
* Convert the live Codex usage row into a conservative quota verdict. A
|
|
133
|
+
* successful response with at least one window below 100% proves that stale
|
|
134
|
+
* terminal text is no longer current only when no other window is exhausted.
|
|
135
|
+
* Missing credentials, API errors, and metric-less responses prove nothing.
|
|
136
|
+
*/
|
|
137
|
+
export declare function codexQuotaVerdictFromUsage(usage: CodexUsageResult): CodexQuotaVerdict;
|
|
138
|
+
/** Run only the Codex usage provider, bounded independently of its network timeout. */
|
|
139
|
+
export declare function verifyCodexQuotaStatus(fetchUsage?: () => Promise<CodexUsageResult>, timeoutMs?: number): Promise<CodexQuotaVerdict>;
|
|
140
|
+
/**
|
|
141
|
+
* Convert a LIVE Claude usage API row into a conservative verdict. The
|
|
142
|
+
* provider can degrade to statusline data when the network/API is unavailable;
|
|
143
|
+
* that fallback is intentionally unknown because stale local limits cannot
|
|
144
|
+
* disprove a current API credit-balance error.
|
|
145
|
+
*/
|
|
146
|
+
export declare function claudeQuotaVerdictFromUsage(usage: ClaudeUsageResult): ClaudeQuotaVerdict;
|
|
147
|
+
/** Run only the Claude usage provider, bounded independently of its network timeout. */
|
|
148
|
+
export declare function verifyClaudeQuotaStatus(fetchUsage?: () => Promise<ClaudeUsageResult>, timeoutMs?: number): Promise<ClaudeQuotaVerdict>;
|
|
114
149
|
export declare class InstanceLifecycle {
|
|
115
150
|
private ctx;
|
|
116
151
|
/** Active daemon processes: instanceName → Daemon */
|
|
117
152
|
readonly daemons: Map<string, import("./daemon.js").Daemon>;
|
|
118
153
|
/** backend → last auth-error alert time, so one expiry sends one alert. */
|
|
119
154
|
private lastAuthAlertAt;
|
|
155
|
+
/**
|
|
156
|
+
* backend → cached token-free auth verification (see AUTH_VERIFY_CACHE_MS).
|
|
157
|
+
* The PROMISE is cached, not the result: a shared credential expiring makes
|
|
158
|
+
* every instance of the backend fire in the same tick, and they must join
|
|
159
|
+
* one in-flight check instead of each spawning their own.
|
|
160
|
+
*/
|
|
161
|
+
private authVerifyCache;
|
|
162
|
+
/** Same-tick Codex quota alerts join one live usage probe. */
|
|
163
|
+
private codexQuotaVerifyInFlight;
|
|
164
|
+
/** Same-tick Claude quota alerts join one live usage probe. */
|
|
165
|
+
private claudeQuotaVerifyInFlight;
|
|
120
166
|
/**
|
|
121
167
|
* Minimum gap between MCP-revival auto-restarts of one instance. Kept here —
|
|
122
168
|
* not in the daemon — because each restart replaces the daemon object, which
|
|
@@ -143,6 +189,27 @@ export declare class InstanceLifecycle {
|
|
|
143
189
|
private notifyIncident;
|
|
144
190
|
/** Backend a running instance uses (config → fleet default). */
|
|
145
191
|
private backendOf;
|
|
192
|
+
/**
|
|
193
|
+
* Confirm a pane-detected auth error with the backend's token-free status
|
|
194
|
+
* probe before pausing anything: pattern matching over terminal text also
|
|
195
|
+
* fires on an agent DISCUSSING a 401. "valid" means false positive — ignore.
|
|
196
|
+
* "invalid" and "unknown" (timeout, missing binary) both pause: for a
|
|
197
|
+
* suspected expiry, pausing too much is recoverable, delivering into a dead
|
|
198
|
+
* CLI is not. Cached per backend so simultaneous alerts run one check.
|
|
199
|
+
*/
|
|
200
|
+
private verifyAuthError;
|
|
201
|
+
private verifyCodexQuota;
|
|
202
|
+
private verifyClaudeQuota;
|
|
203
|
+
/** Same verification keyed by backend (used by startup pre-flight priming). */
|
|
204
|
+
verifyBackendAuth(backend: string): Promise<"valid" | "invalid" | "unknown">;
|
|
205
|
+
/**
|
|
206
|
+
* Startup pre-flight: warm the per-backend auth verification cache so the
|
|
207
|
+
* detectors that fire seconds later (login-screen scan, MCP-died gate) get an
|
|
208
|
+
* instant answer. Advisory only — a pre-flight result alone never pauses
|
|
209
|
+
* anything, because e.g. codex on a custom provider runs fine while
|
|
210
|
+
* `codex login status` reports logged out (live-verified on this fleet).
|
|
211
|
+
*/
|
|
212
|
+
primeAuthVerification(backends: Iterable<string>): void;
|
|
146
213
|
/**
|
|
147
214
|
* One alert per backend per cooldown, naming every affected instance — a CLI's
|
|
148
215
|
* credentials are shared, so N instances failing is ONE problem with ONE fix
|