@hraness/wordcell 0.26.3 → 0.27.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 (77) hide show
  1. package/README.md +36 -21
  2. package/dist/capture.js +15 -7
  3. package/dist/cli-bin.js +2 -2
  4. package/dist/cli.js +21 -19
  5. package/dist/clip/acquire.js +4 -3
  6. package/dist/clip/bundle-reader.js +3 -2
  7. package/dist/clip/cli.js +8 -7
  8. package/dist/clip/defuddle-worker.js +4 -1
  9. package/dist/clip/doctor.js +5 -4
  10. package/dist/clip/jobs.js +2 -1
  11. package/dist/clip/persist.js +2 -1
  12. package/dist/clip/refresh.js +4 -3
  13. package/dist/evaluation-builder-bin.js +2 -2
  14. package/dist/evaluation-builder.js +3 -3
  15. package/dist/evaluation-kb.js +3 -3
  16. package/dist/{index-mp5y3ty3.js → index-30v9w4cy.js} +36 -20
  17. package/dist/{index-9paxge84.js → index-3hts6yy9.js} +1 -1
  18. package/dist/{index-h9vyd03z.js → index-58azscg5.js} +7 -6
  19. package/dist/{index-9zkba8hr.js → index-7bqwzjba.js} +7 -6
  20. package/dist/{index-j4zgmzjr.js → index-8djdwjjd.js} +1 -1
  21. package/dist/{index-5h5awwh4.js → index-b40e2dkx.js} +2 -2
  22. package/dist/index-e2wstc7t.js +323 -0
  23. package/dist/{index-hacpnaew.js → index-fd8j527z.js} +1 -1
  24. package/dist/{index-mxxxytys.js → index-g63d3937.js} +4 -0
  25. package/dist/{index-k86wepd8.js → index-h2w7syy2.js} +5 -1
  26. package/dist/{index-9fywek7g.js → index-ht14xne3.js} +1 -1
  27. package/dist/{index-82r6g4py.js → index-k9yzc4vn.js} +1 -1
  28. package/dist/{index-m9p2a4mj.js → index-my50xsa3.js} +221 -36
  29. package/dist/{index-ncwzmsge.js → index-nwdzhj1h.js} +2 -2
  30. package/dist/{index-9rf81m0p.js → index-pbz3qw1s.js} +35 -20
  31. package/dist/index-pn14a2m5.js +59 -0
  32. package/dist/{index-nd8v7r0z.js → index-sp43012q.js} +1 -1
  33. package/dist/{index-8pabwzqg.js → index-t4hjm1kk.js} +2 -1
  34. package/dist/{index-npg9z1a4.js → index-xn5q4kne.js} +5 -1
  35. package/dist/{index-j2jt49gr.js → index-yatn62qq.js} +1 -1
  36. package/dist/index.js +14 -4
  37. package/dist/pdf.js +438 -4
  38. package/dist/portfolio.js +3 -3
  39. package/dist/rerank-clef.js +16 -0
  40. package/dist/rerank-typesafe.js +3 -1
  41. package/dist/sdk.js +2 -2
  42. package/dist/{support-9qdr4hb8.js → support-s059eytv.js} +20 -18
  43. package/dist/url-intelligence.js +4 -3
  44. package/dist/workflows/decision-context.js +3 -3
  45. package/dist/workflows/index.js +3 -3
  46. package/package.json +23 -9
  47. package/skills/wordcell/SKILL.md +1 -1
  48. package/skills/wordcell/references/query.md +11 -6
  49. package/src/capture.ts +5 -0
  50. package/src/cli-help.ts +2 -1
  51. package/src/cli-program.ts +23 -8
  52. package/src/clip/bundle-reader.ts +3 -0
  53. package/src/clip/capture.ts +1 -0
  54. package/src/clip/extract.ts +2 -0
  55. package/src/clip/lib.ts +3 -0
  56. package/src/clip/metadata-search-tool/Cargo.lock +6 -6
  57. package/src/clip/metadata.ts +232 -0
  58. package/src/clip/persist.ts +3 -0
  59. package/src/index.ts +2 -1
  60. package/src/pdf/bundle-reader.ts +457 -0
  61. package/src/pdf/capture.ts +6 -2
  62. package/src/pdf/cli.ts +2 -1
  63. package/src/pdf/errors.ts +11 -0
  64. package/src/pdf/extract.ts +16 -13
  65. package/src/pdf/layout.ts +136 -3
  66. package/src/pdf/markdown.ts +7 -1
  67. package/src/pdf/model.ts +9 -0
  68. package/src/pdf/persist.ts +8 -2
  69. package/src/pdf/source.ts +5 -4
  70. package/src/pdf/tools.ts +8 -6
  71. package/src/pdf.ts +10 -0
  72. package/src/rerank-clef.ts +52 -0
  73. package/src/rerank-credentials.ts +11 -2
  74. package/src/rerank-typesafe.ts +44 -20
  75. package/src/rerank.ts +1 -1
  76. package/src/sdk.ts +4 -2
  77. /package/dist/{index-cd75vky9.js → index-jbtyp6q5.js} +0 -0
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ import {
3
+ CLEF_MODELS,
4
+ DEFAULT_CLEF_MODEL,
5
+ clefEndpoint,
6
+ createClefReranker
7
+ } from "./index-pn14a2m5.js";
8
+ import"./index-pbz3qw1s.js";
9
+ import"./index-j70m75wd.js";
10
+ import"./index-z1w83f81.js";
11
+ export {
12
+ createClefReranker,
13
+ clefEndpoint,
14
+ DEFAULT_CLEF_MODEL,
15
+ CLEF_MODELS
16
+ };
@@ -2,12 +2,14 @@
2
2
  import {
3
3
  DEFAULT_SYSTEMONE_ENDPOINT,
4
4
  DEFAULT_SYSTEMONE_MODEL,
5
+ createHostedReranker,
5
6
  createTypeSafeReranker
6
- } from "./index-9rf81m0p.js";
7
+ } from "./index-pbz3qw1s.js";
7
8
  import"./index-j70m75wd.js";
