@vibe-commit/capture 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +149 -1
  2. package/dist/agents/claude_code.js +13 -0
  3. package/dist/agents/claude_code.js.map +1 -1
  4. package/dist/agents/codex_cli.js +11 -0
  5. package/dist/agents/codex_cli.js.map +1 -1
  6. package/dist/agents/cursor.js +7 -1
  7. package/dist/agents/cursor.js.map +1 -1
  8. package/dist/agents/registry.d.ts +7 -0
  9. package/dist/agents/registry.js +9 -0
  10. package/dist/agents/registry.js.map +1 -1
  11. package/dist/agents/types.d.ts +32 -0
  12. package/dist/agents/types.js.map +1 -1
  13. package/dist/bounded_id.d.ts +29 -0
  14. package/dist/bounded_id.js +42 -0
  15. package/dist/bounded_id.js.map +1 -0
  16. package/dist/codex_folders.d.ts +340 -0
  17. package/dist/codex_folders.js +1448 -0
  18. package/dist/codex_folders.js.map +1 -0
  19. package/dist/commands/backfill.d.ts +29 -7
  20. package/dist/commands/backfill.js +387 -109
  21. package/dist/commands/backfill.js.map +1 -1
  22. package/dist/commands/connect.d.ts +1 -1
  23. package/dist/commands/connect.js +1 -1
  24. package/dist/commands/connect.js.map +1 -1
  25. package/dist/commands/connect_picker.js +48 -7
  26. package/dist/commands/connect_picker.js.map +1 -1
  27. package/dist/commands/finalize.d.ts +67 -0
  28. package/dist/commands/finalize.js +452 -114
  29. package/dist/commands/finalize.js.map +1 -1
  30. package/dist/commands/scan.d.ts +28 -0
  31. package/dist/commands/scan.js +11 -0
  32. package/dist/commands/scan.js.map +1 -1
  33. package/dist/commands/status_machine.js +47 -10
  34. package/dist/commands/status_machine.js.map +1 -1
  35. package/dist/commands/why.d.ts +19 -1
  36. package/dist/commands/why.js +35 -3
  37. package/dist/commands/why.js.map +1 -1
  38. package/dist/commit_files.d.ts +64 -0
  39. package/dist/commit_files.js +83 -0
  40. package/dist/commit_files.js.map +1 -0
  41. package/dist/consent.d.ts +22 -0
  42. package/dist/consent.js +38 -1
  43. package/dist/consent.js.map +1 -1
  44. package/dist/copy/strings.d.ts +55 -9
  45. package/dist/copy/strings.js +60 -12
  46. package/dist/copy/strings.js.map +1 -1
  47. package/dist/folder_grants.d.ts +44 -0
  48. package/dist/folder_grants.js +101 -0
  49. package/dist/folder_grants.js.map +1 -0
  50. package/dist/git.d.ts +26 -4
  51. package/dist/git.js +82 -11
  52. package/dist/git.js.map +1 -1
  53. package/dist/hooks/entry.d.ts +30 -50
  54. package/dist/hooks/entry.js +595 -559
  55. package/dist/hooks/entry.js.map +1 -1
  56. package/dist/hooks/fire_lock.d.ts +31 -0
  57. package/dist/hooks/fire_lock.js +120 -12
  58. package/dist/hooks/fire_lock.js.map +1 -1
  59. package/dist/hooks/post_commit.d.ts +9 -0
  60. package/dist/hooks/post_commit.js +9 -5
  61. package/dist/hooks/post_commit.js.map +1 -1
  62. package/dist/machine_state.d.ts +44 -1
  63. package/dist/machine_state.js +75 -12
  64. package/dist/machine_state.js.map +1 -1
  65. package/dist/oauth/discovery.js +2 -1
  66. package/dist/oauth/discovery.js.map +1 -1
  67. package/dist/oauth/pkce.js +2 -1
  68. package/dist/oauth/pkce.js.map +1 -1
  69. package/dist/paths.d.ts +34 -1
  70. package/dist/paths.js +62 -12
  71. package/dist/paths.js.map +1 -1
  72. package/dist/physical_path.d.ts +46 -0
  73. package/dist/physical_path.js +151 -0
  74. package/dist/physical_path.js.map +1 -0
  75. package/dist/picker.d.ts +52 -3
  76. package/dist/picker.js +129 -5
  77. package/dist/picker.js.map +1 -1
  78. package/dist/picker_checklist.d.ts +9 -1
  79. package/dist/picker_checklist.js +41 -2
  80. package/dist/picker_checklist.js.map +1 -1
  81. package/dist/policy.d.ts +9 -1
  82. package/dist/policy.js +11 -2
  83. package/dist/policy.js.map +1 -1
  84. package/dist/post.d.ts +25 -0
  85. package/dist/post.js +49 -13
  86. package/dist/post.js.map +1 -1
  87. package/dist/project.d.ts +89 -0
  88. package/dist/project.js +123 -0
  89. package/dist/project.js.map +1 -1
  90. package/dist/redact.d.ts +77 -2
  91. package/dist/redact.js +713 -47
  92. package/dist/redact.js.map +1 -1
  93. package/dist/session_targets.d.ts +713 -0
  94. package/dist/session_targets.js +2602 -0
  95. package/dist/session_targets.js.map +1 -0
  96. package/dist/spool.d.ts +23 -5
  97. package/dist/spool.js +37 -6
  98. package/dist/spool.js.map +1 -1
  99. package/dist/spool_union.d.ts +51 -0
  100. package/dist/spool_union.js +57 -0
  101. package/dist/spool_union.js.map +1 -0
  102. package/dist/state.d.ts +5 -0
  103. package/dist/state.js +19 -1
  104. package/dist/state.js.map +1 -1
  105. package/dist/text_tail.d.ts +8 -0
  106. package/dist/text_tail.js +19 -0
  107. package/dist/text_tail.js.map +1 -0
  108. package/dist/version.d.ts +1 -1
  109. package/dist/version.js +1 -1
  110. package/dist/version.js.map +1 -1
  111. package/package.json +3 -3
