@hraness/wordcell 0.22.5 → 0.24.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 (78) hide show
  1. package/README.md +67 -18
  2. package/dist/authoring.js +2 -2
  3. package/dist/{authority-3ga47syb.js → authority-35cbvp1x.js} +2 -2
  4. package/dist/benchmark.js +3 -3
  5. package/dist/capture.js +6 -6
  6. package/dist/cli.js +26 -24
  7. package/dist/clip/acquire.js +3 -3
  8. package/dist/clip/args.js +1 -1
  9. package/dist/clip/cli.js +6 -6
  10. package/dist/clip/doctor.js +4 -4
  11. package/dist/evaluation-builder.js +10 -10
  12. package/dist/evaluation-kb.js +10 -10
  13. package/dist/graph-authority.js +4 -4
  14. package/dist/graph-percolation.js +6 -6
  15. package/dist/graph.js +3 -1
  16. package/dist/{index-bcknqxrq.js → index-0eacgvpv.js} +9 -1
  17. package/dist/{index-f75zmmdr.js → index-1er88ckw.js} +4 -4
  18. package/dist/{index-8v6k9h4r.js → index-1s8mc4hz.js} +1 -1
  19. package/dist/{index-n9kwenpt.js → index-1w0sp1q7.js} +1 -1
  20. package/dist/{index-de2w8crk.js → index-2fmnttca.js} +82 -15
  21. package/dist/{index-8bgnhjgq.js → index-44kw9tr8.js} +3867 -162
  22. package/dist/{index-42tb8qqp.js → index-5d1rd5v9.js} +444 -9
  23. package/dist/{index-aer0jdrq.js → index-ahyhryb8.js} +1 -1
  24. package/dist/{index-f7fnww7a.js → index-b0khj0h5.js} +164 -9
  25. package/dist/{index-qdb8f8va.js → index-bdwcjvr4.js} +1 -1
  26. package/dist/{index-dfag79p7.js → index-byz4kzww.js} +3 -0
  27. package/dist/{index-hgve9rh2.js → index-cd75vky9.js} +96 -1
  28. package/dist/{index-h2qn3y3f.js → index-f184qyh1.js} +4 -4
  29. package/dist/{index-n57tewfr.js → index-fp732bgg.js} +2 -2
  30. package/dist/{index-zy7an84p.js → index-jvb7w0gg.js} +5 -2
  31. package/dist/{index-f984hw45.js → index-k86wepd8.js} +1 -1
  32. package/dist/{index-1r5rnkfr.js → index-mvs6f7ne.js} +2 -2
  33. package/dist/{index-p96kb6t2.js → index-nn67kzwa.js} +1 -1
  34. package/dist/{index-fc4dr114.js → index-nwrehke7.js} +1 -1
  35. package/dist/{index-pz2b2x0y.js → index-pgtm2nhf.js} +1 -1
  36. package/dist/{index-054mb7d3.js → index-qfqjfxaa.js} +10 -9
  37. package/dist/{index-xzvcw9ga.js → index-r0m5taz2.js} +2 -2
  38. package/dist/{index-gtwqye5a.js → index-tcaq1c7f.js} +4 -4
  39. package/dist/{index-g5vsqmdy.js → index-xwxy71ew.js} +190 -4
  40. package/dist/index.js +15 -13
  41. package/dist/pdf.js +3 -3
  42. package/dist/percolate.js +2 -2
  43. package/dist/portfolio.js +10 -10
  44. package/dist/publish.js +3 -3
  45. package/dist/sdk.js +9 -9
  46. package/dist/search.js +2 -2
  47. package/dist/semantic.js +4 -4
  48. package/dist/{support-jf9v10j7.js → support-1yhv6vm6.js} +25 -23
  49. package/dist/url-intelligence.js +1 -1
  50. package/dist/workflows/decision-context.js +10 -10
  51. package/dist/workflows/index.js +10 -10
  52. package/package.json +12 -4
  53. package/skills/wordcell/AGENTS.md +1 -0
  54. package/skills/wordcell/SKILL.md +5 -3
  55. package/skills/wordcell/references/query.md +52 -4
  56. package/skills/wordcell/references/session-memory.md +207 -0
  57. package/src/authoring-import.ts +32 -0
  58. package/src/authoring-model.ts +185 -2
  59. package/src/authoring-program.ts +19 -7
  60. package/src/cli-help.ts +894 -0
  61. package/src/cli-intro.ts +1 -1
  62. package/src/cli-program.ts +612 -83
  63. package/src/cli-style.ts +132 -0
  64. package/src/clip/acquire.ts +20 -0
  65. package/src/clip/args.ts +3 -0
  66. package/src/clip/cli.ts +82 -5
  67. package/src/clip/cookie-permission.ts +241 -0
  68. package/src/clip/url-metadata-cli.ts +6 -5
  69. package/src/clip/url-metadata.ts +14 -0
  70. package/src/graph.ts +9 -4
  71. package/src/import-supermemory.ts +1629 -0
  72. package/src/mcp-server.ts +415 -0
  73. package/src/mcp-tools.ts +1138 -0
  74. package/src/pdf/cli.ts +5 -4
  75. package/src/sdk.ts +149 -1
  76. package/src/selected-passage.ts +409 -0
  77. package/src/support-profile.ts +1 -1
  78. package/src/support.ts +3 -0
