agent-steward 0.0.3 → 0.0.5
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 +154 -2
- package/CROSS_PLATFORM.md +19 -0
- package/README.md +54 -9
- package/ROADMAP-STRATEGY.md +23 -20
- package/ROADMAP.md +140 -143
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +351 -0
- package/dist/core/dlq-api.d.ts +44 -0
- package/dist/core/dlq-api.d.ts.map +1 -0
- package/dist/core/dlq-api.js +68 -0
- package/dist/core/dry-run.d.ts.map +1 -1
- package/dist/core/dry-run.js +18 -1
- package/dist/core/execution.d.ts +203 -0
- package/dist/core/execution.d.ts.map +1 -0
- package/dist/core/execution.js +309 -0
- package/dist/core/gate-integrity.d.ts +35 -0
- package/dist/core/gate-integrity.d.ts.map +1 -0
- package/dist/core/gate-integrity.js +132 -0
- package/dist/core/git-trigger.d.ts.map +1 -1
- package/dist/core/git-trigger.js +14 -2
- package/dist/core/guard-run.d.ts +4 -0
- package/dist/core/guard-run.d.ts.map +1 -0
- package/dist/core/guard-run.js +101 -0
- package/dist/core/guard.d.ts +52 -0
- package/dist/core/guard.d.ts.map +1 -0
- package/dist/core/guard.js +362 -0
- package/dist/core/lock.d.ts +61 -4
- package/dist/core/lock.d.ts.map +1 -1
- package/dist/core/lock.js +213 -26
- package/dist/core/matrix.d.ts.map +1 -1
- package/dist/core/matrix.js +75 -15
- package/dist/core/mission.d.ts +83 -0
- package/dist/core/mission.d.ts.map +1 -0
- package/dist/core/mission.js +334 -0
- package/dist/core/one-shot.d.ts +5 -1
- package/dist/core/one-shot.d.ts.map +1 -1
- package/dist/core/one-shot.js +33 -8
- package/dist/core/opencode-cli.d.ts +28 -0
- package/dist/core/opencode-cli.d.ts.map +1 -0
- package/dist/core/opencode-cli.js +74 -0
- package/dist/core/opencode-models.d.ts +62 -0
- package/dist/core/opencode-models.d.ts.map +1 -0
- package/dist/core/opencode-models.js +277 -0
- package/dist/core/pipeline-apply.d.ts +38 -0
- package/dist/core/pipeline-apply.d.ts.map +1 -0
- package/dist/core/pipeline-apply.js +117 -0
- package/dist/core/pipeline-io.d.ts +13 -0
- package/dist/core/pipeline-io.d.ts.map +1 -0
- package/dist/core/pipeline-io.js +64 -0
- package/dist/core/pipeline-map.d.ts +46 -0
- package/dist/core/pipeline-map.d.ts.map +1 -0
- package/dist/core/pipeline-map.js +196 -0
- package/dist/core/pipeline-spec.d.ts +109 -0
- package/dist/core/pipeline-spec.d.ts.map +1 -0
- package/dist/core/pipeline-spec.js +554 -0
- package/dist/core/ps-wrapper.d.ts +19 -2
- package/dist/core/ps-wrapper.d.ts.map +1 -1
- package/dist/core/ps-wrapper.js +261 -63
- package/dist/core/record-history.d.ts +15 -0
- package/dist/core/record-history.d.ts.map +1 -1
- package/dist/core/record-history.js +183 -58
- package/dist/core/router/dispatch.d.ts +36 -0
- package/dist/core/router/dispatch.d.ts.map +1 -0
- package/dist/core/router/dispatch.js +59 -0
- package/dist/core/router/escalation.d.ts +47 -0
- package/dist/core/router/escalation.d.ts.map +1 -0
- package/dist/core/router/escalation.js +87 -0
- package/dist/core/router/planner.d.ts +53 -0
- package/dist/core/router/planner.d.ts.map +1 -0
- package/dist/core/router/planner.js +113 -0
- package/dist/core/router/rules.d.ts +46 -0
- package/dist/core/router/rules.d.ts.map +1 -0
- package/dist/core/router/rules.js +91 -0
- package/dist/core/run-panel-api.d.ts +94 -0
- package/dist/core/run-panel-api.d.ts.map +1 -0
- package/dist/core/run-panel-api.js +169 -0
- package/dist/core/schedule-gate.js +5 -1
- package/dist/core/schedule-v2.d.ts +34 -0
- package/dist/core/schedule-v2.d.ts.map +1 -1
- package/dist/core/schedule-v2.js +91 -5
- package/dist/core/scheduler/at-fallback.d.ts +55 -2
- package/dist/core/scheduler/at-fallback.d.ts.map +1 -1
- package/dist/core/scheduler/at-fallback.js +135 -5
- package/dist/core/scheduler/linux.d.ts +18 -2
- package/dist/core/scheduler/linux.d.ts.map +1 -1
- package/dist/core/scheduler/linux.js +63 -20
- package/dist/core/scheduler/mac.d.ts +44 -2
- package/dist/core/scheduler/mac.d.ts.map +1 -1
- package/dist/core/scheduler/mac.js +126 -15
- package/dist/core/scheduler/posix.d.ts.map +1 -1
- package/dist/core/scheduler/posix.js +25 -1
- package/dist/core/scheduler/registry.d.ts +11 -0
- package/dist/core/scheduler/registry.d.ts.map +1 -1
- package/dist/core/scheduler/registry.js +83 -21
- package/dist/core/scheduler/run-now.d.ts +16 -0
- package/dist/core/scheduler/run-now.d.ts.map +1 -0
- package/dist/core/scheduler/run-now.js +28 -0
- package/dist/core/scheduler/windows.d.ts.map +1 -1
- package/dist/core/scheduler/windows.js +15 -12
- package/dist/core/secrets.d.ts.map +1 -1
- package/dist/core/secrets.js +125 -28
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +18 -11
- package/dist/core/structured-log.d.ts +7 -1
- package/dist/core/structured-log.d.ts.map +1 -1
- package/dist/core/task-name.d.ts +24 -0
- package/dist/core/task-name.d.ts.map +1 -0
- package/dist/core/task-name.js +40 -0
- package/dist/core/worktree-run.d.ts +4 -0
- package/dist/core/worktree-run.d.ts.map +1 -0
- package/dist/core/worktree-run.js +164 -0
- package/dist/core/worktree.d.ts +115 -0
- package/dist/core/worktree.d.ts.map +1 -0
- package/dist/core/worktree.js +462 -0
- package/dist/core/wrappers/bash.d.ts +17 -0
- package/dist/core/wrappers/bash.d.ts.map +1 -1
- package/dist/core/wrappers/bash.js +224 -28
- package/dist/db/capability-repo.d.ts +124 -0
- package/dist/db/capability-repo.d.ts.map +1 -0
- package/dist/db/capability-repo.js +267 -0
- package/dist/db/history-repo.d.ts +46 -5
- package/dist/db/history-repo.d.ts.map +1 -1
- package/dist/db/history-repo.js +107 -25
- package/dist/db/index.d.ts +4 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +39 -1
- package/dist/db/metrics-repo.js +2 -2
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +3 -1
- package/dist/db/recovery.d.ts.map +1 -1
- package/dist/db/recovery.js +5 -4
- package/dist/db/run-context.d.ts +103 -0
- package/dist/db/run-context.d.ts.map +1 -0
- package/dist/db/run-context.js +224 -0
- package/dist/db/run-dlq.d.ts +100 -0
- package/dist/db/run-dlq.d.ts.map +1 -0
- package/dist/db/run-dlq.js +191 -0
- package/dist/db/run-journal.d.ts +33 -5
- package/dist/db/run-journal.d.ts.map +1 -1
- package/dist/db/run-journal.js +78 -14
- package/dist/db/run-resume.d.ts +10 -2
- package/dist/db/run-resume.d.ts.map +1 -1
- package/dist/db/run-resume.js +39 -13
- package/dist/db/runs-repo.d.ts +32 -7
- package/dist/db/runs-repo.d.ts.map +1 -1
- package/dist/db/runs-repo.js +50 -11
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +216 -3
- package/dist/db/settings-repo.d.ts +11 -0
- package/dist/db/settings-repo.d.ts.map +1 -1
- package/dist/db/settings-repo.js +25 -0
- package/dist/db/step-idempotency.d.ts +51 -0
- package/dist/db/step-idempotency.d.ts.map +1 -0
- package/dist/db/step-idempotency.js +136 -0
- package/dist/history.d.ts +1 -1
- package/dist/history.d.ts.map +1 -1
- package/dist/i18n.d.ts +5 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +11 -4
- package/dist/index.d.ts +140 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +480 -18
- package/dist/notifications.d.ts +22 -0
- package/dist/notifications.d.ts.map +1 -1
- package/dist/notifications.js +36 -8
- package/dist/profiles.d.ts.map +1 -1
- package/dist/profiles.js +25 -4
- package/dist/rpc.d.ts +924 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +352 -0
- package/dist/server.d.ts +46 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +172 -53
- package/dist/settings.d.ts +2 -2
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +3 -3
- package/dist/shared/jobs-view.d.ts +1 -1
- package/dist/shared/jobs-view.d.ts.map +1 -1
- package/dist/shared/jobs-view.js +2 -0
- package/dist/task-transfer.d.ts +16 -0
- package/dist/task-transfer.d.ts.map +1 -1
- package/dist/task-transfer.js +16 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +7 -0
- package/dist/workspaces.d.ts +25 -3
- package/dist/workspaces.d.ts.map +1 -1
- package/dist/workspaces.js +43 -8
- package/docs/ARCHITECTURE.md +498 -58
- package/docs/COMPATIBILITY.md +2 -2
- package/docs/CONCEPT.md +185 -91
- package/docs/CROSS_PLATFORM.ru.md +20 -0
- package/docs/CROSS_PLATFORM.zh.md +18 -0
- package/docs/EXECUTION-LOOP.md +211 -0
- package/docs/FEATURES.md +65 -4
- package/docs/FEATURES.zh.md +52 -4
- package/docs/MIGRATION.md +2 -2
- package/docs/PIPELINE.md +293 -0
- package/docs/README.ru.md +44 -5
- package/docs/README.zh.md +46 -6
- package/docs/SAFETY.md +142 -0
- package/docs/SAVINGS.md +29 -0
- package/docs/SAVINGS.ru.md +29 -0
- package/docs/SAVINGS.zh.md +18 -0
- package/gui-experimental.cjs +9 -8
- package/locales/en.json +84 -1
- package/locales/ru.json +84 -1
- package/locales/zh.json +84 -1
- package/opencode.pipeline.yaml +35 -0
- package/package.json +46 -2
- package/scripts/audit-bundle.mjs +215 -0
- package/scripts/test-home.mjs +83 -0
- package/src/cli.ts +412 -0
- package/src/core/dlq-api.ts +98 -0
- package/src/core/dry-run.ts +27 -3
- package/src/core/execution.ts +538 -0
- package/src/core/file-watcher.ts +2 -2
- package/src/core/gate-integrity.ts +160 -0
- package/src/core/git-trigger.ts +18 -5
- package/src/core/guard-run.ts +119 -0
- package/src/core/guard.ts +431 -0
- package/src/core/lock.ts +244 -30
- package/src/core/matrix.ts +95 -50
- package/src/core/mission.ts +485 -0
- package/src/core/native-notify.ts +1 -1
- package/src/core/one-shot.ts +36 -8
- package/src/core/opencode-cli.ts +103 -0
- package/src/core/opencode-models.ts +315 -0
- package/src/core/pipeline-apply.ts +158 -0
- package/src/core/pipeline-io.ts +79 -0
- package/src/core/pipeline-map.ts +264 -0
- package/src/core/pipeline-spec.ts +775 -0
- package/src/core/ps-wrapper.ts +274 -64
- package/src/core/record-history.ts +229 -104
- package/src/core/router/dispatch.ts +94 -0
- package/src/core/router/escalation.ts +129 -0
- package/src/core/router/planner.ts +166 -0
- package/src/core/router/rules.ts +115 -0
- package/src/core/run-panel-api.ts +262 -0
- package/src/core/schedule-gate.ts +7 -3
- package/src/core/schedule-v2.ts +114 -5
- package/src/core/scheduler/at-fallback.ts +190 -5
- package/src/core/scheduler/linux.ts +72 -21
- package/src/core/scheduler/logs.ts +2 -2
- package/src/core/scheduler/mac.ts +174 -14
- package/src/core/scheduler/posix.ts +20 -1
- package/src/core/scheduler/registry.ts +107 -26
- package/src/core/scheduler/run-now.ts +32 -0
- package/src/core/scheduler/windows.ts +19 -15
- package/src/core/secrets.ts +131 -31
- package/src/core/session.ts +23 -10
- package/src/core/structured-log.ts +22 -5
- package/src/core/task-name.ts +67 -0
- package/src/core/telegram.ts +2 -2
- package/src/core/triage-worker.ts +7 -7
- package/src/core/triage.ts +2 -2
- package/src/core/worktree-run.ts +199 -0
- package/src/core/worktree.ts +600 -0
- package/src/core/wrappers/bash.ts +239 -27
- package/src/db/capability-repo.ts +402 -0
- package/src/db/history-repo.ts +151 -22
- package/src/db/index.ts +37 -1
- package/src/db/metrics-repo.ts +2 -2
- package/src/db/migrate.ts +3 -1
- package/src/db/recovery.ts +5 -4
- package/src/db/run-context.ts +370 -0
- package/src/db/run-dlq.ts +310 -0
- package/src/db/run-journal.ts +100 -13
- package/src/db/run-resume.ts +65 -13
- package/src/db/runs-repo.ts +66 -13
- package/src/db/schema.ts +218 -3
- package/src/db/settings-repo.ts +31 -0
- package/src/db/step-idempotency.ts +185 -0
- package/src/gui.tsx +692 -13
- package/src/history.ts +1 -1
- package/src/i18n.ts +12 -4
- package/src/index.ts +648 -8
- package/src/notifications.ts +38 -8
- package/src/profiles.ts +26 -4
- package/src/rpc.ts +379 -0
- package/src/server.ts +206 -54
- package/src/settings.ts +5 -5
- package/src/shared/jobs-view.ts +3 -1
- package/src/task-transfer.ts +31 -0
- package/src/types.ts +9 -0
- package/src/workspaces.ts +58 -9
package/src/notifications.ts
CHANGED
|
@@ -639,13 +639,43 @@ function embeddingKey(taskName: string, status: string): string {
|
|
|
639
639
|
return `emb:${(taskName + "|" + status).toLowerCase()}`;
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
-
/**
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
642
|
+
/**
|
|
643
|
+
* CJK-символы: хирагана, катакана, хань, совместимые идеограммы, хангыль.
|
|
644
|
+
* Регэксп без `g`, проверяется посимвольно.
|
|
645
|
+
*/
|
|
646
|
+
const CJK_CHAR_RE = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uac00-\ud7af]/;
|
|
647
|
+
|
|
648
|
+
/** Латиница, кириллица, цифры и диакритика — как раньше, но без вырезания CJK. */
|
|
649
|
+
const TOKEN_CHUNK_RE =
|
|
650
|
+
/[a-z\u00c0-\u024f\u0400-\u04ff0-9]+|[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uac00-\ud7af]+/g;
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Простой токенизатор: слова, цифры, нижний регистр.
|
|
654
|
+
*
|
|
655
|
+
* B14: CJK-блоки больше не вырезаются. Иероглифы не разделены пробелами,
|
|
656
|
+
* поэтому слово режется на перекрывающиеся биграммы («任务失败» → «任务»,
|
|
657
|
+
* «务失», «失败»); одиночный иероглиф остаётся униграммой. Это даёт
|
|
658
|
+
* ненулевой вектор для `zh`/`ja`/`ko` и работает без словарей и
|
|
659
|
+
* `Intl.Segmenter`, одинаково на всех платформах.
|
|
660
|
+
*/
|
|
661
|
+
export function tokenize(text: string): string[] {
|
|
662
|
+
const tokens: string[] = [];
|
|
663
|
+
for (const match of text.toLowerCase().matchAll(TOKEN_CHUNK_RE)) {
|
|
664
|
+
const chunk = match[0];
|
|
665
|
+
if (CJK_CHAR_RE.test(chunk[0])) {
|
|
666
|
+
const chars = Array.from(chunk);
|
|
667
|
+
if (chars.length === 1) {
|
|
668
|
+
tokens.push(chars[0]);
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
for (let i = 0; i < chars.length - 1; i++) {
|
|
672
|
+
tokens.push(chars[i] + chars[i + 1]);
|
|
673
|
+
}
|
|
674
|
+
} else {
|
|
675
|
+
tokens.push(chunk);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return tokens;
|
|
649
679
|
}
|
|
650
680
|
|
|
651
681
|
/**
|
|
@@ -659,7 +689,7 @@ function tokenize(text: string): string[] {
|
|
|
659
689
|
* Вес — 1 + log(tf), L2-нормализация; знак из старшего бита хеша снижает
|
|
660
690
|
* влияние коллизий.
|
|
661
691
|
*/
|
|
662
|
-
function textToVector(text: string): number[] {
|
|
692
|
+
export function textToVector(text: string): number[] {
|
|
663
693
|
const tokens = tokenize(text);
|
|
664
694
|
const vec: number[] = new Array(EMBEDDING_DIMENSION).fill(0);
|
|
665
695
|
if (tokens.length === 0) return vec;
|
package/src/profiles.ts
CHANGED
|
@@ -253,16 +253,38 @@ export function listProfiles(): ProfileInfo[] {
|
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
/**
|
|
256
|
+
/**
|
|
257
|
+
* Порты, зарезервированные за профилем default: основной (PREFERRED_PORT
|
|
258
|
+
* в server.ts) и запасной. У default может не быть profile.json, поэтому
|
|
259
|
+
* в listProfiles() его порт — null, и раньше аллокатор выдавал 3782 второму
|
|
260
|
+
* профилю: два дашборда дрались за один порт.
|
|
261
|
+
*/
|
|
262
|
+
const DEFAULT_PROFILE_PORTS = new Set([3782, 4782]);
|
|
263
|
+
const FIRST_PROFILE_PORT = 3783;
|
|
264
|
+
const LAST_PORT = 65535;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Свободный порт для нового профиля (B4.2).
|
|
268
|
+
*
|
|
269
|
+
* Исключает зарезервированные порты default, порты из profile.json всех
|
|
270
|
+
* профилей и порт, заданный через OPENCODE_SCHEDULER_PORT. Сканирует диапазон
|
|
271
|
+
* от 3783 до 65535 и берёт первый не занятый — прежняя формула
|
|
272
|
+
* `3782 + used.size` могла выдать уже занятый порт (например, при
|
|
273
|
+
* зарезервированном 3783 и одном профиле).
|
|
274
|
+
*/
|
|
257
275
|
function allocateProfilePort(): number {
|
|
258
|
-
const used = new Set<number>();
|
|
276
|
+
const used = new Set<number>(DEFAULT_PROFILE_PORTS);
|
|
259
277
|
for (const profile of listProfiles()) {
|
|
260
278
|
if (profile.port) used.add(profile.port);
|
|
261
279
|
}
|
|
262
|
-
|
|
280
|
+
const fromEnv = Number(process.env.OPENCODE_SCHEDULER_PORT);
|
|
281
|
+
if (Number.isFinite(fromEnv) && fromEnv >= 1 && fromEnv <= LAST_PORT) {
|
|
282
|
+
used.add(Math.floor(fromEnv));
|
|
283
|
+
}
|
|
284
|
+
for (let port = FIRST_PROFILE_PORT; port <= LAST_PORT; port += 1) {
|
|
263
285
|
if (!used.has(port)) return port;
|
|
264
286
|
}
|
|
265
|
-
|
|
287
|
+
throw new Error("Не удалось выделить порт профилю: свободных портов не осталось.");
|
|
266
288
|
}
|
|
267
289
|
|
|
268
290
|
/**
|
package/src/rpc.ts
CHANGED
|
@@ -306,6 +306,54 @@ const DeleteTaskOutput = {
|
|
|
306
306
|
|
|
307
307
|
const RunTaskOutput = DeleteTaskOutput;
|
|
308
308
|
|
|
309
|
+
const RunMissionInput = {
|
|
310
|
+
type: "object" as const,
|
|
311
|
+
properties: {
|
|
312
|
+
prompt: { type: "string" },
|
|
313
|
+
cwd: { type: "string" },
|
|
314
|
+
taskName: { type: "string" },
|
|
315
|
+
taskType: { type: "string" },
|
|
316
|
+
model: { type: "string" },
|
|
317
|
+
session: { type: "string", enum: ["new", "reuse", "last"] },
|
|
318
|
+
sessionId: { type: "string" },
|
|
319
|
+
timeoutSeconds: { type: "number" },
|
|
320
|
+
gate: { type: "string" },
|
|
321
|
+
gateTimeoutSeconds: { type: "number" },
|
|
322
|
+
policy: { type: "string", enum: ["hybrid", "secure", "legacy"] },
|
|
323
|
+
allowedTools: { type: "array", items: { type: "string" } },
|
|
324
|
+
deniedTools: { type: "array", items: { type: "string" } },
|
|
325
|
+
dryRun: { type: "boolean" },
|
|
326
|
+
},
|
|
327
|
+
required: ["prompt"],
|
|
328
|
+
} as const;
|
|
329
|
+
|
|
330
|
+
const RunMissionOutput = {
|
|
331
|
+
type: "object" as const,
|
|
332
|
+
properties: {
|
|
333
|
+
success: { type: "boolean" },
|
|
334
|
+
dryRun: { type: "boolean" },
|
|
335
|
+
runId: { type: "string" },
|
|
336
|
+
status: { type: "string" },
|
|
337
|
+
description: { type: "string" },
|
|
338
|
+
error: { type: "string" },
|
|
339
|
+
steps: {
|
|
340
|
+
type: "array",
|
|
341
|
+
items: {
|
|
342
|
+
type: "object",
|
|
343
|
+
properties: {
|
|
344
|
+
stepName: { type: "string" },
|
|
345
|
+
taskType: { type: "string" },
|
|
346
|
+
target: { type: "string" },
|
|
347
|
+
status: { type: "string" },
|
|
348
|
+
attempt: { type: "number" },
|
|
349
|
+
error: { type: "string" },
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
required: ["success", "dryRun", "status", "description"],
|
|
355
|
+
} as const;
|
|
356
|
+
|
|
309
357
|
const GetTaskLogsInput = NameOnly;
|
|
310
358
|
|
|
311
359
|
const GetTaskLogsOutput = {
|
|
@@ -899,6 +947,251 @@ const GetAuditOutput = {
|
|
|
899
947
|
required: ["success", "records", "total"],
|
|
900
948
|
} as const;
|
|
901
949
|
|
|
950
|
+
/** Запись dead-letter queue (Спринт 36.6). */
|
|
951
|
+
const DlqEntrySchema = {
|
|
952
|
+
type: "object" as const,
|
|
953
|
+
properties: {
|
|
954
|
+
id: { type: "string" },
|
|
955
|
+
runId: { type: "string" },
|
|
956
|
+
stepName: { type: "string" },
|
|
957
|
+
status: { type: "string" },
|
|
958
|
+
reason: { type: ["string", "null"] },
|
|
959
|
+
error: { type: ["string", "null"] },
|
|
960
|
+
attempts: { type: "number" },
|
|
961
|
+
createdAt: { type: "string" },
|
|
962
|
+
updatedAt: { type: "string" },
|
|
963
|
+
resolvedAt: { type: ["string", "null"] },
|
|
964
|
+
resolution: { type: ["string", "null"] },
|
|
965
|
+
},
|
|
966
|
+
required: [
|
|
967
|
+
"id",
|
|
968
|
+
"runId",
|
|
969
|
+
"stepName",
|
|
970
|
+
"status",
|
|
971
|
+
"reason",
|
|
972
|
+
"error",
|
|
973
|
+
"attempts",
|
|
974
|
+
"createdAt",
|
|
975
|
+
"updatedAt",
|
|
976
|
+
"resolvedAt",
|
|
977
|
+
"resolution",
|
|
978
|
+
],
|
|
979
|
+
} as const;
|
|
980
|
+
|
|
981
|
+
const ListDlqInput = {
|
|
982
|
+
type: "object" as const,
|
|
983
|
+
properties: {
|
|
984
|
+
/** open (по умолчанию) | retried | discarded | all. */
|
|
985
|
+
status: { type: "string" },
|
|
986
|
+
/** Сколько записей вернуть (по умолчанию 100, максимум 500). */
|
|
987
|
+
limit: { type: "number" },
|
|
988
|
+
},
|
|
989
|
+
additionalProperties: false,
|
|
990
|
+
} as const;
|
|
991
|
+
|
|
992
|
+
const ListDlqOutput = {
|
|
993
|
+
type: "object" as const,
|
|
994
|
+
properties: {
|
|
995
|
+
success: { type: "boolean" },
|
|
996
|
+
entries: { type: "array", items: DlqEntrySchema },
|
|
997
|
+
open: { type: "number" },
|
|
998
|
+
error: { type: "string" },
|
|
999
|
+
},
|
|
1000
|
+
required: ["success", "entries", "open"],
|
|
1001
|
+
additionalProperties: false,
|
|
1002
|
+
} as const;
|
|
1003
|
+
|
|
1004
|
+
const RetryDlqInput = {
|
|
1005
|
+
type: "object" as const,
|
|
1006
|
+
properties: {
|
|
1007
|
+
id: { type: "string" },
|
|
1008
|
+
},
|
|
1009
|
+
required: ["id"],
|
|
1010
|
+
additionalProperties: false,
|
|
1011
|
+
} as const;
|
|
1012
|
+
|
|
1013
|
+
const RetryDlqOutput = {
|
|
1014
|
+
type: "object" as const,
|
|
1015
|
+
properties: {
|
|
1016
|
+
success: { type: "boolean" },
|
|
1017
|
+
error: { type: "string" },
|
|
1018
|
+
entry: DlqEntrySchema,
|
|
1019
|
+
runId: { type: "string" },
|
|
1020
|
+
stepName: { type: "string" },
|
|
1021
|
+
runReopened: { type: "boolean" },
|
|
1022
|
+
},
|
|
1023
|
+
required: ["success"],
|
|
1024
|
+
additionalProperties: false,
|
|
1025
|
+
} as const;
|
|
1026
|
+
|
|
1027
|
+
const DiscardDlqInput = {
|
|
1028
|
+
type: "object" as const,
|
|
1029
|
+
properties: {
|
|
1030
|
+
id: { type: "string" },
|
|
1031
|
+
/** Причина отказа для журнала (по умолчанию discarded). */
|
|
1032
|
+
resolution: { type: "string" },
|
|
1033
|
+
},
|
|
1034
|
+
required: ["id"],
|
|
1035
|
+
additionalProperties: false,
|
|
1036
|
+
} as const;
|
|
1037
|
+
|
|
1038
|
+
const DiscardDlqOutput = {
|
|
1039
|
+
type: "object" as const,
|
|
1040
|
+
properties: {
|
|
1041
|
+
success: { type: "boolean" },
|
|
1042
|
+
error: { type: "string" },
|
|
1043
|
+
entry: DlqEntrySchema,
|
|
1044
|
+
},
|
|
1045
|
+
required: ["success"],
|
|
1046
|
+
additionalProperties: false,
|
|
1047
|
+
} as const;
|
|
1048
|
+
|
|
1049
|
+
/** Шаг durable-запуска для панели (Спринт 36.8). */
|
|
1050
|
+
const RunPanelStepSchema = {
|
|
1051
|
+
type: "object" as const,
|
|
1052
|
+
properties: {
|
|
1053
|
+
stepName: { type: "string" },
|
|
1054
|
+
position: { type: "number" },
|
|
1055
|
+
status: { type: "string" },
|
|
1056
|
+
attempt: { type: "number" },
|
|
1057
|
+
error: { type: ["string", "null"] },
|
|
1058
|
+
anchor: { type: "string" },
|
|
1059
|
+
},
|
|
1060
|
+
required: ["stepName", "position", "status", "attempt", "error", "anchor"],
|
|
1061
|
+
} as const;
|
|
1062
|
+
|
|
1063
|
+
/** Вставка контекста в истории запуска. */
|
|
1064
|
+
const RunPanelInjectionSchema = {
|
|
1065
|
+
type: "object" as const,
|
|
1066
|
+
properties: {
|
|
1067
|
+
id: { type: "string" },
|
|
1068
|
+
kind: { type: "string" },
|
|
1069
|
+
content: { type: "string" },
|
|
1070
|
+
contentLength: { type: "number" },
|
|
1071
|
+
author: { type: "string" },
|
|
1072
|
+
createdAt: { type: "string" },
|
|
1073
|
+
consumedAt: { type: ["string", "null"] },
|
|
1074
|
+
consumedByStep: { type: ["string", "null"] },
|
|
1075
|
+
},
|
|
1076
|
+
required: [
|
|
1077
|
+
"id",
|
|
1078
|
+
"kind",
|
|
1079
|
+
"content",
|
|
1080
|
+
"contentLength",
|
|
1081
|
+
"author",
|
|
1082
|
+
"createdAt",
|
|
1083
|
+
"consumedAt",
|
|
1084
|
+
"consumedByStep",
|
|
1085
|
+
],
|
|
1086
|
+
} as const;
|
|
1087
|
+
|
|
1088
|
+
/** Durable-запуск в панели паузы/resume. */
|
|
1089
|
+
const RunPanelRunSchema = {
|
|
1090
|
+
type: "object" as const,
|
|
1091
|
+
properties: {
|
|
1092
|
+
id: { type: "string" },
|
|
1093
|
+
taskName: { type: "string" },
|
|
1094
|
+
status: { type: "string" },
|
|
1095
|
+
createdAt: { type: "string" },
|
|
1096
|
+
startedAt: { type: ["string", "null"] },
|
|
1097
|
+
finishedAt: { type: ["string", "null"] },
|
|
1098
|
+
error: { type: ["string", "null"] },
|
|
1099
|
+
steps: { type: "array", items: RunPanelStepSchema },
|
|
1100
|
+
currentStep: { type: ["object", "null"], properties: RunPanelStepSchema.properties },
|
|
1101
|
+
doneSteps: { type: "number" },
|
|
1102
|
+
totalSteps: { type: "number" },
|
|
1103
|
+
injections: { type: "array", items: RunPanelInjectionSchema },
|
|
1104
|
+
pendingInjections: { type: "number" },
|
|
1105
|
+
},
|
|
1106
|
+
required: [
|
|
1107
|
+
"id",
|
|
1108
|
+
"taskName",
|
|
1109
|
+
"status",
|
|
1110
|
+
"createdAt",
|
|
1111
|
+
"startedAt",
|
|
1112
|
+
"finishedAt",
|
|
1113
|
+
"error",
|
|
1114
|
+
"steps",
|
|
1115
|
+
"currentStep",
|
|
1116
|
+
"doneSteps",
|
|
1117
|
+
"totalSteps",
|
|
1118
|
+
"injections",
|
|
1119
|
+
"pendingInjections",
|
|
1120
|
+
],
|
|
1121
|
+
} as const;
|
|
1122
|
+
|
|
1123
|
+
const ListDurableRunsInput = {
|
|
1124
|
+
type: "object" as const,
|
|
1125
|
+
properties: {
|
|
1126
|
+
/** active (по умолчанию) | all | pending | running | paused | passed | failed | cancelled. */
|
|
1127
|
+
filter: { type: "string" },
|
|
1128
|
+
/** Сколько запусков вернуть (по умолчанию 20, максимум 100). */
|
|
1129
|
+
limit: { type: "number" },
|
|
1130
|
+
},
|
|
1131
|
+
additionalProperties: false,
|
|
1132
|
+
} as const;
|
|
1133
|
+
|
|
1134
|
+
const ListDurableRunsOutput = {
|
|
1135
|
+
type: "object" as const,
|
|
1136
|
+
properties: {
|
|
1137
|
+
success: { type: "boolean" },
|
|
1138
|
+
runs: { type: "array", items: RunPanelRunSchema },
|
|
1139
|
+
active: { type: "number" },
|
|
1140
|
+
error: { type: "string" },
|
|
1141
|
+
},
|
|
1142
|
+
required: ["success", "runs", "active"],
|
|
1143
|
+
additionalProperties: false,
|
|
1144
|
+
} as const;
|
|
1145
|
+
|
|
1146
|
+
const PauseDurableRunInput = {
|
|
1147
|
+
type: "object" as const,
|
|
1148
|
+
properties: {
|
|
1149
|
+
runId: { type: "string" },
|
|
1150
|
+
/** Явный шаг-получатель; по умолчанию первый незавершённый. */
|
|
1151
|
+
stepName: { type: "string" },
|
|
1152
|
+
/** Комментарий, который получит шаг при resume. */
|
|
1153
|
+
comment: { type: "string" },
|
|
1154
|
+
/** Автор комментария (по умолчанию local-user). */
|
|
1155
|
+
author: { type: "string" },
|
|
1156
|
+
},
|
|
1157
|
+
required: ["runId"],
|
|
1158
|
+
additionalProperties: false,
|
|
1159
|
+
} as const;
|
|
1160
|
+
|
|
1161
|
+
const PauseDurableRunOutput = {
|
|
1162
|
+
type: "object" as const,
|
|
1163
|
+
properties: {
|
|
1164
|
+
success: { type: "boolean" },
|
|
1165
|
+
error: { type: "string" },
|
|
1166
|
+
run: RunPanelRunSchema,
|
|
1167
|
+
stepName: { type: ["string", "null"] },
|
|
1168
|
+
},
|
|
1169
|
+
required: ["success"],
|
|
1170
|
+
additionalProperties: false,
|
|
1171
|
+
} as const;
|
|
1172
|
+
|
|
1173
|
+
const ResumeDurableRunInput = {
|
|
1174
|
+
type: "object" as const,
|
|
1175
|
+
properties: {
|
|
1176
|
+
runId: { type: "string" },
|
|
1177
|
+
},
|
|
1178
|
+
required: ["runId"],
|
|
1179
|
+
additionalProperties: false,
|
|
1180
|
+
} as const;
|
|
1181
|
+
|
|
1182
|
+
const ResumeDurableRunOutput = {
|
|
1183
|
+
type: "object" as const,
|
|
1184
|
+
properties: {
|
|
1185
|
+
success: { type: "boolean" },
|
|
1186
|
+
error: { type: "string" },
|
|
1187
|
+
run: RunPanelRunSchema,
|
|
1188
|
+
stepName: { type: ["string", "null"] },
|
|
1189
|
+
prepared: { type: "boolean" },
|
|
1190
|
+
},
|
|
1191
|
+
required: ["success"],
|
|
1192
|
+
additionalProperties: false,
|
|
1193
|
+
} as const;
|
|
1194
|
+
|
|
902
1195
|
/** Сравнение триажа «до/после» (Спринт 31.5). */
|
|
903
1196
|
const CompareTriageInput = {
|
|
904
1197
|
type: "object" as const,
|
|
@@ -1420,6 +1713,82 @@ const DryRunAllOutput = {
|
|
|
1420
1713
|
required: ["success", "reports"],
|
|
1421
1714
|
} as const;
|
|
1422
1715
|
|
|
1716
|
+
/* === Pipeline-as-code (спринт 32) === */
|
|
1717
|
+
|
|
1718
|
+
const PipelineValidateInput = {
|
|
1719
|
+
type: "object" as const,
|
|
1720
|
+
properties: {
|
|
1721
|
+
path: { type: "string" },
|
|
1722
|
+
source: { type: "string" },
|
|
1723
|
+
dryRun: { type: "boolean" },
|
|
1724
|
+
},
|
|
1725
|
+
additionalProperties: false,
|
|
1726
|
+
} as const;
|
|
1727
|
+
|
|
1728
|
+
const PipelineIssue = {
|
|
1729
|
+
type: "object" as const,
|
|
1730
|
+
properties: {
|
|
1731
|
+
path: { type: "string" },
|
|
1732
|
+
message: { type: "string" },
|
|
1733
|
+
},
|
|
1734
|
+
required: ["path", "message"],
|
|
1735
|
+
} as const;
|
|
1736
|
+
|
|
1737
|
+
const PipelineValidationOutput = {
|
|
1738
|
+
type: "object" as const,
|
|
1739
|
+
properties: {
|
|
1740
|
+
ok: { type: "boolean" },
|
|
1741
|
+
errors: { type: "array", items: PipelineIssue },
|
|
1742
|
+
warnings: { type: "array", items: PipelineIssue },
|
|
1743
|
+
spec: {},
|
|
1744
|
+
},
|
|
1745
|
+
required: ["ok", "errors", "warnings"],
|
|
1746
|
+
} as const;
|
|
1747
|
+
|
|
1748
|
+
const PipelineApplyInput = {
|
|
1749
|
+
type: "object" as const,
|
|
1750
|
+
properties: {
|
|
1751
|
+
path: { type: "string" },
|
|
1752
|
+
source: { type: "string" },
|
|
1753
|
+
dryRun: { type: "boolean" },
|
|
1754
|
+
},
|
|
1755
|
+
additionalProperties: false,
|
|
1756
|
+
} as const;
|
|
1757
|
+
|
|
1758
|
+
const PipelineApplyOutput = {
|
|
1759
|
+
type: "object" as const,
|
|
1760
|
+
properties: {
|
|
1761
|
+
created: { type: "number" },
|
|
1762
|
+
updated: { type: "number" },
|
|
1763
|
+
unchanged: { type: "number" },
|
|
1764
|
+
stale: { type: "number" },
|
|
1765
|
+
warnings: { type: "array", items: { type: "string" } },
|
|
1766
|
+
errors: { type: "array", items: PipelineIssue },
|
|
1767
|
+
},
|
|
1768
|
+
required: ["created", "updated", "unchanged", "stale"],
|
|
1769
|
+
} as const;
|
|
1770
|
+
|
|
1771
|
+
const PipelineExportInput = {
|
|
1772
|
+
type: "object" as const,
|
|
1773
|
+
properties: {
|
|
1774
|
+
pipeline: { type: "string" },
|
|
1775
|
+
},
|
|
1776
|
+
required: ["pipeline"],
|
|
1777
|
+
additionalProperties: false,
|
|
1778
|
+
} as const;
|
|
1779
|
+
|
|
1780
|
+
const PipelineExportOutput = {
|
|
1781
|
+
type: "object" as const,
|
|
1782
|
+
properties: {
|
|
1783
|
+
ok: { type: "boolean" },
|
|
1784
|
+
spec: {},
|
|
1785
|
+
error: { type: "string" },
|
|
1786
|
+
},
|
|
1787
|
+
required: ["ok"],
|
|
1788
|
+
} as const;
|
|
1789
|
+
|
|
1790
|
+
/* === end Pipeline-as-code === */
|
|
1791
|
+
|
|
1423
1792
|
/** Детальный отчёт по одному клону матрицы. */
|
|
1424
1793
|
const MatrixCloneResult = {
|
|
1425
1794
|
type: "object" as const,
|
|
@@ -1627,6 +1996,7 @@ export const SchedulerRpc = Rpc.define({
|
|
|
1627
1996
|
create_task: { input: CreateTaskInput, output: CreateTaskOutput },
|
|
1628
1997
|
delete_task: { input: DeleteTaskInput, output: DeleteTaskOutput },
|
|
1629
1998
|
run_task: { input: RunTaskInput, output: RunTaskOutput },
|
|
1999
|
+
run_mission: { input: RunMissionInput, output: RunMissionOutput },
|
|
1630
2000
|
pause_task: { input: PauseResumeInput, output: DeleteTaskOutput },
|
|
1631
2001
|
resume_task: { input: PauseResumeInput, output: DeleteTaskOutput },
|
|
1632
2002
|
update_task: { input: UpdateTaskInput, output: UpdateTaskOutput },
|
|
@@ -1637,6 +2007,9 @@ export const SchedulerRpc = Rpc.define({
|
|
|
1637
2007
|
get_platform: { input: GetPlatformInput, output: GetPlatformOutput },
|
|
1638
2008
|
dry_run: { input: DryRunInput, output: DryRunReportOutput },
|
|
1639
2009
|
dry_run_all: { input: GetTasksInput, output: DryRunAllOutput },
|
|
2010
|
+
pipeline_validate: { input: PipelineValidateInput, output: PipelineValidationOutput },
|
|
2011
|
+
pipeline_apply: { input: PipelineApplyInput, output: PipelineApplyOutput },
|
|
2012
|
+
pipeline_export: { input: PipelineExportInput, output: PipelineExportOutput },
|
|
1640
2013
|
get_matrix_results: {
|
|
1641
2014
|
input: GetMatrixResultsInput,
|
|
1642
2015
|
output: GetMatrixResultsOutput,
|
|
@@ -1681,6 +2054,12 @@ export const SchedulerRpc = Rpc.define({
|
|
|
1681
2054
|
save_secret: { input: SaveSecretInput, output: SaveSecretOutput },
|
|
1682
2055
|
delete_secret: { input: DeleteSecretInput, output: DeleteSecretOutput },
|
|
1683
2056
|
get_audit: { input: GetAuditInput, output: GetAuditOutput },
|
|
2057
|
+
list_dlq: { input: ListDlqInput, output: ListDlqOutput },
|
|
2058
|
+
retry_dlq: { input: RetryDlqInput, output: RetryDlqOutput },
|
|
2059
|
+
discard_dlq: { input: DiscardDlqInput, output: DiscardDlqOutput },
|
|
2060
|
+
list_durable_runs: { input: ListDurableRunsInput, output: ListDurableRunsOutput },
|
|
2061
|
+
pause_durable_run: { input: PauseDurableRunInput, output: PauseDurableRunOutput },
|
|
2062
|
+
resume_durable_run: { input: ResumeDurableRunInput, output: ResumeDurableRunOutput },
|
|
1684
2063
|
compare_triage: {
|
|
1685
2064
|
input: CompareTriageInput,
|
|
1686
2065
|
output: CompareTriageOutput,
|