@spekn/cli 1.0.1 → 1.0.2

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.
Files changed (79) hide show
  1. package/dist/main.js +34806 -29538
  2. package/dist/prompts/governance-analysis.prompt.md +109 -0
  3. package/dist/resources/prompts/repo-analysis.prompt.md +28 -136
  4. package/dist/resources/prompts/repo-sync-analysis.prompt.md +31 -68
  5. package/dist/tui/app.d.ts +7 -0
  6. package/dist/tui/app.js +122 -0
  7. package/dist/tui/args.d.ts +8 -0
  8. package/dist/tui/args.js +57 -0
  9. package/dist/tui/capabilities/policy.d.ts +7 -0
  10. package/dist/tui/capabilities/policy.js +64 -0
  11. package/dist/tui/chunk-4WEASLXY.mjs +3444 -0
  12. package/dist/tui/chunk-755CADEG.mjs +3401 -0
  13. package/dist/tui/chunk-BUJQVTY5.mjs +3409 -0
  14. package/dist/tui/chunk-BZKKMGFB.mjs +1959 -0
  15. package/dist/tui/chunk-DJYOBCNM.mjs +3159 -0
  16. package/dist/tui/chunk-GTFTFDY4.mjs +3417 -0
  17. package/dist/tui/chunk-IMEBD2KA.mjs +3444 -0
  18. package/dist/tui/chunk-IX6DR5SW.mjs +3433 -0
  19. package/dist/tui/chunk-JKFOY4IF.mjs +2003 -0
  20. package/dist/tui/chunk-OXXZ3O5L.mjs +3378 -0
  21. package/dist/tui/chunk-SHJNIAAJ.mjs +1697 -0
  22. package/dist/tui/chunk-V4SNDRUS.mjs +1666 -0
  23. package/dist/tui/chunk-VXVHNZST.mjs +1666 -0
  24. package/dist/tui/chunk-WCTSFKTA.mjs +3459 -0
  25. package/dist/tui/chunk-X2XP5ACW.mjs +3443 -0
  26. package/dist/tui/chunk-YUYJ7VBG.mjs +2029 -0
  27. package/dist/tui/chunk-ZM3EI5IA.mjs +3384 -0
  28. package/dist/tui/chunk-ZYOX64HP.mjs +1653 -0
  29. package/dist/tui/components/frame.d.ts +8 -0
  30. package/dist/tui/components/frame.js +8 -0
  31. package/dist/tui/components/status-bar.d.ts +8 -0
  32. package/dist/tui/components/status-bar.js +8 -0
  33. package/dist/tui/index.d.ts +2 -0
  34. package/dist/tui/index.js +23 -0
  35. package/dist/tui/index.mjs +6999 -6938
  36. package/dist/tui/keymap/use-global-keymap.d.ts +19 -0
  37. package/dist/tui/keymap/use-global-keymap.js +82 -0
  38. package/dist/tui/navigation/nav-items.d.ts +3 -0
  39. package/dist/tui/navigation/nav-items.js +18 -0
  40. package/dist/tui/prompts/spec-creation-system.prompt.md +47 -0
  41. package/dist/tui/prompts/spec-refinement-system.prompt.md +72 -0
  42. package/dist/tui/screens/bridge.d.ts +8 -0
  43. package/dist/tui/screens/bridge.js +19 -0
  44. package/dist/tui/screens/decisions.d.ts +5 -0
  45. package/dist/tui/screens/decisions.js +28 -0
  46. package/dist/tui/screens/export.d.ts +5 -0
  47. package/dist/tui/screens/export.js +16 -0
  48. package/dist/tui/screens/home.d.ts +5 -0
  49. package/dist/tui/screens/home.js +33 -0
  50. package/dist/tui/screens/locked.d.ts +5 -0
  51. package/dist/tui/screens/locked.js +9 -0
  52. package/dist/tui/screens/specs.d.ts +5 -0
  53. package/dist/tui/screens/specs.js +31 -0
  54. package/dist/tui/services/client.d.ts +1 -0
  55. package/dist/tui/services/client.js +18 -0
  56. package/dist/tui/services/context-service.d.ts +19 -0
  57. package/dist/tui/services/context-service.js +246 -0
  58. package/dist/tui/shared-enums.d.ts +16 -0
  59. package/dist/tui/shared-enums.js +19 -0
  60. package/dist/tui/state/use-app-state.d.ts +35 -0
  61. package/dist/tui/state/use-app-state.js +177 -0
  62. package/dist/tui/types.d.ts +77 -0
  63. package/dist/tui/types.js +2 -0
  64. package/dist/tui/use-session-store-63YUGUFA.mjs +8 -0
  65. package/dist/tui/use-session-store-ACO2SMJC.mjs +8 -0
  66. package/dist/tui/use-session-store-BVFDAWOB.mjs +8 -0
  67. package/dist/tui/use-session-store-DJIZ3FQZ.mjs +9 -0
  68. package/dist/tui/use-session-store-EAIQA4UG.mjs +9 -0
  69. package/dist/tui/use-session-store-EFBAXC3G.mjs +8 -0
  70. package/dist/tui/use-session-store-FJOR4KTG.mjs +8 -0
  71. package/dist/tui/use-session-store-IJE5KVOC.mjs +8 -0
  72. package/dist/tui/use-session-store-KGAFXCKI.mjs +8 -0
  73. package/dist/tui/use-session-store-KS4DPNDY.mjs +8 -0
  74. package/dist/tui/use-session-store-MMHJENNL.mjs +8 -0
  75. package/dist/tui/use-session-store-OZ6HC4I2.mjs +9 -0
  76. package/dist/tui/use-session-store-PTMWISNJ.mjs +8 -0
  77. package/dist/tui/use-session-store-VCDECQMW.mjs +8 -0
  78. package/dist/tui/use-session-store-VOK5ML5J.mjs +9 -0
  79. package/package.json +6 -3
