@sayknow-cli/coding-agent 0.5.2 → 0.5.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +66 -16
  2. package/dist/types/cli/update-cli.d.ts +8 -1
  3. package/dist/types/config/atomic-yaml-patch.d.ts +20 -1
  4. package/dist/types/config/keybindings.d.ts +10 -0
  5. package/dist/types/config/model-registry.d.ts +1 -1
  6. package/dist/types/config/models-config-schema.d.ts +4 -0
  7. package/dist/types/config/settings-schema.d.ts +73 -0
  8. package/dist/types/dap/client.d.ts +1 -0
  9. package/dist/types/lsp/client.d.ts +5 -0
  10. package/dist/types/modes/components/welcome.d.ts +1 -0
  11. package/dist/types/modes/controllers/selector-controller.d.ts +3 -1
  12. package/dist/types/modes/interactive-mode.d.ts +13 -1
  13. package/dist/types/modes/types.d.ts +7 -1
  14. package/dist/types/runtime-mcp/transports/stdio.d.ts +2 -0
  15. package/dist/types/session/agent-session.d.ts +8 -0
  16. package/dist/types/session/internal/managed-session-scope.d.ts +3 -1
  17. package/dist/types/session/internal/managed-session-storage.d.ts +2 -0
  18. package/dist/types/session/session-manager.d.ts +9 -0
  19. package/dist/types/session/session-storage.d.ts +17 -0
  20. package/dist/types/session-import/claude.d.ts +26 -0
  21. package/dist/types/session-import/codex.d.ts +22 -0
  22. package/dist/types/session-import/command.d.ts +20 -0
  23. package/dist/types/session-import/detect.d.ts +22 -0
  24. package/dist/types/session-import/index.d.ts +7 -0
  25. package/dist/types/session-import/redact.d.ts +23 -0
  26. package/dist/types/session-import/service.d.ts +28 -0
  27. package/dist/types/session-import/types.d.ts +125 -0
  28. package/dist/types/skc-runtime/launch-worktree.d.ts +17 -1
  29. package/dist/types/slash-commands/builtin-registry.d.ts +4 -0
  30. package/dist/types/slash-commands/types.d.ts +5 -0
  31. package/dist/types/system-prompt.d.ts +5 -0
  32. package/dist/types/tools/ask.d.ts +5 -0
  33. package/dist/types/utils/mupdf-wasm.d.ts +1 -0
  34. package/package.json +13 -7
  35. package/scripts/compile-args.ts +8 -4
  36. package/scripts/generate-sdk-operation-inventory.ts +5 -6
  37. package/src/cli/config-cli.ts +23 -8
  38. package/src/cli/update-cli.ts +265 -21
  39. package/src/config/atomic-yaml-patch.ts +167 -30
  40. package/src/config/keybindings.ts +10 -0
  41. package/src/config/model-profiles.ts +84 -16
  42. package/src/config/model-registry.ts +60 -38
  43. package/src/config/models-config-schema.ts +1 -1
  44. package/src/config/settings-schema.ts +79 -0
  45. package/src/config/settings.ts +13 -2
  46. package/src/dap/client.ts +78 -30
  47. package/src/internal-urls/docs-index.generated.ts +5 -4
  48. package/src/lsp/client.ts +17 -29
  49. package/src/modes/action-registry.ts +2 -0
  50. package/src/modes/components/welcome.ts +5 -0
  51. package/src/modes/controllers/goal-mode-controller.ts +7 -2
  52. package/src/modes/controllers/input-controller.ts +71 -6
  53. package/src/modes/controllers/plan-mode-controller.ts +8 -1
  54. package/src/modes/controllers/runtime-mcp-command-controller.ts +14 -0
  55. package/src/modes/controllers/selector-controller.ts +47 -19
  56. package/src/modes/interactive-mode.ts +54 -4
  57. package/src/modes/types.ts +5 -1
  58. package/src/prompts/system/system-prompt.md +8 -0
  59. package/src/runtime-mcp/transports/stdio.ts +96 -33
  60. package/src/sdk/broker/lifecycle.ts +6 -5
  61. package/src/sdk/protocol/operation-inventory.generated.json +33 -0
  62. package/src/sdk/session.ts +27 -18
  63. package/src/session/agent-session.ts +155 -15
  64. package/src/session/internal/managed-session-scope.ts +41 -6
  65. package/src/session/internal/managed-session-storage.ts +14 -0
  66. package/src/session/session-manager.ts +113 -11
  67. package/src/session/session-storage.ts +70 -0
  68. package/src/session-import/claude.ts +382 -0
  69. package/src/session-import/codex.ts +458 -0
  70. package/src/session-import/command.ts +61 -0
  71. package/src/session-import/detect.ts +133 -0
  72. package/src/session-import/index.ts +27 -0
  73. package/src/session-import/redact.ts +125 -0
  74. package/src/session-import/service.ts +749 -0
  75. package/src/session-import/types.ts +163 -0
  76. package/src/skc-runtime/launch-worktree.ts +277 -4
  77. package/src/slash-commands/acp-builtins.ts +5 -1
  78. package/src/slash-commands/builtin-registry.ts +100 -1
  79. package/src/slash-commands/types.ts +5 -0
  80. package/src/system-prompt.ts +7 -0
  81. package/src/tools/ask.ts +5 -0
  82. package/src/tools/fetch.ts +7 -2
  83. package/src/utils/markit.ts +24 -2
  84. package/src/utils/mupdf-wasm.ts +26 -0
  85. package/src/export/html/template.css +0 -1060
  86. package/src/export/html/template.html +0 -47
  87. package/src/export/html/template.js +0 -2348
  88. package/vendor/insane-search/engine/tests/test_hardening.py +0 -57
  89. package/vendor/insane-search/engine/tests/test_smoke.py +0 -152
  90. package/vendor/insane-search/engine/tests/test_u1.py +0 -200
  91. package/vendor/insane-search/engine/tests/test_u4.py +0 -131
  92. package/vendor/insane-search/engine/tests/test_u5.py +0 -163
  93. package/vendor/insane-search/engine/tests/test_u7.py +0 -124
  94. package/vendor/insane-search/engine/tests/test_u8.py +0 -216
