agent-steward 0.0.3 → 0.0.4
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 +20 -0
- package/README.md +3 -3
- package/ROADMAP-STRATEGY.md +9 -9
- package/ROADMAP.md +50 -34
- 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/lock.d.ts +20 -4
- package/dist/core/lock.d.ts.map +1 -1
- package/dist/core/lock.js +97 -22
- 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/ps-wrapper.d.ts +1 -1
- package/dist/core/ps-wrapper.d.ts.map +1 -1
- package/dist/core/ps-wrapper.js +11 -1
- 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 +56 -32
- 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 +85 -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 +10 -1
- package/dist/core/scheduler/linux.d.ts.map +1 -1
- package/dist/core/scheduler/linux.js +29 -11
- 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/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/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/wrappers/bash.d.ts.map +1 -1
- package/dist/core/wrappers/bash.js +49 -4
- package/dist/db/capability-repo.d.ts +83 -0
- package/dist/db/capability-repo.d.ts.map +1 -0
- package/dist/db/capability-repo.js +182 -0
- package/dist/db/history-repo.d.ts +8 -0
- package/dist/db/history-repo.d.ts.map +1 -1
- package/dist/db/history-repo.js +19 -0
- 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/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +3 -1
- 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-resume.d.ts +5 -2
- package/dist/db/run-resume.d.ts.map +1 -1
- package/dist/db/run-resume.js +30 -11
- package/dist/db/runs-repo.d.ts +13 -5
- package/dist/db/runs-repo.d.ts.map +1 -1
- package/dist/db/runs-repo.js +28 -5
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +154 -2
- 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/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +102 -4
- package/dist/rpc.d.ts +678 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +235 -0
- package/dist/server.d.ts +31 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +95 -35
- 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 +229 -5
- package/docs/CONCEPT.md +171 -91
- package/docs/EXECUTION-LOOP.md +196 -0
- package/docs/README.ru.md +2 -2
- package/docs/README.zh.md +3 -3
- package/docs/SAFETY.md +122 -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 +8 -8
- package/locales/en.json +67 -0
- package/locales/ru.json +67 -0
- package/locales/zh.json +67 -0
- package/package.json +28 -3
- package/scripts/audit-bundle.mjs +215 -0
- package/src/core/dlq-api.ts +98 -0
- package/src/core/dry-run.ts +25 -1
- package/src/core/lock.ts +95 -22
- 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/ps-wrapper.ts +11 -1
- package/src/core/record-history.ts +75 -37
- 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 +109 -0
- package/src/core/run-panel-api.ts +262 -0
- package/src/core/schedule-gate.ts +6 -2
- package/src/core/schedule-v2.ts +114 -5
- package/src/core/scheduler/at-fallback.ts +190 -5
- package/src/core/scheduler/linux.ts +32 -10
- 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/secrets.ts +127 -27
- package/src/core/session.ts +23 -10
- package/src/core/task-name.ts +67 -0
- package/src/core/wrappers/bash.ts +49 -4
- package/src/db/capability-repo.ts +285 -0
- package/src/db/history-repo.ts +22 -0
- package/src/db/index.ts +37 -1
- package/src/db/migrate.ts +3 -1
- package/src/db/run-context.ts +370 -0
- package/src/db/run-dlq.ts +310 -0
- package/src/db/run-resume.ts +48 -12
- package/src/db/runs-repo.ts +30 -7
- package/src/db/schema.ts +154 -2
- package/src/db/settings-repo.ts +31 -0
- package/src/db/step-idempotency.ts +185 -0
- package/src/gui.tsx +515 -0
- package/src/index.ts +124 -4
- package/src/rpc.ts +251 -0
- package/src/server.ts +112 -36
- package/src/types.ts +9 -0
- package/src/workspaces.ts +58 -9
package/src/index.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
validateModelId,
|
|
23
23
|
validateTaskName,
|
|
24
24
|
} from "./types.js";
|
|
25
|
-
import { parseCron, buildScheduleGate, isValidIanaTimeZone, validateLaunchWindow, prevRun, nextRun as cronNextRun, normalizeActiveDays, activeWindowState, nextWindowOpenDelayMs } from "./core/schedule-v2.js";
|
|
25
|
+
import { parseCron, buildScheduleGate, isValidIanaTimeZone, validateLaunchWindow, prevRun, nextRun as cronNextRun, normalizeActiveDays, activeWindowState, nextWindowOpenDelayMs, assessCronWindowFeasibility, windowFeasibilityReasonText } from "./core/schedule-v2.js";
|
|
26
26
|
import {
|
|
27
27
|
buildLaunchdOneShotCleanup,
|
|
28
28
|
normalizeOneShotRunAt,
|
|
@@ -36,9 +36,10 @@ import {
|
|
|
36
36
|
type SessionMode,
|
|
37
37
|
} from "./core/session.js";
|
|
38
38
|
import { ensureWrapper, writePromptFile, writeWrapperCmd, lockFilePath, requestImmediateRun } from "./core/ps-wrapper.js";
|
|
39
|
-
import { getSchedulerBackend } from "./core/scheduler/index.js";
|
|
39
|
+
import { getSchedulerBackend, LinuxScheduler } from "./core/scheduler/index.js";
|
|
40
40
|
import { SCHEDULER_SKILL_ID, loadSchedulerSkill } from "./skill.js";
|
|
41
41
|
import { getTaskLogs } from "./core/scheduler/logs.js";
|
|
42
|
+
import { findSanitizedNameConflict, sanitizedConflictMessage } from "./core/task-name.js";
|
|
42
43
|
import { writeBashWrapper } from "./core/wrappers/bash.js";
|
|
43
44
|
import { simulatePipeline } from "./core/dry-run.js";
|
|
44
45
|
import {
|
|
@@ -78,6 +79,12 @@ import { buildAnalytics } from "./core/analytics.js";
|
|
|
78
79
|
import { generateSelfAnalysisReport } from "./core/self-analysis.js";
|
|
79
80
|
import { getHistory, listRunningRecords } from "./db/history-repo.js";
|
|
80
81
|
import { getAllMetrics } from "./db/metrics-repo.js";
|
|
82
|
+
import { discardDlq, listDlq, retryDlq } from "./core/dlq-api.js";
|
|
83
|
+
import {
|
|
84
|
+
listRunPanel,
|
|
85
|
+
pauseRunPanel,
|
|
86
|
+
resumeRunPanel,
|
|
87
|
+
} from "./core/run-panel-api.js";
|
|
81
88
|
import {
|
|
82
89
|
findStuckMatrixClones,
|
|
83
90
|
maybeSendDigest,
|
|
@@ -2448,8 +2455,17 @@ async function refreshWorkspaceEnvFiles(workspaceId: string): Promise<number> {
|
|
|
2448
2455
|
let refreshed = 0;
|
|
2449
2456
|
for (const task of await loadTaskDefinitions()) {
|
|
2450
2457
|
if (task.workspaceId !== workspaceId) continue;
|
|
2451
|
-
|
|
2452
|
-
|
|
2458
|
+
try {
|
|
2459
|
+
writeWorkspaceEnvFile(workspace, PLUGIN_DIR, sanitizeName(task.name));
|
|
2460
|
+
refreshed += 1;
|
|
2461
|
+
} catch (err: any) {
|
|
2462
|
+
// P2-21: не разрешаем задаче работать с литералом ${secret:...}.
|
|
2463
|
+
console.error(
|
|
2464
|
+
`[workspace] Задача "${task.name}": env-файл не обновлён — ${
|
|
2465
|
+
err instanceof Error ? err.message : String(err)
|
|
2466
|
+
}`,
|
|
2467
|
+
);
|
|
2468
|
+
}
|
|
2453
2469
|
}
|
|
2454
2470
|
return refreshed;
|
|
2455
2471
|
}
|
|
@@ -3227,6 +3243,18 @@ const RPC_AUDIT_RULES: Record<
|
|
|
3227
3243
|
targetType: "history",
|
|
3228
3244
|
target: () => "runs",
|
|
3229
3245
|
},
|
|
3246
|
+
retry_dlq: { action: "dlq.retry", targetType: "dlq", target: (i) => i.id ?? "" },
|
|
3247
|
+
discard_dlq: { action: "dlq.discard", targetType: "dlq", target: (i) => i.id ?? "" },
|
|
3248
|
+
pause_durable_run: {
|
|
3249
|
+
action: "run.pause",
|
|
3250
|
+
targetType: "run",
|
|
3251
|
+
target: (i) => i.runId ?? "",
|
|
3252
|
+
},
|
|
3253
|
+
resume_durable_run: {
|
|
3254
|
+
action: "run.resume",
|
|
3255
|
+
targetType: "run",
|
|
3256
|
+
target: (i) => i.runId ?? "",
|
|
3257
|
+
},
|
|
3230
3258
|
emit_event: { action: "event.emit", targetType: "event", target: (i) => i.eventName ?? "" },
|
|
3231
3259
|
add_workspace: {
|
|
3232
3260
|
action: "workspace.add",
|
|
@@ -3470,6 +3498,26 @@ export async function createRuntime(ctxLike: RuntimeContextLike): Promise<Schedu
|
|
|
3470
3498
|
}`,
|
|
3471
3499
|
);
|
|
3472
3500
|
}
|
|
3501
|
+
// P1-14: pid:-записи fallback'а не переживают перезагрузку. Чистим их и
|
|
3502
|
+
// пересоздаём будущие one-shot, иначе после reboot можно убить чужой pid.
|
|
3503
|
+
if (scheduler instanceof LinuxScheduler) {
|
|
3504
|
+
try {
|
|
3505
|
+
const report = await scheduler.pruneStaleFallbacks();
|
|
3506
|
+
if (report.removed || report.rescheduled || report.missed) {
|
|
3507
|
+
console.log(
|
|
3508
|
+
`[scheduler] Fallback one-shot: удалено ${report.removed}, ` +
|
|
3509
|
+
`пересоздано ${report.rescheduled}, пропущено ${report.missed}, ` +
|
|
3510
|
+
`живо ${report.kept}.`,
|
|
3511
|
+
);
|
|
3512
|
+
}
|
|
3513
|
+
} catch (err: any) {
|
|
3514
|
+
console.error(
|
|
3515
|
+
`[scheduler] Не удалось очистить fallback-записи: ${
|
|
3516
|
+
err instanceof Error ? err.message : String(err)
|
|
3517
|
+
}`,
|
|
3518
|
+
);
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3473
3521
|
checkJsonBackups();
|
|
3474
3522
|
void garbageCollectTaskArtifacts().catch((err) => {
|
|
3475
3523
|
console.log(`[gc] Не удалось вычистить мусорные файлы: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -5025,6 +5073,43 @@ const v2Plugin = Plugin.define({
|
|
|
5025
5073
|
});
|
|
5026
5074
|
return { success: true, ...result };
|
|
5027
5075
|
},
|
|
5076
|
+
list_dlq: async (input: unknown) => {
|
|
5077
|
+
const source = (input ?? {}) as { status?: string; limit?: number };
|
|
5078
|
+
return listDlq({ status: source.status, limit: source.limit });
|
|
5079
|
+
},
|
|
5080
|
+
retry_dlq: async (input: unknown) => {
|
|
5081
|
+
const source = (input ?? {}) as { id?: string };
|
|
5082
|
+
if (!source.id) return { success: false, error: "id is required" };
|
|
5083
|
+
return retryDlq(source.id);
|
|
5084
|
+
},
|
|
5085
|
+
discard_dlq: async (input: unknown) => {
|
|
5086
|
+
const source = (input ?? {}) as { id?: string; resolution?: string };
|
|
5087
|
+
if (!source.id) return { success: false, error: "id is required" };
|
|
5088
|
+
return discardDlq(source.id, source.resolution);
|
|
5089
|
+
},
|
|
5090
|
+
list_durable_runs: async (input: unknown) => {
|
|
5091
|
+
const source = (input ?? {}) as { filter?: string; limit?: number };
|
|
5092
|
+
return listRunPanel({ filter: source.filter, limit: source.limit });
|
|
5093
|
+
},
|
|
5094
|
+
pause_durable_run: async (input: unknown) => {
|
|
5095
|
+
const source = (input ?? {}) as {
|
|
5096
|
+
runId?: string;
|
|
5097
|
+
stepName?: string;
|
|
5098
|
+
comment?: string;
|
|
5099
|
+
author?: string;
|
|
5100
|
+
};
|
|
5101
|
+
if (!source.runId) return { success: false, error: "runId is required" };
|
|
5102
|
+
return pauseRunPanel(source.runId, {
|
|
5103
|
+
stepName: source.stepName,
|
|
5104
|
+
comment: source.comment,
|
|
5105
|
+
author: source.author,
|
|
5106
|
+
});
|
|
5107
|
+
},
|
|
5108
|
+
resume_durable_run: async (input: unknown) => {
|
|
5109
|
+
const source = (input ?? {}) as { runId?: string };
|
|
5110
|
+
if (!source.runId) return { success: false, error: "runId is required" };
|
|
5111
|
+
return resumeRunPanel(source.runId);
|
|
5112
|
+
},
|
|
5028
5113
|
get_templates: async () => {
|
|
5029
5114
|
try {
|
|
5030
5115
|
return { templates: await loadTemplates() };
|
|
@@ -5475,6 +5560,18 @@ async function schedulerCreateTask(
|
|
|
5475
5560
|
// Для отката файлов: при обновлении существующей задачи файлы переиспользуются,
|
|
5476
5561
|
// удалять их при сбое нельзя — в БД остаётся прежнее определение.
|
|
5477
5562
|
const definitionExisted = Boolean(getTask(normalizedName));
|
|
5563
|
+
// P1-10: при создании проверяем, что sanitized-имя не занято другой задачей
|
|
5564
|
+
// или её оставшимися файлами. Иначе «my task» и «my-task» делят
|
|
5565
|
+
// wrapper/prompt/lock/log, а вторая задача перезаписывает первую.
|
|
5566
|
+
if (!definitionExisted) {
|
|
5567
|
+
const conflict = findSanitizedNameConflict(
|
|
5568
|
+
normalizedName,
|
|
5569
|
+
listTaskDefinitions().map((def) => def.name),
|
|
5570
|
+
);
|
|
5571
|
+
if (conflict) {
|
|
5572
|
+
throw new Error(sanitizedConflictMessage(normalizedName, conflict));
|
|
5573
|
+
}
|
|
5574
|
+
}
|
|
5478
5575
|
|
|
5479
5576
|
const normalizedModel = model?.trim() || undefined;
|
|
5480
5577
|
if (normalizedModel) {
|
|
@@ -5710,6 +5807,29 @@ async function schedulerCreateTask(
|
|
|
5710
5807
|
if (windowError) {
|
|
5711
5808
|
throw new Error(t("tool.error.window", { task: name, error: windowError }));
|
|
5712
5809
|
}
|
|
5810
|
+
// P2-24: cron может быть валидным, но никогда не попадать в окно запуска
|
|
5811
|
+
// (например, daily 09:00 при окне 22:00–06:00). Предупреждаем сразу при
|
|
5812
|
+
// создании: иначе задача молча не выполняется из-за лимита переноса 12 ч.
|
|
5813
|
+
if (normalizedNotBefore || normalizedNotAfter || normalizedActiveDays) {
|
|
5814
|
+
const feasibility = assessCronWindowFeasibility(
|
|
5815
|
+
schedule,
|
|
5816
|
+
{
|
|
5817
|
+
notBefore: normalizedNotBefore,
|
|
5818
|
+
notAfter: normalizedNotAfter,
|
|
5819
|
+
days: normalizedActiveDays,
|
|
5820
|
+
timeZone: normalizedTz || undefined,
|
|
5821
|
+
},
|
|
5822
|
+
normalizedWindowPolicy,
|
|
5823
|
+
);
|
|
5824
|
+
if (!feasibility.feasible) {
|
|
5825
|
+
console.warn(
|
|
5826
|
+
`[scheduler] Задача "${name}": ${t("dryRun.window.unreachable", {
|
|
5827
|
+
cron: schedule,
|
|
5828
|
+
reason: windowFeasibilityReasonText(feasibility.reason),
|
|
5829
|
+
})}`,
|
|
5830
|
+
);
|
|
5831
|
+
}
|
|
5832
|
+
}
|
|
5713
5833
|
}
|
|
5714
5834
|
// Спринт 27: окно и дни недели применимы и к событийным триггерам
|
|
5715
5835
|
// (file/git/mcp-event/once) — проверяем корректность до создания задачи.
|
package/src/rpc.ts
CHANGED
|
@@ -899,6 +899,251 @@ const GetAuditOutput = {
|
|
|
899
899
|
required: ["success", "records", "total"],
|
|
900
900
|
} as const;
|
|
901
901
|
|
|
902
|
+
/** Запись dead-letter queue (Спринт 36.6). */
|
|
903
|
+
const DlqEntrySchema = {
|
|
904
|
+
type: "object" as const,
|
|
905
|
+
properties: {
|
|
906
|
+
id: { type: "string" },
|
|
907
|
+
runId: { type: "string" },
|
|
908
|
+
stepName: { type: "string" },
|
|
909
|
+
status: { type: "string" },
|
|
910
|
+
reason: { type: ["string", "null"] },
|
|
911
|
+
error: { type: ["string", "null"] },
|
|
912
|
+
attempts: { type: "number" },
|
|
913
|
+
createdAt: { type: "string" },
|
|
914
|
+
updatedAt: { type: "string" },
|
|
915
|
+
resolvedAt: { type: ["string", "null"] },
|
|
916
|
+
resolution: { type: ["string", "null"] },
|
|
917
|
+
},
|
|
918
|
+
required: [
|
|
919
|
+
"id",
|
|
920
|
+
"runId",
|
|
921
|
+
"stepName",
|
|
922
|
+
"status",
|
|
923
|
+
"reason",
|
|
924
|
+
"error",
|
|
925
|
+
"attempts",
|
|
926
|
+
"createdAt",
|
|
927
|
+
"updatedAt",
|
|
928
|
+
"resolvedAt",
|
|
929
|
+
"resolution",
|
|
930
|
+
],
|
|
931
|
+
} as const;
|
|
932
|
+
|
|
933
|
+
const ListDlqInput = {
|
|
934
|
+
type: "object" as const,
|
|
935
|
+
properties: {
|
|
936
|
+
/** open (по умолчанию) | retried | discarded | all. */
|
|
937
|
+
status: { type: "string" },
|
|
938
|
+
/** Сколько записей вернуть (по умолчанию 100, максимум 500). */
|
|
939
|
+
limit: { type: "number" },
|
|
940
|
+
},
|
|
941
|
+
additionalProperties: false,
|
|
942
|
+
} as const;
|
|
943
|
+
|
|
944
|
+
const ListDlqOutput = {
|
|
945
|
+
type: "object" as const,
|
|
946
|
+
properties: {
|
|
947
|
+
success: { type: "boolean" },
|
|
948
|
+
entries: { type: "array", items: DlqEntrySchema },
|
|
949
|
+
open: { type: "number" },
|
|
950
|
+
error: { type: "string" },
|
|
951
|
+
},
|
|
952
|
+
required: ["success", "entries", "open"],
|
|
953
|
+
additionalProperties: false,
|
|
954
|
+
} as const;
|
|
955
|
+
|
|
956
|
+
const RetryDlqInput = {
|
|
957
|
+
type: "object" as const,
|
|
958
|
+
properties: {
|
|
959
|
+
id: { type: "string" },
|
|
960
|
+
},
|
|
961
|
+
required: ["id"],
|
|
962
|
+
additionalProperties: false,
|
|
963
|
+
} as const;
|
|
964
|
+
|
|
965
|
+
const RetryDlqOutput = {
|
|
966
|
+
type: "object" as const,
|
|
967
|
+
properties: {
|
|
968
|
+
success: { type: "boolean" },
|
|
969
|
+
error: { type: "string" },
|
|
970
|
+
entry: DlqEntrySchema,
|
|
971
|
+
runId: { type: "string" },
|
|
972
|
+
stepName: { type: "string" },
|
|
973
|
+
runReopened: { type: "boolean" },
|
|
974
|
+
},
|
|
975
|
+
required: ["success"],
|
|
976
|
+
additionalProperties: false,
|
|
977
|
+
} as const;
|
|
978
|
+
|
|
979
|
+
const DiscardDlqInput = {
|
|
980
|
+
type: "object" as const,
|
|
981
|
+
properties: {
|
|
982
|
+
id: { type: "string" },
|
|
983
|
+
/** Причина отказа для журнала (по умолчанию discarded). */
|
|
984
|
+
resolution: { type: "string" },
|
|
985
|
+
},
|
|
986
|
+
required: ["id"],
|
|
987
|
+
additionalProperties: false,
|
|
988
|
+
} as const;
|
|
989
|
+
|
|
990
|
+
const DiscardDlqOutput = {
|
|
991
|
+
type: "object" as const,
|
|
992
|
+
properties: {
|
|
993
|
+
success: { type: "boolean" },
|
|
994
|
+
error: { type: "string" },
|
|
995
|
+
entry: DlqEntrySchema,
|
|
996
|
+
},
|
|
997
|
+
required: ["success"],
|
|
998
|
+
additionalProperties: false,
|
|
999
|
+
} as const;
|
|
1000
|
+
|
|
1001
|
+
/** Шаг durable-запуска для панели (Спринт 36.8). */
|
|
1002
|
+
const RunPanelStepSchema = {
|
|
1003
|
+
type: "object" as const,
|
|
1004
|
+
properties: {
|
|
1005
|
+
stepName: { type: "string" },
|
|
1006
|
+
position: { type: "number" },
|
|
1007
|
+
status: { type: "string" },
|
|
1008
|
+
attempt: { type: "number" },
|
|
1009
|
+
error: { type: ["string", "null"] },
|
|
1010
|
+
anchor: { type: "string" },
|
|
1011
|
+
},
|
|
1012
|
+
required: ["stepName", "position", "status", "attempt", "error", "anchor"],
|
|
1013
|
+
} as const;
|
|
1014
|
+
|
|
1015
|
+
/** Вставка контекста в истории запуска. */
|
|
1016
|
+
const RunPanelInjectionSchema = {
|
|
1017
|
+
type: "object" as const,
|
|
1018
|
+
properties: {
|
|
1019
|
+
id: { type: "string" },
|
|
1020
|
+
kind: { type: "string" },
|
|
1021
|
+
content: { type: "string" },
|
|
1022
|
+
contentLength: { type: "number" },
|
|
1023
|
+
author: { type: "string" },
|
|
1024
|
+
createdAt: { type: "string" },
|
|
1025
|
+
consumedAt: { type: ["string", "null"] },
|
|
1026
|
+
consumedByStep: { type: ["string", "null"] },
|
|
1027
|
+
},
|
|
1028
|
+
required: [
|
|
1029
|
+
"id",
|
|
1030
|
+
"kind",
|
|
1031
|
+
"content",
|
|
1032
|
+
"contentLength",
|
|
1033
|
+
"author",
|
|
1034
|
+
"createdAt",
|
|
1035
|
+
"consumedAt",
|
|
1036
|
+
"consumedByStep",
|
|
1037
|
+
],
|
|
1038
|
+
} as const;
|
|
1039
|
+
|
|
1040
|
+
/** Durable-запуск в панели паузы/resume. */
|
|
1041
|
+
const RunPanelRunSchema = {
|
|
1042
|
+
type: "object" as const,
|
|
1043
|
+
properties: {
|
|
1044
|
+
id: { type: "string" },
|
|
1045
|
+
taskName: { type: "string" },
|
|
1046
|
+
status: { type: "string" },
|
|
1047
|
+
createdAt: { type: "string" },
|
|
1048
|
+
startedAt: { type: ["string", "null"] },
|
|
1049
|
+
finishedAt: { type: ["string", "null"] },
|
|
1050
|
+
error: { type: ["string", "null"] },
|
|
1051
|
+
steps: { type: "array", items: RunPanelStepSchema },
|
|
1052
|
+
currentStep: { type: ["object", "null"], properties: RunPanelStepSchema.properties },
|
|
1053
|
+
doneSteps: { type: "number" },
|
|
1054
|
+
totalSteps: { type: "number" },
|
|
1055
|
+
injections: { type: "array", items: RunPanelInjectionSchema },
|
|
1056
|
+
pendingInjections: { type: "number" },
|
|
1057
|
+
},
|
|
1058
|
+
required: [
|
|
1059
|
+
"id",
|
|
1060
|
+
"taskName",
|
|
1061
|
+
"status",
|
|
1062
|
+
"createdAt",
|
|
1063
|
+
"startedAt",
|
|
1064
|
+
"finishedAt",
|
|
1065
|
+
"error",
|
|
1066
|
+
"steps",
|
|
1067
|
+
"currentStep",
|
|
1068
|
+
"doneSteps",
|
|
1069
|
+
"totalSteps",
|
|
1070
|
+
"injections",
|
|
1071
|
+
"pendingInjections",
|
|
1072
|
+
],
|
|
1073
|
+
} as const;
|
|
1074
|
+
|
|
1075
|
+
const ListDurableRunsInput = {
|
|
1076
|
+
type: "object" as const,
|
|
1077
|
+
properties: {
|
|
1078
|
+
/** active (по умолчанию) | all | pending | running | paused | passed | failed | cancelled. */
|
|
1079
|
+
filter: { type: "string" },
|
|
1080
|
+
/** Сколько запусков вернуть (по умолчанию 20, максимум 100). */
|
|
1081
|
+
limit: { type: "number" },
|
|
1082
|
+
},
|
|
1083
|
+
additionalProperties: false,
|
|
1084
|
+
} as const;
|
|
1085
|
+
|
|
1086
|
+
const ListDurableRunsOutput = {
|
|
1087
|
+
type: "object" as const,
|
|
1088
|
+
properties: {
|
|
1089
|
+
success: { type: "boolean" },
|
|
1090
|
+
runs: { type: "array", items: RunPanelRunSchema },
|
|
1091
|
+
active: { type: "number" },
|
|
1092
|
+
error: { type: "string" },
|
|
1093
|
+
},
|
|
1094
|
+
required: ["success", "runs", "active"],
|
|
1095
|
+
additionalProperties: false,
|
|
1096
|
+
} as const;
|
|
1097
|
+
|
|
1098
|
+
const PauseDurableRunInput = {
|
|
1099
|
+
type: "object" as const,
|
|
1100
|
+
properties: {
|
|
1101
|
+
runId: { type: "string" },
|
|
1102
|
+
/** Явный шаг-получатель; по умолчанию первый незавершённый. */
|
|
1103
|
+
stepName: { type: "string" },
|
|
1104
|
+
/** Комментарий, который получит шаг при resume. */
|
|
1105
|
+
comment: { type: "string" },
|
|
1106
|
+
/** Автор комментария (по умолчанию local-user). */
|
|
1107
|
+
author: { type: "string" },
|
|
1108
|
+
},
|
|
1109
|
+
required: ["runId"],
|
|
1110
|
+
additionalProperties: false,
|
|
1111
|
+
} as const;
|
|
1112
|
+
|
|
1113
|
+
const PauseDurableRunOutput = {
|
|
1114
|
+
type: "object" as const,
|
|
1115
|
+
properties: {
|
|
1116
|
+
success: { type: "boolean" },
|
|
1117
|
+
error: { type: "string" },
|
|
1118
|
+
run: RunPanelRunSchema,
|
|
1119
|
+
stepName: { type: ["string", "null"] },
|
|
1120
|
+
},
|
|
1121
|
+
required: ["success"],
|
|
1122
|
+
additionalProperties: false,
|
|
1123
|
+
} as const;
|
|
1124
|
+
|
|
1125
|
+
const ResumeDurableRunInput = {
|
|
1126
|
+
type: "object" as const,
|
|
1127
|
+
properties: {
|
|
1128
|
+
runId: { type: "string" },
|
|
1129
|
+
},
|
|
1130
|
+
required: ["runId"],
|
|
1131
|
+
additionalProperties: false,
|
|
1132
|
+
} as const;
|
|
1133
|
+
|
|
1134
|
+
const ResumeDurableRunOutput = {
|
|
1135
|
+
type: "object" as const,
|
|
1136
|
+
properties: {
|
|
1137
|
+
success: { type: "boolean" },
|
|
1138
|
+
error: { type: "string" },
|
|
1139
|
+
run: RunPanelRunSchema,
|
|
1140
|
+
stepName: { type: ["string", "null"] },
|
|
1141
|
+
prepared: { type: "boolean" },
|
|
1142
|
+
},
|
|
1143
|
+
required: ["success"],
|
|
1144
|
+
additionalProperties: false,
|
|
1145
|
+
} as const;
|
|
1146
|
+
|
|
902
1147
|
/** Сравнение триажа «до/после» (Спринт 31.5). */
|
|
903
1148
|
const CompareTriageInput = {
|
|
904
1149
|
type: "object" as const,
|
|
@@ -1681,6 +1926,12 @@ export const SchedulerRpc = Rpc.define({
|
|
|
1681
1926
|
save_secret: { input: SaveSecretInput, output: SaveSecretOutput },
|
|
1682
1927
|
delete_secret: { input: DeleteSecretInput, output: DeleteSecretOutput },
|
|
1683
1928
|
get_audit: { input: GetAuditInput, output: GetAuditOutput },
|
|
1929
|
+
list_dlq: { input: ListDlqInput, output: ListDlqOutput },
|
|
1930
|
+
retry_dlq: { input: RetryDlqInput, output: RetryDlqOutput },
|
|
1931
|
+
discard_dlq: { input: DiscardDlqInput, output: DiscardDlqOutput },
|
|
1932
|
+
list_durable_runs: { input: ListDurableRunsInput, output: ListDurableRunsOutput },
|
|
1933
|
+
pause_durable_run: { input: PauseDurableRunInput, output: PauseDurableRunOutput },
|
|
1934
|
+
resume_durable_run: { input: ResumeDurableRunInput, output: ResumeDurableRunOutput },
|
|
1684
1935
|
compare_triage: {
|
|
1685
1936
|
input: CompareTriageInput,
|
|
1686
1937
|
output: CompareTriageOutput,
|