8
9
  import"./index-z1w83f81.js";
9
10
  export {
10
11
  createTypeSafeReranker,
12
+ createHostedReranker,
11
13
  DEFAULT_SYSTEMONE_MODEL,
12
14
  DEFAULT_SYSTEMONE_ENDPOINT
13
15
  };
package/dist/sdk.js CHANGED
@@ -11,10 +11,10 @@ import {
11
11
  packUntrustedSearchContext,
12
12
  searchEvidenceRank,
13
13
  validateKnowledgeBaseSearchHistory
14
- } from "./index-9zkba8hr.js";
14
+ } from "./index-7bqwzjba.js";
15
+ import"./index-4j3tt0c3.js";
15
16
  import"./index-adx6khj5.js";
16
17
  import"./index-fp732bgg.js";
17
- import"./index-4j3tt0c3.js";
18
18
  import"./index-wqx1x32f.js";
19
19
  import"./index-3gc2yk4k.js";
20
20
  import"./index-pgtm2nhf.js";
@@ -2,24 +2,25 @@
2
2
  import {
3
3
  parseArguments as parseArguments2,
4
4
  parseUrlMetadataArguments
5
- } from "./index-mp5y3ty3.js";
6
- import"./index-5h5awwh4.js";
5
+ } from "./index-30v9w4cy.js";
6
+ import"./index-b40e2dkx.js";
7
7
  import {
8
8
  parsePdfArguments
9
- } from "./index-m9p2a4mj.js";
10
- import"./index-9paxge84.js";
11
- import"./index-j4zgmzjr.js";
12
- import"./index-npg9z1a4.js";
13
- import"./index-h9vyd03z.js";
14
- import"./index-hacpnaew.js";
15
- import"./index-k86wepd8.js";
16
- import"./index-nd8v7r0z.js";
9
+ } from "./index-my50xsa3.js";
10
+ import"./index-3hts6yy9.js";
11
+ import"./index-8djdwjjd.js";
12
+ import"./index-xn5q4kne.js";
13
+ import"./index-58azscg5.js";
14
+ import"./index-fd8j527z.js";
15
+ import"./index-h2w7syy2.js";
16
+ import"./index-sp43012q.js";
17
17
  import"./index-hnvx7m1j.js";
18
- import"./index-8pabwzqg.js";
19
- import"./index-ncwzmsge.js";
20
- import"./index-cd75vky9.js";
18
+ import"./index-t4hjm1kk.js";
19
+ import"./index-nwdzhj1h.js";
20
+ import"./index-jbtyp6q5.js";
21
21
  import"./index-2gv8y733.js";
22
- import"./index-mxxxytys.js";
22
+ import"./index-g63d3937.js";
23
+ import"./index-e2wstc7t.js";
23
24
  import"./index-w2zc0vwa.js";
24
25
  import"./index-e5fbsywq.js";
25
26
  import"./index-gh719d91.js";
@@ -27,13 +28,14 @@ import {
27
28
  parseArguments
28
29
  } from "./index-byz4kzww.js";
29
30
  import"./index-23z4zxgg.js";
30
- import"./index-9rf81m0p.js";
31
+ import"./index-pn14a2m5.js";
32
+ import"./index-pbz3qw1s.js";
31
33
  import"./index-pj501bh1.js";
32
- import"./index-j2jt49gr.js";
33
- import"./index-9zkba8hr.js";
34
+ import"./index-yatn62qq.js";
35
+ import"./index-7bqwzjba.js";
36
+ import"./index-4j3tt0c3.js";
34
37
  import"./index-adx6khj5.js";
35
38
  import"./index-fp732bgg.js";
36
- import"./index-4j3tt0c3.js";
37
39
  import"./index-wqx1x32f.js";
