@uniqbit/mate-core 1.0.0-canary.3 → 1.0.0-canary.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/hooks/hooks.json +21 -1
- package/claude-plugin/hooks/session-attention.mjs +10 -0
- package/claude-plugin/hooks/session-end.mjs +9 -0
- package/claude-plugin/hooks/session-guidance.mjs +1 -1
- package/opencode-plugin/src/server.ts +13 -2
- package/package.json +1 -1
- package/src/cli/commands/artifact/delivery/archive.ts +2 -2
- package/src/cli/commands/artifact/delivery/link.ts +22 -5
- package/src/cli/commands/artifact/delivery/output.ts +9 -1
- package/src/cli/commands/artifact/finish/openspec.ts +1 -3
- package/src/cli/commands/companion/companion.ts +1 -1
- package/src/cli/commands/companion/link.ts +36 -4
- package/src/cli/commands/companion/open.ts +40 -12
- package/src/cli/commands/doctor.ts +122 -0
- package/src/cli/commands/session/prepare.ts +32 -4
- package/src/cli/commands/session/registry.ts +90 -0
- package/src/cli/commands/studio/companion-removal.ts +79 -0
- package/src/cli/commands/studio/mate-inventory.ts +1 -1
- package/src/cli/commands/studio/payload.ts +12 -1
- package/src/cli/commands/studio/server.ts +39 -16
- package/src/cli/commands/studio/services.ts +20 -0
- package/src/cli/commands/studio/skill-files.ts +133 -0
- package/src/cli/commands/studio/vault.ts +218 -44
- package/src/cli/commands/studio/views/model.ts +0 -5
- package/src/cli/commands/studio/views/vault/markdown-tree.ts +255 -4
- package/src/cli/commands/unwrap.ts +8 -0
- package/src/cli/commands/update.ts +26 -8
- package/src/cli/commands/vscode/setup.ts +155 -0
- package/src/cli/commands/vscode/vsix.ts +73 -0
- package/src/cli/commands/working/cleanup.ts +34 -10
- package/src/cli/commands/working/worktree.ts +58 -8
- package/src/cli/commands/wrap.ts +33 -7
- package/src/cli/main.ts +9 -2
- package/src/cli/usage.ts +6 -1
- package/src/hooks/companion-instructions.ts +19 -11
- package/src/hooks/hook-io.ts +15 -0
- package/src/hooks/session-banner.ts +5 -3
- package/src/hooks/session-end.ts +10 -0
- package/src/hooks/session-guidance.ts +10 -6
- package/src/hooks/session-prepare.ts +47 -31
- package/src/hooks/session-register.ts +199 -0
- package/src/hooks/tokensave-route.ts +7 -3
- package/src/hooks/validate-artifact-path.ts +9 -2
- package/src/lib/delivery/archive-change.ts +0 -1
- package/src/lib/delivery/branches.ts +15 -0
- package/src/lib/delivery/record-delivery.ts +94 -39
- package/src/lib/delivery/record.ts +30 -28
- package/src/lib/delivery/refresh.ts +37 -17
- package/src/lib/delivery/resolve-branch.ts +258 -37
- package/src/lib/factory/outcomes/index.ts +11 -1
- package/src/lib/factory/runtime.ts +10 -1
- package/src/lib/opencode-server.ts +238 -0
- package/src/lib/orchestrator/adapters/claude.ts +147 -2
- package/src/lib/orchestrator/adapters/opencode.ts +53 -2
- package/src/lib/orchestrator/checkout-adoption.ts +125 -0
- package/src/lib/orchestrator/companion-registry-store.ts +6 -2
- package/src/lib/orchestrator/editor.ts +2 -2
- package/src/lib/orchestrator/framework-context.ts +26 -14
- package/src/lib/orchestrator/global-config-store.ts +11 -0
- package/src/lib/orchestrator/launcher.ts +15 -2
- package/src/lib/orchestrator/projection-claude-links.ts +52 -5
- package/src/lib/orchestrator/projection-claude-skills.ts +28 -2
- package/src/lib/orchestrator/projection-companion-link.ts +12 -1
- package/src/lib/orchestrator/registry-checkouts.ts +177 -0
- package/src/lib/orchestrator/repository-link.ts +216 -57
- package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
- package/src/lib/orchestrator/session-context-link.ts +11 -5
- package/src/lib/orchestrator/session-prepare.ts +36 -6
- package/src/lib/orchestrator/types.ts +5 -0
- package/src/lib/orchestrator/workspace-inventory.ts +5 -1
- package/src/lib/public-npm.ts +17 -0
- package/src/lib/session-attribution.ts +52 -0
- package/src/lib/session-state.ts +285 -0
- package/src/lib/session-stop.ts +64 -0
- package/src/lib/workset/record.ts +20 -0
- package/src/lib/workset/worktree.ts +85 -17
- package/src/opencode/background-server.ts +145 -0
- package/src/opencode/companion-hooks.ts +3 -1
- package/src/opencode/companion-policy.ts +2 -2
- package/src/opencode/projected-guidance.ts +2 -1
- package/src/opencode/session-register.ts +176 -0
- package/src/runtime/claude-delivery-plan.ts +14 -3
- package/src/runtime/current-branch.ts +10 -0
- package/src/runtime/env.ts +13 -7
- package/src/runtime/git-layout.ts +164 -17
- package/src/runtime/launch-env-guard.ts +65 -0
- package/src/runtime/opencode-server-record.ts +136 -0
- package/src/runtime/projection.ts +40 -6
- package/src/runtime/repo-local.ts +6 -1
- package/src/runtime/serving-claude-wrap.ts +28 -0
- package/src/runtime/session-context.ts +4 -3
- package/src/runtime/session-registry.ts +434 -0
- package/src/runtime/tokensave-route.ts +10 -5
- package/src/runtime/wrap-state.ts +31 -0
- package/src/studio.ts +2 -0
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +49 -21
- package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +0 -5
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +2 -8
- package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +1 -3
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +2 -4
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +49 -21
- package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +0 -5
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +2 -8
- package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +1 -3
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +2 -4
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +404 -30
- package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -3
- package/src/tools/setup/providers/claude-plugin-hooks.ts +26 -0
- package/src/tools/setup/providers/claude.ts +21 -1
- package/studio-dist/client/assets/app-CdPiFv59.css +2 -0
- package/studio-dist/client/assets/button-BIIHE0EQ.js +3 -0
- package/studio-dist/client/assets/companion-view-DM6YyXaR.js +1 -0
- package/studio-dist/client/assets/delivery-path-DELxj0Av.js +1 -0
- package/studio-dist/client/assets/factory-BZy0E8ty.js +4 -0
- package/studio-dist/client/assets/index-B3wkMzjA.js +40 -0
- package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +1 -0
- package/studio-dist/client/assets/panel-CbajlC3p.js +1 -0
- package/studio-dist/client/assets/{prepaint-CD5OpmTM.js → prepaint-CwSrpdFA.js} +7 -4
- package/studio-dist/client/assets/react-CN2GSx7x.js +1 -0
- package/studio-dist/client/assets/reports-DllhYQ5_.js +1 -0
- package/studio-dist/client/assets/routes-COm-G3mK.js +1 -0
- package/studio-dist/client/assets/skills-DmWAy-jZ.js +1 -0
- package/studio-dist/client/assets/specs-BG3Wi3ln.js +1 -0
- package/studio-dist/client/assets/steps-DFsH3Neu.js +1 -0
- package/studio-dist/client/assets/vault-B2q1nBY5.js +1 -0
- package/studio-dist/client/assets/warnings-BSXIyuSQ.js +1 -0
- package/studio-dist/client/assets/workflow-DlsQD6Hc.js +1 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-BQKuMdJW.js → __23tanstack-start-server-fn-resolver-M2GBs8s3.js} +179 -9
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +35 -25
- package/studio-dist/server/assets/button-CIJqAhni.js +11929 -0
- package/studio-dist/server/assets/{companion-view-aBady57v.js → companion-view-DISASvdJ.js} +13 -7
- package/studio-dist/server/assets/companions-BYbHWKOZ.js +15 -0
- package/studio-dist/server/assets/delivery-path-C29fBynY.js +654 -0
- package/studio-dist/server/assets/{factory-DT3UzHlh.js → factory-DGPmNGbo.js} +1 -0
- package/studio-dist/server/assets/{factory-D6xnjedJ.js → factory-DUTa0eDs.js} +317 -530
- package/studio-dist/server/assets/markdown-view-Bn7xPdks.js +86 -0
- package/studio-dist/server/assets/panel-3Jmn4awF.js +169 -0
- package/studio-dist/server/assets/{prepaint-BMke0fo1.js → prepaint-DJfTQ_VH.js} +6 -2
- package/studio-dist/server/assets/{react-COs0LHn-.js → react-Ce6dj15C.js} +4 -9
- package/studio-dist/server/assets/reports-C06RXVE2.js +18 -0
- package/studio-dist/server/assets/reports-D6YMqhnO.js +142 -0
- package/studio-dist/server/assets/router-C8MGqlAY.js +13713 -0
- package/studio-dist/server/assets/routes-BcFgvqf7.js +622 -0
- package/studio-dist/server/assets/{shell-CboT2f66.js → shell-DS3wUexh.js} +1 -0
- package/studio-dist/server/assets/skills-BEnOxiDl.js +266 -0
- package/studio-dist/server/assets/skills-CtrBAtX3.js +28 -0
- package/studio-dist/server/assets/specs-C8rv34-5.js +211 -0
- package/studio-dist/server/assets/{start-BW5ovN0k.js → start-h3ICWwd2.js} +4 -1
- package/studio-dist/server/assets/steps-Dq_CwY_s.js +181 -0
- package/studio-dist/server/assets/{vault-BGulVoNh.js → vault-BmWnryh3.js} +16 -1
- package/studio-dist/server/assets/vault-Fvxt2Tzl.js +1032 -0
- package/studio-dist/server/assets/{views-Bd7cRr27.js → views-BgYa-za2.js} +1 -3
- package/studio-dist/server/assets/warnings-DzR6fyZh.js +23 -0
- package/studio-dist/server/assets/workflow-liRYecHk.js +73 -0
- package/studio-dist/server/server.js +3 -157
- package/studio-dist/client/assets/companion-view-Csva26Ir.js +0 -1
- package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +0 -1
- package/studio-dist/client/assets/factory-B7l9ZQyx.js +0 -4
- package/studio-dist/client/assets/index-n6uo_92S.js +0 -40
- package/studio-dist/client/assets/queries-CN3JwMBX.js +0 -1
- package/studio-dist/client/assets/react-CabXf2Ds.js +0 -1
- package/studio-dist/client/assets/report-time-Dc-KOqQu.js +0 -1
- package/studio-dist/client/assets/reports-C01RsnMA.js +0 -1
- package/studio-dist/client/assets/routes-4pbC-2Hj.js +0 -1
- package/studio-dist/client/assets/skills-CihQganl.js +0 -1
- package/studio-dist/client/assets/spec-areas-C2L48N4C.js +0 -1
- package/studio-dist/client/assets/specs-D24_35_K.js +0 -1
- package/studio-dist/client/assets/studio-DKxfi691.css +0 -1
- package/studio-dist/client/assets/studio-queries-rvbJupCy.js +0 -3
- package/studio-dist/client/assets/vault-Bd4CQiTK.js +0 -1
- package/studio-dist/client/assets/warnings-V_Ys51wJ.js +0 -1
- package/studio-dist/client/assets/workflow-BJejeVwQ.js +0 -1
- package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +0 -778
- package/studio-dist/server/assets/queries-Ag2iL8q2.js +0 -107
- package/studio-dist/server/assets/report-time-DAfzln-N.js +0 -8
- package/studio-dist/server/assets/reports-BnUNJVtx.js +0 -126
- package/studio-dist/server/assets/router-BH--drIx.js +0 -4298
- package/studio-dist/server/assets/routes-khSDK1bV.js +0 -361
- package/studio-dist/server/assets/skills-MWYnWoKs.js +0 -106
- package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +0 -16
- package/studio-dist/server/assets/specs-DE3w8hZP.js +0 -155
- package/studio-dist/server/assets/studio-queries-CLnP9kGu.js +0 -3365
- package/studio-dist/server/assets/vault-CuyyhLyB.js +0 -832
- package/studio-dist/server/assets/warnings-BH05rOuG.js +0 -15
- package/studio-dist/server/assets/workflow-BSuIKWqH.js +0 -42
|
@@ -71,9 +71,7 @@ var getCompanionView = createServerFn({ method: "GET" }).validator((input) => {
|
|
|
71
71
|
};
|
|
72
72
|
return studioMode === "analysis" ? {
|
|
73
73
|
...base,
|
|
74
|
-
|
|
75
|
-
shipped: payload.shipped,
|
|
76
|
-
reports: page.reports ?? null
|
|
74
|
+
shipped: payload.shipped
|
|
77
75
|
} : {
|
|
78
76
|
...base,
|
|
79
77
|
changes: payload.changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Ar as cn, rt as PAGE_PAD } from "./button-CIJqAhni.js";
|
|
2
|
+
import { u as require_jsx_runtime } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
|
|
3
|
+
// src/views/warnings.tsx
|
|
4
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
5
|
+
/** Degraded collection is reported without costing the rest of the page. */
|
|
6
|
+
function Warnings({ warnings }) {
|
|
7
|
+
if (warnings.length === 0) return null;
|
|
8
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {
|
|
9
|
+
className: cn(PAGE_PAD, "pb-4"),
|
|
10
|
+
"aria-label": "Warnings",
|
|
11
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
12
|
+
className: "warnings grid gap-1.5 rounded-card border border-[color-mix(in_srgb,var(--warn)_35%,var(--border))] bg-warn-soft px-4 py-3 text-sm",
|
|
13
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
|
|
14
|
+
className: "m-0 text-sm font-semibold text-warn",
|
|
15
|
+
children: "Some data could not be read"
|
|
16
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
|
|
17
|
+
className: "m-0 grid list-none gap-1 p-0",
|
|
18
|
+
children: warnings.map((warning) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: warning }, warning))
|
|
19
|
+
})]
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export { Warnings as t };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { fi as useQuery, zr as companionViewQuery } from "./button-CIJqAhni.js";
|
|
2
|
+
import { E as changeStep, b as useBrowser, n as Route } from "./router-C8MGqlAY.js";
|
|
3
|
+
import { t as CompanionView } from "./companion-view-DISASvdJ.js";
|
|
4
|
+
import { t as Warnings } from "./warnings-DzR6fyZh.js";
|
|
5
|
+
import { t as DeliveryPathView } from "./delivery-path-C29fBynY.js";
|
|
6
|
+
import { u as require_jsx_runtime } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
|
|
7
|
+
// src/views/workflow/workflow-view.tsx
|
|
8
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
9
|
+
/** Graph node per change stage, in path order; matches the stage the Overview panel names. */
|
|
10
|
+
var STAGE_NODES = [
|
|
11
|
+
{
|
|
12
|
+
node: "propose",
|
|
13
|
+
label: "Propose change"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
node: "reviews",
|
|
17
|
+
label: "Human review"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
node: "apply",
|
|
21
|
+
label: "Apply change"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
node: "archive",
|
|
25
|
+
label: "Archive change"
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
function stagesOf(changes) {
|
|
29
|
+
const byStage = STAGE_NODES.map((stage) => ({
|
|
30
|
+
...stage,
|
|
31
|
+
changes: changes.flatMap((change) => changeStep(change).stage === stage.label ? [change.name] : [])
|
|
32
|
+
}));
|
|
33
|
+
const counts = {};
|
|
34
|
+
for (const stage of byStage) if (stage.changes.length > 0) counts[stage.node] = stage.changes.length;
|
|
35
|
+
return {
|
|
36
|
+
counts,
|
|
37
|
+
byStage
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
var NO_CHANGES = [];
|
|
41
|
+
function Workflow({ payload, changes = NO_CHANGES }) {
|
|
42
|
+
const { counts, byStage } = stagesOf(changes);
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Warnings, { warnings: payload.warnings }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
44
|
+
className: "workflow-view",
|
|
45
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeliveryPathView, {
|
|
46
|
+
payload,
|
|
47
|
+
counts,
|
|
48
|
+
changesByStage: byStage
|
|
49
|
+
})
|
|
50
|
+
})] });
|
|
51
|
+
}
|
|
52
|
+
// src/routes/workflow.tsx?tsr-split=component
|
|
53
|
+
var SplitComponent = function WorkflowRoute() {
|
|
54
|
+
const search = Route.useSearch();
|
|
55
|
+
const browser = useBrowser();
|
|
56
|
+
const overview = useQuery({
|
|
57
|
+
...companionViewQuery("dashboard", search),
|
|
58
|
+
enabled: browser
|
|
59
|
+
});
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompanionView, {
|
|
61
|
+
view: "workflow",
|
|
62
|
+
search,
|
|
63
|
+
children: (data) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Workflow, {
|
|
64
|
+
payload: {
|
|
65
|
+
skills: data.skills ?? [],
|
|
66
|
+
topology: data.topology ?? null,
|
|
67
|
+
warnings: data.warnings
|
|
68
|
+
},
|
|
69
|
+
changes: overview.data?.changes ?? []
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
export { SplitComponent as component };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./assets/rolldown-runtime-DYf_mQCB.js";
|
|
2
2
|
import { _ as splitSetCookieString, a as getStartOptions, c as MAX_FRAMED_STREAMS, d as TSS_FORMDATA_CONTEXT, f as TSS_SERVER_FUNCTION, g as parseSetCookie, h as mergeHeaders, i as safeObjectMerge, l as MAX_FRAME_PAYLOAD_SIZE, m as X_TSS_SERIALIZED, n as flattenMiddlewares, o as getStartContext, p as X_TSS_RAW_RESPONSE, r as createNullProtoObject, s as runWithStartContext, u as TSS_CONTENT_TYPE_FRAMED_VERSIONED, v as isRedirect } from "./assets/createServerFn-F5sAOF8V.js";
|
|
3
|
-
import { A as
|
|
3
|
+
import { A as isNotFound, C as invariant, S as storageKey, c as useRouter, f as useLayoutEffect, h as _getRenderedMatches, j as require_react, k as rootRouteId, l as routerContext, n as require_react_dom, p as waitForReason, s as matchContext, t as getServerFnById, u as require_jsx_runtime, v as createServerHistory, w as createSieveCache, x as defaultGetScrollRestorationKey } from "./assets/__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
|
|
4
4
|
import { f as isDangerousProtocol, i as decodePath, m as isPromise, s as escapeHtml, u as hasKeys } from "./assets/utils-C9CX1kcy.js";
|
|
5
5
|
import { PassThrough, Readable } from "node:stream";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -5366,160 +5366,6 @@ function makeMergeStream(serverSsr, reader, hydrationOutput, opts) {
|
|
|
5366
5366
|
disarmLifecycle = armStreamLifecycle(serverSsr, opts, () => terminal, terminate);
|
|
5367
5367
|
return stream;
|
|
5368
5368
|
}
|
|
5369
|
-
// ../../node_modules/.bun/react-dom@19.2.7+e14d3f224186685e/node_modules/react-dom/cjs/react-dom.production.js
|
|
5370
|
-
/**
|
|
5371
|
-
* @license React
|
|
5372
|
-
* react-dom.production.js
|
|
5373
|
-
*
|
|
5374
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5375
|
-
*
|
|
5376
|
-
* This source code is licensed under the MIT license found in the
|
|
5377
|
-
* LICENSE file in the root directory of this source tree.
|
|
5378
|
-
*/
|
|
5379
|
-
var require_react_dom_production = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5380
|
-
var React = require_react();
|
|
5381
|
-
function formatProdErrorMessage(code) {
|
|
5382
|
-
var url = "https://react.dev/errors/" + code;
|
|
5383
|
-
if (1 < arguments.length) {
|
|
5384
|
-
url += "?args[]=" + encodeURIComponent(arguments[1]);
|
|
5385
|
-
for (var i = 2; i < arguments.length; i++) url += "&args[]=" + encodeURIComponent(arguments[i]);
|
|
5386
|
-
}
|
|
5387
|
-
return "Minified React error #" + code + "; visit " + url + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
|
|
5388
|
-
}
|
|
5389
|
-
function noop() {}
|
|
5390
|
-
var Internals = {
|
|
5391
|
-
d: {
|
|
5392
|
-
f: noop,
|
|
5393
|
-
r: function() {
|
|
5394
|
-
throw Error(formatProdErrorMessage(522));
|
|
5395
|
-
},
|
|
5396
|
-
D: noop,
|
|
5397
|
-
C: noop,
|
|
5398
|
-
L: noop,
|
|
5399
|
-
m: noop,
|
|
5400
|
-
X: noop,
|
|
5401
|
-
S: noop,
|
|
5402
|
-
M: noop
|
|
5403
|
-
},
|
|
5404
|
-
p: 0,
|
|
5405
|
-
findDOMNode: null
|
|
5406
|
-
};
|
|
5407
|
-
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
5408
|
-
function createPortal$1(children, containerInfo, implementation) {
|
|
5409
|
-
var key = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
|
|
5410
|
-
return {
|
|
5411
|
-
$$typeof: REACT_PORTAL_TYPE,
|
|
5412
|
-
key: null == key ? null : "" + key,
|
|
5413
|
-
children,
|
|
5414
|
-
containerInfo,
|
|
5415
|
-
implementation
|
|
5416
|
-
};
|
|
5417
|
-
}
|
|
5418
|
-
var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
5419
|
-
function getCrossOriginStringAs(as, input) {
|
|
5420
|
-
if ("font" === as) return "";
|
|
5421
|
-
if ("string" === typeof input) return "use-credentials" === input ? input : "";
|
|
5422
|
-
}
|
|
5423
|
-
exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = Internals;
|
|
5424
|
-
exports.createPortal = function(children, container) {
|
|
5425
|
-
var key = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
|
|
5426
|
-
if (!container || 1 !== container.nodeType && 9 !== container.nodeType && 11 !== container.nodeType) throw Error(formatProdErrorMessage(299));
|
|
5427
|
-
return createPortal$1(children, container, null, key);
|
|
5428
|
-
};
|
|
5429
|
-
exports.flushSync = function(fn) {
|
|
5430
|
-
var previousTransition = ReactSharedInternals.T, previousUpdatePriority = Internals.p;
|
|
5431
|
-
try {
|
|
5432
|
-
if (ReactSharedInternals.T = null, Internals.p = 2, fn) return fn();
|
|
5433
|
-
} finally {
|
|
5434
|
-
ReactSharedInternals.T = previousTransition, Internals.p = previousUpdatePriority, Internals.d.f();
|
|
5435
|
-
}
|
|
5436
|
-
};
|
|
5437
|
-
exports.preconnect = function(href, options) {
|
|
5438
|
-
"string" === typeof href && (options ? (options = options.crossOrigin, options = "string" === typeof options ? "use-credentials" === options ? options : "" : void 0) : options = null, Internals.d.C(href, options));
|
|
5439
|
-
};
|
|
5440
|
-
exports.prefetchDNS = function(href) {
|
|
5441
|
-
"string" === typeof href && Internals.d.D(href);
|
|
5442
|
-
};
|
|
5443
|
-
exports.preinit = function(href, options) {
|
|
5444
|
-
if ("string" === typeof href && options && "string" === typeof options.as) {
|
|
5445
|
-
var as = options.as, crossOrigin = getCrossOriginStringAs(as, options.crossOrigin), integrity = "string" === typeof options.integrity ? options.integrity : void 0, fetchPriority = "string" === typeof options.fetchPriority ? options.fetchPriority : void 0;
|
|
5446
|
-
"style" === as ? Internals.d.S(href, "string" === typeof options.precedence ? options.precedence : void 0, {
|
|
5447
|
-
crossOrigin,
|
|
5448
|
-
integrity,
|
|
5449
|
-
fetchPriority
|
|
5450
|
-
}) : "script" === as && Internals.d.X(href, {
|
|
5451
|
-
crossOrigin,
|
|
5452
|
-
integrity,
|
|
5453
|
-
fetchPriority,
|
|
5454
|
-
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
|
5455
|
-
});
|
|
5456
|
-
}
|
|
5457
|
-
};
|
|
5458
|
-
exports.preinitModule = function(href, options) {
|
|
5459
|
-
if ("string" === typeof href) if ("object" === typeof options && null !== options) {
|
|
5460
|
-
if (null == options.as || "script" === options.as) {
|
|
5461
|
-
var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
|
|
5462
|
-
Internals.d.M(href, {
|
|
5463
|
-
crossOrigin,
|
|
5464
|
-
integrity: "string" === typeof options.integrity ? options.integrity : void 0,
|
|
5465
|
-
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
|
5466
|
-
});
|
|
5467
|
-
}
|
|
5468
|
-
} else options ?? Internals.d.M(href);
|
|
5469
|
-
};
|
|
5470
|
-
exports.preload = function(href, options) {
|
|
5471
|
-
if ("string" === typeof href && "object" === typeof options && null !== options && "string" === typeof options.as) {
|
|
5472
|
-
var as = options.as, crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
|
|
5473
|
-
Internals.d.L(href, as, {
|
|
5474
|
-
crossOrigin,
|
|
5475
|
-
integrity: "string" === typeof options.integrity ? options.integrity : void 0,
|
|
5476
|
-
nonce: "string" === typeof options.nonce ? options.nonce : void 0,
|
|
5477
|
-
type: "string" === typeof options.type ? options.type : void 0,
|
|
5478
|
-
fetchPriority: "string" === typeof options.fetchPriority ? options.fetchPriority : void 0,
|
|
5479
|
-
referrerPolicy: "string" === typeof options.referrerPolicy ? options.referrerPolicy : void 0,
|
|
5480
|
-
imageSrcSet: "string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
|
|
5481
|
-
imageSizes: "string" === typeof options.imageSizes ? options.imageSizes : void 0,
|
|
5482
|
-
media: "string" === typeof options.media ? options.media : void 0
|
|
5483
|
-
});
|
|
5484
|
-
}
|
|
5485
|
-
};
|
|
5486
|
-
exports.preloadModule = function(href, options) {
|
|
5487
|
-
if ("string" === typeof href) if (options) {
|
|
5488
|
-
var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
|
|
5489
|
-
Internals.d.m(href, {
|
|
5490
|
-
as: "string" === typeof options.as && "script" !== options.as ? options.as : void 0,
|
|
5491
|
-
crossOrigin,
|
|
5492
|
-
integrity: "string" === typeof options.integrity ? options.integrity : void 0
|
|
5493
|
-
});
|
|
5494
|
-
} else Internals.d.m(href);
|
|
5495
|
-
};
|
|
5496
|
-
exports.requestFormReset = function(form) {
|
|
5497
|
-
Internals.d.r(form);
|
|
5498
|
-
};
|
|
5499
|
-
exports.unstable_batchedUpdates = function(fn, a) {
|
|
5500
|
-
return fn(a);
|
|
5501
|
-
};
|
|
5502
|
-
exports.useFormState = function(action, initialState, permalink) {
|
|
5503
|
-
return ReactSharedInternals.H.useFormState(action, initialState, permalink);
|
|
5504
|
-
};
|
|
5505
|
-
exports.useFormStatus = function() {
|
|
5506
|
-
return ReactSharedInternals.H.useHostTransitionStatus();
|
|
5507
|
-
};
|
|
5508
|
-
exports.version = "19.2.7";
|
|
5509
|
-
}));
|
|
5510
|
-
// ../../node_modules/.bun/react-dom@19.2.7+e14d3f224186685e/node_modules/react-dom/index.js
|
|
5511
|
-
var require_react_dom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5512
|
-
function checkDCE() {
|
|
5513
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== "function") return;
|
|
5514
|
-
try {
|
|
5515
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
|
|
5516
|
-
} catch (err) {
|
|
5517
|
-
console.error(err);
|
|
5518
|
-
}
|
|
5519
|
-
}
|
|
5520
|
-
checkDCE();
|
|
5521
|
-
module.exports = require_react_dom_production();
|
|
5522
|
-
}));
|
|
5523
5369
|
// ../../node_modules/.bun/react-dom@19.2.7+e14d3f224186685e/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js
|
|
5524
5370
|
/**
|
|
5525
5371
|
* @license React
|
|
@@ -15655,8 +15501,8 @@ var getBaseManifest = getProdBaseManifest;
|
|
|
15655
15501
|
var createEarlyHintsForRequest = createEarlyHintsCollector;
|
|
15656
15502
|
async function loadEntries() {
|
|
15657
15503
|
const [routerEntry, startEntry, pluginAdapters] = await Promise.all([
|
|
15658
|
-
import("./assets/router-
|
|
15659
|
-
import("./assets/start-
|
|
15504
|
+
import("./assets/router-C8MGqlAY.js").then((n) => n.t),
|
|
15505
|
+
import("./assets/start-h3ICWwd2.js"),
|
|
15660
15506
|
import("./assets/empty-plugin-adapters-Cipd4ZH4.js")
|
|
15661
15507
|
]);
|
|
15662
15508
|
return {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./queries-CN3JwMBX.js";import{Et as t,o as n}from"./studio-queries-rvbJupCy.js";var r=t();function i({companionPath:e,reason:t}){return(0,r.jsxs)(`section`,{className:`panel error`,children:[(0,r.jsx)(`h3`,{children:`Could not read this companion`}),(0,r.jsx)(`p`,{className:`mono`,children:e}),(0,r.jsx)(`p`,{children:t})]})}function a({view:t,search:a,children:o}){let{data:s}=e(n(t,a));return s.error?(0,r.jsx)(i,{companionPath:s.error.companionPath,reason:s.error.reason}):(0,r.jsx)(r.Fragment,{children:o(s)})}export{a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{D as t,E as n,Et as r,I as i,T as a,qt as o,z as s}from"./studio-queries-rvbJupCy.js";var c=[`mate-clarify-intent`,`mate-interview-me`,`mate-grill-me`],l={"mate-clarify-intent":`Default. Reads what the request already states and routes to an interview, grilling, or skip, then runs that one mode.`,"mate-interview-me":`Explicit mode: guided, one-question-at-a-time clarification when intent, constraints, or scope still need confirmation.`,"mate-grill-me":`Explicit mode: round-based stress test of a mostly known direction to surface hidden assumptions and risks.`},u={"clarify-intent":{what:`Settles who the change is for, why it is needed, how success is measured, and what binds it, before any artifact exists.`,why:`Intent gaps are cheapest to close before exploration turns them into documents.`},explore:{what:`Resolves repository evidence, unknowns, and options, with scope taken from the companion context map, and suggests slicing a large feature.`,why:`It separates uncertainty from the proposal's committed scope.`},propose:{what:`Chooses the schema from the minimal eligibility test, checks slicing when explore agreed none, and writes the change's planning artifacts in one prompt.`,why:`One prompt writes every artifact; each one is then reviewed on its own.`},apply:{what:`Records the delivery branch, avoiding protected branches, then implements the reviewed tasks.`,why:`The recorded branch is what archive and publication later wait on.`},"inspect-outcome":{what:`Shows what the applied change did as a rendered diagram and diff in a Mate report.`,why:`Seeing the result tells the reviewer whether cleanup is warranted.`},"refine-code":{what:`Looks for smaller, clearer code once tests pass, preserving behavior.`,why:`Cleanup lands before archive, so shipped code and recorded specs agree.`},archive:{what:`Applies the delta specs to the local canonical specs and records the delivery; allowed before the branch merges.`,why:`A feature's later changes build on canonical specs that already include this one.`},publish:{what:`Commits, tags, and pushes archived changes whose delivery branches are merged, chosen by the developer.`,why:`Published canonical specs then describe the default branch; unmerged archives wait.`}};function d(e,t,n){return{what:(t?.schemaName===n?t.artifacts.find(t=>t.id===e)?.description:void 0)??`A person reviews the ${e} artifact.`,why:`Reviews stay with people: Mate never marks them approved.`}}function f(e,t){if(e.kind===`human`)return null;if(e.id===`clarify-intent`)return`/${e.skill} about ${s}`;let n=e.id===`propose`&&t!==`mate-v1`?` (use schema: ${t})`:``;return`/${e.skill}${n} for ${i}`}function p(e){return e&&e.replace(` ${i}`,``).replace(` ${s}`,``)}function m(e){return c.filter(e).map(e=>({name:e,description:l[e],prompt:`/${e} about ${s}`,copyPrompt:`/${e} about`}))}var h=new Set([`explore`,`propose`,`apply`,`archive`]);function g(e){if(e.kind===`human`)return[`human-review`];let t=e.optional?[`optional`,`skill`]:[`skill`];return h.has(e.id)&&t.push(`openspec`),t}var _={"mate-v1":{tagline:`full planning`,description:`Full planning path: proposal, specs, design, and tasks.`},"mate-minimal":{tagline:`minimal planning`,description:`Short path: specs and tasks only, for one-Area, low-risk changes with clear intent.`}};function v(e){return t(e)?_[e]:{tagline:`custom schema`,description:`Planning path of the ${e} schema.`}}var y={plan:`Plan`,review:`Review`,build:`Build`,ship:`Ship`};function b(e,t){return e.kind===`human`?`review`:e.id===`apply`||t===`build`&&e.optional?`build`:t===void 0||t===`plan`?`plan`:`ship`}function x(e){return e.kind===`human`?`human`:e.optional?`optional`:null}function S(e){let t=[];for(let n of e){let e=x(n),r=t.at(-1);e&&r?.group===e?r.steps.push(n):t.push({group:e,steps:[n]})}return t.map(e=>e.group===`human`||e.group===`optional`&&e.steps.length>1?{kind:`group`,group:e.group,steps:e.steps}:{kind:`stage`,step:e.steps[0]})}function C(e,t,r){let i=r.skills?new Set(r.skills):null,a=e=>!i||i.has(e),o=n(t),s=[];for(let t of o.stages){let n=t.kind===`human`?d(t.artifact,r.topology,e):u[t.id],i=f(t,e),o=s.at(-1),c={...t,what:n.what,why:n.why,badges:g(t),prompt:i,copyPrompt:p(i),phase:b(t,o?.phase)};t.id===`clarify-intent`&&(c.alternatives=m(a)),t.kind===`skill`&&!a(t.skill)&&(c.missingSkill=t.skill),t.id===`apply`&&(c.sessionBreakBefore=!0),s.push(c)}return{schema:e,label:e,...v(e),steps:s,map:S(s),reviewsKnown:o.reviewsKnown}}function w(e,n){return n?.schemaName===e?n.artifacts.map(e=>e.id):t(e)?a[e]:void 0}function T(e={}){let n=e.topology?.schemaName;return{paths:(n&&!t(n)?[n]:Object.keys(a)).map(t=>C(t,w(t,e.topology),e))}}var E=e=>({id:e.id,kind:`stage`,step:e});function ee(e){let t=e.map.map(e=>e.kind===`stage`?{nodes:[E(e.step)],optional:e.step.optional,phase:e.step.phase}:e.group===`human`?{nodes:[{id:`reviews`,kind:`review-group`,steps:e.steps}],optional:!1,phase:e.steps[0].phase}:{nodes:e.steps.map(E),optional:!0,phase:e.steps[0].phase});return t.unshift({nodes:[{id:`start`,kind:`start`}],optional:!1,phase:t[0]?.phase??`plan`}),t}function te(e){return e.kind===`stage`?!!e.step.sessionBreakBefore:e.kind===`review-group`&&!!e.steps[0].sessionBreakBefore}function D(e){let t=[],n=(e,n,r)=>{for(let i of e)for(let e of n)t.push({from:i.id,to:e.id,kind:r,newSession:te(e)})};return e.forEach((t,r)=>{let i=e[r+1];i&&n(t.nodes,i.nodes,`flow`);let a=e[r-1];t.optional&&a&&i&&n(a.nodes,i.nodes,`bypass`)}),t}function O(e){let t=[];return e.forEach((e,n)=>{let r=t.at(-1);r?.phase===e.phase?r.to=n+1:t.push({phase:e.phase,label:y[e.phase],from:n,to:n+1})}),t}function k(e){let t=e.findIndex(e=>e.nodes.some(e=>e.id===`archive`));return t===-1?null:{from:0,to:t+1}}function A(e){let t=ee(e),n=Math.max(1,...t.map(e=>e.nodes.length)),r=t.flatMap((e,t)=>e.nodes.map((r,i)=>e.nodes.length===1?{...r,column:t,row:0,rowSpan:n}:{...r,column:t,row:i,rowSpan:1}));return{columns:t.length,rows:n,nodes:r,edges:D(t),bands:O(t),cycle:k(t)}}var j=e=>e.rows*2+1;function M(e){return{along:e.column+.5,across:e.row*2+e.rowSpan}}var N=e=>Math.round(e*1e4)/1e4,P=(e,t)=>`${N(e/t*100)}%`,F=({along:e,across:t})=>`${N(t)} ${N(e)}`;function I(e,t){let n=t=>{let n=e.nodes.find(e=>e.id===t);if(!n)throw Error(`Unknown graph node: ${t}`);return M(n)};return[n(t.from),n(t.to)]}function L(e,t){let[n,r]=I(e,t);if(t.kind===`bypass`){let t=j(e);return`M ${F(n)} C ${F({along:n.along,across:t})}, ${F({along:r.along,across:t})}, ${F(r)}`}let i=(n.along+r.along)/2;return`M ${F(n)} C ${F({along:i,across:n.across})}, ${F({along:i,across:r.across})}, ${F(r)}`}function R(e,t){let[n,r]=I(e,t),i=(n.along+r.along)/2;return t.kind===`bypass`?{along:i,across:(n.across+r.across)/8+j(e)*3/4}:{along:i,across:(n.across+r.across)/2}}function z(e,t){return{x:P(t.across,j(e)),y:P(t.along,e.columns)}}function B(e,t){return{top:P(t.from,e.columns),height:P(t.to-t.from,e.columns)}}var V=e(o(),1),H=r();function ne({payload:e}){let t=T({skills:e.skills&&e.skills.length>0?e.skills:void 0,topology:e.topology}),[n,r]=(0,V.useState)(t.paths[0]?.schema);return(0,H.jsx)(`section`,{className:`workflow-delivery-path`,"aria-label":`Delivery Path`,children:t.paths.length>1?(0,H.jsxs)(`div`,{className:`workflow-schema`,"data-workflow-schema-root":!0,children:[(0,H.jsxs)(`label`,{className:`view-choice`,children:[(0,H.jsx)(`span`,{children:`OpenSpec schema`}),(0,H.jsx)(`select`,{"data-workflow-schema-select":!0,value:n,onChange:e=>r(e.target.value),children:t.paths.map(e=>(0,H.jsxs)(`option`,{value:e.schema,children:[e.label,` – `,e.tagline]},e.schema))})]}),(0,H.jsx)(`div`,{className:`workflow-schema-panels`,children:t.paths.map(e=>(0,H.jsx)(`section`,{"data-workflow-schema-panel":e.schema,"data-active":e.schema===n?`true`:`false`,children:(0,H.jsx)(U,{path:e})},e.schema))})]}):(0,H.jsxs)(`div`,{className:`workflow-schema`,children:[(0,H.jsxs)(`p`,{className:`view-choice`,children:[(0,H.jsx)(`span`,{children:`OpenSpec schema`}),(0,H.jsxs)(`code`,{children:[t.paths[0].label,` – `,t.paths[0].tagline]})]}),(0,H.jsx)(U,{path:t.paths[0]})]})})}function U({path:e}){return(0,H.jsxs)(`div`,{className:`workflow-path`,children:[(0,H.jsxs)(`div`,{className:`workflow-path-graph`,children:[(0,H.jsx)(J,{path:e}),(0,H.jsx)(Y,{})]}),(0,H.jsxs)(`aside`,{className:`workflow-detail`,"aria-label":`${e.label} stage details`,children:[(0,H.jsxs)(`div`,{className:`workflow-detail-overview`,id:G(e),children:[(0,H.jsx)(`p`,{className:`workflow-description`,children:e.description}),e.reviewsKnown?null:(0,H.jsx)(`p`,{className:`workflow-description`,children:`The schema's artifacts could not be read, so its review stages are unknown.`}),(0,H.jsx)(`p`,{className:`workflow-description`,children:`A workset is one or more changes published together: after Archive change, start again at the top for the next change, and publish once they are archived.`}),(0,H.jsx)(`p`,{className:`workflow-detail-hint`,children:`Select a node in the graph to see what that stage does and the prompt that runs it.`})]}),e.steps.map(t=>(0,H.jsx)(re,{path:e,step:t},t.id))]})]})}var W=(e,t)=>`workflow-${e.schema}-${t.id}`,G=e=>`workflow-${e.schema}-overview`;function K(e,t){if(!t)return()=>void 0;let n=q(e,t.current);return e=>e.column<n?`done`:e.id===t.current?`current`:`next`}function q(e,t){let n=e.nodes.find(e=>e.id===t);return n?n.column:t===`complete`?e.columns:-1}function J({path:e,progress:t,label:n=`Delivery Path map`}){let r=A(e),i=K(r,t);return(0,H.jsxs)(`nav`,{className:`workflow-graph`,"aria-label":n,"data-progress-activity":t?.activity,style:{"--graph-columns":String(r.columns),"--graph-rows":String(r.rows)},children:[(0,H.jsxs)(`div`,{className:`workflow-graph-bands`,"aria-hidden":`true`,children:[r.bands.map(e=>(0,H.jsx)(`div`,{className:`workflow-graph-band`,"data-band":e.phase,style:B(r,e),children:e.label},e.phase)),r.cycle?(0,H.jsx)(`div`,{className:`workflow-graph-cycle`,style:B(r,r.cycle),children:(0,H.jsx)(`span`,{children:`repeats for each change`})}):null,(0,H.jsx)(`div`,{className:`workflow-graph-workset`,children:(0,H.jsx)(`span`,{children:`workset`})})]}),(0,H.jsx)(Z,{graph:r,stateOf:i}),(0,H.jsx)(`ol`,{className:`workflow-graph-nodes`,children:r.nodes.map(n=>n.kind===`start`?null:(0,H.jsx)(`li`,{className:`workflow-graph-node`,"data-node-kind":n.kind,"data-progress":i(n),"aria-current":i(n)===`current`?`step`:void 0,style:{"--graph-row":String(n.column+1),"--graph-lane":String(n.row+1),"--graph-span":String(n.rowSpan)},children:n.kind===`stage`?(0,H.jsx)(Q,{path:e,step:n.step,box:!0,plain:!!t,children:(0,H.jsx)(X,{progress:t,state:i(n)})}):(0,H.jsxs)(`div`,{className:`workflow-graph-box workflow-graph-group`,"data-map-group":`human`,children:[(0,H.jsx)(`span`,{className:`workflow-graph-group-label`,children:`Human review`}),(0,H.jsx)(`ol`,{children:n.steps.map(n=>(0,H.jsx)(`li`,{children:(0,H.jsx)(Q,{path:e,step:n,plain:!!t})},n.id))}),(0,H.jsx)(X,{progress:t,state:i(n)})]})},n.id))})]})}function Y(){return(0,H.jsxs)(`ul`,{className:`workflow-graph-legend`,"aria-hidden":`true`,children:[(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`i`,{className:`workflow-legend-optional`}),`optional`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`i`,{className:`workflow-graph-openspec`}),`OpenSpec`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`i`,{className:`workflow-legend-session`}),`new session`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`i`,{className:`workflow-legend-skip`}),`can be skipped`]})]})}function X({progress:e,state:t}){return t===`done`?(0,H.jsx)(`span`,{className:`visually-hidden`,children:`, done`}):t!==`current`||!e?.note?null:(0,H.jsx)(`span`,{className:`workflow-graph-note`,children:e.note})}function Z({graph:e,stateOf:t}){let n=n=>{let r=e.nodes.find(e=>e.id===n.to),i=r?t(r):void 0;return n.kind===`flow`&&(i===`done`||i===`current`)};return(0,H.jsxs)(`svg`,{className:`workflow-graph-layer`,"aria-hidden":`true`,focusable:`false`,children:[(0,H.jsx)(`svg`,{viewBox:`0 0 ${j(e)} ${e.columns}`,preserveAspectRatio:`none`,overflow:`visible`,children:e.edges.map(t=>(0,H.jsx)(`path`,{className:`workflow-graph-edge`,d:L(e,t),"data-edge-kind":t.kind,"data-edge-from":t.from,"data-edge-to":t.to,"data-new-session":t.newSession?`true`:void 0,"data-travelled":n(t)?`true`:void 0},`${t.kind}-${t.from}-${t.to}`))}),e.nodes.map(t=>{if(t.kind!==`start`)return null;let{x:n,y:r}=z(e,M(t));return(0,H.jsx)(`circle`,{className:`workflow-graph-start`,cx:n,cy:r,r:`3.5`},t.id)}),e.edges.map(t=>{if(!t.newSession)return null;let{x:n,y:r}=z(e,R(e,t));return(0,H.jsx)(`circle`,{className:`workflow-graph-session`,"data-session-mark":t.to,cx:n,cy:r,r:`3.5`},`${t.from}-${t.to}`)})]})}function Q({path:e,step:t,box:n,plain:r,children:i}){return(0,H.jsxs)(r?`span`:`a`,{className:n?`workflow-graph-link workflow-graph-box`:`workflow-graph-link`,href:r?void 0:`#${W(e,t)}`,"data-map-stage":t.id,"data-stage-kind":t.kind,"data-optional":t.optional?`true`:void 0,"aria-label":t.kind===`human`?t.label:void 0,children:[t.badges.includes(`openspec`)?(0,H.jsx)(`span`,{className:`workflow-graph-openspec`,"aria-hidden":`true`}):null,t.kind===`human`?t.artifact:t.label,i]})}function re({path:e,step:t}){return(0,H.jsxs)(`article`,{className:`workflow-card`,id:W(e,t),"data-stage":t.id,"data-stage-kind":t.kind,"data-optional":t.optional?`true`:void 0,children:[(0,H.jsxs)(`header`,{className:`workflow-card-header`,children:[(0,H.jsxs)(`div`,{className:`workflow-card-heading`,children:[(0,H.jsx)(`h3`,{children:t.label}),(0,H.jsx)(se,{badges:oe(t)})]}),(0,H.jsxs)(`p`,{className:`workflow-card-meta`,children:[(0,H.jsx)(`span`,{children:y[t.phase]}),t.skill?(0,H.jsx)(`code`,{children:t.skill}):null,t.sessionBreakBefore?(0,H.jsx)(`span`,{className:`workflow-card-session`,children:`New session / clean chat`}):null]})]}),(0,H.jsx)(ie,{step:t}),t.missingSkill?(0,H.jsxs)(`p`,{className:`workflow-missing-skill`,role:`note`,children:[`Skill not reported for this companion: `,(0,H.jsx)(`code`,{children:t.missingSkill}),`. Run`,` `,(0,H.jsx)(`code`,{children:`mate companion update`}),`; this stage is not complete.`]}):null,(0,H.jsxs)(`dl`,{className:`workflow-card-explanation`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`What`}),(0,H.jsx)(`dd`,{children:t.what})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`dt`,{children:`Why`}),(0,H.jsx)(`dd`,{children:t.why})]})]}),(0,H.jsx)(`footer`,{className:`workflow-card-footer`,children:(0,H.jsx)(`a`,{href:`#${G(e)}`,children:`Path overview`})})]})}function ie({step:e}){return e.kind===`human`?(0,H.jsxs)(`p`,{className:`workflow-card-human`,children:[`Review `,e.artifact,` yourself — no skill, no prompt`]}):e.alternatives?.length?(0,H.jsx)(ae,{step:e}):e.prompt?(0,H.jsxs)(`div`,{className:`workflow-command`,children:[(0,H.jsx)(`span`,{className:`workflow-command-label`,children:`Run`}),(0,H.jsx)(`code`,{children:e.prompt}),(0,H.jsx)($,{text:e.copyPrompt??e.prompt,label:`${e.label} prompt`})]}):null}function ae({step:e}){return e.alternatives?.length?(0,H.jsx)(`div`,{className:`workflow-option-list`,children:e.alternatives.map(e=>(0,H.jsxs)(`div`,{className:`workflow-option`,children:[(0,H.jsxs)(`div`,{className:`workflow-command`,children:[(0,H.jsx)(`span`,{className:`workflow-command-label`,children:`Option`}),(0,H.jsx)(`code`,{children:e.prompt}),(0,H.jsx)($,{text:e.copyPrompt,label:`${e.name} prompt`})]}),(0,H.jsx)(`small`,{children:e.description})]},e.name))}):null}function $({text:e,label:t}){return(0,H.jsx)(`button`,{type:`button`,className:`runway-step-copy`,"data-copy":e,"data-copy-label":t,children:`Copy`})}var oe=e=>e.badges.filter(e=>e!==`skill`);function se({badges:e}){return(0,H.jsx)(`span`,{className:`workflow-badges`,children:e.map(e=>(0,H.jsx)(`em`,{className:`runway-step-badge runway-step-badge-${e}`,children:e===`human-review`?`Human review`:e},e))})}export{J as n,T as r,ne as t};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{i as t}from"./queries-CN3JwMBX.js";import{C as n,Et as r,F as i,N as a,O as o,P as s,_ as c,b as l,bt as u,g as d,ht as f,n as p,qt as m,s as h,v as g,y as _}from"./studio-queries-rvbJupCy.js";import{t as v}from"./warnings-V_Ys51wJ.js";import{n as y,r as ee}from"./delivery-path-DJMpRmiY.js";import{c as te,d as b,g as x,l as S,o as ne,u as re}from"./index-n6uo_92S.js";import{n as ie,t as ae}from"./react-CabXf2Ds.js";function C(e){if(Array.isArray(e.questions)&&e.questions.length>0)return e.questions;let t=e;return typeof t.question==`string`?[t]:[]}function oe(e,t){return t===`failed`||t===`interrupted`?null:`Workset ${e} has no failed or interrupted run to retry`}var se=[`start`,`later`,`answer`,`take-control`,`return`,`retry`,`cancel`,`feedback`,`regenerate`,`start-apply`,`publish`],ce=`the AFK runner needs the appliance's factory mode for this companion`;function le(e,t,n,r){let{id:i,stage:a,stageLabel:o}=t,s=n?.state??`idle`;switch(e){case`start`:case`later`:return a===`done`?`Workset ${i} is done`:null}if(!r.runner)return ce;switch(e){case`answer`:return s===`waiting`?null:`this question was already answered`;case`take-control`:return n?.conversation?n.control?`a person already has, or asked for, this Outcome's conversation`:a===`done`?`Workset ${i} is done`:null:`this Outcome has no factory conversation to take over`;case`return`:return n?.control&&n.control.mode!==`automatic`?null:`the factory already drives this Outcome`;case`retry`:return oe(i,s);case`cancel`:return s===`queued`||s===`running`?null:`Workset ${i} has no run to cancel`;case`feedback`:return a===`human-review`||a===`apply`||a===`merge-wait`?null:`Workset ${i} takes no feedback at ${o}; start a new outcome instead`;case`regenerate`:case`start-apply`:return a===`human-review`?null:`Workset ${i} is not in the Human Reviews; it is at ${o}`;case`publish`:return a===`publish`?null:`Workset ${i} is not merged and archived; it is at ${o}`}}function w(e,t,n){return new Set(se.filter(r=>le(r,e,t,n)===null))}function ue(e){if(!e.queuedAt)return null;let t=Date.parse(e.queuedAt);return Number.isNaN(t)?null:t}function de(e,t){return e.rank===null||t.rank===null?e.rank===t.rank?0:e.rank===null?1:-1:e.rank-t.rank||(e.id<t.id?-1:+(e.id>t.id))}var T=e(m(),1),fe=(0,T.createContext)(``);function pe(e,t){let n=(0,T.useRef)(e);(0,T.useEffect)(()=>{n.current=e});let r=(0,T.useRef)(null),i=(0,T.useRef)(t);return(0,T.useEffect)(()=>{let e=r.current;if(!e)return;e.open||i.current(e);let t=t=>{t.target===e&&e.close()},a=()=>n.current();return e.addEventListener(`click`,t),e.addEventListener(`close`,a),()=>{e.removeEventListener(`click`,t),e.removeEventListener(`close`,a)}},[]),r}var E=r(),D=[{kind:`subscription`,tab:`Claude subscription`,label:`Subscription token`,hint:(0,E.jsxs)(`ol`,{className:`note agents-steps`,children:[(0,E.jsxs)(`li`,{children:[`In a terminal on your own machine, run `,(0,E.jsx)(`code`,{children:`claude setup-token`}),`.`]}),(0,E.jsx)(`li`,{children:`Sign in with your Claude account in the browser it opens.`}),(0,E.jsxs)(`li`,{children:[`Paste the token it prints below. It starts with `,(0,E.jsx)(`code`,{children:`sk-ant-oat`}),` and is valid for a year.`]})]})},{kind:`api-key`,tab:`API key`,label:`Anthropic API key`,hint:(0,E.jsx)(`p`,{className:`note`,children:`Agents bill this key. It starts with sk-ant-api.`})}],me={subscription:`Claude subscription token`,"api-key":`Anthropic API key`};function he(e){if(!e)return`Checking…`;if(!e.kind)return`No credential set. Worksets cannot start agents until one is.`;let t=e.source===`studio`?`set in Studio${e.setAt?` on ${new Date(e.setAt).toLocaleString()}`:``}`:`supplied at startup`;return`${me[e.kind]}, ${t}.`}function ge(e,t){e.preventDefault();let n=e.currentTarget,r=new FormData(n).get(t);return n.reset(),typeof r==`string`?r:``}function _e({kind:e,label:t,hint:n,onSaved:r}){let i=x({mutationFn:t=>l(e,t),onSuccess:r});return(0,E.jsxs)(`form`,{className:`factory-sheet`,"data-agents-form":e,onSubmit:e=>i.mutate(ge(e,`value`)),children:[n,(0,E.jsxs)(`label`,{className:`agents-field`,children:[(0,E.jsx)(`span`,{children:t}),(0,E.jsx)(`input`,{type:`password`,name:`value`,autoComplete:`off`,spellCheck:!1,required:!0})]}),(0,E.jsx)(`div`,{className:`factory-sheet-actions`,children:(0,E.jsx)(`button`,{type:`submit`,disabled:i.isPending,children:`Save`})}),i.error?(0,E.jsx)(`p`,{className:`factory-problems`,role:`alert`,children:i.error.message}):null]})}function ve({onClose:e}){let t=f(),n=ie(g()),[r,i]=(0,T.useState)(`subscription`),[a,o]=(0,T.useState)(!1),s=D.find(e=>e.kind===r),l=e=>{t.setQueryData(c,e),o(!0)},u=x({mutationFn:_,onSuccess:e=>{t.setQueryData(c,e),o(!1)}}),d=pe(e,e=>e.showModal?.());return(0,E.jsxs)(`dialog`,{ref:d,className:`outcome-dialog agents-dialog`,"aria-labelledby":`agents-title`,children:[(0,E.jsxs)(`header`,{className:`outcome-dialog-head`,children:[(0,E.jsxs)(`div`,{className:`outcome-dialog-heading`,children:[(0,E.jsx)(`h2`,{id:`agents-title`,children:`Workset agents`}),(0,E.jsx)(`p`,{className:`outcome-dialog-state`,"data-agents-status":``,children:n.error?n.error.message:he(n.data)})]}),(0,E.jsx)(`form`,{method:`dialog`,children:(0,E.jsxs)(`button`,{type:`submit`,className:`outcome-dialog-close`,"aria-keyshortcuts":`Escape`,children:[`Close `,(0,E.jsx)(`kbd`,{children:`Esc`})]})})]}),(0,E.jsxs)(`div`,{className:`agents-dialog-body`,children:[(0,E.jsx)(`div`,{role:`tablist`,"aria-label":`How to sign in`,className:`agents-tabs`,children:D.map(e=>(0,E.jsx)(`button`,{type:`button`,role:`tab`,id:`agents-tab-${e.kind}`,"aria-controls":`agents-panel`,"aria-selected":r===e.kind,onClick:()=>{i(e.kind),o(!1)},children:e.tab},e.kind))}),(0,E.jsx)(`div`,{role:`tabpanel`,id:`agents-panel`,"aria-labelledby":`agents-tab-${r}`,children:(0,E.jsx)(_e,{kind:s.kind,label:s.label,hint:s.hint,onSaved:l},s.kind)}),a?(0,E.jsx)(`p`,{className:`note`,role:`status`,children:`Saved. The next agent start uses it.`}):null,n.data?.source===`studio`?(0,E.jsxs)(`div`,{className:`factory-sheet-actions agents-clear`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:()=>u.mutate(),disabled:u.isPending,children:`Remove the credential set in Studio`}),u.error?(0,E.jsx)(`p`,{className:`factory-problems`,role:`alert`,children:u.error.message}):null]}):null]})]})}function O({action:e,id:t,className:n,children:r,...i}){let a=(0,T.useContext)(fe),o=f(),s=x({mutationFn:n=>d({data:{companion:a,action:e,id:t,fields:n}}),onSuccess:()=>p(o,a)});return(0,E.jsxs)(`form`,{className:n,"data-factory-action":t?`/${t}/${e}`:`/${e}`,onSubmit:e=>{e.preventDefault();let t=e.currentTarget,n=e.nativeEvent.submitter,r={};for(let[e,i]of new FormData(t,n))typeof i==`string`&&(r[e]=i);s.mutate(r,{onSuccess:()=>t.reset()})},"aria-busy":s.isPending||void 0,...i,children:[(0,E.jsx)(`fieldset`,{className:`factory-form-fields`,disabled:s.isPending,children:r}),s.error?(0,E.jsx)(`p`,{className:`factory-problems`,role:`alert`,children:s.error.message}):null]})}function k(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var A=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return A(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return A(t)(e)}}}},j=ae()(((e,t)=>(n,r,i)=>{let a={storage:k(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(...e)=>(f(...e),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return A(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p})(e=>({filter:``,setFilter:t=>e({filter:t}),stepped:!1,setStepped:t=>e({stepped:t}),agentsOpen:!1,setAgentsOpen:t=>e({agentsOpen:t})}),{name:`mate.factory.filter`,storage:k(()=>sessionStorage),partialize:({filter:e})=>({filter:e})})),M=`mate.factory.needsYou`;function ye(e,t){let n=e.toLowerCase();return t.toLowerCase().split(/\s+/).every(e=>n.includes(e))}function N(e,t){let n=e.replace(/^\(\d+\) /,``);return t>0?`(${t}) ${n}`:n}function be(e,t,n){let r=t?e.indexOf(t):-1;return r===-1?e[0]:e[Math.min(e.length-1,Math.max(0,r+n))]}function xe(e){return!!e?.closest?.(`input, textarea, select, [contenteditable], .outcome-terminal`)}function Se(e,t){if(/^[1-9]$/.test(t))return e.querySelector(`[data-option-key="${t}"]`);let n={j:`J`,k:`K`}[t];return n?e.querySelector(`[data-outcome-goto][aria-keyshortcuts="${n}"]`):null}function Ce(e,t){return t===`n`?e.querySelector(`form[data-outcome-input] textarea`):t===`/`?e.querySelector(`[data-outcome-filter]`):null}function we(e){return t=>{if(t.defaultPrevented||t.altKey)return;let n=t.target;if(t.key===`Enter`&&(t.ctrlKey||t.metaKey)){let e=n?.closest?.(`form`);if(n?.localName===`textarea`&&e){if(t.preventDefault(),e.querySelector(`button[type="submit"].factory-primary:disabled`))return;let n=e.querySelector(`button[value="start"]`);e.requestSubmit(n??void 0)}return}if(t.ctrlKey||t.metaKey||xe(n))return;let r=e.querySelector(`dialog.outcome-dialog[open]`);if(r){let e=Se(r,t.key);e&&(t.preventDefault(),e.click());return}let i=Ce(e,t.key);if(i){t.preventDefault(),i.focus();return}let a=!!n?.matches?.(`[data-outcome-row]`),o=t.key===`j`||a&&t.key===`ArrowDown`,s=t.key===`k`||a&&t.key===`ArrowUp`;if(!o&&!s)return;let c=be([...e.querySelectorAll(`[data-outcome-row]`)].filter(e=>e.getClientRects().length>0),e.activeElement,o?1:-1);c&&(t.preventDefault(),c.focus(),c.scrollIntoView({block:`nearest`}))}}function Te(){(0,T.useEffect)(()=>{let e=we(document);return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[])}function Ee(e){(0,T.useEffect)(()=>{if(document.title=N(document.title,e),typeof Notification>`u`||Notification.permission!==`granted`)return;let t=0;try{t=Number(sessionStorage.getItem(M)||`0`),sessionStorage.setItem(M,String(e))}catch{}e>t&&new Notification(`Mate factory`,{body:e===1?`1 decision needs you`:`${e} decisions need you`})},[e]),(0,T.useEffect)(()=>()=>void(document.title=N(document.title,0)),[])}function De(){let[e,t]=(0,T.useState)(()=>typeof Notification<`u`&&Notification.permission==="default");return{offered:e,ask:()=>void Notification.requestPermission().then(()=>t(!1))}}function P(e,t){if(t===void 0)return``;let n=Math.max(0,Math.floor((t-Date.parse(e))/6e4));return n>=1440?`${Math.floor(n/1440)}d`:n>=60?`${Math.floor(n/60)}h`:`${n}m`}var F={pieces:[],open:{}},Oe=/^(> |committed: |pushed |published |linked |Returned to automation|no review report |the review report for |\S+ is now at )/;function ke(e){let t=[];for(let n of e.split(/(?<=\n)/)){let e=Oe.test(n)?`factory`:`agent`,r=t.at(-1);r&&(r.kind===e||n.trim()===``)?r.text+=n:t.push({kind:e,text:n})}return t}function I(e,t){let n=(t,n,r)=>{let i=[...e.pieces,r===void 0?{kind:t,text:n}:{id:r,kind:t,text:n}];return{pieces:i,open:r===void 0?e.open:{...e.open,[r]:i.length-1}}},r=(t,r)=>{let i=e.open[t];if(i===void 0)return n(`agent`,r,t);let a=[...e.pieces];return a[i]={...a[i],text:a[i].text+r},{...e,pieces:a}};switch(t.type){case`replay`:{let e={pieces:ke(t.log),open:{}};for(let n of t.open)e=I(e,{type:`text`,...n,delta:n.text});return e}case`text`:return t.id===void 0?n(`agent`,t.delta):r(t.id,t.delta);case`text-end`:{let e=r(t.id,`
|
|
2
|
-
`),{[t.id]:n,...i}=e.open;return{...e,open:i}}case`tool`:return n(`tool`,`› ${t.name} ${t.summary}\n`);case`tool-done`:return t.failed?n(`failed`,` ${t.name} failed\n`):e;case`log`:return n(`factory`,t.text);case`lost`:return n(`factory`,`
|
|
3
|
-
This view fell behind the run; close and reopen the Outcome.
|
|
4
|
-
`);case`settled`:return e}}function Ae(e){let[t,n]=(0,T.useReducer)((e,t)=>t.type===`reset`?{...F,ended:!1}:{...I(e,t),ended:e.ended||t.type===`lost`},{...F,ended:!1});return(0,T.useEffect)(()=>{if(typeof EventSource>`u`)return;n({type:`reset`});let t=new EventSource(e);return t.addEventListener(`message`,e=>{try{n(JSON.parse(e.data))}catch{}}),()=>t.close()},[e]),{pieces:t.pieces,ended:t.ended}}var je=class{mount;outcome;companion;failed;focus;term=null;ws=null;sessionId=null;observer=null;closed=!1;constructor(e,t,n,r,i){this.mount=e,this.outcome=t,this.companion=n,this.failed=r,this.focus=i,this.open()}async open(){try{let e=await te();if(this.closed)return;let t=new e(this.mount,{cursorBlink:!0,autoResize:!1,wasmUrl:a});if(this.term=t,t.onData=e=>this.send({type:`input`,data:e}),t.onResize=()=>this.send({type:`resize`,cols:t.cols,rows:t.rows}),await t.init(),this.closed)return;t.fit(),this.observer=new ResizeObserver(()=>{this.mount.clientWidth&&this.mount.clientHeight&&t.fit()}),this.observer.observe(this.mount),this.connect()}catch{this.term=null,this.failed()}}send(e){b(this.ws,e)}notice(e){this.term?.write(`\r\n\u001b[2m${e}\u001b[0m\r\n`)}start(){if(!this.term)return;let{cols:e,rows:t}=this.term;this.send({type:`start`,workset:this.outcome,companion:this.companion,cols:e,rows:t})}connect(){let e=S();this.ws=e,e.onopen=()=>{if(!this.term)return;let{cols:e,rows:t}=this.term;this.sessionId?this.send({type:`attach`,sessionId:this.sessionId,cols:e,rows:t}):this.start()},e.onmessage=e=>this.receive(e.data),e.onclose=()=>{this.ws===e&&(this.ws=null)}}receive(e){let t=this.term;if(!t)return;if(typeof e!=`string`){t.write(new Uint8Array(e));return}let n=re(e);n&&(n.type===`ready`?(this.sessionId=n.sessionId??null,t.write(`\x1Bc`),this.focus&&t.focus()):n.type===`gone`?(this.sessionId=null,this.start()):n.type===`exit`||n.type===`ended`?(this.sessionId=null,this.notice(`The session ended. Return to automation when you are done, or close and reopen the Outcome to start it again.`)):n.type===`takenOver`?this.notice(`Another tab has this session now.`):n.type===`error`&&n.reason&&this.notice(n.reason))}close(){this.closed=!0,this.observer?.disconnect(),this.ws?.close(),this.ws=null,this.term?.destroy(),this.term=null}};function Me({outcome:e,companion:t,focus:n=!0}){let r=(0,T.useRef)(null),[i,a]=(0,T.useState)(!1),o=(0,T.useRef)(n);return(0,T.useEffect)(()=>{let n=new je(r.current,e,t,()=>a(!0),o.current);return()=>n.close()},[e,t]),(0,E.jsx)(`div`,{ref:r,className:`outcome-terminal`,"data-outcome-terminal":e,"data-companion":t,"data-terminal-error":i?``:void 0,children:i?`The terminal could not start in this browser. Close and reopen the Outcome to retry.`:null})}var Ne=new Set([`queued`,`running`]);function L(e,t){return e.stage===`done`?null:t?.control?.mode===`manual`?`control`:t?.state===`waiting`?`decision`:t?.state===`failed`||t?.state===`interrupted`?`problem`:t&&Ne.has(t.state)?null:e.stage===`human-review`?`review`:e.stage===`merge-wait`?`merge`:e.stage===`publish`?`publish`:null}function R(e,t){return e.workset.id<t.workset.id?-1:+(e.workset.id>t.workset.id)}function z(e){let t=Date.parse(e.run?.updatedAt||e.workset.queuedAt||``);return Number.isNaN(t)?1/0:t}function Pe(e,t){return e.map(e=>({workset:e,run:t?.[e.id]}))}function Fe(e,t){return de({id:e.workset.id,rank:ue(e.workset)},{id:t.workset.id,rank:ue(t.workset)})}function B(e){let t=[e.run?.situations?.[0]?.at,e.run?.updatedAt,e.workset.queuedAt];return Math.max(0,...t.map(e=>Date.parse(e??``)).filter(Number.isFinite))}function V(e){return e.workset.queuedAt!==void 0||e.workset.changes.length>0||e.run!==void 0&&e.run.state!==`idle`}function Ie(e,t){let n=Pe(e,t),r=n.flatMap(e=>{let t=L(e.workset,e.run);return t?[{...e,kind:t}]:[]}).toSorted((e,t)=>z(e)-z(t)||R(e,t)),i=n.filter(e=>e.workset.stage!==`done`);return{attention:r,active:i.filter(V).toSorted(Fe),later:i.filter(e=>!V(e)).toSorted(R),completed:n.filter(e=>e.workset.stage===`done`).toSorted((e,t)=>B(t)-B(e)||R(e,t))}}var H=[{label:`Understood`,after:`clarify-intent`,next:`The factory is working out what you want`},{label:`Approach chosen`,after:`explore`,next:`The factory is choosing the approach`},{label:`Plan ready`,after:`propose`,next:`The factory is writing the plan`},{label:`Plan approved`,after:`human-review`,next:`Ready for your review`},{label:`Built`,after:`apply`,next:`The factory is building it`},{label:`Merged`,after:`merge-wait`,next:`Ready for you to merge`},{label:`Delivered`,after:`publish`,next:`Ready to publish`}];function U(e){return n.indexOf(e)}function Le(e){let t=U(e.stage);return H.map(e=>({label:e.label,reached:t>U(e.after)}))}function W(e,t){return!e.queuedAt&&e.changes.length===0&&(!t||t.state===`idle`)}function Re(e,t){if(e.stage===`done`)return`Delivered`;if(t?.control?.mode===`manual`)return`You have control`;if(t?.state===`waiting`)return`Waiting for your answer`;if(t?.state===`failed`||t?.state===`interrupted`)return`Stopped; needs you`;if(W(e,t))return`Saved for later`;let n=U(e.stage);return H.find(e=>n<=U(e.after))?.next??`Delivered`}var ze={"clarify-intent":`Understanding what you want.`,explore:`Working out the approach.`,propose:`Writing the plan.`,"human-review":`A plan is ready for your review.`,apply:`Building it.`,"merge-wait":`Built; waiting for the merge.`,publish:`Merged; ready to publish.`,done:`Delivered.`};function Be(e,t){return t?.state===`queued`?t.waiting===`workset-slot`?`Waiting for a Workset slot.`:t.waiting===`build-slot`?`Waiting for a build slot.`:`Waiting for a free slot.`:t?.state===`failed`?`Stopped: ${t.reason}`:t?.state===`interrupted`?`Stopped when Studio restarted.`:t?.state===`waiting`?`Waiting for your answer.`:W(e,t)?`Saved for later.`:ze[e.stage]??e.stageLabel}var Ve=new Set([`queued`,`waiting`,`failed`,`interrupted`]);function G(e,t){let n=t?.situations?.[0];return n&&!(t&&Ve.has(t.state))?n:{text:Be(e,t)}}var K={running:`Running`,queued:`Queued`,"needs-you":`Needs you`,control:`You have control`,stopped:`Stopped`,idle:`Idle`,later:`Saved for later`,done:`Delivered`};function q(e,t){return e.stage===`done`?`done`:t?.control?.mode===`manual`?`control`:t?.state===`failed`||t?.state===`interrupted`?`stopped`:t?.state===`running`?`running`:t?.state===`queued`?`queued`:L(e,t)?`needs-you`:V({workset:e,run:t})?`idle`:`later`}var He={"clarify-intent":`clarify-intent`,explore:`explore`,propose:`propose`,"human-review":`reviews`,apply:`apply`,"merge-wait":`archive`,publish:`publish`,done:`complete`},Ue=e=>He[e.stage],We={control:`You have control`,decision:`Decision needed`,review:`Plan ready for review`,merge:`Ready to merge`,publish:`Ready to publish`,problem:`Something went wrong`},Ge={decision:`The run is paused on this. Pick an option or answer in your words; it continues on its own.`,review:`Read each report, then approve to start building, or request a change to revise the plan.`,merge:`Merge the delivery branch on your forge; the board picks it up on its next refresh.`,publish:`Publishing commits, tags and pushes the archived specs to the companion.`,problem:`Retry runs the stage again; take control to fix it yourself.`,control:`You work in the factory's own conversation. Exit Claude, then return the Outcome to automation; the factory checks what changed and continues.`},Ke=`Pauses automation after the current stage; you continue the factory's own conversation here.`,qe=5;function J(e,t){let n=t?.state===`waiting`?C(t).length:0;return e===`decision`&&n>1?`Decisions needed (${n})`:We[e]}var Je=new Set([`answer`,`start-apply`,`publish`,`return`,`retry`,`start`]);function Ye({id:e,action:t,label:n,children:r}){return(0,E.jsxs)(O,{id:e,action:t,className:`factory-action`,children:[r,(0,E.jsx)(`button`,{type:`submit`,className:Je.has(t)?`factory-primary`:void 0,children:n})]})}function Y(e,t){let n=w(e.workset,e.run,t);return(r,i,a)=>t.writable&&n.has(r)?(0,E.jsx)(Ye,{id:e.workset.id,action:r,label:i,children:a}):null}function Xe({activity:e}){return(0,E.jsx)(`span`,{className:`activity-dot`,"data-activity":e,title:K[e],"aria-hidden":`true`})}function Ze({repositories:e,context:t}){return t.writable?e.length===0?(0,E.jsx)(`p`,{className:`note`,children:`Link a Working Repository to this companion to describe outcomes.`}):(0,E.jsxs)(O,{action:`create`,className:`outcome-input`,"data-outcome-input":``,children:[(0,E.jsxs)(`label`,{children:[(0,E.jsx)(`span`,{className:`outcome-input-label`,children:`What should we build or improve?`}),(0,E.jsx)(`textarea`,{name:`text`,rows:3,required:!0,placeholder:`Make onboarding easier: fewer signup steps, and keep authentication working.`})]}),(0,E.jsxs)(`div`,{className:`outcome-input-actions`,children:[(0,E.jsxs)(`button`,{type:`submit`,name:`start`,value:`start`,className:`factory-primary`,children:[`Start `,(0,E.jsx)(`kbd`,{children:`⌘↵`})]}),(0,E.jsx)(`button`,{type:`submit`,name:`start`,value:`later`,children:`Save for later`}),e.length>1?(0,E.jsx)(`select`,{name:`repository`,required:!0,"aria-label":`Working Repository`,children:e.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))}):null]})]}):(0,E.jsx)(`p`,{className:`note`,children:`Read-only mode. Start Studio with --writable to describe outcomes.`})}function Qe({workset:e}){let t=Le(e),n=t.filter(e=>e.reached).length,r=t.find(e=>!e.reached);return(0,E.jsxs)(`span`,{className:`outcome-row-track`,title:`${n} of ${t.length} milestones${r?`; next: ${r.label}`:``}`,children:[(0,E.jsx)(`span`,{className:`outcome-row-pips`,"aria-hidden":`true`,children:t.map(e=>(0,E.jsx)(`i`,{"data-reached":e.reached?`true`:`false`},e.label))}),(0,E.jsxs)(`span`,{className:`mono`,children:[n,`/`,t.length]})]})}function $e({checks:e}){return e?.length?(0,E.jsx)(`ul`,{className:`outcome-checks`,"aria-label":`Checks`,children:e.map(e=>(0,E.jsxs)(`li`,{"data-passed":e.passed?`true`:`false`,children:[e.passed?`✓`:`✗`,` `,e.name]},e.name))}):null}function et({item:e}){let t=Object.entries(e.run?.reviewReports??{}),n=e.run?.compareUrl;return t.length===0&&!n?null:(0,E.jsxs)(`div`,{className:`outcome-results`,children:[t.map(([e,n])=>(0,E.jsxs)(`a`,{href:`${o}${n}`,target:`_blank`,rel:`noreferrer`,children:[`Review plan`,t.length>1?` · ${e}`:``]},e)),n?(0,E.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,children:`View changes`}):null]})}function tt({item:e}){let t=e.run?.reviewReports??{};return(0,E.jsx)(`div`,{className:`factory-review-reports`,children:e.workset.changes.map(e=>t[e]?(0,E.jsxs)(`figure`,{className:`factory-review-report`,children:[(0,E.jsxs)(`figcaption`,{className:`mono`,children:[e,` ·`,` `,(0,E.jsx)(`a`,{href:`${o}${t[e]}`,target:`_blank`,rel:`noreferrer`,children:`open`})]}),(0,E.jsx)(`iframe`,{src:`${o}${t[e]}`,title:`Review report for ${e}`,loading:`lazy`,sandbox:`allow-scripts allow-modals`})]},e):(0,E.jsxs)(`p`,{className:`note`,"data-report-missing":e,children:[`No review report for `,(0,E.jsx)(`span`,{className:`mono`,children:e}),`.`]},e))})}function nt({item:e,context:t}){if(!t.writable)return null;let{stage:n}=e.workset;return n===`publish`||n===`done`?(0,E.jsxs)(O,{action:`create`,className:`outcome-feedback`,children:[(0,E.jsx)(`textarea`,{name:`text`,rows:2,required:!0,"aria-label":`A new outcome`}),(0,E.jsx)(`button`,{type:`submit`,name:`start`,value:`start`,children:`Start as a new outcome`})]}):Y(e,t)(`feedback`,`Request a change`,(0,E.jsx)(`textarea`,{name:`feedback`,rows:2,required:!0,"aria-label":`Request a change`,placeholder:`What should change?`}))}var rt=e=>e?.state===`running`||e?.state===`queued`;function it({item:e}){let{workset:t,run:n}=e,r=rt(n);return!n?.hasLog&&!r?null:(0,E.jsxs)(`section`,{className:`outcome-log-section`,"aria-label":`Log`,children:[(0,E.jsxs)(`header`,{className:`outcome-section-head`,children:[(0,E.jsx)(`h3`,{children:`Log`}),r?(0,E.jsx)(`span`,{className:`outcome-log-live`,children:`live`}):null,(0,E.jsx)(`a`,{href:s(t.id),target:`_blank`,rel:`noreferrer`,children:`Full log`})]}),(0,E.jsx)(at,{id:t.id})]})}function at({id:e}){let{pieces:t,ended:n}=Ae(i(e)),r=(0,T.useRef)(null),a=(0,T.useRef)(!0),[o,s]=(0,T.useState)(!1);return(0,T.useEffect)(()=>{let e=r.current;e&&t.length>0&&a.current&&(e.scrollTop=e.scrollHeight)},[t]),(0,E.jsxs)(`div`,{className:`outcome-log-frame`,children:[(0,E.jsx)(`pre`,{ref:r,role:`log`,"aria-label":`Run log`,tabIndex:0,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollHeight-t.scrollTop-t.clientHeight<48,s(!a.current)},className:`outcome-log`,"data-outcome-log":i(e),"data-ended":n||void 0,children:t.length>0?t.map((e,t)=>(0,E.jsx)(`span`,{"data-kind":e.kind,children:e.text},t)):(0,E.jsx)(`span`,{className:`outcome-log-empty`,children:`Waiting for output.`})}),o?(0,E.jsx)(`button`,{type:`button`,className:`outcome-log-jump`,onClick:()=>{let e=r.current;e&&(e.scrollTop=e.scrollHeight,a.current=!0,s(!1))},children:`Jump to latest`}):null]})}function ot({item:e,context:t}){let{workset:n,run:r}=e,i=j(e=>e.stepped);return(0,E.jsxs)(`div`,{className:`factory-sheet outcome-control`,children:[(0,E.jsxs)(`div`,{className:`outcome-control-bar`,children:[r?.control?.reason?(0,E.jsx)(`p`,{className:`outcome-control-reason`,children:r.control.reason}):null,Y(e,t)(`return`,`Return to automation`)]}),t.sessions&&r?.control?.mode===`manual`?(0,E.jsx)(Me,{outcome:n.id,companion:t.companionDigest,focus:!i}):(0,E.jsx)(`p`,{className:`note`,children:`The terminal is not available in this Studio.`})]})}function st({item:e,context:t}){let{workset:n,run:r}=e;if(!r?.conversation||r.control||n.stage===`done`)return null;let i=Y(e,t)(`take-control`,`Take control`);return i?(0,E.jsxs)(`div`,{className:`outcome-control-offer`,children:[i,(0,E.jsx)(`p`,{className:`note`,children:Ke})]}):null}function ct({run:e,now:t}){if(e?.control?.mode!==`takeover-requested`)return null;let n=e.state===`running`?e.stage:null,r=e.control.updatedAt?P(e.control.updatedAt,t):``;return(0,E.jsxs)(`section`,{className:`outcome-dialog-attention`,"data-kind":`control`,"data-pending":``,role:`status`,"aria-label":`Taking control`,children:[(0,E.jsx)(`h3`,{children:`Taking control`}),(0,E.jsxs)(`p`,{className:`outcome-attention-hint`,children:[`Control passes to you once`,` `,n?(0,E.jsxs)(E.Fragment,{children:[`the `,(0,E.jsx)(`span`,{className:`mono`,children:n}),` stage`]}):`the current stage`,` `,`ends; the log below keeps following it. The terminal opens here then.`,r?(0,E.jsxs)(`span`,{className:`factory-age mono`,children:[` · asked `,r,` ago`]}):null]})]})}function lt(e,t){if(!e||e.state===`idle`)return`idle`;let n=e.state===`running`?e.startedAt:e.updatedAt;return`${e.state} ${e.stage}${n?` · ${P(n,t)}`:``}`}var ut=({workset:e,run:t})=>e.changes.some(e=>!t?.reviewReports?.[e]);function dt({item:e,context:t}){let{workset:n,run:r}=e,i=Y(e,t),a=rt(r),o=n.stage!==`done`;return(0,E.jsxs)(`div`,{className:`outcome-actions`,role:`group`,"aria-label":`Run actions`,children:[o&&!n.queuedAt?i(`start`,`Start`):null,a?i(`cancel`,`Cancel run`):null,n.stage===`human-review`&&!ut(e)?i(`regenerate`,`Regenerate reports`):null,o&&n.queuedAt?i(`later`,`Move to later`):null]})}function ft({item:e,context:t}){let{workset:n,run:r}=e;return(0,E.jsxs)(`dl`,{className:`outcome-facts`,children:[(0,E.jsx)(`dt`,{children:`Stage`}),(0,E.jsx)(`dd`,{children:n.stageLabel}),(0,E.jsx)(`dt`,{children:`Run`}),(0,E.jsx)(`dd`,{children:lt(r,t.now)}),(0,E.jsx)(`dt`,{children:`Changes`}),(0,E.jsx)(`dd`,{className:`mono`,children:n.changes.join(`, `)||`none yet`}),r?.pushedBranch?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`dt`,{children:`Branch`}),(0,E.jsx)(`dd`,{className:`mono`,children:r.pushedBranch})]}):null,(0,E.jsx)(`dt`,{children:`Id`}),(0,E.jsx)(`dd`,{className:`mono`,children:n.id})]})}function pt(e,t,n){let{run:r}=e,i=K[t].toLowerCase();return r?.state===`running`&&n!==void 0?`${i} · ${P(r.startedAt,n)}`:t===`idle`?``:i}function X(){return(0,E.jsx)(`span`,{className:`factory-recommended`,children:`recommended`})}function mt({item:e,asked:t,round:n,context:r}){let i=r.writable&&w(e.workset,e.run,r).has(`answer`);return(0,E.jsxs)(`div`,{className:`factory-sheet`,children:[(0,E.jsx)(`p`,{className:`factory-question`,children:t.question}),t.options?.length?(0,E.jsx)(`div`,{className:`factory-options`,role:`group`,"aria-label":`Answers`,children:t.options.map((r,a)=>{let o=r===t.recommended,s=a<9?String(a+1):void 0;return i?(0,E.jsxs)(O,{id:e.workset.id,action:`answer`,className:`factory-option`,children:[(0,E.jsx)(`input`,{type:`hidden`,name:`round`,value:n}),(0,E.jsx)(`input`,{type:`hidden`,name:`answer`,value:r}),(0,E.jsxs)(`button`,{type:`submit`,"data-recommended":o?`true`:`false`,"data-option-key":s,"aria-keyshortcuts":s,children:[s?(0,E.jsx)(`kbd`,{"aria-hidden":`true`,children:s}):null,(0,E.jsx)(`span`,{children:r}),o?(0,E.jsx)(X,{}):null]})]},r):(0,E.jsxs)(`span`,{className:`factory-choice`,"data-recommended":o?`true`:`false`,children:[r,o?(0,E.jsx)(X,{}):null]},r)})}):t.recommended?(0,E.jsxs)(`p`,{className:`note`,children:[`Recommended: `,t.recommended]}):null,Y(e,r)(`answer`,t.options?.length?`Send my words`:`Answer`,(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`input`,{type:`hidden`,name:`round`,value:n}),(0,E.jsx)(`textarea`,{name:`answer`,rows:2,required:!0,"aria-label":`Answer in your words`,placeholder:t.options?.length?`Or answer in your words`:`Your answer`})]}))]})}function ht({asked:e,index:t}){return(0,E.jsxs)(`fieldset`,{className:`factory-question-set`,children:[(0,E.jsxs)(`legend`,{className:`factory-question`,children:[(0,E.jsxs)(`span`,{className:`mono`,children:[t+1,`.`]}),` `,e.question]}),e.options?.length?(0,E.jsx)(`div`,{className:`factory-choices`,children:e.options.map(n=>{let r=n===e.recommended;return(0,E.jsxs)(`label`,{className:`factory-choice`,"data-recommended":r?`true`:`false`,children:[(0,E.jsx)(`input`,{type:`radio`,name:`choice-${t}`,value:n}),(0,E.jsx)(`span`,{children:n}),r?(0,E.jsx)(X,{}):null]},n)})}):e.recommended?(0,E.jsxs)(`p`,{className:`note`,children:[`Recommended: `,e.recommended]}):null,(0,E.jsx)(`textarea`,{name:`answer-${t}`,rows:1,"aria-label":`Answer to question ${t+1} in your words`,placeholder:e.options?.length?`Or in your words (overrides the choice)`:`Your answer`})]})}function gt(e,t){let n=new FormData(e),r=0;for(let e=0;e<t;e+=1){let t=n.get(`answer-${e}`);(n.get(`choice-${e}`)||typeof t==`string`&&t.trim())&&(r+=1)}return r}function _t({item:e,questions:t,round:n,context:r}){let[i,a]=(0,T.useState)(0);if(!r.writable||!w(e.workset,e.run,r).has(`answer`))return(0,E.jsx)(`ol`,{className:`outcome-history`,children:t.map(e=>(0,E.jsx)(`li`,{children:e.question},e.question))});let o=e=>{let n=e.currentTarget.closest(`form`);n&&a(gt(n,t.length))},s=t.every(e=>e.recommended);return(0,E.jsxs)(`div`,{className:`factory-sheet`,children:[(0,E.jsxs)(O,{id:e.workset.id,action:`answer`,className:`factory-action factory-round`,children:[(0,E.jsx)(`input`,{type:`hidden`,name:`round`,value:n}),(0,E.jsx)(`div`,{className:`factory-round-questions`,onChange:o,onInput:o,children:t.map((e,t)=>(0,E.jsx)(ht,{asked:e,index:t},e.question))}),(0,E.jsxs)(`div`,{className:`factory-sheet-actions`,children:[(0,E.jsx)(`button`,{type:`submit`,className:`factory-primary`,disabled:i<t.length,children:`Send answers`}),(0,E.jsxs)(`span`,{className:`factory-round-count mono`,"aria-live":`polite`,children:[i,` of `,t.length,` answered`]})]})]}),s?(0,E.jsxs)(O,{id:e.workset.id,action:`answer`,className:`factory-action`,children:[(0,E.jsx)(`input`,{type:`hidden`,name:`round`,value:n}),t.map((e,t)=>(0,E.jsx)(`input`,{type:`hidden`,name:`choice-${t}`,value:e.recommended},e.question)),(0,E.jsx)(`button`,{type:`submit`,children:`Accept all recommendations`})]}):null]})}function vt({item:e,run:t,context:n}){let r=C(t);return r.length===1?(0,E.jsx)(mt,{item:e,asked:r[0],round:t.round??``,context:n}):(0,E.jsx)(_t,{item:e,questions:r,round:t.round??``,context:n})}function yt({item:e,kind:t,context:n}){let{run:r}=e,i=Y(e,n);if(t===`control`)return(0,E.jsx)(ot,{item:e,context:n});if(t===`decision`&&r?.state===`waiting`)return(0,E.jsx)(vt,{item:e,run:r,context:n});if(t===`problem`)return(0,E.jsxs)(`div`,{className:`factory-sheet`,children:[(0,E.jsx)(`p`,{className:`factory-problems`,children:r?.state===`failed`?r.reason:`Stopped when Studio restarted.`}),r?.needsCredential?(0,E.jsx)(At,{label:`Set the agent credential`}):null,i(`retry`,`Retry`)]});if(t===`review`){let t=ut(e);return(0,E.jsxs)(`div`,{className:`factory-sheet`,children:[(0,E.jsx)(tt,{item:e}),(0,E.jsxs)(`div`,{className:`factory-sheet-actions`,children:[i(`start-apply`,`Approve`),t?i(`regenerate`,`Regenerate`):null]}),(0,E.jsx)(nt,{item:e,context:n})]})}return t===`merge`?(0,E.jsx)(`div`,{className:`factory-sheet`,children:r?.compareUrl?(0,E.jsxs)(`a`,{href:r.compareUrl,target:`_blank`,rel:`noreferrer`,children:[`Open `,r.pushedBranch??`the branch`,` to merge`]}):(0,E.jsxs)(`p`,{className:`note`,children:[`Merge `,(0,E.jsx)(`span`,{className:`mono`,children:r?.pushedBranch??`the delivery branch`}),`, then refresh.`]})}):(0,E.jsx)(`div`,{className:`factory-sheet`,children:i(`publish`,`Publish`)})}var bt=e=>`outcome-${e}`;function Z(){let e=u(),t=(t,n=!1)=>void e({to:`/factory`,search:e=>({...e,outcome:t}),replace:n,resetScroll:!1});return{open:e=>t(e),step:e=>t(e,!0),close:()=>t(void 0)}}function Q({item:e,context:t,lead:n,progress:r=!0,trailing:i}){let{workset:a,run:o}=e,s=G(a,o),c=s.at??(o?.updatedAt||a.queuedAt),l=Z();return(0,E.jsxs)(`li`,{className:`outcome-row-item`,"data-workset":a.id,children:[(0,E.jsxs)(`button`,{type:`button`,className:`outcome-row`,"data-outcome-row":``,onClick:()=>{j.getState().setStepped(!1),l.open(a.id)},children:[(0,E.jsx)(Xe,{activity:q(a,o)}),(0,E.jsx)(`span`,{className:`outcome-row-title`,children:a.title}),(0,E.jsx)(`span`,{className:`outcome-row-where`,children:n??s.text}),(0,E.jsx)(`span`,{className:`outcome-row-progress`,children:r?(0,E.jsx)(Qe,{workset:a}):null}),(0,E.jsx)(`span`,{className:`outcome-row-age mono`,children:c?P(c,t.now):``})]}),i]})}function $({label:e,section:t,count:n,children:r}){return(0,E.jsxs)(`section`,{className:`outcome-list-section`,"data-section":t,"aria-label":e,children:[(0,E.jsxs)(`h3`,{children:[e,` `,(0,E.jsx)(`span`,{className:`outcome-list-count mono`,children:n})]}),(0,E.jsx)(`ul`,{className:`outcome-list`,children:r})]})}var xt=(e,t)=>e.replace(/\.$/,``).toLowerCase()===t.replace(/\.$/,``).toLowerCase();function St({to:e,label:t,keyName:n}){let r=Z();return(0,E.jsxs)(`button`,{type:`button`,className:`outcome-step`,"data-outcome-goto":e?bt(e):void 0,disabled:!e,"aria-keyshortcuts":n,onClick:()=>{e&&(j.getState().setStepped(!0),r.step(e))},children:[t,` `,(0,E.jsx)(`kbd`,{children:n})]})}function Ct({item:e,kind:t,context:n}){return(0,E.jsxs)(`section`,{className:`outcome-dialog-attention`,"data-kind":t,"aria-label":`Needs you`,children:[(0,E.jsx)(`h3`,{children:J(t,e.run)}),Ge[t]?(0,E.jsx)(`p`,{className:`outcome-attention-hint`,children:Ge[t]}):null,(0,E.jsx)(yt,{item:e,kind:t,context:n})]})}function wt({item:e,situation:t}){let{workset:n,run:r}=e,i=Re(n,r);return(0,E.jsxs)(`section`,{className:`outcome-dialog-status`,"aria-label":`Where it is`,children:[(0,E.jsx)(`p`,{className:`outcome-situation`,children:t.text}),xt(i,t.text)?null:(0,E.jsxs)(`p`,{className:`outcome-next`,children:[(0,E.jsx)(`span`,{className:`muted`,children:`Next`}),` `,i]}),(0,E.jsx)($e,{checks:t.checks}),(0,E.jsx)(et,{item:e}),n.problems.length>0?(0,E.jsx)(`ul`,{className:`factory-problems`,children:n.problems.map(e=>(0,E.jsx)(`li`,{children:e},e))}):null]})}function Tt({run:e,now:t}){return e?.situations?.length?(0,E.jsxs)(`section`,{className:`outcome-history-section`,"aria-label":`What happened`,children:[(0,E.jsx)(`h3`,{children:`What happened`}),(0,E.jsx)(`ol`,{className:`outcome-history`,children:e.situations.map(e=>(0,E.jsxs)(`li`,{children:[(0,E.jsx)(`span`,{className:`factory-age mono`,children:P(e.at,t)}),(0,E.jsx)(`span`,{children:e.text})]},e.at))})]}):null}function Et({item:e,kind:t,context:n,place:r}){let{workset:i,run:a}=e,o=G(i,a),s=q(i,a),c=a?.state===`running`?a.startedAt:a?.updatedAt||o.at,l=bt(i.id),u={current:Ue(i),activity:s,note:pt(e,s,n.now)},d=pe(Z().close,e=>{e.showModal(),e.querySelector(`.outcome-dialog-close`)?.focus()});return(0,E.jsxs)(`dialog`,{ref:d,id:l,className:`outcome-dialog`,"data-workset":i.id,"data-layout":t===`control`?`control`:void 0,"aria-labelledby":`${l}-title`,children:[(0,E.jsxs)(`header`,{className:`outcome-dialog-head`,children:[(0,E.jsxs)(`div`,{className:`outcome-dialog-heading`,children:[(0,E.jsx)(`h2`,{id:`${l}-title`,children:i.title}),(0,E.jsxs)(`p`,{className:`outcome-dialog-state`,children:[(0,E.jsx)(Xe,{activity:s}),K[s],c?(0,E.jsxs)(`span`,{className:`factory-age mono`,children:[`· `,P(c,n.now)]}):null]})]}),(0,E.jsxs)(`nav`,{className:`outcome-dialog-steps`,"aria-label":`Other outcomes`,children:[(0,E.jsxs)(`span`,{className:`outcome-dialog-place mono`,children:[r.index+1,` of `,r.total]}),(0,E.jsx)(St,{to:r.prev,label:`Previous`,keyName:`K`}),(0,E.jsx)(St,{to:r.next,label:`Next`,keyName:`J`})]}),(0,E.jsx)(`form`,{method:`dialog`,children:(0,E.jsxs)(`button`,{type:`submit`,className:`outcome-dialog-close`,"aria-keyshortcuts":`Escape`,children:[`Close `,(0,E.jsx)(`kbd`,{children:`Esc`})]})})]}),(0,E.jsxs)(`div`,{className:`outcome-dialog-body`,children:[(0,E.jsxs)(`div`,{className:`outcome-dialog-main`,children:[t?(0,E.jsx)(Ct,{item:e,kind:t,context:n}):null,(0,E.jsx)(ct,{run:a,now:n.now}),(0,E.jsx)(it,{item:e}),(0,E.jsx)(wt,{item:e,situation:o}),(0,E.jsx)(dt,{item:e,context:n}),(0,E.jsx)(st,{item:e,context:n}),(0,E.jsx)(Tt,{run:a,now:n.now}),i.intent?(0,E.jsxs)(`section`,{className:`outcome-intent-section`,"aria-label":`Request`,children:[(0,E.jsx)(`h3`,{children:`Request`}),(0,E.jsx)(`p`,{className:`outcome-intent`,children:i.intent})]}):null,t===`review`?null:(0,E.jsx)(nt,{item:e,context:n})]}),(0,E.jsxs)(`aside`,{className:`outcome-dialog-rail`,"aria-label":`Delivery Path`,children:[t===`control`?null:(0,E.jsx)(y,{path:n.path,progress:u,label:`Where it is on the Delivery Path`}),(0,E.jsx)(ft,{item:e,context:n})]})]})]})}function Dt({items:e,context:t,expanded:n}){if(e.length===0)return null;let r=n?[]:e.slice(qe),i=e=>(0,E.jsx)(Q,{item:e,context:t,progress:!1},e.workset.id);return(0,E.jsxs)($,{label:`Done`,section:`completed`,count:e.length,children:[(n?e:e.slice(0,qe)).map(i),r.length>0?(0,E.jsx)(`li`,{children:(0,E.jsxs)(`details`,{className:`outcome-list-more`,children:[(0,E.jsxs)(`summary`,{children:[`Show all `,e.length]}),(0,E.jsx)(`ul`,{className:`outcome-list`,children:r.map(i)})]})}):null]})}function Ot(){return(0,E.jsxs)(`section`,{className:`factory-first-run`,"aria-label":`How the factory works`,children:[(0,E.jsx)(`h3`,{children:`How an outcome gets delivered`}),(0,E.jsxs)(`ol`,{children:[(0,E.jsx)(`li`,{children:`Describe what you want built or improved, and start it.`}),(0,E.jsx)(`li`,{children:`The factory clarifies and explores; answer its questions as they come up.`}),(0,E.jsx)(`li`,{children:`It writes a plan. Review it, then approve or request a change.`}),(0,E.jsx)(`li`,{children:`It builds the plan on a delivery branch. Merge the branch, then publish.`})]}),(0,E.jsx)(`p`,{className:`note`,children:`Everything that needs you shows under Needs you. Open an outcome to follow its log or take control of its conversation.`})]})}function kt(e){let t=j(e=>e.filter).trim(),n=new Map(e.attention.map(e=>[e.workset.id,e.kind])),r=e.active.filter(e=>!n.has(e.workset.id)),i=e=>{if(!t)return!0;let r=n.get(e.workset.id),i=r?J(r,e.run):``;return ye(`${e.workset.title} ${G(e.workset,e.run).text} ${i}`,t)},a=e.attention.filter(i),o=r.filter(i),s=e.later.filter(i),c=e.completed.filter(i);return{kinds:n,query:t,ordered:[...e.attention,...r,...e.later,...e.completed],attention:a,running:{all:r,shown:o},later:s,completed:c,shownCount:a.length+o.length+s.length+c.length}}function At({label:e}){let t=j(e=>e.setAgentsOpen);return(0,E.jsx)(`button`,{type:`button`,"data-open-agents":``,onClick:()=>t(!0),children:e})}function jt({count:e,worksets:t,writable:n,factoryMode:r}){let i=j(e=>e.filter),a=j(e=>e.setFilter),o=De();return(0,E.jsxs)(`div`,{className:`view-intro`,"data-factory-live":``,"data-needs-you":e,children:[t>0?(0,E.jsx)(`input`,{type:`search`,className:`outcome-filter`,"data-outcome-filter":``,placeholder:`Filter outcomes`,"aria-label":`Filter outcomes`,"aria-keyshortcuts":`/`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(a(``),e.currentTarget.blur())}}):null,(0,E.jsxs)(`p`,{className:`factory-keys`,children:[n?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`kbd`,{children:`N`}),` new`]}):null,t>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`kbd`,{children:`/`}),` filter`]}):null,(0,E.jsx)(`kbd`,{children:`J`}),(0,E.jsx)(`kbd`,{children:`K`}),` move `,(0,E.jsx)(`kbd`,{children:`↵`}),` open `,(0,E.jsx)(`kbd`,{children:`1`}),`–`,(0,E.jsx)(`kbd`,{children:`9`}),` answer`]}),(0,E.jsx)(`button`,{type:`button`,"data-factory-notify":``,hidden:!o.offered,onClick:o.ask,children:`Notify me about decisions`}),r&&n?(0,E.jsx)(At,{label:`Agents`}):null]})}function Mt({payload:e,companionDigest:t,writable:n,sessions:r=null,runs:i=null,now:a,openId:o,factoryMode:s=!1}){let c=Ie(e.worksets,i),l={companionDigest:t,writable:n,sessions:r,runner:i!==null,now:a,path:ee({topology:e.topology}).paths[0]},{kinds:u,ordered:d,attention:f,running:p,later:m,completed:h,shownCount:g,query:_}=kt(c),y=o?d.findIndex(e=>e.workset.id===o):-1,te=p.all.length===0&&c.attention.length===0;Te(),Ee(c.attention.length);let b=y>=0?{item:d[y],index:y}:null,x=j(e=>e.agentsOpen),S=j(e=>e.setAgentsOpen);return(0,E.jsx)(fe.Provider,{value:t,children:(0,E.jsxs)(`section`,{className:`view-section factory-home`,"aria-label":`Factory`,children:[(0,E.jsx)(jt,{count:c.attention.length,worksets:e.worksets.length,writable:n,factoryMode:s}),(0,E.jsx)(Ze,{repositories:e.linkedRepositories,context:l}),f.length>0?(0,E.jsx)($,{label:`Needs you`,section:`attention`,count:f.length,children:f.map(e=>(0,E.jsx)(Q,{item:e,context:l,lead:(0,E.jsx)(`span`,{className:`attention-kind`,"data-kind":e.kind,children:J(e.kind,e.run)})},e.workset.id))}):null,p.shown.length>0?(0,E.jsx)($,{label:`Running`,section:`active`,count:p.shown.length,children:p.shown.map(e=>(0,E.jsx)(Q,{item:e,context:l},e.workset.id))}):null,e.worksets.length===0?(0,E.jsx)(Ot,{}):te?(0,E.jsx)(`p`,{className:`note`,children:`The factory is idle. Describe an outcome to get it started.`}):null,(0,E.jsx)(`p`,{className:`note outcome-filter-empty`,"data-outcome-filter-empty":``,hidden:!_||g>0,children:`No outcomes match the filter.`}),m.length>0?(0,E.jsx)($,{label:`Later`,section:`later`,count:m.length,children:m.map(e=>(0,E.jsx)(Q,{item:e,context:l,progress:!1,trailing:Y(e,l)(`start`,`Start`)},e.workset.id))}):null,(0,E.jsx)(Dt,{items:h,context:l,expanded:!!_}),b?(0,E.jsx)(Et,{item:b.item,kind:u.get(b.item.workset.id)??null,context:l,place:{index:b.index,total:d.length,prev:d[b.index-1]?.workset.id,next:d[b.index+1]?.workset.id}},b.item.workset.id):null,e.worksetProblems.length>0?(0,E.jsx)(v,{warnings:e.worksetProblems.map(e=>`${e.path} ${e.reason}`)}):null,(0,E.jsx)(v,{warnings:e.warnings}),s&&n&&x?(0,E.jsx)(ve,{onClose:()=>S(!1)}):null]})})}function Nt(){let{companion:e,outcome:t}=ne.useSearch(),n=u();return(0,T.useEffect)(()=>{let e=/^#outcome-([a-z0-9][a-z0-9-]*)$/.exec(window.location.hash)?.[1];e&&!t&&n({to:`/factory`,search:t=>({...t,outcome:e}),hash:``,replace:!0})},[n,t]),e?(0,E.jsx)(Pt,{companion:e,outcome:t}):null}function Pt({companion:e,outcome:n}){let{data:r}=t(h(e));return r.payload?(0,E.jsx)(Mt,{payload:r.payload,companionDigest:e,writable:r.writable,factoryMode:r.factoryMode,sessions:r.sessions,runs:r.runs,now:r.renderedAt,openId:n}):(0,E.jsx)(`section`,{className:`panel`,children:(0,E.jsx)(`p`,{className:`empty`,children:r.error??`No state collected for this companion.`})})}export{Nt as component};
|