@canonical/summon-core 0.35.0 → 0.37.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/dist/esm/format/index.js +5 -0
- package/dist/esm/format/index.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/prompt/ink/Wizard.js +44 -8
- package/dist/esm/prompt/ink/Wizard.js.map +1 -1
- package/dist/esm/prompt/ink/mount.js +19 -7
- package/dist/esm/prompt/ink/mount.js.map +1 -1
- package/dist/esm/prompt/ink/progressWindow.js +131 -3
- package/dist/esm/prompt/ink/progressWindow.js.map +1 -1
- package/dist/esm/prompt/ink/session.js +114 -8
- package/dist/esm/prompt/ink/session.js.map +1 -1
- package/dist/esm/prompt/inkPrompt.js +8 -1
- package/dist/esm/prompt/inkPrompt.js.map +1 -1
- package/dist/esm/testing/conformance/fixtures.js +33 -1
- package/dist/esm/testing/conformance/fixtures.js.map +1 -1
- package/dist/types/format/index.d.ts +1 -0
- package/dist/types/format/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/prompt/index.d.ts +1 -1
- package/dist/types/prompt/index.d.ts.map +1 -1
- package/dist/types/prompt/ink/Wizard.d.ts.map +1 -1
- package/dist/types/prompt/ink/mount.d.ts +3 -2
- package/dist/types/prompt/ink/mount.d.ts.map +1 -1
- package/dist/types/prompt/ink/progressWindow.d.ts +98 -2
- package/dist/types/prompt/ink/progressWindow.d.ts.map +1 -1
- package/dist/types/prompt/ink/session.d.ts +86 -3
- package/dist/types/prompt/ink/session.d.ts.map +1 -1
- package/dist/types/prompt/inkPrompt.d.ts +29 -2
- package/dist/types/prompt/inkPrompt.d.ts.map +1 -1
- package/dist/types/testing/conformance/fixtures.d.ts +1 -1
- package/dist/types/testing/conformance/fixtures.d.ts.map +1 -1
- package/package.json +13 -10
package/dist/esm/format/index.js
CHANGED
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
* so now does the pragma kernel — the reason the rules live here rather than
|
|
16
16
|
* in either host.
|
|
17
17
|
*/
|
|
18
|
+
// The wizard's outcome glyphs. Re-exported off this LIGHT seam (progressWindow
|
|
19
|
+
// imports nothing) so a host can pin its own rendering vocabulary against the
|
|
20
|
+
// wizard's without loading summon-core proper — the pragma CLI's
|
|
21
|
+
// renderVocabularySync test does exactly that.
|
|
22
|
+
export { COMPLETED_GLYPH, FAILURE_GLYPH, } from "../prompt/ink/progressWindow.js";
|
|
18
23
|
export { buildReplayCommand, effectStyleFor, formatContentPreview, formatEffectLine, formatEffectWithContent, formatLlmHelp, formatLlmJson, formatLlmMarkdown, getActionColor, getActionLabel, getEffectPayload, getLanguageHint, getLlmActionLabel, getLlmEffectPath, isVisibleEffect, visiblePlanEffects, } from "./effects.js";
|
|
19
24
|
export { default as formatFlagName } from "./formatFlagName.js";
|
|
20
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/format/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/format/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,+EAA+E;AAC/E,8EAA8E;AAC9E,iEAAiE;AACjE,+CAA+C;AAC/C,OAAO,EACL,eAAe,EACf,aAAa,GACd,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqBH,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAW1B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GAChB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqBH,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAW1B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAmB5B,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,SAAS,EACT,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,gFAAgF;AAChF,iDAAiD;AACjD,gFAAgF;AAEhF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAalD,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAE7B,gFAAgF;AAChF,+CAA+C;AAC/C,gFAAgF;AAEhF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import { describeEffect } from "@canonical/task";
|
|
9
9
|
import { Box, Static, Text, useInput } from "ink";
|
|
10
10
|
import { useEffect, useState } from "react";
|
|
11
|
-
import { truncateMiddle } from "./progressWindow.js";
|
|
11
|
+
import { COMPLETED_GLYPH, describedWidthBudget, FAILURE_GLYPH, formatEffectDuration, truncateMiddle, } from "./progressWindow.js";
|
|
12
12
|
import { AnswersTable, ProgressHeader, QuestionView } from "./prompts.js";
|
|
13
13
|
import { Spinner } from "./Spinner.js";
|
|
14
14
|
/** A compact summary of the effects the confirm gate is about to apply. */
|
|
@@ -62,14 +62,46 @@ const EffectsSummary = ({ effects }) => {
|
|
|
62
62
|
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { bold: true, dimColor: true, children: "Operations:" }), rows.map((row) => (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [" ", row.label.padEnd(width), " "] }), _jsx(Text, { color: "green", children: row.count })] }, row.label)))] }));
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
|
-
* Live progress: the file effects completed so far.
|
|
65
|
+
* Live progress: the file effects completed so far, each with what it cost.
|
|
66
66
|
*
|
|
67
67
|
* The completed lines render under Ink's `<Static>` (C7): each is printed ONCE,
|
|
68
68
|
* to the scrollback above the live region, instead of the whole history being
|
|
69
69
|
* re-rendered on every new effect — the flicker/scroll a big scaffold otherwise
|
|
70
70
|
* caused. Each line is middle-truncated so a long path stays on ONE row. Only
|
|
71
71
|
* the trailing spinner remains in the live (re-rendered) frame.
|
|
72
|
+
*
|
|
73
|
+
* The trailing `(12ms)` is the duration the seam already delivers per effect
|
|
74
|
+
* (`SessionController.reportEffectComplete`) — same spelling as the summon
|
|
75
|
+
* binary's timed view. The description is truncated against a budget that has
|
|
76
|
+
* everything rendered around it — the `✓ ` prefix as well as the suffix —
|
|
77
|
+
* reserved out of it ({@link describedWidthBudget}), so neither the glyph nor
|
|
78
|
+
* the timing can push the row past the one-line cap.
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* Live progress in the HOST's units — rendered whenever the host has reported
|
|
82
|
+
* steps ({@link SessionController.reportStep}), in place of the per-effect
|
|
83
|
+
* transcript below. One row per step: a settled row wears the shared outcome
|
|
84
|
+
* glyph and its wall time, the running one a spinner. The glyphs, the duration
|
|
85
|
+
* spelling and the one-row truncation are the transcript's own — the two views
|
|
86
|
+
* share one dialect; they differ only in what a row IS.
|
|
87
|
+
*
|
|
88
|
+
* Rendered in the LIVE region, never under `<Static>`, and that is
|
|
89
|
+
* load-bearing: `execute` walks `generate` on the mock interpreter once after
|
|
90
|
+
* consent (the outcome summary's file list), so the board fills with
|
|
91
|
+
* near-zero-duration rows once before the real drive resets and repaints it
|
|
92
|
+
* (see {@link SessionController.reportStep}) — and a static row cannot be
|
|
93
|
+
* taken back. The list is bounded by the host's own step count (one row per
|
|
94
|
+
* setup target), so the full-repaint cost `<Static>` exists to avoid does not
|
|
95
|
+
* arise.
|
|
72
96
|
*/
|
|
97
|
+
const StepRow = ({ step }) => {
|
|
98
|
+
if (step.status === "running") {
|
|
99
|
+
return (_jsx(Box, { children: _jsx(Spinner, { color: "blue", label: truncateMiddle(step.label, describedWidthBudget("")) }) }));
|
|
100
|
+
}
|
|
101
|
+
const duration = formatEffectDuration(step.duration ?? 0);
|
|
102
|
+
return (_jsxs(Text, { children: [step.status === "failed" ? (_jsx(Text, { color: "red", children: FAILURE_GLYPH })) : (_jsx(Text, { color: "green", children: COMPLETED_GLYPH })), " ", truncateMiddle(step.label, describedWidthBudget(duration)), " ", _jsx(Text, { dimColor: true, children: duration })] }));
|
|
103
|
+
};
|
|
104
|
+
const StepsProgress = ({ state }) => (_jsx(Box, { flexDirection: "column", children: state.steps.map((step) => (_jsx(StepRow, { step: step }, step.key))) }));
|
|
73
105
|
const Progress = ({ state }) => {
|
|
74
106
|
const shown = state.progress.filter((t) => t.effect._tag !== "Log" &&
|
|
75
107
|
t.effect._tag !== "Exists" &&
|
|
@@ -79,9 +111,12 @@ const Progress = ({ state }) => {
|
|
|
79
111
|
t.effect._tag !== "Prompt" &&
|
|
80
112
|
t.effect._tag !== "Parallel" &&
|
|
81
113
|
t.effect._tag !== "Race");
|
|
82
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: shown, children: (t, i) =>
|
|
83
|
-
|
|
84
|
-
|
|
114
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: shown, children: (t, i) => {
|
|
115
|
+
const duration = formatEffectDuration(t.duration);
|
|
116
|
+
return (
|
|
117
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: append-only progress; a path may repeat
|
|
118
|
+
_jsxs(Text, { children: [_jsx(Text, { color: "green", children: COMPLETED_GLYPH }), " ", truncateMiddle(describeEffect(t.effect), describedWidthBudget(duration)), " ", _jsx(Text, { dimColor: true, children: duration })] }, `${t.effect._tag}-${i}`));
|
|
119
|
+
} }), state.phase === "executing" && (_jsx(Box, { children: _jsx(Spinner, { color: "blue", label: "Generating\u2026" }) }))] }));
|
|
85
120
|
};
|
|
86
121
|
/** The wizard view — subscribes to the controller and renders its phase. */
|
|
87
122
|
export const Wizard = ({ controller }) => {
|
|
@@ -102,15 +137,16 @@ export const Wizard = ({ controller }) => {
|
|
|
102
137
|
controller.submitConfirm(false);
|
|
103
138
|
}, { isActive: state.phase === "confirming" });
|
|
104
139
|
const { generator } = state;
|
|
105
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, color: "magenta", children: generator.meta.name }), _jsxs(Text, { dimColor: true, children: [" v", generator.meta.version] })] }), state.phase === "idle" && _jsx(Spinner, { label: "Loading\u2026" }), state.phase === "prompting" && state.activeQuestion && (_jsxs(Box, { flexDirection: "column", children: [_jsx(ProgressHeader, { current: state.step, total: state.total }), _jsx(AnswersTable, { prompts: generator.prompts, answers: state.answers }), _jsx(QuestionView, { question: state.activeQuestion.question, validate: generator.prompts.find((p) => p.name === state.activeQuestion?.question.name)?.validate, onSubmit: (value) => controller.submitAnswer(value), onCancel: () => controller.cancel() })] })), state.phase === "confirming" && (_jsxs(Box, { flexDirection: "column", children: [_jsx(AnswersTable, { prompts: generator.prompts, answers: state.answers }), _jsx(EffectsSummary, { effects: state.previewEffects }), _jsxs(Box, { children: [_jsx(Text, { color: "magenta", children: "\u203A " }), _jsx(Text, { bold: true, children: "Proceed? " }), _jsx(Text, { dimColor: true, children: "(Y/n)" })] })] })), (state.phase === "executing" || state.phase === "complete") &&
|
|
140
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, color: "magenta", children: generator.meta.name }), _jsxs(Text, { dimColor: true, children: [" v", generator.meta.version] })] }), state.phase === "idle" && _jsx(Spinner, { label: "Loading\u2026" }), state.phase === "prompting" && state.activeQuestion && (_jsxs(Box, { flexDirection: "column", children: [_jsx(ProgressHeader, { current: state.step, total: state.total }), _jsx(AnswersTable, { prompts: generator.prompts, answers: state.answers }), _jsx(QuestionView, { question: state.activeQuestion.question, validate: generator.prompts.find((p) => p.name === state.activeQuestion?.question.name)?.validate, onSubmit: (value) => controller.submitAnswer(value), onCancel: () => controller.cancel() }, state.activeQuestion.question.name)] })), state.phase === "confirming" && (_jsxs(Box, { flexDirection: "column", children: [_jsx(AnswersTable, { prompts: generator.prompts, answers: state.answers }), _jsx(EffectsSummary, { effects: state.previewEffects }), _jsxs(Box, { children: [_jsx(Text, { color: "magenta", children: "\u203A " }), _jsx(Text, { bold: true, children: "Proceed? " }), _jsx(Text, { dimColor: true, children: "(Y/n)" })] })] })), (state.phase === "executing" || state.phase === "complete") &&
|
|
141
|
+
(state.steps.length > 0 ? (_jsx(StepsProgress, { state: state })) : (_jsx(Progress, { state: state }))), state.phase === "complete" && state.steps.length === 0 && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "green", children: [COMPLETED_GLYPH, " Generation complete!"] }) })), state.phase === "cancelled" &&
|
|
106
142
|
(() => {
|
|
107
143
|
// Truthful (H2): a Ctrl-C mid-execution may have written some files
|
|
108
144
|
// before the abort landed, so count the completed write-like effects
|
|
109
145
|
// the session already tracked rather than always claiming none.
|
|
110
146
|
const written = state.progress.filter((t) => ["WriteFile", "AppendFile", "Symlink", "CopyFile"].includes(t.effect._tag)).length;
|
|
111
|
-
return (_jsxs(Text, { color: "yellow", children: ["
|
|
147
|
+
return (_jsxs(Text, { color: "yellow", children: [FAILURE_GLYPH, " Cancelled.", " ", written === 0
|
|
112
148
|
? "No files were written."
|
|
113
149
|
: `${written} file(s) were written.`] }));
|
|
114
|
-
})(), state.phase === "error" && (_jsxs(Text, { color: "red", children: ["
|
|
150
|
+
})(), state.phase === "error" && (_jsxs(Text, { color: "red", children: [FAILURE_GLYPH, " Error: ", state.error?.message] }))] }));
|
|
115
151
|
};
|
|
116
152
|
//# sourceMappingURL=Wizard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wizard.js","sourceRoot":"","sources":["../../../../src/prompt/ink/Wizard.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAe,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,EAAE,S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AG,EAAE;oBACJ,oEAAoE;oBACpE,qEAAqE;oBACrE,gEAAgE;oBAChE,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1C,CAAC,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,QAAQ,CACzD,CAAC,CAAC,MAAM,CAAC,IAAI,CACd,CACF,CAAC,MAAM,CAAC;oBACT,OAAO,CACL,MAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,aACjB,aAAa,iBAAa,GAAG,EAC7B,OAAO,KAAK,CAAC;gCACZ,CAAC,CAAC,wBAAwB;gCAC1B,CAAC,CAAC,GAAG,OAAO,wBAAwB,IACjC,CACR,CAAC;gBACJ,CAAC,CAAC,EAAE,EAEL,KAAK,CAAC,KAAK,KAAK,OAAO,IAAI,CAC1B,MAAC,IAAI,IAAC,KAAK,EAAC,KAAK,aACd,aAAa,cAAU,KAAK,CAAC,KAAK,EAAE,OAAO,IACvC,CACR,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -24,19 +24,31 @@ export function mountPromptSession(generator, options = {}) {
|
|
|
24
24
|
const { signal } = options;
|
|
25
25
|
const onAbort = () => controller.cancel();
|
|
26
26
|
signal?.addEventListener("abort", onAbort);
|
|
27
|
-
let
|
|
27
|
+
let disposal;
|
|
28
28
|
return {
|
|
29
29
|
answerPrompt: (effect) => controller.request(effect),
|
|
30
30
|
reportEffectStart: (effect) => controller.reportEffectStart(effect),
|
|
31
31
|
reportEffectComplete: (effect, duration) => controller.reportEffectComplete(effect, duration),
|
|
32
32
|
reportLog: (level, message) => controller.reportLog(level, message),
|
|
33
|
+
reportStep: (report) => controller.reportStep(report),
|
|
33
34
|
dispose: () => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
// MEMOIZED, not boolean-guarded: every caller — however many, however
|
|
36
|
+
// concurrent — gets THE one disposal. A guard that returned early made
|
|
37
|
+
// a second concurrent dispose() resolve BEFORE the first had flushed
|
|
38
|
+
// the final frame, which breaks the contract awaiting dispose() exists
|
|
39
|
+
// for: a caller could print into a still-mounted UI.
|
|
40
|
+
disposal ??= (async () => {
|
|
41
|
+
controller.markComplete();
|
|
42
|
+
signal?.removeEventListener("abort", onAbort);
|
|
43
|
+
// Let React COMMIT the state just reported (markComplete, and a run's
|
|
44
|
+
// last effect/step — its scheduler commits on a macrotask) before the
|
|
45
|
+
// unmount flushes the final frame. Unmounting in the same continuation
|
|
46
|
+
// flushed the previously committed tree, so the last row of a run was
|
|
47
|
+
// permanently painted as still in progress.
|
|
48
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
49
|
+
instance.unmount();
|
|
50
|
+
})();
|
|
51
|
+
return disposal;
|
|
40
52
|
},
|
|
41
53
|
};
|
|
42
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../../../../src/prompt/ink/mount.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../../../../src/prompt/ink/mount.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAYrC;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAA8B,EAC9B,UAA4B,EAAE;IAE9B,8DAA8D;IAC9D,6EAA6E;IAC7E,6EAA6E;IAC7E,0DAA0D;IAC1D,MAAM,UAAU,GAAG,IAAI,iBAAiB,CACt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AAC,CAAC;gBAC9C,sEAAsE;gBACtE,sEAAsE;gBACtE,uEAAuE;gBACvE,sEAAsE;gBACtE,4CAA4C;gBAC5C,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;gBACtD,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrB,CAAC,CAAC,EAAE,CAAC;YACL,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -14,12 +14,95 @@
|
|
|
14
14
|
* wide glyphs overflow and wrap. {@link measureDisplayWidth} is the shared
|
|
15
15
|
* width approximation both concerns rely on.
|
|
16
16
|
*
|
|
17
|
+
* Width is also STYLE-invariant: SGR escape sequences (the bytes `chalk` emits
|
|
18
|
+
* for `<Text color="green">`) occupy no cells, so {@link stripStyles} removes
|
|
19
|
+
* them before anything is counted. Whether the process happens to have colour
|
|
20
|
+
* enabled therefore cannot change how wide a row measures — see that helper for
|
|
21
|
+
* why that mattered.
|
|
22
|
+
*
|
|
17
23
|
* A `.ts` sibling of the JSX view so the string math is unit testable.
|
|
18
24
|
*/
|
|
19
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Max display columns a single RENDERED progress line may occupy — status
|
|
27
|
+
* glyph, description and duration suffix together. Everything but the
|
|
28
|
+
* description is fixed, so {@link describedWidthBudget} spends what is left of
|
|
29
|
+
* this cap on the description alone.
|
|
30
|
+
*/
|
|
20
31
|
export const MAX_PROGRESS_LINE = 72;
|
|
21
32
|
/** The single-column marker inserted where a truncated middle was elided. */
|
|
22
33
|
export const TRUNCATION_MARKER = "…";
|
|
34
|
+
/**
|
|
35
|
+
* The single space that separates a completed effect's description from its
|
|
36
|
+
* trailing duration suffix. Named because {@link describedWidthBudget} must
|
|
37
|
+
* reserve it, and a line that forgot it would be one column over the cap.
|
|
38
|
+
*/
|
|
39
|
+
const SUFFIX_GAP = 1;
|
|
40
|
+
/**
|
|
41
|
+
* The status glyph a COMPLETED progress line opens with, rendered green by
|
|
42
|
+
* `Wizard.tsx`. Exported so the view and the budget cannot drift: the columns
|
|
43
|
+
* the glyph costs are reserved here, and a fork that changed the glyph in the
|
|
44
|
+
* view alone would silently reopen the overflow this reservation closes.
|
|
45
|
+
*/
|
|
46
|
+
export const COMPLETED_GLYPH = "✓";
|
|
47
|
+
/**
|
|
48
|
+
* The status glyph for a run that did NOT complete — the error and cancel
|
|
49
|
+
* lines `Wizard.tsx` ends on. Named beside {@link COMPLETED_GLYPH} so the
|
|
50
|
+
* wizard's outcome marks are one vocabulary in one place rather than literals
|
|
51
|
+
* scattered through the view — and exported (via `@canonical/summon-core/
|
|
52
|
+
* format`) so the pragma CLI's render-vocabulary sync test can pin both marks
|
|
53
|
+
* to byte equality with its own: the two binaries narrate the same run, and a
|
|
54
|
+
* reader must not have to learn a second dialect for the same fact.
|
|
55
|
+
*/
|
|
56
|
+
export const FAILURE_GLYPH = "✗";
|
|
57
|
+
/**
|
|
58
|
+
* The single space between {@link COMPLETED_GLYPH} and the description. Sibling
|
|
59
|
+
* of {@link SUFFIX_GAP}, and reserved for the same reason.
|
|
60
|
+
*/
|
|
61
|
+
const GLYPH_GAP = 1;
|
|
62
|
+
/**
|
|
63
|
+
* Format a completed effect's duration as the suffix its progress line ends
|
|
64
|
+
* with — `(12ms)`, whole milliseconds.
|
|
65
|
+
*
|
|
66
|
+
* The spelling is deliberately IDENTICAL to the summon binary's own timed
|
|
67
|
+
* progress view (`ExecutionProgress.tsx`): the two binaries render the same
|
|
68
|
+
* run, and a reader who has seen one must not have to learn a second dialect
|
|
69
|
+
* for the same fact.
|
|
70
|
+
*
|
|
71
|
+
* @param durationMs - The effect's measured duration, in milliseconds.
|
|
72
|
+
* @returns The parenthesised suffix, e.g. `(12ms)`.
|
|
73
|
+
*/
|
|
74
|
+
export function formatEffectDuration(durationMs) {
|
|
75
|
+
return `(${durationMs.toFixed(0)}ms)`;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The display columns left for the DESCRIBED middle of a progress line once
|
|
79
|
+
* everything rendered AROUND it is reserved out of `max`: the leading
|
|
80
|
+
* {@link COMPLETED_GLYPH} and its space, and the trailing duration suffix and
|
|
81
|
+
* the space before it.
|
|
82
|
+
*
|
|
83
|
+
* The one-row guarantee is about the WHOLE rendered row — that is the thing the
|
|
84
|
+
* terminal has to fit — so the description alone can no longer spend the entire
|
|
85
|
+
* cap: appending `(1234ms)` to a line already at {@link MAX_PROGRESS_LINE}
|
|
86
|
+
* would wrap, which is exactly the jitter the truncation exists to prevent. The
|
|
87
|
+
* glyph is reserved for the same reason and was the earlier miss: a budget that
|
|
88
|
+
* covered only the suffix let `Wizard.tsx` emit `MAX_PROGRESS_LINE + 2` columns
|
|
89
|
+
* — overflowing on precisely the boundary this helper protects.
|
|
90
|
+
*
|
|
91
|
+
* Budgeting here (rather than truncating the joined line) keeps the timing
|
|
92
|
+
* legible — it is the part a middle-truncation would never protect, since it
|
|
93
|
+
* sits at neither end of the description.
|
|
94
|
+
*
|
|
95
|
+
* @param suffix - The rendered duration suffix, from {@link formatEffectDuration}.
|
|
96
|
+
* @param max - The whole-ROW width cap; defaults to {@link MAX_PROGRESS_LINE}.
|
|
97
|
+
* @returns The columns the description may occupy, never negative.
|
|
98
|
+
*/
|
|
99
|
+
export function describedWidthBudget(suffix, max = MAX_PROGRESS_LINE) {
|
|
100
|
+
const around = measureDisplayWidth(COMPLETED_GLYPH) +
|
|
101
|
+
GLYPH_GAP +
|
|
102
|
+
SUFFIX_GAP +
|
|
103
|
+
measureDisplayWidth(suffix);
|
|
104
|
+
return Math.max(0, max - around);
|
|
105
|
+
}
|
|
23
106
|
/**
|
|
24
107
|
* East Asian Wide / Fullwidth / emoji code-point ranges, each an inclusive
|
|
25
108
|
* `[low, high]` pair. A code point inside any range is rendered by terminals in
|
|
@@ -74,18 +157,58 @@ function decodeCodePoint(char) {
|
|
|
74
157
|
const low = char.charCodeAt(1);
|
|
75
158
|
return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;
|
|
76
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* An ANSI CSI escape sequence — `ESC [`, parameter and intermediate bytes, then
|
|
162
|
+
* a final byte. Built with `RegExp` rather than written as a literal because the
|
|
163
|
+
* pattern must contain a raw control character (`ESC`), which a regex literal
|
|
164
|
+
* may not carry.
|
|
165
|
+
*
|
|
166
|
+
* Broad on purpose: the styling `chalk` emits is all SGR (`…m`), but a captured
|
|
167
|
+
* frame can also carry cursor and erase sequences, and none of them occupy a
|
|
168
|
+
* terminal cell.
|
|
169
|
+
*/
|
|
170
|
+
const ANSI_ESCAPE = new RegExp(`${String.fromCharCode(27)}\\[[0-9;:?]*[ -/]*[@-~]`, "g");
|
|
171
|
+
/**
|
|
172
|
+
* Remove ANSI escape sequences, leaving only the characters a terminal actually
|
|
173
|
+
* prints.
|
|
174
|
+
*
|
|
175
|
+
* The rendered frame is styled — `Wizard.tsx` wraps the status glyph in
|
|
176
|
+
* `<Text color="green">` and the duration in `<Text dimColor>`, and Ink renders
|
|
177
|
+
* those through `chalk` — so a completed progress row reaches a reader (or a
|
|
178
|
+
* test) as `ESC[32m✓ESC[39m … ESC[2m(5ms)ESC[22m`. Those 19 bytes are
|
|
179
|
+
* instructions to the terminal, not columns in it.
|
|
180
|
+
*
|
|
181
|
+
* Whether they are present at all depends on the environment: `chalk` enables
|
|
182
|
+
* colour only when it believes the stream is a terminal, so the SAME frame is
|
|
183
|
+
* bare under a plain `vitest` run and styled when the task runs under a task
|
|
184
|
+
* runner that allocates a pseudo-terminal (which is how CI invokes this suite).
|
|
185
|
+
* Counting the escapes as columns therefore made the measured width of one
|
|
186
|
+
* fixed row swing between 72 and 91 — a one-row guarantee that held or failed
|
|
187
|
+
* on the shape of the invoking shell. Stripping first makes the measurement say
|
|
188
|
+
* the same thing everywhere.
|
|
189
|
+
*
|
|
190
|
+
* @param text - Possibly styled text, e.g. a captured Ink frame.
|
|
191
|
+
* @returns `text` with every ANSI escape sequence removed.
|
|
192
|
+
*/
|
|
193
|
+
export function stripStyles(text) {
|
|
194
|
+
return text.replace(ANSI_ESCAPE, "");
|
|
195
|
+
}
|
|
77
196
|
/**
|
|
78
197
|
* Measure the terminal-column width of a string, summing per-code-point widths:
|
|
79
198
|
* one column for most code points, two for East Asian Wide / emoji ones (see
|
|
80
199
|
* {@link isWideCodePoint}). Iterating code points rather than UTF-16 code units
|
|
81
200
|
* means a surrogate pair counts once, as the single glyph it renders to.
|
|
82
201
|
*
|
|
83
|
-
* @
|
|
202
|
+
* Styling is discounted first ({@link stripStyles}): an escape sequence costs
|
|
203
|
+
* bytes but no cells, so the width of a row is the same number whether or not
|
|
204
|
+
* colour is enabled.
|
|
205
|
+
*
|
|
206
|
+
* @param text - The string to measure; may carry ANSI styling.
|
|
84
207
|
* @returns The approximate number of terminal columns `text` occupies.
|
|
85
208
|
*/
|
|
86
209
|
export function measureDisplayWidth(text) {
|
|
87
210
|
let width = 0;
|
|
88
|
-
for (const char of text) {
|
|
211
|
+
for (const char of stripStyles(text)) {
|
|
89
212
|
width += isWideCodePoint(decodeCodePoint(char)) ? 2 : 1;
|
|
90
213
|
}
|
|
91
214
|
return width;
|
|
@@ -122,6 +245,11 @@ function collectWithinWidth(chars, budget) {
|
|
|
122
245
|
* code points, so the one-row guarantee holds for multibyte and wide (CJK /
|
|
123
246
|
* emoji) paths and a surrogate pair is never split into a lone-surrogate `�`.
|
|
124
247
|
*
|
|
248
|
+
* `line` must be UNSTYLED text — the description `Wizard.tsx` truncates before
|
|
249
|
+
* handing it to Ink, which applies the colour. Cutting a line that already
|
|
250
|
+
* carried escape sequences could sever one mid-sequence; the styling is applied
|
|
251
|
+
* around the truncated text precisely so that cannot arise.
|
|
252
|
+
*
|
|
125
253
|
* @param line - The described-effect line (e.g. `Write file: a/b/c.ts (12 bytes)`).
|
|
126
254
|
* @param max - The width cap, in columns; defaults to {@link MAX_PROGRESS_LINE}.
|
|
127
255
|
* @returns The line unchanged when within the cap, else its truncated form.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressWindow.js","sourceRoot":"","sources":["../../../../src/prompt/ink/progressWindow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"progressWindow.js","sourceRoot":"","sources":["../../../../src/prompt/ink/progressWindow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC;;;GAGG;AACH,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB;IACrD,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAc,EACd,MAAc,iBAAiB;IAE/B,MAAM,MAAM,GACV,mBAAmB,CAAC,eAAe,CAAC;QACpC,SAAS;QACT,UAAU;QACV,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,GAA2C;IAC1D,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc;IAChC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,kDAAkD;IACpE,CAAC,MAAM,EA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,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACxB,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACnD,6EAA6E;IAC7E,kEAAkE;IAClE,MAAM,YAAY,GAAG,kBAAkB,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;IAC1E,MAAM,IAAI,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClD,OAAO,GAAG,IAAI,GAAG,iBAAiB,GAAG,IAAI,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -69,6 +69,7 @@ export class SessionController {
|
|
|
69
69
|
total: countApplicable(generator, { ...initialAnswers }),
|
|
70
70
|
previewEffects: [],
|
|
71
71
|
progress: [],
|
|
72
|
+
steps: [],
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
/** Subscribe to state changes; returns an unsubscribe function. */
|
|
@@ -138,8 +139,14 @@ export class SessionController {
|
|
|
138
139
|
catch {
|
|
139
140
|
previewEffects = [];
|
|
140
141
|
}
|
|
141
|
-
|
|
142
|
+
// Stale once the gate is no longer both showing AND unanswered. The phase
|
|
143
|
+
// check alone stopped covering the second half when submitConfirm began
|
|
144
|
+
// deferring the executing transition on this very promise: consent clears
|
|
145
|
+
// `pending` immediately but flips the phase only after this settles, so a
|
|
146
|
+
// result landing in that window would repaint a pane already answered.
|
|
147
|
+
if (this.current.phase !== "confirming" || this.pending === undefined) {
|
|
142
148
|
return;
|
|
149
|
+
}
|
|
143
150
|
this.set({ previewEffects });
|
|
144
151
|
}
|
|
145
152
|
/**
|
|
@@ -158,16 +165,79 @@ export class SessionController {
|
|
|
158
165
|
reportEffectStart(_effect) {
|
|
159
166
|
// No-op: the live view is driven by reportEffectComplete.
|
|
160
167
|
}
|
|
161
|
-
/**
|
|
162
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Record a completed effect — and what it cost — for the live progress view.
|
|
170
|
+
* The seam delivers a per-effect `duration`; it is stored, not discarded, so
|
|
171
|
+
* the view can say how long each step took.
|
|
172
|
+
*/
|
|
173
|
+
reportEffectComplete(effect, duration) {
|
|
163
174
|
const timestamp = this.executionStart > 0 ? performance.now() - this.executionStart : 0;
|
|
164
175
|
this.set({
|
|
165
176
|
phase: this.current.phase === "cancelled" ? "cancelled" : "executing",
|
|
166
|
-
progress: [...this.current.progress, { effect, timestamp }],
|
|
177
|
+
progress: [...this.current.progress, { effect, timestamp, duration }],
|
|
167
178
|
});
|
|
168
179
|
}
|
|
169
180
|
/** A task log line (kept for parity; not surfaced by the default view). */
|
|
170
181
|
reportLog(_level, _message) { }
|
|
182
|
+
/** Per-step `start` timestamps, so completion can measure wall time. */
|
|
183
|
+
stepStarts = new Map();
|
|
184
|
+
/**
|
|
185
|
+
* Fold a host step report into the live view (see {@link StepProgress}).
|
|
186
|
+
*
|
|
187
|
+
* GATED to the executing phase, unlike {@link reportEffectComplete}: effect
|
|
188
|
+
* callbacks only ever arrive from the real interpreter through the seam, but
|
|
189
|
+
* step reports originate INSIDE the host's task composition, so every
|
|
190
|
+
* interpretation of it fires them — including the confirm gate's own honest
|
|
191
|
+
* preview, which walks the same task before the user has consented. Dropping
|
|
192
|
+
* reports outside `executing` keeps a previewed step from painting itself
|
|
193
|
+
* as work in progress — and the gate is sound only because of the pairing
|
|
194
|
+
* invariant {@link submitConfirm} enforces: `executing` begins strictly
|
|
195
|
+
* AFTER the preview walk has completed (consent is released on
|
|
196
|
+
* `previewSettled()`), so no pre-consent walk can still be emitting once
|
|
197
|
+
* reports are accepted. Testing arrival time alone could not close that —
|
|
198
|
+
* a report says nothing about which walk produced it.
|
|
199
|
+
*
|
|
200
|
+
* The phase gate alone is still not enough: `execute` walks `generate` once
|
|
201
|
+
* more on the MOCK interpreter right after consent — synchronously, to give
|
|
202
|
+
* the outcome summary its file list — so a full set of settled steps arrives
|
|
203
|
+
* (in-phase, near-zero durations) before the real drive begins. Steps run
|
|
204
|
+
* sequentially with per-walk-unique keys, so a `start` for a key that has
|
|
205
|
+
* ALREADY settled can only mean a new interpretation: the board resets and
|
|
206
|
+
* the real walk repaints it with real timings. This is also why the view
|
|
207
|
+
* renders steps in the LIVE region, never under `<Static>` — a static row
|
|
208
|
+
* cannot be taken back, and the mock walk's rows must be.
|
|
209
|
+
*/
|
|
210
|
+
reportStep(report) {
|
|
211
|
+
if (this.current.phase !== "executing")
|
|
212
|
+
return;
|
|
213
|
+
let steps = [...this.current.steps];
|
|
214
|
+
const at = steps.findIndex((step) => step.key === report.key);
|
|
215
|
+
let entry;
|
|
216
|
+
if (report.status === "start") {
|
|
217
|
+
if (at >= 0 && steps[at]?.status !== "running") {
|
|
218
|
+
// A settled key starting again: a fresh walk. Reset the board.
|
|
219
|
+
steps = [];
|
|
220
|
+
this.stepStarts.clear();
|
|
221
|
+
}
|
|
222
|
+
this.stepStarts.set(report.key, performance.now());
|
|
223
|
+
entry = { key: report.key, label: report.label, status: "running" };
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
const started = this.stepStarts.get(report.key);
|
|
227
|
+
entry = {
|
|
228
|
+
key: report.key,
|
|
229
|
+
label: report.label,
|
|
230
|
+
status: report.status,
|
|
231
|
+
duration: started === undefined ? 0 : performance.now() - started,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
const target = steps.findIndex((step) => step.key === report.key);
|
|
235
|
+
if (target >= 0)
|
|
236
|
+
steps[target] = entry;
|
|
237
|
+
else
|
|
238
|
+
steps.push(entry);
|
|
239
|
+
this.set({ steps });
|
|
240
|
+
}
|
|
171
241
|
/** Mark the run complete (the view flashes a completion summary). */
|
|
172
242
|
markComplete() {
|
|
173
243
|
if (this.current.phase === "cancelled" || this.current.phase === "error")
|
|
@@ -197,16 +267,52 @@ export class SessionController {
|
|
|
197
267
|
listener();
|
|
198
268
|
pending.resolve(value);
|
|
199
269
|
}
|
|
200
|
-
/**
|
|
270
|
+
/**
|
|
271
|
+
* The user answered the confirm gate.
|
|
272
|
+
*
|
|
273
|
+
* Consent does NOT begin execution by itself. The gate's honest preview
|
|
274
|
+
* ({@link loadPreview}) walks the same `generate` the run will, and it is
|
|
275
|
+
* async — a fast Y can land while that walk is still in flight. Entering
|
|
276
|
+
* `executing` at that instant re-opened the gap {@link reportStep}'s phase
|
|
277
|
+
* gate exists to close: the pre-consent walk's late step reports arrived
|
|
278
|
+
* in-phase and were accepted, and one naming a key the real walk had
|
|
279
|
+
* already settled hit the fresh-walk reset and cleared the board mid-run.
|
|
280
|
+
* Step reports carry no walk identity — they are plain closures fired from
|
|
281
|
+
* task continuations — so the sound closure is to ensure NO pre-consent
|
|
282
|
+
* walk survives into the executing phase: consent is released only once
|
|
283
|
+
* {@link previewSettled} resolves, which is `runPreview` COMPLETING its
|
|
284
|
+
* walk (loadPreview catches its failure), not merely having started it.
|
|
285
|
+
* The pane has usually settled long before the user answers, so the
|
|
286
|
+
* deferral is normally one microtask.
|
|
287
|
+
*
|
|
288
|
+
* A cancel that lands while consent waits on the preview rejects the gate
|
|
289
|
+
* here, with the same `GENERATOR_CANCELLED` an at-prompt cancel carries —
|
|
290
|
+
* {@link cancel} cannot reach it, this method already claimed the pending
|
|
291
|
+
* slot — so the task fails cleanly instead of hanging on a prompt that
|
|
292
|
+
* would otherwise never settle.
|
|
293
|
+
*/
|
|
201
294
|
submitConfirm(proceed) {
|
|
202
295
|
const pending = this.pending;
|
|
203
296
|
if (!pending || !pending.isConfirm)
|
|
204
297
|
return;
|
|
205
298
|
this.pending = undefined;
|
|
206
|
-
if (proceed)
|
|
299
|
+
if (!proceed) {
|
|
300
|
+
this.set({ phase: "cancelled" });
|
|
301
|
+
pending.resolve(false);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
void this.previewSettled().then(() => {
|
|
305
|
+
if (this.current.phase === "cancelled") {
|
|
306
|
+
pending.reject(new TaskExecutionError({
|
|
307
|
+
code: GENERATOR_CANCELLED,
|
|
308
|
+
message: "Cancelled.",
|
|
309
|
+
}));
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
207
312
|
this.executionStart = performance.now();
|
|
208
|
-
|
|
209
|
-
|
|
313
|
+
this.set({ phase: "executing" });
|
|
314
|
+
pending.resolve(true);
|
|
315
|
+
});
|
|
210
316
|
}
|
|
211
317
|
/**
|
|
212
318
|
* The user cancelled (Ctrl-C / escape). Two things must happen, and both are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../../src/prompt/ink/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAIL,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../../src/prompt/ink/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAIL,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAmElC,2EAA2E;AAC3E,SAAS,qBAAqB,CAC5B,SAA8B,EAC9B,OAAgC;IAEhC,OAAO,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,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OAAO,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACtB,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QACjC,OAAO,EAAE,MAAM,CACb,IAAI,kBAAkB,CAAC;YACrB,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,YAAY;SACtB,CAAC,CACH,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -58,7 +58,14 @@ export default function inkPrompt(generator, options = {}) {
|
|
|
58
58
|
onEffectStart: (effect) => mounted?.reportEffectStart(effect),
|
|
59
59
|
onEffectComplete: (effect, duration) => mounted?.reportEffectComplete(effect, duration),
|
|
60
60
|
onLog: (level, message) => mounted?.reportLog(level, message),
|
|
61
|
-
|
|
61
|
+
// Steps can only originate from the running task, and the session mounts
|
|
62
|
+
// on the FIRST Prompt effect — which precedes execution (the confirm gate
|
|
63
|
+
// is itself a prompt) — so by the time a step is reported the session
|
|
64
|
+
// exists; the guard only covers a host reporting outside a run.
|
|
65
|
+
reportStep: (report) => mounted?.reportStep(report),
|
|
66
|
+
dispose: async () => {
|
|
67
|
+
await mounted?.dispose();
|
|
68
|
+
},
|
|
62
69
|
};
|
|
63
70
|
}
|
|
64
71
|
//# sourceMappingURL=inkPrompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inkPrompt.js","sourceRoot":"","sources":["../../../src/prompt/inkPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"inkPrompt.js","sourceRoot":"","sources":["../../../src/prompt/inkPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;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gE;QAChE,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC;QACnD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,OAAO,EAAE,OAAO,EAAE,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -20,7 +20,7 @@ const COMPONENT_ANSWERS = {
|
|
|
20
20
|
withSsrTests: false,
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
* The design-system generator fixtures — the
|
|
23
|
+
* The design-system generator fixtures — the seven trees pragma's `create` verbs
|
|
24
24
|
* and summon's `execute` must agree on byte for byte.
|
|
25
25
|
*/
|
|
26
26
|
export const CONFORMANCE_FIXTURES = [
|
|
@@ -63,6 +63,38 @@ export const CONFORMANCE_FIXTURES = [
|
|
|
63
63
|
runInstall: false,
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
|
+
{
|
|
67
|
+
// The SPA arm. Nothing else in CI produces a client-only tree, so without
|
|
68
|
+
// this fixture `--rendering spa` would be exercised only by hand: here
|
|
69
|
+
// three independent producers build it and diff it byte for byte.
|
|
70
|
+
name: "application-spa",
|
|
71
|
+
generator: "application",
|
|
72
|
+
answers: {
|
|
73
|
+
appPath: "my-app",
|
|
74
|
+
forms: true,
|
|
75
|
+
intl: false,
|
|
76
|
+
relay: false,
|
|
77
|
+
rendering: "spa",
|
|
78
|
+
runInstall: false,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
// The SPA arm with every feature on. The bare fixture above renders none
|
|
83
|
+
// of the combination-only gates — `relay && spa` (an environment with no
|
|
84
|
+
// payloads to seed), `intl && spa` (negotiation with no server to have
|
|
85
|
+
// done it), the four-way provider stack in the client entry, and the
|
|
86
|
+
// nested intl/spa gates in the e2e template. This one renders all of them.
|
|
87
|
+
name: "application-spa-all",
|
|
88
|
+
generator: "application",
|
|
89
|
+
answers: {
|
|
90
|
+
appPath: "my-app",
|
|
91
|
+
forms: true,
|
|
92
|
+
intl: true,
|
|
93
|
+
relay: true,
|
|
94
|
+
rendering: "spa",
|
|
95
|
+
runInstall: false,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
66
98
|
];
|
|
67
99
|
/**
|
|
68
100
|
* Look up a fixture by name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,mFAAmF;AACnF,MAAM,iBAAiB,GAAG;IACxB,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,KAAK;CACX,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkC;IACjE;QACE,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,iBAAiB;QAC5B,OAAO,EAAE,EAAE,aAAa,EAAE,uBAAuB,EAAE,GAAG,iBAAiB,EAAE;KAC1E;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,kBAAkB;QAC7B,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE;KACnE;IACD;QACE,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,eAAe;QAC1B,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE;KACnE;IACD;QACE,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,YAAY;YACzB,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,KAAK;YACpB,OAAO,EAAE,KAAK;YACd,cAAc,EAAE,KAAK;YACrB,UAAU,EAAE,KAAK;SAClB;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,KAAK;YACZ,UAAU,EAAE,KAAK;SAClB;KACF;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACxE,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;IACtE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,mFAAmF;AACnF,MAAM,iBAAiB,GAAG;IACxB,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,KAAK;CACX,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkC;IACjE;QACE,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,iBAAiB;QAC5B,OAAO,EAAE,EAAE,aAAa,EAAE,uBAAuB,EAAE,GAAG,iBAAiB,EAAE;KAC1E;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,kBAAkB;QAC7B,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE;KACnE;IACD;QACE,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,eAAe;QAC1B,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE;KACnE;IACD;QACE,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAA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15,7 @@
|
|
|
15
15
|
* so now does the pragma kernel — the reason the rules live here rather than
|
|
16
16
|
* in either host.
|
|
17
17
|
*/
|
|
18
|
+
export { COMPLETED_GLYPH, FAILURE_GLYPH, } from "../prompt/ink/progressWindow.js";
|
|
18
19
|
export type { EffectColor, EffectStyle } from "./effects.js";
|
|
19
20
|
export { buildReplayCommand, effectStyleFor, formatContentPreview, formatEffectLine, formatEffectWithContent, formatLlmHelp, formatLlmJson, formatLlmMarkdown, getActionColor, getActionLabel, getEffectPayload, getLanguageHint, getLlmActionLabel, getLlmEffectPath, isVisibleEffect, visiblePlanEffects, } from "./effects.js";
|
|
20
21
|
export { default as formatFlagName } from "./formatFlagName.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/format/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/format/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EACL,eAAe,EACf,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type { RunTaskWithStampOptions } from "./stamp/index.js";
|
|
|
12
12
|
export { applyStamp, createGeneratorStamp, createStampOnEffectStart, runTaskWithStamp, } from "./stamp/index.js";
|
|
13
13
|
export type { AnswerablePrompt, ExecuteContext, GeneratorResult, } from "./execute/index.js";
|
|
14
14
|
export { CONFIRM_ANSWER_KEY, collectAnswers, execute, GENERATOR_CANCELLED, GENERATOR_INVALID_ANSWER, invalidAnswersError, isInvalidAnswersError, validateAnswers, } from "./execute/index.js";
|
|
15
|
-
export type { ConfirmPrompt, InkPromptOptions, InkSession, MultiselectPrompt, PromptEffect, PromptHandler, PromptQuestion, SelectPrompt, TextPrompt, } from "./prompt/index.js";
|
|
15
|
+
export type { ConfirmPrompt, InkPromptOptions, InkSession, MultiselectPrompt, PromptEffect, PromptHandler, PromptQuestion, SelectPrompt, StepReport, TextPrompt, } from "./prompt/index.js";
|
|
16
16
|
export { answerPromptWithDefaults, autoPrompt, inkPrompt, MISSING_REQUIRED_ANSWER, mcpPrompt, missingRequiredError, } from "./prompt/index.js";
|
|
17
17
|
export { buildReplayCommand, effectStyleFor, formatContentPreview, formatEffectLine, formatEffectWithContent, formatLlmHelp, formatLlmJson, formatLlmMarkdown, getActionColor, getActionLabel, getEffectPayload, getLanguageHint, getLlmActionLabel, getLlmEffectPath, isVisibleEffect, visiblePlanEffects, } from "./format/index.js";
|
|
18
18
|
export type { RunGeneratorTaskOptions } from "./run/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,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AAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAO5B,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,SAAS,EACT,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAMlD,YAAY,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { default as answerPromptWithDefaults } from "./answerPromptWithDefaults.js";
|
|
9
9
|
export { default as autoPrompt, MISSING_REQUIRED_ANSWER, missingRequiredError, } from "./autoPrompt.js";
|
|
10
|
-
export type { InkPromptOptions, InkSession } from "./inkPrompt.js";
|
|
10
|
+
export type { InkPromptOptions, InkSession, StepReport } from "./inkPrompt.js";
|
|
11
11
|
export { default as inkPrompt } from "./inkPrompt.js";
|
|
12
12
|
export { default as mcpPrompt } from "./mcpPrompt.js";
|
|
13
13
|
export type { ConfirmPrompt, MultiselectPrompt, PromptEffect, PromptHandler, PromptQuestion, SelectPrompt, TextPrompt, } from "./types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompt/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompt/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,UAAU,GACX,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wizard.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/Wizard.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"Wizard.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/Wizard.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,KAAK,EACV,iBAAiB,EAGlB,MAAM,cAAc,CAAC;AA+KtB,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,UAAU,EAAE,iBAAiB,CAAC;CAC/B;AAED,4EAA4E;AAC5E,eAAO,MAAM,MAAM,GAAI,gBAAgB,WAAW,4CAmIjD,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Effect, LogLevel } from "@canonical/task";
|
|
11
11
|
import type GeneratorDefinition from "../../types/GeneratorDefinition.js";
|
|
12
|
-
import type { InkPromptOptions } from "../inkPrompt.js";
|
|
12
|
+
import type { InkPromptOptions, StepReport } from "../inkPrompt.js";
|
|
13
13
|
import type { PromptEffect } from "../types.js";
|
|
14
14
|
/** The seam handle a mounted session exposes back to {@link inkPrompt}. */
|
|
15
15
|
export interface MountedSession {
|
|
@@ -17,7 +17,8 @@ export interface MountedSession {
|
|
|
17
17
|
reportEffectStart: (effect: Effect) => void;
|
|
18
18
|
reportEffectComplete: (effect: Effect, duration: number) => void;
|
|
19
19
|
reportLog: (level: LogLevel, message: string) => void;
|
|
20
|
-
|
|
20
|
+
reportStep: (report: StepReport) => void;
|
|
21
|
+
dispose: () => Promise<void>;
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* Mount the wizard for a generator and return its seam handle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/mount.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,mBAAmB,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/mount.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,mBAAmB,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,UAAU,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,mBAAmB,EAC9B,OAAO,GAAE,gBAAqB,GAC7B,cAAc,CAiDhB"}
|
|
@@ -14,19 +14,110 @@
|
|
|
14
14
|
* wide glyphs overflow and wrap. {@link measureDisplayWidth} is the shared
|
|
15
15
|
* width approximation both concerns rely on.
|
|
16
16
|
*
|
|
17
|
+
* Width is also STYLE-invariant: SGR escape sequences (the bytes `chalk` emits
|
|
18
|
+
* for `<Text color="green">`) occupy no cells, so {@link stripStyles} removes
|
|
19
|
+
* them before anything is counted. Whether the process happens to have colour
|
|
20
|
+
* enabled therefore cannot change how wide a row measures — see that helper for
|
|
21
|
+
* why that mattered.
|
|
22
|
+
*
|
|
17
23
|
* A `.ts` sibling of the JSX view so the string math is unit testable.
|
|
18
24
|
*/
|
|
19
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Max display columns a single RENDERED progress line may occupy — status
|
|
27
|
+
* glyph, description and duration suffix together. Everything but the
|
|
28
|
+
* description is fixed, so {@link describedWidthBudget} spends what is left of
|
|
29
|
+
* this cap on the description alone.
|
|
30
|
+
*/
|
|
20
31
|
export declare const MAX_PROGRESS_LINE = 72;
|
|
21
32
|
/** The single-column marker inserted where a truncated middle was elided. */
|
|
22
33
|
export declare const TRUNCATION_MARKER = "\u2026";
|
|
34
|
+
/**
|
|
35
|
+
* The status glyph a COMPLETED progress line opens with, rendered green by
|
|
36
|
+
* `Wizard.tsx`. Exported so the view and the budget cannot drift: the columns
|
|
37
|
+
* the glyph costs are reserved here, and a fork that changed the glyph in the
|
|
38
|
+
* view alone would silently reopen the overflow this reservation closes.
|
|
39
|
+
*/
|
|
40
|
+
export declare const COMPLETED_GLYPH = "\u2713";
|
|
41
|
+
/**
|
|
42
|
+
* The status glyph for a run that did NOT complete — the error and cancel
|
|
43
|
+
* lines `Wizard.tsx` ends on. Named beside {@link COMPLETED_GLYPH} so the
|
|
44
|
+
* wizard's outcome marks are one vocabulary in one place rather than literals
|
|
45
|
+
* scattered through the view — and exported (via `@canonical/summon-core/
|
|
46
|
+
* format`) so the pragma CLI's render-vocabulary sync test can pin both marks
|
|
47
|
+
* to byte equality with its own: the two binaries narrate the same run, and a
|
|
48
|
+
* reader must not have to learn a second dialect for the same fact.
|
|
49
|
+
*/
|
|
50
|
+
export declare const FAILURE_GLYPH = "\u2717";
|
|
51
|
+
/**
|
|
52
|
+
* Format a completed effect's duration as the suffix its progress line ends
|
|
53
|
+
* with — `(12ms)`, whole milliseconds.
|
|
54
|
+
*
|
|
55
|
+
* The spelling is deliberately IDENTICAL to the summon binary's own timed
|
|
56
|
+
* progress view (`ExecutionProgress.tsx`): the two binaries render the same
|
|
57
|
+
* run, and a reader who has seen one must not have to learn a second dialect
|
|
58
|
+
* for the same fact.
|
|
59
|
+
*
|
|
60
|
+
* @param durationMs - The effect's measured duration, in milliseconds.
|
|
61
|
+
* @returns The parenthesised suffix, e.g. `(12ms)`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function formatEffectDuration(durationMs: number): string;
|
|
64
|
+
/**
|
|
65
|
+
* The display columns left for the DESCRIBED middle of a progress line once
|
|
66
|
+
* everything rendered AROUND it is reserved out of `max`: the leading
|
|
67
|
+
* {@link COMPLETED_GLYPH} and its space, and the trailing duration suffix and
|
|
68
|
+
* the space before it.
|
|
69
|
+
*
|
|
70
|
+
* The one-row guarantee is about the WHOLE rendered row — that is the thing the
|
|
71
|
+
* terminal has to fit — so the description alone can no longer spend the entire
|
|
72
|
+
* cap: appending `(1234ms)` to a line already at {@link MAX_PROGRESS_LINE}
|
|
73
|
+
* would wrap, which is exactly the jitter the truncation exists to prevent. The
|
|
74
|
+
* glyph is reserved for the same reason and was the earlier miss: a budget that
|
|
75
|
+
* covered only the suffix let `Wizard.tsx` emit `MAX_PROGRESS_LINE + 2` columns
|
|
76
|
+
* — overflowing on precisely the boundary this helper protects.
|
|
77
|
+
*
|
|
78
|
+
* Budgeting here (rather than truncating the joined line) keeps the timing
|
|
79
|
+
* legible — it is the part a middle-truncation would never protect, since it
|
|
80
|
+
* sits at neither end of the description.
|
|
81
|
+
*
|
|
82
|
+
* @param suffix - The rendered duration suffix, from {@link formatEffectDuration}.
|
|
83
|
+
* @param max - The whole-ROW width cap; defaults to {@link MAX_PROGRESS_LINE}.
|
|
84
|
+
* @returns The columns the description may occupy, never negative.
|
|
85
|
+
*/
|
|
86
|
+
export declare function describedWidthBudget(suffix: string, max?: number): number;
|
|
87
|
+
/**
|
|
88
|
+
* Remove ANSI escape sequences, leaving only the characters a terminal actually
|
|
89
|
+
* prints.
|
|
90
|
+
*
|
|
91
|
+
* The rendered frame is styled — `Wizard.tsx` wraps the status glyph in
|
|
92
|
+
* `<Text color="green">` and the duration in `<Text dimColor>`, and Ink renders
|
|
93
|
+
* those through `chalk` — so a completed progress row reaches a reader (or a
|
|
94
|
+
* test) as `ESC[32m✓ESC[39m … ESC[2m(5ms)ESC[22m`. Those 19 bytes are
|
|
95
|
+
* instructions to the terminal, not columns in it.
|
|
96
|
+
*
|
|
97
|
+
* Whether they are present at all depends on the environment: `chalk` enables
|
|
98
|
+
* colour only when it believes the stream is a terminal, so the SAME frame is
|
|
99
|
+
* bare under a plain `vitest` run and styled when the task runs under a task
|
|
100
|
+
* runner that allocates a pseudo-terminal (which is how CI invokes this suite).
|
|
101
|
+
* Counting the escapes as columns therefore made the measured width of one
|
|
102
|
+
* fixed row swing between 72 and 91 — a one-row guarantee that held or failed
|
|
103
|
+
* on the shape of the invoking shell. Stripping first makes the measurement say
|
|
104
|
+
* the same thing everywhere.
|
|
105
|
+
*
|
|
106
|
+
* @param text - Possibly styled text, e.g. a captured Ink frame.
|
|
107
|
+
* @returns `text` with every ANSI escape sequence removed.
|
|
108
|
+
*/
|
|
109
|
+
export declare function stripStyles(text: string): string;
|
|
23
110
|
/**
|
|
24
111
|
* Measure the terminal-column width of a string, summing per-code-point widths:
|
|
25
112
|
* one column for most code points, two for East Asian Wide / emoji ones (see
|
|
26
113
|
* {@link isWideCodePoint}). Iterating code points rather than UTF-16 code units
|
|
27
114
|
* means a surrogate pair counts once, as the single glyph it renders to.
|
|
28
115
|
*
|
|
29
|
-
* @
|
|
116
|
+
* Styling is discounted first ({@link stripStyles}): an escape sequence costs
|
|
117
|
+
* bytes but no cells, so the width of a row is the same number whether or not
|
|
118
|
+
* colour is enabled.
|
|
119
|
+
*
|
|
120
|
+
* @param text - The string to measure; may carry ANSI styling.
|
|
30
121
|
* @returns The approximate number of terminal columns `text` occupies.
|
|
31
122
|
*/
|
|
32
123
|
export declare function measureDisplayWidth(text: string): number;
|
|
@@ -40,6 +131,11 @@ export declare function measureDisplayWidth(text: string): number;
|
|
|
40
131
|
* code points, so the one-row guarantee holds for multibyte and wide (CJK /
|
|
41
132
|
* emoji) paths and a surrogate pair is never split into a lone-surrogate `�`.
|
|
42
133
|
*
|
|
134
|
+
* `line` must be UNSTYLED text — the description `Wizard.tsx` truncates before
|
|
135
|
+
* handing it to Ink, which applies the colour. Cutting a line that already
|
|
136
|
+
* carried escape sequences could sever one mid-sequence; the styling is applied
|
|
137
|
+
* around the truncated text precisely so that cannot arise.
|
|
138
|
+
*
|
|
43
139
|
* @param line - The described-effect line (e.g. `Write file: a/b/c.ts (12 bytes)`).
|
|
44
140
|
* @param max - The width cap, in columns; defaults to {@link MAX_PROGRESS_LINE}.
|
|
45
141
|
* @returns The line unchanged when within the cap, else its truncated form.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressWindow.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/progressWindow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"progressWindow.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/progressWindow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,WAAM,CAAC;AASrC;;;;;GAKG;AACH,eAAO,MAAM,eAAe,WAAM,CAAC;AAEnC;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,WAAM,CAAC;AAQjC;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,GAAG,GAAE,MAA0B,GAC9B,MAAM,CAOR;AAwED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMxD;AAwBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,MAA0B,GAC9B,MAAM,CAYR"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { type Effect, type LogLevel, type TaskError } from "@canonical/task";
|
|
14
14
|
import type GeneratorDefinition from "../../types/GeneratorDefinition.js";
|
|
15
|
+
import type { StepReport } from "../inkPrompt.js";
|
|
15
16
|
import type { PromptEffect } from "../types.js";
|
|
16
17
|
/** The wizard's coarse lifecycle phase. */
|
|
17
18
|
export type WizardPhase = "idle" | "prompting" | "confirming" | "executing" | "complete" | "error" | "cancelled";
|
|
@@ -19,6 +20,26 @@ export type WizardPhase = "idle" | "prompting" | "confirming" | "executing" | "c
|
|
|
19
20
|
export interface TimedEffect {
|
|
20
21
|
readonly effect: Effect;
|
|
21
22
|
readonly timestamp: number;
|
|
23
|
+
/**
|
|
24
|
+
* How long the effect itself took, in milliseconds, as measured by the
|
|
25
|
+
* interpreter and handed to the seam's `onEffectComplete`. KEPT rather than
|
|
26
|
+
* dropped: the live view renders it as `✓ <effect> (12ms)` — the spelling
|
|
27
|
+
* the summon binary's own progress view already uses.
|
|
28
|
+
*/
|
|
29
|
+
readonly duration: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One host-named step's live state — a {@link StepReport} folded into the
|
|
33
|
+
* view model. `duration` is measured HERE, from the step's `start` report to
|
|
34
|
+
* its completion report, so it covers the step's whole wall time (every effect
|
|
35
|
+
* it spans) rather than any single effect's.
|
|
36
|
+
*/
|
|
37
|
+
export interface StepProgress {
|
|
38
|
+
readonly key: string;
|
|
39
|
+
readonly label: string;
|
|
40
|
+
readonly status: "running" | "done" | "failed";
|
|
41
|
+
/** Wall-clock ms from `start` to completion; set on `done`/`failed`. */
|
|
42
|
+
readonly duration?: number;
|
|
22
43
|
}
|
|
23
44
|
/** The immutable snapshot the React view renders. A new object per change. */
|
|
24
45
|
export interface WizardState {
|
|
@@ -35,6 +56,12 @@ export interface WizardState {
|
|
|
35
56
|
readonly previewEffects: readonly Effect[];
|
|
36
57
|
/** Effects completed so far during execution. */
|
|
37
58
|
readonly progress: readonly TimedEffect[];
|
|
59
|
+
/**
|
|
60
|
+
* Host-named steps reported so far ({@link SessionController.reportStep}).
|
|
61
|
+
* Non-empty ONLY for a host that narrates its run in its own units; the
|
|
62
|
+
* view then renders these rows instead of the per-effect transcript.
|
|
63
|
+
*/
|
|
64
|
+
readonly steps: readonly StepProgress[];
|
|
38
65
|
/** A failure, when `phase === "error"`. */
|
|
39
66
|
readonly error?: TaskError;
|
|
40
67
|
}
|
|
@@ -104,17 +131,73 @@ export declare class SessionController {
|
|
|
104
131
|
previewSettled(): Promise<void>;
|
|
105
132
|
/** Feed effect start (kept for seam symmetry; progress rides completion). */
|
|
106
133
|
reportEffectStart(_effect: Effect): void;
|
|
107
|
-
/**
|
|
108
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Record a completed effect — and what it cost — for the live progress view.
|
|
136
|
+
* The seam delivers a per-effect `duration`; it is stored, not discarded, so
|
|
137
|
+
* the view can say how long each step took.
|
|
138
|
+
*/
|
|
139
|
+
reportEffectComplete(effect: Effect, duration: number): void;
|
|
109
140
|
/** A task log line (kept for parity; not surfaced by the default view). */
|
|
110
141
|
reportLog(_level: LogLevel, _message: string): void;
|
|
142
|
+
/** Per-step `start` timestamps, so completion can measure wall time. */
|
|
143
|
+
private readonly stepStarts;
|
|
144
|
+
/**
|
|
145
|
+
* Fold a host step report into the live view (see {@link StepProgress}).
|
|
146
|
+
*
|
|
147
|
+
* GATED to the executing phase, unlike {@link reportEffectComplete}: effect
|
|
148
|
+
* callbacks only ever arrive from the real interpreter through the seam, but
|
|
149
|
+
* step reports originate INSIDE the host's task composition, so every
|
|
150
|
+
* interpretation of it fires them — including the confirm gate's own honest
|
|
151
|
+
* preview, which walks the same task before the user has consented. Dropping
|
|
152
|
+
* reports outside `executing` keeps a previewed step from painting itself
|
|
153
|
+
* as work in progress — and the gate is sound only because of the pairing
|
|
154
|
+
* invariant {@link submitConfirm} enforces: `executing` begins strictly
|
|
155
|
+
* AFTER the preview walk has completed (consent is released on
|
|
156
|
+
* `previewSettled()`), so no pre-consent walk can still be emitting once
|
|
157
|
+
* reports are accepted. Testing arrival time alone could not close that —
|
|
158
|
+
* a report says nothing about which walk produced it.
|
|
159
|
+
*
|
|
160
|
+
* The phase gate alone is still not enough: `execute` walks `generate` once
|
|
161
|
+
* more on the MOCK interpreter right after consent — synchronously, to give
|
|
162
|
+
* the outcome summary its file list — so a full set of settled steps arrives
|
|
163
|
+
* (in-phase, near-zero durations) before the real drive begins. Steps run
|
|
164
|
+
* sequentially with per-walk-unique keys, so a `start` for a key that has
|
|
165
|
+
* ALREADY settled can only mean a new interpretation: the board resets and
|
|
166
|
+
* the real walk repaints it with real timings. This is also why the view
|
|
167
|
+
* renders steps in the LIVE region, never under `<Static>` — a static row
|
|
168
|
+
* cannot be taken back, and the mock walk's rows must be.
|
|
169
|
+
*/
|
|
170
|
+
reportStep(report: StepReport): void;
|
|
111
171
|
/** Mark the run complete (the view flashes a completion summary). */
|
|
112
172
|
markComplete(): void;
|
|
113
173
|
/** Mark the run failed. */
|
|
114
174
|
markError(error: TaskError): void;
|
|
115
175
|
/** The user answered the active (non-confirm) prompt. */
|
|
116
176
|
submitAnswer(value: unknown): void;
|
|
117
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* The user answered the confirm gate.
|
|
179
|
+
*
|
|
180
|
+
* Consent does NOT begin execution by itself. The gate's honest preview
|
|
181
|
+
* ({@link loadPreview}) walks the same `generate` the run will, and it is
|
|
182
|
+
* async — a fast Y can land while that walk is still in flight. Entering
|
|
183
|
+
* `executing` at that instant re-opened the gap {@link reportStep}'s phase
|
|
184
|
+
* gate exists to close: the pre-consent walk's late step reports arrived
|
|
185
|
+
* in-phase and were accepted, and one naming a key the real walk had
|
|
186
|
+
* already settled hit the fresh-walk reset and cleared the board mid-run.
|
|
187
|
+
* Step reports carry no walk identity — they are plain closures fired from
|
|
188
|
+
* task continuations — so the sound closure is to ensure NO pre-consent
|
|
189
|
+
* walk survives into the executing phase: consent is released only once
|
|
190
|
+
* {@link previewSettled} resolves, which is `runPreview` COMPLETING its
|
|
191
|
+
* walk (loadPreview catches its failure), not merely having started it.
|
|
192
|
+
* The pane has usually settled long before the user answers, so the
|
|
193
|
+
* deferral is normally one microtask.
|
|
194
|
+
*
|
|
195
|
+
* A cancel that lands while consent waits on the preview rejects the gate
|
|
196
|
+
* here, with the same `GENERATOR_CANCELLED` an at-prompt cancel carries —
|
|
197
|
+
* {@link cancel} cannot reach it, this method already claimed the pending
|
|
198
|
+
* slot — so the task fails cleanly instead of hanging on a prompt that
|
|
199
|
+
* would otherwise never settle.
|
|
200
|
+
*/
|
|
118
201
|
submitConfirm(proceed: boolean): void;
|
|
119
202
|
/**
|
|
120
203
|
* The user cancelled (Ctrl-C / escape). Two things must happen, and both are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,mBAAmB,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,WAAW,GACX,YAAY,GACZ,WAAW,GACX,UAAU,GACV,OAAO,GACP,WAAW,CAAC;AAEhB,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,mEAAmE;IACnE,QAAQ,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC;IACvC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CA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4BpC,qEAAqE;IACrE,YAAY,IAAI,IAAI;IAMpB,2BAA2B;IAC3B,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAMjC,yDAAyD;IACzD,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAgBlC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAyBrC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,IAAI,IAAI;CAYf"}
|
|
@@ -46,6 +46,23 @@ export interface InkPromptOptions {
|
|
|
46
46
|
*/
|
|
47
47
|
readonly initialAnswers?: Readonly<Record<string, unknown>>;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* One host-named unit of work, reported through {@link InkSession.reportStep}.
|
|
51
|
+
*
|
|
52
|
+
* The wizard's default live progress is the per-effect transcript — the right
|
|
53
|
+
* grain for a scaffolder, whose unit of work IS the file. A host whose unit is
|
|
54
|
+
* coarser (pragma's `setup`, where one step is one configured target spanning
|
|
55
|
+
* a dozen effects) reports its own steps instead, in its own vocabulary, and
|
|
56
|
+
* the view renders those rows in place of the transcript. `label` is the whole
|
|
57
|
+
* row body, unstyled — the glyph, spinner and duration are the view's.
|
|
58
|
+
*/
|
|
59
|
+
export interface StepReport {
|
|
60
|
+
/** Stable identity — a `start` and its `done`/`failed` share it. */
|
|
61
|
+
readonly key: string;
|
|
62
|
+
/** The row body (unstyled); the completion report may extend it. */
|
|
63
|
+
readonly label: string;
|
|
64
|
+
readonly status: "start" | "done" | "failed";
|
|
65
|
+
}
|
|
49
66
|
/**
|
|
50
67
|
* A running Ink session's seam surface: the prompt handler plus the effect
|
|
51
68
|
* callbacks the runner wires into `runtime.exec`, and its teardown.
|
|
@@ -59,8 +76,18 @@ export interface InkSession {
|
|
|
59
76
|
readonly onEffectComplete: (effect: Effect, duration: number) => void;
|
|
60
77
|
/** Feed a task log line into the live view. */
|
|
61
78
|
readonly onLog: (level: LogLevel, message: string) => void;
|
|
62
|
-
/**
|
|
63
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Report a host-named step ({@link StepReport}). Once any step is reported,
|
|
81
|
+
* the live progress renders the host's step rows INSTEAD of the per-effect
|
|
82
|
+
* transcript; a session that never receives one renders exactly as before.
|
|
83
|
+
*/
|
|
84
|
+
readonly reportStep: (report: StepReport) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Tear down the Ink render. Safe to call more than once. Resolves once the
|
|
87
|
+
* final frame is flushed — AWAIT it before printing to the same terminal,
|
|
88
|
+
* or the closing frame and the caller's output interleave.
|
|
89
|
+
*/
|
|
90
|
+
readonly dispose: () => Promise<void>;
|
|
64
91
|
}
|
|
65
92
|
/**
|
|
66
93
|
* Build the interactive Ink session for a generator.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inkPrompt.d.ts","sourceRoot":"","sources":["../../../src/prompt/inkPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,mBAAmB,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ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,GAAG,QAAQ,CAAC;CAC9C;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,wEAAwE;IACxE,QAAQ,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAClD;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAYD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,SAAS,EAAE,mBAAmB,EAC9B,OAAO,GAAE,gBAAqB,GAC7B,UAAU,CA4CZ"}
|
|
@@ -23,7 +23,7 @@ export interface ConformanceFixture {
|
|
|
23
23
|
readonly answers: Readonly<Record<string, unknown>>;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* The design-system generator fixtures — the
|
|
26
|
+
* The design-system generator fixtures — the seven trees pragma's `create` verbs
|
|
27
27
|
* and summon's `execute` must agree on byte for byte.
|
|
28
28
|
*/
|
|
29
29
|
export declare const CONFORMANCE_FIXTURES: readonly ConformanceFixture[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD;AASD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD;AASD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,EAwE7D,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAIxD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/summon-core",
|
|
3
3
|
"description": "Code generation framework: generator definitions, templates, stamps, discovery. Built on @canonical/task.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.37.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"check:webarchitect": "webarchitect library --license GPL-3.0",
|
|
59
59
|
"test": "bun run test:vitest && bun run test:ink",
|
|
60
60
|
"test:vitest": "vitest run --coverage --exclude '**/*.test.tsx'",
|
|
61
|
-
"test:ink": "vitest run --no-coverage
|
|
61
|
+
"test:ink": "vitest run --no-coverage src/prompt/ink/wizard.test.tsx src/prompt/ink/mount.test.tsx",
|
|
62
62
|
"test:vitest:watch": "vitest"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@biomejs/biome": "2.4.9",
|
|
66
|
-
"@canonical/biome-config": "^0.
|
|
67
|
-
"@canonical/typescript-config": "^0.
|
|
68
|
-
"@canonical/webarchitect": "^0.
|
|
66
|
+
"@canonical/biome-config": "^0.37.0",
|
|
67
|
+
"@canonical/typescript-config": "^0.37.0",
|
|
68
|
+
"@canonical/webarchitect": "^0.37.0",
|
|
69
69
|
"@types/bun": "^1.3.10",
|
|
70
70
|
"@types/ejs": "^3.1.5",
|
|
71
71
|
"@types/node": "^26.0.0",
|
|
@@ -75,15 +75,18 @@
|
|
|
75
75
|
"vitest": "^4.0.18"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@canonical/task": "^0.
|
|
79
|
-
"@canonical/utils": "^0.
|
|
80
|
-
"chalk": "^
|
|
81
|
-
"commander": "^
|
|
78
|
+
"@canonical/task": "^0.37.0",
|
|
79
|
+
"@canonical/utils": "^0.37.0",
|
|
80
|
+
"chalk": "^6.0.0",
|
|
81
|
+
"commander": "^15.0.0",
|
|
82
82
|
"ejs": "^5.0.0",
|
|
83
83
|
"ink": "^6.8.0",
|
|
84
84
|
"ink-select-input": "^6.2.0",
|
|
85
85
|
"ink-text-input": "^6.0.0",
|
|
86
86
|
"react": "^19.2.4"
|
|
87
87
|
},
|
|
88
|
-
"
|
|
88
|
+
"engines": {
|
|
89
|
+
"node": ">=22.18 <23 || >=23.6"
|
|
90
|
+
},
|
|
91
|
+
"gitHead": "ac8383bdb4be1bcd6fa6c4960a1e3d78c0279688"
|
|
89
92
|
}
|