38
40
  import"./index-3gc2yk4k.js";
39
41
  import"./index-pgtm2nhf.js";
@@ -10,7 +10,7 @@ import {
10
10
  readUrlMetadataDocument,
11
11
  renderUrlMetadataDocument,
12
12
  writeUrlMetadataDocument
13
- } from "./index-5h5awwh4.js";
13
+ } from "./index-b40e2dkx.js";
14
14
  import {
15
15
  ARCHIVE_TODAY_HOSTS,
16
16
  ArchiveTodayFailure,
@@ -23,8 +23,9 @@ import {
23
23
  parseMetadataSearchResponse,
24
24
  rankMetadataSearchResults,
25
25
  selectNewestArchiveTodayMemento
26
- } from "./index-hacpnaew.js";
27
- import"./index-mxxxytys.js";
26
+ } from "./index-fd8j527z.js";
27
+ import"./index-g63d3937.js";
28
+ import"./index-e2wstc7t.js";
28
29
  import"./index-e5fbsywq.js";
29
30
  import"./index-gh719d91.js";
30
31
  import"./index-1xxnjn0d.js";
@@ -1,12 +1,12 @@
1
1
  // @bun
2
2
  import {
3
3
  decisionContextWorkflow
4
- } from "../index-9fywek7g.js";
4
+ } from "../index-ht14xne3.js";
5
5
  import"../index-h170byqw.js";
6
- import"../index-9zkba8hr.js";
6
+ import"../index-7bqwzjba.js";
7
+ import"../index-4j3tt0c3.js";
7
8
  import"../index-adx6khj5.js";
8
9
  import"../index-fp732bgg.js";
9
- import"../index-4j3tt0c3.js";
10
10
  import"../index-wqx1x32f.js";
11
11
  import"../index-3gc2yk4k.js";
12
12
  import"../index-pgtm2nhf.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  decisionContextWorkflow
4
- } from "../index-9fywek7g.js";
4
+ } from "../index-ht14xne3.js";
5
5
  import {
6
6
  explainChangeWorkflow
7
7
  } from "../index-e4fagfjz.js";
@@ -9,10 +9,10 @@ import {
9
9
  planRadarWorkflow
10
10
  } from "../index-rdd5f7jj.js";
11
11
  import"../index-h170byqw.js";
12
- import"../index-9zkba8hr.js";
12
+ import"../index-7bqwzjba.js";
13
+ import"../index-4j3tt0c3.js";
13
14
  import"../index-adx6khj5.js";
14
15
  import"../index-fp732bgg.js";
15
- import"../index-4j3tt0c3.js";
16
16
  import"../index-wqx1x32f.js";
17
17
  import"../index-3gc2yk4k.js";
18
18
  import"../index-pgtm2nhf.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hraness/wordcell",
3
- "version": "0.26.3",
3
+ "version": "0.27.0",
4
4
  "description": "Wordcell keeps decisions, plans, and sources as Markdown beside your code, so coding agents can find them from the file they are about to change.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -55,6 +55,7 @@
55
55
  "./src/query.ts",
56
56
  "./src/rerank.ts",
57
57
  "./src/rerank-typesafe.ts",
58
+ "./src/rerank-clef.ts",
58
59
  "./src/repository-memory.ts",
59
60
  "./src/sdk.ts",
60
61
  "./src/search.ts",
@@ -249,6 +250,10 @@
249
250
  "types": "./src/rerank-typesafe.ts",
250
251
  "import": "./dist/rerank-typesafe.js"
251
252
  },
253
+ "./rerank-clef": {
254
+ "types": "./src/rerank-clef.ts",
255
+ "import": "./dist/rerank-clef.js"
256
+ },
252
257
  "./repository-memory": {
253
258
  "types": "./src/repository-memory.ts",
254
259
  "import": "./dist/repository-memory.js"
@@ -432,6 +437,7 @@
432
437
  "src/query.ts",
433
438
  "src/rerank.ts",
434
439
  "src/rerank-typesafe.ts",
440
+ "src/rerank-clef.ts",
435
441
  "src/rerank-credentials.ts",
436
442
  "src/repository-memory.ts",
437
443
  "src/search.ts",
@@ -478,14 +484,17 @@
478
484
  "src/cli-update.ts",
479
485
  "src/cli-release.ts",
480
486
  "src/evaluation-builder-bin.ts",
481
- "src/evaluation-builder-cli-args.ts"
487
+ "src/evaluation-builder-cli-args.ts",
488
+ "src/clip/metadata.ts",
489
+ "src/pdf/bundle-reader.ts",
490
+ "src/pdf/errors.ts"
482
491
  ],
