@hearsay-tools/squawk 0.17.0-pr3285.5787 → 0.18.0-dev.5793

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 (82) hide show
  1. package/dist/artifacts/reports-index.js +1 -3
  2. package/dist/artifacts/reports-index.js.map +1 -1
  3. package/dist/artifacts/store.d.ts +1 -1
  4. package/dist/artifacts/store.js +1 -3
  5. package/dist/artifacts/store.js.map +1 -1
  6. package/dist/autosave-cleanup.d.ts +1 -2
  7. package/dist/autosave-cleanup.js +6 -8
  8. package/dist/autosave-cleanup.js.map +1 -1
  9. package/dist/delegation/context.js +2 -4
  10. package/dist/delegation/context.js.map +1 -1
  11. package/dist/delegation/results.js +2 -3
  12. package/dist/delegation/results.js.map +1 -1
  13. package/dist/delegation/routes.d.ts +75 -75
  14. package/dist/delegation/transport.d.ts +73 -73
  15. package/dist/handoff.js +1 -2
  16. package/dist/handoff.js.map +1 -1
  17. package/dist/preview/agent-marker.js +6 -9
  18. package/dist/preview/agent-marker.js.map +1 -1
  19. package/dist/preview/dev-server.js +10 -31
  20. package/dist/preview/dev-server.js.map +1 -1
  21. package/dist/preview/host.js +2 -3
  22. package/dist/preview/host.js.map +1 -1
  23. package/dist/project-migration/answer.d.ts +0 -2
  24. package/dist/project-migration/answer.js +5 -7
  25. package/dist/project-migration/answer.js.map +1 -1
  26. package/dist/project-migration/auto.d.ts +8 -15
  27. package/dist/project-migration/auto.js +26 -24
  28. package/dist/project-migration/auto.js.map +1 -1
  29. package/dist/project-migration/cli.js +2 -3
  30. package/dist/project-migration/cli.js.map +1 -1
  31. package/dist/project-migration/containment.d.ts +1 -1
  32. package/dist/project-migration/containment.js +2 -4
  33. package/dist/project-migration/containment.js.map +1 -1
  34. package/dist/project-migration/engine.d.ts +1 -5
  35. package/dist/project-migration/engine.js +1 -18
  36. package/dist/project-migration/engine.js.map +1 -1
  37. package/dist/project-migration/journal.d.ts +2 -8
  38. package/dist/project-migration/journal.js +2 -9
  39. package/dist/project-migration/journal.js.map +1 -1
  40. package/dist/project-migration/live.d.ts +5 -20
  41. package/dist/project-migration/live.js +5 -47
  42. package/dist/project-migration/live.js.map +1 -1
  43. package/dist/project-migration/offline.d.ts +4 -6
  44. package/dist/project-migration/offline.js +6 -8
  45. package/dist/project-migration/offline.js.map +1 -1
  46. package/dist/project-migration/plan.d.ts +2 -28
  47. package/dist/project-migration/plan.js +36 -151
  48. package/dist/project-migration/plan.js.map +1 -1
  49. package/dist/project-migration/steps.js +3 -56
  50. package/dist/project-migration/steps.js.map +1 -1
  51. package/dist/project-paths.d.ts +1 -3
  52. package/dist/project-paths.js +2 -9
  53. package/dist/project-paths.js.map +1 -1
  54. package/dist/runs/agent-tmpdir.js +3 -4
  55. package/dist/runs/agent-tmpdir.js.map +1 -1
  56. package/dist/runs/history-file.js +3 -6
  57. package/dist/runs/history-file.js.map +1 -1
  58. package/dist/runs/store.d.ts +72 -72
  59. package/dist/runs/store.js +6 -6
  60. package/dist/runs/store.js.map +1 -1
  61. package/dist/runs/worker-execution.d.ts +1 -3
  62. package/dist/runs/worker-execution.js +6 -23
  63. package/dist/runs/worker-execution.js.map +1 -1
  64. package/dist/server/activity-routes.d.ts +23 -23
  65. package/dist/server/self-update-routes.d.ts +19 -19
  66. package/dist/server/server.d.ts +2929 -2929
  67. package/dist/voice/routes.d.ts +19 -19
  68. package/dist/workflows/attachment-path.js +1 -2
  69. package/dist/workflows/attachment-path.js.map +1 -1
  70. package/dist/workflows/run/attachment-writer.js +1 -2
  71. package/dist/workflows/run/attachment-writer.js.map +1 -1
  72. package/dist/workflows/run/continuation-session.js +1 -2
  73. package/dist/workflows/run/continuation-session.js.map +1 -1
  74. package/dist/workflows/run/queued-input.js +1 -2
  75. package/dist/workflows/run/queued-input.js.map +1 -1
  76. package/dist/workflows/run/step-session.js +1 -2
  77. package/dist/workflows/run/step-session.js.map +1 -1
  78. package/dist/workflows/run/wait-engine.d.ts +72 -72
  79. package/package.json +4 -4
  80. package/dist/legacy-runs.d.ts +0 -56
  81. package/dist/legacy-runs.js +0 -122
  82. package/dist/legacy-runs.js.map +0 -1
