@kriya-ai/harness 0.2.5 → 2.0.0
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/RELEASE_NOTES.md +121 -0
- package/SAFETY.md +181 -0
- package/THIRD_PARTY_NOTICES.md +113 -0
- package/bin/kriya.js +188 -2
- package/bundle/cordis.patch.yml +49 -0
- package/contract/SOURCE.md +3 -3
- package/contract/contract.json +498 -3
- package/contract/schemas/api.json +64 -0
- package/contract/schemas/auth_matrix.json +44 -0
- package/contract/schemas/component_states.json +33 -0
- package/contract/schemas/design_tokens.json +34 -0
- package/contract/schemas/scene_direction.json +82 -0
- package/contract/schemas/threat_model.json +44 -0
- package/package.json +2 -1
- package/plugins/changes/client.js +5 -3
- package/plugins/deploy/index.js +215 -0
- package/plugins/deploy/package.json +13 -0
- package/plugins/grounding/index.js +81 -0
- package/plugins/grounding/lookup.js +373 -0
- package/plugins/grounding/package.json +13 -0
- package/plugins/kriya-tools/index.js +2 -1
- package/plugins/loop/index.js +376 -10
- package/plugins/mcp/index.js +79 -0
- package/plugins/mcp/package.json +13 -0
- package/plugins/mirror/index.js +17 -0
- package/plugins/overview/client.js +5 -2
- package/plugins/preview/client.js +12 -6
- package/plugins/progress/client.js +7 -4
- package/plugins/repo/index.js +230 -0
- package/plugins/repo/package.json +13 -0
- package/plugins/repo/repo.js +348 -0
- package/plugins/runstrip/client.js +426 -0
- package/plugins/runstrip/index.js +301 -0
- package/plugins/runstrip/package.json +23 -0
- package/src/cartridges.js +133 -0
- package/src/contracts.js +130 -0
- package/src/critic.js +78 -0
- package/src/daemon.js +7 -1
- package/src/doctor.js +67 -0
- package/src/edit/core/effects.js +185 -0
- package/src/edit/core/ffmpeg.js +65 -6
- package/src/edit/core/layout.js +46 -1
- package/src/edit/core/ops.js +169 -2
- package/src/edit/core/plan.js +65 -9
- package/src/edit/core/project.d.ts +24 -0
- package/src/edit/core/project.js +64 -0
- package/src/edit/core/solver.js +34 -6
- package/src/edit/core/style-brief.js +211 -0
- package/src/edit/core/style-packs.js +57 -0
- package/src/edit/core/type-kit.js +173 -0
- package/src/edit/director/ask.js +37 -3
- package/src/edit/director/assembly.js +829 -0
- package/src/edit/director/continuity.js +9 -1
- package/src/edit/director/custom-motion.js +88 -0
- package/src/edit/director/graphics.js +44 -10
- package/src/edit/director/intent.js +125 -0
- package/src/edit/director/mentions.js +52 -0
- package/src/edit/director/plan.js +43 -11
- package/src/edit/director/revise.js +132 -9
- package/src/edit/director/viewer.js +136 -0
- package/src/edit/director/watch-fix.js +119 -0
- package/src/edit/engine/captions.js +110 -5
- package/src/edit/engine/confine.js +81 -4
- package/src/edit/engine/custom.js +243 -0
- package/src/edit/engine/dna2.js +893 -0
- package/src/edit/engine/fonts.js +218 -0
- package/src/edit/engine/graphics.js +271 -10
- package/src/edit/engine/index.js +14 -5
- package/src/edit/engine/motion.js +148 -13
- package/src/edit/engine/music-bed.js +59 -1
- package/src/edit/engine/packs.js +11 -0
- package/src/edit/engine/reference2.js +26 -0
- package/src/edit/engine/sfx.js +56 -1
- package/src/edit/engine/tool.js +21 -5
- package/src/edit/gates/assembly.js +194 -0
- package/src/edit/gates/copy.js +7 -4
- package/src/edit/gates/index.js +72 -7
- package/src/edit/gates/reference.js +115 -0
- package/src/edit/gates/tile.js +96 -0
- package/src/edit/host/client.js +4 -3
- package/src/edit/host/clips.js +33 -0
- package/src/edit/host/jobs.js +9 -3
- package/src/edit/host/layers.js +134 -0
- package/src/edit/host/main.js +10 -3
- package/src/edit/host/paths.js +21 -3
- package/src/edit/host/preview.js +108 -0
- package/src/edit/host/projects.js +443 -34
- package/src/edit/host/server.js +235 -20
- package/src/edit/host/tavi.js +77 -0
- package/src/edit/loop/make.js +28 -3
- package/src/edit/recipes/assembly.js +352 -0
- package/src/edit/recipes/graphic-clips.js +4 -2
- package/src/edit/recipes/openings.js +36 -0
- package/src/edit/recipes/reel.js +104 -14
- package/src/edit/recipes/reference-look.js +29 -0
- package/src/edit/recipes/short-from-long.js +3 -3
- package/src/edit/recipes/sound.js +71 -0
- package/src/edit/runtime/cli.js +26 -5
- package/src/edit/runtime/fetch.js +4 -4
- package/src/edit/runtime/licences.js +7 -1
- package/src/explore.js +103 -0
- package/src/failure.js +1 -1
- package/src/gate-commands.js +114 -0
- package/src/gates/api.js +127 -0
- package/src/gates/commands.js +111 -0
- package/src/gates/detectors.js +370 -0
- package/src/gates/http.js +62 -0
- package/src/gates/index.js +196 -0
- package/src/gates/page.js +264 -0
- package/src/gates/sast.js +64 -0
- package/src/gates/stack.js +110 -0
- package/src/gates/tenant.js +162 -0
- package/src/gates/three.js +407 -0
- package/src/gates/ui.js +111 -0
- package/src/launch.js +15 -3
- package/src/loop.js +199 -7
- package/src/mcp.js +126 -0
- package/src/milestones.js +188 -0
- package/src/modes.js +32 -0
- package/src/orchestra.js +43 -0
- package/src/outcomes.js +88 -0
- package/src/profiles.js +5 -0
- package/src/receipts.js +238 -0
- package/src/release.js +356 -0
- package/src/runstrip.js +122 -0
- package/src/stack.js +120 -0
- package/src/verify.js +67 -20
- package/studio/dist/fonts/fraunces.woff2 +0 -0
- package/studio/dist/fonts/geist.woff2 +0 -0
- package/studio/dist/fonts/jetbrains-mono.woff2 +0 -0
- package/studio/dist/studio.css +449 -1
- package/studio/dist/studio.js +3 -3
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
// Harness 2.0 W18 (WD-23), browser half: the Run strip in shell.bottom, the
|
|
2
|
+
// gate chip, Mission Control (a "Missions" row in the sidebar's panel list and
|
|
3
|
+
// its page in the main slot) and the four tracks' extra sections. Only
|
|
4
|
+
// mounted with --runstrip; it then tells the Overview, Progress, Preview and
|
|
5
|
+
// Changes tabs to read as Project, Proof, Live and Changes (same tab kinds, so
|
|
6
|
+
// the old ids keep working). Everything shown comes from index.js, which reads
|
|
7
|
+
// the loop's ledger only. Brand tokens only; no DSH file is edited (HD-02).
|
|
8
|
+
window.__ModuleLoader__.load({
|
|
9
|
+
id: "@kriya-ai/harness-runstrip",
|
|
10
|
+
factory: (require) => {
|
|
11
|
+
const React = require("react")
|
|
12
|
+
const { useCallback, useEffect, useRef, useState } = React
|
|
13
|
+
const h = React.createElement
|
|
14
|
+
|
|
15
|
+
const PLUGIN = "@kriya-ai/harness-runstrip"
|
|
16
|
+
const PANEL_ID = "kriya-missions"
|
|
17
|
+
const API = { strip: "api/kriya.runstrip", stop: "api/kriya.runstrip.stop", missions: "api/kriya.missions", track: "api/kriya.tracks", restore: "api/kriya.tracks.restore", verify: "api/kriya.tracks.receipt-verify" }
|
|
18
|
+
const STRIP_MS = 2000
|
|
19
|
+
const TRACK_MS = 4000
|
|
20
|
+
// The four tracks, in their fixed order, and the tab kinds they are (src/runstrip.js TRACKS)
|
|
21
|
+
const TRACKS = [
|
|
22
|
+
["live", "kriya-preview", "Live"],
|
|
23
|
+
["proof", "kriya-progress", "Proof"],
|
|
24
|
+
["changes", "kriya-changes", "Changes"],
|
|
25
|
+
["project", "kriya-overview", "Project"],
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
const CSS = `
|
|
29
|
+
.kh-chip { box-sizing: border-box; flex: none; display: inline-flex; align-items: center; gap: 5px; width: 14.5em; height: 28px; padding: 0 9px; border-radius: 999px; border: 1.5px solid var(--dsw-alias-label-tertiary); color: var(--dsw-alias-label-secondary); font-size: 11.5px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background-color .16s ease-out, border-color .16s ease-out, color .16s ease-out; }
|
|
30
|
+
.kh-chip-g { flex: none; width: 1em; text-align: center; font-weight: 700; }
|
|
31
|
+
.kh-chip-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
32
|
+
.kh-chip[data-state="passed"] { background: var(--dsw-alias-link); border-color: var(--dsw-alias-link); color: var(--dsw-alias-label-primary-foreground, #fff); }
|
|
33
|
+
.kh-chip[data-state="failed"] { border-color: var(--dsw-alias-state-error-primary); color: var(--dsw-alias-state-error-primary); }
|
|
34
|
+
.kh-chip[data-state="not-checked"] { border-style: dashed; }
|
|
35
|
+
.kh-chip[data-state="running"] { border-color: transparent; color: var(--dsw-alias-state-warn-label);
|
|
36
|
+
background: linear-gradient(90deg, var(--dsw-alias-state-warn-primary) 50%, transparent 0) repeat-x top / 8px 1.5px, linear-gradient(90deg, var(--dsw-alias-state-warn-primary) 50%, transparent 0) repeat-x bottom / 8px 1.5px, linear-gradient(0deg, var(--dsw-alias-state-warn-primary) 50%, transparent 0) repeat-y left / 1.5px 8px, linear-gradient(0deg, var(--dsw-alias-state-warn-primary) 50%, transparent 0) repeat-y right / 1.5px 8px;
|
|
37
|
+
animation: kh-stitch 1.2s linear infinite; }
|
|
38
|
+
@keyframes kh-stitch { to { background-position: 8px 0, -8px 100%, 0 -8px, 100% 8px; } }
|
|
39
|
+
.kh-chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
|
|
40
|
+
.kh-rs { box-sizing: border-box; height: 44px; overflow: hidden; border-top: .5px solid var(--kh-edge, var(--dsw-alias-border-l2)); background: var(--kh-glass-thick, var(--dsw-alias-bg-layer-1)); backdrop-filter: var(--kh-blur, none); color: var(--dsw-alias-label-primary); font-size: 12.5px; transition: height .2s ease-out; }
|
|
41
|
+
.kh-rs[data-open="true"] { height: 240px; }
|
|
42
|
+
.kh-rs-row { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px 0 14px; min-width: 0; }
|
|
43
|
+
.kh-rs-sum { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; min-height: 44px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0; }
|
|
44
|
+
.kh-rs-sum:focus-visible, .kh-rs-stop:focus-visible, .kh-mc-btn:focus-visible, .kh-tx-btn:focus-visible, .kh-tx-range:focus-visible { outline: 2px solid var(--dsw-alias-link); outline-offset: 2px; }
|
|
45
|
+
.kh-rs-step { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
|
|
46
|
+
.kh-rs-dim { color: var(--dsw-alias-label-tertiary); white-space: nowrap; }
|
|
47
|
+
.kh-rs-mono { font-family: var(--dsw-font-code, ui-monospace, monospace); font-variant-numeric: tabular-nums; }
|
|
48
|
+
.kh-rs-tier { flex: none; padding: 2px 8px; border-radius: 6px; background: var(--kh-chip, var(--dsw-alias-bg-layer-1)); box-shadow: var(--kh-rim, none); font-size: 11.5px; font-weight: 600; }
|
|
49
|
+
.kh-rs-count { display: none; }
|
|
50
|
+
.kh-rs-stop { flex: none; min-width: 44px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; color: var(--dsw-alias-state-error-primary); font: inherit; font-weight: 600; cursor: pointer; }
|
|
51
|
+
.kh-rs-stop:hover { background: var(--dsw-alias-interactive-bg-hover-danger, var(--dsw-alias-interactive-bg-hover)); }
|
|
52
|
+
.kh-rs-more { flex: none; }
|
|
53
|
+
.kh-rs-tl { height: 196px; overflow: auto; padding: 0 14px 10px; }
|
|
54
|
+
.kh-rs-at { display: grid; grid-template-columns: 6.5em 4.5em minmax(6em, 10em) 1fr 4em; gap: 10px; align-items: center; min-height: 34px; border-top: 1px dashed var(--dsw-alias-border-l2); }
|
|
55
|
+
.kh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
56
|
+
@media (max-width: 1023px) { .kh-rs-wide { display: none; } }
|
|
57
|
+
@media (max-width: 767px) { .kh-rs-mid, .kh-rs-row .kh-chips { display: none; } .kh-rs-count { display: inline; } .kh-rs-at { grid-template-columns: 5.5em 1fr 3.5em; } .kh-rs-at > :nth-child(2), .kh-rs-at > :nth-child(4) { display: none; } }
|
|
58
|
+
@media (prefers-reduced-motion: reduce) { .kh-chip, .kh-rs { transition: none; } .kh-chip[data-state="running"] { animation: none; } }
|
|
59
|
+
.kh-mc { height: 100%; overflow: auto; padding: 32px; box-sizing: border-box; color: var(--dsw-alias-label-primary); font-size: 14px; }
|
|
60
|
+
.kh-mc-title { margin: 0 0 6px; font-family: var(--dsw-font-family-brand); font-size: 30px; line-height: 36px; font-weight: 420; letter-spacing: -0.016em; }
|
|
61
|
+
.kh-mc-sub { margin: 0 0 20px; color: var(--dsw-alias-label-secondary); line-height: 1.5; max-width: 60ch; }
|
|
62
|
+
.kh-mc-card { padding: 14px 16px; border-radius: 16px; background: var(--kh-chip, var(--dsw-alias-bg-layer-1)); box-shadow: var(--kh-rim, inset 0 0 0 1px var(--dsw-alias-border-l3)); margin-bottom: 10px; }
|
|
63
|
+
.kh-mc-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; justify-content: space-between; }
|
|
64
|
+
.kh-mc-btn, .kh-tx-btn { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--kh-chip, var(--dsw-alias-bg-layer-1)); box-shadow: var(--kh-rim, inset 0 0 0 1px var(--dsw-alias-border-l3)); color: inherit; font: inherit; cursor: pointer; }
|
|
65
|
+
.kh-mc-note, .kh-tx-note { color: var(--dsw-alias-label-tertiary); line-height: 1.5; }
|
|
66
|
+
.kh-mc-error, .kh-tx-error { color: var(--dsw-alias-state-error-primary); }
|
|
67
|
+
.kh-tx { padding: 10px 14px; border-bottom: 1px solid var(--dsw-alias-border-l2); font-size: 13px; color: var(--dsw-alias-label-primary); }
|
|
68
|
+
.kh-tx-h { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
|
|
69
|
+
.kh-tx-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 32px; }
|
|
70
|
+
.kh-tx-vp { display: flex; gap: 6px; flex-wrap: wrap; }
|
|
71
|
+
.kh-tx-btn[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--dsw-alias-link); font-weight: 600; }
|
|
72
|
+
.kh-tx-range { width: 100%; min-height: 44px; accent-color: var(--dsw-alias-link); }
|
|
73
|
+
.kh-tx-mono { font-family: var(--dsw-font-code, ui-monospace, monospace); font-size: 12px; }
|
|
74
|
+
.kh-tx-banner { padding: 8px 12px; border-radius: 12px; font-weight: 600; }
|
|
75
|
+
.kh-tx-banner[data-ok="true"] { color: var(--dsw-alias-link); box-shadow: inset 0 0 0 1px var(--dsw-alias-link); }
|
|
76
|
+
.kh-tx-banner[data-ok="false"] { color: var(--dsw-alias-state-error-primary); box-shadow: inset 0 0 0 1px var(--dsw-alias-state-error-primary); }
|
|
77
|
+
.kh-tx-grid { display: grid; grid-template-columns: 7em 1fr; gap: 4px 10px; }
|
|
78
|
+
`
|
|
79
|
+
|
|
80
|
+
function installStyles() {
|
|
81
|
+
const tag = document.createElement("style")
|
|
82
|
+
tag.dataset.plugin = PLUGIN
|
|
83
|
+
tag.textContent = CSS
|
|
84
|
+
document.head.appendChild(tag)
|
|
85
|
+
return () => tag.remove()
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* ─────────────────────────────── data ─────────────────────────────── */
|
|
89
|
+
|
|
90
|
+
const message = (e) => (e?.message === "Failed to fetch" ? "Kriya Harness isn't answering; is it still running?" : String(e?.message ?? e))
|
|
91
|
+
async function getJson(url, init) {
|
|
92
|
+
const response = await fetch(url, { credentials: "same-origin", ...init })
|
|
93
|
+
const body = await response.json().catch(() => ({}))
|
|
94
|
+
if (!response.ok) throw new Error(body.error || `Kriya answered ${response.status}.`)
|
|
95
|
+
return body
|
|
96
|
+
}
|
|
97
|
+
const post = (url, body) => getJson(url, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) })
|
|
98
|
+
|
|
99
|
+
/** Polls `url` every `ms` while the page is visible: { data, error, reload }. */
|
|
100
|
+
function usePoll(url, ms) {
|
|
101
|
+
const [state, setState] = useState({ data: null, error: null })
|
|
102
|
+
const reload = useCallback(() => {
|
|
103
|
+
if (!url) return Promise.resolve()
|
|
104
|
+
return getJson(url).then((data) => setState({ data, error: null }), (e) => setState((s) => ({ data: s.data, error: message(e) })))
|
|
105
|
+
}, [url])
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
reload()
|
|
108
|
+
if (!ms) return
|
|
109
|
+
const timer = setInterval(() => (typeof document === "undefined" || !document.hidden) && reload(), ms)
|
|
110
|
+
return () => clearInterval(timer)
|
|
111
|
+
}, [reload, ms])
|
|
112
|
+
return { ...state, reload }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* ───────────────────────────── gate chip ──────────────────────────── */
|
|
116
|
+
|
|
117
|
+
const GLYPH = { waiting: "○", running: "◐", passed: "✓", failed: "×", "not-checked": "–" }
|
|
118
|
+
|
|
119
|
+
/** One gate: five states, its words always present, its width fixed (no layout shift). */
|
|
120
|
+
function GateChip({ chip }) {
|
|
121
|
+
return h(
|
|
122
|
+
"span",
|
|
123
|
+
{ className: "kh-chip", "data-state": chip.state, title: chip.text, role: "img", "aria-label": chip.text },
|
|
124
|
+
h("span", { className: "kh-chip-g", "aria-hidden": true }, GLYPH[chip.state] ?? "○"),
|
|
125
|
+
h("span", { className: "kh-chip-t", "aria-hidden": true }, chip.text)
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
const Chips = ({ chips }) => (chips?.length ? h("span", { className: "kh-chips" }, chips.map((c) => h(GateChip, { key: c.id, chip: c }))) : null)
|
|
129
|
+
|
|
130
|
+
/* ───────────────────────────── run strip ──────────────────────────── */
|
|
131
|
+
|
|
132
|
+
function elapsed(ms) {
|
|
133
|
+
const s = Math.max(0, Math.floor(ms / 1000))
|
|
134
|
+
if (s < 60) return `${s}s`
|
|
135
|
+
const m = Math.floor(s / 60)
|
|
136
|
+
return m < 60 ? `${m}m` : `${Math.floor(m / 60)}h ${String(m % 60).padStart(2, "0")}m`
|
|
137
|
+
}
|
|
138
|
+
const passedOf = (chips) => `${chips.filter((c) => c.state === "passed").length}/${chips.length} passed`
|
|
139
|
+
|
|
140
|
+
/** What the live region says, once per change of the finished attempts' verdict, never per chip. */
|
|
141
|
+
function announcement(prev, run) {
|
|
142
|
+
if (!run) return prev?.running ? { key: "idle", text: "Nothing is running." } : null
|
|
143
|
+
const done = run.attempts.filter((a) => a.outcome !== "building")
|
|
144
|
+
const last = done.at(-1)
|
|
145
|
+
const key = `${run.sessionId}:${run.step.n}:${done.length}:${last?.outcome ?? ""}`
|
|
146
|
+
if (prev?.key === key) return null
|
|
147
|
+
return { key, running: true, text: last ? `Step ${run.step.n}, attempt ${last.n}: ${last.outcome}.` : `Step ${run.step.n} started: ${run.step.title}.` }
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function Strip() {
|
|
151
|
+
const { data } = usePoll(API.strip, STRIP_MS)
|
|
152
|
+
const [open, setOpen] = useState(false)
|
|
153
|
+
const [said, setSaid] = useState(null)
|
|
154
|
+
const [error, setError] = useState(null)
|
|
155
|
+
const run = data?.runs?.[0]
|
|
156
|
+
const stop = useCallback(() => run && post(API.stop, { session: run.sessionId }).then(() => setError(null), (e) => setError(message(e))), [run?.sessionId])
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
const next = announcement(said, run)
|
|
159
|
+
if (next) setSaid({ ...next, running: Boolean(run) })
|
|
160
|
+
}, [run])
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
const onKey = (e) => {
|
|
163
|
+
if (!e.altKey || e.metaKey || e.ctrlKey) return
|
|
164
|
+
if (e.code === "ArrowUp" && run) (e.preventDefault(), setOpen((o) => !o))
|
|
165
|
+
else if (e.code === "Period" && run) (e.preventDefault(), stop())
|
|
166
|
+
}
|
|
167
|
+
window.addEventListener("keydown", onKey)
|
|
168
|
+
return () => window.removeEventListener("keydown", onKey)
|
|
169
|
+
}, [run, stop])
|
|
170
|
+
const live = h("div", { className: "kh-sr", role: "status", "aria-live": "polite" }, said?.text ?? "")
|
|
171
|
+
// Idle: nothing but the empty live region, so the slot reserves no space
|
|
172
|
+
if (!run) return live
|
|
173
|
+
const more = data.runs.length > 1 ? ` · +${data.runs.length - 1} more` : ""
|
|
174
|
+
return h(
|
|
175
|
+
"section",
|
|
176
|
+
{ className: "kh-rs", "data-open": String(open), "aria-label": "Run strip" },
|
|
177
|
+
live,
|
|
178
|
+
h(
|
|
179
|
+
"div",
|
|
180
|
+
{ className: "kh-rs-row" },
|
|
181
|
+
h(
|
|
182
|
+
"button",
|
|
183
|
+
{ type: "button", className: "kh-rs-sum", "aria-expanded": open, "aria-keyshortcuts": "Alt+ArrowUp", title: "Attempts (⌥↑)", onClick: () => setOpen((o) => !o) },
|
|
184
|
+
run.milestone && h("span", { className: "kh-rs-dim kh-rs-mid" }, `Milestone ${run.milestone.n}/${run.milestone.of} ›`),
|
|
185
|
+
h("span", { className: "kh-rs-step" }, `Step ${run.step.n}`, h("span", { className: "kh-rs-mid" }, ` "${run.step.title}"`)),
|
|
186
|
+
h("span", { className: "kh-rs-dim kh-rs-mono kh-rs-mid" }, `try ${run.attempt.n}/${run.attempt.of}${run.attempt.polish ? " · polish" : ""}`),
|
|
187
|
+
run.tier && h("span", { className: "kh-rs-tier kh-rs-mid", title: run.tier.model, "aria-label": `${run.tier.level}: ${run.tier.model}` }, run.tier.level),
|
|
188
|
+
h(Chips, { chips: run.gates }),
|
|
189
|
+
run.gates.length > 0 && h("span", { className: "kh-rs-count kh-rs-dim" }, passedOf(run.gates)),
|
|
190
|
+
h("span", { className: "kh-rs-dim kh-rs-mono kh-rs-wide" }, elapsed(run.elapsedMs)),
|
|
191
|
+
run.spend && h("span", { className: "kh-rs-dim kh-rs-mono kh-rs-wide", title: run.spend.estimated ? "Estimated: some requests aren't priced yet" : "This task's spend" }, `${run.spend.inr}${run.spend.estimated ? " est." : ""}`),
|
|
192
|
+
more && h("span", { className: "kh-rs-dim kh-rs-wide" }, more)
|
|
193
|
+
),
|
|
194
|
+
error && h("span", { className: "kh-mc-error", role: "alert" }, error),
|
|
195
|
+
h("button", { type: "button", className: "kh-rs-stop", onClick: stop, "aria-keyshortcuts": "Alt+Period", title: "Stop (⌥.)" }, "Stop")
|
|
196
|
+
),
|
|
197
|
+
open &&
|
|
198
|
+
h(
|
|
199
|
+
"div",
|
|
200
|
+
{ className: "kh-rs-tl", role: "list", "aria-label": "Attempts" },
|
|
201
|
+
run.attempts.map((a) =>
|
|
202
|
+
h(
|
|
203
|
+
"div",
|
|
204
|
+
{ key: a.n, className: "kh-rs-at", role: "listitem" },
|
|
205
|
+
h("span", null, `Attempt ${a.n}`),
|
|
206
|
+
h("span", { className: "kh-rs-dim" }, a.tier ?? "–"),
|
|
207
|
+
h("span", { className: a.outcome === "passed" ? "" : "kh-rs-dim" }, a.outcome),
|
|
208
|
+
h(Chips, { chips: a.gates }),
|
|
209
|
+
h("span", { className: "kh-rs-dim kh-rs-mono" }, elapsed(a.durationMs))
|
|
210
|
+
)
|
|
211
|
+
)
|
|
212
|
+
)
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* ──────────────────────────── track extras ─────────────────────────── */
|
|
217
|
+
|
|
218
|
+
const trackUrl = (sessionId, part) => sessionId && `${API.track}?${new URLSearchParams({ session: sessionId, part })}`
|
|
219
|
+
const Section = (title, body, action) => h("section", { className: "kh-tx", "aria-label": title }, h("h3", { className: "kh-tx-h" }, title, action), body)
|
|
220
|
+
/** Loading, error and empty states every extra shares; null when there is data to show. */
|
|
221
|
+
function states({ data, error }, empty) {
|
|
222
|
+
if (error && !data) return h("div", { className: "kh-tx-error", role: "alert" }, error)
|
|
223
|
+
if (!data) return h("div", { className: "kh-tx-note" }, "Loading…")
|
|
224
|
+
return empty(data) ? h("div", { className: "kh-tx-note" }, empty(data)) : null
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const VIEWPORTS = [360, 390, 1440]
|
|
228
|
+
/** Live: the viewport switch and the page gates drawn over the frame. */
|
|
229
|
+
function LiveExtra({ sessionId, viewport, setViewport }) {
|
|
230
|
+
const poll = usePoll(trackUrl(sessionId, "live"), TRACK_MS)
|
|
231
|
+
return Section(
|
|
232
|
+
"Live",
|
|
233
|
+
h(
|
|
234
|
+
React.Fragment,
|
|
235
|
+
null,
|
|
236
|
+
h(
|
|
237
|
+
"div",
|
|
238
|
+
{ className: "kh-tx-vp", role: "group", "aria-label": "Viewport" },
|
|
239
|
+
h("button", { type: "button", className: "kh-tx-btn", "aria-pressed": !viewport, onClick: () => setViewport(null) }, "Fit"),
|
|
240
|
+
VIEWPORTS.map((w) => h("button", { key: w, type: "button", className: "kh-tx-btn", "aria-pressed": viewport === w, onClick: () => setViewport(w) }, `${w}`))
|
|
241
|
+
),
|
|
242
|
+
sessionId && (states(poll, (d) => (d.gates.length ? null : "No page gate has run for this session yet.")) ?? h(Chips, { chips: poll.data.gates }))
|
|
243
|
+
)
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Proof: each step's chips, release readiness and the receipt with Copy and Verify. */
|
|
248
|
+
function ProofExtra({ sessionId }) {
|
|
249
|
+
const poll = usePoll(trackUrl(sessionId, "proof"), TRACK_MS)
|
|
250
|
+
const [check, setCheck] = useState(null)
|
|
251
|
+
const early = states(poll, (d) => (!d.steps.length && !d.release && !d.receipt ? "No plan yet. Ask for something with more than one step and the plan appears here." : null))
|
|
252
|
+
if (early) return Section("Proof", early)
|
|
253
|
+
const d = poll.data
|
|
254
|
+
const verify = () => post(API.verify, { session: sessionId }).then(setCheck, (e) => setCheck({ ok: false, problems: [message(e)] }))
|
|
255
|
+
return h(
|
|
256
|
+
React.Fragment,
|
|
257
|
+
null,
|
|
258
|
+
d.steps.some((s) => s.chips.length) &&
|
|
259
|
+
Section("Gates by step", d.steps.map((s) => h("div", { key: s.n, className: "kh-tx-row" }, h("span", { className: "kh-tx-mono" }, `${s.n}.`), s.chips.length ? h(Chips, { chips: s.chips }) : h("span", { className: "kh-tx-note" }, "no gates run")))),
|
|
260
|
+
Section(
|
|
261
|
+
"Release readiness",
|
|
262
|
+
d.release
|
|
263
|
+
? h(
|
|
264
|
+
React.Fragment,
|
|
265
|
+
null,
|
|
266
|
+
h("div", { className: "kh-tx-banner", "data-ok": String(d.release.ready) }, d.release.ready ? `Ready at ${d.release.commit}` : `Not ready at ${d.release.commit}`),
|
|
267
|
+
h("div", { className: "kh-tx-grid" }, d.release.lines.flatMap((l) => [h("span", { key: `${l.id}a`, className: "kh-tx-mono" }, l.id), h("span", { key: `${l.id}b` }, l.status)]))
|
|
268
|
+
)
|
|
269
|
+
: h("div", { className: "kh-tx-note" }, "Not checked: no release check has run (kriya release check).")
|
|
270
|
+
),
|
|
271
|
+
Section(
|
|
272
|
+
"Receipt",
|
|
273
|
+
d.receipt
|
|
274
|
+
? h(
|
|
275
|
+
React.Fragment,
|
|
276
|
+
null,
|
|
277
|
+
h("div", { className: "kh-tx-row" }, `Verdict ${d.receipt.verdict} · ${d.receipt.runs} run${d.receipt.runs === 1 ? "" : "s"}${d.receipt.commit ? ` · ${d.receipt.commit}` : ""}`),
|
|
278
|
+
h("div", { className: "kh-tx-row kh-tx-mono", title: d.receipt.chain }, d.receipt.chain.slice(0, 26), "…"),
|
|
279
|
+
h(
|
|
280
|
+
"div",
|
|
281
|
+
{ className: "kh-tx-row" },
|
|
282
|
+
h("button", { type: "button", className: "kh-tx-btn", onClick: () => navigator.clipboard?.writeText(d.receipt.markdown) }, "Copy"),
|
|
283
|
+
h("button", { type: "button", className: "kh-tx-btn", onClick: verify }, "Verify")
|
|
284
|
+
),
|
|
285
|
+
check && h("div", { className: "kh-tx-banner", role: "status", "data-ok": String(check.ok) }, check.ok ? "The receipt matches this computer's records." : check.problems.join(" "))
|
|
286
|
+
)
|
|
287
|
+
: h("div", { className: "kh-tx-note" }, "No receipt yet: one is made on request (kriya receipt make) or with a draft pull request.")
|
|
288
|
+
)
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** Changes: a time scrubber over this session's checkpoints, and "Restore this point". */
|
|
293
|
+
function ChangesExtra({ sessionId }) {
|
|
294
|
+
const poll = usePoll(trackUrl(sessionId, "changes"), TRACK_MS)
|
|
295
|
+
const [at, setAt] = useState(null)
|
|
296
|
+
const [note, setNote] = useState(null)
|
|
297
|
+
const early = states(poll, (d) => (d.points.length ? null : "No checkpoints yet: one is saved before each step changes files."))
|
|
298
|
+
if (early) return Section("Time", early)
|
|
299
|
+
const points = poll.data.points
|
|
300
|
+
const i = at === null || at >= points.length ? points.length - 1 : at
|
|
301
|
+
const p = points[i]
|
|
302
|
+
const restore = () => {
|
|
303
|
+
if (!window.confirm(`Put the files back as they were at "${p.label}"? The files as they are now are saved first, so this can be undone with kriya undo.`)) return
|
|
304
|
+
post(API.restore, { session: sessionId, commit: p.commit }).then((r) => (setNote(`Restored: ${r.changed} file${r.changed === 1 ? "" : "s"} changed.`), poll.reload()), (e) => setNote(message(e)))
|
|
305
|
+
}
|
|
306
|
+
return Section(
|
|
307
|
+
`Time · ${points.length} point${points.length === 1 ? "" : "s"}`,
|
|
308
|
+
h(
|
|
309
|
+
React.Fragment,
|
|
310
|
+
null,
|
|
311
|
+
h("input", { type: "range", className: "kh-tx-range", min: 0, max: points.length - 1, step: 1, value: i, onChange: (e) => setAt(Number(e.target.value)), "aria-label": "Checkpoint", "aria-valuetext": `${p.label}, ${p.verdict ?? "not checked"}` }),
|
|
312
|
+
h("div", { className: "kh-tx-row" }, h("span", { className: "kh-tx-mono" }, new Date(p.at).toLocaleTimeString()), h("span", null, p.label), h("span", { className: "kh-tx-note" }, p.verdict ? `then: ${p.verdict}` : "not checked")),
|
|
313
|
+
h("div", { className: "kh-tx-row" }, h("button", { type: "button", className: "kh-tx-btn", onClick: restore }, "Restore this point")),
|
|
314
|
+
note && h("div", { className: "kh-tx-note", role: "status" }, note)
|
|
315
|
+
)
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** Project: the repository's connection state and next action, MCP servers, and the capability matrix. */
|
|
320
|
+
function ProjectExtra({ sessionId }) {
|
|
321
|
+
const poll = usePoll(trackUrl(sessionId, "project"), 0)
|
|
322
|
+
const refresh = h("button", { type: "button", className: "kh-tx-btn", onClick: poll.reload, "aria-label": "Check the project again" }, "Check again")
|
|
323
|
+
const early = states(poll, () => null)
|
|
324
|
+
if (early) return Section("Project", early, refresh)
|
|
325
|
+
const d = poll.data
|
|
326
|
+
return h(
|
|
327
|
+
React.Fragment,
|
|
328
|
+
null,
|
|
329
|
+
Section("Repository", h(React.Fragment, null, h("div", { className: "kh-tx-row" }, h("b", null, d.repo.state)), h("div", { className: "kh-tx-note", style: { whiteSpace: "pre-line" } }, d.repo.text)), refresh),
|
|
330
|
+
Section("MCP servers", d.mcp.length ? d.mcp.map((m) => h("div", { key: m.id, className: "kh-tx-row" }, m.name)) : h("div", { className: "kh-tx-note" }, "None offered (kriya --mcp, and the owner's registry).")),
|
|
331
|
+
Section(
|
|
332
|
+
"What can be checked here",
|
|
333
|
+
h("div", { className: "kh-tx-grid" }, d.matrix.flatMap((r) => [h("span", { key: `${r.gate}a`, className: "kh-tx-mono" }, r.gate), h("span", { key: `${r.gate}b`, className: r.works ? "" : "kh-tx-note" }, r.works ? "works" : `needs ${r.needs}`)]))
|
|
334
|
+
)
|
|
335
|
+
)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/* ─────────────────────────── mission control ───────────────────────── */
|
|
339
|
+
|
|
340
|
+
function MissionsPage() {
|
|
341
|
+
const poll = usePoll(API.missions, TRACK_MS)
|
|
342
|
+
const head = [h("h1", { key: "t", className: "kh-mc-title" }, "Missions"), h("p", { key: "s", className: "kh-mc-sub" }, "Everything running on this computer: each project's milestones, what it waits for, and this month's spend.")]
|
|
343
|
+
if (poll.error && !poll.data) return h("div", { className: "kh-mc" }, head, h("p", { className: "kh-mc-error", role: "alert" }, poll.error))
|
|
344
|
+
if (!poll.data) return h("div", { className: "kh-mc" }, head, h("p", { className: "kh-mc-note" }, "Loading…"))
|
|
345
|
+
const d = poll.data
|
|
346
|
+
return h(
|
|
347
|
+
"div",
|
|
348
|
+
{ className: "kh-mc" },
|
|
349
|
+
head,
|
|
350
|
+
h(
|
|
351
|
+
"div",
|
|
352
|
+
{ className: "kh-mc-card" },
|
|
353
|
+
h(
|
|
354
|
+
"div",
|
|
355
|
+
{ className: "kh-mc-row" },
|
|
356
|
+
h("span", null, d.signedIn ? "Signed in to Kriya" : "Not signed in: run kriya login"),
|
|
357
|
+
d.account ? h("span", { className: "kh-rs-mono" }, `${d.account.used} of ${d.account.cap} this month${d.account.estimated ? " (estimated)" : ""}`) : d.signedIn && h("span", { className: "kh-mc-note" }, "Spend unavailable right now")
|
|
358
|
+
)
|
|
359
|
+
),
|
|
360
|
+
d.missions.length
|
|
361
|
+
? d.missions.map((m) =>
|
|
362
|
+
h(
|
|
363
|
+
"div",
|
|
364
|
+
{ key: m.root, className: "kh-mc-card" },
|
|
365
|
+
h("div", { className: "kh-mc-row" }, h("b", { title: m.root }, m.project), h("span", { className: "kh-rs-mono" }, `${m.done}/${m.of} milestones · ${m.status}`)),
|
|
366
|
+
m.current && h("div", null, `Milestone ${m.current.n}: ${m.current.title}`),
|
|
367
|
+
h("div", { className: "kh-mc-note" }, `Waiting for: ${m.waiting}`)
|
|
368
|
+
)
|
|
369
|
+
)
|
|
370
|
+
: h("p", { className: "kh-mc-note" }, "No missions yet. Long work gets milestones (kriya --milestones), and each project's appear here.")
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const MissionsIcon = ({ size = 20 }) =>
|
|
375
|
+
h("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.7, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, h("path", { d: "M4 5h16M4 12h10M4 19h6" }), h("circle", { cx: 18, cy: 16, r: 3 }))
|
|
376
|
+
|
|
377
|
+
/* ─────────────────────────────── apply ──────────────────────────────── */
|
|
378
|
+
|
|
379
|
+
// The seam the four tab plugins read (they render these only when present): titles, order, extras
|
|
380
|
+
const extras = {
|
|
381
|
+
title: Object.fromEntries(TRACKS.map(([, kind, title]) => [kind, title])),
|
|
382
|
+
order: Object.fromEntries(TRACKS.map(([, kind], i) => [kind, i + 1])),
|
|
383
|
+
Live: LiveExtra,
|
|
384
|
+
Proof: ProofExtra,
|
|
385
|
+
Changes: ChangesExtra,
|
|
386
|
+
Project: ProjectExtra,
|
|
387
|
+
GateChip,
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function openTrack(ctx, n) {
|
|
391
|
+
try {
|
|
392
|
+
ctx.get?.("sidebarRight")?.openTab(TRACKS[n][1])
|
|
393
|
+
} catch {
|
|
394
|
+
// No session open: nothing to show a track for
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const inject = ["slots"]
|
|
399
|
+
|
|
400
|
+
function apply(ctx) {
|
|
401
|
+
if (typeof document !== "undefined") ctx.effect(installStyles, "kriya-runstrip: styles")
|
|
402
|
+
ctx.effect(() => {
|
|
403
|
+
globalThis.__kriyaTracks = extras
|
|
404
|
+
return () => {
|
|
405
|
+
if (globalThis.__kriyaTracks === extras) delete globalThis.__kriyaTracks
|
|
406
|
+
}
|
|
407
|
+
}, "kriya-runstrip: tracks")
|
|
408
|
+
if (typeof window !== "undefined" && window.addEventListener)
|
|
409
|
+
ctx.effect(() => {
|
|
410
|
+
const onKey = (e) => {
|
|
411
|
+
const n = /^Digit([1-4])$/.exec(e.code ?? "")
|
|
412
|
+
if (!n || !e.altKey || e.metaKey || e.ctrlKey) return
|
|
413
|
+
e.preventDefault()
|
|
414
|
+
openTrack(ctx, Number(n[1]) - 1)
|
|
415
|
+
}
|
|
416
|
+
window.addEventListener("keydown", onKey)
|
|
417
|
+
return () => window.removeEventListener("keydown", onKey)
|
|
418
|
+
}, "kriya-runstrip: track keys")
|
|
419
|
+
ctx.slots.inject("shell.bottom", () => ctx.slots.register({ name: "shell.bottom", key: PLUGIN }, Strip))
|
|
420
|
+
ctx.slots.inject("main", () => ctx.slots.register({ name: "main", key: PANEL_ID }, MissionsPage))
|
|
421
|
+
ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({ name: "sidebar.panellist", id: PANEL_ID, order: 6, label: "Missions" }, MissionsIcon))
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return { apply, inject, Strip, GateChip, MissionsPage, LiveExtra, ProofExtra, ChangesExtra, ProjectExtra, announcement, extras, TRACKS, API, CSS }
|
|
425
|
+
},
|
|
426
|
+
})
|