483
492
  "scripts": {
484
493
  "kb:refresh": "bunx --bun --package https://github.com/hraness/wordcell/releases/download/v0.24.1/hraness-wordcell-0.24.1.tgz wordcell refresh --root kb",
485
494
  "kb:check:lane": "bunx --bun --package https://github.com/hraness/wordcell/releases/download/v0.24.1/hraness-wordcell-0.24.1.tgz wordcell check --root kb --no-catalog",
486
495
  "kb:check": "bunx --bun --package https://github.com/hraness/wordcell/releases/download/v0.24.1/hraness-wordcell-0.24.1.tgz wordcell check --root kb && bunx --bun --package https://github.com/hraness/wordcell/releases/download/v0.24.1/hraness-wordcell-0.24.1.tgz wordcell agents check --root kb --repo .",
487
496
  "kb:catalog": "bunx --bun --package https://github.com/hraness/wordcell/releases/download/v0.24.1/hraness-wordcell-0.24.1.tgz wordcell catalog --root kb",
488
- "build": "bun -e 'await (await import(\"node:fs/promises\")).rm(\"./dist\", { recursive: true, force: true })' && bun build ./src/index.ts ./src/publish.ts ./src/publish-model.ts ./src/publish-search.ts ./src/agent-context.ts ./src/agent-guide-audit.ts ./src/attachments.ts ./src/authoring.ts ./src/benchmark.ts ./src/clip/browser-profiles.ts ./src/capture.ts ./src/cli.ts ./src/cli-bin.ts ./src/evaluation-builder-bin.ts ./src/clip/acquire.ts ./src/clip/args.ts ./src/clip/bounded-byte-buffer.ts ./src/clip/bundle-reader.ts ./src/clip/cli.ts ./src/clip/cookies.ts ./src/clip/doctor.ts ./src/clip/jobs.ts ./src/clip/network.ts ./src/clip/network-proxy.ts ./src/clip/persist.ts ./src/clip/refresh.ts ./src/clip/terminal.ts ./src/evaluation.ts ./src/evaluation-builder.ts ./src/evaluation-kb.ts ./src/git.ts ./src/graph.ts ./src/graph-percolation.ts ./src/graph-authority.ts ./src/navigation.ts ./src/pdf.ts ./src/percolate.ts ./src/portfolio.ts ./src/query.ts ./src/rerank.ts ./src/rerank-typesafe.ts ./src/repository-memory.ts ./src/sdk.ts ./src/search.ts ./src/search-rules.ts ./src/semantic.ts ./src/source-inbox.ts ./src/untrusted-content.ts ./src/url-intelligence.ts ./src/workflow.ts ./src/workflows/index.ts ./src/workflows/decision-context.ts ./src/workflows/explain-change.ts ./src/workflows/plan-radar.ts ./src/clip/defuddle-worker.ts --outdir ./dist --root ./src --target bun --format esm --splitting --packages external && bun build ./src/publish-reader/reader.ts --outfile ./dist/publish-reader/reader.js --target browser --format esm && bun build ./src/publish-reader/theme.ts --outfile ./dist/publish-reader/theme.js --target browser --format iife && cp ./src/publish-reader/reader.css ./dist/publish-reader/reader.css",
497
+ "build": "bun -e 'await (await import(\"node:fs/promises\")).rm(\"./dist\", { recursive: true, force: true })' && bun build ./src/index.ts ./src/publish.ts ./src/publish-model.ts ./src/publish-search.ts ./src/agent-context.ts ./src/agent-guide-audit.ts ./src/attachments.ts ./src/authoring.ts ./src/benchmark.ts ./src/clip/browser-profiles.ts ./src/capture.ts ./src/cli.ts ./src/cli-bin.ts ./src/evaluation-builder-bin.ts ./src/clip/acquire.ts ./src/clip/args.ts ./src/clip/bounded-byte-buffer.ts ./src/clip/bundle-reader.ts ./src/clip/cli.ts ./src/clip/cookies.ts ./src/clip/doctor.ts ./src/clip/jobs.ts ./src/clip/network.ts ./src/clip/network-proxy.ts ./src/clip/persist.ts ./src/clip/refresh.ts ./src/clip/terminal.ts ./src/evaluation.ts ./src/evaluation-builder.ts ./src/evaluation-kb.ts ./src/git.ts ./src/graph.ts ./src/graph-percolation.ts ./src/graph-authority.ts ./src/navigation.ts ./src/pdf.ts ./src/percolate.ts ./src/portfolio.ts ./src/query.ts ./src/rerank.ts ./src/rerank-typesafe.ts ./src/rerank-clef.ts ./src/repository-memory.ts ./src/sdk.ts ./src/search.ts ./src/search-rules.ts ./src/semantic.ts ./src/source-inbox.ts ./src/untrusted-content.ts ./src/url-intelligence.ts ./src/workflow.ts ./src/workflows/index.ts ./src/workflows/decision-context.ts ./src/workflows/explain-change.ts ./src/workflows/plan-radar.ts ./src/clip/defuddle-worker.ts --outdir ./dist --root ./src --target bun --format esm --splitting --packages external && bun build ./src/publish-reader/reader.ts --outfile ./dist/publish-reader/reader.js --target browser --format esm && bun build ./src/publish-reader/theme.ts --outfile ./dist/publish-reader/theme.js --target browser --format iife && cp ./src/publish-reader/reader.css ./dist/publish-reader/reader.css",
489
498
  "check:workflows": "bun ./scripts/check-workflow-yaml.ts",
490
499
  "check:installed-command-docs": "bun ./scripts/check-installed-command-docs.ts",
491
500
  "check:portfolio-inventory": "bun ./scripts/check-portfolio-inventory.ts",
@@ -499,21 +508,23 @@
499
508
  "check": "bun run check:worker && bun run check:effect && bun run check:workflows && bun run check:portfolio-inventory && bun run check:installed-command-docs && bun run typecheck && bun run build && bun run test:package && bun run test && bun run url-metadata:tool:check",
500
509
  "prepack": "bun run check",
501
510
  "check:effect": "bun run scripts/check-effect-policy.ts",
502
- "kb:search": "bunx --bun --package https://github.com/hraness/wordcell/releases/download/v0.24.1/hraness-wordcell-0.24.1.tgz wordcell search --root kb --mode exact --selected-passage --rerank typesafe --rerank-limit 25",
511
+ "kb:search": "bunx --bun --package https://github.com/hraness/wordcell/releases/download/v0.24.1/hraness-wordcell-0.24.1.tgz wordcell search --root kb --mode exact --selected-passage",
512
+ "kb:search:clef": "bun ./dist/cli.js search --root kb --mode exact --selected-passage --rerank clef --rerank-limit 25",
503
513
  "kb:search:local": "bunx --bun --package https://github.com/hraness/wordcell/releases/download/v0.24.1/hraness-wordcell-0.24.1.tgz wordcell search --root kb --mode exact --selected-passage",
504
514
  "check:worker": "tsc -p worker/tsconfig.json --noEmit"
505
515
  },
