@vibe-commit/capture 0.10.0 → 0.11.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.
- package/README.md +24 -0
- package/dist/agent_hooks.js +2 -2
- package/dist/cli.d.ts +35 -0
- package/dist/cli.js +412 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/backfill.js +19 -2
- package/dist/commands/backfill.js.map +1 -1
- package/dist/commands/finalize.d.ts +37 -1
- package/dist/commands/finalize.js +129 -29
- package/dist/commands/finalize.js.map +1 -1
- package/dist/commands/status.js +7 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/status_machine.js +5 -0
- package/dist/commands/status_machine.js.map +1 -1
- package/dist/commands/upload_worker.d.ts +63 -0
- package/dist/commands/upload_worker.js +336 -0
- package/dist/commands/upload_worker.js.map +1 -0
- package/dist/copy/strings.d.ts +23 -7
- package/dist/copy/strings.js +40 -7
- package/dist/copy/strings.js.map +1 -1
- package/dist/drain.d.ts +68 -0
- package/dist/drain.js +234 -0
- package/dist/drain.js.map +1 -0
- package/dist/firing.d.ts +169 -0
- package/dist/firing.js +334 -0
- package/dist/firing.js.map +1 -0
- package/dist/hooks/entry.d.ts +171 -26
- package/dist/hooks/entry.js +333 -507
- package/dist/hooks/entry.js.map +1 -1
- package/dist/hooks/fire_lock.d.ts +36 -87
- package/dist/hooks/fire_lock.js +40 -99
- package/dist/hooks/fire_lock.js.map +1 -1
- package/dist/hooks/post_commit.d.ts +2 -0
- package/dist/hooks/post_commit.js +7 -3
- package/dist/hooks/post_commit.js.map +1 -1
- package/dist/identity.d.ts +32 -0
- package/dist/identity.js +38 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -17
- package/dist/index.js +59 -450
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +18 -0
- package/dist/paths.js +31 -0
- package/dist/paths.js.map +1 -1
- package/dist/pending_prune.d.ts +2 -2
- package/dist/pending_prune.js +2 -2
- package/dist/policy.d.ts +17 -0
- package/dist/policy.js +7 -0
- package/dist/policy.js.map +1 -1
- package/dist/post.d.ts +52 -4
- package/dist/post.js +59 -21
- package/dist/post.js.map +1 -1
- package/dist/replay.d.ts +167 -0
- package/dist/replay.js +301 -0
- package/dist/replay.js.map +1 -0
- package/dist/session_targets.d.ts +12 -0
- package/dist/session_targets.js +6 -1
- package/dist/session_targets.js.map +1 -1
- package/dist/spool.d.ts +44 -16
- package/dist/spool.js +174 -33
- package/dist/spool.js.map +1 -1
- package/dist/spool_union.d.ts +18 -2
- package/dist/spool_union.js +23 -2
- package/dist/spool_union.js.map +1 -1
- package/dist/state.js +21 -14
- package/dist/state.js.map +1 -1
- package/dist/stdin.d.ts +2 -0
- package/dist/stdin.js +13 -0
- package/dist/stdin.js.map +1 -0
- package/dist/uploader_status.d.ts +34 -0
- package/dist/uploader_status.js +25 -0
- package/dist/uploader_status.js.map +1 -0
- package/dist/uploader_view.d.ts +39 -0
- package/dist/uploader_view.js +106 -0
- package/dist/uploader_view.js.map +1 -0
- package/dist/verbs.d.ts +11 -0
- package/dist/verbs.js +13 -0
- package/dist/verbs.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE IDENTITY DIGEST — U5a of the detached uploader (plan §3.13).
|
|
3
|
+
*
|
|
4
|
+
* One machine-wide worker serves every session's firing log, and a session can be started under a different credential than the one the
|
|
5
|
+
* worker would find on its own: `VIBECOMMIT_TOKEN=<org B>` in one shell, the saved `org A` credential everywhere else. Without a check, the
|
|
6
|
+
* worker would upload B's session under A's credential. So each firing carries a digest of "who this upload is for", the worker computes
|
|
7
|
+
* its own, and **a worker serves only firings of its own identity**, in the idle drain as well.
|
|
8
|
+
*
|
|
9
|
+
* The digest is a sha256 of, in order:
|
|
10
|
+
* - the ingest URL (a different server is a different account),
|
|
11
|
+
* - the credential SOURCE: the constant `file` for the saved credential, and for `VIBECOMMIT_TOKEN` a hash of the token itself,
|
|
12
|
+
* - `CLAUDE_CONFIG_DIR` and `CODEX_HOME` (a different agent profile is a different set of transcripts).
|
|
13
|
+
*
|
|
14
|
+
* ⛔ The saved credential is a CONSTANT on purpose. A fingerprint there would strand every queued firing the moment `vibecommit auth`
|
|
15
|
+
* rotates it: the worker re-reads the file every round, so rotation takes effect at once and the identity must not change with it.
|
|
16
|
+
*
|
|
17
|
+
* ⛔ A LEAF: it imports `node:crypto` and nothing of this package, so the hook can compute it without loading the worker. It reads a token
|
|
18
|
+
* only to hash it and never returns, stores or logs it; the digest is not reversible and carries no secret.
|
|
19
|
+
*/
|
|
20
|
+
/** The part of the environment the digest is a function of. Anything else cannot change who an upload is for. */
|
|
21
|
+
export interface IdentityInput {
|
|
22
|
+
/** The validated ingest URL (`ingestUrl(env)`), never the raw override. */
|
|
23
|
+
readonly url: string;
|
|
24
|
+
readonly env: NodeJS.ProcessEnv;
|
|
25
|
+
}
|
|
26
|
+
/** `file`, or `env:<sha256 of the token>`. A blank `VIBECOMMIT_TOKEN` is not set (`loadCredential` agrees). */
|
|
27
|
+
export declare function credentialSourceOf(env: NodeJS.ProcessEnv): string;
|
|
28
|
+
/**
|
|
29
|
+
* The digest. Each field is length-prefixed, so ("ab","c") and ("a","bc") cannot collide, and an absent variable differs from an empty one
|
|
30
|
+
* only if nobody can tell them apart (they behave identically), which is why both read as "".
|
|
31
|
+
*/
|
|
32
|
+
export declare function identityDigest(input: IdentityInput): string;
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE IDENTITY DIGEST — U5a of the detached uploader (plan §3.13).
|
|
3
|
+
*
|
|
4
|
+
* One machine-wide worker serves every session's firing log, and a session can be started under a different credential than the one the
|
|
5
|
+
* worker would find on its own: `VIBECOMMIT_TOKEN=<org B>` in one shell, the saved `org A` credential everywhere else. Without a check, the
|
|
6
|
+
* worker would upload B's session under A's credential. So each firing carries a digest of "who this upload is for", the worker computes
|
|
7
|
+
* its own, and **a worker serves only firings of its own identity**, in the idle drain as well.
|
|
8
|
+
*
|
|
9
|
+
* The digest is a sha256 of, in order:
|
|
10
|
+
* - the ingest URL (a different server is a different account),
|
|
11
|
+
* - the credential SOURCE: the constant `file` for the saved credential, and for `VIBECOMMIT_TOKEN` a hash of the token itself,
|
|
12
|
+
* - `CLAUDE_CONFIG_DIR` and `CODEX_HOME` (a different agent profile is a different set of transcripts).
|
|
13
|
+
*
|
|
14
|
+
* ⛔ The saved credential is a CONSTANT on purpose. A fingerprint there would strand every queued firing the moment `vibecommit auth`
|
|
15
|
+
* rotates it: the worker re-reads the file every round, so rotation takes effect at once and the identity must not change with it.
|
|
16
|
+
*
|
|
17
|
+
* ⛔ A LEAF: it imports `node:crypto` and nothing of this package, so the hook can compute it without loading the worker. It reads a token
|
|
18
|
+
* only to hash it and never returns, stores or logs it; the digest is not reversible and carries no secret.
|
|
19
|
+
*/
|
|
20
|
+
import { createHash } from "node:crypto";
|
|
21
|
+
/** `file`, or `env:<sha256 of the token>`. A blank `VIBECOMMIT_TOKEN` is not set (`loadCredential` agrees). */
|
|
22
|
+
export function credentialSourceOf(env) {
|
|
23
|
+
const token = env.VIBECOMMIT_TOKEN?.trim() ?? "";
|
|
24
|
+
return token === "" ? "file" : `env:${createHash("sha256").update(token).digest("hex")}`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The digest. Each field is length-prefixed, so ("ab","c") and ("a","bc") cannot collide, and an absent variable differs from an empty one
|
|
28
|
+
* only if nobody can tell them apart (they behave identically), which is why both read as "".
|
|
29
|
+
*/
|
|
30
|
+
export function identityDigest(input) {
|
|
31
|
+
const hash = createHash("sha256");
|
|
32
|
+
for (const part of [input.url, credentialSourceOf(input.env), input.env.CLAUDE_CONFIG_DIR ?? "", input.env.CODEX_HOME ?? ""]) {
|
|
33
|
+
hash.update(`${Buffer.byteLength(part)}:`);
|
|
34
|
+
hash.update(part);
|
|
35
|
+
}
|
|
36
|
+
return hash.digest("hex");
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AASzC,+GAA+G;AAC/G,MAAM,UAAU,kBAAkB,CAAC,GAAsB;IACvD,MAAM,KAAK,GAAG,GAAG,CAAC,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACjD,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC3F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAoB;IACjD,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,CAAC;QAC7H,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { type InvocationMode } from "./exit.js";
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
import { isVerb, type Verb } from "./verbs.js";
|
|
4
|
+
export { isVerb };
|
|
5
|
+
export type { Verb };
|
|
6
6
|
/**
|
|
7
7
|
* Hook invocations are distinguished by ARGV FIRST, then by env.
|
|
8
8
|
*
|
|
@@ -18,17 +18,3 @@ export declare function isVerb(value: string): value is Verb;
|
|
|
18
18
|
* established it and a wrapper may already set it.
|
|
19
19
|
*/
|
|
20
20
|
export declare function invocationMode(env: NodeJS.ProcessEnv, argv: readonly string[]): InvocationMode;
|
|
21
|
-
/**
|
|
22
|
-
* `--help`, wrapped hard at 80 columns per DESIGN.md §13.4.
|
|
23
|
-
*
|
|
24
|
-
* Never reflows to `process.stdout.columns`: identical commands must emit
|
|
25
|
-
* identical bytes, or issue-paste, screenshots and every golden-file test of the
|
|
26
|
-
* copy break. `test/help-golden.test.ts` is that golden file.
|
|
27
|
-
*
|
|
28
|
-
* No SGR here at all. Colour would have to be resolved before help could be
|
|
29
|
-
* rendered, and help is the one surface where structure alone is enough —
|
|
30
|
-
* indentation and the label gutter carry it, which is §13.1's point about
|
|
31
|
-
* `NO_COLOR` being a lossless degradation rather than a downgrade.
|
|
32
|
-
*/
|
|
33
|
-
export declare function renderHelp(): string;
|
|
34
|
-
export {};
|