@posthog/wizard 2.32.0 → 2.33.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/{add-mcp-server-to-clients-Dc0yssCM.js → add-mcp-server-to-clients-Dhq75Hda.js} +5 -5
- package/dist/{add-mcp-server-to-clients-Dc0yssCM.js.map → add-mcp-server-to-clients-Dhq75Hda.js.map} +1 -1
- package/dist/{agent-interface-c7B2JZEd.js → agent-interface-DCeQ5Oiw.js} +6 -6
- package/dist/{agent-interface-c7B2JZEd.js.map → agent-interface-DCeQ5Oiw.js.map} +1 -1
- package/dist/{agent-runner-Am34bBUT.js → agent-runner-BRajaO84.js} +10 -9
- package/dist/{agent-runner-Am34bBUT.js.map → agent-runner-BRajaO84.js.map} +1 -1
- package/dist/{analytics-CBIKy9PZ.js → analytics-CU4o3eF8.js} +3 -3
- package/dist/analytics-CU4o3eF8.js.map +1 -0
- package/dist/{api-Blg3nvvZ.js → api-BBRfHEZ-.js} +3 -3
- package/dist/{api-Blg3nvvZ.js.map → api-BBRfHEZ-.js.map} +1 -1
- package/dist/bin.js +203 -75
- package/dist/bin.js.map +1 -1
- package/dist/ci-install-D-otkGW6.js +113 -0
- package/dist/ci-install-D-otkGW6.js.map +1 -0
- package/dist/{debug-AdvgwKEw.js → debug-BGMe1wP6.js} +2 -2
- package/dist/{debug-AdvgwKEw.js.map → debug-BGMe1wP6.js.map} +1 -1
- package/dist/{debug-cy_jyRb4.js → debug-BewTLNNr.js} +1 -1
- package/dist/{defaults-BNWIWzjc.js → defaults-DII5CAog.js} +1 -1
- package/dist/{defaults-BNWIWzjc.js.map → defaults-DII5CAog.js.map} +1 -1
- package/dist/{environment-B6TW5v9d.js → environment-G41UFzou.js} +3 -3
- package/dist/{environment-B6TW5v9d.js.map → environment-G41UFzou.js.map} +1 -1
- package/dist/{file-utils-8tUk_eEX.js → file-utils-D9InAvZd.js} +2 -2
- package/dist/{file-utils-8tUk_eEX.js.map → file-utils-D9InAvZd.js.map} +1 -1
- package/dist/headless-ui-xjHVVUqe.js +24 -0
- package/dist/headless-ui-xjHVVUqe.js.map +1 -0
- package/dist/{interactive-CApktTrj.js → interactive-D2CKikzz.js} +3 -3
- package/dist/{interactive-CApktTrj.js.map → interactive-D2CKikzz.js.map} +1 -1
- package/dist/{mcp-prompt-streaming-BKcU9yuz.js → mcp-prompt-streaming-FrArGwfv.js} +4 -4
- package/dist/{mcp-prompt-streaming-BKcU9yuz.js.map → mcp-prompt-streaming-FrArGwfv.js.map} +1 -1
- package/dist/{non-interactive-DejTdRTW.js → non-interactive-BXx6Q-D0.js} +2 -2
- package/dist/{non-interactive-DejTdRTW.js.map → non-interactive-BXx6Q-D0.js.map} +1 -1
- package/dist/{package-manager-DBfgSXNn.js → package-manager-D9ojA4jO.js} +2 -2
- package/dist/{package-manager-DBfgSXNn.js.map → package-manager-D9ojA4jO.js.map} +1 -1
- package/dist/{playground-BOg2U1AT.js → playground-Bgtxrusl.js} +7 -5
- package/dist/{playground-BOg2U1AT.js.map → playground-Bgtxrusl.js.map} +1 -1
- package/dist/{posthog-Cr37rnla.js → posthog-DU6JXG00.js} +1 -1
- package/dist/{posthog-Cr37rnla.js.map → posthog-DU6JXG00.js.map} +1 -1
- package/dist/{posthog-integration-gLhOUdPJ.js → posthog-integration-gnC9v4kg.js} +13 -13
- package/dist/{posthog-integration-gLhOUdPJ.js.map → posthog-integration-gnC9v4kg.js.map} +1 -1
- package/dist/{provisioning-DuzclqPB.js → provisioning-C3qglLdc.js} +3 -3
- package/dist/{provisioning-DuzclqPB.js.map → provisioning-C3qglLdc.js.map} +1 -1
- package/dist/{registry-Dbl-5SnO.js → registry-BVrvFTZ0.js} +4 -4
- package/dist/{registry-Dbl-5SnO.js.map → registry-BVrvFTZ0.js.map} +1 -1
- package/dist/{setup-utils-B6wbp3s0.js → setup-utils-CanVlGbX.js} +8 -8
- package/dist/{setup-utils-B6wbp3s0.js.map → setup-utils-CanVlGbX.js.map} +1 -1
- package/dist/smoke-test.sh +25 -0
- package/dist/{start-tui-IoQh-Nhj.js → start-tui-YE7bybIr.js} +17 -16
- package/dist/{start-tui-IoQh-Nhj.js.map → start-tui-YE7bybIr.js.map} +1 -1
- package/dist/{steps-CJrqlHbo.js → steps-N20e4IoE.js} +7 -7
- package/dist/{steps-CJrqlHbo.js.map → steps-N20e4IoE.js.map} +1 -1
- package/dist/store-D15C9YSW.js +763 -0
- package/dist/store-D15C9YSW.js.map +1 -0
- package/dist/{task-stream-BQNSp0qR.js → task-stream-CPjpHFhI.js} +4 -4
- package/dist/{task-stream-BQNSp0qR.js.map → task-stream-CPjpHFhI.js.map} +1 -1
- package/dist/{telemetry-1m0CyTry.js → telemetry-DknCDWP6.js} +3 -3
- package/dist/{telemetry-1m0CyTry.js.map → telemetry-DknCDWP6.js.map} +1 -1
- package/dist/{terminal-BKI4i72f.js → terminal-Cvv0a-7Q.js} +14 -764
- package/dist/terminal-Cvv0a-7Q.js.map +1 -0
- package/dist/{urls-B3JumpLT.js → urls-DrR6F_A3.js} +2 -2
- package/dist/{urls-B3JumpLT.js.map → urls-DrR6F_A3.js.map} +1 -1
- package/dist/{wizard-abort-PqLMKSh1.js → wizard-abort-Cw818xPr.js} +4 -3
- package/dist/{wizard-abort-PqLMKSh1.js.map → wizard-abort-Cw818xPr.js.map} +1 -1
- package/dist/{wizard-abort-D7SzKUgE.js → wizard-abort-DMvS0YXD.js} +1 -1
- package/dist/wizard-session-BKEdX9mO.js +2 -0
- package/dist/{wizard-session-G3VWD6hv.js → wizard-session-CN55LYyZ.js} +9 -2
- package/dist/{wizard-session-G3VWD6hv.js.map → wizard-session-CN55LYyZ.js.map} +1 -1
- package/package.json +1 -1
- package/dist/analytics-CBIKy9PZ.js.map +0 -1
- package/dist/ci-install-51ntd9x5.js +0 -73
- package/dist/ci-install-51ntd9x5.js.map +0 -1
- package/dist/terminal-BKI4i72f.js.map +0 -1
- package/dist/wizard-session-wPJtNl4c.js +0 -2
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B_-DWIq7.js";
|
|
2
|
+
import { s as logToFile, y as getBlockingServiceKeys } from "./debug-BGMe1wP6.js";
|
|
3
|
+
import { n as isTaskStatus } from "./wizard-ui-WZ48rUgr.js";
|
|
4
|
+
import { r as sessionProperties, t as analytics } from "./analytics-CU4o3eF8.js";
|
|
5
|
+
import { a as buildSession } from "./wizard-session-CN55LYyZ.js";
|
|
6
|
+
import { d as Program, f as getProgramConfig, u as PROGRAM_REGISTRY } from "./bin.js";
|
|
7
|
+
import { atom, map } from "nanostores";
|
|
8
|
+
//#region src/lib/programs/program-step.ts
|
|
9
|
+
/**
|
|
10
|
+
* Project program steps into the narrower Screen shape the router consumes.
|
|
11
|
+
*
|
|
12
|
+
* Two things happen here:
|
|
13
|
+
* 1. Headless steps (no `screenId`) are filtered out. The router walks
|
|
14
|
+
* visible screens; gate-only steps like `detect` are store concerns.
|
|
15
|
+
* 2. The step is narrowed to just { id, show, isComplete } — the
|
|
16
|
+
* router has no business touching gate, onInit, or label.
|
|
17
|
+
*
|
|
18
|
+
* This intentional separation keeps the router focused on one question:
|
|
19
|
+
* "Which screen should be rendered right now?"
|
|
20
|
+
*/
|
|
21
|
+
function createProgramSequence(steps) {
|
|
22
|
+
const entries = steps.filter((step) => step.screenId != null).map((step) => ({
|
|
23
|
+
id: step.screenId,
|
|
24
|
+
show: step.show,
|
|
25
|
+
isComplete: step.isComplete ?? step.gate
|
|
26
|
+
}));
|
|
27
|
+
entries.push({
|
|
28
|
+
id: "exit",
|
|
29
|
+
show: void 0,
|
|
30
|
+
isComplete: void 0
|
|
31
|
+
});
|
|
32
|
+
return entries;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/lib/programs/ai-opt-in-gate.ts
|
|
36
|
+
/** Step id — also the ScreenId.AiOptIn enum value in screen-sequences. */
|
|
37
|
+
const AI_OPT_IN_STEP_ID = "ai-opt-in";
|
|
38
|
+
function aiApproved(session) {
|
|
39
|
+
return !!session.apiUser?.organization?.is_ai_data_processing_approved;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns the program's steps with the AI opt-in gate injected after
|
|
43
|
+
* `auth`. Programs with `requiresAi: false` or no auth step pass
|
|
44
|
+
* through unchanged — without auth, `apiUser` would never be populated
|
|
45
|
+
* for evaluation anyway.
|
|
46
|
+
*/
|
|
47
|
+
function withAiOptInGate(config) {
|
|
48
|
+
if (config.requiresAi === false) return config.steps;
|
|
49
|
+
const authIdx = config.steps.findIndex((s) => s.id === "auth");
|
|
50
|
+
if (authIdx === -1) return config.steps;
|
|
51
|
+
const gateStep = {
|
|
52
|
+
id: AI_OPT_IN_STEP_ID,
|
|
53
|
+
label: "AI opt-in check",
|
|
54
|
+
screenId: AI_OPT_IN_STEP_ID,
|
|
55
|
+
show: (session) => !session.ci && session.apiUser != null && !aiApproved(session),
|
|
56
|
+
isComplete: (session) => session.ci || aiApproved(session),
|
|
57
|
+
gate: (session) => session.ci || aiApproved(session)
|
|
58
|
+
};
|
|
59
|
+
return [
|
|
60
|
+
...config.steps.slice(0, authIdx + 1),
|
|
61
|
+
gateStep,
|
|
62
|
+
...config.steps.slice(authIdx + 1)
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/ui/tui/screen-sequences.ts
|
|
67
|
+
/** All program screen sequences keyed by program id. */
|
|
68
|
+
const PROGRAM_SEQUENCES = Object.fromEntries(PROGRAM_REGISTRY.map((c) => [c.id, createProgramSequence(withAiOptInGate(c))]));
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/ui/tui/router.ts
|
|
71
|
+
var WizardRouter = class {
|
|
72
|
+
sequence;
|
|
73
|
+
programId;
|
|
74
|
+
overlays = [];
|
|
75
|
+
constructor(programId = Program.PostHogIntegration) {
|
|
76
|
+
this.programId = programId;
|
|
77
|
+
this.sequence = PROGRAM_SEQUENCES[programId];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Resolve which screen should be active based on session state.
|
|
81
|
+
* Walks the program sequence, skipping hidden entries and completed entries,
|
|
82
|
+
* returns the first incomplete screen.
|
|
83
|
+
*/
|
|
84
|
+
resolve(session) {
|
|
85
|
+
if (this.overlays.length > 0) return this.overlays[this.overlays.length - 1];
|
|
86
|
+
for (const entry of this.sequence) {
|
|
87
|
+
if (entry.show && !entry.show(session)) continue;
|
|
88
|
+
if (entry.isComplete && entry.isComplete(session)) continue;
|
|
89
|
+
return entry.id;
|
|
90
|
+
}
|
|
91
|
+
return this.sequence[this.sequence.length - 1].id;
|
|
92
|
+
}
|
|
93
|
+
/** The screen that should be rendered right now. */
|
|
94
|
+
get activeScreen() {
|
|
95
|
+
if (this.overlays.length > 0) return this.overlays[this.overlays.length - 1];
|
|
96
|
+
return this.sequence[0].id;
|
|
97
|
+
}
|
|
98
|
+
/** The id of the active program. */
|
|
99
|
+
get activeProgram() {
|
|
100
|
+
return this.programId;
|
|
101
|
+
}
|
|
102
|
+
/** Whether an overlay is currently active. */
|
|
103
|
+
get hasOverlay() {
|
|
104
|
+
return this.overlays.length > 0;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Push an overlay that interrupts the current program.
|
|
108
|
+
* The program resumes when the overlay is dismissed via popOverlay().
|
|
109
|
+
*/
|
|
110
|
+
pushOverlay(overlay) {
|
|
111
|
+
this.overlays.push(overlay);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Dismiss the topmost overlay. The program screen underneath resumes.
|
|
115
|
+
*/
|
|
116
|
+
popOverlay() {
|
|
117
|
+
this.overlays.pop();
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Direction hint for screen transitions.
|
|
121
|
+
*/
|
|
122
|
+
_lastDirection = null;
|
|
123
|
+
get lastNavDirection() {
|
|
124
|
+
return this._lastDirection;
|
|
125
|
+
}
|
|
126
|
+
/** @internal — called by store wrapper to track direction */
|
|
127
|
+
_setDirection(dir) {
|
|
128
|
+
this._lastDirection = dir;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/ui/tui/store.ts
|
|
133
|
+
/**
|
|
134
|
+
* WizardStore — Nanostore-backed reactive store for the TUI.
|
|
135
|
+
* React components subscribe via useSyncExternalStore.
|
|
136
|
+
*
|
|
137
|
+
* The active screen is derived from session state — WizardRouter walks
|
|
138
|
+
* the flow and shows the first step whose `isComplete` is still false.
|
|
139
|
+
*
|
|
140
|
+
* Define a step `gate` if your screen needs to await user interactions.
|
|
141
|
+
* bin.ts calls `await store.getGate(stepId)` to pause until the gate
|
|
142
|
+
* predicate becomes true.
|
|
143
|
+
*
|
|
144
|
+
* All session mutations that affect screen resolution go through
|
|
145
|
+
* explicit setters so emitChange() is always called.
|
|
146
|
+
*/
|
|
147
|
+
var store_exports = /* @__PURE__ */ __exportAll({
|
|
148
|
+
Program: () => Program,
|
|
149
|
+
WizardStore: () => WizardStore
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* FIFO cap on retained status lines. The status bar is the only consumer and
|
|
153
|
+
* renders at most EXPANDED_COUNT lines, so there is no reason to retain more —
|
|
154
|
+
* the cap is tied to the window it feeds.
|
|
155
|
+
*/
|
|
156
|
+
const MAX_STATUS_MESSAGES = 10;
|
|
157
|
+
/**
|
|
158
|
+
* Fired once per blocked readiness result, so we can quantify how often
|
|
159
|
+
* the wizard refuses to start and — crucially — split that between
|
|
160
|
+
* confirmed PostHog outages and probe-level reachability failures that
|
|
161
|
+
* are most likely the user's network. Helps us decide whether the
|
|
162
|
+
* health-check UX is over-firing.
|
|
163
|
+
*/
|
|
164
|
+
function captureHealthCheckBlocked(result) {
|
|
165
|
+
try {
|
|
166
|
+
const health = result.health;
|
|
167
|
+
const blockingKeys = getBlockingServiceKeys(health);
|
|
168
|
+
const blockingStatuses = blockingKeys.map((k) => health[k]?.status);
|
|
169
|
+
const allNoConnection = blockingStatuses.length > 0 && blockingStatuses.every((s) => s === "no-connection");
|
|
170
|
+
const decision = blockingKeys.length === 1 && blockingKeys[0] === "githubReleases" ? "github-releases-down" : allNoConnection ? "no-connection" : "confirmed-outage";
|
|
171
|
+
const posthogStatus = health.posthogOverall?.status;
|
|
172
|
+
const retriesUsed = Math.max(0, ...[
|
|
173
|
+
"llmGateway",
|
|
174
|
+
"mcp",
|
|
175
|
+
"githubReleases"
|
|
176
|
+
].map((k) => {
|
|
177
|
+
const m = (health[k]?.rawIndicator ?? "").match(/attempts=(\d+)/);
|
|
178
|
+
return m ? Number(m[1]) - 1 : 0;
|
|
179
|
+
}));
|
|
180
|
+
analytics.wizardCapture("health check blocked", {
|
|
181
|
+
decision,
|
|
182
|
+
blocking_keys: blockingKeys,
|
|
183
|
+
posthog_status_reachable: posthogStatus !== "no-connection",
|
|
184
|
+
posthog_status_reports_incident: posthogStatus === "down" || posthogStatus === "degraded",
|
|
185
|
+
retries_used: retriesUsed
|
|
186
|
+
});
|
|
187
|
+
} catch (err) {
|
|
188
|
+
logToFile(`[health-checks] failed to capture analytics: ${err instanceof Error ? err.message : String(err)}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
var WizardStore = class {
|
|
192
|
+
$session = map(buildSession({}));
|
|
193
|
+
$statusMessages = atom([]);
|
|
194
|
+
$statusExpanded = atom(false);
|
|
195
|
+
$tasks = atom([]);
|
|
196
|
+
$eventPlan = atom([]);
|
|
197
|
+
$learnCardBlockIdx = atom(0);
|
|
198
|
+
$learnCardComplete = atom(false);
|
|
199
|
+
$version = atom(0);
|
|
200
|
+
$currentStage = atom(null);
|
|
201
|
+
_onTasksChanged = null;
|
|
202
|
+
/** Last screen seen — used to detect screen transitions for analytics. */
|
|
203
|
+
_lastScreen = null;
|
|
204
|
+
/** Hooks run when transitioning onto a screen. */
|
|
205
|
+
_enterScreenHooks = /* @__PURE__ */ new Map();
|
|
206
|
+
/** Gate promises derived from program step definitions. */
|
|
207
|
+
_gates = /* @__PURE__ */ new Map();
|
|
208
|
+
version = "";
|
|
209
|
+
/** Navigation router — resolves active screen from session state. */
|
|
210
|
+
router;
|
|
211
|
+
/** Blocks agent execution until the settings-override overlay is dismissed. */
|
|
212
|
+
_resolveSettingsOverride = null;
|
|
213
|
+
_backupAndFixSettings = null;
|
|
214
|
+
/** Blocks OAuth flow until the port-conflict overlay is dismissed. */
|
|
215
|
+
_resolvePortConflict = null;
|
|
216
|
+
/** Resolves the OAuth flow with a manually-entered authorization code. */
|
|
217
|
+
_resolveManualAuthCode = null;
|
|
218
|
+
/** Resolves the in-flight wizard_ask request. */
|
|
219
|
+
_resolvePendingQuestion = null;
|
|
220
|
+
constructor(program = Program.PostHogIntegration) {
|
|
221
|
+
this.router = new WizardRouter(program);
|
|
222
|
+
this._initFromProgram(program);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Scan program steps for gate predicates and create gate promises.
|
|
226
|
+
*
|
|
227
|
+
* Steps are wrapped with withAiOptInGate so the injected ai-opt-in
|
|
228
|
+
* step's gate registers here — the agent runner awaits it (via
|
|
229
|
+
* WizardUI.waitForAiOptIn) before any source leaves the machine.
|
|
230
|
+
* Same wrapper screen-sequences.ts uses, so the gate and its screen
|
|
231
|
+
* can't drift apart.
|
|
232
|
+
*/
|
|
233
|
+
_initFromProgram(program) {
|
|
234
|
+
const steps = withAiOptInGate(getProgramConfig(program));
|
|
235
|
+
for (const step of steps) if (step.gate) {
|
|
236
|
+
let resolve;
|
|
237
|
+
const promise = new Promise((r) => {
|
|
238
|
+
resolve = r;
|
|
239
|
+
});
|
|
240
|
+
this._gates.set(step.id, {
|
|
241
|
+
predicate: step.gate,
|
|
242
|
+
promise,
|
|
243
|
+
resolve,
|
|
244
|
+
resolved: false
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Run the program steps' onInit callbacks. startTUI calls this once
|
|
250
|
+
* the screens are actually rendering — constructing a store alone
|
|
251
|
+
* (tests, playground) must not fire init work like the health-check
|
|
252
|
+
* pre-flight, whose probes belong only to flows that show its screen.
|
|
253
|
+
*/
|
|
254
|
+
runInitHooks() {
|
|
255
|
+
const steps = getProgramConfig(this.router.activeProgram).steps;
|
|
256
|
+
const getSession = () => this.session;
|
|
257
|
+
const ctx = {
|
|
258
|
+
get session() {
|
|
259
|
+
return getSession();
|
|
260
|
+
},
|
|
261
|
+
setReadinessResult: (r) => this.setReadinessResult(r),
|
|
262
|
+
setFrameworkContext: (k, v) => this.setFrameworkContext(k, v),
|
|
263
|
+
emitChange: () => this.emitChange()
|
|
264
|
+
};
|
|
265
|
+
for (const step of steps) step.onInit?.(ctx);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Run all `onReady` hooks declared by the current flow's steps, in
|
|
269
|
+
* order. Must be called after `store.session = session` so hooks see
|
|
270
|
+
* the real installDir. bin.ts calls this generically — it doesn't
|
|
271
|
+
* need to know which program has which pre-flow work.
|
|
272
|
+
*/
|
|
273
|
+
async runReadyHooks() {
|
|
274
|
+
const steps = getProgramConfig(this.router.activeProgram).steps;
|
|
275
|
+
const ctx = {
|
|
276
|
+
session: this.session,
|
|
277
|
+
setFrameworkContext: (k, v) => this.setFrameworkContext(k, v),
|
|
278
|
+
setFrameworkConfig: (i, c) => this.setFrameworkConfig(i, c),
|
|
279
|
+
setDetectedFramework: (l) => this.setDetectedFramework(l),
|
|
280
|
+
setSkillId: (id) => this.setSkillId(id),
|
|
281
|
+
setUnsupportedVersion: (info) => this.setUnsupportedVersion(info),
|
|
282
|
+
addDiscoveredFeature: (f) => this.addDiscoveredFeature(f),
|
|
283
|
+
setDetectionComplete: () => this.setDetectionComplete()
|
|
284
|
+
};
|
|
285
|
+
for (const step of steps) if (step.onReady) await step.onReady(ctx);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Get a gate promise by step ID — the primary blocking checkpoint API
|
|
289
|
+
* for bin.ts. `await store.getGate('...')` parks the caller until the
|
|
290
|
+
* corresponding program step's gate predicate flips to true (if the
|
|
291
|
+
* predicate stays false, the caller stays parked indefinitely — the
|
|
292
|
+
* TUI keeps rendering so the user can resolve whatever is blocking).
|
|
293
|
+
*
|
|
294
|
+
* If the program doesn't define a step with this ID, or the step
|
|
295
|
+
* has no `gate` predicate, this returns an already-resolved promise
|
|
296
|
+
* so bin.ts flows straight through. This lets programs opt in to
|
|
297
|
+
* gates on a per-step basis without bin.ts needing to know which
|
|
298
|
+
* gates exist in which flow.
|
|
299
|
+
*/
|
|
300
|
+
getGate(stepId) {
|
|
301
|
+
return this._gates.get(stepId)?.promise ?? Promise.resolve();
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Re-evaluate every gate predicate against the current session and
|
|
305
|
+
* resolve any whose predicate now returns true. Called after every
|
|
306
|
+
* emitChange(), so gates unblock as soon as the session mutation
|
|
307
|
+
* that satisfies them lands. Gates only resolve once — a predicate
|
|
308
|
+
* that goes true → false → true will NOT re-block a caller that
|
|
309
|
+
* already awaited through.
|
|
310
|
+
*/
|
|
311
|
+
_checkGates() {
|
|
312
|
+
for (const [, gate] of this._gates) if (!gate.resolved && gate.predicate(this.session)) {
|
|
313
|
+
gate.resolved = true;
|
|
314
|
+
gate.resolve();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
get session() {
|
|
318
|
+
return this.$session.get();
|
|
319
|
+
}
|
|
320
|
+
set session(value) {
|
|
321
|
+
this.$session.set(value);
|
|
322
|
+
this.emitChange();
|
|
323
|
+
}
|
|
324
|
+
get statusMessages() {
|
|
325
|
+
return this.$statusMessages.get();
|
|
326
|
+
}
|
|
327
|
+
get tasks() {
|
|
328
|
+
return this.$tasks.get();
|
|
329
|
+
}
|
|
330
|
+
get eventPlan() {
|
|
331
|
+
return this.$eventPlan.get();
|
|
332
|
+
}
|
|
333
|
+
get currentStage() {
|
|
334
|
+
return this.$currentStage.get();
|
|
335
|
+
}
|
|
336
|
+
/** No-op when the stage hasn't changed, so `startedAt` survives across
|
|
337
|
+
* re-renders and tab switches and measures real stage time. */
|
|
338
|
+
setCurrentStage(stage) {
|
|
339
|
+
if (this.$currentStage.get()?.stage === stage) return;
|
|
340
|
+
this.$currentStage.set({
|
|
341
|
+
stage,
|
|
342
|
+
startedAt: Date.now()
|
|
343
|
+
});
|
|
344
|
+
this.emitChange();
|
|
345
|
+
}
|
|
346
|
+
get statusExpanded() {
|
|
347
|
+
return this.$statusExpanded.get();
|
|
348
|
+
}
|
|
349
|
+
toggleStatusExpanded() {
|
|
350
|
+
this.$statusExpanded.set(!this.$statusExpanded.get());
|
|
351
|
+
this.emitChange();
|
|
352
|
+
}
|
|
353
|
+
setStatusExpanded(expanded) {
|
|
354
|
+
if (this.$statusExpanded.get() !== expanded) {
|
|
355
|
+
this.$statusExpanded.set(expanded);
|
|
356
|
+
this.emitChange();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
/** Sets setupConfirmed. Gate resolves via _checkGates(). */
|
|
360
|
+
completeSetup() {
|
|
361
|
+
this.$session.setKey("setupConfirmed", true);
|
|
362
|
+
analytics.wizardCapture("setup confirmed", sessionProperties(this.session));
|
|
363
|
+
this.emitChange();
|
|
364
|
+
}
|
|
365
|
+
setRunPhase(phase) {
|
|
366
|
+
this.$session.setKey("runPhase", phase);
|
|
367
|
+
this.emitChange();
|
|
368
|
+
}
|
|
369
|
+
setCredentials(credentials) {
|
|
370
|
+
this.$session.setKey("credentials", credentials);
|
|
371
|
+
if (credentials?.projectId) analytics.setTag("project_id", credentials.projectId);
|
|
372
|
+
analytics.wizardCapture("auth complete", { project_id: credentials?.projectId });
|
|
373
|
+
this.emitChange();
|
|
374
|
+
}
|
|
375
|
+
setRoleAtOrganization(role) {
|
|
376
|
+
this.$session.setKey("roleAtOrganization", role);
|
|
377
|
+
this.emitChange();
|
|
378
|
+
}
|
|
379
|
+
setApiUser(user) {
|
|
380
|
+
this.$session.setKey("apiUser", user);
|
|
381
|
+
this.emitChange();
|
|
382
|
+
}
|
|
383
|
+
setFrameworkConfig(integration, config) {
|
|
384
|
+
this.$session.setKey("integration", integration);
|
|
385
|
+
this.$session.setKey("frameworkConfig", config);
|
|
386
|
+
this.$session.setKey("unsupportedVersion", null);
|
|
387
|
+
if (integration) analytics.setTag("integration", integration);
|
|
388
|
+
this.emitChange();
|
|
389
|
+
}
|
|
390
|
+
setDetectionComplete() {
|
|
391
|
+
this.$session.setKey("detectionComplete", true);
|
|
392
|
+
this.emitChange();
|
|
393
|
+
}
|
|
394
|
+
setDetectedFramework(label) {
|
|
395
|
+
this.$session.setKey("detectedFrameworkLabel", label);
|
|
396
|
+
analytics.setTag("detected_framework", label);
|
|
397
|
+
this.emitChange();
|
|
398
|
+
}
|
|
399
|
+
setSkillId(skillId) {
|
|
400
|
+
this.$session.setKey("skillId", skillId);
|
|
401
|
+
this.emitChange();
|
|
402
|
+
}
|
|
403
|
+
setUnsupportedVersion(info) {
|
|
404
|
+
this.$session.setKey("unsupportedVersion", info);
|
|
405
|
+
this.emitChange();
|
|
406
|
+
}
|
|
407
|
+
setLoginUrl(url) {
|
|
408
|
+
this.$session.setKey("loginUrl", url);
|
|
409
|
+
this.emitChange();
|
|
410
|
+
}
|
|
411
|
+
setAuthorizeUrl(url) {
|
|
412
|
+
this.$session.setKey("authorizeUrl", url);
|
|
413
|
+
this.emitChange();
|
|
414
|
+
}
|
|
415
|
+
setReadinessResult(result) {
|
|
416
|
+
this.$session.setKey("readinessResult", result);
|
|
417
|
+
if (result && result.decision === "no") captureHealthCheckBlocked(result);
|
|
418
|
+
this.emitChange();
|
|
419
|
+
}
|
|
420
|
+
/** User dismissed the blocking outage screen. Gate resolves via _checkGates(). */
|
|
421
|
+
dismissOutage() {
|
|
422
|
+
logToFile("[health-checks] user dismissed outage screen, continuing");
|
|
423
|
+
this.$session.setKey("outageDismissed", true);
|
|
424
|
+
this.emitChange();
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Push the settings-override overlay and return a promise that blocks
|
|
428
|
+
* until the user dismisses it via backupAndFixSettingsOverride().
|
|
429
|
+
*/
|
|
430
|
+
showSettingsOverride(conflicts, backupAndFix) {
|
|
431
|
+
const allKeys = conflicts.flatMap((c) => c.keys);
|
|
432
|
+
this.$session.setKey("settingsOverrideKeys", allKeys);
|
|
433
|
+
this.$session.setKey("settingsConflicts", conflicts);
|
|
434
|
+
this._backupAndFixSettings = backupAndFix;
|
|
435
|
+
if (conflicts.some((c) => !c.writable)) this.pushOverlay("managed-settings");
|
|
436
|
+
else this.pushOverlay("settings-override");
|
|
437
|
+
return new Promise((resolve) => {
|
|
438
|
+
this._resolveSettingsOverride = resolve;
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Push the port-conflict overlay and return a promise that blocks
|
|
443
|
+
* until the user frees the ports and retries, or exits.
|
|
444
|
+
*/
|
|
445
|
+
showPortConflict(processInfo) {
|
|
446
|
+
this.$session.setKey("portConflictProcess", processInfo);
|
|
447
|
+
this.pushOverlay("port-conflict");
|
|
448
|
+
return new Promise((resolve) => {
|
|
449
|
+
this._resolvePortConflict = resolve;
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
/** Dismiss the port-conflict overlay and retry the OAuth port loop. */
|
|
453
|
+
resolvePortConflict() {
|
|
454
|
+
this.$session.setKey("portConflictProcess", null);
|
|
455
|
+
this.popOverlay();
|
|
456
|
+
this._resolvePortConflict?.();
|
|
457
|
+
this._resolvePortConflict = null;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Return a promise that resolves when the user submits a manually-entered
|
|
461
|
+
* OAuth code via the paste modal. The OAuth flow races this against the
|
|
462
|
+
* local callback server — see `performOAuthFlow`.
|
|
463
|
+
*/
|
|
464
|
+
waitForManualAuthCode() {
|
|
465
|
+
return new Promise((resolve) => {
|
|
466
|
+
this._resolveManualAuthCode = resolve;
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
/** Open the manual OAuth code-entry overlay over the auth screen. */
|
|
470
|
+
showManualAuthCode() {
|
|
471
|
+
this.pushOverlay("manual-auth-code");
|
|
472
|
+
}
|
|
473
|
+
/** Dismiss the manual OAuth code overlay without submitting. */
|
|
474
|
+
dismissManualAuthCode() {
|
|
475
|
+
this.popOverlay();
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Submit a manually-entered authorization code: dismiss the overlay and
|
|
479
|
+
* resolve the in-flight OAuth flow so it can exchange the code for a token.
|
|
480
|
+
*/
|
|
481
|
+
submitManualAuthCode(code) {
|
|
482
|
+
this.popOverlay();
|
|
483
|
+
this._resolveManualAuthCode?.(code);
|
|
484
|
+
this._resolveManualAuthCode = null;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Open the WizardAsk overlay with a set of questions and return a promise
|
|
488
|
+
* that resolves once the user submits answers (or the request is cancelled).
|
|
489
|
+
*
|
|
490
|
+
* Only one request is in flight at a time — calling this while a request
|
|
491
|
+
* is already pending throws.
|
|
492
|
+
*/
|
|
493
|
+
requestQuestion(question) {
|
|
494
|
+
if (this._resolvePendingQuestion) throw new Error("requestQuestion called while another wizard_ask request is pending");
|
|
495
|
+
this.$session.setKey("pendingQuestion", question);
|
|
496
|
+
this.pushOverlay("wizard-ask");
|
|
497
|
+
analytics.wizardCapture("wizard_ask shown", {
|
|
498
|
+
source: question.source,
|
|
499
|
+
question_count: question.questions.length,
|
|
500
|
+
kinds: question.questions.map((q) => q.kind)
|
|
501
|
+
});
|
|
502
|
+
return new Promise((resolve) => {
|
|
503
|
+
this._resolvePendingQuestion = resolve;
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Resolve the in-flight wizard_ask request with the user's answers and
|
|
508
|
+
* dismiss the overlay. Answers flow back to the agent as the tool result.
|
|
509
|
+
*/
|
|
510
|
+
resolvePendingQuestion(answers) {
|
|
511
|
+
const resolve = this._resolvePendingQuestion;
|
|
512
|
+
this._resolvePendingQuestion = null;
|
|
513
|
+
this.$session.setKey("pendingQuestion", null);
|
|
514
|
+
this.popOverlay();
|
|
515
|
+
resolve?.(answers);
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Cancel the in-flight wizard_ask request — the bridge sends a sentinel
|
|
519
|
+
* answer ("__cancelled__") so the skill can decide how to handle it.
|
|
520
|
+
*/
|
|
521
|
+
cancelPendingQuestion() {
|
|
522
|
+
const pending = this.session.pendingQuestion;
|
|
523
|
+
if (!pending) return;
|
|
524
|
+
const cancelled = {};
|
|
525
|
+
for (const q of pending.questions) cancelled[q.id] = "__cancelled__";
|
|
526
|
+
this.resolvePendingQuestion(cancelled);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Back up .claude/settings.json. Dismisses the overlay on success.
|
|
530
|
+
*/
|
|
531
|
+
backupAndFixSettingsOverride() {
|
|
532
|
+
const ok = this._backupAndFixSettings?.() ?? false;
|
|
533
|
+
if (ok) {
|
|
534
|
+
this.$session.setKey("settingsOverrideKeys", null);
|
|
535
|
+
this.$session.setKey("settingsConflicts", null);
|
|
536
|
+
this.popOverlay();
|
|
537
|
+
this._resolveSettingsOverride?.();
|
|
538
|
+
this._resolveSettingsOverride = null;
|
|
539
|
+
this._backupAndFixSettings = null;
|
|
540
|
+
}
|
|
541
|
+
return ok;
|
|
542
|
+
}
|
|
543
|
+
/** Push the auth-error overlay (no dismiss — user must exit). */
|
|
544
|
+
showAuthError(detail) {
|
|
545
|
+
this.$session.setKey("authErrorDetail", detail ?? null);
|
|
546
|
+
this.pushOverlay("auth-error");
|
|
547
|
+
}
|
|
548
|
+
/** Push the session-timeout overlay (no dismiss — user must exit). */
|
|
549
|
+
showSessionTimeout() {
|
|
550
|
+
this.pushOverlay("session-timeout");
|
|
551
|
+
}
|
|
552
|
+
addDiscoveredFeature(feature) {
|
|
553
|
+
if (!this.session.discoveredFeatures.includes(feature)) {
|
|
554
|
+
this.session.discoveredFeatures.push(feature);
|
|
555
|
+
this.emitChange();
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Enable an additional feature: enqueue it for the stop hook
|
|
560
|
+
* and set any feature-specific session flags.
|
|
561
|
+
*/
|
|
562
|
+
enableFeature(feature) {
|
|
563
|
+
if (!this.session.additionalFeatureQueue.includes(feature)) this.session.additionalFeatureQueue.push(feature);
|
|
564
|
+
if (feature === "llm") this.session.llmOptIn = true;
|
|
565
|
+
analytics.wizardCapture("feature enabled", { feature });
|
|
566
|
+
this.emitChange();
|
|
567
|
+
}
|
|
568
|
+
setMcpComplete(outcome = "skipped", installedClients = [], featuresSelected) {
|
|
569
|
+
this.$session.setKey("mcpComplete", true);
|
|
570
|
+
this.$session.setKey("mcpOutcome", outcome);
|
|
571
|
+
this.$session.setKey("mcpInstalledClients", installedClients);
|
|
572
|
+
const featuresPayload = outcome === "installed" && featuresSelected !== void 0 ? { mcp_features_selected: featuresSelected } : {};
|
|
573
|
+
analytics.wizardCapture("mcp complete", {
|
|
574
|
+
mcp_outcome: outcome,
|
|
575
|
+
mcp_installed_clients: installedClients,
|
|
576
|
+
...featuresPayload,
|
|
577
|
+
...sessionProperties(this.session)
|
|
578
|
+
});
|
|
579
|
+
this.emitChange();
|
|
580
|
+
}
|
|
581
|
+
setSkillsComplete(kept) {
|
|
582
|
+
this.$session.setKey("skillsComplete", true);
|
|
583
|
+
analytics.wizardCapture("skills complete", {
|
|
584
|
+
skills_kept: kept,
|
|
585
|
+
...sessionProperties(this.session)
|
|
586
|
+
});
|
|
587
|
+
this.emitChange();
|
|
588
|
+
}
|
|
589
|
+
setMcpSuggestedPromptsDismissed() {
|
|
590
|
+
this.$session.setKey("mcpSuggestedPromptsDismissed", true);
|
|
591
|
+
this.emitChange();
|
|
592
|
+
}
|
|
593
|
+
setSlackStepDismissed() {
|
|
594
|
+
this.$session.setKey("slackStepDismissed", true);
|
|
595
|
+
this.emitChange();
|
|
596
|
+
}
|
|
597
|
+
setSlackConnected(connected) {
|
|
598
|
+
this.$session.setKey("slackConnected", connected);
|
|
599
|
+
this.emitChange();
|
|
600
|
+
}
|
|
601
|
+
setOutroDismissed() {
|
|
602
|
+
this.$session.setKey("outroDismissed", true);
|
|
603
|
+
this.emitChange();
|
|
604
|
+
}
|
|
605
|
+
setOutroData(data) {
|
|
606
|
+
this.$session.setKey("outroData", data);
|
|
607
|
+
this.emitChange();
|
|
608
|
+
}
|
|
609
|
+
setDashboardUrl(url) {
|
|
610
|
+
logToFile(`store.setDashboardUrl: ${url}`);
|
|
611
|
+
this.$session.setKey("dashboardUrl", url);
|
|
612
|
+
this.emitChange();
|
|
613
|
+
}
|
|
614
|
+
setNotebookUrl(url) {
|
|
615
|
+
logToFile(`store.setNotebookUrl: ${url}`);
|
|
616
|
+
this.$session.setKey("notebookUrl", url);
|
|
617
|
+
this.emitChange();
|
|
618
|
+
}
|
|
619
|
+
setFrameworkContext(key, value) {
|
|
620
|
+
const ctx = {
|
|
621
|
+
...this.$session.get().frameworkContext,
|
|
622
|
+
[key]: value
|
|
623
|
+
};
|
|
624
|
+
this.$session.setKey("frameworkContext", ctx);
|
|
625
|
+
this.emitChange();
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* The screen that should be rendered right now.
|
|
629
|
+
* Derived from session state via the router.
|
|
630
|
+
*/
|
|
631
|
+
get currentScreen() {
|
|
632
|
+
return this.router.resolve(this.session);
|
|
633
|
+
}
|
|
634
|
+
/** Direction hint for screen transitions. */
|
|
635
|
+
get lastNavDirection() {
|
|
636
|
+
return this.router.lastNavDirection;
|
|
637
|
+
}
|
|
638
|
+
getVersion() {
|
|
639
|
+
return this.$version.get();
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Notify React that state has changed.
|
|
643
|
+
* The router re-resolves the active screen on next render.
|
|
644
|
+
* Gate predicates are checked and resolved if ready.
|
|
645
|
+
*/
|
|
646
|
+
emitChange() {
|
|
647
|
+
this.router._setDirection("push");
|
|
648
|
+
this.$version.set(this.$version.get() + 1);
|
|
649
|
+
this._checkGates();
|
|
650
|
+
this._detectTransition();
|
|
651
|
+
}
|
|
652
|
+
pushOverlay(overlay) {
|
|
653
|
+
this.router._setDirection("push");
|
|
654
|
+
this.router.pushOverlay(overlay);
|
|
655
|
+
this.$version.set(this.$version.get() + 1);
|
|
656
|
+
this._detectTransition();
|
|
657
|
+
}
|
|
658
|
+
popOverlay() {
|
|
659
|
+
this.router._setDirection("pop");
|
|
660
|
+
this.router.popOverlay();
|
|
661
|
+
this.$version.set(this.$version.get() + 1);
|
|
662
|
+
this._detectTransition();
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Register a callback to run when transitioning onto the given screen.
|
|
666
|
+
* Fires after every transition that lands on this screen.
|
|
667
|
+
*/
|
|
668
|
+
onEnterScreen(screen, fn) {
|
|
669
|
+
const list = this._enterScreenHooks.get(screen) ?? [];
|
|
670
|
+
list.push(fn);
|
|
671
|
+
this._enterScreenHooks.set(screen, list);
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Detect screen transitions, run enter-screen hooks, and fire analytics.
|
|
675
|
+
* Called at the end of emitChange/pushOverlay/popOverlay.
|
|
676
|
+
*/
|
|
677
|
+
_detectTransition() {
|
|
678
|
+
const next = this.router.resolve(this.session);
|
|
679
|
+
const prev = this._lastScreen;
|
|
680
|
+
if (next !== prev) analytics.setTag("$screen_name", next);
|
|
681
|
+
if (prev !== null && next !== prev) {
|
|
682
|
+
const hooks = this._enterScreenHooks.get(next);
|
|
683
|
+
if (hooks) for (const fn of hooks) fn();
|
|
684
|
+
analytics.wizardCapture(`screen ${next}`, {
|
|
685
|
+
from_screen: prev,
|
|
686
|
+
program_id: this.router.activeProgram,
|
|
687
|
+
...sessionProperties(this.session)
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
this._lastScreen = next;
|
|
691
|
+
}
|
|
692
|
+
pushStatus(message) {
|
|
693
|
+
const msgs = this.$statusMessages.get();
|
|
694
|
+
if (msgs.length > 0 && msgs[msgs.length - 1] === message) return;
|
|
695
|
+
const next = msgs.length >= MAX_STATUS_MESSAGES ? [...msgs.slice(msgs.length - MAX_STATUS_MESSAGES + 1), message] : [...msgs, message];
|
|
696
|
+
this.$statusMessages.set(next);
|
|
697
|
+
this.emitChange();
|
|
698
|
+
}
|
|
699
|
+
setTasks(tasks) {
|
|
700
|
+
this.$tasks.set(tasks);
|
|
701
|
+
this.emitChange();
|
|
702
|
+
}
|
|
703
|
+
updateTask(index, done) {
|
|
704
|
+
const tasks = this.$tasks.get();
|
|
705
|
+
if (tasks[index]) {
|
|
706
|
+
const updated = [...tasks];
|
|
707
|
+
updated[index] = {
|
|
708
|
+
...updated[index],
|
|
709
|
+
done,
|
|
710
|
+
status: done ? "completed" : "pending"
|
|
711
|
+
};
|
|
712
|
+
this.$tasks.set(updated);
|
|
713
|
+
this.emitChange();
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
setEventPlan(events) {
|
|
717
|
+
this.$eventPlan.set(events);
|
|
718
|
+
this.emitChange();
|
|
719
|
+
}
|
|
720
|
+
get learnCardBlockIdx() {
|
|
721
|
+
return this.$learnCardBlockIdx.get();
|
|
722
|
+
}
|
|
723
|
+
setLearnCardBlockIdx(idx) {
|
|
724
|
+
this.$learnCardBlockIdx.set(idx);
|
|
725
|
+
}
|
|
726
|
+
get learnCardComplete() {
|
|
727
|
+
return this.$learnCardComplete.get();
|
|
728
|
+
}
|
|
729
|
+
setLearnCardComplete() {
|
|
730
|
+
this.$learnCardComplete.set(true);
|
|
731
|
+
this.emitChange();
|
|
732
|
+
}
|
|
733
|
+
syncTodos(todos) {
|
|
734
|
+
const incoming = todos.map((t) => {
|
|
735
|
+
const status = isTaskStatus(t.status) ? t.status : "pending";
|
|
736
|
+
return {
|
|
737
|
+
label: t.content,
|
|
738
|
+
activeForm: t.activeForm,
|
|
739
|
+
status,
|
|
740
|
+
done: status === "completed"
|
|
741
|
+
};
|
|
742
|
+
});
|
|
743
|
+
const incomingLabels = new Set(incoming.map((t) => t.label));
|
|
744
|
+
const retained = this.$tasks.get().filter((t) => t.done && !incomingLabels.has(t.label));
|
|
745
|
+
this.$tasks.set([...retained, ...incoming]);
|
|
746
|
+
this.emitChange();
|
|
747
|
+
this._onTasksChanged?.();
|
|
748
|
+
}
|
|
749
|
+
/** Register a listener for task state changes (e.g. task stream push). */
|
|
750
|
+
set onTasksChanged(fn) {
|
|
751
|
+
this._onTasksChanged = fn;
|
|
752
|
+
}
|
|
753
|
+
subscribe(callback) {
|
|
754
|
+
return this.$version.listen(() => callback());
|
|
755
|
+
}
|
|
756
|
+
getSnapshot() {
|
|
757
|
+
return this.$version.get();
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
//#endregion
|
|
761
|
+
export { store_exports as n, WizardStore as t };
|
|
762
|
+
|
|
763
|
+
//# sourceMappingURL=store-D15C9YSW.js.map
|