@@ -32,8 +32,56 @@
32
32
  * - Read anywhere but the agent's own transcript root (`admitsTranscript`, the same confinement as a hook).
33
33
  */
34
34
  import { type IngestCredential } from "../credential.js";
35
+ import { type Isolation, type Target, type TargetRecord } from "../session_targets.js";
36
+ import type { ProjectKeys } from "../project.js";
35
37
  import { type Delivery } from "../post.js";
36
38
  import { type CommandContext } from "./context.js";
39
+ /** One thing to close: a repo (or the folder) the session's bytes belong to, with everything `closeSession` needs about it. */
40
+ export interface CloseSpec {
41
+ readonly projectKey: string;
42
+ readonly redactionRoots: readonly string[];
43
+ readonly repoSlug: string;
44
+ readonly worktrees: readonly string[];
45
+ readonly allowNeverCaptured: boolean;
46
+ /** The resolver's SCANNED offsets: set for a FOLDER target only, which never sends past them (A-T3 (b)). */
47
+ readonly sizeCap?: Readonly<Record<string, number>>;
48
+ readonly isolation?: Isolation;
49
+ readonly target: Target | null;
50
+ }
51
+ /**
52
+ * Take the session's one writer lock (O5) and resolve every target the session names, as a session that is OVER (`end` mode, the
53
+ * only mode that may decide a folder target). The lock is released by the caller's `releases`, after the sends. Shared by
54
+ * `finalize` and `backfill`: one resolver loop, so a session is judged the same whichever verb closes it.
55
+ * `busy`: another writer held the session for the whole wait.
56
+ */
57
+ export declare function resolveSessionTargets(env: {
58
+ readonly home: string;
59
+ readonly env: NodeJS.ProcessEnv;
60
+ readonly nowMs: number;
61
+ readonly turnEndCwd: string | null;
62
+ }, sessionId: string, transcriptPath: string, known: {
63
+ readonly keys: ProjectKeys;
64
+ readonly slugOf: () => string | null;
65
+ } | null, releases: Array<() => void>): Promise<{
66
+ readonly kind: "busy";
67
+ } | {
68
+ readonly kind: "ok";
69
+ readonly targets: readonly Target[];
70
+ readonly scan: Record<string, number>;
71
+ /** C27: the session's target record as the resolver just wrote it (the per-target multi flag, the call checkpoints). */
72
+ readonly record: TargetRecord;
73
+ /** C27: the dialect isolates records, so a REPO target also delivers only up to what the resolver scanned (a FOLDER target always did). */
74
+ readonly capRepos: boolean;
75
+ /** C25: re-stamp the lock; `false` = it is no longer ours and the caller stops before its next write. Pass it to `closeSession`. */
76
+ readonly heartbeat: () => boolean;
77
+ }>;
78
+ /** What `closeSession` is told for one resolved target: the repo (or folder) and everything `closeSession` needs about it. */
79
+ export declare function closeSpecOf(target: Target, scan: Record<string, number>, facts?: SpecFacts): CloseSpec;
80
+ /** What `resolveSessionTargets` knows beyond the scan offsets: the record (multi flag, call checkpoints) and whether a repo target is capped at the scan. */
81
+ export interface SpecFacts {
82
+ readonly record: TargetRecord;
83
+ readonly capRepos: boolean;
84
+ }
37
85
  export declare function finalize(ctx: CommandContext, argv: readonly string[]): Promise<number>;
