fifony 0.1.42 → 0.1.43

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 (58) hide show
  1. package/app/dist/assets/{CommandPalette-DNR5umI1.js → CommandPalette-M4VAMxCU.js} +1 -1
  2. package/app/dist/assets/{KeyboardShortcutsHelp-Dpl19F20.js → KeyboardShortcutsHelp-DkvPUXQq.js} +1 -1
  3. package/app/dist/assets/OnboardingWizard-B7V9hoCR.js +1 -0
  4. package/app/dist/assets/analytics.lazy-zVJdF880.js +1 -0
  5. package/app/dist/assets/{api-ChEctgc5.js → api-CkVfYg_m.js} +1 -1
  6. package/app/dist/assets/{createLucideIcon-R47sXufx.js → createLucideIcon-Dfk_Hxud.js} +1 -1
  7. package/app/dist/assets/index-BpiCi7Ew.css +1 -0
  8. package/app/dist/assets/index-D2INW0zc.js +47 -0
  9. package/app/dist/assets/vendor-BEoYbFV1.js +9 -0
  10. package/app/dist/index.html +5 -5
  11. package/app/dist/service-worker.js +9 -4
  12. package/bin/fifony.js +3 -0
  13. package/dist/agent/pty-daemon.js +177 -0
  14. package/dist/agent/run-local.js +177 -43
  15. package/dist/{agent-NNGZEKZH.js → agent-RMQTTUEC.js} +37 -16
  16. package/dist/analytics-broadcaster-O6YBP66L.js +145 -0
  17. package/dist/chunk-3NE23NYW.js +82 -0
  18. package/dist/chunk-42AMQAJG.js +404 -0
  19. package/dist/{chunk-H5N7O5NP.js → chunk-AILXZ2TD.js} +79 -147
  20. package/dist/{chunk-I2UHVKHS.js → chunk-BRSR26VK.js} +2 -2
  21. package/dist/chunk-E2EWEYA4.js +1302 -0
  22. package/dist/chunk-ESWHDHH6.js +102 -0
  23. package/dist/{chunk-NB44PCD2.js → chunk-FJNH3G2Z.js} +1061 -1138
  24. package/dist/chunk-MVTGAKQK.js +493 -0
  25. package/dist/chunk-QQQLP3PL.js +155 -0
  26. package/dist/chunk-SOBLO4YZ.js +2016 -0
  27. package/dist/chunk-YRSH2CLW.js +13784 -0
  28. package/dist/cli.js +335 -44
  29. package/dist/{issue-state-machine-GPQNZYUZ.js → fsm-issue-YGGF7SIL.js} +9 -5
  30. package/dist/helpers-L7NYO5XS.js +53 -0
  31. package/dist/issue-log-broadcaster-WZAHISYB.js +84 -0
  32. package/dist/{issues-MZLRSXD6.js → issues-3QRR7KM6.js} +10 -8
  33. package/dist/log-analyzer-K7MXQB4T.js +287 -0
  34. package/dist/mcp/server.js +109 -137
  35. package/dist/parallel-executor-6INE6NDO.js +118 -0
  36. package/dist/pid-manager-UBWXVSMD.js +21 -0
  37. package/dist/queue-workers-XFZK3TT5.js +32 -0
  38. package/dist/replan-issue.command-4UCWYHGZ.js +15 -0
  39. package/dist/scheduler-ZP7GOZDW.js +26 -0
  40. package/dist/{settings-NGY33WQE.js → settings-ZAWDCFP2.js} +32 -8
  41. package/dist/settings.resource-5CW456AZ.js +24 -0
  42. package/dist/store-M6NCKMZY.js +97 -0
  43. package/dist/{web-push-CRVDJKWR.js → web-push-AX5IIK3P.js} +2 -2
  44. package/dist/{workspace-D3F3XGSI.js → workspace-CJTWFWTJ.js} +5 -4
  45. package/package.json +8 -7
  46. package/app/dist/assets/OnboardingWizard-CijMhJDW.js +0 -1
  47. package/app/dist/assets/analytics.lazy-Dq90a756.js +0 -1
  48. package/app/dist/assets/index-Dy_fM427.js +0 -54
  49. package/app/dist/assets/index-Q9jBP0Pz.css +0 -1
  50. package/app/dist/assets/vendor-DkWeBvNl.js +0 -9
  51. package/dist/chunk-2CVTK5F2.js +0 -288
  52. package/dist/chunk-37N5OFHM.js +0 -125
  53. package/dist/chunk-JTKUWIQD.js +0 -8406
  54. package/dist/chunk-RBDBGU2C.js +0 -303
  55. package/dist/issue-runner-CMZPSVC7.js +0 -16
  56. package/dist/queue-workers-XZ6DGH4W.js +0 -23
  57. package/dist/scheduler-NVE6L3P7.js +0 -22
  58. package/dist/store-4HCGBN4L.js +0 -65
