@hasna/todos 0.13.7 → 0.13.8

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.
@@ -0,0 +1,72 @@
1
+ /** The subset of an agent row this validator needs. */
2
+ export interface KnownAgent {
3
+ id: string;
4
+ name: string;
5
+ }
6
+ export interface AssigneeContext {
7
+ /** Every agent row known to the store. */
8
+ agents: KnownAgent[];
9
+ /** Roster seat slugs, normalised. See {@link loadSeatSlugs}. */
10
+ seats: Set<string>;
11
+ /** Caller passed `--assign-seat`: filing at a seat is deliberate. */
12
+ allowSeat?: boolean;
13
+ }
14
+ /**
15
+ * Three outcomes, and the split between REFUSE and WARN is evidence-driven
16
+ * rather than a matter of taste:
17
+ *
18
+ * - `seat` REFUSES. The seat list is a closed, declared set and an owner
19
+ * directive says the row is ownerless. There is no honest reading of
20
+ * `--assign agent-ceo` that means "a session will pick this up".
21
+ * - `ambiguous` REFUSES. The name certainly exists; what cannot be done is
22
+ * PICK, and picking the first row is precisely how a task lands on a
23
+ * stranger. A fresh store cannot trip this, because a name has to occupy two
24
+ * rows to be ambiguous.
25
+ * - `unknown` only WARNS. Assigning to an agent that has not registered yet is
26
+ * a REAL, EXISTING, TESTED contract in this CLI — `todos add --assign
27
+ * brutus` against a store where brutus has never registered must succeed
28
+ * (src/cli/creator-attribution.test.ts). Refusing it broke 9 existing tests
29
+ * when this validator was first written to refuse, which is exactly the
30
+ * legitimate flow that measurement was supposed to find. The check cannot
31
+ * tell a typo from a not-yet-registered agent, so it says so and gets out of
32
+ * the way.
33
+ */
34
+ export type AssigneeVerdict = {
35
+ ok: true;
36
+ assignee: string;
37
+ agentId?: string;
38
+ isSeat: boolean;
39
+ warning?: string;
40
+ } | {
41
+ ok: false;
42
+ reason: "seat" | "ambiguous";
43
+ message: string;
44
+ candidates?: KnownAgent[];
45
+ };
46
+ /**
47
+ * The canonical declarative seat roster, in the `AgentRoster` format shipped
48
+ * by `@hasna/identities`. `identities` has no built-in path for it — every
49
+ * consumer passes `--roster <file>` — so the path is config here, not a
50
+ * constant baked into a code path.
51
+ */
52
+ export declare function defaultSeatRosterPath(): string;
53
+ /**
54
+ * Read seat slugs out of the roster file.
55
+ *
56
+ * Returns an EMPTY SET on a missing or malformed roster, and never throws. The
57
+ * roster is a station-local file that does not exist inside an e2b sandbox or
58
+ * a cloud runner, and a validator that refused every assignment when it could
59
+ * not find its config would be a worse defect than the one it fixes. The cost
60
+ * of degrading is bounded and stated: without the roster the seat check is
61
+ * skipped, while the unknown-agent and ambiguous-name checks still apply.
62
+ */
63
+ export declare function loadSeatSlugs(path?: string): Set<string>;
64
+ /**
65
+ * Resolve and validate an `--assign` value.
66
+ *
67
+ * Accepts either an agent name (case-insensitive) or an agent ID. An ID is
68
+ * resolved to its name first, so that passing a seat's ID is caught by the
69
+ * seat rule exactly as passing its slug is.
70
+ */
71
+ export declare function validateAssignee(input: string, ctx: AssigneeContext): AssigneeVerdict;
72
+ //# sourceMappingURL=assignee-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignee-validation.d.ts","sourceRoot":"","sources":["../../src/lib/assignee-validation.ts"],"names":[],"mappings":"AA2CA,uDAAuD;AACvD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,gEAAgE;IAChE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACnF;IACE,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;CAC3B,CAAC;AAEN;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAK9C;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,IAAI,GAAE,MAAgC,GAAG,GAAG,CAAC,MAAM,CAAC,CAajF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,GAAG,eAAe,CAoErF"}
@@ -1 +1 @@
1
- {"version":3,"file":"claude-tasks.d.ts","sourceRoot":"","sources":["../../src/lib/claude-tasks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAwF9D;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAO,GACpC,UAAU,CA4GZ;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAO,GACpC,UAAU,CAwFZ;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAO,GACpC,UAAU,CAQZ"}
1
+ {"version":3,"file":"claude-tasks.d.ts","sourceRoot":"","sources":["../../src/lib/claude-tasks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA0F9D;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAO,GACpC,UAAU,CAgHZ;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAO,GACpC,UAAU,CAwFZ;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAO,GACpC,UAAU,CAQZ"}
@@ -1,4 +1,5 @@
1
1
  import type { SyncConflict } from "./sync-types.js";
2
+ export declare const TODO_SYNC_FINGERPRINT_KEY = "todos_sync_fingerprint";
2
3
  export declare const HOME: string;
3
4
  export declare function getHomeDir(): string;
4
5
  export declare function getTodosGlobalDir(): string;
@@ -11,4 +12,10 @@ export declare function writeHighWaterMark(dir: string, value: number): void;
11
12
  export declare function getFileMtimeMs(path: string): number | null;
12
13
  export declare function parseTimestamp(value: unknown): number | null;
13
14
  export declare function appendSyncConflict(metadata: Record<string, unknown>, conflict: SyncConflict, limit?: number): Record<string, unknown>;
15
+ export declare function withSyncFingerprint<T extends {
16
+ metadata: Record<string, unknown>;
17
+ }>(record: T): T;
18
+ export declare function hasSyncFingerprintChanged(record: {
19
+ metadata?: Record<string, unknown>;
20
+ }): boolean | null;
14
21
  //# sourceMappingURL=sync-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sync-utils.d.ts","sourceRoot":"","sources":["../../src/lib/sync-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iB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