agent-steward 0.0.5 → 0.0.6
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/CHANGELOG.md +176 -1
- package/README.md +9 -7
- package/ROADMAP-STRATEGY.md +5 -5
- package/ROADMAP.md +107 -17
- package/dist/cli.js +5 -0
- package/dist/core/analytics.d.ts +6 -0
- package/dist/core/analytics.d.ts.map +1 -1
- package/dist/core/analytics.js +20 -3
- package/dist/core/audit.d.ts +6 -0
- package/dist/core/audit.d.ts.map +1 -1
- package/dist/core/audit.js +24 -0
- package/dist/core/budget.d.ts +118 -0
- package/dist/core/budget.d.ts.map +1 -0
- package/dist/core/budget.js +206 -0
- package/dist/core/cron-to-schtasks.d.ts.map +1 -1
- package/dist/core/cron-to-schtasks.js +38 -0
- package/dist/core/dry-run.d.ts +26 -1
- package/dist/core/dry-run.d.ts.map +1 -1
- package/dist/core/dry-run.js +199 -8
- package/dist/core/feedback.d.ts +192 -0
- package/dist/core/feedback.d.ts.map +1 -0
- package/dist/core/feedback.js +426 -0
- package/dist/core/gate-integrity.d.ts +36 -0
- package/dist/core/gate-integrity.d.ts.map +1 -1
- package/dist/core/gate-integrity.js +144 -1
- package/dist/core/local-ai.d.ts.map +1 -1
- package/dist/core/local-ai.js +7 -3
- package/dist/core/matrix.d.ts +8 -0
- package/dist/core/matrix.d.ts.map +1 -1
- package/dist/core/matrix.js +57 -2
- package/dist/core/mission.d.ts +20 -0
- package/dist/core/mission.d.ts.map +1 -1
- package/dist/core/mission.js +45 -5
- package/dist/core/opencode-models.d.ts +2 -2
- package/dist/core/opencode-models.d.ts.map +1 -1
- package/dist/core/opencode-models.js +28 -21
- package/dist/core/opencode-usage.d.ts +35 -0
- package/dist/core/opencode-usage.d.ts.map +1 -0
- package/dist/core/opencode-usage.js +132 -0
- package/dist/core/pipeline-io.d.ts +1 -1
- package/dist/core/pipeline-io.d.ts.map +1 -1
- package/dist/core/pipeline-io.js +26 -12
- package/dist/core/pipeline-map.d.ts +6 -0
- package/dist/core/pipeline-map.d.ts.map +1 -1
- package/dist/core/pipeline-map.js +12 -0
- package/dist/core/ps-wrapper.d.ts +10 -2
- package/dist/core/ps-wrapper.d.ts.map +1 -1
- package/dist/core/ps-wrapper.js +176 -5
- package/dist/core/record-history.d.ts.map +1 -1
- package/dist/core/record-history.js +76 -4
- package/dist/core/run-mode.d.ts +12 -0
- package/dist/core/run-mode.d.ts.map +1 -0
- package/dist/core/run-mode.js +17 -0
- package/dist/core/scheduler/logs.d.ts +4 -0
- package/dist/core/scheduler/logs.d.ts.map +1 -1
- package/dist/core/scheduler/logs.js +25 -1
- package/dist/core/secrets.d.ts.map +1 -1
- package/dist/core/secrets.js +18 -8
- package/dist/core/self-analysis.d.ts +32 -2
- package/dist/core/self-analysis.d.ts.map +1 -1
- package/dist/core/self-analysis.js +38 -27
- package/dist/core/shutdown.d.ts +33 -2
- package/dist/core/shutdown.d.ts.map +1 -1
- package/dist/core/shutdown.js +58 -2
- package/dist/core/structured-log.d.ts +30 -0
- package/dist/core/structured-log.d.ts.map +1 -1
- package/dist/core/structured-log.js +37 -0
- package/dist/core/usage-surface.d.ts +25 -0
- package/dist/core/usage-surface.d.ts.map +1 -0
- package/dist/core/usage-surface.js +41 -0
- package/dist/core/wrappers/bash.d.ts +2 -0
- package/dist/core/wrappers/bash.d.ts.map +1 -1
- package/dist/core/wrappers/bash.js +58 -6
- package/dist/db/history-repo.d.ts +32 -0
- package/dist/db/history-repo.d.ts.map +1 -1
- package/dist/db/history-repo.js +85 -7
- package/dist/db/metrics-repo.d.ts +20 -2
- package/dist/db/metrics-repo.d.ts.map +1 -1
- package/dist/db/metrics-repo.js +33 -11
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +37 -17
- package/dist/db/recovery.d.ts +3 -1
- package/dist/db/recovery.d.ts.map +1 -1
- package/dist/db/recovery.js +9 -4
- package/dist/db/runs-repo.d.ts.map +1 -1
- package/dist/db/runs-repo.js +71 -56
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +70 -1
- package/dist/db/templates-repo.d.ts +2 -2
- package/dist/db/templates-repo.d.ts.map +1 -1
- package/dist/db/templates-repo.js +5 -3
- package/dist/history.d.ts +6 -1
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +4 -2
- package/dist/hook-output.d.ts +2 -0
- package/dist/hook-output.d.ts.map +1 -0
- package/dist/hook-output.js +31 -0
- package/dist/index.d.ts +247 -53
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +999 -211
- package/dist/notifications.d.ts +31 -2
- package/dist/notifications.d.ts.map +1 -1
- package/dist/notifications.js +132 -13
- package/dist/profiles.d.ts.map +1 -1
- package/dist/profiles.js +66 -15
- package/dist/rpc.d.ts +108 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +28 -0
- package/dist/server.d.ts +17 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +77 -12
- package/dist/settings.d.ts +42 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +82 -0
- package/dist/task-transfer.d.ts +5 -0
- package/dist/task-transfer.d.ts.map +1 -1
- package/dist/task-transfer.js +48 -3
- package/dist/templates.d.ts +2 -2
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +3 -3
- package/dist/types.d.ts +22 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/workspaces.d.ts.map +1 -1
- package/dist/workspaces.js +34 -11
- package/docs/ARCHITECTURE.md +49 -12
- package/docs/COMPATIBILITY.md +2 -2
- package/docs/EXECUTION-LOOP.md +6 -3
- package/docs/FEATURES.md +65 -4
- package/docs/FEATURES.zh.md +45 -2
- package/docs/QA-A2-GUI-TUI.md +205 -0
- package/docs/README.ru.md +3 -3
- package/docs/README.zh.md +2 -2
- package/gui-experimental.cjs +9 -9
- package/locales/en.json +42 -3
- package/locales/ru.json +42 -3
- package/locales/zh.json +42 -3
- package/package.json +15 -2
- package/scripts/check-eslint-baseline.mjs +139 -0
- package/scripts/gen-test-plan-counters.mjs +117 -0
- package/scripts/github-ci-fetch.ps1 +37 -0
- package/scripts/pl-commit.ps1 +112 -0
- package/scripts/qa-a2-commit.ps1 +104 -0
- package/scripts/test-home.mjs +26 -2
- package/skills/scheduled-job-best-practices/SKILL.md +95 -1
- package/skills/scheduled-job-best-practices/references/recipes.md +139 -0
- package/src/cli.ts +5 -0
- package/src/core/analytics.ts +27 -4
- package/src/core/audit.ts +25 -0
- package/src/core/budget.ts +340 -0
- package/src/core/cron-to-schtasks.ts +42 -0
- package/src/core/dry-run.ts +233 -10
- package/src/core/feedback.ts +582 -0
- package/src/core/gate-integrity.ts +171 -1
- package/src/core/local-ai.ts +7 -3
- package/src/core/matrix.ts +63 -2
- package/src/core/mission.ts +51 -5
- package/src/core/opencode-models.ts +30 -21
- package/src/core/opencode-usage.ts +182 -0
- package/src/core/pipeline-io.ts +28 -11
- package/src/core/pipeline-map.ts +19 -0
- package/src/core/ps-wrapper.ts +173 -4
- package/src/core/record-history.ts +94 -4
- package/src/core/run-mode.ts +19 -0
- package/src/core/scheduler/logs.ts +32 -1
- package/src/core/secrets.ts +18 -11
- package/src/core/self-analysis.ts +75 -29
- package/src/core/shutdown.ts +90 -4
- package/src/core/structured-log.ts +67 -0
- package/src/core/usage-surface.ts +70 -0
- package/src/core/wrappers/bash.ts +60 -5
- package/src/db/history-repo.ts +153 -19
- package/src/db/metrics-repo.ts +38 -11
- package/src/db/migrate.ts +57 -32
- package/src/db/recovery.ts +10 -4
- package/src/db/runs-repo.ts +113 -61
- package/src/db/schema.ts +70 -1
- package/src/db/templates-repo.ts +5 -3
- package/src/gui.tsx +261 -5
- package/src/history.ts +10 -3
- package/src/hook-output.ts +39 -0
- package/src/index.ts +1407 -345
- package/src/notifications.ts +189 -39
- package/src/profiles.ts +72 -16
- package/src/rpc.ts +30 -0
- package/src/server.ts +107 -23
- package/src/settings.ts +120 -0
- package/src/task-transfer.ts +59 -6
- package/src/templates.ts +3 -3
- package/src/types.ts +23 -2
- package/src/workspaces.ts +37 -14
package/dist/types.d.ts
CHANGED
|
@@ -78,8 +78,8 @@ export type ListJobsArgs = z.infer<typeof ListJobsArgs>;
|
|
|
78
78
|
* Результат преобразования cron в флаги schtasks.
|
|
79
79
|
*/
|
|
80
80
|
export interface CronConversion {
|
|
81
|
-
/** Тип расписания schtasks: MINUTE, DAILY или
|
|
82
|
-
sc: "MINUTE" | "HOURLY" | "DAILY" | "WEEKLY";
|
|
81
|
+
/** Тип расписания schtasks: MINUTE, HOURLY, DAILY, WEEKLY или MONTHLY. */
|
|
82
|
+
sc: "MINUTE" | "HOURLY" | "DAILY" | "WEEKLY" | "MONTHLY";
|
|
83
83
|
/** Дополнительные флаги командной строки (кроме /sc и /tn /tr /f). */
|
|
84
84
|
extraFlags: string[];
|
|
85
85
|
/** Время начала для /st (HH:MM) или undefined. */
|
|
@@ -109,4 +109,24 @@ export interface ScheduledTaskInfo {
|
|
|
109
109
|
/** true — задача поставлена на паузу (disabled). */
|
|
110
110
|
paused?: boolean;
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Строка history.json, приведённая к колонкам БД миграцией (QA-A2.4).
|
|
114
|
+
* Все поля уже проверены type guard'ами в src/db/migrate.ts: строки непустые,
|
|
115
|
+
* числа конечные, а status сужен до значений, которые умеет писать миграция.
|
|
116
|
+
*/
|
|
117
|
+
export interface MigrationHistoryRow {
|
|
118
|
+
taskName: string;
|
|
119
|
+
/** skipped/running в legacy JSON не встречаются: миграция пишет только эти четыре. */
|
|
120
|
+
status: "success" | "partial" | "timeout" | "error";
|
|
121
|
+
startedAt: string;
|
|
122
|
+
finishedAt: string | null;
|
|
123
|
+
durationMs: number | null;
|
|
124
|
+
error: string | null;
|
|
125
|
+
tokens: number | null;
|
|
126
|
+
costUsd: number | null;
|
|
127
|
+
model: string | null;
|
|
128
|
+
preFlightStatus: string | null;
|
|
129
|
+
postFlightStatus: string | null;
|
|
130
|
+
nextTask: string | null;
|
|
131
|
+
}
|
|
112
132
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,uDAAuD;AACvD,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,GAAE,MAAyB,GAAG,MAAM,CAEnF;AAED,+EAA+E;AAC/E,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,MAAyB,GACjC,MAAM,CAER;AAED,eAAO,MAAM,gBAAgB,QAA6B,CAAC;AAC3D,eAAO,MAAM,uBAAuB,QAAmC,CAAC;AAExE,kCAAkC;AAClC,eAAO,MAAM,WAAW,QAAkC,CAAC;AAC3D,sDAAsD;AACtD,eAAO,MAAM,kBAAkB,QAAyC,CAAC;AAczE,eAAO,MAAM,UAAU,QAAqB,CAAC;AAE7C,eAAO,MAAM,QAAQ,QAAiC,CAAC;AACvD,eAAO,MAAM,OAAO,QAAgC,CAAC;AACrD,eAAO,MAAM,WAAW,QAAoC,CAAC;AAE7D,4CAA4C;AAC5C,eAAO,MAAM,UAAU,SAA+B,CAAC;AAEvD,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,QAAsB,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAcjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsC3D;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;iBA6B1B,CAAC;AAEH,MAA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AG,MAAM,GAAG,SAAS,CAavE;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAavE;AAED,gCAAgC;AAChC,wBAAgB,cAAc,IAAI,SAAS,EAAE,CAK5C;AAED,uBAAuB;AACvB,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAM9D;AAED,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAM/E;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CA6ChE;AAED,yCAAyC;AACzC,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,GAAG,SAAS,CAkElF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAenD;AAED,kDAAkD;AAClD,wBAAgB,eAAe,IAAI,MAAM,CAKxC"}
|
package/dist/workspaces.js
CHANGED
|
@@ -7,6 +7,25 @@ import { clearWorkspaceAssignments } from "./db/tasks-repo.js";
|
|
|
7
7
|
import { hasSecretRef, resolveSecretRefs } from "./core/secrets.js";
|
|
8
8
|
/** Максимум пар env на workspace — защита от раздувания строки JSON. */
|
|
9
9
|
export const MAX_WORKSPACE_ENV_PAIRS = 100;
|
|
10
|
+
/**
|
|
11
|
+
* Строковое представление unknown для env и колонок БД (QA-A2.5).
|
|
12
|
+
* Для примитивов совпадает с String(); объекты дают стандартный '[object Object]'
|
|
13
|
+
* (в JSON и в текстовых колонках SQLite таких значений не бывает).
|
|
14
|
+
*/
|
|
15
|
+
function safeString(value) {
|
|
16
|
+
if (value === null || value === undefined)
|
|
17
|
+
return String(value);
|
|
18
|
+
switch (typeof value) {
|
|
19
|
+
case "string":
|
|
20
|
+
case "number":
|
|
21
|
+
case "boolean":
|
|
22
|
+
case "bigint":
|
|
23
|
+
case "symbol":
|
|
24
|
+
return String(value);
|
|
25
|
+
default:
|
|
26
|
+
return "[object Object]";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
10
29
|
/** Палитра цветных маркеров для GUI/дашборда. */
|
|
11
30
|
export const WORKSPACE_COLORS = [
|
|
12
31
|
"#5b8def",
|
|
@@ -44,7 +63,7 @@ export function normalizeWorkspaceEnv(value) {
|
|
|
44
63
|
if (typeof rawValue === "object") {
|
|
45
64
|
throw new Error(`Значение env '${key}' должно быть строкой.`);
|
|
46
65
|
}
|
|
47
|
-
result[key] =
|
|
66
|
+
result[key] = safeString(rawValue);
|
|
48
67
|
}
|
|
49
68
|
return result;
|
|
50
69
|
}
|
|
@@ -212,21 +231,21 @@ function rowToWorkspace(row) {
|
|
|
212
231
|
let env;
|
|
213
232
|
if (row.env_json) {
|
|
214
233
|
try {
|
|
215
|
-
env = normalizeWorkspaceEnv(JSON.parse(
|
|
234
|
+
env = normalizeWorkspaceEnv(JSON.parse(safeString(row.env_json)));
|
|
216
235
|
}
|
|
217
236
|
catch {
|
|
218
237
|
env = undefined;
|
|
219
238
|
}
|
|
220
239
|
}
|
|
221
240
|
return {
|
|
222
|
-
id:
|
|
223
|
-
name:
|
|
224
|
-
path:
|
|
225
|
-
gitRemote: row.git_remote == null ? undefined :
|
|
226
|
-
color: row.color == null ? undefined :
|
|
241
|
+
id: safeString(row.id),
|
|
242
|
+
name: safeString(row.name),
|
|
243
|
+
path: safeString(row.path),
|
|
244
|
+
gitRemote: row.git_remote == null ? undefined : safeString(row.git_remote),
|
|
245
|
+
color: row.color == null ? undefined : safeString(row.color),
|
|
227
246
|
env,
|
|
228
|
-
envFile: row.env_file == null ? undefined :
|
|
229
|
-
createdAt:
|
|
247
|
+
envFile: row.env_file == null ? undefined : safeString(row.env_file),
|
|
248
|
+
createdAt: safeString(row.created_at),
|
|
230
249
|
};
|
|
231
250
|
}
|
|
232
251
|
function normalizePath(value) {
|
|
@@ -306,7 +325,9 @@ export function listWorkspaces() {
|
|
|
306
325
|
export function getWorkspace(id) {
|
|
307
326
|
if (!id)
|
|
308
327
|
return undefined;
|
|
309
|
-
const row = getDb()
|
|
328
|
+
const row = getDb()
|
|
329
|
+
.prepare("SELECT * FROM workspaces WHERE id = ?")
|
|
330
|
+
.get(id);
|
|
310
331
|
return row ? rowToWorkspace(row) : undefined;
|
|
311
332
|
}
|
|
312
333
|
/** Workspace по пути (без учёта регистра, как в Windows). */
|
|
@@ -423,6 +444,8 @@ export function deleteWorkspace(id) {
|
|
|
423
444
|
}
|
|
424
445
|
/** Количество workspace (для сводок и тестов). */
|
|
425
446
|
export function countWorkspaces() {
|
|
426
|
-
const row = getDb()
|
|
447
|
+
const row = getDb()
|
|
448
|
+
.prepare("SELECT COUNT(*) AS count FROM workspaces")
|
|
449
|
+
.get();
|
|
427
450
|
return Number(row?.count) || 0;
|
|
428
451
|
}
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -46,7 +46,7 @@ path, and the OS scheduler is only one of them (CONCEPT §5, §8):
|
|
|
46
46
|
|
|
47
47
|
| Entry | Examples | Goes through the OS scheduler? |
|
|
48
48
|
| --- | --- | --- |
|
|
49
|
-
| ad-hoc (no OS registration) |
|
|
49
|
+
| ad-hoc (no OS registration) | GUI · CLI · TUI · RPC (`run_mission`) | No |
|
|
50
50
|
| internal orchestration (core-driven, no OS) | chains · DAG dependents · retries · matrix continuation · escalation · resume after pause/crash | No |
|
|
51
51
|
| registered triggers | `cron` / `once` | Yes — registered with Task Scheduler / launchd / crontab |
|
|
52
52
|
| registered, in-process | `file` / `git` / `mcp-event` / webhook | No — watched inside the plugin process |
|
|
@@ -60,7 +60,7 @@ The OS scheduler is responsible only for firing registered `cron`/`once` ticks.
|
|
|
60
60
|
│ ENTRIES │
|
|
61
61
|
│ │
|
|
62
62
|
│ ad-hoc (no OS registration) │
|
|
63
|
-
│
|
|
63
|
+
│ GUI · CLI · TUI · RPC (`run_mission`) │
|
|
64
64
|
│ │
|
|
65
65
|
│ internal orchestration (core-driven, no OS) │
|
|
66
66
|
│ chains · DAG dependents · retries · matrix continuation · │
|
|
@@ -163,7 +163,7 @@ review step.
|
|
|
163
163
|
|
|
164
164
|
`src/core/mission.ts` turns a one-off request into a `RunContext` without
|
|
165
165
|
registering anything in the OS scheduler. The same entry point is exposed by
|
|
166
|
-
the
|
|
166
|
+
the RPC method `run_mission` (not registered as an agent tool), the CLI command `agent-steward run`
|
|
167
167
|
and the GUI panel «Ad-hoc миссия».
|
|
168
168
|
|
|
169
169
|
- **MissionSpec (AB-8.1)** — `prompt` is required; `cwd`, `taskName`,
|
|
@@ -208,8 +208,9 @@ profile gets the first free port from 3783 upward when it is created, recorded i
|
|
|
208
208
|
dashboard response carries `x-plugin-profile`, so a second profile neither reuses
|
|
209
209
|
another profile's server nor treats it as a zombie.
|
|
210
210
|
|
|
211
|
-
`SCHEMA_VERSION` is currently **
|
|
212
|
-
applied through `PRAGMA user_version` on open.
|
|
211
|
+
`SCHEMA_VERSION` is currently **12**; migrations are additive and idempotent,
|
|
212
|
+
applied through `PRAGMA user_version` on open. Step 11 adds functional indexes
|
|
213
|
+
`idx_history_task_lower` / `idx_history_status_lower` for `getHistory()` filters.
|
|
213
214
|
|
|
214
215
|
| Tables | Purpose |
|
|
215
216
|
| --- | --- |
|
|
@@ -320,7 +321,7 @@ avg_cost / avg_time / last_10_runs`. Обучается на исходах ге
|
|
|
320
321
|
токенов на само решение.
|
|
321
322
|
|
|
322
323
|
Реализация (Спринт 36.5.b, B13): `src/db/capability-repo.ts`, таблица
|
|
323
|
-
`capability_map` (`SCHEMA_VERSION =
|
|
324
|
+
`capability_map` (`SCHEMA_VERSION = 12`). `recordCapabilityOutcome` обновляет
|
|
324
325
|
счётчики (`runs_total`, `runs_passed`, `first_pass_count`), кумулятивный
|
|
325
326
|
`success_rate` и скользящие средние стоимости/времени, хранит `last_10_runs`
|
|
326
327
|
(JSON, новые справа). `decideCapabilityRoute` решает по правилам:
|
|
@@ -359,7 +360,7 @@ avg_cost / avg_time / last_10_runs`. Обучается на исходах ге
|
|
|
359
360
|
|
|
360
361
|
| Path | Role |
|
|
361
362
|
| --- | --- |
|
|
362
|
-
| `src/index.ts` | Plugin lifecycle,
|
|
363
|
+
| `src/index.ts` | Plugin lifecycle, 30 agent tools, RPC handlers, task CRUD, view assembly |
|
|
363
364
|
| `src/rpc.ts` | JSON-schema contracts for every RPC method |
|
|
364
365
|
| `src/gui.tsx` | OpenCode sidebar panel (SolidJS, built to `gui-experimental.cjs`) |
|
|
365
366
|
| `src/server.ts` | Local web dashboard HTTP server and HTML rendering |
|
|
@@ -406,7 +407,7 @@ avg_cost / avg_time / last_10_runs`. Обучается на исходах ге
|
|
|
406
407
|
|
|
407
408
|
| Platform | Backend | Notes |
|
|
408
409
|
| --- | --- | --- |
|
|
409
|
-
| Windows | `schtasks.exe` | Cron is translated to `MINUTE/HOURLY/DAILY/WEEKLY/MONTHLY` flags; non-cron triggers are registered as `ONCE` at `31.12.2099` |
|
|
410
|
+
| Windows | `schtasks.exe` | Cron is translated to `MINUTE/HOURLY/DAILY/WEEKLY/MONTHLY` flags; non-cron triggers are registered as an **enabled** `ONCE` entry at `31.12.2099` (Status `Ready`, never fires by itself) |
|
|
410
411
|
| Linux | `crontab` | Task lines with the plugin marker are rewritten via `crontab -` |
|
|
411
412
|
| macOS | `launchd` | `StartCalendarInterval` plists |
|
|
412
413
|
| POSIX fallback | `crontab` | Used when launchd is unavailable |
|
|
@@ -434,6 +435,20 @@ enforced:
|
|
|
434
435
|
| Logging | Append-only log per task under `logs/` |
|
|
435
436
|
| History | Calls the recorder with `--start` and `--finish` |
|
|
436
437
|
|
|
438
|
+
**Gate input and worktree snapshots.** A task with `qualityGate` stores a hash of
|
|
439
|
+
the gate command, prompt and timeout when it is created (`core/gate-integrity.ts`,
|
|
440
|
+
`gate-snapshots/*.json`); before the gate runs, both wrappers verify that hash and
|
|
441
|
+
fail closed on a mismatch (G-1.2). **PL-25:** a parallel agent can edit `src/`
|
|
442
|
+
without committing while a task is running, which used to make the start lint green
|
|
443
|
+
and the post-flight gate fail on somebody else's uncommitted code. The wrappers now
|
|
444
|
+
also capture a worktree snapshot at task start — `HEAD` plus
|
|
445
|
+
`git status --porcelain --untracked-files=no -- src` — into a sibling
|
|
446
|
+
`*.worktree.json` file, and verify it immediately before the gate. Guard paths are
|
|
447
|
+
configurable via `AGENT_STEWARD_GATE_GUARD_PATHS` (separator `|` or `;`). If `HEAD`
|
|
448
|
+
or the guarded working tree changed during the run, the gate is skipped and the run
|
|
449
|
+
is marked as an error with an explicit message; non-git directories are not guarded.
|
|
450
|
+
This prevents a green gate from certifying code that was changed by another task.
|
|
451
|
+
|
|
437
452
|
**Единый формат lock-токена (B6).** Node (`src/core/lock.ts`), PowerShell
|
|
438
453
|
(`src/core/ps-wrapper.ts`) и bash (`src/core/wrappers/bash.ts`) используют один
|
|
439
454
|
формат записи владельца: `<pid>-<iso>` (Node добавляет `-<uuid>` для
|
|
@@ -468,7 +483,17 @@ Usage (tokens/cost) resolves in both recorder modes: explicit wrapper arguments
|
|
|
468
483
|
and when they are `-` the recorder parses the log tail (`parseUsageFromLog`) using the
|
|
469
484
|
log path passed as the last argument. This applies to `--finish` (12th argument) and to
|
|
470
485
|
the legacy pre-`--start` mode (11th argument, B10); a missing/unreadable log degrades to
|
|
471
|
-
|
|
486
|
+
the next source instead of failing the record. Many OpenCode providers (for example
|
|
487
|
+
hy4-flash-free and local Ollama) print no usage lines at all, so `parseUsageFromLog`
|
|
488
|
+
alone leaves tokens at zero. In that case `core/opencode-usage.ts` reads OpenCode's own
|
|
489
|
+
SQLite database read-only (`~/.local/share/opencode/opencode.db`, override via
|
|
490
|
+
`OPENCODE_USAGE_DB`) and sums assistant-message `tokens`/`cost` from `message.data`
|
|
491
|
+
inside a ±2 s window around the run, optionally restricted to the task's working
|
|
492
|
+
directory. `record-history.ts` fills only fields that are still missing and emits a
|
|
493
|
+
`usage.from_opencode_db` structured event; a missing or locked database is ignored.
|
|
494
|
+
Offline tool-surface measurement lives in `core/usage-surface.ts`: it accepts an
|
|
495
|
+
injected tokenizer (the test uses `gpt-tokenizer`) so the reported size of the 30-tool
|
|
496
|
+
registry is a real token count, not a character heuristic.
|
|
472
497
|
|
|
473
498
|
If the host or the machine dies mid-run, the row stays in `running`. On the next
|
|
474
499
|
plugin activation, `db/recovery.ts` marks stale `running` rows as `error`, so the UI
|
|
@@ -497,6 +522,18 @@ All three are evaluated by the recorder after a run finishes:
|
|
|
497
522
|
`selectDependentsToTrigger(taskName, definitions, history)` is a pure function, which
|
|
498
523
|
keeps the rules testable.
|
|
499
524
|
|
|
525
|
+
**Dependency completion is an event, not a one-shot latch (PL-40).** Every time a
|
|
526
|
+
dependency finishes, its completion is evaluated against the dependencies' latest
|
|
527
|
+
records. If all dependencies are currently successful, the dependent is started — even
|
|
528
|
+
when an earlier run of the same generation already started it. With two parents this
|
|
529
|
+
means the dependent may run once per parent completion (e.g. `T5` with
|
|
530
|
+
`dependsOn: [T3, T4]` runs when `T3` finishes while `T4` is still successful, and again
|
|
531
|
+
when `T4` finishes). This also applies to a stale but successful record: an older
|
|
532
|
+
success still satisfies the gate. The dependent's own latest `startedAt` only suppresses
|
|
533
|
+
a re-trigger when it is newer than the newest dependency `finishedAt`. Do not dedupe
|
|
534
|
+
across generations — `test-dag-latest-history.mjs` locks this in. For a strict single
|
|
535
|
+
run per trigger use `nextTaskOnSuccess` instead of a multi-parent `dependsOn`.
|
|
536
|
+
|
|
500
537
|
## Matrix builds
|
|
501
538
|
|
|
502
539
|
A matrix task is a template, not a runnable job:
|
|
@@ -575,7 +612,7 @@ the whole plugin directory (database, logs, locks, wrappers, prompts) with
|
|
|
575
612
|
|
|
576
613
|
Schema evolution is additive: `applySchema` runs `CREATE TABLE IF NOT EXISTS` on every
|
|
577
614
|
connection and adds missing columns after `PRAGMA table_info`, so upgrading the plugin
|
|
578
|
-
never requires a manual migration. `SCHEMA_VERSION` (currently `
|
|
615
|
+
never requires a manual migration. `SCHEMA_VERSION` (currently `12`) is stored in
|
|
579
616
|
`PRAGMA user_version`; incremental steps live in `MIGRATIONS`.
|
|
580
617
|
|
|
581
618
|
### Durable run state (Sprint 36.1)
|
|
@@ -801,7 +838,7 @@ resume preparation, rejection of a repeated resume, end-to-end comment delivery
|
|
|
801
838
|
|
|
802
839
|
| Interface | Audience | Entry point |
|
|
803
840
|
| --- | --- | --- |
|
|
804
|
-
| Agent tools | AI agent |
|
|
841
|
+
| Agent tools | AI agent | 30 tools registered via `ctx.tool.transform` |
|
|
805
842
|
| Agent skill | AI agent | `skills/scheduled-job-best-practices` |
|
|
806
843
|
| RPC | Sidebar GUI | `src/rpc.ts` contracts, 57 methods |
|
|
807
844
|
| Sidebar GUI | Human | `gui-experimental.cjs` |
|
|
@@ -975,7 +1012,7 @@ after the agent with the user's privileges and are not filtered by tool policy.
|
|
|
975
1012
|
|---|---|---|
|
|
976
1013
|
| Миссия | цель + scope + gate-спека + safety + бюджет | `runs` metadata (AB-8); шаблон `missions` — план 38 |
|
|
977
1014
|
| Задача | миссия-шаблон + триггер | `tasks` (есть) |
|
|
978
|
-
| Запуск | durable-исполнение: шаги, попытки, вердикты | `runs` / `run_steps` (есть, SCHEMA_VERSION
|
|
1015
|
+
| Запуск | durable-исполнение: шаги, попытки, вердикты | `runs` / `run_steps` (есть, SCHEMA_VERSION 12) |
|
|
979
1016
|
| Исход гейта | вердикт + provenance + экономика | `gate_outcomes` (план 40) |
|
|
980
1017
|
|
|
981
1018
|
### Путь исполнения (целевой)
|
package/docs/COMPATIBILITY.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
| Возможность | V1 (`>=1.18.29`) | V2 (`>=2.2.7`) | Комментарий |
|
|
17
17
|
|---|---|---|---|
|
|
18
|
-
|
|
|
18
|
+
| 30 инструментов агента | да, `tool()`; без `options.codemode` | да, `ctx.tool.transform`; `options: { codemode: true }` | имена, схемы и обработчики совпадают |
|
|
19
19
|
| Хуки (tool / session / event / config) | да, строковые ключи в `Hooks` | да, типизированные домены `ctx.*` | API есть, но плагин его **не использует** — см. ниже |
|
|
20
20
|
| TUI-панель «Планировщик» | да, `src/tui-v1.tsx`; маршрут `/scheduler` + снимок в сайдбаре | да, `src/tui.tsx`; reactive store | **обе линии**, один модуль `./tui` |
|
|
21
21
|
| GUI-панель | **нет** | да | subpath `@opencode/plugin/gui` в V1 отсутствует |
|
|
@@ -102,7 +102,7 @@ SDK — совместимость мажора проверяется в `test-
|
|
|
102
102
|
|
|
103
103
|
| Проверка | Что покрывает |
|
|
104
104
|
|---|---|
|
|
105
|
-
| `test-dual-entry.mjs` | форму default export (`id`, `setup`, `server`), `createV1Hooks` → `tool` + `dispose`,
|
|
105
|
+
| `test-dual-entry.mjs` | форму default export (`id`, `setup`, `server`), `createV1Hooks` → `tool` + `dispose`, 30 инструментов, совпадение имён с V2-реестром `createToolHandlers`, кросс-версию zod |
|
|
106
106
|
| `test-v1-integration.mjs` | реальный V1-путь: `server({ directory })`, изолированные `OPENCODE_SCHEDULER_HOME` и порт дашборда, три read-only инструмента, повторный `dispose` |
|
|
107
107
|
| `test-docs.mjs` | контракт в документации и коде: `exports["./tui"]`, `sidebar_content`, ключи `plugin`/`plugins`, инварианты состояния |
|
|
108
108
|
| CI `compat-v1` / `compat-v2` | отдельные jobs: V1 SDK `1.19.x` и V2 SDK `2.3.0` (устанавливается поверх `2.2.7`), не блокируют матрицу трёх ОС |
|
package/docs/EXECUTION-LOOP.md
CHANGED
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
- **Эскалация не живая.** `escalateAfterGate` есть, но провал гейта идёт в retry/chain.
|
|
14
14
|
- **Нет ad-hoc входа.** Любой запуск требует регистрации: `schedule_task` + `run_task_now`; `once` — это `at` / `schtasks ONCE` / launchd. Цепочки/DAG/retry обходят расписание костылём force-маркера. *(Закрыто в AB-8: `run_mission` / CLI `run` / GUI / RPC.)*
|
|
15
15
|
|
|
16
|
+
Частично построено: контекст запуска (`src/db/run-context.ts`), per-task/per-window
|
|
17
|
+
бюджеты (`src/core/budget.ts`), целостность гейта (`src/core/gate-integrity.ts`),
|
|
18
|
+
worktree-изоляция (`src/core/worktree.ts`, `src/core/worktree-run.ts`).
|
|
19
|
+
|
|
16
20
|
Не построено вовсе: ledger + provenance; класс риска и компиляция политики;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
approvals-очередь.
|
|
21
|
+
flake-aware повторы и отложенные эффекты; полноценная context compilation
|
|
22
|
+
(repo-map + инъекция scaffolding); egress-контроль и approvals-очередь.
|
|
20
23
|
|
|
21
24
|
Подтверждение:
|
|
22
25
|
|
package/docs/FEATURES.md
CHANGED
|
@@ -247,6 +247,16 @@ read/edit/glob/grep/subagent/skill/webfetch/websearch and denies `shell` and `qu
|
|
|
247
247
|
allowed everything. Task-level `legacyShell: true` re-enables `shell` under `hybrid` for
|
|
248
248
|
jobs migrated from older versions; `legacy` is the blunt alternative.
|
|
249
249
|
|
|
250
|
+
> **Autonomous tasks and `tool.blocked`:** with the default `hybrid` policy the agent
|
|
251
|
+
> is denied `shell` and `question`, so an unattended task that tries to run `git status`
|
|
252
|
+
> (or ask a clarifying question) will log `tool.blocked` and cannot complete that step.
|
|
253
|
+
> This is intentional — do **not** switch `defaultPolicy` to `legacy` globally just to
|
|
254
|
+
> silence it. Grant the capability to the specific task instead: add `shell`
|
|
255
|
+
> (and/or `question`, if truly needed) to that task's `allowedTools`, use
|
|
256
|
+
> `legacyShell: true` for migrated jobs, or move the command into `beforeScript` /
|
|
257
|
+
> `qualityGate` / `afterScript`, which run with your user privileges and are not subject
|
|
258
|
+
> to agent tool restrictions. `shell` commands inside scripts are the recommended path.
|
|
259
|
+
|
|
250
260
|
`allowedTools` and `deniedTools` are enforced for the `opencode run` process that the
|
|
251
261
|
task wrapper starts. The wrapper passes the generated `permissions` rules to the
|
|
252
262
|
process through `OPENCODE_CONFIG_CONTENT`; no file is written to the task workdir, so a
|
|
@@ -455,6 +465,22 @@ rate of $0.01 / 1k tokens. The KPI is labelled as an estimate and links to
|
|
|
455
465
|
[docs/SAVINGS.md](SAVINGS.md) with the full methodology; `report.savings` exposes
|
|
456
466
|
`savedUsd`, `runs`, `tokens` and a per-task breakdown.
|
|
457
467
|
|
|
468
|
+
Daily and weekly **budgets** (Economy v2) are configured through `manage_settings`
|
|
469
|
+
(`budgets: { enabled, dailyUsd, weeklyUsd }`, USD; `0` means no limit) or the
|
|
470
|
+
`get_settings`/`save_settings` RPC methods. Spending is accounted from finished
|
|
471
|
+
history rows in the current UTC day / UTC week (Monday start) using the same
|
|
472
|
+
cost rule as analytics; unfinished runs are ignored. `get_analytics` (and
|
|
473
|
+
`GET /api/analytics`) expose `report.budgets` with `day`/`week` usage
|
|
474
|
+
(`spentUsd`, `runs`, `limitUsd`, `remainingUsd`, `ratio`, `exceeded`, `disabled`)
|
|
475
|
+
and a combined `exceeded` flag. When a limit is enabled and reached, new runs
|
|
476
|
+
are paused automatically: `run_task`, `run_mission`, `run_task_now` and the
|
|
477
|
+
RPC/GUI, file-trigger and MCP entry points all refuse to start until the next
|
|
478
|
+
period, with a human-readable reason. An alert is sent to the configured
|
|
479
|
+
notification channels (webhook/Telegram/native) when a run is blocked; repeated
|
|
480
|
+
alerts with the same reason are suppressed for 24 hours. Budgets are fail-open:
|
|
481
|
+
disabled groups and zero limits never block a run, and accounting stays visible
|
|
482
|
+
regardless.
|
|
483
|
+
|
|
458
484
|
### Prometheus
|
|
459
485
|
|
|
460
486
|
`GET /metrics` exposes the Prometheus text format (0.0.4): `opencode_scheduler_info`,
|
|
@@ -668,12 +694,12 @@ the `cleanup_history` RPC and the GUI's **Clear now** button. Aggregates in
|
|
|
668
694
|
|
|
669
695
|
## Agent interface
|
|
670
696
|
|
|
671
|
-
|
|
697
|
+
Thirty tools: `schedule_task`, `list_tasks`, `update_task`, `delete_task`,
|
|
672
698
|
`run_task_now`, `pause_task`, `resume_task`, `get_history`, `get_task_logs`, `dry_run`,
|
|
673
699
|
`manage_workspaces`, `matrix_control` (results/cancel/cleanup/preview), `get_metrics`,
|
|
674
700
|
`get_analytics`, `self_analysis` (health score, anomalies, trends), `manage_settings`,
|
|
675
701
|
`manage_local_ai`, `manage_templates`, `manage_profiles`,
|
|
676
|
-
`transfer_tasks`, `send_notification`, `get_dashboard_info`, `cleanup_history`,
|
|
702
|
+
`transfer_tasks`, `send_notification`, `report_bug`, `get_dashboard_info`, `cleanup_history`,
|
|
677
703
|
`manage_secrets`, `get_audit_log`,
|
|
678
704
|
`emit_event`,
|
|
679
705
|
`pipeline_validate`, `pipeline_apply`, `pipeline_export`.
|
|
@@ -686,6 +712,39 @@ plugin, no installation step required.
|
|
|
686
712
|
The `manage_local_ai` tool reads, updates and tests the local triage settings
|
|
687
713
|
(`action: "get" | "update" | "test"`); see [LOCAL-AI.md](LOCAL-AI.md).
|
|
688
714
|
|
|
715
|
+
## Author feedback (bug reports)
|
|
716
|
+
|
|
717
|
+
`report_bug` sends a structured report to the plugin author through a **write-only**
|
|
718
|
+
receiver (a Cloudflare Worker that creates a GitHub Issue in `DeadSno/agent-steward`).
|
|
719
|
+
The npm package contains **no tokens**: the fine-grained PAT (`issues: write` only)
|
|
720
|
+
lives in the receiver secrets. See [infra/feedback-worker/README.md](../infra/feedback-worker/README.md)
|
|
721
|
+
for deployment.
|
|
722
|
+
|
|
723
|
+
Arguments: `description` (required), `destination: "author" | "local" | "both"`
|
|
724
|
+
(default `author`), `dryRun` (preview only, no network), `includeLogs` (default
|
|
725
|
+
**false**), `includeAnalytics` (default true), `contactEmail`, `taskName`, `channel`.
|
|
726
|
+
|
|
727
|
+
What is sent in the payload (`schemaVersion: 1`): plugin/OS/Node versions,
|
|
728
|
+
locale, active profile, optional task name, the description, and — only when
|
|
729
|
+
explicitly allowed — redacted logs and aggregate metrics. What is **not** sent by
|
|
730
|
+
default: logs, emails, raw environment variables. Client-side redaction removes
|
|
731
|
+
`sk-`/`ghp_`/`xox*`/bot tokens, all values stored via `manage_secrets`, the home
|
|
732
|
+
directory (replaced with `~`) and email addresses (replaced with `[EMAIL]`).
|
|
733
|
+
`contactEmail` is included only if the user provided it explicitly.
|
|
734
|
+
|
|
735
|
+
Privacy controls: `feedback.enabled` defaults to **false**; `includeLogs` defaults
|
|
736
|
+
to **false**; the endpoint must be HTTPS (HTTP only for localhost) and is validated
|
|
737
|
+
on save. Use `report_bug` with `dryRun: true` to inspect the exact payload before
|
|
738
|
+
sending — the plugin displays `schemaVersion`, `reportId`, OS, locale, profile,
|
|
739
|
+
description, contact email, logs and metrics (F-3.1). The GUI has a dedicated
|
|
740
|
+
**Author feedback** settings section. Messages are localized to ru/en/zh.
|
|
741
|
+
|
|
742
|
+
Delivery is fail-open (F-1.6): if the receiver is unavailable, the report is saved
|
|
743
|
+
to the local `feedback_outbox` table and retried on plugin start (max 5 attempts);
|
|
744
|
+
it never blocks task execution. A hash of the description, a 5-minute window and
|
|
745
|
+
an hourly limit (default 6) prevent spam; only hashes, never report text, are stored
|
|
746
|
+
in `feedback_spam`.
|
|
747
|
+
|
|
689
748
|
## Local assistant (triage)
|
|
690
749
|
|
|
691
750
|
An optional offline model classifies failed and partial runs (category, severity,
|
|
@@ -750,8 +809,10 @@ and troubleshooting (including `OLLAMA_CONTEXT_LENGTH`) are documented in
|
|
|
750
809
|
not supported.
|
|
751
810
|
- **No sandbox.** Hooks, Quality Gates and prompts run with your user privileges.
|
|
752
811
|
- **No authentication on the dashboard.** Localhost only by design.
|
|
753
|
-
- **Secrets are
|
|
754
|
-
|
|
812
|
+
- **Secrets are encrypted at rest with AES-256-GCM** in `<PLUGIN_DIR>/secrets.json`
|
|
813
|
+
(see the Secrets section). The key lives in `secrets.key`; losing it makes stored
|
|
814
|
+
values unrecoverable. For higher-sensitivity values, prefer environment variables
|
|
815
|
+
or an external secret manager.
|
|
755
816
|
- **`allowedTools` / `deniedTools` restrict the agent process, not the whole job.**
|
|
756
817
|
Hooks, Quality Gates and wrapper scripts still run with your user privileges, and a
|
|
757
818
|
project-level or system `opencode.jsonc` can weaken task-scoped denies. See the
|
package/docs/FEATURES.zh.md
CHANGED
|
@@ -210,6 +210,14 @@ read/edit/glob/grep/subagent/skill/webfetch/websearch 并拒绝 `shell` 和 `que
|
|
|
210
210
|
`legacyShell: true` 会在 `hybrid` 下为从旧版本迁移来的作业重新启用 `shell`;
|
|
211
211
|
`legacy` 是粗放的替代方案。
|
|
212
212
|
|
|
213
|
+
> **自治任务与 `tool.blocked`:** 默认的 `hybrid` 策略会拒绝 agent 使用 `shell`
|
|
214
|
+
> 和 `question`,因此无人值守任务若尝试运行 `git status`(或询问澄清问题),
|
|
215
|
+
> 会在日志中留下 `tool.blocked` 且无法完成该步骤。这是有意设计——不要仅为消除
|
|
216
|
+
> 它而全局把 `defaultPolicy` 改成 `legacy`。应当为该具体任务授予能力:把 `shell`
|
|
217
|
+
> (确有需要时也包括 `question`)加入该任务的 `allowedTools`,为迁移作业使用
|
|
218
|
+
> `legacyShell: true`,或把命令移入 `beforeScript` / `qualityGate` / `afterScript`
|
|
219
|
+
> ——它们以你的用户权限运行,不受 agent 工具限制约束。推荐在脚本中执行 shell 命令。
|
|
220
|
+
|
|
213
221
|
`allowedTools` 和 `deniedTools` 对任务包装器启动的 `opencode run` 进程
|
|
214
222
|
强制生效。包装器通过 `OPENCODE_CONFIG_CONTENT` 把生成的 `permissions` 规则
|
|
215
223
|
传给该进程;不会向任务工作目录写入任何文件,因此项目级
|
|
@@ -408,6 +416,19 @@ OTLP/JSON(`GET /api/history/export?format=otlp`)。
|
|
|
408
416
|
[docs/SAVINGS.md](SAVINGS.md) 的完整方法说明;`report.savings` 暴露
|
|
409
417
|
`savedUsd`、`runs`、`tokens` 以及按任务的细分。
|
|
410
418
|
|
|
419
|
+
每日/每周 **预算**(Economy v2)通过 `manage_settings`
|
|
420
|
+
(`budgets: { enabled, dailyUsd, weeklyUsd }`,单位 USD;`0` 表示无限制)
|
|
421
|
+
或 `get_settings`/`save_settings` RPC 方法配置。支出按当前 UTC 日 /
|
|
422
|
+
UTC 周(周一开始)从已完成的历史记录中统计,使用与分析相同的成本规则;
|
|
423
|
+
未完成的运行会被忽略。`get_analytics`(以及 `GET /api/analytics`)在
|
|
424
|
+
`report.budgets` 中提供 `day`/`week` 用量(`spentUsd`、`runs`、`limitUsd`、
|
|
425
|
+
`remainingUsd`、`ratio`、`exceeded`、`disabled`)以及总的 `exceeded` 标志。
|
|
426
|
+
当启用某个限额并达到时,新运行会自动暂停:`run_task`、`run_mission`、
|
|
427
|
+
`run_task_now` 以及 RPC/GUI、文件触发和 MCP 入口都会拒绝启动,并给出原因,
|
|
428
|
+
直到下一个周期。运行被阻止时会向已配置的通知渠道(webhook/Telegram/原生通知)
|
|
429
|
+
发送警报;相同原因的重复警报在 24 小时内会被抑制。预算默认 fail-open:
|
|
430
|
+
禁用的分组和零限制永远不会阻止运行,且统计始终可见。
|
|
431
|
+
|
|
411
432
|
### Prometheus
|
|
412
433
|
|
|
413
434
|
`GET /metrics` 暴露 Prometheus 文本格式(0.0.4):`opencode_scheduler_info`、
|
|
@@ -629,6 +650,27 @@ GUI 面板)支持 `list`、`set` 和 `delete`。密钥名匹配
|
|
|
629
650
|
`manage_local_ai` 工具读取、更新并测试本地分诊设置
|
|
630
651
|
(`action: "get" | "update" | "test"`);见 [LOCAL-AI.md](LOCAL-AI.md)。
|
|
631
652
|
|
|
653
|
+
## 作者反馈(bug 报告)
|
|
654
|
+
|
|
655
|
+
`report_bug` 通过**只写**接收端(Cloudflare Worker,在 `DeadSno/agent-steward`
|
|
656
|
+
创建 GitHub Issue)把结构化报告发送给插件作者;npm 包里不含任何 token,
|
|
657
|
+
fine-grained PAT(仅 `issues:write`)保存在 Worker 的 secrets 中。
|
|
658
|
+
|
|
659
|
+
参数:`description`(必填)、`destination: "author" | "local" | "both"`
|
|
660
|
+
(默认 `author`)、`dryRun`(只展示 payload,不发网络请求)、
|
|
661
|
+
`includeLogs`(默认 **false**)、`includeAnalytics`、`contactEmail`、`taskName`。
|
|
662
|
+
|
|
663
|
+
默认发送的 payload(`schemaVersion: 1`)包含插件/操作系统/Node 版本、locale、
|
|
664
|
+
当前 profile、可选任务名、描述,以及明确允许时才附上的脱敏日志和汇总指标。
|
|
665
|
+
默认**不**发送日志、邮箱或原始环境变量;客户端会剔除 `sk-`/`ghp_`/`xox*`/bot
|
|
666
|
+
token、`manage_secrets` 中的值、home → `~`、email → `[EMAIL]`。
|
|
667
|
+
|
|
668
|
+
隐私控制:`feedback.enabled` 默认 **false**,`includeLogs` 默认 **false**;
|
|
669
|
+
endpoint 必须是 https(localhost 可用 http),保存时校验。先调用
|
|
670
|
+
`report_bug` 且 `dryRun: true` 可查看完整 payload,确认后再发送。GUI 中有
|
|
671
|
+
专门的「作者反馈」设置区,消息提供 ru/en/zh 三种语言。投递采用 fail-open:
|
|
672
|
+
接收端不可用时报告写入本地 outbox,启动时重试(最多 5 次),不阻塞任务。
|
|
673
|
+
|
|
632
674
|
## 本地助手(分诊)
|
|
633
675
|
|
|
634
676
|
一个可选的离线模型对失败和 partial 的运行进行分类(类别、严重程度、
|
|
@@ -694,8 +736,9 @@ GUI 面板)支持 `list`、`set` 和 `delete`。密钥名匹配
|
|
|
694
736
|
和 `last` 覆盖常见场景;不支持按消息分叉/分支会话。
|
|
695
737
|
- **没有沙箱。** 钩子、Quality Gate 和 prompt 都以你的用户权限运行。
|
|
696
738
|
- **仪表板没有认证。** 设计上仅限 localhost。
|
|
697
|
-
-
|
|
698
|
-
|
|
739
|
+
- **密钥在静态存储时使用 AES-256-GCM 加密**,保存在 `<PLUGIN_DIR>/secrets.json`
|
|
740
|
+
(见 Secrets 一节)。密钥存放在 `secrets.key` 中;丢失后已存储的值无法恢复。
|
|
741
|
+
对于更高敏感度的密钥,建议使用环境变量或外部密钥管理器。
|
|
699
742
|
- **`allowedTools` / `deniedTools` 限制的是 agent 进程,而不是整个作业。**
|
|
700
743
|
钩子、Quality Gate 和包装器脚本仍以你的用户权限运行,而且项目级
|
|
701
744
|
或系统级 `opencode.jsonc` 可以削弱任务范围的拒绝规则。见
|