package/dist/cli.js CHANGED
@@ -1,16 +1,41 @@
1
1
  import {
2
+ applyPersistedSettings,
3
+ bootstrapDevProfile,
4
+ buildProbeResult,
5
+ closeStateStore,
6
+ collectRuntimeHealthSnapshot,
7
+ getDevProfileStatus,
8
+ initStateStore,
9
+ loadPersistedMilestones,
10
+ loadPersistedServices,
11
+ loadPersistedState,
12
+ loadRuntimeSettings,
13
+ resetDevProfile,
14
+ runDoctorChecks
15
+ } from "./chunk-YRSH2CLW.js";
16
+ import "./chunk-BRSR26VK.js";
17
+ import "./chunk-QQQLP3PL.js";
18
+ import "./chunk-AILXZ2TD.js";
19
+ import "./chunk-SOBLO4YZ.js";
20
+ import {
21
+ applyWorkflowConfig,
22
+ buildRuntimeState,
23
+ deriveConfig,
2
24
  getReferenceRepositoriesRoot,
3
25
  importReferenceArtifacts,
4
26
  listReferenceRepositories,
27
+ resolveProjectMetadata,
5
28
  syncReferenceRepositories
6
- } from "./chunk-JTKUWIQD.js";
7
- import "./chunk-RBDBGU2C.js";
8
- import "./chunk-I2UHVKHS.js";
9
- import "./chunk-H5N7O5NP.js";
10
- import "./chunk-NB44PCD2.js";
11
- import "./chunk-2CVTK5F2.js";
12
- import "./chunk-37N5OFHM.js";
29
+ } from "./chunk-E2EWEYA4.js";
30
+ import "./chunk-MVTGAKQK.js";
31
+ import "./chunk-FJNH3G2Z.js";
13
32
  import "./chunk-DVU3CXWA.js";
33
+ import "./chunk-ESWHDHH6.js";
34
+ import {
35
+ now,
36
+ resolvePersistenceRoot
37
+ } from "./chunk-42AMQAJG.js";
38
+ import "./chunk-3NE23NYW.js";
14
39
 
15
40
  // src/cli.ts
16
41
  import { spawn } from "child_process";
@@ -98,6 +123,114 @@ function getWorkspaceRoot(result) {
98
123
  const workspace = getStringOption(result, "workspace");
99
124
  return resolve(workspace ?? env.FIFONY_WORKSPACE_ROOT ?? cwd());
100
125
  }
