@tea-agent/loop-agent 0.26.0 → 0.26.2
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 +1056 -1020
- package/README.md +8 -3
- package/bin/loop-agent.js +21 -21
- package/dist/application/dag/generate-task-dag.js +33 -0
- package/dist/cli/command-definitions.js +25 -10
- package/dist/cli/help.js +4 -3
- package/dist/cli/program.js +43 -17
- package/dist/commands/cursor-prompt.js +6 -6
- package/dist/commands/import-prd.js +7 -2
- package/dist/commands/init.js +7 -5
- package/dist/commands/loop-benchmark.js +11 -11
- package/dist/commands/pi-reuse-benchmark.js +16 -16
- package/dist/commands/task-source-prepare.js +474 -0
- package/dist/executors/dag-pi-executor.js +40 -5
- package/dist/executors/shell-executor.js +111 -0
- package/dist/executors/shell-presets.js +12 -4
- package/dist/executors/shell-write-guard.js +161 -25
- package/dist/sidecars/cursor-prompt/executor.js +1 -1
- package/dist/task/config-types.js +6 -0
- package/dist/task/contract/constants.js +1 -0
- package/dist/task/contract/project.js +8 -0
- package/dist/task/contract/schema.js +1 -0
- package/dist/task/frontend-preflight.js +131 -0
- package/dist/task/runtime.js +2 -4
- package/dist/task/source-prepare/build-draft.js +224 -0
- package/dist/task/source-prepare/completeness.js +195 -0
- package/dist/task/source-prepare/index.js +7 -0
- package/dist/task/source-prepare/parse-intent.js +373 -0
- package/dist/task/source-prepare/path-policy.js +197 -0
- package/dist/task/source-prepare/prepare.js +506 -0
- package/dist/task/source-prepare/reference-integrity.js +274 -0
- package/dist/task/source-prepare/types.js +7 -0
- package/dist/worker/observability/read-model.js +134 -0
- package/dist/worker/observe/static/copy.js +67 -67
- package/dist/worker/observe/static/dag-layout.d.ts +31 -31
- package/dist/worker/observe/static/dag-layout.js +83 -83
- package/dist/worker/observe/static/dom.js +220 -220
- package/dist/worker/observe/static/relations.js +133 -133
- package/dist/worker/observe/static/router.js +93 -93
- package/dist/worker/observe/static/run-processing.js +148 -148
- package/dist/worker/observe/static/state.js +61 -0
- package/dist/worker/observe/static/styles.css +8 -0
- package/dist/worker/observe/static/views/batch.js +227 -227
- package/dist/worker/observe/static/views/dag-graph.js +248 -172
- package/dist/worker/observe/static/views/dag-inspector.js +374 -157
- package/dist/worker/observe/static/views/dag.js +4 -11
- package/dist/worker/observe/static/views/failures.js +143 -143
- package/dist/worker/observe/static/views/feature.js +492 -492
- package/dist/worker/observe/static/views/run.js +453 -453
- package/dist/worker/observe/static/views/shell.js +7 -7
- package/dist/worker/observe/static/views/timeline.js +163 -163
- package/dist/workflows/dag/backend-test-pytest-collection.js +277 -0
- package/dist/workflows/dag/canvas-observer.js +275 -275
- package/dist/workflows/dag/convergence/controller.js +110 -21
- package/dist/workflows/dag/frontend-implementation-contract.js +218 -17
- package/dist/workflows/dag/frontend-review-context.js +7 -1
- package/dist/workflows/dag/frontend-verification-trace.js +14 -3
- package/dist/workflows/dag/frontend-worktree-diff.js +14 -3
- package/dist/workflows/dag/init-hybrid.js +96 -34
- package/dist/workflows/dag/output-protocol.js +180 -7
- package/dist/workflows/dag/runner.js +141 -52
- package/dist/workflows/dag/types.js +4 -0
- package/dist/workflows/dag/validate.js +3 -2
- package/docs/skills/README.md +7 -7
- package/docs/templates/adr.md +60 -60
- package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -94
- package/docs/templates/agent-dag-decision-envelope.schema.json +213 -213
- package/docs/templates/agent-dag-decision-gate.prompt.md +246 -246
- package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -98
- package/docs/templates/agent-dag-report.schema.json +473 -473
- package/docs/templates/agent-dag-review-verdict.prompt.md +68 -68
- package/docs/templates/backend-test-dag.json +100 -8
- package/docs/templates/backend-test-result.schema.json +99 -99
- package/docs/templates/feature-spec.md +53 -53
- package/docs/templates/frontend-design-contract.md +42 -42
- package/docs/templates/frontend-eval/fixtures/failures/01-type-build-error.md +17 -17
- package/docs/templates/frontend-eval/fixtures/failures/02-unit-component-test-fail.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/03-fixture-schema-drift.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/04-missing-loading-empty-error-state.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/05-forbidden-write-writeset-expansion.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/06-unapproved-dependency-add.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/07-mock-production-on.md +21 -21
- package/docs/templates/frontend-eval/fixtures/functional/01-simple-component-style.md +29 -29
- package/docs/templates/frontend-eval/fixtures/functional/02-form-validation.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/03-list-detail-page.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/04-api-mock.md +29 -29
- package/docs/templates/frontend-eval/fixtures/functional/05-permission-auth-gated-ui.md +27 -27
- package/docs/templates/frontend-eval/fixtures/functional/06-ssr-server-client-boundary.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/07-shared-public-component-api.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/08-pure-local-no-remote.md +27 -27
- package/docs/templates/frontend-eval/metrics.md +138 -138
- package/docs/templates/frontend-eval/smoke-targets.md +53 -53
- package/docs/templates/frontend-task-constraints.md +35 -35
- package/docs/templates/frontend-task-requirement.md +70 -70
- package/docs/templates/init-evolution-review.md +35 -35
- package/docs/templates/init-managed-agents.md +10 -5
- package/docs/templates/interactive-ui-round2-experiment.md +66 -66
- package/docs/templates/knowledge-graph-bootstrap-dag.json +118 -118
- package/docs/templates/knowledge-sync-dag.json +178 -178
- package/docs/templates/knowledge-sync-draft.schema.json +71 -71
- package/docs/templates/product-line/closeout.yaml +9 -9
- package/docs/templates/product-line/design.md +13 -13
- package/docs/templates/product-line/links.md +10 -10
- package/docs/templates/product-line/requirement.md +17 -17
- package/docs/templates/product-line/test-plan.md +7 -7
- package/docs/templates/production-readiness-checklist.md +57 -57
- package/docs/templates/project-start-checklist.md +9 -9
- package/docs/templates/qa-report.md +48 -48
- package/docs/templates/sprint-contract.md +29 -29
- package/docs/templates/worker-dogfood-evidence.md +80 -80
- package/docs/templates/worker-dogfood-setup.md +68 -68
- package/package.json +1 -1
- package/scripts/kb-bootstrap-init-skeleton.sh +0 -0
- package/scripts/kb-graph-incremental-prepare.mjs +386 -386
- package/scripts/kb-graph-materialize.mjs +105 -105
- package/scripts/kb-graph-promote.mjs +164 -164
- package/scripts/kb-query.mjs +554 -554
- package/skills/ai-engineering-context/SKILL.md +48 -48
- package/skills/analyze-product-dependencies/SKILL.md +67 -67
- package/skills/analyze-product-dependencies/agents/openai.yaml +4 -4
- package/skills/analyze-product-dependencies/references/api-documentation-schema.md +30 -30
- package/skills/analyze-product-dependencies/references/dependency-analysis-schema.md +28 -28
- package/skills/analyze-product-dependencies/references/example.md +76 -76
- package/skills/analyze-product-dependencies/references/forward-test-cases.md +35 -35
- package/skills/analyze-product-dependencies/references/input-contract.md +11 -11
- package/skills/analyze-product-dependencies/references/scouting-rules.md +61 -61
- package/skills/analyze-product-dependencies/scripts/test-validators.mjs +267 -267
- package/skills/analyze-product-dependencies/scripts/validate-api-documentation.mjs +101 -101
- package/skills/analyze-product-dependencies/scripts/validate-dependency-analysis.mjs +142 -142
- package/skills/analyze-product-dependencies/scripts/validate-product-requirement-input.mjs +76 -76
- package/skills/analyze-product-dependencies/scripts/validation-helpers.mjs +146 -146
- package/skills/analyze-product-requirements/SKILL.md +90 -90
- package/skills/analyze-product-requirements/agents/openai.yaml +4 -4
- package/skills/analyze-product-requirements/references/acceptance-criteria.md +91 -91
- package/skills/analyze-product-requirements/references/clarification-and-knowledge.md +56 -56
- package/skills/analyze-product-requirements/references/example.md +86 -86
- package/skills/analyze-product-requirements/references/forward-test-cases.md +66 -66
- package/skills/analyze-product-requirements/references/product-analysis-schema.md +32 -32
- package/skills/analyze-product-requirements/references/product-requirement-schema.md +33 -33
- package/skills/analyze-product-requirements/references/requirement-clarification-schema.md +35 -35
- package/skills/analyze-product-requirements/scripts/test-validators.mjs +193 -193
- package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +69 -69
- package/skills/analyze-product-requirements/scripts/validate-product-requirement.mjs +97 -97
- package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +98 -98
- package/skills/analyze-product-requirements/scripts/validation-helpers.mjs +156 -156
- package/skills/browser-tools/browser-content.js +103 -103
- package/skills/browser-tools/browser-cookies.js +35 -35
- package/skills/browser-tools/browser-eval.js +53 -53
- package/skills/browser-tools/browser-hn-scraper.js +108 -108
- package/skills/browser-tools/browser-nav.js +44 -44
- package/skills/browser-tools/browser-pick.js +162 -162
- package/skills/browser-tools/browser-screenshot.js +34 -34
- package/skills/browser-tools/browser-start.js +86 -86
- package/skills/browser-tools/package-lock.json +2556 -2556
- package/skills/browser-tools/package.json +19 -19
- package/skills/code-review-core/SKILL.md +20 -20
- package/skills/codebase-scout/SKILL.md +19 -19
- package/skills/grill-me/SKILL.md +10 -10
- package/skills/loop-agent/SKILL.md +5 -2
- package/skills/loop-agent/references/README.md +67 -67
- package/skills/loop-agent/references/command-reference.md +17 -15
- package/skills/loop-agent/references/docs-converge.md +126 -126
- package/skills/loop-agent/references/harness-policy.md +3 -4
- package/skills/loop-agent/references/hybrid-dag.md +1 -1
- package/skills/loop-agent/references/learned/README.md +21 -21
- package/skills/loop-agent/references/long-running-loop.md +57 -57
- package/skills/loop-agent/references/one-shot-runs.md +85 -85
- package/skills/loop-agent/references/pi-prompt.md +23 -23
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +84 -84
- package/skills/loop-agent/references/post-implementation-and-patterns.md +1 -1
- package/skills/loop-agent/references/source-and-plan-practice.md +3 -2
- package/skills/loop-agent/references/task-workflow.md +7 -5
- package/skills/playwright-cli/SKILL.md +420 -420
- package/skills/playwright-cli/references/element-attributes.md +23 -23
- package/skills/playwright-cli/references/playwright-tests.md +39 -39
- package/skills/playwright-cli/references/request-mocking.md +87 -87
- package/skills/playwright-cli/references/running-code.md +241 -241
- package/skills/playwright-cli/references/session-management.md +225 -225
- package/skills/playwright-cli/references/storage-state.md +275 -275
- package/skills/playwright-cli/references/test-generation.md +433 -433
- package/skills/playwright-cli/references/tracing.md +139 -139
- package/skills/playwright-cli/references/video-recording.md +143 -143
- package/skills/requesting-code-review/SKILL.md +101 -101
- package/skills/requesting-code-review/code-reviewer.md +168 -168
- package/skills/systematic-debugging/CREATION-LOG.md +119 -119
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
- package/skills/systematic-debugging/condition-based-waiting.md +115 -115
- package/skills/systematic-debugging/defense-in-depth.md +122 -122
- package/skills/systematic-debugging/find-polluter.sh +63 -63
- package/skills/systematic-debugging/root-cause-tracing.md +169 -169
- package/skills/systematic-debugging/test-academic.md +14 -14
- package/skills/systematic-debugging/test-pressure-1.md +58 -58
- package/skills/systematic-debugging/test-pressure-2.md +68 -68
- package/skills/systematic-debugging/test-pressure-3.md +69 -69
- package/skills/using-git-worktrees/SKILL.md +215 -215
- package/skills/verification-before-completion/SKILL.md +154 -154
- package/skills/webapp-testing/SKILL.md +19 -19
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
/** Run step/command/artifact processing and task history rows. */
|
|
2
|
-
import {
|
|
3
|
-
STEP_LABELS,
|
|
4
|
-
ARTIFACT_LABELS,
|
|
5
|
-
STEP_ORDER,
|
|
6
|
-
ARTIFACT_KEYS,
|
|
7
|
-
} from "./constants.js";
|
|
8
|
-
import { badge } from "./format.js";
|
|
9
|
-
import { navigate } from "./router.js";
|
|
10
|
-
|
|
11
|
-
export function stepDisplayLabel(label) {
|
|
12
|
-
return STEP_LABELS[label] ?? label;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function buildStepStates(events) {
|
|
16
|
-
const states = new Map();
|
|
17
|
-
for (const ev of events) {
|
|
18
|
-
if (ev.type === "step.started") {
|
|
19
|
-
states.set(ev.label, { status: "running", startedAt: ev.at });
|
|
20
|
-
} else if (ev.type === "step.finished") {
|
|
21
|
-
states.set(ev.label, {
|
|
22
|
-
status: ev.status === "failed" ? "failed" : "succeeded",
|
|
23
|
-
durationMs: ev.durationMs,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const ordered = [...STEP_ORDER];
|
|
29
|
-
for (const label of states.keys()) {
|
|
30
|
-
if (!ordered.includes(label)) ordered.push(label);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return ordered.map((label) => {
|
|
34
|
-
const state = states.get(label);
|
|
35
|
-
return {
|
|
36
|
-
label,
|
|
37
|
-
display: stepDisplayLabel(label),
|
|
38
|
-
status: state?.status ?? "pending",
|
|
39
|
-
durationMs: state?.durationMs,
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function stepMarker(status) {
|
|
45
|
-
switch (status) {
|
|
46
|
-
case "succeeded":
|
|
47
|
-
return "✓";
|
|
48
|
-
case "running":
|
|
49
|
-
return "●";
|
|
50
|
-
case "failed":
|
|
51
|
-
return "✗";
|
|
52
|
-
default:
|
|
53
|
-
return "○";
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function getCurrentCommand(events) {
|
|
58
|
-
const active = new Map();
|
|
59
|
-
for (const ev of events) {
|
|
60
|
-
if (ev.type === "command.started") {
|
|
61
|
-
active.set(ev.label, ev);
|
|
62
|
-
} else if (ev.type === "command.finished") {
|
|
63
|
-
active.delete(ev.label);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
let latest = null;
|
|
67
|
-
for (const cmd of active.values()) {
|
|
68
|
-
if (!latest || cmd.at > latest.at) latest = cmd;
|
|
69
|
-
}
|
|
70
|
-
if (latest?.at) {
|
|
71
|
-
const elapsed = Date.now() - Date.parse(latest.at);
|
|
72
|
-
latest = { ...latest, elapsedMs: Number.isFinite(elapsed) ? elapsed : 0 };
|
|
73
|
-
}
|
|
74
|
-
return latest;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function getOutputTail(events, commandLabel) {
|
|
78
|
-
if (!commandLabel) return "";
|
|
79
|
-
const chunks = [];
|
|
80
|
-
for (const ev of events) {
|
|
81
|
-
if (
|
|
82
|
-
ev.type === "command.output" &&
|
|
83
|
-
ev.label === commandLabel &&
|
|
84
|
-
ev.outputPreview
|
|
85
|
-
) {
|
|
86
|
-
chunks.push(ev.outputPreview);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return chunks.join("");
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function collectArtifacts(task, events) {
|
|
93
|
-
const arts = new Map();
|
|
94
|
-
const add = (label, artifactPath) => {
|
|
95
|
-
if (artifactPath && !arts.has(label)) arts.set(label, artifactPath);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
if (task?.artifactRefs) {
|
|
99
|
-
for (const key of ARTIFACT_KEYS) {
|
|
100
|
-
add(ARTIFACT_LABELS[key] ?? key, task.artifactRefs[key]);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
for (const ev of events) {
|
|
105
|
-
if (!ev.artifactRefs) continue;
|
|
106
|
-
for (const [key, artifactPath] of Object.entries(ev.artifactRefs)) {
|
|
107
|
-
add(ARTIFACT_LABELS[key] ?? key, artifactPath);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return arts;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function findBatchRunIdForTask(snapshot, task) {
|
|
115
|
-
if (!snapshot || !task) return null;
|
|
116
|
-
const workerRunId = task.workerRunId;
|
|
117
|
-
if (!workerRunId) return null;
|
|
118
|
-
for (const batch of snapshot.batches ?? []) {
|
|
119
|
-
for (const t of batch.tasks ?? []) {
|
|
120
|
-
if (t.workerRunId === workerRunId) return batch.batchRunId;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export function taskRunHistoryRow(run) {
|
|
127
|
-
let runLink = run.workerRunId;
|
|
128
|
-
if (run.workerRunId) {
|
|
129
|
-
const a = document.createElement("a");
|
|
130
|
-
a.href = `#/run/${encodeURIComponent(run.workerRunId)}`;
|
|
131
|
-
a.textContent = run.workerRunId;
|
|
132
|
-
a.addEventListener("click", (e) => {
|
|
133
|
-
e.preventDefault();
|
|
134
|
-
navigate(`#/run/${encodeURIComponent(run.workerRunId)}`);
|
|
135
|
-
});
|
|
136
|
-
runLink = a;
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
cells: [
|
|
140
|
-
runLink,
|
|
141
|
-
badge(run.status),
|
|
142
|
-
run.recordedAt ?? run.finishedAt ?? "—",
|
|
143
|
-
run.batchRunId ?? "—",
|
|
144
|
-
run.retryOfWorkerRunId ?? "—",
|
|
145
|
-
run.failureCategory ?? "—",
|
|
146
|
-
],
|
|
147
|
-
};
|
|
148
|
-
}
|
|
1
|
+
/** Run step/command/artifact processing and task history rows. */
|
|
2
|
+
import {
|
|
3
|
+
STEP_LABELS,
|
|
4
|
+
ARTIFACT_LABELS,
|
|
5
|
+
STEP_ORDER,
|
|
6
|
+
ARTIFACT_KEYS,
|
|
7
|
+
} from "./constants.js";
|
|
8
|
+
import { badge } from "./format.js";
|
|
9
|
+
import { navigate } from "./router.js";
|
|
10
|
+
|
|
11
|
+
export function stepDisplayLabel(label) {
|
|
12
|
+
return STEP_LABELS[label] ?? label;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function buildStepStates(events) {
|
|
16
|
+
const states = new Map();
|
|
17
|
+
for (const ev of events) {
|
|
18
|
+
if (ev.type === "step.started") {
|
|
19
|
+
states.set(ev.label, { status: "running", startedAt: ev.at });
|
|
20
|
+
} else if (ev.type === "step.finished") {
|
|
21
|
+
states.set(ev.label, {
|
|
22
|
+
status: ev.status === "failed" ? "failed" : "succeeded",
|
|
23
|
+
durationMs: ev.durationMs,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const ordered = [...STEP_ORDER];
|
|
29
|
+
for (const label of states.keys()) {
|
|
30
|
+
if (!ordered.includes(label)) ordered.push(label);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return ordered.map((label) => {
|
|
34
|
+
const state = states.get(label);
|
|
35
|
+
return {
|
|
36
|
+
label,
|
|
37
|
+
display: stepDisplayLabel(label),
|
|
38
|
+
status: state?.status ?? "pending",
|
|
39
|
+
durationMs: state?.durationMs,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function stepMarker(status) {
|
|
45
|
+
switch (status) {
|
|
46
|
+
case "succeeded":
|
|
47
|
+
return "✓";
|
|
48
|
+
case "running":
|
|
49
|
+
return "●";
|
|
50
|
+
case "failed":
|
|
51
|
+
return "✗";
|
|
52
|
+
default:
|
|
53
|
+
return "○";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function getCurrentCommand(events) {
|
|
58
|
+
const active = new Map();
|
|
59
|
+
for (const ev of events) {
|
|
60
|
+
if (ev.type === "command.started") {
|
|
61
|
+
active.set(ev.label, ev);
|
|
62
|
+
} else if (ev.type === "command.finished") {
|
|
63
|
+
active.delete(ev.label);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
let latest = null;
|
|
67
|
+
for (const cmd of active.values()) {
|
|
68
|
+
if (!latest || cmd.at > latest.at) latest = cmd;
|
|
69
|
+
}
|
|
70
|
+
if (latest?.at) {
|
|
71
|
+
const elapsed = Date.now() - Date.parse(latest.at);
|
|
72
|
+
latest = { ...latest, elapsedMs: Number.isFinite(elapsed) ? elapsed : 0 };
|
|
73
|
+
}
|
|
74
|
+
return latest;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function getOutputTail(events, commandLabel) {
|
|
78
|
+
if (!commandLabel) return "";
|
|
79
|
+
const chunks = [];
|
|
80
|
+
for (const ev of events) {
|
|
81
|
+
if (
|
|
82
|
+
ev.type === "command.output" &&
|
|
83
|
+
ev.label === commandLabel &&
|
|
84
|
+
ev.outputPreview
|
|
85
|
+
) {
|
|
86
|
+
chunks.push(ev.outputPreview);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return chunks.join("");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function collectArtifacts(task, events) {
|
|
93
|
+
const arts = new Map();
|
|
94
|
+
const add = (label, artifactPath) => {
|
|
95
|
+
if (artifactPath && !arts.has(label)) arts.set(label, artifactPath);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
if (task?.artifactRefs) {
|
|
99
|
+
for (const key of ARTIFACT_KEYS) {
|
|
100
|
+
add(ARTIFACT_LABELS[key] ?? key, task.artifactRefs[key]);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
for (const ev of events) {
|
|
105
|
+
if (!ev.artifactRefs) continue;
|
|
106
|
+
for (const [key, artifactPath] of Object.entries(ev.artifactRefs)) {
|
|
107
|
+
add(ARTIFACT_LABELS[key] ?? key, artifactPath);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return arts;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function findBatchRunIdForTask(snapshot, task) {
|
|
115
|
+
if (!snapshot || !task) return null;
|
|
116
|
+
const workerRunId = task.workerRunId;
|
|
117
|
+
if (!workerRunId) return null;
|
|
118
|
+
for (const batch of snapshot.batches ?? []) {
|
|
119
|
+
for (const t of batch.tasks ?? []) {
|
|
120
|
+
if (t.workerRunId === workerRunId) return batch.batchRunId;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function taskRunHistoryRow(run) {
|
|
127
|
+
let runLink = run.workerRunId;
|
|
128
|
+
if (run.workerRunId) {
|
|
129
|
+
const a = document.createElement("a");
|
|
130
|
+
a.href = `#/run/${encodeURIComponent(run.workerRunId)}`;
|
|
131
|
+
a.textContent = run.workerRunId;
|
|
132
|
+
a.addEventListener("click", (e) => {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
navigate(`#/run/${encodeURIComponent(run.workerRunId)}`);
|
|
135
|
+
});
|
|
136
|
+
runLink = a;
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
cells: [
|
|
140
|
+
runLink,
|
|
141
|
+
badge(run.status),
|
|
142
|
+
run.recordedAt ?? run.finishedAt ?? "—",
|
|
143
|
+
run.batchRunId ?? "—",
|
|
144
|
+
run.retryOfWorkerRunId ?? "—",
|
|
145
|
+
run.failureCategory ?? "—",
|
|
146
|
+
],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
@@ -53,6 +53,8 @@ export const uiState = {
|
|
|
53
53
|
dagTimelineViewportState: null,
|
|
54
54
|
dagNodeOutputViewportState: null,
|
|
55
55
|
dagNodeInputViewportState: null,
|
|
56
|
+
/** Spec-evidence inspector content scroll (single active region snapshot). */
|
|
57
|
+
dagNodeSpecEvidenceViewportState: null,
|
|
56
58
|
runOutputViewportState: null,
|
|
57
59
|
/**
|
|
58
60
|
* Spec-evidence file preview drill-down. null = list view; otherwise
|
|
@@ -67,6 +69,65 @@ export const uiState = {
|
|
|
67
69
|
/** Per-dagRunId graph viewport restore map (stable Map instance). */
|
|
68
70
|
export const dagGraphViewportStates = new Map();
|
|
69
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Per-context inspector content scroll map.
|
|
74
|
+
* Key format: dag:<dagRunId>:<nodeId>:<tab>
|
|
75
|
+
*/
|
|
76
|
+
export const dagInspectorViewportStates = new Map();
|
|
77
|
+
|
|
78
|
+
/** Build a stable inspector scroll region key (AC-005 context isolation). */
|
|
79
|
+
export function inspectorViewportRegionKey(dagRunId, nodeId, tab) {
|
|
80
|
+
return `dag:${dagRunId ?? ""}:${nodeId ?? ""}:${tab ?? "output"}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function updateDagInspectorViewportState(
|
|
84
|
+
_previous,
|
|
85
|
+
regionKey,
|
|
86
|
+
scrollLeft,
|
|
87
|
+
scrollTop,
|
|
88
|
+
) {
|
|
89
|
+
return {
|
|
90
|
+
regionKey,
|
|
91
|
+
scrollLeft: Math.max(0, Number(scrollLeft) || 0),
|
|
92
|
+
scrollTop: Math.max(0, Number(scrollTop) || 0),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Persist inspector scroll for a context. When `preserveIntent` is true and the
|
|
98
|
+
* incoming position is a zero clamp on short (loading) content while a non-zero
|
|
99
|
+
* intent already exists, keep the previous intent instead of overwriting to 0.
|
|
100
|
+
*/
|
|
101
|
+
export function saveDagInspectorViewportState(
|
|
102
|
+
regionKey,
|
|
103
|
+
scrollLeft,
|
|
104
|
+
scrollTop,
|
|
105
|
+
options = {},
|
|
106
|
+
) {
|
|
107
|
+
if (!regionKey) return null;
|
|
108
|
+
const left = Math.max(0, Number(scrollLeft) || 0);
|
|
109
|
+
const top = Math.max(0, Number(scrollTop) || 0);
|
|
110
|
+
if (options.preserveIntent) {
|
|
111
|
+
const existing = dagInspectorViewportStates.get(regionKey);
|
|
112
|
+
if (
|
|
113
|
+
existing &&
|
|
114
|
+
left === 0 &&
|
|
115
|
+
top === 0 &&
|
|
116
|
+
(existing.scrollLeft > 0 || existing.scrollTop > 0)
|
|
117
|
+
) {
|
|
118
|
+
return existing;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const next = updateDagInspectorViewportState(null, regionKey, left, top);
|
|
122
|
+
dagInspectorViewportStates.set(regionKey, next);
|
|
123
|
+
return next;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function getDagInspectorViewportState(regionKey) {
|
|
127
|
+
if (!regionKey) return null;
|
|
128
|
+
return dagInspectorViewportStates.get(regionKey) ?? null;
|
|
129
|
+
}
|
|
130
|
+
|
|
70
131
|
/** Build a fresh session-event identity token and bump the global sequence. */
|
|
71
132
|
export function makeSessionEventIdentity(dagRunId, nodeId) {
|
|
72
133
|
uiState.sessionEventIdentitySeq += 1;
|
|
@@ -1522,6 +1522,14 @@ body.is-resizing-dag-graph {
|
|
|
1522
1522
|
#dag-arrow path {
|
|
1523
1523
|
fill: color-mix(in srgb, var(--hairline-strong) 80%, var(--muted));
|
|
1524
1524
|
}
|
|
1525
|
+
.dag-edge-control {
|
|
1526
|
+
stroke: var(--orange);
|
|
1527
|
+
stroke-width: 2;
|
|
1528
|
+
stroke-dasharray: 6 4;
|
|
1529
|
+
}
|
|
1530
|
+
#dag-arrow-control path {
|
|
1531
|
+
fill: var(--orange);
|
|
1532
|
+
}
|
|
1525
1533
|
.dag-graph-node {
|
|
1526
1534
|
cursor: pointer;
|
|
1527
1535
|
transition: opacity var(--transition-fast);
|