@wrongstack/tools 0.302.2 → 0.305.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 (44) hide show
  1. package/dist/builtin.d.ts +6 -0
  2. package/dist/builtin.js +3213 -686
  3. package/dist/codebase-index/binary-frame.d.ts +43 -0
  4. package/dist/codebase-index/codebase-incoming-calls-tool.d.ts +1 -0
  5. package/dist/codebase-index/codebase-index-tool.d.ts +6 -0
  6. package/dist/codebase-index/codebase-outgoing-calls-tool.d.ts +1 -0
  7. package/dist/codebase-index/content-hash.d.ts +66 -0
  8. package/dist/codebase-index/index.js +1597 -153
  9. package/dist/codebase-index/indexer.d.ts +6 -0
  10. package/dist/codebase-index/parser-worker-pool.d.ts +63 -0
  11. package/dist/codebase-index/parser-worker-script.d.ts +42 -0
  12. package/dist/codebase-index/project-server-protocol.d.ts +2 -0
  13. package/dist/codebase-index/project-server.js +1483 -104
  14. package/dist/codebase-index/schema.d.ts +18 -0
  15. package/dist/codebase-index/tree-sitter/queries.d.ts +48 -0
  16. package/dist/codebase-index/tree-sitter/util.d.ts +31 -0
  17. package/dist/codebase-index/tree-sitter/visitor.d.ts +47 -0
  18. package/dist/codebase-index/tree-sitter-parser.d.ts +58 -0
  19. package/dist/codebase-index/vector-search.d.ts +62 -0
  20. package/dist/codebase-index/worker-protocol.d.ts +2 -0
  21. package/dist/codebase-index/worker.js +1452 -73
  22. package/dist/codebase-index/writer-bulk-insert.d.ts +5 -0
  23. package/dist/codebase-index/writer-graph-reader.d.ts +39 -0
  24. package/dist/codebase-index/writer-schema.d.ts +9 -2
  25. package/dist/codebase-index/writer.d.ts +36 -0
  26. package/dist/index.d.ts +4 -3
  27. package/dist/index.js +3258 -727
  28. package/dist/kanban-contract-actions.d.ts +7 -0
  29. package/dist/kanban-task-inputs.d.ts +16 -2
  30. package/dist/kanban-tool-schema.d.ts +2 -2
  31. package/dist/kanban-tool-types.d.ts +39 -2
  32. package/dist/kanban.js +580 -193
  33. package/dist/pack.js +3212 -686
  34. package/dist/plan.d.ts +4 -1
  35. package/dist/plan.js +2701 -18
  36. package/dist/read.js +1559 -103
  37. package/dist/session-kanban.d.ts +94 -1
  38. package/dist/session-kanban.js +308 -44
  39. package/dist/task.d.ts +5 -4
  40. package/dist/task.js +2825 -138
  41. package/dist/todo.d.ts +10 -1
  42. package/dist/todo.js +2474 -30
  43. package/dist/tool-tier.js +3212 -686
  44. package/package.json +8 -4
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Binary frame protocol for the codebase-index IPC server.
3
+ *
4
+ * Replaces newline-delimited JSON with a length-prefixed MessagePack binary
5
+ * format. The first byte of every frame is a magic value that distinguishes
6
+ * binary from JSON — so a mixed-protocol socket is never ambiguous:
7
+ *
8
+ * - `0x57` ('W') → binary frame: [magic] [uint32 BE length] [MessagePack]
9
+ * - anything else → the byte is part of a JSON text line terminated by `\n`
10
+ *
11
+ * Negotiation happens during the existing handshake:
12
+ * 1. The server's `hello` frame includes `binarySupported: true` (always JSON)
13
+ * 2. If the client supports binary, it sends `acceptsBinary: true` in its
14
+ * first authenticated request (still JSON, so the server can read it)
15
+ * 3. Both sides switch to binary framing for all subsequent frames on that
16
+ * socket
17
+ *
18
+ * Backward compatibility: if either side does not advertise binary support,
19
+ * the connection stays on newline-delimited JSON. The protocolVersion + buildId
20
+ * handshake already prevents a binary build from talking to a JSON-only build
21
+ * of a different version (the buildId changes when the compiled artifact
22
+ * changes), so there is no protocol ambiguity in practice.
23
+ */
24
+ /** Magic byte that prefixes every binary frame. 'W' for WrongStack. */
25
+ export declare const BINARY_FRAME_MAGIC = 87;
26
+ /** True if a byte stream begins with the binary-frame magic. */
27
+ export declare function isBinaryFrame(firstByte: number): boolean;
28
+ /**
29
+ * Encode a message as a binary frame: [magic] [uint32 BE length] [MessagePack].
30
+ * Returns a single Buffer ready to write to the socket.
31
+ */
32
+ export declare function encodeBinaryFrame(message: unknown): Buffer;
33
+ /**
34
+ * Decode a MessagePack payload (the bytes after the magic + length header).
35
+ * Throws if the payload is not valid MessagePack.
36
+ */
37
+ export declare function decodeBinaryFrame(payload: Uint8Array): unknown;
38
+ /**
39
+ * Encode a message as a JSON text frame, terminated by `\n`.
40
+ * This is the original wire format — kept for fallback and handshake.
41
+ */
42
+ export declare function encodeJsonFrame(message: unknown): string;
43
+ //# sourceMappingURL=binary-frame.d.ts.map
@@ -20,6 +20,7 @@ interface IncomingCallsInput {
20
20
  symbol: string;
21
21
  file?: string | undefined;
22
22
  limit?: number | undefined;
23
+ transitive?: boolean | undefined;
23
24
  }