@@ -12,35 +12,46 @@ import {
12
12
  localizeAssets,
13
13
  scoreExtraction,
14
14
  sniffImage
15
- } from "./index-f984hw45.js";
15
+ } from "./index-k86wepd8.js";
16
16
  import {
17
17
  adapterCapabilities,
18
18
  inspectClipEnvironment,
19
19
  renderAdapterCapabilities,
20
20
  renderDoctorReport
21
- } from "./index-fc4dr114.js";
21
+ } from "./index-nwrehke7.js";
22
22
  import {
23
23
  cloneBrowserProfile
24
24
  } from "./index-5n05se68.js";
25
25
  import {
26
+ CONFIRM_LINE,
26
27
  acquireBrowser,
27
28
  acquireCookieHttp,
28
29
  acquireCookieRecords,
29
30
  acquireFile,
30
31
  acquireHttp,
31
- assertSafePersistentProfile
32
- } from "./index-g5vsqmdy.js";
32
+ assertSafePersistentProfile,
33
+ cookiePermissionRecovery,
34
+ renderCookiePermissionNotice,
35
+ renderCookiePermissionRecovery,
36
+ setCookiePermissionReporter
37
+ } from "./index-xwxy71ew.js";
33
38
  import {
34
39
  CONTENT_REWRITE_TRUNCATION_WARNING,
35
40
  buildClipMarkdown,
36
41
  classifyPlatformUrl,
42
+ detectAudience,
37
43
  parseBlueskyCapture,
38
44
  parseHackerNewsCapture,
39
45
  parseRedditCapture,
40
46
  renderCapturedDocument,
47
+ renderFailure,
41
48
  rewriteContentWithStatus,
42
- slugify
43
- } from "./index-hgve9rh2.js";
49
+ sentence,
50
+ slugify,
51
+ stderrStyle,
52
+ terminalOutput,
53
+ writesToTerminal
54
+ } from "./index-cd75vky9.js";
44
55
  import {
45
56
  MAX_COOKIE_BYTES,
46
57
  filterCookieProviderResult,
@@ -61,7 +72,7 @@ import {
61
72
  captureUrl,
62
73
  parseArguments,
63
74
  usage
64
- } from "./index-dfag79p7.js";
75
+ } from "./index-byz4kzww.js";
65
76
  import {
66
77
  BoundedByteBuffer
67
78
  } from "./index-gh719d91.js";
@@ -2359,10 +2370,10 @@ async function runCapture(rawOptions, dependencies = {}) {
2359
2370
  }
2360
2371
 
2361
2372
  // src/clip/cli.ts