126
+ function getStateRoot(result) {
127
+ const persistence = getStringOption(result, "persistence");
128
+ return resolvePersistenceRoot(
129
+ persistence ?? env.FIFONY_PERSISTENCE ?? getWorkspaceRoot(result)
130
+ );
131
+ }
132
+ function printJson(value) {
133
+ console.log(JSON.stringify(value, null, 2));
134
+ }
135
+ function printKeyValue(label, value) {
136
+ console.log(`${label}: ${value ?? "n/a"}`);
137
+ }
138
+ async function loadRuntimeStateSnapshot(result) {
139
+ const workspaceRoot = getWorkspaceRoot(result);
140
+ const port = getNumberOption(result, "port");
141
+ await initStateStore();
142
+ try {
143
+ let config = applyWorkflowConfig(deriveConfig(buildRuntimeArgs(result)), port);
144
+ const [previous, settings, services, milestones] = await Promise.all([
145
+ loadPersistedState(),
146
+ loadRuntimeSettings(),
147
+ loadPersistedServices(),
148
+ loadPersistedMilestones()
149
+ ]);
150
+ config = applyPersistedSettings(config, settings);
151
+ if (services.length > 0) {
152
+ config = { ...config, services };
153
+ }
154
+ return buildRuntimeState(
155
+ previous,
156
+ config,
157
+ resolveProjectMetadata(settings, workspaceRoot),
158
+ milestones
159
+ );
160
+ } finally {
161
+ await closeStateStore();
162
+ }
163
+ }
164
+ async function runStatus(result) {
165
+ const json = getBooleanOption(result, "json");
166
+ const includeAll = getBooleanOption(result, "all");
167
+ const state = await loadRuntimeStateSnapshot(result);
168
+ const snapshot = collectRuntimeHealthSnapshot(state);
169
+ if (json) {
170
+ printJson(includeAll ? {
171
+ generatedAt: now(),
172
+ snapshot,
173
+ probe: buildProbeResult(state),
174
+ doctor: runDoctorChecks(state)
175
+ } : snapshot);
176
+ return;
177
+ }
178
+ console.log("Fifony Runtime Status");
179
+ printKeyValue("Generated", snapshot.generatedAt);
180
+ printKeyValue("Workspace", snapshot.workspace.root);
181
+ printKeyValue("Healthy", snapshot.ok);
182
+ printKeyValue("Configured provider", snapshot.providers.configuredProvider);
183
+ printKeyValue("Issues", snapshot.issues.total);
184
+ printKeyValue("Running issues", snapshot.issues.running);
185
+ printKeyValue("Reviewing issues", snapshot.issues.reviewing);
186
+ printKeyValue("Services running", `${snapshot.services.running}/${snapshot.services.total}`);
187
+ printKeyValue("Active agents", snapshot.agents.active);
188
+ printKeyValue("Memory flushes", snapshot.memory.totalFlushes);
189
+ if (!includeAll) return;
190
+ console.log("");
191
+ console.log("Doctor");
192
+ for (const check of runDoctorChecks(state)) {
193
+ console.log(`- [${check.status}] ${check.title}: ${check.summary}`);
194
+ }
195
+ }
196
+ async function runProbe(result) {
197
+ const json = getBooleanOption(result, "json");
198
+ const state = await loadRuntimeStateSnapshot(result);
199
+ const probe = buildProbeResult(state);
200
+ if (json) {
201
+ printJson(probe);
202
+ return;
203
+ }
204
+ console.log(`Probe: ${probe.ok ? "ok" : "degraded"}`);
205
+ for (const check of probe.checks) {
206
+ console.log(`- [${check.ok ? "ok" : "fail"}] ${check.id}: ${check.detail}`);
207
+ }
208
+ }
209
+ async function runDoctor(result) {
210
+ const json = getBooleanOption(result, "json");
211
+ const state = await loadRuntimeStateSnapshot(result);
212
+ const checks = runDoctorChecks(state);
213
+ const payload = {
214
+ ok: checks.every((check) => check.status !== "fail"),
215
+ generatedAt: now(),
216
+ checks
217
+ };
218
+ if (json) {
219
+ printJson(payload);
220
+ return;
221
+ }
222
+ console.log("Fifony Doctor");
223
+ for (const check of checks) {
224
+ console.log(`- [${check.status}] ${check.title}`);
225
+ console.log(` ${check.summary}`);
226
+ if (check.detail) {
227
+ console.log(` detail: ${check.detail}`);
228
+ }
229
+ if (check.suggestedAction) {
230
+ console.log(` action: ${check.suggestedAction}`);
231
+ }
232
+ }
233
+ }
101
234
  async function runOnboardingList() {
102
235
  const root = getReferenceRepositoriesRoot();
103
236
  const repositories = listReferenceRepositories();
@@ -209,10 +342,13 @@ async function runOnboardingImport(result) {
209
342
  }
210
343
  }
