agents-relay 2.0.265 → 2.0.267
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dashboard/dashboard.css +224 -0
- package/dashboard/dashboard.js +398 -0
- package/dashboard/icons/icon-180.png +0 -0
- package/dashboard/icons/icon-192.png +0 -0
- package/dashboard/icons/icon-512.png +0 -0
- package/dashboard/index.html +92 -0
- package/dashboard/jel-function.js +193 -0
- package/dashboard/manifest.webmanifest +25 -0
- package/dashboard/pwa.js +6 -0
- package/dashboard/service-worker.js +24 -0
- package/dist/agent-prompt-builder.js +6 -1
- package/dist/cli-help.js +11 -2
- package/dist/cli-task-complete.js +12 -0
- package/dist/cli.js +6 -1
- package/dist/dashboard-html.js +23 -483
- package/dist/dashboard-style.js +3 -223
- package/dist/dashboard.js +34 -4
- package/dist/git-delivery.js +112 -0
- package/dist/managed-worker-input.js +1 -0
- package/dist/reconciler-runtime.js +6 -1
- package/dist/relayd-control.js +45 -0
- package/dist/workflow/definitions-v2.js +2 -1
- package/dist/workflow/entity-creation.js +2 -1
- package/dist/workflow/lifecycle.js +3 -3
- package/package.json +2 -1
- package/skills/agents-relay/SKILL.md +4 -0
- package/skills/agents-relay/contracts/event-contract.md +1 -0
- package/skills/agents-relay/contracts/worker-self-review.md +4 -0
- package/workflow/task-lifecycle.mmd +6 -2
package/dist/dashboard-style.js
CHANGED
|
@@ -1,223 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
[hidden] { display:none !important; }
|
|
5
|
-
body { margin:0; min-height:100vh; background:var(--bg); color:var(--text); font:14px/1.45 ui-sans-serif,system-ui,sans-serif; }
|
|
6
|
-
header { position:sticky; top:0; z-index:3; background:var(--surface); border-bottom:1px solid var(--border); padding:.8rem 1rem; }
|
|
7
|
-
.brand { display:flex; align-items:baseline; gap:.65rem; min-width:0; }
|
|
8
|
-
.version { margin-left:auto; color:var(--muted); font-size:.72rem; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; white-space:nowrap; }
|
|
9
|
-
.runtime-summary { display:flex; gap:.4rem; align-items:center; flex-wrap:wrap; margin-top:.55rem; }
|
|
10
|
-
.runtime-stat { padding:.18rem .45rem; border:1px solid var(--border); border-radius:999px; background:var(--surface2); color:var(--muted); font-size:.72rem; white-space:nowrap; }
|
|
11
|
-
.runtime-stat strong { color:var(--text); }
|
|
12
|
-
h1 { margin:0; font-size:1.08rem; letter-spacing:-.02em; }
|
|
13
|
-
.tagline,.subtle { color:var(--muted); font-size:.78rem; }
|
|
14
|
-
.warning-banner { margin:.65rem 0 0; padding:.5rem .65rem; border:1px solid #e6bf62; border-radius:.4rem; background:#fff4d6; color:#6f4b00; font-size:.78rem; font-weight:700; }
|
|
15
|
-
.tagline { margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
16
|
-
nav[role="tablist"] { display:flex; gap:.3rem; margin-top:.65rem; }
|
|
17
|
-
nav button { border:0; border-radius:.35rem; background:transparent; color:var(--muted); padding:.38rem .68rem; font:inherit; font-weight:700; cursor:pointer; }
|
|
18
|
-
nav button[aria-selected="true"] { background:var(--accent); color:#fff; }
|
|
19
|
-
button:focus-visible,a:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
|
|
20
|
-
main { max-width:1500px; margin:auto; padding:1rem; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:1rem; align-items:start; }
|
|
21
|
-
.panel { min-width:0; background:var(--surface); border:1px solid var(--border); border-radius:.55rem; box-shadow:var(--shadow); }
|
|
22
|
-
.panel-head { display:flex; align-items:center; justify-content:space-between; gap:.6rem; padding:.65rem .75rem; border-bottom:1px solid var(--border); }
|
|
23
|
-
.panel-head h2,.panel-head h3 { margin:0; color:var(--muted); font-size:.75rem; letter-spacing:.07em; text-transform:uppercase; min-width:0; }\n #workspace-heading { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }\n #selected-job-title { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
24
|
-
.panel-actions { display:flex; align-items:center; gap:.55rem; flex-wrap:wrap; min-width:0; }
|
|
25
|
-
#jobs-view .panel-head { display:flex; align-items:center; justify-content:space-between; gap:.65rem; }
|
|
26
|
-
#jobs-view .panel-actions { display:flex; align-items:center; justify-content:flex-end; gap:.4rem; flex-wrap:wrap; min-width:0; }
|
|
27
|
-
.job-filters,.jobs-actions { display:flex; align-items:center; gap:.35rem; min-width:0; }
|
|
28
|
-
.job-filters { flex:1 1 auto; }
|
|
29
|
-
.jobs-actions { flex:none; }
|
|
30
|
-
.job-filter,.refresh-button { min-height:2rem; border:1px solid var(--border); border-radius:.45rem; background:var(--surface); color:var(--text); padding:.3rem .5rem; font:inherit; font-size:.72rem; font-weight:650; }
|
|
31
|
-
.job-filter { width:8rem; max-width:8rem; flex:none; }
|
|
32
|
-
#status-filter { width:9.5rem; max-width:9.5rem; font-size:.66rem; }
|
|
33
|
-
#repo-filter { width:8rem; max-width:8rem; }
|
|
34
|
-
.refresh-button { color:var(--muted); font-weight:700; cursor:pointer; transition:border-color .15s ease,background .15s ease; }
|
|
35
|
-
.refresh-button:hover { background:#ffffff10; color:var(--text); }
|
|
36
|
-
.job-filter:focus-visible,.refresh-button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
|
|
37
|
-
.jobs-feedback { flex:none; min-width:0; max-width:12rem; font-size:.67rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
38
|
-
.jobs-feedback:empty { display:none; }
|
|
39
|
-
.jobs-feedback:not(:empty) { flex-basis:100%; max-width:none; text-align:right; white-space:normal; }
|
|
40
|
-
.job-search { flex:1 1 11rem; width:12rem; min-width:8rem; max-width:18rem; border:1px solid var(--border); border-radius:.45rem; background:var(--surface); color:var(--text); padding:.3rem .5rem; font:inherit; font-size:.72rem; }
|
|
41
|
-
.job-search:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
|
|
42
|
-
.quick-filter { border:1px solid var(--border); border-radius:.35rem; background:var(--surface); color:var(--muted); padding:.27rem .42rem; font:inherit; font-size:.7rem; font-weight:750; cursor:pointer; }
|
|
43
|
-
.quick-filter[aria-pressed="true"] { border-color:var(--accent); background:var(--accent2); color:var(--accent); }
|
|
44
|
-
.refresh-button { border:1px solid var(--border); border-radius:.35rem; background:var(--surface); color:var(--muted); padding:.28rem .55rem; font:inherit; font-size:.72rem; font-weight:700; cursor:pointer; }
|
|
45
|
-
.refresh-button:disabled { cursor:default; opacity:.55; }
|
|
46
|
-
.icon-button { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; width:2.5rem; height:2.5rem; padding:0; border:0; border-radius:50%; color:var(--muted); background:transparent; cursor:pointer; }
|
|
47
|
-
.icon-button svg { display:block; width:1.3rem; height:1.3rem; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
|
|
48
|
-
.icon-button:hover { color:var(--accent); background:var(--accent2); }
|
|
49
|
-
.icon-button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
|
|
50
|
-
.icon-button:disabled { cursor:default; opacity:.4; }
|
|
51
|
-
.job-status-button[data-state="ACTIVE"],.job-status-button[data-state="COMPLETED"] { color:var(--ok); background:#e5f3e9; }
|
|
52
|
-
.job-status-button[data-state="DRAFT"] { color:#3f51b5; background:#eef2ff; }
|
|
53
|
-
.job-status-button[data-state="CANCELLED"],.job-status-button[data-state="IDLE"] { color:var(--muted); background:#edf0f4; }
|
|
54
|
-
.job-status-button .status-center { fill:currentColor; stroke:none; }
|
|
55
|
-
.job-state-select[data-state="ACTIVE"],.job-state-select[data-state="COMPLETED"] { color:var(--ok); background:#e5f3e9; border-color:transparent; }
|
|
56
|
-
.job-state-select[data-state="DRAFT"] { color:#3f51b5; background:#eef2ff; border-color:transparent; }
|
|
57
|
-
.job-state-select[data-state="CANCELLED"] { color:var(--muted); background:#edf0f4; border-color:transparent; }
|
|
58
|
-
.mobile-only { display:none; }
|
|
59
|
-
.panel-body { padding:.75rem; overflow:auto; max-height:calc(100vh - 11.5rem); }
|
|
60
|
-
#jobs-workspace > .panel:first-child .panel-body { overflow:visible; max-height:none; }
|
|
61
|
-
.jobs-panel { grid-row:1/span 2; }
|
|
62
|
-
.workspace { display:grid; gap:1rem; }
|
|
63
|
-
.job-list,.tree,.event-list { list-style:none; margin:0; padding:0; }
|
|
64
|
-
.job-list { display:grid; gap:.35rem; }
|
|
65
|
-
.job-row { display:grid; gap:.2rem; padding:.35rem .45rem; border:1px solid transparent; border-radius:.4rem; cursor:pointer; }
|
|
66
|
-
.job-row[aria-current="true"] { border-color:var(--accent); background:var(--accent2); }
|
|
67
|
-
.job-row.complete-unmerged { border-color:#d69a1b; background:#fff8df; }
|
|
68
|
-
.job-row.complete-unmerged[aria-current="true"] { border-color:#b77900; background:#fff0bd; }
|
|
69
|
-
.job-content { min-width:0; display:grid; gap:.2rem; }
|
|
70
|
-
.job-button { min-width:0; display:block; padding:.12rem 0; border:0; background:transparent; color:inherit; text-align:left; font:inherit; cursor:pointer; }
|
|
71
|
-
.job-title { font-weight:750; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
72
|
-
.job-last-line { display:flex; align-items:center; justify-content:space-between; gap:.5rem; min-width:0; }
|
|
73
|
-
.job-last-line .subtle:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
74
|
-
.job-last-line .subtle:last-child { flex:none; white-space:nowrap; }
|
|
75
|
-
.job-primary { display:flex; align-items:center; justify-content:space-between; gap:.45rem; min-width:0; }
|
|
76
|
-
.job-status-line { display:flex; align-items:center; gap:.3rem; min-width:0; white-space:nowrap; }
|
|
77
|
-
.job-status-line .badge { flex:0 0 auto; }
|
|
78
|
-
.badge { display:inline-flex; align-items:center; border-radius:999px; padding:.06rem .42rem; min-height:1.35rem; font-size:.68rem; font-weight:800; }
|
|
79
|
-
.badge.ACTIVE,.badge.RUNNING,.badge.SUCCEEDED,.badge.COMPLETED,.badge.MERGED { background:#e5f3e9; color:var(--ok); }
|
|
80
|
-
.badge.BLOCKED,.badge.DRAFT,.badge.QUEUED,.badge.WAITING,.badge.AWAITING_DECISION,.badge.OPEN { background:#fff1d2; color:var(--warn); }
|
|
81
|
-
.badge.FAILED { background:#ffe8e8; color:var(--bad); }
|
|
82
|
-
.badge.IDLE,.badge.CANCELLED { background:#edf0f4; color:var(--muted); }
|
|
83
|
-
.badge.DRAFT { background:#eef2ff; color:#3f51b5; }
|
|
84
|
-
.badge.shortcut-mode { background:var(--accent2); color:var(--accent); border:1px solid var(--accent); }
|
|
85
|
-
.badge.MERGE_PENDING { background:#ffe3a3; color:#7a4a00; }
|
|
86
|
-
.details-dialog { width:min(850px,calc(100vw - 2rem)); max-height:85vh; overflow:auto; border:1px solid var(--border); border-radius:.6rem; background:var(--surface); color:var(--text); box-shadow:0 18px 55px #0004; padding:1rem; } .details-dialog::backdrop { background:#17202b99; } .details-dialog-head { display:flex; justify-content:space-between; align-items:center; gap:1rem; position:sticky; top:-1rem; background:var(--surface); padding:.5rem 0; } .details-dialog pre { white-space:pre-wrap; overflow-wrap:anywhere; background:var(--surface2); padding:.7rem; border-radius:.4rem; } .details-dialog h3 { font-size:.8rem; margin:1rem 0 .3rem; }
|
|
87
|
-
.job-summary,.detail-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.55rem; }
|
|
88
|
-
.detail-group { min-width:0; padding:.5rem; background:var(--surface2); border:1px solid var(--border); border-radius:.4rem; }
|
|
89
|
-
.detail-label { margin:0; color:var(--muted); font-size:.66rem; text-transform:uppercase; letter-spacing:.04em; }
|
|
90
|
-
.detail-value { margin:.12rem 0 0; font-weight:650; overflow-wrap:anywhere; }
|
|
91
|
-
.section-title { margin:.8rem 0 .35rem; color:var(--muted); font-size:.72rem; letter-spacing:.05em; text-transform:uppercase; }
|
|
92
|
-
ul.tree { display:grid; gap:.25rem; min-width:0; max-width:100%; }
|
|
93
|
-
ul.tree li { min-width:0; max-width:100%; }
|
|
94
|
-
ul.tree ul { width:calc(100% - .6rem); min-width:0; max-width:calc(100% - .6rem); list-style:none; margin:.2rem 0 .1rem .6rem; padding-left:.6rem; border-left:1px solid var(--border); }
|
|
95
|
-
.task-line { display:flex; align-items:center; gap:.2rem; min-width:0; }
|
|
96
|
-
.task-fold { flex:0 0 auto; width:1.35rem; padding:.32rem 0; border:0; background:transparent; color:var(--muted); font:inherit; cursor:pointer; }
|
|
97
|
-
.task-row { width:100%; max-width:100%; overflow:hidden; flex:1 1 0; display:flex; align-items:center; gap:.4rem; min-width:0; padding:.32rem .38rem; border:0; border-radius:.35rem; background:transparent; color:inherit; font:inherit; text-align:left; cursor:pointer; }
|
|
98
|
-
.task-row[aria-current="true"] { background:var(--accent2); }
|
|
99
|
-
.task-row .badge { flex:0 0 auto; }
|
|
100
|
-
.task-id { min-width:0; max-width:100%; flex:1 1 0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font: .77rem ui-monospace,SFMono-Regular,Menlo,monospace; }
|
|
101
|
-
.task-actions { display:flex; justify-content:flex-end; gap:.25rem; margin-bottom:.5rem; }
|
|
102
|
-
.task-link { color:var(--accent); font-weight:700; }
|
|
103
|
-
.agent-graph { display:grid; gap:.45rem; margin-top:.55rem; padding:.55rem; border:1px solid var(--border); border-radius:.4rem; background:var(--surface2); overflow:auto; }
|
|
104
|
-
.agent-wave { display:flex; align-items:center; gap:.4rem; min-width:max-content; }
|
|
105
|
-
.agent-node { padding:.32rem .48rem; border:1px solid var(--border); border-radius:.35rem; background:var(--surface); font:.73rem ui-monospace,SFMono-Regular,Menlo,monospace; }
|
|
106
|
-
.agent-arrow { color:var(--muted); font-weight:800; }
|
|
107
|
-
.agent-graph-source { margin:.1rem 0 0; padding:.45rem; border-radius:.35rem; background:var(--surface); color:var(--muted); font:.7rem/1.45 ui-monospace,SFMono-Regular,Menlo,monospace; white-space:pre; overflow:auto; }
|
|
108
|
-
.event-list { display:grid; gap:.45rem; }
|
|
109
|
-
.event-item { padding:.34rem .42rem .42rem; border-left:3px solid transparent; border-bottom:1px solid var(--border); border-radius:.28rem; }
|
|
110
|
-
.event-item.event-error { border-left-color:var(--bad); background:#fff4f4; }
|
|
111
|
-
.event-item.event-error .event-kind,.event-item.event-error .event-message { color:var(--bad); }
|
|
112
|
-
.event-item.event-warn { border-left-color:var(--warn); background:#fff9eb; }
|
|
113
|
-
.event-item.event-warn .event-kind { color:var(--warn); }
|
|
114
|
-
.event-meta { display:flex; flex-wrap:wrap; gap:.4rem; color:var(--muted); font-size:.68rem; }
|
|
115
|
-
.event-kind { color:var(--accent); font-weight:800; }
|
|
116
|
-
.event-message { margin:.12rem 0 0; overflow-wrap:anywhere; }
|
|
117
|
-
#usage-view,#graphs-view,#rules-view,#shortcuts-view,#worker-rules-view { grid-column:1 / -1; }
|
|
118
|
-
.graphs-browser { display:grid; grid-template-columns:minmax(190px,260px) minmax(0,1fr); gap:.75rem; min-height:60vh; }
|
|
119
|
-
.graph-list { display:grid; align-content:start; gap:.35rem; }
|
|
120
|
-
.graph-button { width:100%; display:grid; gap:.08rem; padding:.48rem .55rem; border:1px solid var(--border); border-radius:.4rem; background:var(--surface2); color:var(--text); text-align:left; font:inherit; cursor:pointer; }
|
|
121
|
-
.graph-button[aria-current="true"] { border-color:var(--accent); background:var(--accent2); }
|
|
122
|
-
.graph-button strong { font-size:.78rem; }
|
|
123
|
-
.graph-button span { color:var(--muted); font:.66rem ui-monospace,SFMono-Regular,Menlo,monospace; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
124
|
-
.graph-preview { min-width:0; display:grid; align-content:start; gap:.55rem; }
|
|
125
|
-
.graph-preview-head { display:flex; justify-content:space-between; gap:.7rem; align-items:baseline; flex-wrap:wrap; }
|
|
126
|
-
.graph-preview-head h3 { margin:0; font-size:.95rem; }
|
|
127
|
-
.graph-canvas { min-height:24rem; display:grid; place-items:center; overflow:auto; padding:1rem; border:1px solid var(--border); border-radius:.45rem; background:var(--surface2); }
|
|
128
|
-
.graph-canvas svg { max-width:none; height:auto; }
|
|
129
|
-
.graph-canvas svg rect.background { display:none; }
|
|
130
|
-
.graph-canvas svg .edgeLabel rect, .graph-canvas svg .edgeLabel .labelBkg, .graph-canvas svg .edgeLabel .background { fill:transparent !important; opacity:0 !important; }
|
|
131
|
-
.graph-navigation { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; margin-bottom:.7rem; }
|
|
132
|
-
.graph-canvas .node.drillable { cursor:pointer; }
|
|
133
|
-
.graph-canvas .node.drillable text, .graph-canvas .node.drillable tspan { fill:#2367b1; }
|
|
134
|
-
.jel-chart .node.jel-inspectable { cursor:pointer; }
|
|
135
|
-
.jel-chart .node.jel-inspectable:focus-visible { outline:2px solid #2563eb; outline-offset:3px; }
|
|
136
|
-
.jel-source { overflow:auto; white-space:pre; font:12px/1.5 ui-monospace,monospace; }
|
|
137
|
-
.graph-dialog { box-sizing:border-box; width:98vw; height:96vh; height:96dvh; max-width:none; max-height:none; padding:.55rem; border:1px solid var(--border); border-radius:.5rem; background:var(--surface); color:var(--text); }
|
|
138
|
-
.graph-dialog[open] { display:flex; flex-direction:column; gap:.25rem; }
|
|
139
|
-
.graph-dialog::backdrop { background:#17202b99; }
|
|
140
|
-
.graph-dialog-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.7rem; padding:.3rem .5rem; }
|
|
141
|
-
.graph-dialog-viewport { flex:1; min-height:0; min-width:0; overflow:auto; cursor:grab; background:var(--surface2); border:1px solid var(--border); border-radius:.4rem; }
|
|
142
|
-
.graph-dialog-viewport:active { cursor:grabbing; }
|
|
143
|
-
.graph-dialog-viewport .graph-canvas { display:grid; width:max-content; min-width:100%; min-height:100%; overflow:visible; }
|
|
144
|
-
.graph-canvas .node text { pointer-events:none; }
|
|
145
|
-
.graph-source { margin:0; max-height:22rem; overflow:auto; padding:.7rem; border:1px solid var(--border); border-radius:.4rem; background:var(--surface2); color:var(--muted); font:.72rem/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; white-space:pre; }
|
|
146
|
-
.graph-source-details summary { cursor:pointer; color:var(--muted); font-size:.74rem; font-weight:700; }
|
|
147
|
-
.rules-editor { display:grid; gap:.65rem; }
|
|
148
|
-
.rules-help { margin:0; color:var(--muted); font-size:.8rem; }
|
|
149
|
-
.rules-textarea { width:100%; min-height:55vh; resize:vertical; border:1px solid var(--border); border-radius:.45rem; background:var(--surface2); color:var(--text); padding:.8rem; font:13px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; }
|
|
150
|
-
.rules-footer { display:flex; align-items:center; justify-content:space-between; gap:.75rem; flex-wrap:wrap; }
|
|
151
|
-
.rules-save { border:1px solid var(--accent); border-radius:.35rem; background:var(--accent); color:#fff; padding:.38rem .8rem; font:inherit; font-weight:750; cursor:pointer; }
|
|
152
|
-
.rules-save:disabled { opacity:.55; cursor:default; }
|
|
153
|
-
.usage-providers { display:grid; gap:.55rem; }
|
|
154
|
-
.usage-provider { display:grid; grid-template-columns:minmax(130px,180px) minmax(0,1fr); gap:1rem; align-items:center; padding:.7rem .8rem; border:1px solid var(--border); border-radius:.45rem; background:var(--surface2); }
|
|
155
|
-
.usage-provider h3 { margin:0; font-size:.86rem; }
|
|
156
|
-
.usage-bars { display:grid; gap:1rem; }
|
|
157
|
-
.usage-row { display:grid; gap:.35rem; }
|
|
158
|
-
.usage-label { display:flex; justify-content:space-between; gap:1rem; font-weight:700; }
|
|
159
|
-
.usage-track { height:.72rem; overflow:hidden; border:1px solid var(--border); border-radius:999px; background:var(--surface2); }
|
|
160
|
-
.usage-fill { height:100%; width:0; border-radius:inherit; background:var(--accent); transition:width .2s ease; }
|
|
161
|
-
.usage-details { border-top:1px solid var(--border); padding-top:.45rem; }
|
|
162
|
-
.usage-details summary { cursor:pointer; color:var(--muted); font-size:.72rem; font-weight:700; }
|
|
163
|
-
.usage-details-body { display:grid; gap:.3rem; margin-top:.4rem; overflow-wrap:anywhere; }
|
|
164
|
-
.empty,.error-state { padding:.85rem; border:1px dashed var(--border); border-radius:.4rem; color:var(--muted); }
|
|
165
|
-
.error-state,.error-text { color:var(--bad); }
|
|
166
|
-
.skeleton { height:3.2rem; border-radius:.4rem; background:linear-gradient(90deg,#edf0f4,#fafbfc,#edf0f4); animation:pulse 1.2s infinite; }
|
|
167
|
-
@keyframes pulse { 50% { opacity:.55; } }
|
|
168
|
-
@media (max-width:1050px) { main { grid-template-columns:1fr; } .jobs-panel { grid-row:auto; } .panel-body { max-height:24rem; } #jobs-workspace > .panel:first-child .panel-body { max-height:none; } }
|
|
169
|
-
@media (max-width:650px) {
|
|
170
|
-
header { padding:.65rem .7rem; }
|
|
171
|
-
nav[role="tablist"] { overflow-x:auto; padding-bottom:.1rem; }
|
|
172
|
-
nav button { flex:0 0 auto; white-space:nowrap; }
|
|
173
|
-
main { padding:.5rem; gap:.65rem; }
|
|
174
|
-
body[data-mobile-jobs-view="list"] #jobs-workspace { display:none; }
|
|
175
|
-
body[data-mobile-jobs-view="detail"] #jobs-view { display:none; }
|
|
176
|
-
.mobile-only { display:inline-flex; }
|
|
177
|
-
#jobs-view .panel-head { display:grid; align-items:start; }
|
|
178
|
-
#jobs-view .panel-actions { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; width:100%; gap:.25rem; }
|
|
179
|
-
.runtime-summary { display:none; }
|
|
180
|
-
#jobs-view .job-filters { display:grid; grid-template-columns:minmax(0,1fr) 5.8rem 4.6rem; align-items:center; gap:.25rem; min-width:0; }
|
|
181
|
-
#jobs-view .job-search { width:100%; min-width:0; max-width:none; min-height:2.25rem; }
|
|
182
|
-
#jobs-view .job-filter { width:100%; max-width:none; min-width:0; text-transform:none; font-size:.69rem; min-height:2.25rem; padding:.2rem .15rem; }
|
|
183
|
-
#jobs-view .jobs-actions { justify-content:flex-end; }
|
|
184
|
-
#jobs-view .jobs-feedback { grid-column:1 / -1; text-align:left; }
|
|
185
|
-
#jobs-view #jobs-refresh { width:2.25rem; height:2.25rem; }
|
|
186
|
-
#jobs-workspace > .panel:first-child > .panel-head { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:.3rem; align-items:center; }
|
|
187
|
-
#jobs-workspace > .panel:first-child > .panel-head .panel-actions { flex-wrap:nowrap; gap:.05rem; }
|
|
188
|
-
#jobs-view .panel-body { max-height:none; }
|
|
189
|
-
#jobs-workspace { gap:.65rem; }
|
|
190
|
-
#jobs-workspace .panel-body { max-height:none; }
|
|
191
|
-
#usage-view .panel-head { padding:.6rem .7rem .35rem; }
|
|
192
|
-
#usage-view .panel-head .subtle { display:none; }
|
|
193
|
-
.graphs-browser { grid-template-columns:1fr; min-height:0; }
|
|
194
|
-
.graph-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
|
|
195
|
-
.graph-canvas { min-height:18rem; }
|
|
196
|
-
#usage-view .panel-body { padding:.45rem .5rem .65rem; max-height:none; }
|
|
197
|
-
#usage-view .usage-providers { gap:.45rem; }
|
|
198
|
-
#usage-view .usage-provider {
|
|
199
|
-
grid-template-columns:1fr;
|
|
200
|
-
gap:.55rem;
|
|
201
|
-
padding:.65rem .7rem;
|
|
202
|
-
border-radius:.55rem;
|
|
203
|
-
background:var(--surface);
|
|
204
|
-
}
|
|
205
|
-
#usage-view .usage-provider h3 { font-size:.78rem; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
|
|
206
|
-
#usage-view .usage-bars { gap:.7rem; }
|
|
207
|
-
#usage-view .usage-row { gap:.25rem; }
|
|
208
|
-
#usage-view .usage-label { align-items:baseline; gap:.5rem; font-size:.78rem; }
|
|
209
|
-
#usage-view .usage-label span:last-child { font-size:1.05rem; font-weight:800; color:var(--text); }
|
|
210
|
-
#usage-view .usage-track { height:.48rem; border:0; background:var(--border); }
|
|
211
|
-
#usage-view .usage-row .subtle { font-size:.68rem; line-height:1.25; }
|
|
212
|
-
#usage-view .usage-provider > .detail-value { font-size:1.2rem; font-weight:800; }
|
|
213
|
-
#usage-view .usage-details { padding-top:.35rem; }
|
|
214
|
-
#usage-view .usage-details-body { font-size:.68rem; }
|
|
215
|
-
.details-dialog { width:min(850px,calc(100vw - 2rem)); max-height:85vh; overflow:auto; border:1px solid var(--border); border-radius:.6rem; background:var(--surface); color:var(--text); box-shadow:0 18px 55px #0004; padding:1rem; } .details-dialog::backdrop { background:#17202b99; } .details-dialog-head { display:flex; justify-content:space-between; align-items:center; gap:1rem; position:sticky; top:-1rem; background:var(--surface); padding:.5rem 0; } .details-dialog pre { white-space:pre-wrap; overflow-wrap:anywhere; background:var(--surface2); padding:.7rem; border-radius:.4rem; } .details-dialog h3 { font-size:.8rem; margin:1rem 0 .3rem; }
|
|
216
|
-
.job-summary,.detail-groups { grid-template-columns:1fr; }
|
|
217
|
-
.panel-head { padding:.55rem .6rem; }
|
|
218
|
-
.panel-body { padding:.6rem; }
|
|
219
|
-
.tagline { display:none; }
|
|
220
|
-
}
|
|
221
|
-
@media (prefers-reduced-motion:reduce) { .skeleton { animation:none; } .usage-fill { transition:none; } }
|
|
222
|
-
.router-rules-workspace{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:start;min-width:0}.router-rules-pane{min-width:0;max-width:100%;overflow:hidden}.rules-editor .rules-textarea{min-height:420px}.audit-log{display:flex;flex-direction:column;gap:8px;max-height:500px;overflow:auto;min-width:0}.audit-entry{border:1px solid var(--border);border-radius:10px;padding:10px;background:var(--surface)}.audit-entry-head{display:flex;justify-content:space-between;gap:8px;align-items:center}.audit-entry pre{white-space:pre-wrap;word-break:break-word;margin:8px 0 0;font-size:11px}.router-test-panel{margin-top:16px;border-top:1px solid var(--border);padding-top:12px}.router-test-results{margin-top:8px;display:flex;flex-direction:column;gap:6px;max-height:480px;overflow:auto;min-width:0}.router-test-results pre{white-space:pre;overflow:auto;max-width:100%;font-size:11px;line-height:1.45;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:12px}.router-test-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;padding:7px 0;border-bottom:1px solid var(--border)}@media(max-width:900px){.router-rules-workspace{grid-template-columns:1fr}.router-rules-pane{max-height:none}.router-test-results{max-height:420px}}@media(max-width:650px){#rules-view .panel-head .subtle{display:none}#rules-view .panel-body{max-height:none;overflow:visible;padding:.6rem}#rules-view .router-rules-workspace{gap:.9rem}#rules-view .rules-help{font-size:.74rem;line-height:1.4}#rules-view .rules-textarea{min-height:52vh;padding:.65rem;font-size:12px}#rules-view .rules-footer{align-items:stretch}#rules-view .rules-footer>.subtle{width:100%}#rules-view .rules-footer>div{width:100%;display:grid;grid-template-columns:1fr 1fr;gap:.5rem}#rules-view .rules-save{min-height:44px;width:100%;padding:.55rem .7rem}#rules-view .router-rules-pane>.panel-head{padding:.55rem 0}#rules-view .audit-log{max-height:none}#rules-view .audit-entry-head{align-items:flex-start}#rules-view .audit-entry-head .subtle{display:block;flex:0 0 auto}#rules-view .router-test-panel{min-width:0;max-width:100%;overflow:hidden}#rules-view .router-test-results{max-height:none;width:100%;max-width:100%;overflow-x:hidden}#rules-view .router-test-results>*{min-width:0;max-width:100%}#rules-view .router-test-results pre{width:100%;box-sizing:border-box;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font-size:11px;padding:.65rem}#rules-view .router-test-row{grid-template-columns:1fr}}
|
|
223
|
-
</style>`;
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
/** Legacy Node/Rust byte-for-byte stylesheet parity fixture; source is a standalone PWA asset. */
|
|
3
|
+
export const dashboardStyles = ' <style>' + readFileSync(new URL('../dashboard/dashboard.css', import.meta.url), 'utf8') + '</style>';
|
package/dist/dashboard.js
CHANGED
|
@@ -2,6 +2,7 @@ import { inspectWorkflowSymbol } from './dashboard-workflow-inspection.js';
|
|
|
2
2
|
import { createServer } from 'node:http';
|
|
3
3
|
import { subscribeLocalCommits } from './local-commit-events.js';
|
|
4
4
|
import { handleTroubleshooterQa } from './troubleshooter-qa-api.js';
|
|
5
|
+
import { readFile } from 'node:fs/promises';
|
|
5
6
|
import { readUsageSnapshot } from './usage.js';
|
|
6
7
|
import { deriveJobRuntimeStatus } from './runtime-status.js';
|
|
7
8
|
import { DeliveryDeduper, parseGitHubWebhook, verifyGitHubWebhook } from './github-webhook.js';
|
|
@@ -9,12 +10,23 @@ import { loadExecutionRouterRules, saveExecutionRouterRules } from './routing-po
|
|
|
9
10
|
import { summarizeRuntime } from './runtime-summary.js';
|
|
10
11
|
import { dashboardWorkflowGraphs, effectiveGitHubUsage, eventHistory, listDashboardJobInventory, searchDashboardJobs } from './dashboard-data.js';
|
|
11
12
|
export { dashboardWorkflowGraphs, githubPrUrl, searchDashboardJobs } from './dashboard-data.js';
|
|
13
|
+
/** Exact public asset allowlist; no path interpolation from request URLs. */
|
|
14
|
+
const dashboardStaticAssets = {
|
|
15
|
+
'/dashboard.css': ['dashboard.css', 'text/css; charset=utf-8'],
|
|
16
|
+
'/dashboard.js': ['dashboard.js', 'text/javascript; charset=utf-8'],
|
|
17
|
+
'/pwa.js': ['pwa.js', 'text/javascript; charset=utf-8'],
|
|
18
|
+
'/service-worker.js': ['service-worker.js', 'text/javascript; charset=utf-8'],
|
|
19
|
+
'/manifest.webmanifest': ['manifest.webmanifest', 'application/manifest+json; charset=utf-8'],
|
|
20
|
+
'/icons/icon-180.png': ['icons/icon-180.png', 'image/png'],
|
|
21
|
+
'/icons/icon-192.png': ['icons/icon-192.png', 'image/png'],
|
|
22
|
+
'/icons/icon-512.png': ['icons/icon-512.png', 'image/png'],
|
|
23
|
+
};
|
|
12
24
|
const SSE_HEARTBEAT_MS = 15000;
|
|
13
25
|
function isTaskId(candidate) {
|
|
14
26
|
return candidate.length > 0;
|
|
15
27
|
}
|
|
16
28
|
export { dashboardHtml, dashboardVersion, dashboardSourceRevision } from './dashboard-html.js';
|
|
17
|
-
import {
|
|
29
|
+
import { dashboardIndexHtml, dashboardConfigScript, dashboardVersion } from './dashboard-html.js';
|
|
18
30
|
export function serveDashboard(store, port = 8787, bus, refreshMs = 300000, jobId, usageRegistry, overviewProvider, webhook, statusProvider, githubUsageProvider, exactJobProvider, actions, routerTestProvider, decisionAuditProvider) {
|
|
19
31
|
const legacyActions = typeof exactJobProvider === 'object' && exactJobProvider !== null ? exactJobProvider : undefined;
|
|
20
32
|
const legacyExactJobProvider = !exactJobProvider && githubUsageProvider ? githubUsageProvider : undefined;
|
|
@@ -122,9 +134,27 @@ export function serveDashboard(store, port = 8787, bus, refreshMs = 300000, jobI
|
|
|
122
134
|
return JSON.stringify({ ...account, githubEffective, githubStatus });
|
|
123
135
|
};
|
|
124
136
|
const server = createServer(async (req, res) => {
|
|
125
|
-
if (req.url === '/') {
|
|
126
|
-
res.writeHead(200, { 'content-type': 'text/html; charset=utf-8' });
|
|
127
|
-
res.end(
|
|
137
|
+
if (req.method === 'GET' && req.url === '/') {
|
|
138
|
+
res.writeHead(200, { 'content-type': 'text/html; charset=utf-8', 'cache-control': 'no-store', 'x-content-type-options': 'nosniff' });
|
|
139
|
+
res.end(dashboardIndexHtml);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (req.method === 'GET' && req.url === '/dashboard-config.js') {
|
|
143
|
+
res.writeHead(200, { 'content-type': 'text/javascript; charset=utf-8', 'cache-control': 'no-store', 'x-content-type-options': 'nosniff' });
|
|
144
|
+
res.end(dashboardConfigScript());
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const asset = req.method === 'GET' ? dashboardStaticAssets[req.url ?? ''] : undefined;
|
|
148
|
+
if (asset) {
|
|
149
|
+
try {
|
|
150
|
+
const content = await readFile(new URL('../dashboard/' + asset[0], import.meta.url));
|
|
151
|
+
res.writeHead(200, { 'content-type': asset[1], 'cache-control': 'no-cache', 'x-content-type-options': 'nosniff' });
|
|
152
|
+
res.end(content);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
res.writeHead(404);
|
|
156
|
+
res.end('Not found');
|
|
157
|
+
}
|
|
128
158
|
return;
|
|
129
159
|
}
|
|
130
160
|
if (req.url === '/api/version') {
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { realpathSync } from 'node:fs';
|
|
3
|
+
import { isFinalReviewAgent } from './final-review-role.js';
|
|
4
|
+
const SHA = /^[a-f0-9]{40,64}$/i;
|
|
5
|
+
const SOURCE_REF = /^refs\/heads\/[A-Za-z0-9][A-Za-z0-9._/-]*$/;
|
|
6
|
+
/** Source delivery policy is fixed when the Task is created, not inferred from event data. */
|
|
7
|
+
export function sourceCommitRequired(task) {
|
|
8
|
+
return task.output?.kind === 'task_pr' && task.kind !== 'planner' && !task.agentGraph
|
|
9
|
+
&& !isFinalReviewAgent(task.agentName)
|
|
10
|
+
&& !['troubleshooter', 'planner', 'review-chair'].includes(task.agentName ?? '');
|
|
11
|
+
}
|
|
12
|
+
function git(cwd, ...args) {
|
|
13
|
+
return execFileSync('git', ['-C', cwd, ...args], { encoding: 'utf8', timeout: 8000,
|
|
14
|
+
stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: 1024 * 1024 }).trim();
|
|
15
|
+
}
|
|
16
|
+
function root(job) {
|
|
17
|
+
if (!job.projectRoot || !job.repository)
|
|
18
|
+
throw new Error('Git delivery requires a canonical Job projectRoot');
|
|
19
|
+
const path = realpathSync(job.projectRoot);
|
|
20
|
+
if (realpathSync(git(path, 'rev-parse', '--show-toplevel')) !== path)
|
|
21
|
+
throw new Error('Git delivery projectRoot is not the canonical Git root');
|
|
22
|
+
return path;
|
|
23
|
+
}
|
|
24
|
+
function ref(job) {
|
|
25
|
+
const value = job.localMerge?.sourceRef;
|
|
26
|
+
if (!value || !SOURCE_REF.test(value) || value.includes('..') || value.endsWith('.lock'))
|
|
27
|
+
throw new Error('Git delivery requires a configured local Job source branch');
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
/** Read-only Git facts; event senders cannot select a different repository or branch. */
|
|
31
|
+
export function sourceCommitSha(job) {
|
|
32
|
+
return git(root(job), 'rev-parse', '--verify', `${ref(job)}^{commit}`);
|
|
33
|
+
}
|
|
34
|
+
/** Snapshot the source head before any Worker's code edits; persist it with this execution. */
|
|
35
|
+
export function startedSourceBaseline(job, taskId) {
|
|
36
|
+
const task = job.tasks.find(item => item.id === taskId);
|
|
37
|
+
return task?.gitDeliveryRequired ? sourceCommitSha(job) : null;
|
|
38
|
+
}
|
|
39
|
+
export function bindSourceBaseline(task, sha) {
|
|
40
|
+
if (task.gitDeliveryRequired && sha && task.executionId) {
|
|
41
|
+
task.gitDeliveryBaseline = { executionId: task.executionId, sha };
|
|
42
|
+
task.gitDelivery = undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function ownedWorktree(job) {
|
|
46
|
+
const project = root(job);
|
|
47
|
+
const wanted = ref(job);
|
|
48
|
+
const matches = git(project, 'worktree', 'list', '--porcelain').split(/\n\s*\n/).filter(Boolean)
|
|
49
|
+
.map(record => {
|
|
50
|
+
const lines = record.split('\n');
|
|
51
|
+
return { path: lines.find(line => line.startsWith('worktree '))?.slice(9),
|
|
52
|
+
branch: lines.find(line => line.startsWith('branch '))?.slice(7) };
|
|
53
|
+
}).filter(item => item.branch === wanted && item.path);
|
|
54
|
+
if (matches.length !== 1)
|
|
55
|
+
throw new Error('Git delivery requires exactly one checked-out source branch worktree');
|
|
56
|
+
const path = realpathSync(matches[0].path);
|
|
57
|
+
if (git(path, 'symbolic-ref', 'HEAD') !== wanted)
|
|
58
|
+
throw new Error('Git delivery branch changed');
|
|
59
|
+
return path;
|
|
60
|
+
}
|
|
61
|
+
/** Validate exact execution/branch binding, a new nonempty commit and a fully clean source worktree. */
|
|
62
|
+
export function verifySourceCommit(job, task, executionId, commitSha) {
|
|
63
|
+
if (!task.gitDeliveryRequired || task.state !== 'RUNNING' || task.executionId !== executionId)
|
|
64
|
+
throw new Error('Git delivery requires an active source Task execution');
|
|
65
|
+
const baseline = task.gitDeliveryBaseline;
|
|
66
|
+
if (!baseline || baseline.executionId !== executionId || !SHA.test(baseline.sha))
|
|
67
|
+
throw new Error('Git delivery is missing the current execution start baseline');
|
|
68
|
+
if (!SHA.test(commitSha))
|
|
69
|
+
throw new Error('Git delivery requires a full commit SHA');
|
|
70
|
+
const actual = sourceCommitSha(job);
|
|
71
|
+
if (commitSha === baseline.sha)
|
|
72
|
+
throw new Error('Git delivery requires a new committed source branch HEAD');
|
|
73
|
+
const path = ownedWorktree(job);
|
|
74
|
+
if (git(path, 'rev-parse', '--verify', 'HEAD') !== actual)
|
|
75
|
+
throw new Error('Git delivery source worktree HEAD differs from branch');
|
|
76
|
+
if (git(path, 'status', '--porcelain=v1', '--untracked-files=all'))
|
|
77
|
+
throw new Error('Git delivery source worktree has uncommitted or untracked changes');
|
|
78
|
+
try {
|
|
79
|
+
git(path, 'merge-base', '--is-ancestor', baseline.sha, commitSha);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
throw new Error('Git delivery commit does not descend from execution baseline');
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
git(path, 'merge-base', '--is-ancestor', commitSha, actual);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
throw new Error('Git delivery commit is not on the current Job source branch');
|
|
89
|
+
}
|
|
90
|
+
// An unrelated Worker may advance Job HEAD after this Worker commits.
|
|
91
|
+
// Verify the Task-owned commit itself, not the newest commit by another Worker.
|
|
92
|
+
const message = git(path, 'log', '-1', '--format=%B', commitSha).split('\n').map(line => line.trim());
|
|
93
|
+
if (!message.includes(`Relay-Task: ${task.id}`) || !message.includes(`Relay-Execution: ${executionId}`))
|
|
94
|
+
throw new Error('Git delivery commit must contain exact Relay-Task and Relay-Execution trailers');
|
|
95
|
+
if (!git(path, 'diff-tree', '--no-commit-id', '--name-only', '-r', commitSha))
|
|
96
|
+
throw new Error('Git delivery requires a nonempty code commit');
|
|
97
|
+
return { executionId, baseSha: baseline.sha, commitSha, worktree: path, verifiedAt: new Date().toISOString() };
|
|
98
|
+
}
|
|
99
|
+
/** Persisted proof alone is never sufficient: validate live Git again on every terminal ingress. */
|
|
100
|
+
export function sourceCompletionVerified(job, task, executionId) {
|
|
101
|
+
if (!task.gitDeliveryRequired)
|
|
102
|
+
return true;
|
|
103
|
+
if (!executionId || task.gitDelivery?.executionId !== executionId)
|
|
104
|
+
return false;
|
|
105
|
+
try {
|
|
106
|
+
const current = verifySourceCommit(job, task, executionId, task.gitDelivery.commitSha);
|
|
107
|
+
return current.baseSha === task.gitDelivery.baseSha && current.worktree === task.gitDelivery.worktree;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -61,6 +61,7 @@ export async function managedWorkerInput(job, task, context, mode = 'production'
|
|
|
61
61
|
skillPath: join(packageRoot, 'skills/agents-relay/SKILL.md'),
|
|
62
62
|
taskTitle: task.title,
|
|
63
63
|
workerSelfReview: role === 'worker',
|
|
64
|
+
sourceCommitRequired: task.gitDeliveryRequired === true,
|
|
64
65
|
jobId: job.id,
|
|
65
66
|
taskId: task.id,
|
|
66
67
|
executionId: task.executionId,
|
|
@@ -19,6 +19,7 @@ import { monitorExecutionProcess } from './execution-process-tracker.js';
|
|
|
19
19
|
import { HostInteractiveInvocationCoordinator, hostInvocationPorts } from './interactive-invocation.js';
|
|
20
20
|
import { resumeInteractiveTask } from './interactive-resume.js';
|
|
21
21
|
import { acceptTaskProgress, armInactivityWatchdog, inactivityDeadline, isCorrelatedWorkerEvent, isRecoverableWatchdogFailure } from './task-inactivity-watchdog.js';
|
|
22
|
+
import { startedSourceBaseline, bindSourceBaseline, sourceCompletionVerified } from './git-delivery.js';
|
|
22
23
|
const activeExecutionOwners = new Map();
|
|
23
24
|
import { withExecutionBoundary } from './execution-boundary.js';
|
|
24
25
|
export { withExecutionBoundary } from './execution-boundary.js';
|
|
@@ -216,6 +217,7 @@ export class ReconcilerRuntimeBase {
|
|
|
216
217
|
}
|
|
217
218
|
async markWorkerStarted(event) {
|
|
218
219
|
const live = this.live.get(event.task_id);
|
|
220
|
+
const baseline = startedSourceBaseline(await this.store.load(event.job_id), event.task_id);
|
|
219
221
|
const transition = await this.taskTransitions.apply(event.job_id, event.task_id, 'task.started', {
|
|
220
222
|
eligible: (job, task) => {
|
|
221
223
|
if (!task.executionId || eventSourceId(event) !== executionEventSource(job.id, task.id, task.executionId))
|
|
@@ -231,6 +233,7 @@ export class ReconcilerRuntimeBase {
|
|
|
231
233
|
&& Boolean(task.executionId && eventSourceId(event) === executionEventSource(event.job_id, task.id, task.executionId)),
|
|
232
234
|
}),
|
|
233
235
|
mutate: (_job, task) => {
|
|
236
|
+
bindSourceBaseline(task, baseline);
|
|
234
237
|
task.updatedAt = task.lastProgressAt = new Date().toISOString();
|
|
235
238
|
task.lastProgressEventAt = event.timestamp;
|
|
236
239
|
},
|
|
@@ -422,6 +425,8 @@ export class ReconcilerRuntimeBase {
|
|
|
422
425
|
return false;
|
|
423
426
|
if (isFinalReviewAgent(task.agentName) && event.type === 'task.completed')
|
|
424
427
|
return false;
|
|
428
|
+
if (event.type === 'task.completed' && !sourceCompletionVerified(_job, task, terminalEventExecutionId ?? null))
|
|
429
|
+
return false;
|
|
425
430
|
if (event.type === 'task.completed' && task.interactiveInvocation?.status !== undefined && task.interactiveInvocation.status !== 'approved')
|
|
426
431
|
return false; // current interactive revision requires durable approval
|
|
427
432
|
const modelBacked = ['codex', 'chatgpt', 'z', 'script'].includes(task.adapter);
|
|
@@ -437,7 +442,7 @@ export class ReconcilerRuntimeBase {
|
|
|
437
442
|
facts: (_job, task) => {
|
|
438
443
|
const processExitedAfterPublishedTerminal = task.failureReason === 'worker_exit_without_terminal_event';
|
|
439
444
|
const freshEnough = processExitedAfterPublishedTerminal || isCorrelatedWorkerEvent(task, event);
|
|
440
|
-
return { recoverableExecution: isRecoverableWatchdogFailure(task) && freshEnough, awaitingInteractiveDecision: lifecycleEvent === 'task.interactive_waiting' && task.interactiveInvocation?.status === 'awaiting_decision' };
|
|
445
|
+
return { recoverableExecution: isRecoverableWatchdogFailure(task) && freshEnough, awaitingInteractiveDecision: lifecycleEvent === 'task.interactive_waiting' && task.interactiveInvocation?.status === 'awaiting_decision', sourceDeliveryVerified: sourceCompletionVerified(_job, task, terminalEventExecutionId ?? null) };
|
|
441
446
|
},
|
|
442
447
|
mutate: (job, task) => {
|
|
443
448
|
const modelBacked = ['codex', 'chatgpt', 'z', 'script'].includes(task.adapter);
|
package/dist/relayd-control.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { submitTargetedRevisionRequest } from './review-revision-model.js';
|
|
2
2
|
import { beginInteractiveReview, abortInteractiveReview, failInteractiveReview, interactiveWaitingEvent } from './interactive-request.js';
|
|
3
3
|
import { localSourceHead, localWorkingHead } from './local-git-merge.js';
|
|
4
|
+
import { verifySourceCommit } from './git-delivery.js';
|
|
5
|
+
import { eventFor } from './events.js';
|
|
6
|
+
import { executionEventSource } from './execution-event-identity.js';
|
|
4
7
|
import { appendTaskComment } from './task-comments.js';
|
|
5
8
|
import { InMemoryStore } from './store.js';
|
|
6
9
|
import { openLocalManagedStore } from './local-managed-store.js';
|
|
@@ -211,6 +214,48 @@ export function createWorkspaceControl(deps) {
|
|
|
211
214
|
// The committed receipt must not be obscured by an unrelated wake failure.
|
|
212
215
|
return response;
|
|
213
216
|
}
|
|
217
|
+
if (command === 'task.complete') {
|
|
218
|
+
const taskId = typeof body.taskId === 'string' ? body.taskId : '';
|
|
219
|
+
const executionId = typeof body.executionId === 'string' ? body.executionId : '';
|
|
220
|
+
const commitSha = typeof body.commitSha === 'string' ? body.commitSha : '';
|
|
221
|
+
const repository = typeof body.repository === 'string' ? body.repository : '';
|
|
222
|
+
const summary = typeof body.summary === 'string' ? body.summary.trim() : '';
|
|
223
|
+
if (!taskId || !executionId || !commitSha || !summary || repository !== job.repository || summary.length > 4000)
|
|
224
|
+
throw new Error('task.complete requires matching repository, Task/Execution IDs, commit SHA and bounded summary');
|
|
225
|
+
const original = job.tasks.find((item) => item.id === taskId);
|
|
226
|
+
if (!original || !original.gitDeliveryRequired)
|
|
227
|
+
throw new Error('task.complete is for commit-required source Tasks only');
|
|
228
|
+
if (original.state === 'SUCCEEDED' && original.gitDelivery?.executionId === executionId && original.gitDelivery.commitSha === commitSha)
|
|
229
|
+
return { accepted: true, idempotent: true, task: original };
|
|
230
|
+
const receipt = verifySourceCommit(job, original, executionId, commitSha);
|
|
231
|
+
await store.mutateJob(jobId, (current) => {
|
|
232
|
+
const task = current.tasks.find((item) => item.id === taskId);
|
|
233
|
+
if (!task || !task.gitDeliveryRequired || task.state !== 'RUNNING' || task.executionId !== executionId
|
|
234
|
+
|| task.gitDeliveryBaseline?.executionId !== receipt.executionId || task.gitDeliveryBaseline.sha !== receipt.baseSha)
|
|
235
|
+
throw new Error('task.complete refused: stale or replaced source Task execution');
|
|
236
|
+
task.gitDelivery = receipt;
|
|
237
|
+
task.updatedAt = new Date().toISOString();
|
|
238
|
+
return current;
|
|
239
|
+
});
|
|
240
|
+
const reconciler = makeReconciler(store, concurrency);
|
|
241
|
+
const event = eventFor(jobId, taskId, original.parentTaskId, 'task.completed', 'succeeded', summary, 'worker', { commit_sha: commitSha, verified_git_delivery: true }, { id: executionEventSource(jobId, taskId, executionId), agent: original.agentName ?? 'worker', component: 'agents-relay-cli' });
|
|
242
|
+
try {
|
|
243
|
+
const outcome = await reconciler.applyEvent(event);
|
|
244
|
+
if (!outcome.applied)
|
|
245
|
+
throw new Error('task.complete rejected by Task Graph: ' + outcome.reason);
|
|
246
|
+
try {
|
|
247
|
+
await bus?.publish(event);
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
process.stderr.write(`warning: task.complete event transport: ${String(error)}\n`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
finally {
|
|
254
|
+
await reconciler.close();
|
|
255
|
+
}
|
|
256
|
+
await pool.reconcileLocalJob(jobId, 'control.task.complete');
|
|
257
|
+
return { accepted: true, task: (await store.load(jobId)).tasks.find((item) => item.id === taskId) };
|
|
258
|
+
}
|
|
214
259
|
if (command === 'task.comment') {
|
|
215
260
|
const taskId = typeof body.taskId === 'string' ? body.taskId : '';
|
|
216
261
|
const message = typeof body.message === 'string' ? body.message : '';
|
|
@@ -5,7 +5,7 @@ import { WORKFLOW_EFFECT_NAMES, WORKFLOW_EVENT_NAMES, WORKFLOW_MUTATION_NAMES, }
|
|
|
5
5
|
const TASK_STATES = ['DRAFT', 'QUEUED', 'RUNNING', 'AWAITING_DECISION', 'BLOCKED', 'SUCCEEDED', 'FAILED', 'CANCELLED'];
|
|
6
6
|
const JOB_STATES = ['DRAFT', 'ACTIVE', 'COMPLETED', 'CANCELLED'];
|
|
7
7
|
const conditionRegistry = new ConditionRegistry([
|
|
8
|
-
...new Set(['dependenciesSatisfied', 'dependenciesUnsatisfied', 'runnable', 'dispatchable', 'recoverableExecution', 'troubleshooterRecovery', 'troubleshooterTask', 'awaitingInteractiveDecision', 'retryAvailable', 'notMerged', 'autoMerge', 'prOpen', 'reviewDisabled', 'implementationComplete', 'headAvailable', 'mergeCapable', 'localCompletionAllowed', 'localMergeReady'])
|
|
8
|
+
...new Set(['dependenciesSatisfied', 'dependenciesUnsatisfied', 'runnable', 'dispatchable', 'recoverableExecution', 'sourceDeliveryVerified', 'troubleshooterRecovery', 'troubleshooterTask', 'awaitingInteractiveDecision', 'retryAvailable', 'notMerged', 'autoMerge', 'prOpen', 'reviewDisabled', 'implementationComplete', 'headAvailable', 'mergeCapable', 'localCompletionAllowed', 'localMergeReady'])
|
|
9
9
|
].map(booleanCondition));
|
|
10
10
|
const boolGuard = (name) => conditionRegistry.guard(name);
|
|
11
11
|
export const lifecycleConditions = conditionRegistry;
|
|
@@ -31,6 +31,7 @@ export const taskLifecycleV2 = load('task-lifecycle', TASK_STATES, {
|
|
|
31
31
|
dispatchable: boolGuard('dispatchable'),
|
|
32
32
|
shortcutEffectsSafe: facts => facts.durableFacts.shortcutEffectsSafe === true,
|
|
33
33
|
recoverableExecution: boolGuard('recoverableExecution'),
|
|
34
|
+
sourceDeliveryVerified: boolGuard('sourceDeliveryVerified'),
|
|
34
35
|
troubleshooterRecovery: boolGuard('troubleshooterRecovery'),
|
|
35
36
|
troubleshooterTask: boolGuard('troubleshooterTask'),
|
|
36
37
|
awaitingInteractiveDecision: facts => facts.durableFacts.awaitingInteractiveDecision === true,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { dispatchJobLifecycleSync, dispatchTaskLifecycleSync } from './lifecycle.js';
|
|
2
2
|
import { deriveTaskTitle } from '../task-title.js';
|
|
3
3
|
import { validateDependencyValidity } from '../dependency-validity.js';
|
|
4
|
+
import { sourceCommitRequired } from '../git-delivery.js';
|
|
4
5
|
function dependenciesSatisfied(job, dependencies) {
|
|
5
6
|
if (dependencies.length === 0)
|
|
6
7
|
return true;
|
|
@@ -23,7 +24,7 @@ function validateTaskRequirements(value) {
|
|
|
23
24
|
*/
|
|
24
25
|
export function createTaskEntity(job, value, options = {}) {
|
|
25
26
|
validateTaskRequirements(value);
|
|
26
|
-
const task = { ...value, title: value.title?.trim() || deriveTaskTitle(value.input, value.agentName ? `${value.agentName} task` : 'Task'), state: 'DRAFT' };
|
|
27
|
+
const task = { ...value, gitDeliveryRequired: sourceCommitRequired(value), title: value.title?.trim() || deriveTaskTitle(value.input, value.agentName ? `${value.agentName} task` : 'Task'), state: 'DRAFT' };
|
|
27
28
|
if (!options.defer) {
|
|
28
29
|
dispatchTaskLifecycleSync(task, 'reconcile', {
|
|
29
30
|
dependenciesSatisfied: dependenciesSatisfied(job, task.dependencies),
|
|
@@ -26,7 +26,7 @@ function v2WorkflowDecision(runtime, from, event, facts = {}) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
export function decideTaskLifecycle(task, event, facts = {}) {
|
|
29
|
-
return v2WorkflowDecision(taskLifecycleV2, task.state, event, { ...facts, troubleshooterTask: task.agentName === 'troubleshooter' });
|
|
29
|
+
return v2WorkflowDecision(taskLifecycleV2, task.state, event, { ...facts, troubleshooterTask: task.agentName === 'troubleshooter', sourceDeliveryVerified: facts.sourceDeliveryVerified !== false });
|
|
30
30
|
}
|
|
31
31
|
export function decideJobLifecycle(job, event, facts = {}) {
|
|
32
32
|
return v2WorkflowDecision(jobLifecycleV2, job.state, event, facts);
|
|
@@ -36,7 +36,7 @@ export function dispatchTaskLifecycleSync(task, event, facts = {}) {
|
|
|
36
36
|
const result = dispatchWorkflowGraphSync(taskLifecycleV2, {
|
|
37
37
|
initialState: task.state,
|
|
38
38
|
input: { transport: 'event', id: event, payload: {} },
|
|
39
|
-
durableFacts: { ...facts, troubleshooterTask: task.agentName === 'troubleshooter' },
|
|
39
|
+
durableFacts: { ...facts, troubleshooterTask: task.agentName === 'troubleshooter', sourceDeliveryVerified: task.gitDeliveryRequired !== true || facts.sourceDeliveryVerified === true },
|
|
40
40
|
graphName: 'task-lifecycle',
|
|
41
41
|
persistTransition: (_source, target) => applyTaskGraphTarget(task, target, new Date().toISOString(), event === 'task.unblocked' && task.agentName === 'troubleshooter'),
|
|
42
42
|
executeAction: actionId => { actions.push(actionId); if (actionId.startsWith('mutation.'))
|
|
@@ -49,7 +49,7 @@ export function dispatchTaskLifecycleSync(task, event, facts = {}) {
|
|
|
49
49
|
export async function dispatchTaskLifecycle(task, event, facts = {}, executeEffect, persist) {
|
|
50
50
|
const actions = [];
|
|
51
51
|
const result = await dispatchWorkflowGraph(taskLifecycleV2, {
|
|
52
|
-
initialState: task.state, input: { transport: 'event', id: event, payload: {} }, durableFacts: { ...facts, troubleshooterTask: task.agentName === 'troubleshooter' },
|
|
52
|
+
initialState: task.state, input: { transport: 'event', id: event, payload: {} }, durableFacts: { ...facts, troubleshooterTask: task.agentName === 'troubleshooter', sourceDeliveryVerified: task.gitDeliveryRequired !== true || facts.sourceDeliveryVerified === true },
|
|
53
53
|
graphName: 'task-lifecycle',
|
|
54
54
|
persistTransition: async (_source, target) => { applyTaskGraphTarget(task, target, new Date().toISOString(), event === 'task.unblocked' && task.agentName === 'troubleshooter'); await persist?.(); },
|
|
55
55
|
executeAction: async (actionId) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agents-relay",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.267",
|
|
4
4
|
"description": "Durable async agent jobs coordinated through GitHub pull requests",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
"dist",
|
|
51
|
+
"dashboard",
|
|
51
52
|
"bin",
|
|
52
53
|
"agents",
|
|
53
54
|
"skills",
|
|
@@ -15,6 +15,10 @@ Relay owns durable Jobs and Tasks; do one-shot work directly. On Neo Master, **u
|
|
|
15
15
|
- Deliver: optional verified non-force origin/main push after completion; never changes Job state.
|
|
16
16
|
- Daemon: no Workspace scan and no `--workspace` requirement. Neo's `package.published` watcher restarts package-backed PM2 services after npm `latest` is confirmed.
|
|
17
17
|
|
|
18
|
+
## Source Worker completion
|
|
19
|
+
|
|
20
|
+
New source Tasks (`gitDeliveryRequired: true`) must commit with `Relay-Task: ID` and `Relay-Execution: EXECUTION_ID` trailers, then run the matching `agents-relay task complete` CLI with `--repo --id --task-id --execution-id --commit-sha --summary`. Relay verifies clean Git HEAD and execution before emitting completion. **Never directly emit `task.completed`**. File, Reviewer, Troubleshooter and legacy Tasks retain normal events.
|
|
21
|
+
|
|
18
22
|
## Job Execution Lifecycle (JEL)
|
|
19
23
|
|
|
20
24
|
**JEL:** Create → [Plan] → Execute → Final Review → local Merge → Completed. Plan-free Coordinator uses the same lifecycle. PASS merges; CHANGES_REQUIRED records findings and starts Planner N+1 for minimal fixes, then re-reviews. No post-success Plan. Planner/Workers use **ponytail** (YAGNI, reuse, minimal Tasks) without bypassing safety gates.
|