24
25
  interface IncomingCallsOutput {
25
26
  symbol: string;
@@ -6,6 +6,12 @@ interface CodebaseIndexInput {
6
6
  }
7
7
  interface CodebaseIndexOutput {
8
8
  filesIndexed: number;
9
+ fileOutcomes?: {
10
+ parsed: number;
11
+ skipped: number;
12
+ empty: number;
13
+ failed: number;
14
+ } | undefined;
9
15
  symbolsIndexed: number;
10
16
  langStats: Record<string, number>;
11
17
  durationMs: number;
@@ -20,6 +20,7 @@ interface OutgoingCallsInput {
20
20
  symbol: string;
21
21
  file?: string | undefined;
22
22
  limit?: number | undefined;
23
+ transitive?: boolean | undefined;
23
24
  }
24
25
  interface OutgoingCallsOutput {
25
26
  symbol: string;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Content-Addressable Hashing for incremental reindex (Phase 2).
3
+ *
4
+ * A 64-bit xxHash over file contents lets the indexer skip re-parsing when
5
+ * `touch` or `git checkout` rewrites `mtime_ms` without changing actual bytes.
6
+ * The corresponding SQLite column `files.content_hash` is added by Phase 2 to
7
+ * the existing `files` table; see `writer-schema.ts`.
8
+ *
9
+ * Why xxHash64 and not SHA-256 / BLAKE3 / crypto:
10
+ *
11
+ * - Non-cryptographic — we're not authenticating anything, just fingerprinting.
12
+ * - 64-bit output — collision probability for a million files is ~1e-13,
13
+ * which is well below the indexer error budget. SHA-256 is overkill.
14
+ * - Constant-time on small inputs — the inner loop is a few ALU ops per
15
+ * byte, no allocations after the initial seed.
16
+ * - Zero dependency — keeps `packages/tools` slim. The alternative
17
+ * (`hash-wasm`, `blake3-wasm`) would add ~150 KB to the bundle for a
18
+ * function we call once per file.
19
+ * - Deterministic across runs and platforms — the canonical xxHash64
20
+ * reference implementation is byte-identical regardless of endianness.
21
+ *
22
+ * Algorithm: Yann Collet's xxHash64 (BSD-2-Clause), seed `0`. The constants
23
+ * and round/merge functions are reproduced from the xxhash spec at
24
+ * https://github.com/Cyan4973/xxHash/blob/dev/doc/xxhash_spec.md — any
25
+ * change here must be validated against the KAT vectors in
26
+ * `codebase-index-content-hash.test.ts`, or two different installs of
27
+ * WrongStack will report different hashes for the same file and trigger
28
+ * spurious re-indexing.
29
+ *
30
+ * Spec notations:
31
+ * - `<<<` = rotate-left (circular shift), NOT logical shift
32
+ * - `*` = modular multiplication mod 2^64 (full 64x64 -> 64)
33
+ * - All multi-byte reads are little-endian
34
+ */
35
+ /**
36
+ * Compute xxHash64 of `buf` with seed `0`. Returns a 16-character lowercase
37
+ * hex string.
38
+ *
39
+ * The string format is what gets stored in `files.content_hash`. Keeping it
40
+ * hex (vs. raw BigInt) means the SQLite column can be a plain TEXT and is
41
+ * debuggable from the `sqlite3` CLI without bespoke formatters.
42
+ */
43
+ export declare function xxhash64Hex(buf: Uint8Array, explicitLen?: number): string;
44
+ /**
45
+ * Convenience wrapper: hash a UTF-8 string. The indexer feeds file contents
46
+ * as `string` (Node.js convention) rather than `Buffer`, so this is the
47
+ * common entry point.
48
+ *
49
+ * Note: the buffer capacity does NOT participate in the hash — only the
50
+ * bytes up to `content.length` do. The caller is responsible for passing a
51
+ * `Uint8Array` whose `.length` is the byte count of the content.
52
+ */
53
+ export declare function xxhash64String(content: string): string;
54
+ /** Sentinel value stored in `files.content_hash` for a never-indexed file. */
55
+ export declare const CONTENT_HASH_EMPTY = "";
56
+ /**
57
+ * Parse a stored `content_hash` value (from SQLite) and return the
58
+ * equivalent BigInt, or `undefined` for empty / unknown values.
59
+ *
60
+ * Used by the indexer's incremental path: when both the stored and the fresh
61
+ * hash parse cleanly, they're compared as 64-bit integers in O(1) without
62
+ * string allocation. The hex-string storage format is the on-disk contract;
63
+ * this function is the in-memory helper.
64
+ */
65
+ export declare function parseContentHash(value: string | null | undefined): bigint | undefined;
66
+ //# sourceMappingURL=content-hash.d.ts.map