506
516
  "dependencies": {
517
+ "@hraness/cli-update": "https://github.com/hraness/cli-update/releases/download/v0.1.0/hraness-cli-update-0.1.0.tgz",
507
518
  "@hraness/oh": "https://github.com/hraness/oh/releases/download/v0.12.0/hraness-oh-0.12.0.tgz",
519
+ "@hraness/support-foundation": "git+https://github.com/hraness/support-foundation.git#b32c1c81bb2444f50509ed54388758ecfab1f1c0",
508
520
  "@steipete/sweet-cookie": "0.4.3",
509
- "@tobilu/qmd": "git+https://github.com/hraness/qmd.git#aa993dceb3ef8cfb71d470554ca437570f5a2b3c",
521
+ "@tobilu/qmd": "https://github.com/hraness/qmd/releases/download/v2.8.3-hraness.1/hraness-qmd-2.8.3-hraness.1.tgz",
510
522
  "agent-browser": "0.32.3",
511
523
  "defuddle": "0.19.1",
512
- "yaml": "^2.9.0",
513
- "zod": "^4.4.3",
514
524
  "effect": "3.22.1",
515
- "@hraness/support-foundation": "git+https://github.com/hraness/support-foundation.git#b32c1c81bb2444f50509ed54388758ecfab1f1c0",
516
- "@hraness/cli-update": "https://github.com/hraness/cli-update/releases/download/v0.1.0/hraness-cli-update-0.1.0.tgz"
525
+ "entities": "7.0.1",
526
+ "yaml": "^2.9.0",
527
+ "zod": "^4.4.3"
517
528
  },
518
529
  "devDependencies": {
519
530
  "@hraness/build-governance": "github:hraness/build-governance#v0.1.0",
@@ -524,5 +535,8 @@
524
535
  "publishConfig": {
525
536
  "access": "public",
526
537
  "registry": "https://registry.npmjs.org"
538
+ },
539
+ "overrides": {
540
+ "simple-git": "^4.0.2"
527
541
  }
528
542
  }
@@ -58,7 +58,7 @@ missing:
58
58
  ```sh
59
59
  command -v wordcell >/dev/null 2>&1 || {
60
60
  command -v bun >/dev/null 2>&1 || exit 1
61
- bun add --global --ignore-scripts https://github.com/hraness/wordcell/releases/download/v0.26.3/hraness-wordcell-0.26.3.tgz
61
+ bun add --global --ignore-scripts https://github.com/hraness/wordcell/releases/download/v0.27.0/hraness-wordcell-0.27.0.tgz
62
62
  }
63
63
  wordcell --help
64
64
  ```
@@ -189,17 +189,22 @@ form. Graph neighbors and Git history remain separate from primary
189
189
  text rank. They explain and expand candidates without becoming authored facts,
190
190
  links, or recency boosts.
191
191
 