package/src/tools/ask.ts CHANGED
@@ -595,6 +595,11 @@ export class AskTool implements AgentTool<typeof askSchema, AskToolDetails> {
595
595
  readonly description: string;
596
596
  readonly parameters = askSchema;
597
597
  readonly strict = true;
598
+ /**
599
+ * These fields are rendered to the user and carry no executable or durable
600
+ * meaning. IDs and workflow/deep-interview metadata remain fail-closed.
601
+ */
602
+ readonly displaySafeEscapedArgFields = ["questions.question", "questions.options.label"] as const;
598
603
  readonly loadMode = "discoverable";
599
604
 
600
605
  constructor(private readonly session: ToolSession) {
@@ -751,7 +751,9 @@ async function renderUrl(
751
751
  let convertedText: string | null = null;
752
752
  const converted = await convertWithMarkit(binary.buffer, conversionExtension, timeout, signal);
753
753
  if (converted.ok) {
754
- if (converted.content.trim().length > 50) {
754
+ // See the non-empty conversion note near the document path
755
+ // below (upstream #5433): short conversions still beat raw fallback.
756
+ if (converted.content.trim().length > 0) {
755
757
  notes.push("Converted with markit");
756
758
  convertedText = converted.content;
757
759
  } else {
@@ -859,7 +861,10 @@ async function renderUrl(
859
861
  const ext = getExtensionHint(finalUrl, binary.contentDisposition) || extHint;
860
862
  const converted = await convertWithMarkit(binary.buffer, ext, timeout, signal);
861
863
  if (converted.ok) {
862
- if (converted.content.trim().length > 50) {
864
+ // Any non-empty markit conversion is preferable to a raw-bytes
865
+ // fallback (upstream #5433): short documents like the W3C dummy.pdf
866
+ // ("Dummy PDF file", 14 chars) are legitimately converted text.
867
+ if (converted.content.trim().length > 0) {
863
868
  notes.push("Converted with markit");
864
869
  const output = finalizeOutput(converted.content);
865
870
  return {
@@ -1,6 +1,7 @@
1
1
  import { untilAborted } from "@sayknow-cli/utils";
2
2
  import type { Markit, StreamInfo } from "markit-ai";
3
3
  import { ToolAbortError } from "../tools/tool-errors";
4
+ import { ensureMupdfWasmResolution } from "./mupdf-wasm";
4
5
 
5
6
  export interface MarkitConversionResult {
6
7
  content: string;
@@ -18,6 +19,11 @@ let markit: () => Markit | Promise<Markit> = async () => {
18
19
  return promise;
19
20
  };
20
21
 
22
+ // Upstream #5433: mupdf's wasm asset is not reachable at the Emscripten
23
+ // loader's default bunfs path in compiled binaries. Seed the embedded-asset
24
+ // hook before any markit conversion (and therefore before any mupdf import).
25
+ ensureMupdfWasmResolution();
26
+
21
27
  function normalizeExtension(extension: string): string {
22
28
  const trimmed = extension.trim().toLowerCase();
23
29
  if (!trimmed) return ".bin";
@@ -31,6 +37,22 @@ function normalizeError(error: unknown): string {
31
37
  return "Conversion failed";
32
38
  }
33
39
 
40
+ /**
41
+ * markit-ai's PDF converter swallows the real mupdf import failure behind a
42
+ * generic "Install it" message (upstream #5433). Re-run the import here so
43
+ * release diagnostics carry the actual module/asset/initialization error.
44
+ */
45
+ async function describeConversionError(error: unknown): Promise<string> {
46
+ const base = normalizeError(error);
47
+ if (!base.includes("PDF support requires 'mupdf'")) return base;
48
+ try {
49
+ await import("mupdf");
50
+ } catch (cause) {
51
+ return `${base} (mupdf import failed: ${normalizeError(cause)})`;
52
+ }
53
+ return base;
54
+ }
55
+
34
56
  async function runMarkitConversion<T>(task: (markit: Markit) => Promise<T>, signal?: AbortSignal): Promise<T> {
35
57
  try {
36
58
  const instance = await markit();
@@ -62,7 +84,7 @@ export async function convertFileWithMarkit(filePath: string, signal?: AbortSign
62
84
  if (error instanceof ToolAbortError) {
63
85
  throw error;
64
86
  }
65
- return { content: "", ok: false, error: normalizeError(error) };
87
+ return { content: "", ok: false, error: await describeConversionError(error) };
66
88
  }
67
89
  }
68
90
 
@@ -84,6 +106,6 @@ export async function convertBufferWithMarkit(
84
106
  if (error instanceof ToolAbortError) {
85
107
  throw error;
86
108
  }
87
- return { content: "", ok: false, error: normalizeError(error) };
109
+ return { content: "", ok: false, error: await describeConversionError(error) };
88
110
  }
89
111
  }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * MuPDF wasm asset resolution inside compiled binaries (upstream #5433).
3
+ *
4
+ * `mupdf`'s Emscripten loader resolves `mupdf-wasm.wasm` relative to
5
+ * `import.meta.url` (or `scriptDirectory`). Inside a `bun build --compile`
6
+ * bunfs that path points at the bunfs root where the asset does not exist,
7
+ * so every mupdf import aborted with
8
+ * `ENOENT: ... /$bunfs/root/mupdf-wasm.wasm`.
9
+ *
10
+ * The wasm is embedded via `with { type: "file" }`, which lands it at a
11
+ * hashed bunfs path. MuPDF's top-level factory call reads
12
+ * `globalThis["$libmupdf_wasm_Module"]`, so seeding that config with a
13
+ * `locateFile` hook that returns the embedded asset path makes the loader
14
+ * read the wasm from the bunfs directly — no disk sidecar needed.
15
+ *
16
+ * This must run before the first `import("mupdf")` anywhere in the process.
17
+ */
18
+ import mupdfWasmPath from "../../../../node_modules/mupdf/dist/mupdf-wasm.wasm" with { type: "file" };
19
+
20
+ const MODULE_CONFIG_KEY = "$libmupdf_wasm_Module";
21
+
22
+ export function ensureMupdfWasmResolution(): void {
23
+ const globalScope = globalThis as typeof globalThis & Record<string, unknown>;
24
+ if (globalScope[MODULE_CONFIG_KEY] !== undefined) return;
25
+ globalScope[MODULE_CONFIG_KEY] = { locateFile: () => String(mupdfWasmPath) };
26
+ }