211
344
  function buildRuntimeArgs(result) {
345
+ return buildRuntimeArgsWithOverrides(result);
346
+ }
347
+ function buildRuntimeArgsWithOverrides(result, overrides = {}) {
212
348
  const runtimeArgs = [];
213
- const workspace = getStringOption(result, "workspace");
214
- const persistence = getStringOption(result, "persistence");
215
- const port = getNumberOption(result, "port");
349
+ const workspace = overrides.workspace ?? getStringOption(result, "workspace");
350
+ const persistence = overrides.persistence ?? getStringOption(result, "persistence");
351
+ const port = overrides.port ?? getNumberOption(result, "port");
216
352
  const concurrency = getNumberOption(result, "concurrency");
217
353
  const attempts = getNumberOption(result, "attempts");
218
354
  const poll = getNumberOption(result, "poll");
@@ -242,20 +378,13 @@ function buildRuntimeArgs(result) {
242
378
  }
243
379
  return runtimeArgs;
244
380
  }
245
- async function runRuntime(mode, result) {
246
- const workspace = getStringOption(result, "workspace");
247
- const workspaceRoot = resolve(workspace ?? env.FIFONY_WORKSPACE_ROOT ?? cwd());
248
- const runtimeArgs = buildRuntimeArgs(result);
381
+ async function runNodeEntry(script, args2, runtimeCwd, runtimeEnv) {
249
382
  const outcome = await new Promise((resolvePromise, rejectPromise) => {
250
- const args2 = useCompiled ? [runtimeScript, ...runtimeArgs] : [tsxCli, runtimeScript, ...runtimeArgs];
251
- const child = spawn(execPath, args2, {
252
- cwd: workspaceRoot,
383
+ const childArgs = useCompiled ? [script, ...args2] : [tsxCli, script, ...args2];
384
+ const child = spawn(execPath, childArgs, {
385
+ cwd: runtimeCwd,
253
386
  stdio: "inherit",
254
- env: {
255
- ...env,
256
- FIFONY_INTERFACE: mode,
257
- FIFONY_WORKSPACE_ROOT: workspaceRoot
258
- }
387
+ env: runtimeEnv
259
388
  });
260
389
  child.on("exit", (code, signal) => {
261
390
  resolvePromise({ code, signal });
@@ -272,36 +401,103 @@ async function runRuntime(mode, result) {
272
401
  exit(outcome.code);
273
402
  }
274
403
  }
404
+ async function runRuntimeProcess(mode, workspaceRoot, persistenceRoot, runtimeArgs) {
405
+ await runNodeEntry(runtimeScript, runtimeArgs, workspaceRoot, {
406
+ ...env,
407
+ FIFONY_INTERFACE: mode,
408
+ FIFONY_WORKSPACE_ROOT: workspaceRoot,
409
+ FIFONY_PERSISTENCE: persistenceRoot
410
+ });
411
+ }
412
+ async function runRuntime(mode, result) {
413
+ const workspace = getStringOption(result, "workspace");
414
+ const persistence = getStringOption(result, "persistence");
415
+ const workspaceRoot = resolve(workspace ?? env.FIFONY_WORKSPACE_ROOT ?? cwd());
416
+ const persistenceRoot = resolvePersistenceRoot(persistence ?? env.FIFONY_PERSISTENCE ?? workspaceRoot);
417
+ const runtimeArgs = buildRuntimeArgs(result);
418
+ await runRuntimeProcess(mode, workspaceRoot, persistenceRoot, runtimeArgs);
419
+ }
275
420
  async function runMcpServer(result) {
276
421
  const workspace = getStringOption(result, "workspace");
277
422
  const persistence = getStringOption(result, "persistence");
278
423
  const workspaceRoot = resolve(workspace ?? env.FIFONY_WORKSPACE_ROOT ?? cwd());
279
- const persistenceRoot = resolve(persistence ?? env.FIFONY_PERSISTENCE ?? workspaceRoot);
280
- const outcome = await new Promise((resolvePromise, rejectPromise) => {
281
- const mcpArgs = useCompiled ? [mcpScript] : [tsxCli, mcpScript];
282
- const child = spawn(execPath, mcpArgs, {
283
- cwd: workspaceRoot,
284
- stdio: "inherit",
285
- env: {
286
- ...env,
287
- FIFONY_WORKSPACE_ROOT: workspaceRoot,
288
- FIFONY_PERSISTENCE: persistenceRoot
289
- }
290
- });
291
- child.on("exit", (code, signal) => {
292
- resolvePromise({ code, signal });
293
- });
294
- child.on("error", (error) => {
295
- rejectPromise(error);
296
- });
424
+ const persistenceRoot = resolvePersistenceRoot(persistence ?? env.FIFONY_PERSISTENCE ?? workspaceRoot);
425
+ await runNodeEntry(mcpScript, [], workspaceRoot, {
426
+ ...env,
427
+ FIFONY_WORKSPACE_ROOT: workspaceRoot,
428
+ FIFONY_PERSISTENCE: persistenceRoot
297
429
  });
298
- if (outcome.signal) {
299
- kill(pid, outcome.signal);
430
+ }
431
+ function printDevProfileStatus(profile) {
432
+ console.log("Fifony Dev Profile");
433
+ printKeyValue("Profile", profile.profileName);
434
+ printKeyValue("Workspace", profile.workspaceRoot);
435
+ printKeyValue("Persistence", profile.persistenceRoot);
436
+ printKeyValue("Branch", profile.branchName);
437
+ printKeyValue("Bootstrapped", profile.bootstrapped);
438
+ printKeyValue("Worktree attached", profile.worktreeAttached);
439
+ printKeyValue("Dashboard port", profile.dashboardPort);
440
+ printKeyValue("Trash entries", profile.trashEntries.length);
441
+ if (profile.lastBootstrappedAt) {
442
+ printKeyValue("Last bootstrap", profile.lastBootstrappedAt);
443
+ }
444
+ if (profile.lastResetAt) {
445
+ printKeyValue("Last reset", profile.lastResetAt);
446
+ }
447
+ console.log("");
448
+ console.log("Launch");
449
+ console.log(profile.launchCommand);
450
+ }
451
+ async function runDevStatus(result) {
452
+ const workspaceRoot = getWorkspaceRoot(result);
453
+ const json = getBooleanOption(result, "json");
454
+ const profile = getDevProfileStatus(workspaceRoot, getStateRoot(result));
455
+ if (json) {
456
+ printJson({ ok: true, profile });
300
457
  return;
301
458
  }
302
- if (typeof outcome.code === "number" && outcome.code !== 0) {
303
- exit(outcome.code);
459
+ printDevProfileStatus(profile);
460
+ }
461
+ async function runDevBootstrap(result) {
462
+ const workspaceRoot = getWorkspaceRoot(result);
463
+ const json = getBooleanOption(result, "json");
464
+ const profile = bootstrapDevProfile(workspaceRoot, getStateRoot(result));
465
+ if (json) {
466
+ printJson({ ok: true, profile });
467
+ return;
304
468
  }
469
+ printDevProfileStatus(profile);
470
+ }
471
+ async function runDevReset(result) {
472
+ const workspaceRoot = getWorkspaceRoot(result);
473
+ const stateRoot = getStateRoot(result);
474
+ const json = getBooleanOption(result, "json");
475
+ const resultPayload = resetDevProfile(workspaceRoot, stateRoot);
476
+ const profile = getDevProfileStatus(workspaceRoot, stateRoot);
477
+ if (json) {
478
+ printJson({ ok: true, result: resultPayload, profile });
479
+ return;
480
+ }
481
+ console.log("Dev profile reset");
482
+ printKeyValue("Removed worktree", resultPayload.removedWorktree);
483
+ printKeyValue("Trashed profile", resultPayload.trashedProfile);
484
+ if (resultPayload.trashPath) {
485
+ printKeyValue("Trash path", resultPayload.trashPath);
486
+ }
487
+ console.log("");
488
+ printDevProfileStatus(profile);
489
+ }
490
+ async function runDevRuntime(result) {
491
+ const targetWorkspaceRoot = getWorkspaceRoot(result);
492
+ const stateRoot = getStateRoot(result);
493
+ const profile = bootstrapDevProfile(targetWorkspaceRoot, stateRoot);
494
+ const port = getNumberOption(result, "port") ?? profile.dashboardPort;
495
+ const runtimeArgs = buildRuntimeArgsWithOverrides(result, {
496
+ workspace: profile.workspaceRoot,
497
+ persistence: profile.persistenceRoot,
498
+ port
499
+ });
500
+ await runRuntimeProcess("cli", profile.workspaceRoot, profile.persistenceRoot, runtimeArgs);
305
501
  }
306
502
  var cli = createCLI({
307
503
  name: packageJson.name ?? "fifony",
@@ -318,6 +514,101 @@ var cli = createCLI({
318
514
  options: commonOptions,
319
515
  handler: (result) => runMcpServer(result)
320
516
  },
517
+ dev: {
518
+ description: "Manage and run the isolated Fifony development profile.",
519
+ commands: {
520
+ status: {
521
+ description: "Show the current dev profile status and launch command.",
522
+ options: {
523
+ workspace: commonOptions.workspace,
524
+ persistence: commonOptions.persistence,
525
+ json: {
526
+ type: "boolean",
527
+ description: "Emit JSON instead of human-readable text."
528
+ }
529
+ },
530
+ handler: (result) => runDevStatus(result)
531
+ },
532
+ bootstrap: {
533
+ description: "Create or refresh the isolated dev profile worktree and bootstrap files.",
534
+ options: {
535
+ workspace: commonOptions.workspace,
536
+ persistence: commonOptions.persistence,
537
+ json: {
538
+ type: "boolean",
539
+ description: "Emit JSON instead of human-readable text."
540
+ }
541
+ },
542
+ handler: (result) => runDevBootstrap(result)
543
+ },
544
+ reset: {
545
+ description: "Safely move the dev profile to trash and remove its worktree branch.",
546
+ options: {
547
+ workspace: commonOptions.workspace,
548
+ persistence: commonOptions.persistence,
549
+ json: {
550
+ type: "boolean",
551
+ description: "Emit JSON instead of human-readable text."
552
+ }
553
+ },
554
+ handler: (result) => runDevReset(result)
555
+ },
556
+ run: {
557
+ description: "Launch the runtime against the isolated dev profile.",
558
+ options: {
559
+ ...commonOptions,
560
+ port: {
561
+ ...commonOptions.port,
562
+ default: 4100
563
+ }
564
+ },
565
+ handler: (result) => runDevRuntime(result)
566
+ }
567
+ }
568
+ },
569
+ status: {
570
+ description: "Show an operational snapshot of the local Fifony runtime state.",
571
+ options: {
572
+ workspace: commonOptions.workspace,
573
+ persistence: commonOptions.persistence,
574
+ port: commonOptions.port,
575
+ json: {
576
+ type: "boolean",
577
+ description: "Emit JSON instead of human-readable text."
578
+ },
579
+ all: {
580
+ type: "boolean",
581
+ description: "Include doctor details alongside the status snapshot."
582
+ }
583
+ },
584
+ handler: (result) => runStatus(result)
585
+ },
586
+ probe: {
587
+ description: "Run a fast readiness probe over workspace, providers, services, agents, and memory.",
588
+ options: {
589
+ workspace: commonOptions.workspace,
590
+ persistence: commonOptions.persistence,
591
+ port: commonOptions.port,
592
+ json: {
593
+ type: "boolean",
594
+ description: "Emit JSON instead of human-readable text."
595
+ }
596
+ },
597
+ handler: (result) => runProbe(result)
598
+ },
599
+ doctor: {
600
+ description: "Run detailed operational diagnostics for the local Fifony runtime.",
601
+ options: {
602
+ workspace: commonOptions.workspace,
603
+ persistence: commonOptions.persistence,
604
+ port: commonOptions.port,
605
+ json: {
606
+ type: "boolean",
607
+ description: "Emit JSON instead of human-readable text."
608
+ }
609
+ },
610
+ handler: (result) => runDoctor(result)
611
+ },
321
612
  onboarding: {
322
613
  description: "Manage reference repositories and import agents/skills from them.",
323
614
  aliases: ["onboard"],
@@ -15,12 +15,15 @@ import {
15
15
  setFsmEventEmitter,
16
16
  setIssueResourceStateApi,
17
17
  setIssueStateMachinePlugin,
18
+ setPersistNowFn,
18
19
  visualizeStateMachine
19
- } from "./chunk-H5N7O5NP.js";
20
- import "./chunk-NB44PCD2.js";
21
- import "./chunk-2CVTK5F2.js";
22
- import "./chunk-37N5OFHM.js";
20
+ } from "./chunk-AILXZ2TD.js";
21
+ import "./chunk-SOBLO4YZ.js";
22
+ import "./chunk-MVTGAKQK.js";
23
+ import "./chunk-FJNH3G2Z.js";
23
24
  import "./chunk-DVU3CXWA.js";
25
+ import "./chunk-ESWHDHH6.js";
26
+ import "./chunk-42AMQAJG.js";
24
27
  export {
25
28
  ISSUE_STATE_MACHINE_ID,
26
29
  canTransitionIssue,
@@ -38,6 +41,7 @@ export {
38
41
  setFsmEventEmitter,
39
42
  setIssueResourceStateApi,
40
43
  setIssueStateMachinePlugin,
44
+ setPersistNowFn,
41
45
  visualizeStateMachine
42
46
  };
43
- //# sourceMappingURL=issue-state-machine-GPQNZYUZ.js.map
47
+ //# sourceMappingURL=fsm-issue-YGGF7SIL.js.map
@@ -0,0 +1,53 @@
1
+ import {
2
+ appendFileTail,
3
+ clamp,
4
+ debugBoot,
5
+ extractJsonObjects,
6
+ fail,
7
+ getNestedNumber,
8
+ getNestedRecord,
9
+ getNestedString,
10
+ idToSafePath,
11
+ isoWeek,
12
+ normalizeState,
13
+ now,
14
+ parseEnvNumber,
15
+ parseFrontMatter,
16
+ parseIntArg,
17
+ parseIssueState,
18
+ parsePositiveIntEnv,
19
+ repairTruncatedJson,
20
+ sleep,
21
+ toBooleanValue,
22
+ toNumberValue,
23
+ toStringArray,
24
+ toStringValue,
25
+ withRetryBackoff
26
+ } from "./chunk-42AMQAJG.js";
27
+ export {
28
+ appendFileTail,
29
+ clamp,
30
+ debugBoot,
31
+ extractJsonObjects,
32
+ fail,
33
+ getNestedNumber,
34
+ getNestedRecord,
35
+ getNestedString,
36
+ idToSafePath,
37
+ isoWeek,
38
+ normalizeState,
39
+ now,
40
+ parseEnvNumber,
41
+ parseFrontMatter,
42
+ parseIntArg,
43
+ parseIssueState,
44
+ parsePositiveIntEnv,
45
+ repairTruncatedJson,
46
+ sleep,
47
+ toBooleanValue,
48
+ toNumberValue,
49
+ toStringArray,
50
+ toStringValue,
51
+ withRetryBackoff
52
+ };
53
+ //# sourceMappingURL=helpers-L7NYO5XS.js.map
@@ -0,0 +1,84 @@
1
+ import {
2
+ agentLogPath,
3
+ issueLogRoomSize,
4
+ sendToIssueLogRoom
5
+ } from "./chunk-YRSH2CLW.js";
6
+ import "./chunk-BRSR26VK.js";
7
+ import "./chunk-QQQLP3PL.js";
8
+ import "./chunk-AILXZ2TD.js";
9
+ import "./chunk-SOBLO4YZ.js";
10
+ import "./chunk-E2EWEYA4.js";
11
+ import "./chunk-MVTGAKQK.js";
12
+ import "./chunk-FJNH3G2Z.js";
13
+ import {
14
+ logger
15
+ } from "./chunk-DVU3CXWA.js";
16
+ import "./chunk-ESWHDHH6.js";
17
+ import "./chunk-42AMQAJG.js";
18
+ import "./chunk-3NE23NYW.js";
19
+
20
+ // src/persistence/plugins/issue-log-broadcaster.ts
21
+ import {
22
+ closeSync,
23
+ existsSync,
24
+ openSync,
25
+ readSync,
26
+ statSync
27
+ } from "fs";
28
+ var POLL_INTERVAL_MS = 500;
29
+ var MAX_CHUNK_BYTES = 16384;
30
+ var active = /* @__PURE__ */ new Map();
31
+ function readNewBytes(logPath, position) {
32
+ try {
33
+ const size = statSync(logPath).size;
34
+ if (size <= position) return null;
35
+ const toRead = Math.min(size - position, MAX_CHUNK_BYTES);
36
+ const buf = Buffer.alloc(toRead);
37
+ const fd = openSync(logPath, "r");
38
+ const n = readSync(fd, buf, 0, toRead, position);
39
+ closeSync(fd);
40
+ if (n <= 0) return null;
41
+ return { chunk: buf.slice(0, n).toString("utf8"), newPosition: position + n };
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+ function startIssueLogBroadcasting(issueId, workspacePath) {
47
+ stopIssueLogBroadcasting(issueId);
48
+ const logPath = agentLogPath(workspacePath);
49
+ const entry = { timerId: null, position: 0 };
50
+ const flush = () => {
51
+ if (!existsSync(logPath)) return;
52
+ try {
53
+ const size = statSync(logPath).size;
54
+ if (size < entry.position) entry.position = 0;
55
+ if (size <= entry.position) return;
56
+ } catch {
57
+ return;
58
+ }
59
+ const result = readNewBytes(logPath, entry.position);
60
+ if (!result) return;
61
+ entry.position = result.newPosition;
62
+ if (issueLogRoomSize(issueId) === 0) return;
63
+ sendToIssueLogRoom(issueId, JSON.stringify({ type: "issue:log", id: issueId, chunk: result.chunk }));
64
+ };
65
+ entry.timerId = setInterval(flush, POLL_INTERVAL_MS);
66
+ active.set(issueId, entry);
67
+ logger.debug({ issueId }, "[IssueLogBroadcaster] Started");
68
+ }
69
+ function stopIssueLogBroadcasting(issueId) {
70
+ const entry = active.get(issueId);
71
+ if (!entry) return;
72
+ clearInterval(entry.timerId);
73
+ active.delete(issueId);
74
+ logger.debug({ issueId }, "[IssueLogBroadcaster] Stopped");
75
+ }
76
+ function stopAllIssueLogBroadcasting() {
77
+ for (const id of [...active.keys()]) stopIssueLogBroadcasting(id);
78
+ }
79
+ export {
80
+ startIssueLogBroadcasting,
81
+ stopAllIssueLogBroadcasting,
82
+ stopIssueLogBroadcasting
83
+ };
84
+ //# sourceMappingURL=issue-log-broadcaster-WZAHISYB.js.map
@@ -5,22 +5,22 @@ import {
5
5
  createIssueFromPayload,
6
6
  dedupHistoryEntries,
7
7
  deriveConfig,
8
+ getIssueTransitionExecutor,
8
9
  getNextRetryAt,
9
10
  issueDependenciesResolved,
10
11
  nextLocalIssueId,
11
12
  normalizeIssue,
13
+ setIssueTransitionExecutor,
12
14
  transitionIssue,
13
15
  validateConfig
14
- } from "./chunk-JTKUWIQD.js";
15
- import "./chunk-RBDBGU2C.js";
16
- import "./chunk-I2UHVKHS.js";
16
+ } from "./chunk-E2EWEYA4.js";
17
17
  import {
18
18
  computeMetrics
19
- } from "./chunk-H5N7O5NP.js";
20
- import "./chunk-NB44PCD2.js";
21
- import "./chunk-2CVTK5F2.js";
22
- import "./chunk-37N5OFHM.js";
19
+ } from "./chunk-MVTGAKQK.js";
20
+ import "./chunk-FJNH3G2Z.js";
23
21
  import "./chunk-DVU3CXWA.js";
22
+ import "./chunk-ESWHDHH6.js";
23
+ import "./chunk-42AMQAJG.js";
24
24
  export {
25
25
  addEvent,
26
26
  applyWorkflowConfig,
@@ -29,11 +29,13 @@ export {
29
29
  createIssueFromPayload,
30
30
  dedupHistoryEntries,
31
31
  deriveConfig,
32
+ getIssueTransitionExecutor,
32
33
  getNextRetryAt,
33
34
  issueDependenciesResolved,
34
35
  nextLocalIssueId,
35
36
  normalizeIssue,
37
+ setIssueTransitionExecutor,
36
38
  transitionIssue,
37
39
  validateConfig
38
40
  };
39
- //# sourceMappingURL=issues-MZLRSXD6.js.map
41
+ //# sourceMappingURL=issues-3QRR7KM6.js.map