192
- Reranking is opt-in through `--rerank typesafe`. It uses `jev-1.13.0` and sends
193
- the query plus each candidate's identifier, title, vault-relative path, and at
194
- most 512 UTF-8 bytes of snippet text to TypeSafe. Enable it only for vaults
192
+ Clef support is in the current source tree. The skill's pinned release does not
193
+ include it; do not pass Clef flags to that installed CLI. In an explicitly
194
+ selected source checkout, use `bun ./src/cli.ts` instead of `wordcell` for Clef
195
+ commands. Source selection does not authorize hosted processing.
196
+
197
+ Reranking is opt-in through `--rerank clef`. It uses Cloudflare's `clef` model
198
+ (or `--rerank-model clef-flash`) and sends the query plus each candidate's
199
+ identifier, title, vault-relative path, and at most 512 UTF-8 bytes of snippet
200
+ text to Cloudflare. Enable it only for vaults
195
201
  approved for external processing and provider input-token charges. Use
196
202
  `--rerank-limit 25` to bound the window (2–25 candidates); four requests run
197
203
  concurrently under one eight-second deadline with no retries. Exact identities
198
204
  remain first. Results retain their original scores and retrieval evidence.
199
205
 
200
- The CLI reads `TYPESAFE_API_KEY`, an explicit `TYPESAFE_API_KEY_FILE`, or the
201
- owner-only file `~/.config/wordcell/typesafe-api-key` (honoring
202
- `XDG_CONFIG_HOME`). Keep credentials outside the repository. A missing key or
206
+ The CLI requires `CLOUDFLARE_ACCOUNT_ID` and reads `CLOUDFLARE_API_TOKEN`
207
+ (`CLOUDFLARE_AUTH_TOKEN` is an alias) from the environment only. Keep credentials outside the repository. A missing token or
203
208
  provider failure retains baseline ordering and marks the rerank lane
204
209
  unavailable or degraded. Inspect its structured `rerank` receipt for attempted
205
210
  requests, known usage, elapsed time, and whether usage is complete; an unknown
package/src/capture.ts CHANGED
@@ -66,3 +66,8 @@ export type {
66
66
  MediaMode,
67
67
  ParseArgumentsResult,
68
68
  };