@@ -0,0 +1,1666 @@
1
+ import {
2
+ OrganizationPlan,
3
+ WorkflowPhase,
4
+ __name,
5
+ appendGlobalStructuredLog,
6
+ getClient,
7
+ getService,
8
+ persistProjectContext,
9
+ setClient
10
+ } from "./chunk-JKFOY4IF.mjs";
11
+
12
+ // src/store/use-session-store.ts
13
+ import { create as create6 } from "zustand";
14
+ import { subscribeWithSelector as subscribeWithSelector6 } from "zustand/middleware";
15
+
16
+ // src/store/use-tui-ui-store.ts
17
+ import { create } from "zustand";
18
+ import { subscribeWithSelector } from "zustand/middleware";
19
+ var _initialScreen = "home";
20
+ function setInitialScreen(screen) {
21
+ _initialScreen = screen;
22
+ }
23
+ __name(setInitialScreen, "setInitialScreen");
24
+ var initialState = {
25
+ screen: _initialScreen,
26
+ showHelp: false,
27
+ commandMode: false,
28
+ searchQuery: "",
29
+ navMode: "content",
30
+ cursorSpec: null,
31
+ cursorDecision: null,
32
+ openedSpecId: void 0,
33
+ editorMenuOpen: false,
34
+ statusMenuOpen: false,
35
+ aiRefineMenuOpen: false,
36
+ editorLaunching: false,
37
+ selectedEditor: "",
38
+ selectedOrganizationIndex: void 0,
39
+ selectedProjectIndex: void 0,
40
+ newProjectName: void 0,
41
+ specCreateOpen: false,
42
+ specRefineOpen: false,
43
+ specRefineTargetId: void 0,
44
+ generationPanelOpen: false,
45
+ generationPanelSpecId: void 0,
46
+ selectedAnalysisAgent: "auto"
47
+ };
48
+ var useTuiUiStore = create()(subscribeWithSelector((set) => ({
49
+ ...initialState,
50
+ screen: _initialScreen,
51
+ setScreen: /* @__PURE__ */ __name((screen) => set({
52
+ screen
53
+ }), "setScreen"),
54
+ toggleHelp: /* @__PURE__ */ __name(() => set((prev) => ({
55
+ showHelp: !prev.showHelp
56
+ })), "toggleHelp"),
57
+ setShowHelp: /* @__PURE__ */ __name((show) => set({
58
+ showHelp: show
59
+ }), "setShowHelp"),
60
+ setCommandMode: /* @__PURE__ */ __name((enabled) => set({
61
+ commandMode: enabled
62
+ }), "setCommandMode"),
63
+ setSearchQuery: /* @__PURE__ */ __name((query) => set({
64
+ searchQuery: query
65
+ }), "setSearchQuery"),
66
+ setNavMode: /* @__PURE__ */ __name((mode) => set({
67
+ navMode: mode
68
+ }), "setNavMode"),
69
+ setCursorSpec: /* @__PURE__ */ __name((spec) => set({
70
+ cursorSpec: spec
71
+ }), "setCursorSpec"),
72
+ setCursorDecision: /* @__PURE__ */ __name((decision) => set({
73
+ cursorDecision: decision
74
+ }), "setCursorDecision"),
75
+ setOpenedSpecId: /* @__PURE__ */ __name((specId) => set({
76
+ openedSpecId: specId
77
+ }), "setOpenedSpecId"),
78
+ setSelectedEditor: /* @__PURE__ */ __name((editor) => set({
79
+ selectedEditor: editor
80
+ }), "setSelectedEditor"),
81
+ setEditorMenuOpen: /* @__PURE__ */ __name((open) => set({
82
+ editorMenuOpen: open
83
+ }), "setEditorMenuOpen"),
84
+ setStatusMenuOpen: /* @__PURE__ */ __name((open) => set({
85
+ statusMenuOpen: open
86
+ }), "setStatusMenuOpen"),
87
+ setAiRefineMenuOpen: /* @__PURE__ */ __name((open) => set({
88
+ aiRefineMenuOpen: open
89
+ }), "setAiRefineMenuOpen"),
90
+ setEditorLaunching: /* @__PURE__ */ __name((launching) => set({
91
+ editorLaunching: launching
92
+ }), "setEditorLaunching"),
93
+ openEditorMenuForSpec: /* @__PURE__ */ __name((specId, editor) => set({
94
+ openedSpecId: specId,
95
+ selectedEditor: editor,
96
+ editorMenuOpen: true
97
+ }), "openEditorMenuForSpec"),
98
+ resetSpecsUi: /* @__PURE__ */ __name(() => set({
99
+ openedSpecId: void 0,
100
+ cursorSpec: null,
101
+ editorMenuOpen: false,
102
+ statusMenuOpen: false,
103
+ aiRefineMenuOpen: false,
104
+ editorLaunching: false,
105
+ specCreateOpen: false,
106
+ specRefineOpen: false,
107
+ specRefineTargetId: void 0,
108
+ generationPanelOpen: false,
109
+ generationPanelSpecId: void 0
110
+ }), "resetSpecsUi"),
111
+ setSelectedOrganizationIndex: /* @__PURE__ */ __name((index) => set({
112
+ selectedOrganizationIndex: index
113
+ }), "setSelectedOrganizationIndex"),
114
+ setSelectedProjectIndex: /* @__PURE__ */ __name((index) => set({
115
+ selectedProjectIndex: index
116
+ }), "setSelectedProjectIndex"),
117
+ setNewProjectName: /* @__PURE__ */ __name((name) => set({
118
+ newProjectName: name
119
+ }), "setNewProjectName"),
120
+ setSelectedAnalysisAgent: /* @__PURE__ */ __name((agent) => set({
121
+ selectedAnalysisAgent: agent
122
+ }), "setSelectedAnalysisAgent"),
123
+ resetOnboardingUi: /* @__PURE__ */ __name(() => set({
124
+ selectedOrganizationIndex: void 0,
125
+ selectedProjectIndex: void 0,
126
+ newProjectName: void 0,
127
+ selectedAnalysisAgent: "auto"
128
+ }), "resetOnboardingUi"),
129
+ setSpecCreateOpen: /* @__PURE__ */ __name((open) => set({
130
+ specCreateOpen: open
131
+ }), "setSpecCreateOpen"),
132
+ setSpecRefineOpen: /* @__PURE__ */ __name((open, targetId) => set({
133
+ specRefineOpen: open,
134
+ specRefineTargetId: targetId
135
+ }), "setSpecRefineOpen"),
136
+ setGenerationPanelOpen: /* @__PURE__ */ __name((open, specId) => set({
137
+ generationPanelOpen: open,
138
+ generationPanelSpecId: specId
139
+ }), "setGenerationPanelOpen"),
140
+ showTooltip: /* @__PURE__ */ __name((message, duration = 3e3) => set((state) => {
141
+ if (state.tooltipTimeout) {
142
+ clearTimeout(state.tooltipTimeout);
143
+ }
144
+ const timeout = setTimeout(() => {
145
+ useTuiUiStore.getState().clearTooltip();
146
+ }, duration);
147
+ return {
148
+ tooltip: message,
149
+ tooltipTimeout: timeout
150
+ };
151
+ }), "showTooltip"),
152
+ clearTooltip: /* @__PURE__ */ __name(() => set((state) => {
153
+ if (state.tooltipTimeout) {
154
+ clearTimeout(state.tooltipTimeout);
155
+ }
156
+ return {
157
+ tooltip: void 0,
158
+ tooltipTimeout: void 0
159
+ };
160
+ }), "clearTooltip")
161
+ })));
162
+
163
+ // src/capabilities/policy.ts
164
+ var TIER_ORDER = {
165
+ [OrganizationPlan.FREE]: 0,
166
+ [OrganizationPlan.PRO]: 1,
167
+ [OrganizationPlan.TEAM]: 2,
168
+ [OrganizationPlan.ENTERPRISE]: 3
169
+ };
170
+ var NAV_DEFINITIONS = [
171
+ {
172
+ id: "home",
173
+ label: "Home",
174
+ description: "Next actions and workflow pulse",
175
+ requiredPlan: OrganizationPlan.FREE
176
+ },
177
+ {
178
+ id: "specs",
179
+ label: "Specs",
180
+ description: "Manage governed specifications",
181
+ requiredPlan: OrganizationPlan.FREE
182
+ },
183
+ {
184
+ id: "decisions",
185
+ label: "Decision Log",
186
+ description: "Review decisions and rationale",
187
+ requiredPlan: OrganizationPlan.FREE
188
+ },
189
+ {
190
+ id: "export",
191
+ label: "Export",
192
+ description: "Generate AGENTS.md / CLAUDE.md / .cursorrules",
193
+ requiredPlan: OrganizationPlan.FREE
194
+ },
195
+ {
196
+ id: "bridge",
197
+ label: "Local Bridge",
198
+ description: "Bridge status and controls",
199
+ requiredPlan: OrganizationPlan.FREE
200
+ },
201
+ {
202
+ id: "active-runs",
203
+ label: "Active Runs",
204
+ description: "Realtime orchestration dashboard",
205
+ requiredPlan: OrganizationPlan.TEAM
206
+ },
207
+ {
208
+ id: "phase-gates",
209
+ label: "Phase Gates",
210
+ description: "Approve and unblock workflow phases",
211
+ requiredPlan: OrganizationPlan.TEAM
212
+ },
213
+ {
214
+ id: "skills-marketplace",
215
+ label: "Skills Marketplace",
216
+ description: "Manage shared managed skills",
217
+ requiredPlan: OrganizationPlan.TEAM
218
+ },
219
+ {
220
+ id: "org-governance",
221
+ label: "Org Governance",
222
+ description: "Compliance, policy, deployment gates",
223
+ requiredPlan: OrganizationPlan.ENTERPRISE
224
+ }
225
+ ];
226
+ var GATE_DISABLED_PHASES = [
227
+ WorkflowPhase.SPECIFY,
228
+ WorkflowPhase.CLARIFY
229
+ ];
230
+ function meetsMinimumTier(current, required) {
231
+ return TIER_ORDER[current] >= TIER_ORDER[required];
232
+ }
233
+ __name(meetsMinimumTier, "meetsMinimumTier");
234
+ function resolveNavPolicy(ctx) {
235
+ return NAV_DEFINITIONS.map((item) => {
236
+ if (!meetsMinimumTier(ctx.plan, item.requiredPlan)) {
237
+ return {
238
+ ...item,
239
+ state: "locked",
240
+ reason: `Requires ${item.requiredPlan.toUpperCase()} tier`
241
+ };
242
+ }
243
+ if (item.id === "phase-gates" && ctx.role === "viewer") {
244
+ return {
245
+ ...item,
246
+ state: "disabled",
247
+ reason: "Viewer role cannot approve gates"
248
+ };
249
+ }
250
+ if (item.id === "phase-gates" && ctx.workflowPhase && GATE_DISABLED_PHASES.includes(ctx.workflowPhase)) {
251
+ return {
252
+ ...item,
253
+ state: "disabled",
254
+ reason: `Gate approvals are unavailable in ${ctx.workflowPhase} phase`
255
+ };
256
+ }
257
+ return {
258
+ ...item,
259
+ state: "enabled"
260
+ };
261
+ });
262
+ }
263
+ __name(resolveNavPolicy, "resolveNavPolicy");
264
+
265
+ // src/state/onboarding-utils.ts
266
+ function logOnboardingAttachResult(appendLog, result) {
267
+ if (result.warning) {
268
+ appendLog(`[warn] ${result.warning}`);
269
+ }
270
+ if (result.analyzed) {
271
+ appendLog("[setup] Repository attached and analysis complete.");
272
+ } else if (result.warning) {
273
+ appendLog("[setup] Repository attached; analysis did not fully complete.");
274
+ } else {
275
+ appendLog("[setup] Repository already attached. Metadata sync complete (analysis skipped).");
276
+ }
277
+ }
278
+ __name(logOnboardingAttachResult, "logOnboardingAttachResult");
279
+
280
+ // src/store/windows/use-onboarding-window.ts
281
+ import { create as create2 } from "zustand";
282
+ import { subscribeWithSelector as subscribeWithSelector2 } from "zustand/middleware";
283
+ var useOnboardingWindow = create2()(subscribeWithSelector2((set) => ({
284
+ mode: "initial-setup",
285
+ step: "organization",
286
+ attachCurrentFolder: true,
287
+ runLines: [],
288
+ runStatus: "running",
289
+ startedAt: null,
290
+ availableAgents: [],
291
+ canCreateProject: false,
292
+ toolCalls: {},
293
+ setMode: /* @__PURE__ */ __name((mode) => set({
294
+ mode
295
+ }), "setMode"),
296
+ setStep: /* @__PURE__ */ __name((step) => set({
297
+ step
298
+ }), "setStep"),
299
+ setSelectedOrganizationIndex: /* @__PURE__ */ __name((index) => set({
300
+ selectedOrganizationIndex: index
301
+ }), "setSelectedOrganizationIndex"),
302
+ setSelectedProjectIndex: /* @__PURE__ */ __name((index) => set({
303
+ selectedProjectIndex: index
304
+ }), "setSelectedProjectIndex"),
305
+ setNewProjectName: /* @__PURE__ */ __name((name) => set({
306
+ newProjectName: name
307
+ }), "setNewProjectName"),
308
+ setAttachCurrentFolder: /* @__PURE__ */ __name((attach) => set({
309
+ attachCurrentFolder: attach
310
+ }), "setAttachCurrentFolder"),
311
+ setRunLines: /* @__PURE__ */ __name((lines) => set({
312
+ runLines: lines
313
+ }), "setRunLines"),
314
+ addRunLine: /* @__PURE__ */ __name((line) => set((state) => ({
315
+ runLines: [
316
+ ...state.runLines,
317
+ line
318
+ ].slice(-400)
319
+ })), "addRunLine"),
320
+ setRunStatus: /* @__PURE__ */ __name((status) => set({
321
+ runStatus: status
322
+ }), "setRunStatus"),
323
+ setStartedAt: /* @__PURE__ */ __name((ts) => set({
324
+ startedAt: ts
325
+ }), "setStartedAt"),
326
+ setInteraction: /* @__PURE__ */ __name((interaction) => set({
327
+ interaction
328
+ }), "setInteraction"),
329
+ setError: /* @__PURE__ */ __name((error) => set({
330
+ error
331
+ }), "setError"),
332
+ setSelectedOrganizationId: /* @__PURE__ */ __name((id) => set({
333
+ selectedOrganizationId: id
334
+ }), "setSelectedOrganizationId"),
335
+ setSelectedProjectId: /* @__PURE__ */ __name((id) => set({
336
+ selectedProjectId: id
337
+ }), "setSelectedProjectId"),
338
+ setAvailableAgents: /* @__PURE__ */ __name((agents) => set({
339
+ availableAgents: agents
340
+ }), "setAvailableAgents"),
341
+ setCanCreateProject: /* @__PURE__ */ __name((canCreate) => set({
342
+ canCreateProject: canCreate
343
+ }), "setCanCreateProject"),
344
+ upsertToolCall: /* @__PURE__ */ __name((event) => set((state) => {
345
+ const id = event.toolCallId ?? `tc-${Date.now()}`;
346
+ const existing = state.toolCalls[id];
347
+ const updated = existing ? {
348
+ ...existing,
349
+ status: event.status ?? existing.status,
350
+ title: event.title ?? existing.title,
351
+ locations: event.locations ?? existing.locations,
352
+ completedAt: event.status === "completed" || event.status === "failed" ? Date.now() : existing.completedAt
353
+ } : {
354
+ toolCallId: id,
355
+ title: event.title ?? event.toolName ?? "Tool call",
356
+ toolName: event.toolName,
357
+ kind: event.kind ?? "other",
358
+ status: event.status ?? "in_progress",
359
+ locations: event.locations ?? [],
360
+ startedAt: Date.now()
361
+ };
362
+ return {
363
+ toolCalls: {
364
+ ...state.toolCalls,
365
+ [id]: updated
366
+ }
367
+ };
368
+ }), "upsertToolCall"),
369
+ setActiveThought: /* @__PURE__ */ __name((text) => set({
370
+ activeThought: text
371
+ }), "setActiveThought"),
372
+ reset: /* @__PURE__ */ __name(() => set({
373
+ mode: "initial-setup",
374
+ step: "organization",
375
+ selectedOrganizationIndex: void 0,
376
+ selectedProjectIndex: void 0,
377
+ newProjectName: void 0,
378
+ attachCurrentFolder: true,
379
+ runLines: [],
380
+ runStatus: "running",
381
+ startedAt: null,
382
+ interaction: void 0,
383
+ error: void 0,
384
+ selectedOrganizationId: void 0,
385
+ selectedProjectId: void 0,
386
+ availableAgents: [],
387
+ canCreateProject: false,
388
+ toolCalls: {},
389
+ activeThought: void 0
390
+ }), "reset")
391
+ })));
392
+
393
+ // src/store/auth-utils.ts
394
+ function isAuthenticationError(message) {
395
+ const normalized = message.toLowerCase();
396
+ return normalized.includes("authentication required") || normalized.includes("no valid credentials") || normalized.includes("unauthorized") || normalized.includes("forbidden") || normalized.includes("invalid token") || normalized.includes("token expired") || normalized.includes("auth");
397
+ }
398
+ __name(isAuthenticationError, "isAuthenticationError");
399
+
400
+ // src/store/use-project-data-store.ts
401
+ import { create as create3 } from "zustand";
402
+ import { subscribeWithSelector as subscribeWithSelector3 } from "zustand/middleware";
403
+ var EMPTY_WORKFLOW = {
404
+ currentPhase: null,
405
+ blockedCount: 0,
406
+ hasPlanningArtifacts: false,
407
+ hasVerificationEvidence: false
408
+ };
409
+ var useProjectDataStore = create3()(subscribeWithSelector3((set, get) => ({
410
+ specs: [],
411
+ decisions: [],
412
+ workflow: EMPTY_WORKFLOW,
413
+ navPolicy: [],
414
+ specGenerations: {},
415
+ activeGenerationId: null,
416
+ setProjectData: /* @__PURE__ */ __name((specs, decisions, workflow, navPolicy) => set({
417
+ specs,
418
+ decisions,
419
+ workflow,
420
+ navPolicy
421
+ }), "setProjectData"),
422
+ setPollingData: /* @__PURE__ */ __name((workflow, navPolicy) => set({
423
+ workflow,
424
+ navPolicy
425
+ }), "setPollingData"),
426
+ clearProjectData: /* @__PURE__ */ __name(() => set({
427
+ specs: [],
428
+ decisions: [],
429
+ workflow: EMPTY_WORKFLOW,
430
+ navPolicy: [],
431
+ specGenerations: {},
432
+ activeGenerationId: null
433
+ }), "clearProjectData"),
434
+ updateSpecificationContent: /* @__PURE__ */ __name(async (specificationId, content) => {
435
+ const client = getClient();
436
+ const boot = getBootContext();
437
+ if (!client || !boot) return;
438
+ await withSessionFeedback({
439
+ statusLine: "Saving specification...",
440
+ action: /* @__PURE__ */ __name(() => getService().updateSpecificationContent(client, boot.projectId, specificationId, content), "action"),
441
+ successLog: "[specs] saved specification changes",
442
+ failureLog: "[error] save failed",
443
+ failureStatusLine: "Save failed"
444
+ });
445
+ }, "updateSpecificationContent"),
446
+ updateSpecificationStatus: /* @__PURE__ */ __name(async (specificationId, status, options) => {
447
+ const client = getClient();
448
+ const boot = getBootContext();
449
+ if (!client || !boot) return;
450
+ setSessionStatusLine(`Updating status to ${status}...`);
451
+ try {
452
+ await getService().updateSpecificationStatus(client, boot.projectId, specificationId, status);
453
+ appendSessionLog(`[specs] status updated to ${status}`);
454
+ if (options?.refresh !== false) {
455
+ const { useSessionStore: useSessionStore2 } = await import("./use-session-store-DJIZ3FQZ.mjs");
456
+ await useSessionStore2.getState().refresh();
457
+ }
458
+ } catch (error) {
459
+ const message = error instanceof Error ? error.message : String(error);
460
+ appendSessionLog(`[error] status update failed: ${message}`);
461
+ setSessionStatusLine("Status update failed");
462
+ refreshOnAuthenticationError(message);
463
+ }
464
+ }, "updateSpecificationStatus"),
465
+ deleteSpecification: /* @__PURE__ */ __name(async (specificationId, mode = "archive", options) => {
466
+ const client = getClient();
467
+ const boot = getBootContext();
468
+ if (!client || !boot) return;
469
+ setSessionStatusLine(mode === "delete" ? "Deleting specification permanently..." : "Archiving specification...");
470
+ try {
471
+ await getService().deleteSpecification(client, boot.projectId, specificationId, mode);
472
+ appendSessionLog(mode === "delete" ? "[specs] specification deleted permanently" : "[specs] specification archived");
473
+ if (options?.refresh !== false) {
474
+ const { useSessionStore: useSessionStore2 } = await import("./use-session-store-DJIZ3FQZ.mjs");
475
+ await useSessionStore2.getState().refresh();
476
+ }
477
+ } catch (error) {
478
+ const message = error instanceof Error ? error.message : String(error);
479
+ appendSessionLog(`[error] specification ${mode === "delete" ? "delete" : "archive"} failed: ${message}`);
480
+ setSessionStatusLine(mode === "delete" ? "Permanent delete failed" : "Archive failed");
481
+ refreshOnAuthenticationError(message);
482
+ }
483
+ }, "deleteSpecification"),
484
+ refineSpecificationWithAi: /* @__PURE__ */ __name(async (specificationId, userMessage) => {
485
+ const client = getClient();
486
+ const boot = getBootContext();
487
+ const { specs } = get();
488
+ if (!client || !boot) return;
489
+ const spec = specs.find((item) => item.id === specificationId);
490
+ if (!spec) {
491
+ appendSessionLog("[error] refine failed: specification not found in current list");
492
+ setSessionStatusLine("Refinement failed");
493
+ return;
494
+ }
495
+ const specContent = (spec.content ?? "").trim();
496
+ if (!specContent) {
497
+ appendSessionLog("[error] refine failed: selected specification has no content");
498
+ setSessionStatusLine("Refinement failed");
499
+ return;
500
+ }
501
+ setSessionStatusLine("Refining specification with AI...");
502
+ const service = getService();
503
+ try {
504
+ const refinedContent = await service.refineSpecificationWithAi(client, {
505
+ projectId: boot.projectId,
506
+ specContent,
507
+ userMessage,
508
+ agentType: "codex"
509
+ });
510
+ await service.updateSpecificationContent(client, boot.projectId, specificationId, refinedContent);
511
+ appendSessionLog("[specs] AI refinement applied and saved");
512
+ const { useSessionStore: useSessionStore2 } = await import("./use-session-store-DJIZ3FQZ.mjs");
513
+ await useSessionStore2.getState().refresh();
514
+ } catch (error) {
515
+ const message = error instanceof Error ? error.message : String(error);
516
+ appendSessionLog(`[error] AI refinement failed: ${message}`);
517
+ setSessionStatusLine("AI refinement failed");
518
+ refreshOnAuthenticationError(message);
519
+ }
520
+ }, "refineSpecificationWithAi"),
521
+ resolveDecision: /* @__PURE__ */ __name(async (decisionId, status, reason, existingRationale, options) => {
522
+ const client = getClient();
523
+ const boot = getBootContext();
524
+ if (!client || !boot) {
525
+ throw new Error("Decision update unavailable: project context is not initialized.");
526
+ }
527
+ setSessionStatusLine(`Resolving decision as ${status}...`);
528
+ try {
529
+ await getService().resolveDecision(client, boot.projectId, decisionId, status, reason, existingRationale);
530
+ appendSessionLog(`[decisions] ${decisionId} -> ${status}`);
531
+ if (options?.refresh !== false) {
532
+ const { useSessionStore: useSessionStore2 } = await import("./use-session-store-DJIZ3FQZ.mjs");
533
+ await useSessionStore2.getState().refresh();
534
+ }
535
+ } catch (error) {
536
+ const message = error instanceof Error ? error.message : String(error);
537
+ appendSessionLog(`[error] decision resolution failed: ${message}`);
538
+ setSessionStatusLine("Decision resolution failed");
539
+ refreshOnAuthenticationError(message);
540
+ throw error;
541
+ }
542
+ }, "resolveDecision"),
543
+ deleteDecision: /* @__PURE__ */ __name(async (decisionId, mode = "archive", options) => {
544
+ const client = getClient();
545
+ const boot = getBootContext();
546
+ if (!client || !boot) {
547
+ throw new Error("Decision delete unavailable: project context is not initialized.");
548
+ }
549
+ setSessionStatusLine(mode === "delete" ? "Deleting decision permanently..." : "Archiving decision...");
550
+ try {
551
+ await getService().deleteDecision(client, boot.projectId, decisionId, mode);
552
+ appendSessionLog(mode === "delete" ? `[decisions] ${decisionId} deleted permanently` : `[decisions] ${decisionId} archived`);
553
+ if (options?.refresh !== false) {
554
+ const { useSessionStore: useSessionStore2 } = await import("./use-session-store-DJIZ3FQZ.mjs");
555
+ await useSessionStore2.getState().refresh();
556
+ }
557
+ } catch (error) {
558
+ const message = error instanceof Error ? error.message : String(error);
559
+ appendSessionLog(`[error] decision ${mode === "delete" ? "delete" : "archive"} failed: ${message}`);
560
+ setSessionStatusLine(mode === "delete" ? "Permanent delete failed" : "Archive failed");
561
+ refreshOnAuthenticationError(message);
562
+ throw error;
563
+ }
564
+ }, "deleteDecision"),
565
+ loadGenerations: /* @__PURE__ */ __name(async (specId) => {
566
+ const client = getClient();
567
+ const boot = getBootContext();
568
+ if (!client || !boot) return;
569
+ try {
570
+ const gens = await getService().listGenerations(client, boot.projectId, specId);
571
+ set((state) => ({
572
+ specGenerations: {
573
+ ...state.specGenerations,
574
+ [specId]: gens.map((g) => ({
575
+ id: g.id,
576
+ generationNumber: g.generationNumber,
577
+ status: g.status,
578
+ createdBy: g.createdBy ?? "",
579
+ createdAt: g.createdAt ?? "",
580
+ lockedBy: g.lockedBy,
581
+ lockedAt: g.lockedAt,
582
+ qualityScore: g.qualityScore,
583
+ qualityGrade: g.qualityGrade,
584
+ content: g.content
585
+ }))
586
+ }
587
+ }));
588
+ } catch (error) {
589
+ const message = error instanceof Error ? error.message : String(error);
590
+ appendSessionLog(`[specs] failed to load generations: ${message}`);
591
+ refreshOnAuthenticationError(message);
592
+ }
593
+ }, "loadGenerations"),
594
+ setActiveGenerationId: /* @__PURE__ */ __name((genId) => set({
595
+ activeGenerationId: genId
596
+ }), "setActiveGenerationId")
597
+ })));
598
+
599
+ // src/store/use-export-store.ts
600
+ import { create as create4 } from "zustand";
601
+ import { subscribeWithSelector as subscribeWithSelector4 } from "zustand/middleware";
602
+
603
+ // src/utils/clipboard.ts
604
+ import { spawnSync } from "child_process";
605
+ function clipboardAttempts() {
606
+ if (process.platform === "darwin") {
607
+ return [
608
+ {
609
+ cmd: "pbcopy",
610
+ args: []
611
+ }
612
+ ];
613
+ }
614
+ if (process.platform === "win32") {
615
+ return [
616
+ {
617
+ cmd: "clip",
618
+ args: []
619
+ }
620
+ ];
621
+ }
622
+ return [
623
+ {
624
+ cmd: "wl-copy",
625
+ args: []
626
+ },
627
+ {
628
+ cmd: "xclip",
629
+ args: [
630
+ "-selection",
631
+ "clipboard"
632
+ ]
633
+ },
634
+ {
635
+ cmd: "xsel",
636
+ args: [
637
+ "--clipboard",
638
+ "--input"
639
+ ]
640
+ }
641
+ ];
642
+ }
643
+ __name(clipboardAttempts, "clipboardAttempts");
644
+ function copyTextToClipboard(text) {
645
+ const attempts = clipboardAttempts();
646
+ let lastError = "No clipboard command available.";
647
+ for (const attempt of attempts) {
648
+ const result = spawnSync(attempt.cmd, attempt.args, {
649
+ input: text,
650
+ encoding: "utf8",
651
+ stdio: [
652
+ "pipe",
653
+ "ignore",
654
+ "pipe"
655
+ ]
656
+ });
657
+ if (!result.error && result.status === 0) {
658
+ return {
659
+ ok: true
660
+ };
661
+ }
662
+ lastError = (result.error?.message ?? result.stderr?.trim()) || `${attempt.cmd} exited with status ${result.status}`;
663
+ }
664
+ return {
665
+ ok: false,
666
+ error: lastError
667
+ };
668
+ }
669
+ __name(copyTextToClipboard, "copyTextToClipboard");
670
+
671
+ // src/store/use-export-store.ts
672
+ var EMPTY_EXPORT_JOB = {
673
+ action: null,
674
+ status: "idle"
675
+ };
676
+ async function runExport(action) {
677
+ const state = useExportStore.getState();
678
+ const boot = getBootContext();
679
+ if (!boot) return;
680
+ if (state.exportInFlight) {
681
+ appendSessionLog("[warn] Export already in progress");
682
+ return;
683
+ }
684
+ const format = state.exportFormat;
685
+ useExportStore.setState({
686
+ exportInFlight: true,
687
+ exportJob: {
688
+ action,
689
+ status: "running",
690
+ format
691
+ }
692
+ });
693
+ setSessionStatusLine(action === "preview" ? "Previewing export..." : "Generating export...");
694
+ const service = getService();
695
+ const client = getClient();
696
+ try {
697
+ if (action === "status") {
698
+ const status = await service.exportStatus(boot.projectId, format, {
699
+ mode: state.exportMode,
700
+ scopePath: state.exportScopePath || void 0,
701
+ organizationId: boot.organizationId
702
+ });
703
+ useExportStore.setState({
704
+ exportStatus: status,
705
+ exportJob: {
706
+ action,
707
+ status: "success",
708
+ format
709
+ }
710
+ });
711
+ setSessionStatusLine(`Export status: ${status.overall}`);
712
+ appendSessionLog(`[export] Status ${format}: ${status.overall}`);
713
+ return;
714
+ }
715
+ if (action === "commit" || action === "pr") {
716
+ const delivery = action === "commit" ? "commit" : "pr";
717
+ const result = await service.deliverExport(boot.projectId, format, delivery, {
718
+ mode: state.exportMode,
719
+ scopePath: state.exportScopePath || void 0,
720
+ organizationId: boot.organizationId
721
+ });
722
+ useExportStore.setState({
723
+ exportJob: {
724
+ action,
725
+ status: "success",
726
+ format
727
+ }
728
+ });
729
+ setSessionStatusLine(result.message);
730
+ appendSessionLog(`[export] ${result.message}`);
731
+ return;
732
+ }
733
+ const output = action === "preview" ? await service.previewExport(client, boot.projectId, format) : await service.generateExport(client, boot.projectId, format);
734
+ useExportStore.setState({
735
+ exportPreview: output,
736
+ exportJob: {
737
+ action,
738
+ status: "success",
739
+ format
740
+ }
741
+ });
742
+ setSessionStatusLine(action === "preview" ? "Export preview ready" : "Export generated");
743
+ const verb = action === "preview" ? "Previewed" : "Generated";
744
+ appendSessionLog(`[export] ${verb} ${format} (${output.anchorCount} anchors)`);
745
+ } catch (error) {
746
+ const message = error instanceof Error ? error.message : String(error);
747
+ useExportStore.setState({
748
+ exportJob: {
749
+ action,
750
+ status: "error",
751
+ format,
752
+ error: message
753
+ }
754
+ });
755
+ setSessionStatusLine(action === "preview" ? "Export preview failed" : "Export generation failed");
756
+ appendSessionLog(`[error] Export ${action} failed: ${message}`);
757
+ refreshOnAuthenticationError(message);
758
+ } finally {
759
+ useExportStore.setState({
760
+ exportInFlight: false
761
+ });
762
+ }
763
+ }
764
+ __name(runExport, "runExport");
765
+ var useExportStore = create4()(subscribeWithSelector4((set, get) => ({
766
+ exportFormat: "agents-md",
767
+ exportMode: "global",
768
+ exportScopePath: "",
769
+ exportDelivery: "download",
770
+ exportCapabilities: null,
771
+ exportPreview: null,
772
+ exportStatus: null,
773
+ exportValidation: {
774
+ open: false
775
+ },
776
+ exportJob: EMPTY_EXPORT_JOB,
777
+ exportInFlight: false,
778
+ setCapabilities: /* @__PURE__ */ __name((capabilities) => {
779
+ set((prev) => {
780
+ const discoveredFormats = capabilities?.formats?.map((f) => f.id) ?? [];
781
+ const discoveredModes = capabilities?.modes ?? [];
782
+ const resolvedFormat = discoveredFormats.length > 0 ? discoveredFormats.includes(prev.exportFormat) ? prev.exportFormat : discoveredFormats[0] : prev.exportFormat;
783
+ const resolvedMode = discoveredModes.length > 0 ? discoveredModes.includes(prev.exportMode) ? prev.exportMode : discoveredModes[0] : prev.exportMode;
784
+ return {
785
+ exportCapabilities: capabilities,
786
+ exportFormat: resolvedFormat,
787
+ exportMode: resolvedMode
788
+ };
789
+ });
790
+ }, "setCapabilities"),
791
+ setExportFormat: /* @__PURE__ */ __name((format) => {
792
+ set((prev) => {
793
+ const allowedFormats = prev.exportCapabilities?.formats.map((f) => f.id) ?? [];
794
+ if (allowedFormats.length > 0 && !allowedFormats.includes(format)) {
795
+ setSessionStatusLine(`Export format unavailable: ${format}`);
796
+ return prev;
797
+ }
798
+ if (prev.exportFormat === format) return prev;
799
+ setSessionStatusLine(`Export format set to ${format}`);
800
+ return {
801
+ exportFormat: format,
802
+ exportPreview: null,
803
+ exportStatus: null,
804
+ exportValidation: {
805
+ open: false
806
+ },
807
+ exportJob: EMPTY_EXPORT_JOB
808
+ };
809
+ });
810
+ }, "setExportFormat"),
811
+ setExportMode: /* @__PURE__ */ __name((mode) => {
812
+ set((prev) => {
813
+ const allowedModes = prev.exportCapabilities?.modes ?? [];
814
+ if (allowedModes.length > 0 && !allowedModes.includes(mode)) {
815
+ setSessionStatusLine(`Export mode unavailable: ${mode}`);
816
+ return prev;
817
+ }
818
+ setSessionStatusLine(`Export mode set to ${mode}`);
819
+ return {
820
+ exportMode: mode
821
+ };
822
+ });
823
+ }, "setExportMode"),
824
+ setExportScopePath: /* @__PURE__ */ __name((scopePath) => {
825
+ setSessionStatusLine("Updated export scope path");
826
+ set({
827
+ exportScopePath: scopePath
828
+ });
829
+ }, "setExportScopePath"),
830
+ setExportDelivery: /* @__PURE__ */ __name((delivery) => {
831
+ setSessionStatusLine(`Export delivery set to ${delivery}`);
832
+ set({
833
+ exportDelivery: delivery
834
+ });
835
+ }, "setExportDelivery"),
836
+ previewExport: /* @__PURE__ */ __name(async () => {
837
+ await runExport("preview");
838
+ }, "previewExport"),
839
+ generateExport: /* @__PURE__ */ __name(async () => {
840
+ setSessionStatusLine("Confirm export validation to write files to disk");
841
+ set({
842
+ exportValidation: {
843
+ open: true
844
+ }
845
+ });
846
+ }, "generateExport"),
847
+ validateAndWriteExport: /* @__PURE__ */ __name(async () => {
848
+ const state = get();
849
+ const boot = getBootContext();
850
+ if (!boot) return;
851
+ if (state.exportInFlight) {
852
+ appendSessionLog("[warn] Export already in progress");
853
+ return;
854
+ }
855
+ const format = state.exportFormat;
856
+ set({
857
+ exportInFlight: true,
858
+ exportValidation: {
859
+ open: false
860
+ },
861
+ exportJob: {
862
+ action: "generate",
863
+ status: "running",
864
+ format
865
+ }
866
+ });
867
+ setSessionStatusLine("Validating export and writing files...");
868
+ const service = getService();
869
+ try {
870
+ const result = await service.deliverExport(boot.projectId, format, "download", {
871
+ mode: state.exportMode,
872
+ scopePath: state.exportScopePath || void 0,
873
+ organizationId: boot.organizationId
874
+ });
875
+ set((prev) => ({
876
+ exportStatus: result.localStatus ?? prev.exportStatus,
877
+ exportJob: {
878
+ action: "generate",
879
+ status: "success",
880
+ format
881
+ }
882
+ }));
883
+ setSessionStatusLine(result.message);
884
+ appendSessionLog(`[export] ${result.message}`);
885
+ } catch (error) {
886
+ const message = error instanceof Error ? error.message : String(error);
887
+ set({
888
+ exportJob: {
889
+ action: "generate",
890
+ status: "error",
891
+ format,
892
+ error: message
893
+ }
894
+ });
895
+ setSessionStatusLine("Export validation/write failed");
896
+ appendSessionLog(`[error] Export validate/write failed: ${message}`);
897
+ refreshOnAuthenticationError(message);
898
+ } finally {
899
+ set({
900
+ exportInFlight: false
901
+ });
902
+ }
903
+ }, "validateAndWriteExport"),
904
+ cancelExportValidation: /* @__PURE__ */ __name(() => {
905
+ setSessionStatusLine("Export validation cancelled");
906
+ set({
907
+ exportValidation: {
908
+ open: false
909
+ }
910
+ });
911
+ }, "cancelExportValidation"),
912
+ statusExport: /* @__PURE__ */ __name(async () => {
913
+ await runExport("status");
914
+ }, "statusExport"),
915
+ commitExport: /* @__PURE__ */ __name(async () => {
916
+ await runExport("commit");
917
+ }, "commitExport"),
918
+ createPrExport: /* @__PURE__ */ __name(async () => {
919
+ await runExport("pr");
920
+ }, "createPrExport"),
921
+ copyExportPreview: /* @__PURE__ */ __name(() => {
922
+ const { exportPreview, exportJob } = get();
923
+ const hasGeneratedPreview = exportJob.status === "success" && (exportJob.action === "preview" || exportJob.action === "generate");
924
+ if (!exportPreview?.content || !hasGeneratedPreview) {
925
+ setSessionStatusLine("No generated preview to copy. Run p or g first.");
926
+ appendSessionLog("[warn] export copy requested before preview/generate completed");
927
+ return;
928
+ }
929
+ const copied = copyTextToClipboard(exportPreview.content);
930
+ if (copied.ok) {
931
+ setSessionStatusLine("Copied preview to clipboard");
932
+ appendSessionLog("[export] copied preview to clipboard");
933
+ return;
934
+ }
935
+ setSessionStatusLine("Clipboard copy failed");
936
+ appendSessionLog(`[error] clipboard copy failed: ${copied.error}`);
937
+ }, "copyExportPreview")
938
+ })));
939
+
940
+ // src/store/use-bridge-store.ts
941
+ import { create as create5 } from "zustand";
942
+ import { subscribeWithSelector as subscribeWithSelector5 } from "zustand/middleware";
943
+ var useBridgeStore = create5()(subscribeWithSelector5((set, get) => ({
944
+ bridge: null,
945
+ localBridge: null,
946
+ bridgeLogs: [],
947
+ bridgeLogsSince: 0,
948
+ startedByTui: false,
949
+ webmcpChannels: [],
950
+ setBridgeData: /* @__PURE__ */ __name((bridge, localBridge) => set({
951
+ bridge,
952
+ localBridge
953
+ }), "setBridgeData"),
954
+ setLocalBridge: /* @__PURE__ */ __name((localBridge) => set({
955
+ localBridge
956
+ }), "setLocalBridge"),
957
+ setBridgeLogs: /* @__PURE__ */ __name((logs) => {
958
+ if (logs.length === 0) return;
959
+ const lastTimestamp = logs[logs.length - 1].timestamp;
960
+ set((prev) => ({
961
+ bridgeLogs: [
962
+ ...prev.bridgeLogs,
963
+ ...logs
964
+ ].slice(-200),
965
+ bridgeLogsSince: lastTimestamp
966
+ }));
967
+ }, "setBridgeLogs"),
968
+ clearBridgeLogs: /* @__PURE__ */ __name(() => set({
969
+ bridgeLogs: []
970
+ }), "clearBridgeLogs"),
971
+ setWebMcpChannels: /* @__PURE__ */ __name((channels) => set({
972
+ webmcpChannels: channels
973
+ }), "setWebMcpChannels"),
974
+ bridgeStart: /* @__PURE__ */ __name(() => {
975
+ const service = getService();
976
+ service.startLocalBridgeDetached();
977
+ set({
978
+ startedByTui: true
979
+ });
980
+ appendSessionLog("[bridge] Started local bridge process (detached)");
981
+ setSessionStatusLine("Bridge start triggered (detached)");
982
+ }, "bridgeStart"),
983
+ bridgeStop: /* @__PURE__ */ __name(async () => {
984
+ const service = getService();
985
+ const { localBridge } = get();
986
+ await service.stopLocalBridge(localBridge?.port);
987
+ if (localBridge) {
988
+ set({
989
+ localBridge: {
990
+ ...localBridge,
991
+ running: false,
992
+ uptimeSec: 0
993
+ },
994
+ webmcpChannels: []
995
+ });
996
+ }
997
+ appendSessionLog("[bridge] Stop signal sent");
998
+ setSessionStatusLine("Bridge stop signal sent");
999
+ }, "bridgeStop")
1000
+ })));
1001
+
1002
+ // src/store/store-effects.ts
1003
+ function dispatchRefreshComplete(data) {
1004
+ useProjectDataStore.getState().setProjectData(data.specs, data.decisions, data.workflow, data.navPolicy);
1005
+ useExportStore.getState().setCapabilities(data.exportCapabilities);
1006
+ useBridgeStore.getState().setBridgeData(data.bridge, data.localBridge);
1007
+ }
1008
+ __name(dispatchRefreshComplete, "dispatchRefreshComplete");
1009
+ function dispatchClearProjectData() {
1010
+ useProjectDataStore.getState().clearProjectData();
1011
+ }
1012
+ __name(dispatchClearProjectData, "dispatchClearProjectData");
1013
+ function refreshOnAuthenticationError(message) {
1014
+ if (!isAuthenticationError(message)) return;
1015
+ const { appendLog, refresh } = useSessionStore.getState();
1016
+ useSessionStore.setState({
1017
+ statusLine: "Authentication required. Refreshing context..."
1018
+ });
1019
+ appendLog("[auth] action requires authentication, refreshing context");
1020
+ void refresh();
1021
+ }
1022
+ __name(refreshOnAuthenticationError, "refreshOnAuthenticationError");
1023
+ async function withSessionFeedback(opts) {
1024
+ const { appendLog, refresh } = useSessionStore.getState();
1025
+ useSessionStore.setState({
1026
+ statusLine: opts.statusLine
1027
+ });
1028
+ try {
1029
+ const result = await opts.action();
1030
+ appendLog(opts.successLog);
1031
+ if (opts.refresh !== false) {
1032
+ await refresh();
1033
+ }
1034
+ return result;
1035
+ } catch (error) {
1036
+ const message = error instanceof Error ? error.message : String(error);
1037
+ appendLog(`${opts.failureLog}: ${message}`);
1038
+ useSessionStore.setState({
1039
+ statusLine: opts.failureStatusLine
1040
+ });
1041
+ refreshOnAuthenticationError(message);
1042
+ throw error;
1043
+ }
1044
+ }
1045
+ __name(withSessionFeedback, "withSessionFeedback");
1046
+ function getBootContext() {
1047
+ return useSessionStore.getState().boot;
1048
+ }
1049
+ __name(getBootContext, "getBootContext");
1050
+ function setSessionStatusLine(line) {
1051
+ useSessionStore.setState({
1052
+ statusLine: line
1053
+ });
1054
+ }
1055
+ __name(setSessionStatusLine, "setSessionStatusLine");
1056
+ function appendSessionLog(entry) {
1057
+ useSessionStore.getState().appendLog(entry);
1058
+ }
1059
+ __name(appendSessionLog, "appendSessionLog");
1060
+
1061
+ // src/store/use-session-store.ts
1062
+ var onboardingInteractionResolver = null;
1063
+ function requestOnboardingInteraction(request) {
1064
+ return new Promise((resolve) => {
1065
+ onboardingInteractionResolver = resolve;
1066
+ useSessionStore.setState((prev) => ({
1067
+ onboarding: prev.onboarding ? {
1068
+ ...prev.onboarding,
1069
+ interaction: request
1070
+ } : prev.onboarding
1071
+ }));
1072
+ });
1073
+ }
1074
+ __name(requestOnboardingInteraction, "requestOnboardingInteraction");
1075
+ function refreshOnAuthenticationError2(message) {
1076
+ if (!isAuthenticationError(message)) return;
1077
+ const { appendLog, refresh } = useSessionStore.getState();
1078
+ useSessionStore.setState({
1079
+ statusLine: "Authentication required. Refreshing context..."
1080
+ });
1081
+ appendLog("[auth] action requires authentication, refreshing context");
1082
+ void refresh();
1083
+ }
1084
+ __name(refreshOnAuthenticationError2, "refreshOnAuthenticationError");
1085
+ async function buildOnboardingState(mode) {
1086
+ const service = getService();
1087
+ const boot = useSessionStore.getState().boot;
1088
+ const organizations = await service.listOrganizations();
1089
+ if (organizations.length === 0) {
1090
+ return {
1091
+ mode,
1092
+ step: "create-organization",
1093
+ attachCurrentFolder: mode === "initial-setup",
1094
+ organizations: [],
1095
+ projects: [],
1096
+ availableAgents: [],
1097
+ canCreateProject: false,
1098
+ error: void 0
1099
+ };
1100
+ }
1101
+ const preferredOrganizationId = boot?.organizationId;
1102
+ const selectedOrganization = organizations.find((org) => org.id === preferredOrganizationId) ?? organizations[0];
1103
+ const projects = await service.listProjects(selectedOrganization.id);
1104
+ return {
1105
+ mode,
1106
+ step: organizations.length === 1 ? "project" : "organization",
1107
+ attachCurrentFolder: mode === "initial-setup",
1108
+ organizations,
1109
+ projects,
1110
+ availableAgents: [],
1111
+ canCreateProject: service.canCreateProject(selectedOrganization),
1112
+ selectedOrganizationId: selectedOrganization.id,
1113
+ interaction: void 0,
1114
+ error: void 0
1115
+ };
1116
+ }
1117
+ __name(buildOnboardingState, "buildOnboardingState");
1118
+ var useSessionStore = create6()(subscribeWithSelector6((set, get) => ({
1119
+ boot: null,
1120
+ auth: null,
1121
+ onboarding: null,
1122
+ loading: true,
1123
+ error: null,
1124
+ statusLine: "Bootstrapping...",
1125
+ logs: [],
1126
+ appendLog: /* @__PURE__ */ __name((entry) => {
1127
+ const screen = useTuiUiStore.getState().screen;
1128
+ const level = entry.startsWith("[error]") ? "error" : entry.startsWith("[warn]") ? "warn" : "info";
1129
+ appendGlobalStructuredLog({
1130
+ source: "tui.event-log",
1131
+ level,
1132
+ message: entry,
1133
+ details: {
1134
+ screen
1135
+ }
1136
+ });
1137
+ set((prev) => ({
1138
+ logs: [
1139
+ entry,
1140
+ ...prev.logs
1141
+ ].slice(0, 40)
1142
+ }));
1143
+ }, "appendLog"),
1144
+ setStatusLine: /* @__PURE__ */ __name((line) => set({
1145
+ statusLine: line
1146
+ }), "setStatusLine"),
1147
+ setLoading: /* @__PURE__ */ __name((loading) => set({
1148
+ loading
1149
+ }), "setLoading"),
1150
+ setError: /* @__PURE__ */ __name((error) => set({
1151
+ error
1152
+ }), "setError"),
1153
+ authenticate: /* @__PURE__ */ __name(async () => {
1154
+ const { appendLog } = get();
1155
+ const service = getService();
1156
+ set({
1157
+ loading: false,
1158
+ auth: {
1159
+ status: "authenticating"
1160
+ },
1161
+ statusLine: "Starting browser login flow..."
1162
+ });
1163
+ appendLog("[auth] starting login flow");
1164
+ const ok = await service.authenticateViaCli((line) => {
1165
+ appendLog(`[auth] ${line}`);
1166
+ });
1167
+ if (!ok) {
1168
+ set({
1169
+ auth: {
1170
+ status: "auth_failed",
1171
+ error: "Authentication failed. Check logs and try again."
1172
+ },
1173
+ statusLine: "Authentication failed"
1174
+ });
1175
+ appendLog("[auth] login flow failed");
1176
+ return;
1177
+ }
1178
+ appendLog("[auth] login flow completed");
1179
+ await get().refresh();
1180
+ }, "authenticate"),
1181
+ refresh: /* @__PURE__ */ __name(async (projectId) => {
1182
+ const service = getService();
1183
+ set((prev) => ({
1184
+ loading: prev.boot ? false : true,
1185
+ statusLine: "Loading context..."
1186
+ }));
1187
+ try {
1188
+ const token = await service.checkAuthentication();
1189
+ if (!token) {
1190
+ set({
1191
+ loading: false,
1192
+ error: null,
1193
+ auth: {
1194
+ status: "unauthenticated",
1195
+ error: "No valid credentials. Please run `spekn auth login` to authenticate."
1196
+ },
1197
+ statusLine: "Authentication required"
1198
+ });
1199
+ return;
1200
+ }
1201
+ set({
1202
+ auth: {
1203
+ status: "authenticated",
1204
+ userEmail: service.extractUserEmail(token),
1205
+ tokenExpiresAt: service.extractTokenExpiry(token)
1206
+ }
1207
+ });
1208
+ if (!projectId && !service.hasLocalProjectContext()) {
1209
+ const onboarding = await buildOnboardingState("initial-setup");
1210
+ set({
1211
+ loading: false,
1212
+ error: null,
1213
+ onboarding,
1214
+ statusLine: "Project setup required"
1215
+ });
1216
+ return;
1217
+ }
1218
+ let bootstrapResult;
1219
+ try {
1220
+ bootstrapResult = await service.bootstrap(projectId);
1221
+ } catch (bootstrapError) {
1222
+ if (bootstrapError instanceof Error && bootstrapError.message === "ONBOARDING_REQUIRED") {
1223
+ const onboarding = await buildOnboardingState("initial-setup");
1224
+ set({
1225
+ loading: false,
1226
+ error: null,
1227
+ onboarding,
1228
+ statusLine: "Project setup required"
1229
+ });
1230
+ return;
1231
+ }
1232
+ throw bootstrapError;
1233
+ }
1234
+ const { boot, client } = bootstrapResult;
1235
+ setClient(client);
1236
+ const [specs, decisions, workflow, bridge, localBridge, exportCapabilities] = await Promise.all([
1237
+ service.loadSpecs(client, boot.projectId),
1238
+ service.loadDecisions(client, boot.projectId),
1239
+ service.loadWorkflowSummary(client, boot.projectId),
1240
+ service.loadBridgeSummary(client),
1241
+ service.loadLocalBridgeSummary(),
1242
+ service.discoverExportCapabilities(boot.projectId, boot.organizationId).catch(() => null)
1243
+ ]);
1244
+ const capabilityContext = {
1245
+ plan: boot.plan,
1246
+ role: boot.role,
1247
+ workflowPhase: workflow.currentPhase,
1248
+ permissions: boot.permissions
1249
+ };
1250
+ const navPolicy = resolveNavPolicy(capabilityContext);
1251
+ dispatchRefreshComplete({
1252
+ specs,
1253
+ decisions,
1254
+ workflow,
1255
+ navPolicy,
1256
+ exportCapabilities,
1257
+ bridge,
1258
+ localBridge
1259
+ });
1260
+ set({
1261
+ boot,
1262
+ loading: false,
1263
+ error: null,
1264
+ onboarding: null,
1265
+ statusLine: "Ready"
1266
+ });
1267
+ } catch (error) {
1268
+ const message = error instanceof Error ? error.message : String(error);
1269
+ let authStatus = null;
1270
+ if (message.includes("credentials") || message.includes("auth") || message.includes("token")) {
1271
+ authStatus = {
1272
+ status: "auth_failed",
1273
+ error: message
1274
+ };
1275
+ }
1276
+ set((prev) => ({
1277
+ loading: false,
1278
+ error: message,
1279
+ auth: authStatus || prev.auth,
1280
+ statusLine: "Error"
1281
+ }));
1282
+ get().appendLog(`[error] ${message}`);
1283
+ }
1284
+ }, "refresh"),
1285
+ switchContext: /* @__PURE__ */ __name(async () => {
1286
+ const { appendLog } = get();
1287
+ set({
1288
+ loading: true,
1289
+ error: null,
1290
+ statusLine: "Loading organizations..."
1291
+ });
1292
+ try {
1293
+ const onboarding = await buildOnboardingState("switch-context");
1294
+ set({
1295
+ loading: false,
1296
+ onboarding,
1297
+ statusLine: "Switch organization/project"
1298
+ });
1299
+ appendLog("[context] switch mode opened");
1300
+ } catch (error) {
1301
+ const message = error instanceof Error ? error.message : String(error);
1302
+ set({
1303
+ loading: false,
1304
+ statusLine: "Context switch failed",
1305
+ error: message
1306
+ });
1307
+ appendLog(`[error] context switch failed: ${message}`);
1308
+ refreshOnAuthenticationError2(message);
1309
+ }
1310
+ }, "switchContext"),
1311
+ detachRepoContext: /* @__PURE__ */ __name(async () => {
1312
+ const { boot, appendLog, refresh } = get();
1313
+ const service = getService();
1314
+ const result = await service.detachContextViaCli(boot?.projectId, process.cwd());
1315
+ if (!result.success) {
1316
+ appendLog(`[error] Failed to detach context: ${result.output}`);
1317
+ set({
1318
+ statusLine: "Context detach failed"
1319
+ });
1320
+ return;
1321
+ }
1322
+ if (result.output) {
1323
+ appendLog(`[context] ${result.output}`);
1324
+ }
1325
+ appendLog("[context] Detached repository from local project context");
1326
+ set({
1327
+ boot: null,
1328
+ statusLine: "Repository detached. Select a project to attach."
1329
+ });
1330
+ dispatchClearProjectData();
1331
+ await refresh();
1332
+ }, "detachRepoContext"),
1333
+ syncRepository: /* @__PURE__ */ __name(async (options) => {
1334
+ const { boot, appendLog, refresh } = get();
1335
+ const service = getService();
1336
+ if (!boot) {
1337
+ appendLog("[error] repository sync unavailable: no active project context");
1338
+ set({
1339
+ statusLine: "Repository sync unavailable"
1340
+ });
1341
+ return false;
1342
+ }
1343
+ appendLog("[repo] running sync (metadata + drift analysis)");
1344
+ set({
1345
+ statusLine: "Syncing repository..."
1346
+ });
1347
+ const result = await service.syncRepositoryViaCli(boot.organizationId, boot.projectId, boot.repoPath, {
1348
+ analyze: options?.analyze ?? true,
1349
+ importToProject: options?.importToProject,
1350
+ maxFiles: options?.maxFiles,
1351
+ analysisEngine: options?.analysisEngine,
1352
+ agent: options?.agent,
1353
+ requestInteraction: options?.requestInteraction,
1354
+ onProgress: /* @__PURE__ */ __name((line) => {
1355
+ appendLog(`[repo] ${line}`);
1356
+ options?.onProgress?.(line);
1357
+ }, "onProgress"),
1358
+ onActivity: /* @__PURE__ */ __name((event) => {
1359
+ options?.onActivity?.(event);
1360
+ }, "onActivity"),
1361
+ signal: options?.signal
1362
+ });
1363
+ if (!result.success) {
1364
+ appendLog(`[error] repository sync failed (exit ${result.exitCode})`);
1365
+ set({
1366
+ statusLine: "Repository sync failed"
1367
+ });
1368
+ refreshOnAuthenticationError2(result.output);
1369
+ return false;
1370
+ }
1371
+ appendLog("[repo] sync completed");
1372
+ set({
1373
+ statusLine: "Repository sync completed"
1374
+ });
1375
+ await refresh();
1376
+ return true;
1377
+ }, "syncRepository"),
1378
+ // Onboarding actions
1379
+ selectOnboardingOrganization: /* @__PURE__ */ __name(async (index) => {
1380
+ const { onboarding, appendLog } = get();
1381
+ const service = getService();
1382
+ if (!onboarding) return;
1383
+ if (index < 0 || index >= onboarding.organizations.length) {
1384
+ set((prev) => ({
1385
+ onboarding: prev.onboarding ? {
1386
+ ...prev.onboarding,
1387
+ error: `Invalid organization index: ${index + 1}`
1388
+ } : prev.onboarding
1389
+ }));
1390
+ return;
1391
+ }
1392
+ const selectedOrganization = onboarding.organizations[index];
1393
+ set((prev) => ({
1394
+ loading: true,
1395
+ statusLine: "Loading projects...",
1396
+ onboarding: prev.onboarding ? {
1397
+ ...prev.onboarding,
1398
+ selectedOrganizationId: selectedOrganization.id,
1399
+ error: void 0
1400
+ } : prev.onboarding
1401
+ }));
1402
+ try {
1403
+ const projects = await service.listProjects(selectedOrganization.id);
1404
+ set((prev) => ({
1405
+ loading: false,
1406
+ statusLine: "Select a project",
1407
+ onboarding: prev.onboarding ? {
1408
+ ...prev.onboarding,
1409
+ step: "project",
1410
+ attachCurrentFolder: prev.onboarding.attachCurrentFolder,
1411
+ projects,
1412
+ availableAgents: prev.onboarding?.availableAgents ?? [],
1413
+ canCreateProject: service.canCreateProject(selectedOrganization),
1414
+ selectedOrganizationId: selectedOrganization.id,
1415
+ interaction: void 0,
1416
+ error: projects.length === 0 ? "No projects found in selected organization." : void 0
1417
+ } : prev.onboarding
1418
+ }));
1419
+ } catch (error) {
1420
+ const message = error instanceof Error ? error.message : String(error);
1421
+ set((prev) => ({
1422
+ loading: false,
1423
+ statusLine: "Setup error",
1424
+ onboarding: prev.onboarding ? {
1425
+ ...prev.onboarding,
1426
+ error: message
1427
+ } : prev.onboarding
1428
+ }));
1429
+ }
1430
+ }, "selectOnboardingOrganization"),
1431
+ registerOnboardingProject: /* @__PURE__ */ __name(async (index) => {
1432
+ const { onboarding, appendLog, refresh } = get();
1433
+ const service = getService();
1434
+ if (!onboarding || !onboarding.selectedOrganizationId) return;
1435
+ if (index < 0 || index >= onboarding.projects.length) {
1436
+ set((prev) => ({
1437
+ onboarding: prev.onboarding ? {
1438
+ ...prev.onboarding,
1439
+ error: `Invalid project index: ${index + 1}`
1440
+ } : prev.onboarding
1441
+ }));
1442
+ return;
1443
+ }
1444
+ const selectedProject = onboarding.projects[index];
1445
+ if (onboarding.mode === "switch-context" || !onboarding.attachCurrentFolder) {
1446
+ set((prev) => ({
1447
+ loading: true,
1448
+ statusLine: "Switching context...",
1449
+ onboarding: prev.onboarding ? {
1450
+ ...prev.onboarding,
1451
+ error: void 0
1452
+ } : prev.onboarding
1453
+ }));
1454
+ try {
1455
+ service.persistContext(onboarding.selectedOrganizationId, selectedProject.id);
1456
+ appendLog(`[context] switched to ${selectedProject.name}`);
1457
+ await refresh();
1458
+ } catch (error) {
1459
+ const message = error instanceof Error ? error.message : String(error);
1460
+ set((prev) => ({
1461
+ loading: false,
1462
+ statusLine: "Context switch failed",
1463
+ onboarding: prev.onboarding ? {
1464
+ ...prev.onboarding,
1465
+ step: "project",
1466
+ error: message
1467
+ } : prev.onboarding
1468
+ }));
1469
+ }
1470
+ return;
1471
+ }
1472
+ set((prev) => ({
1473
+ loading: true,
1474
+ statusLine: "Linking repository...",
1475
+ onboarding: prev.onboarding ? {
1476
+ ...prev.onboarding,
1477
+ error: void 0
1478
+ } : prev.onboarding
1479
+ }));
1480
+ try {
1481
+ persistProjectContext(process.cwd(), {
1482
+ projectId: selectedProject.id,
1483
+ organizationId: onboarding.selectedOrganizationId
1484
+ });
1485
+ appendLog(`[context] linked to ${selectedProject.name}`);
1486
+ await refresh();
1487
+ } catch (error) {
1488
+ const message = error instanceof Error ? error.message : String(error);
1489
+ set((prev) => ({
1490
+ loading: false,
1491
+ statusLine: "Setup error",
1492
+ onboarding: prev.onboarding ? {
1493
+ ...prev.onboarding,
1494
+ step: "project",
1495
+ error: message
1496
+ } : prev.onboarding
1497
+ }));
1498
+ }
1499
+ }, "registerOnboardingProject"),
1500
+ createOnboardingProject: /* @__PURE__ */ __name(async (name) => {
1501
+ const { onboarding, appendLog, refresh } = get();
1502
+ const service = getService();
1503
+ if (!onboarding || !onboarding.selectedOrganizationId) return;
1504
+ const trimmed = name.trim();
1505
+ if (!onboarding.canCreateProject) {
1506
+ set((prev) => ({
1507
+ onboarding: prev.onboarding ? {
1508
+ ...prev.onboarding,
1509
+ error: "You are not authorized to create projects in this organization."
1510
+ } : prev.onboarding
1511
+ }));
1512
+ return;
1513
+ }
1514
+ if (trimmed.length < 2) {
1515
+ set((prev) => ({
1516
+ onboarding: prev.onboarding ? {
1517
+ ...prev.onboarding,
1518
+ error: "Project name must be at least 2 characters."
1519
+ } : prev.onboarding
1520
+ }));
1521
+ return;
1522
+ }
1523
+ set((prev) => ({
1524
+ loading: true,
1525
+ statusLine: "Creating project...",
1526
+ onboarding: prev.onboarding ? {
1527
+ ...prev.onboarding,
1528
+ error: void 0
1529
+ } : prev.onboarding
1530
+ }));
1531
+ try {
1532
+ const created = await service.createProject(onboarding.selectedOrganizationId, trimmed);
1533
+ appendLog(`[setup] Created project "${created.name}"`);
1534
+ if (onboarding.mode === "switch-context" || !onboarding.attachCurrentFolder) {
1535
+ service.persistContext(onboarding.selectedOrganizationId, created.id);
1536
+ appendLog(`[context] switched to ${created.name}`);
1537
+ await refresh();
1538
+ return;
1539
+ }
1540
+ const registerStartedAt = Date.now();
1541
+ set((prev) => ({
1542
+ loading: true,
1543
+ statusLine: "Registering repository...",
1544
+ onboarding: prev.onboarding ? {
1545
+ ...prev.onboarding,
1546
+ step: "registering",
1547
+ availableAgents: prev.onboarding?.availableAgents ?? [],
1548
+ selectedProjectId: created.id,
1549
+ runLines: [],
1550
+ runStatus: "running",
1551
+ startedAt: registerStartedAt,
1552
+ interaction: void 0,
1553
+ error: void 0
1554
+ } : prev.onboarding
1555
+ }));
1556
+ useOnboardingWindow.getState().setStartedAt(registerStartedAt);
1557
+ await attachRepositoryFromOnboardingZustand({
1558
+ organizationId: onboarding.selectedOrganizationId,
1559
+ projectId: created.id
1560
+ });
1561
+ await refresh();
1562
+ } catch (error) {
1563
+ const message = error instanceof Error ? error.message : String(error);
1564
+ set((prev) => ({
1565
+ loading: false,
1566
+ statusLine: "Setup error",
1567
+ onboarding: prev.onboarding ? {
1568
+ ...prev.onboarding,
1569
+ error: message
1570
+ } : prev.onboarding
1571
+ }));
1572
+ }
1573
+ }, "createOnboardingProject"),
1574
+ resolveOnboardingInteraction: /* @__PURE__ */ __name((value) => {
1575
+ const resolver = onboardingInteractionResolver;
1576
+ onboardingInteractionResolver = null;
1577
+ set((prev) => ({
1578
+ onboarding: prev.onboarding ? {
1579
+ ...prev.onboarding,
1580
+ interaction: void 0
1581
+ } : prev.onboarding
1582
+ }));
1583
+ if (resolver) resolver(value);
1584
+ }, "resolveOnboardingInteraction"),
1585
+ setOnboardingAttachCurrentFolder: /* @__PURE__ */ __name((attach) => {
1586
+ set((prev) => ({
1587
+ onboarding: prev.onboarding ? prev.onboarding.attachCurrentFolder === attach ? prev.onboarding : {
1588
+ ...prev.onboarding,
1589
+ attachCurrentFolder: attach
1590
+ } : prev.onboarding
1591
+ }));
1592
+ }, "setOnboardingAttachCurrentFolder")
1593
+ })));
1594
+ async function attachRepositoryFromOnboardingZustand(input) {
1595
+ const service = getService();
1596
+ const { appendLog } = useSessionStore.getState();
1597
+ const result = await service.attachOrSyncCurrentRepository(input.organizationId, input.projectId, (line) => {
1598
+ appendLog(`[setup] ${line}`);
1599
+ useSessionStore.setState((prev) => ({
1600
+ statusLine: line.slice(0, 100),
1601
+ onboarding: prev.onboarding ? {
1602
+ ...prev.onboarding,
1603
+ runLines: [
1604
+ ...prev.onboarding.runLines ?? [],
1605
+ line
1606
+ ].slice(-400)
1607
+ } : prev.onboarding
1608
+ }));
1609
+ }, void 0, requestOnboardingInteraction, (event) => {
1610
+ const { upsertToolCall, setActiveThought } = useOnboardingWindow.getState();
1611
+ if (event.event === "tool_call" || event.event === "tool_call_update") {
1612
+ upsertToolCall(event);
1613
+ } else if (event.event === "agent_thought") {
1614
+ setActiveThought(event.text);
1615
+ } else if (event.event === "agent_chunk" && event.text) {
1616
+ useSessionStore.setState((prev) => {
1617
+ if (!prev.onboarding) return prev;
1618
+ const lines = [
1619
+ ...prev.onboarding.runLines ?? []
1620
+ ];
1621
+ const parts = event.text.split("\n");
1622
+ if (lines.length === 0) {
1623
+ lines.push(parts[0]);
1624
+ } else {
1625
+ lines[lines.length - 1] += parts[0];
1626
+ }
1627
+ for (let i = 1; i < parts.length; i++) {
1628
+ lines.push(parts[i]);
1629
+ }
1630
+ return {
1631
+ onboarding: {
1632
+ ...prev.onboarding,
1633
+ runLines: lines.slice(-400)
1634
+ }
1635
+ };
1636
+ });
1637
+ }
1638
+ });
1639
+ useSessionStore.setState((prev) => ({
1640
+ onboarding: prev.onboarding ? {
1641
+ ...prev.onboarding,
1642
+ runStatus: result.warning ? "error" : "success"
1643
+ } : prev.onboarding
1644
+ }));
1645
+ logOnboardingAttachResult(appendLog, result);
1646
+ }
1647
+ __name(attachRepositoryFromOnboardingZustand, "attachRepositoryFromOnboardingZustand");
1648
+
1649
+ export {
1650
+ setInitialScreen,
1651
+ useTuiUiStore,
1652
+ resolveNavPolicy,
1653
+ useOnboardingWindow,
1654
+ buildOnboardingState,
1655
+ useSessionStore,
1656
+ useProjectDataStore,
1657
+ useExportStore,
1658
+ dispatchRefreshComplete,
1659
+ dispatchClearProjectData,
1660
+ refreshOnAuthenticationError,
1661
+ withSessionFeedback,
1662
+ getBootContext,
1663
+ setSessionStatusLine,
1664
+ appendSessionLog,
1665
+ useBridgeStore
1666
+ };