@@ -1,56 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Tasks whose own files stay in `.ai/cezar/` after a project move (owner decision A,
4
- * hearsay-tools/cezarion#2778). A move carries the run store and everything else to `.ai/squawk/`,
5
- * but a task that can still resume at the move (live, or not archived: a human can Continue a
6
- * finished task) keeps its own items where its agent knows them: its worktree, its handoff file
7
- * and other `runs/<id>…` files, its scratch directories. The moved store keeps their absolute
8
- * paths. The move writes the ids of those tasks to `<root>/.ai/squawk/legacy-runs.json`; a later
9
- * move carries their items once the task is archived or deleted, and removes the file when no
10
- * task is left.
11
- *
12
- * Every path helper of a run's own items resolves its directory with `runDataDir`, so the cockpit
13
- * reads and writes a leftover task's items in `.ai/cezar/`, and the read-only rule of the fallback
14
- * directory (`fallbackProjectWriteError`) exempts them.
15
- */
16
- export declare const LEGACY_RUNS_FILE = "legacy-runs.json";
17
- export declare const legacyRunsSchema: z.ZodObject<{
18
- version: z.ZodLiteral<1>;
19
- runs: z.ZodArray<z.ZodString>;
20
- }, z.core.$strict>;
21
- /**
22
- * `legacy-runs.json` exists but cannot be read or validated. Which tasks keep their items in
23
- * `.ai/cezar/` is then unknown: a reader that guessed `.ai/squawk/` could miss a kept task's
24
- * history and write a second copy beside it, so every per-run path refuses until the project's
25
- * next move rewrites the file from the run store.
26
- */
27
- export declare class LegacyRunsUnreadableError extends Error {
28
- readonly file: string;
29
- constructor(file: string, cause: unknown);
30
- }
31
- /**
32
- * The ids of the tasks that keep their own items in `.ai/cezar/` beside the moved directory
33
- * `movedDir`. Only an absent file means none; a file that is present but unreadable or invalid
34
- * throws `LegacyRunsUnreadableError`, and is read again on the next call.
35
- */
36
- export declare function legacyRunIds(movedDir: string): ReadonlySet<string>;
37
- /** Forget what was read for `movedDir`: the move that rewrites the file calls it. */
38
- export declare function forgetLegacyRunIds(movedDir: string): void;
39
- /** The tasks whose own items stay in `.ai/cezar/` beside `dataDir`; none unless it is a moved project directory. */
40
- export declare function legacyRunsBeside(dataDir: string): string[];
41
- /**
42
- * The data directory that holds run `runId`'s own items: `.ai/cezar/` beside a moved project's
43
- * `dataDir` for a task the move left there, else `dataDir` itself.
44
- */
45
- export declare function runDataDir(dataDir: string, runId: string): string;
46
- /**
47
- * The run among `ids` that owns the item at `parts`, a path relative to a project data directory:
48
- * `worktrees/<id>`, `tmp/<id>`, `preview/<id>`, `t/<first 8 of id>` and every `runs/<id>…` entry,
49
- * and anything inside them. Undefined for every other path.
50
- */
51
- export declare function legacyItemOwner(parts: readonly string[], ids: ReadonlySet<string>): string | undefined;
52
- /**
53
- * Whether `path` lies inside an item of a task that kept its files in the legacy directory of
54
- * the project at `root`: writes there stay allowed although `.ai/cezar/` is the fallback.
55
- */
56
- export declare function legacyRunItem(root: string, path: string): boolean;
@@ -1,122 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { basename, dirname, join, resolve, sep } from 'node:path';
3
- import { z } from 'zod';
4
- import { runIdParamSchema } from './contract/index.js';
5
- /**
6
- * Tasks whose own files stay in `.ai/cezar/` after a project move (owner decision A,
7
- * hearsay-tools/cezarion#2778). A move carries the run store and everything else to `.ai/squawk/`,
8
- * but a task that can still resume at the move (live, or not archived: a human can Continue a
9
- * finished task) keeps its own items where its agent knows them: its worktree, its handoff file
10
- * and other `runs/<id>…` files, its scratch directories. The moved store keeps their absolute
11
- * paths. The move writes the ids of those tasks to `<root>/.ai/squawk/legacy-runs.json`; a later
12
- * move carries their items once the task is archived or deleted, and removes the file when no
13
- * task is left.
14
- *
15
- * Every path helper of a run's own items resolves its directory with `runDataDir`, so the cockpit
16
- * reads and writes a leftover task's items in `.ai/cezar/`, and the read-only rule of the fallback
17
- * directory (`fallbackProjectWriteError`) exempts them.
18
- */
19
- export const LEGACY_RUNS_FILE = 'legacy-runs.json';
20
- export const legacyRunsSchema = z.object({ version: z.literal(1), runs: z.array(runIdParamSchema.shape.id) }).strict();
21
- const cache = new Map();
22
- /**
23
- * `legacy-runs.json` exists but cannot be read or validated. Which tasks keep their items in
24
- * `.ai/cezar/` is then unknown: a reader that guessed `.ai/squawk/` could miss a kept task's
25
- * history and write a second copy beside it, so every per-run path refuses until the project's
26
- * next move rewrites the file from the run store.
27
- */
28
- export class LegacyRunsUnreadableError extends Error {
29
- file;
30
- constructor(file, cause) {
31
- super(`Cannot read ${file}: ${cause instanceof Error ? cause.message : String(cause)}. `
32
- + 'It names the tasks whose files stayed in .ai/cezar/; the next cockpit start or migrate-project rewrites it', { cause });
33
- this.file = file;
34
- }
35
- }
36
- /** Whether `dataDir` is a project's moved directory, `<root>/.ai/squawk`. */
37
- function movedDirectory(dataDir) {
38
- return basename(dataDir) === 'squawk' && basename(dirname(dataDir)) === '.ai';
39
- }
40
- /**
41
- * The ids of the tasks that keep their own items in `.ai/cezar/` beside the moved directory
42
- * `movedDir`. Only an absent file means none; a file that is present but unreadable or invalid
43
- * throws `LegacyRunsUnreadableError`, and is read again on the next call.
44
- */
45
- export function legacyRunIds(movedDir) {
46
- const key = resolve(movedDir);
47
- const cached = cache.get(key);
48
- if (cached)
49
- return cached;
50
- const file = join(key, LEGACY_RUNS_FILE);
51
- let ids;
52
- try {
53
- ids = new Set(legacyRunsSchema.parse(JSON.parse(readFileSync(file, 'utf8'))).runs);
54
- }
55
- catch (error) {
56
- if (error.code !== 'ENOENT')
57
- throw new LegacyRunsUnreadableError(file, error);
58
- ids = new Set();
59
- }
60
- cache.set(key, ids);
61
- return ids;
62
- }
63
- /** Forget what was read for `movedDir`: the move that rewrites the file calls it. */
64
- export function forgetLegacyRunIds(movedDir) {
65
- cache.delete(resolve(movedDir));
66
- }
67
- /** The tasks whose own items stay in `.ai/cezar/` beside `dataDir`; none unless it is a moved project directory. */
68
- export function legacyRunsBeside(dataDir) {
69
- return movedDirectory(dataDir) ? [...legacyRunIds(dataDir)] : [];
70
- }
71
- /**
72
- * The data directory that holds run `runId`'s own items: `.ai/cezar/` beside a moved project's
73
- * `dataDir` for a task the move left there, else `dataDir` itself.
74
- */
75
- export function runDataDir(dataDir, runId) {
76
- if (!movedDirectory(dataDir) || !legacyRunIds(dataDir).has(runId))
77
- return dataDir;
78
- return join(dirname(dataDir), 'cezar');
79
- }
80
- const RUN_FILE = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:$|[.-])/i;
81
- const SHORT_SCRATCH = /^[0-9a-f]{8}$/i;
82
- /**
83
- * The run among `ids` that owns the item at `parts`, a path relative to a project data directory:
84
- * `worktrees/<id>`, `tmp/<id>`, `preview/<id>`, `t/<first 8 of id>` and every `runs/<id>…` entry,
85
- * and anything inside them. Undefined for every other path.
86
- */
87
- export function legacyItemOwner(parts, ids) {
88
- const [top, name] = parts;
89
- if (!name || parts.includes('..') || parts.includes('.'))
90
- return undefined;
91
- if (top === 'worktrees' || top === 'tmp' || top === 'preview')
92
- return ids.has(name) ? name : undefined;
93
- if (top === 't')
94
- return SHORT_SCRATCH.test(name) ? [...ids].find(id => id.slice(0, 8) === name) : undefined;
95
- if (top === 'runs') {
96
- const id = RUN_FILE.exec(name)?.[1];
97
- return id && ids.has(id) ? id : undefined;
98
- }
99
- return undefined;
100
- }
101
- /**
102
- * Whether `path` lies inside an item of a task that kept its files in the legacy directory of
103
- * the project at `root`: writes there stay allowed although `.ai/cezar/` is the fallback.
104
- */
105
- export function legacyRunItem(root, path) {
106
- const legacy = resolve(root, '.ai', 'cezar');
107
- const target = resolve(path);
108
- if (!target.startsWith(legacy + sep))
109
- return false;
110
- let ids;
111
- // A write guard fails closed: with the list unreadable, no item counts as a kept task's.
112
- try {
113
- ids = legacyRunIds(resolve(root, '.ai', 'squawk'));
114
- }
115
- catch (error) {
116
- if (error instanceof LegacyRunsUnreadableError)
117
- return false;
118
- throw error;
119
- }
120
- return legacyItemOwner(target.slice(legacy.length + 1).split(sep), ids) !== undefined;
121
- }
122
- //# sourceM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