38
86
  /**
39
87
  * PR 7 (Q2): the ingest address in the environment is one this client refuses to send to. Shared with `backfill`, which
@@ -74,8 +122,23 @@ export interface CloseSessionInput {
74
122
  * and sealing before the sub-agent streams arrive "would seal a poorer turn".
75
123
  */
76
124
  readonly completeSubagents: boolean;
125
+ /**
126
+ * Every work tree of the target's repo this session was seen in (its spool sources, O7). Defaults to the ledger work tree alone,
127
+ * which is the one-source behaviour every caller had before any-folder capture.
128
+ */
129
+ readonly worktrees?: readonly string[];
130
+ /** What the streams may contain beyond structured-path redaction (A-T4). Default: a repo target of `redactionRoots` (R17). */
131
+ readonly isolation?: Isolation;
132
+ /** A FOLDER target's per-stream ceiling (the resolver's scanned offsets); delegated streams never send past it. */
133
+ readonly sizeCap?: Readonly<Record<string, number>>;
77
134
  /** The wall-clock budget for the sends of this close, ms. Default `SEND_BUDGET_MS`. A test seam. */
78
135
  readonly sendBudgetMs?: number;
136
+ /**
137
+ * C25: the session writer lock's heartbeat (`resolveSessionTargets` returns it). Called before every round of delegated sends,
138
+ * before the main delivery and each drain request, and (through `deliver`) before every request. `false` means the lock is no
139
+ * longer ours: the close stops before its next write and answers `lock-lost`. Absent: no lock to keep (a test seam).
140
+ */
141
+ readonly heartbeat?: () => boolean;
79
142
  }
80
143
  /** How a close ended. The caller turns it into words; this function prints nothing. */
81
144
  export type CloseOutcome =
@@ -117,6 +180,10 @@ export type CloseOutcome =
117
180
  /** `allowNeverCaptured` was false and this repo has no state for the session. Nothing was sent. */
118
181
  | {
119
182
  readonly kind: "never-captured";
183
+ }
184
+ /** C25: the session's writer lock was taken from us (another writer is on the session). The close stopped before its next write. */
185
+ | {
186
+ readonly kind: "lock-lost";
120
187
  };
121
188
  /**
122
189
  * Close ONE session: sub-agent streams first, then the main stream, then (when `seal`) the assertion and the bounded drain.