69
+
70
+ import { extractArticleMetadata as extractArticleMetadataImplementation, parseArticleMetadata as parseArticleMetadataImplementation } from "./clip/metadata.js";
71
+ export const extractArticleMetadata: typeof extractArticleMetadataImplementation = (...arguments_) => extractArticleMetadataImplementation(...arguments_);
72
+ export const parseArticleMetadata: typeof parseArticleMetadataImplementation = (...arguments_) => parseArticleMetadataImplementation(...arguments_);
73
+ export type { ArticleMetadata, ArticleMetadataClaim, MetadataSource, MetadataValue } from "./clip/metadata.js";
package/src/cli-help.ts CHANGED
@@ -112,7 +112,8 @@ export const commandHelp: readonly CommandHelp[] = [
112
112
  PRIORITY,
113
113
  ["--candidate-limit <count>", "How many candidates to rank before trimming"],
114
114
  ["--min-score <score>", "Drop results scoring below this (0 to 1)"],
115
- ["--rerank <typesafe>", "Rerank results with the hosted TypeSafe service"],
115
+ ["--rerank <clef|typesafe>", "Send query and snippets to Clef (typesafe is deprecated)"],
116
+ ["--rerank-model <clef|clef-flash>", "Clef model to use (default: clef)"],
116
117
  ["--rerank-limit <2..25>", "How many results the reranker sees"],
117
118
  ["--selected-passage", "Add a local source excerpt to each result"],
118
119
  JSON_OPTION,
@@ -176,7 +176,8 @@ import {
176
176
  type KnowledgeBaseSearchResult,
177
177
  } from "./sdk.js";
178
178
  import { MAX_RERANK_CANDIDATES, type SearchReranker } from "./rerank.js";
179
- import { createCliTypeSafeReranker } from "./rerank-credentials.js";
179
+ import { createCliClefReranker, createCliTypeSafeReranker } from "./rerank-credentials.js";
180
+ import type { ClefModel } from "./rerank-clef.js";
180
181
  import {
181
182
  refreshVault,
182
183
  refreshVaultComplete,
@@ -382,7 +383,8 @@ type ParsedCommand =
382
383
  readonly limit?: number;
383
384
  readonly candidateLimit?: number;
384
385
  readonly minScore?: number;
385
- readonly rerank?: "typesafe";
386
+ readonly rerank?: "clef" | "typesafe";
387
+ readonly rerankModel?: ClefModel;
386
388
  readonly rerankLimit?: number;
387
389
  readonly selectedPassage?: boolean;
388
390
  readonly query: string;
@@ -1272,7 +1274,8 @@ function parseSemanticCommand(command: "index" | "search", arguments_: readonly
1272
1274
  let limit: number | undefined;
1273
1275
  let candidateLimit: number | undefined;
1274
1276
  let minScore: number | undefined;
1275
- let rerank: "typesafe" | undefined;
1277
+ let rerank: "clef" | "typesafe" | undefined;
1278
+ let rerankModel: ClefModel | undefined;
1276
1279
  let rerankLimit: number | undefined;
1277
1280
  let selectedPassage = false;
1278
1281
  let graphDepth: number | undefined;
@@ -1341,6 +1344,7 @@ function parseSemanticCommand(command: "index" | "search", arguments_: readonly
1341
1344
  || argument === "--candidate-limit"
1342
1345
  || argument === "--min-score"
1343
1346
  || argument === "--rerank"
1347
+ || argument === "--rerank-model"
1344
1348
  || argument === "--rerank-limit"
1345
1349
  || argument === "--where"
1346
1350
  || argument === "--has"
@@ -1358,10 +1362,15 @@ function parseSemanticCommand(command: "index" | "search", arguments_: readonly
1358
1362
  }
1359
1363
  mode = value;
1360
1364
  } else if (argument === "--rerank") {
1361
- if (value !== "typesafe") {
1362
- return { ok: false, message: "--rerank must be typesafe" };
1365
+ if (value !== "clef" && value !== "typesafe") {
1366
+ return { ok: false, message: "--rerank must be clef or legacy typesafe" };
1363
1367
  }
1364
1368
  rerank = value;
1369
+ } else if (argument === "--rerank-model") {
1370
+ if (value !== "clef" && value !== "clef-flash") {
1371
+ return { ok: false, message: "--rerank-model must be clef or clef-flash" };
1372
+ }
1373
+ rerankModel = value;
1365
1374
  } else if (argument === "--rerank-limit") {
1366
1375
  const parsed = Number(value);
1367
1376
  if (!Number.isSafeInteger(parsed) || parsed < 2 || parsed > MAX_RERANK_CANDIDATES) {
@@ -1498,7 +1507,10 @@ function parseSemanticCommand(command: "index" | "search", arguments_: readonly
1498
1507
  };
1499
1508
  }
1500
1509
  if (rerankLimit !== undefined && rerank === undefined) {
1501
- return { ok: false, message: "--rerank-limit requires --rerank typesafe" };
1510
+ return { ok: false, message: "--rerank-limit requires --rerank clef or legacy typesafe" };
1511
+ }
1512
+ if (rerankModel !== undefined && rerank !== "clef") {
1513
+ return { ok: false, message: "--rerank-model requires --rerank clef" };
1502
1514
  }
1503
1515
  if (priority && rulesPath === undefined) {
1504
1516
  return { ok: false, message: "--priority requires --rules" };
@@ -1539,6 +1551,7 @@ function parseSemanticCommand(command: "index" | "search", arguments_: readonly
1539
1551
  ...(candidateLimit === undefined ? {} : { candidateLimit }),
1540
1552
  ...(minScore === undefined ? {} : { minScore }),
1541
1553
  ...(rerank === undefined ? {} : { rerank }),
1554
+ ...(rerankModel === undefined ? {} : { rerankModel }),
1542
1555
  ...(rerankLimit === undefined ? {} : { rerankLimit }),
1543
1556
  ...(selectedPassage ? { selectedPassage: true } : {}),
1544
1557
  query,
@@ -2394,7 +2407,7 @@ function renderKnowledgeBaseSearch(result: KnowledgeBaseSearchResult): string {
2394
2407
  const rerankLane = result.diagnostics.lanes.find(({ lane }) => lane === "rerank");
2395
2408
  if (rerankLane !== undefined) {
2396
2409
  lines.push(
2397
- ` Rerank: typesafe over ${rerankLane.results} candidates (${rerankLane.status})`
2410
+ ` Rerank: ${safe(rerankLane.engine ?? "hosted")} over ${rerankLane.results} candidates (${rerankLane.status})`
2398
2411
  + (rerankLane.message === undefined ? "" : ` — ${safe(rerankLane.message)}`),
2399
2412
  );
2400
2413
  const receipt = rerankLane.rerank;
@@ -2488,7 +2501,9 @@ async function runSemantic(
2488
2501
  },
2489
2502
  ...(command.rerank === undefined
2490
2503
  ? []
2491
- : [{ rerankers: dependencies.rerankers ?? [await createCliTypeSafeReranker()] }]),
2504
+ : [{ rerankers: dependencies.rerankers ?? [command.rerank === "clef"
2505
+ ? await createCliClefReranker(process.env, undefined, command.rerankModel)
2506
+ : await createCliTypeSafeReranker()] }]),
2492
2507
  );
2493
2508
  try {
2494
2509
  const result = await kb.search({
@@ -1,3 +1,4 @@
1
+ import { parseArticleMetadata, type ArticleMetadata } from "./metadata.js";
1
2
  import { createHash } from "node:crypto";
2
3
  import { constants as fsConstants, type BigIntStats } from "node:fs";
3
4
  import { lstat, open, opendir, realpath, type FileHandle } from "node:fs/promises";
@@ -27,6 +28,7 @@ const SHA256_PATTERN = /^[0-9a-f]{64}$/u;
27
28
  export type CaptureBundleIntegrity = "mismatch" | "unavailable" | "verified";
28
29
 
29
30
  export type CaptureBundleInspection = {
31
+ readonly metadata?: ArticleMetadata;
30
32
  readonly root: string;
31
33
  readonly schemaVersion: 1 | 2 | 3 | 4;
32
34
  readonly sourceUrl: string;
@@ -556,6 +558,7 @@ export async function readCaptureBundle(
556
558
 
557
559
  await assertBundleRoot(root);
558
560
  return Object.freeze({
561
+ ...(manifest.metadata === undefined ? {} : { metadata: parseArticleMetadata(manifest.metadata) }),
559
562
  root: root.path,
560
563
  schemaVersion,
561
564
  sourceUrl: manifest.sourceUrl,
@@ -965,6 +965,7 @@ export async function runCapture(
965
965
  const finalWarnings = finalizedWarnings(combinedWarnings, redactedMarkdown.count);
966
966
  const includeSource = options.evidence === "source" || options.evidence === "all";
967
967
  const manifestInput: CaptureManifestInput = {
968
+ ...(article.metadata === undefined ? {} : { metadata: article.metadata }),
968
969
  sourceUrl,
969
970
  canonicalUrl: best.canonicalUrl.href,
970
971
  capturedAt,
@@ -1,3 +1,4 @@
1
+ import { parseArticleMetadata } from "./metadata.js";
1
2
  import type { CaptureScope } from "./args.js";
2
3
  import type { AcquiredPage } from "./acquire.js";
3
4
  import {
@@ -719,6 +720,7 @@ export async function extractPage(
719
720
  content: retainDefuddleMedia(restoredContent, response, acquisition.finalUrl),
720
721
  title: boundedMetadata(response.title, articleMetadataLimits.title)
721
722
  ?? boundedMetadata(acquisition.browserTitle, articleMetadataLimits.title),
723
+ ...(response.metadata === undefined ? {} : { metadata: parseArticleMetadata(response.metadata) }),
722
724
  author: boundedMetadata(response.author, articleMetadataLimits.author),
723
725
  published: boundedMetadata(response.published, articleMetadataLimits.published),
724
726
  description,
package/src/clip/lib.ts CHANGED
@@ -1,7 +1,9 @@
1
+ import { parseArticleMetadata, type ArticleMetadata } from "./metadata.js";
1
2
  import { sanitizeTerminalText } from "./terminal.js";
2
3
 
3
4
  /** Defuddle fields consumed after narrowing its JSON output. */
4
5
  export type Article = {
6
+ metadata?: ArticleMetadata;
5
7
  content: string;
6
8
  title: string | null;
7
9
  author: string | null;
@@ -46,6 +48,7 @@ export function parseArticle(parsed: unknown): Article | null {
46
48
  if (content === null) return null;
47
49
  return {
48
50
  content,
51
+ ...(parsed.metadata === undefined ? {} : { metadata: parseArticleMetadata(parsed.metadata) }),
49
52
  title: nonEmptyString(parsed.title, articleMetadataLimits.title),
50
53
  author: nonEmptyString(parsed.author, articleMetadataLimits.author),
51
54
  published: nonEmptyString(parsed.published, articleMetadataLimits.published),
@@ -594,9 +594,9 @@ dependencies = [
594
594
 
595
595
  [[package]]
596
596
  name = "h2"
597
- version = "0.4.15"
597
+ version = "0.4.16"
598
598
  source = "registry+https://github.com/rust-lang/crates.io-index"
599
- checksum = "6cb093c84e8bd9b188d4c4a8cb6579fc016968d14c99882163cd3ff402a4f155"
599
+ checksum = "a9f37a958b41b3b19ee2707c06439c0e9e547e847223eb791ecb0cb821c65e27"
600
600
  dependencies = [
601
601
  "atomic-waker",
602
602
  "bytes",
@@ -1469,9 +1469,9 @@ dependencies = [
1469
1469
 
1470
1470
  [[package]]
1471
1471
  name = "rustls"
1472
- version = "0.23.43"
1472
+ version = "0.23.45"
1473
1473
  source = "registry+https://github.com/rust-lang/crates.io-index"
1474
- checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06"
1474
+ checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"
1475
1475
  dependencies = [
1476
1476
  "once_cell",
1477
1477
  "rustls-pki-types",
@@ -1491,9 +1491,9 @@ dependencies = [
1491
1491
 
1492
1492
  [[package]]
1493
1493
  name = "rustls-webpki"
1494
- version = "0.103.13"
1494
+ version = "0.103.15"
1495
1495
  source = "registry+https://github.com/rust-lang/crates.io-index"
1496
- checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
1496
+ checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
1497
1497
  dependencies = [
1498
1498
  "ring",
1499
1499
  "rustls-pki-types",