@awak-app/simy-cli 0.6.13 → 0.6.17

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 (37) hide show
  1. package/README.md +91 -6
  2. package/package.json +1 -1
  3. package/src/agent.js +97 -23
  4. package/src/auto-update.js +55 -6
  5. package/src/cli-contract.js +1 -1
  6. package/src/codex-plugins/simy/hooks/connection-reminder.mjs +5 -2
  7. package/src/codex-plugins/simy/hooks/delivery-loop.mjs +30 -3
  8. package/src/codex-plugins/simy/hooks/dev-work.mjs +7 -1
  9. package/src/codex-plugins/simy/hooks/hooks.json +2 -2
  10. package/src/codex-work-pattern-sync.js +37 -9
  11. package/src/delivery-hooks/command.js +9 -2
  12. package/src/delivery-hooks/desktop.js +10 -12
  13. package/src/delivery-hooks/evidence.js +50 -0
  14. package/src/delivery-hooks/supervisor.js +8 -2
  15. package/src/desktop-access.js +5 -3
  16. package/src/desktop-host.js +511 -74
  17. package/src/desktop-update-stop.js +22 -0
  18. package/src/doctor.js +2 -1
  19. package/src/host-exit-diagnostics.js +28 -0
  20. package/src/index.js +1 -0
  21. package/src/provider-links.js +74 -0
  22. package/src/session-supervision/action-association-host.js +23 -10
  23. package/src/session-supervision/association-refresh.js +12 -0
  24. package/src/session-supervision/association-store.js +26 -10
  25. package/src/session-supervision/automatic-continuation.js +31 -2
  26. package/src/session-supervision/claude-sessions.js +25 -15
  27. package/src/session-supervision/codex-app-server.js +27 -4
  28. package/src/session-supervision/index.js +163 -42
  29. package/src/session-supervision/statistics.js +76 -15
  30. package/src/sqm/command.js +58 -7
  31. package/src/sqm/evidence-client.js +11 -1
  32. package/src/sqm/failure-circuit.js +28 -6
  33. package/src/sqm/history-store.js +49 -18
  34. package/src/sqm/provider-diagnostics.js +1 -0
  35. package/src/sqm/review-worker.js +70 -21
  36. package/src/sqm/workflow-update.js +12 -3
  37. package/src/windows-desktop-updater.js +6 -1
@@ -1,3 +1,4 @@
1
+ import { setTimeout as delay } from "node:timers/promises";
1
2
  import { mkdir, readFile, realpath, rm, stat } from "node:fs/promises";
2
3
  import { homedir } from "node:os";
3
4
  import path from "node:path";
@@ -36,6 +37,7 @@ export async function syncInstalledWorkflows({ home = homedir(), installMissing
36
37
  claudeHome = process.env.CLAUDE_CONFIG_DIR || path.join(home, ".claude"),
37
38
  inspect = inspectSqmAgentSkill, install = installSqmAgentSkill,
38
39
  resolveExecutable = resolveBackendExecutable, run = runProviderCommand,
40
+ lockWaitMs = 0, wait = delay, now = Date.now,
39
41
  } = {}) {
40
42
  // Multiple daemons may share the same installation. Serialize updates and recover
41
43
  // an abandoned lock after more than the bounded Codex command timeouts.
@@ -44,9 +46,16 @@ export async function syncInstalledWorkflows({ home = homedir(), installMissing
44
46
  try {
45
47
  if (Date.now() - (await stat(lock)).mtimeMs > 5 * 60 * 1000) await rm(lock, { recursive: true, force: true });
46
48
  } catch (error) { if (error.code !== "ENOENT") throw error; }
47
- try { await mkdir(lock); } catch (error) {
48
- if (error.code === "EEXIST") return { outcome: "busy" };
49
- throw error;
49
+ const deadline = now() + (Number.isFinite(lockWaitMs) ? Math.max(0, Math.min(lockWaitMs, 30_000)) : 0);
50
+ for (;;) {
51
+ try { await mkdir(lock); break; } catch (error) {
52
+ if (error.code !== "EEXIST") throw error;
53
+ const remaining = deadline - now();
54
+ if (remaining <= 0) return { outcome: "busy" };
55
+ // Explicit setup can join an ongoing background update. Reinspect after
56
+ // acquiring the lock; a background update may not prepare missing sources.
57
+ await wait(Math.min(remaining, 250));
58
+ }
50
59
  }
51
60
  try {
52
61
  const migrated = await retireLegacySqmGate({ home });
@@ -31,7 +31,12 @@ export function createWindowsDesktopUpdater({ version, fetchImpl = fetch, open =
31
31
  } catch { update({ state: 'failed', message: 'Could not check for updates. Try again.', action: null }); }
32
32
  return events.snapshot();
33
33
  })().finally(() => { pending = null; });
34
- events.performAction = async () => { if (state.action?.url) await open(state.action.url); else await events.checkNow(); };
34
+ events.performAction = async () => {
35
+ if (state.action?.url) {
36
+ const result = await open(state.action.url);
37
+ if (result?.opened === false) throw new Error('Could not open the update installer download.');
38
+ } else await events.checkNow();
39
+ };
35
40
  events.maybeApply = events.performAction;
36
41
  events.beginWork = () => () => {};
37
42
  events.acceptsNewWork = () => true;