2362
- var defaultOutput = {
2373
+ var defaultOutput = terminalOutput({
2363
2374
  stdout: (value) => process.stdout.write(value),
2364
2375
  stderr: (value) => process.stderr.write(value)
2365
- };
2376
+ });
2366
2377
  function line(value) {
2367
2378
  return value.endsWith(`
2368
2379
  `) ? value : `${value}
@@ -2378,6 +2389,27 @@ function terminalSafeJson(value) {
2378
2389
  return `${JSON.stringify(value, (_key, candidate) => typeof candidate === "string" ? sanitizeTerminalText(candidate) : candidate, 2)}
2379
2390
  `;
2380
2391
  }
2392
+ var CONFIRM_TIMEOUT_MS = 120000;
2393
+ async function confirmFromTerminal() {
2394
+ const reader = Bun.stdin.stream().getReader();
2395
+ let timer;
2396
+ try {
2397
+ const timeout = new Promise((resolve2) => {
2398
+ timer = setTimeout(() => resolve2("skip"), CONFIRM_TIMEOUT_MS);
2399
+ });
2400
+ const answer = reader.read().then(({ value }) => {
2401
+ const text = value === undefined ? "" : new TextDecoder().decode(value).trim().toLowerCase();
2402
+ return text === "s" || text === "skip" ? "skip" : "continue";
2403
+ });
2404
+ return await Promise.race([answer, timeout]);
2405
+ } finally {
2406
+ if (timer !== undefined)
2407
+ clearTimeout(timer);
2408
+ await reader.cancel().catch(() => {
2409
+ return;
2410
+ });
2411
+ }
2412
+ }
2381
2413
  function captureSummary(outcome) {
2382
2414
  return {
2383
2415
  ok: captureSucceeded(outcome),
@@ -2415,9 +2447,9 @@ async function diagnosticCommand(arguments_, output, inspectEnvironment) {
2415
2447
  async function main(rawArguments = process.argv.slice(2), environment = process.env, output = defaultOutput, dependencies = {}, runtimeOptions = {}) {
2416
2448
  const parsed = parseArguments(rawArguments, environment);
2417
2449
  if (!parsed.ok) {
2418
- output.stderr(`error: ${safe(parsed.message)}
2419
-
2420
- ${sanitizeTerminalText(usage)}`);
2450
+ const first = rawArguments[0];
2451
+ const next = first === "doctor" || first === "adapters" || first === "inspect" ? `wordcell ${first} --help` : "wordcell clip --help";
2452
+ output.stderr(renderFailure(sentence(safe(parsed.message)), next, stderrStyle(environment, output)));
2421
2453
  return 2;
2422
2454
  }
2423
2455
  const arguments_ = parsed.value;
@@ -2432,6 +2464,24 @@ ${sanitizeTerminalText(usage)}`);
2432
2464
  output.stdout(arguments_.json ? terminalSafeJson({ schemaVersion: 1, adapters: adapterCapabilities }) : sanitizeTerminalText(renderAdapterCapabilities()));
2433
2465
  return 0;
2434
2466
  }
2467
+ const onTerminal = dependencies.stderrIsTerminal ?? writesToTerminal(output);
2468
+ const human = !arguments_.json && detectAudience(environment, onTerminal) === "human";
2469
+ let permissionFailure;
2470
+ setCookiePermissionReporter({
2471
+ notice: async (need) => {
2472
+ if (!human || arguments_.quiet)
2473
+ return "continue";
2474
+ output.stderr(renderCookiePermissionNotice(need, environment, stderrStyle(environment, output)));
2475
+ const confirm = dependencies.confirmPermission ?? (onTerminal && process.stdin.isTTY === true ? confirmFromTerminal : undefined);
2476
+ if (confirm === undefined)
2477
+ return "continue";
2478
+ output.stderr(CONFIRM_LINE);
2479
+ return await confirm();
2480
+ },
2481
+ failure: (failure) => {
2482
+ permissionFailure ??= failure;
2483
+ }
2484
+ });
2435
2485
  if (!arguments_.quiet && !arguments_.json) {
2436
2486
  const target = arguments_.currentTab ? "the current browser tab" : safe(arguments_.url?.href ?? "current");
2437
2487
  output.stderr(`Capturing ${target} (${arguments_.mode}, ${arguments_.scope}) ...
@@ -2466,13 +2516,30 @@ ${sanitizeTerminalText(usage)}`);
2466
2516
  }
2467
2517
  return captureExitCode(outcome);
2468
2518
  } catch (error) {
2469
- const message = safe(error instanceof Error ? error.message : String(error));
2519
+ const raw = error instanceof Error ? error.message : String(error);
2520
+ const recovery = permissionFailure === undefined ? undefined : cookiePermissionRecovery(permissionFailure, environment);
2521
+ if (recovery !== undefined && raw.includes(recovery.message)) {
2522
+ if (arguments_.json) {
2523
+ output.stdout(terminalSafeJson({
2524
+ ok: false,
2525
+ error: recovery.message,
2526
+ code: recovery.code,
2527
+ next: recovery.next,
2528
+ permission: recovery.permission
2529
+ }));
2530
+ } else {
2531
+ output.stderr(renderCookiePermissionRecovery(recovery, stderrStyle(environment, output)));
2532
+ }
2533
+ return 1;
2534
+ }
2535
+ const message = safe(raw);
2470
2536
  if (arguments_.json)
2471
2537
  output.stdout(terminalSafeJson({ ok: false, error: message }));
2472
2538
  else
2473
- output.stderr(`error: ${message}
2474
- `);
2539
+ output.stderr(renderFailure(message, "wordcell doctor", stderrStyle(environment, output)));
2475
2540
  return 1;
2541
+ } finally {
2542
+ setCookiePermissionReporter(undefined);
2476
2543
  }
2477
2544
  }
2478
2545
  if (import.meta.main)