@mcoda/mswarm 0.1.135-codali.18 → 0.1.135-codali.29

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 (153) hide show
  1. package/README.md +5 -0
  2. package/dist/runtime.d.ts.map +1 -1
  3. package/dist/runtime.js +5 -2
  4. package/dist/runtime.js.map +1 -1
  5. package/dist/vendor/codali/cli/TerminalCommand.d.ts.map +1 -1
  6. package/dist/vendor/codali/cli/TerminalCommand.js +53 -20
  7. package/dist/vendor/codali/cli/TerminalInput.d.ts +6 -0
  8. package/dist/vendor/codali/cli/TerminalInput.d.ts.map +1 -1
  9. package/dist/vendor/codali/cli/TerminalInput.js +3 -1
  10. package/dist/vendor/codali/cli/ToolsCommand.d.ts.map +1 -1
  11. package/dist/vendor/codali/cli/ToolsCommand.js +8 -1
  12. package/dist/vendor/codali/cli/tui/TerminalLogo.d.ts +6 -0
  13. package/dist/vendor/codali/cli/tui/TerminalLogo.d.ts.map +1 -0
  14. package/dist/vendor/codali/cli/tui/TerminalLogo.js +26 -0
  15. package/dist/vendor/codali/cli/tui/TerminalMarkdown.d.ts +5 -0
  16. package/dist/vendor/codali/cli/tui/TerminalMarkdown.d.ts.map +1 -0
  17. package/dist/vendor/codali/cli/tui/TerminalMarkdown.js +118 -0
  18. package/dist/vendor/codali/cli/tui/TerminalPresentation.d.ts.map +1 -1
  19. package/dist/vendor/codali/cli/tui/TerminalPresentation.js +12 -3
  20. package/dist/vendor/codali/cli/tui/TerminalScreen.d.ts +1 -0
  21. package/dist/vendor/codali/cli/tui/TerminalScreen.d.ts.map +1 -1
  22. package/dist/vendor/codali/cli/tui/TerminalScreen.js +13 -6
  23. package/dist/vendor/codali/cli/tui/TerminalSelection.d.ts +15 -0
  24. package/dist/vendor/codali/cli/tui/TerminalSelection.d.ts.map +1 -0
  25. package/dist/vendor/codali/cli/tui/TerminalSelection.js +38 -0
  26. package/dist/vendor/codali/cli/tui/TerminalTui.d.ts +4 -0
  27. package/dist/vendor/codali/cli/tui/TerminalTui.d.ts.map +1 -1
  28. package/dist/vendor/codali/cli/tui/TerminalTui.js +96 -12
  29. package/dist/vendor/codali/cli.js +1 -1
  30. package/dist/vendor/codali/config/OrchestrationConfig.d.ts +18 -0
  31. package/dist/vendor/codali/config/OrchestrationConfig.d.ts.map +1 -1
  32. package/dist/vendor/codali/config/OrchestrationConfig.js +42 -2
  33. package/dist/vendor/codali/docdex/DocdexCatalog.d.ts +12 -0
  34. package/dist/vendor/codali/docdex/DocdexCatalog.d.ts.map +1 -0
  35. package/dist/vendor/codali/docdex/DocdexCatalog.js +30 -0
  36. package/dist/vendor/codali/docdex/DocdexClient.d.ts +8 -2
  37. package/dist/vendor/codali/docdex/DocdexClient.d.ts.map +1 -1
  38. package/dist/vendor/codali/docdex/DocdexClient.js +86 -11
  39. package/dist/vendor/codali/docdex/ManagedDocdex.d.ts +1 -0
  40. package/dist/vendor/codali/docdex/ManagedDocdex.d.ts.map +1 -1
  41. package/dist/vendor/codali/docdex/ManagedDocdex.js +25 -4
  42. package/dist/vendor/codali/eval/TrustBenchmark.d.ts +94 -0
  43. package/dist/vendor/codali/eval/TrustBenchmark.d.ts.map +1 -0
  44. package/dist/vendor/codali/eval/TrustBenchmark.js +199 -0
  45. package/dist/vendor/codali/eval/fixtures/TerminalRecoveryJourney.d.ts.map +1 -1
  46. package/dist/vendor/codali/eval/fixtures/TerminalRecoveryJourney.js +10 -1
  47. package/dist/vendor/codali/permissions/PermissionGate.d.ts +1 -1
  48. package/dist/vendor/codali/permissions/PermissionGate.d.ts.map +1 -1
  49. package/dist/vendor/codali/permissions/PermissionGate.js +40 -2
  50. package/dist/vendor/codali/permissions/WorkspacePermissions.d.ts +11 -0
  51. package/dist/vendor/codali/permissions/WorkspacePermissions.d.ts.map +1 -0
  52. package/dist/vendor/codali/permissions/WorkspacePermissions.js +42 -0
  53. package/dist/vendor/codali/providers/ModelServiceError.js +1 -1
  54. package/dist/vendor/codali/providers/OpenAiCompatibleProvider.d.ts.map +1 -1
  55. package/dist/vendor/codali/providers/OpenAiCompatibleProvider.js +3 -1
  56. package/dist/vendor/codali/runtime/ComputedAnswer.d.ts +13 -0
  57. package/dist/vendor/codali/runtime/ComputedAnswer.d.ts.map +1 -0
  58. package/dist/vendor/codali/runtime/ComputedAnswer.js +75 -0
  59. package/dist/vendor/codali/runtime/ContextCompression.d.ts +22 -0
  60. package/dist/vendor/codali/runtime/ContextCompression.d.ts.map +1 -0
  61. package/dist/vendor/codali/runtime/ContextCompression.js +53 -0
  62. package/dist/vendor/codali/runtime/InspectionBudget.d.ts +8 -0
  63. package/dist/vendor/codali/runtime/InspectionBudget.d.ts.map +1 -0
  64. package/dist/vendor/codali/runtime/InspectionBudget.js +25 -0
  65. package/dist/vendor/codali/runtime/InteractionContract.d.ts +42 -0
  66. package/dist/vendor/codali/runtime/InteractionContract.d.ts.map +1 -0
  67. package/dist/vendor/codali/runtime/InteractionContract.js +50 -0
  68. package/dist/vendor/codali/runtime/InteractionRouter.d.ts +46 -5
  69. package/dist/vendor/codali/runtime/InteractionRouter.d.ts.map +1 -1
  70. package/dist/vendor/codali/runtime/InteractionRouter.js +108 -27
  71. package/dist/vendor/codali/runtime/PreparedDocdex.d.ts +4 -0
  72. package/dist/vendor/codali/runtime/PreparedDocdex.d.ts.map +1 -0
  73. package/dist/vendor/codali/runtime/PreparedDocdex.js +55 -0
  74. package/dist/vendor/codali/runtime/SessionController.d.ts +22 -0
  75. package/dist/vendor/codali/runtime/SessionController.d.ts.map +1 -1
  76. package/dist/vendor/codali/runtime/SessionController.js +721 -61
  77. package/dist/vendor/codali/session/InstructionLoader.d.ts +5 -1
  78. package/dist/vendor/codali/session/InstructionLoader.d.ts.map +1 -1
  79. package/dist/vendor/codali/session/InstructionLoader.js +65 -19
  80. package/dist/vendor/codali/session/SkillCatalog.d.ts +33 -0
  81. package/dist/vendor/codali/session/SkillCatalog.d.ts.map +1 -0
  82. package/dist/vendor/codali/session/SkillCatalog.js +194 -0
  83. package/dist/vendor/codali/tools/SemanticToolRetrieval.d.ts +19 -0
  84. package/dist/vendor/codali/tools/SemanticToolRetrieval.d.ts.map +1 -0
  85. package/dist/vendor/codali/tools/SemanticToolRetrieval.js +52 -0
  86. package/dist/vendor/codali/tools/ToolRetrieval.d.ts +7 -0
  87. package/dist/vendor/codali/tools/ToolRetrieval.d.ts.map +1 -0
  88. package/dist/vendor/codali/tools/ToolRetrieval.js +25 -0
  89. package/dist/vendor/codali/tools/browser/BrowserTool.d.ts +9 -0
  90. package/dist/vendor/codali/tools/browser/BrowserTool.d.ts.map +1 -0
  91. package/dist/vendor/codali/tools/browser/BrowserTool.js +152 -0
  92. package/dist/vendor/codali/tools/browser/BrowserWorker.d.ts +2 -0
  93. package/dist/vendor/codali/tools/browser/BrowserWorker.d.ts.map +1 -0
  94. package/dist/vendor/codali/tools/browser/BrowserWorker.js +51 -0
  95. package/dist/vendor/codali/tools/calculation/CalculatorTool.d.ts +5 -0
  96. package/dist/vendor/codali/tools/calculation/CalculatorTool.d.ts.map +1 -0
  97. package/dist/vendor/codali/tools/calculation/CalculatorTool.js +137 -0
  98. package/dist/vendor/codali/tools/deterministic/DeterministicRuntime.d.ts +39 -0
  99. package/dist/vendor/codali/tools/deterministic/DeterministicRuntime.d.ts.map +1 -0
  100. package/dist/vendor/codali/tools/deterministic/DeterministicRuntime.js +98 -0
  101. package/dist/vendor/codali/tools/deterministic/DeterministicTools.d.ts +8 -0
  102. package/dist/vendor/codali/tools/deterministic/DeterministicTools.d.ts.map +1 -0
  103. package/dist/vendor/codali/tools/deterministic/DeterministicTools.js +86 -0
  104. package/dist/vendor/codali/tools/deterministic/node-worker.cjs +38 -0
  105. package/dist/vendor/codali/tools/deterministic/python-worker.py +222 -0
  106. package/dist/vendor/codali/tools/docdex/DocdexCatalogTools.d.ts +4 -0
  107. package/dist/vendor/codali/tools/docdex/DocdexCatalogTools.d.ts.map +1 -0
  108. package/dist/vendor/codali/tools/docdex/DocdexCatalogTools.js +58 -0
  109. package/dist/vendor/codali/tools/docdex/DocdexTools.d.ts +2 -0
  110. package/dist/vendor/codali/tools/docdex/DocdexTools.d.ts.map +1 -1
  111. package/dist/vendor/codali/tools/docdex/DocdexTools.js +72 -105
  112. package/dist/vendor/codali/tools/documents/DocumentRuntime.d.ts +12 -0
  113. package/dist/vendor/codali/tools/documents/DocumentRuntime.d.ts.map +1 -0
  114. package/dist/vendor/codali/tools/documents/DocumentRuntime.js +59 -0
  115. package/dist/vendor/codali/tools/documents/DocumentTools.d.ts +19 -0
  116. package/dist/vendor/codali/tools/documents/DocumentTools.d.ts.map +1 -0
  117. package/dist/vendor/codali/tools/documents/DocumentTools.js +150 -0
  118. package/dist/vendor/codali/tools/documents/worker.py +267 -0
  119. package/dist/vendor/codali/tools/entities/AdesTool.d.ts +7 -0
  120. package/dist/vendor/codali/tools/entities/AdesTool.d.ts.map +1 -0
  121. package/dist/vendor/codali/tools/entities/AdesTool.js +59 -0
  122. package/dist/vendor/codali/tools/research/TnlTool.d.ts +22 -0
  123. package/dist/vendor/codali/tools/research/TnlTool.d.ts.map +1 -0
  124. package/dist/vendor/codali/tools/research/TnlTool.js +246 -0
  125. package/dist/vendor/codali/tools/shell/HostToolchain.d.ts.map +1 -1
  126. package/dist/vendor/codali/tools/shell/HostToolchain.js +14 -2
  127. package/dist/vendor/codali/tools/shell/IsolatedExecutor.d.ts +3 -2
  128. package/dist/vendor/codali/tools/shell/IsolatedExecutor.d.ts.map +1 -1
  129. package/dist/vendor/codali/tools/shell/IsolatedExecutor.js +34 -4
  130. package/dist/vendor/codali/tools/system/TimeTool.d.ts +4 -0
  131. package/dist/vendor/codali/tools/system/TimeTool.d.ts.map +1 -0
  132. package/dist/vendor/codali/tools/system/TimeTool.js +22 -0
  133. package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.d.ts +47 -0
  134. package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.d.ts.map +1 -0
  135. package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.js +71 -0
  136. package/dist/vendor/codali/tools/verification/JavaScriptVerificationWorker.d.ts +2 -0
  137. package/dist/vendor/codali/tools/verification/JavaScriptVerificationWorker.d.ts.map +1 -0
  138. package/dist/vendor/codali/tools/verification/JavaScriptVerificationWorker.js +91 -0
  139. package/dist/vendor/codali/tools/verification/VitestTool.d.ts +3 -0
  140. package/dist/vendor/codali/tools/verification/VitestTool.d.ts.map +1 -0
  141. package/dist/vendor/codali/tools/verification/VitestTool.js +128 -0
  142. package/dist/vendor/config/AGENTS.md +11 -0
  143. package/dist/vendor/config/deterministic/install-python.mjs +16 -0
  144. package/dist/vendor/config/deterministic/node-worker.mjs +77 -0
  145. package/dist/vendor/config/deterministic/python-worker.py +222 -0
  146. package/dist/vendor/config/deterministic/requirements.txt +6 -0
  147. package/dist/vendor/config/docdex-runtime.json +21 -0
  148. package/dist/vendor/config/docdex-tools-0.2.99.json +3977 -0
  149. package/dist/vendor/config/documents/install-python.mjs +16 -0
  150. package/dist/vendor/config/documents/requirements.txt +10 -0
  151. package/dist/vendor/config/documents/worker.py +267 -0
  152. package/dist/vendor/config/skills/planning/SKILL.md +13 -0
  153. package/package.json +11 -4
@@ -1 +1 @@
1
- {"version":3,"file":"TerminalCommand.d.ts","sourceRoot":"","sources":["../../src/cli/TerminalCommand.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2E,KAAK,WAAW,EAA4B,KAAK,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEzM,OAAO,EAAkB,KAAK,iBAAiB,EAAyB,MAAM,kCAAkC,CAAC;AAMjH,OAAO,EAAkC,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAI1F,OAAO,EAA2D,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAYnI,UAAU,SAAS;IAAG,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM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"../runtime/SessionController.js";
6
+ import { INTERACTION_CONTRACT_VERSION } from "../runtime/InteractionRouter.js";
6
7
  import { loadOrchestrationConfig, orchestrationHash, validateOrchestrationConfig } from "../config/OrchestrationConfig.js";
7
8
  import { ConfiguredProvider, ModelServiceClient, providerCredential } from "../providers/ConfiguredProvider.js";
9
+ import { WorkspacePermissions } from "../permissions/WorkspacePermissions.js";
8
10
  import { executorStatus } from "../tools/shell/IsolatedExecutor.js";
9
11
  import { atomicWriteJson } from "../session/AtomicState.js";
10
12
  import { readTerminalCredential, setTerminalCredential } from "./TerminalCredentials.js";
@@ -19,11 +21,15 @@ import { TerminalTui } from "./tui/TerminalTui.js";
19
21
  import { inspectPlanDiff } from "./TerminalPlan.js";
20
22
  import { openTerminalArtifact } from "./TerminalArtifacts.js";
21
23
  import { mediaJobSummary } from "../connectors/media/ConfiguredMediaTools.js";
24
+ import { inspectDeterministicRuntime } from "../tools/deterministic/DeterministicRuntime.js";
25
+ import { inspectDocumentRuntime } from "../tools/documents/DocumentRuntime.js";
26
+ import { resolveBrowserBinary } from "../tools/browser/BrowserTool.js";
27
+ import { inspectTnlCredential } from "../tools/research/TnlTool.js";
22
28
  import { proposeTerminalModel, saveTerminalModel, terminalModelOperation } from "./TerminalModels.js";
23
29
  const DEFAULT_PROVIDER = { adapter: "mswarm", baseUrl: "https://api.mswarm.org/v1/swarm/self-hosted/openai", credentialRef: "env:MCODA_MSWARM_API_KEY" };
24
30
  const CONFIG_PATH = path.join(os.homedir(), ".codali", "orchestration.json");
25
- const COMMANDS = ["/help", "/usage", "/status", "/permissions", "/effort", "/model", "/models", "/config", "/goal", "/plan", "/tasks", "/decisions", "/context", "/diff", "/tools", "/mcp", "/docdex", "/review", "/compact", "/checkpoint", "/sessions", "/resume", "/fork", "/retention", "/delete-session", "/new", "/clear", "/steer", "/continue", "/stop", "/cancel", "/reconcile", "/reconcile-media", "/export", "/artifacts", "/exit", "/quit"];
26
- const HELP = `Codali terminal\n codali [chat] [prompt] [--workspace-root PATH] [--config PATH]\n codali exec PROMPT [--json] [--permissions plan|ask|workspace] [--effort low|medium|high|max]\n codali setup [--config PATH] [--docdex-binary PATH]\n codali login [--stdin] | logout | auth status\n codali sessions | resume SESSION_ID | status SESSION_ID\n\n${COMMANDS.join(" ")}\n\nInteractive terminals open the TUI; --plain selects line-oriented output.\nEnter sends/queues; Alt-Enter or Ctrl-J inserts a newline; Ctrl-S steers.\nCtrl-P commands; Ctrl-R history; Tab completes commands and @files.\nPage Up/Down scroll; Ctrl-O expands tools; Escape closes views or cancels.\nCtrl-C cancels the active turn. A second Ctrl-C exits after cleanup.\nIn noninteractive mode approvals are denied; choose an explicit permission profile.\nProject tasks: mcoda codali chat --project-task TASK_KEY (existing workspace task database).\nExit codes: 0 verified completion, 1 error, 2 open/blocked goal, 130 cancelled.`;
31
+ const COMMANDS = ["/help", "/usage", "/status", "/permissions", "/effort", "/model", "/models", "/config", "/goal", "/plan", "/tasks", "/decisions", "/context", "/diff", "/skills", "/tools", "/mcp", "/docdex", "/review", "/compact", "/checkpoint", "/sessions", "/resume", "/fork", "/retention", "/delete-session", "/new", "/clear", "/steer", "/continue", "/stop", "/cancel", "/reconcile", "/reconcile-media", "/export", "/artifacts", "/exit", "/quit"];
32
+ const HELP = `Codali terminal\n codali [chat] [prompt] [--workspace-root PATH] [--config PATH]\n codali exec PROMPT [--json] [--permissions plan|ask|workspace|full] [--effort low|medium|high|max]\n codali setup [--config PATH] [--docdex-binary PATH]\n codali login [--stdin] | logout | auth status\n codali sessions | resume SESSION_ID | status SESSION_ID\n\n${COMMANDS.join(" ")}\n\nInteractive terminals open the TUI; --plain selects line-oriented output.\nEnter or Tab sends/queues; Alt-Enter or Ctrl-J inserts a newline; Ctrl-S steers.\nCtrl-P commands; Ctrl-R history; Shift-Tab completes commands and @files.\nPage Up/Down scroll; Ctrl-O expands tools; Escape closes views or cancels.\nCtrl-C or Ctrl-Z cancels the active turn; press again to exit after cleanup.\nIn noninteractive mode approvals are denied; choose an explicit permission profile.\nProject tasks: mcoda codali chat --project-task TASK_KEY (existing workspace task database).\nExit codes: 0 verified completion, 1 error, 2 open/blocked goal, 130 cancelled.`;
27
33
  export const parseTerminalArguments = (argv) => {
28
34
  const [command = "chat", ...input] = argv;
29
35
  const result = { command, prompt: "", workspaceRoot: process.cwd(), effort: "medium", permissions: "ask", json: false, plain: false, stdin: false };
@@ -70,7 +76,7 @@ export const parseTerminalArguments = (argv) => {
70
76
  result.effort = value;
71
77
  }
72
78
  if (flag === "--permissions" || flag === "--permission-profile") {
73
- if (!["plan", "ask", "workspace"].includes(value))
79
+ if (!["plan", "ask", "workspace", "full"].includes(value))
74
80
  throw new Error("Invalid permission profile");
75
81
  result.permissions = value;
76
82
  }
@@ -113,12 +119,10 @@ export const setupTerminalConfig = async (destination, options = {}) => {
113
119
  config.bindings.lead = { candidates: lead.map(entry => entry.id) };
114
120
  for (const role of ["architect", "worker", "reviewer", "planner", "compactor", "router", "adjudicator", "synthesizer", "verifier", "repair"])
115
121
  config.bindings[role] = { useBinding: "lead" };
116
- // The evaluated local intent model is an explicit configurable binding.
117
- const intent = catalog.filter(entry => entry.health === "healthy" && entry.id.endsWith("qwen3-4b-instruct-2507") && entry.operations.includes("chat.completions"));
118
- for (const entry of intent)
119
- config.models[entry.id] = { provider: "mswarm", catalogId: entry.id, revision: String(entry.raw.digest ?? entry.raw.revision ?? "catalog-unversioned"), operations: ["chat.completions"], backend: entry.backend, contextWindow: entry.contextWindow ?? 16384, maxOutputTokens: 1024, supportsTools: false, supportsStreaming: false };
120
- config.bindings.intent = intent.length ? { candidates: [...intent.map(entry => entry.id), ...lead.map(entry => entry.id)] } : { useBinding: "lead" };
121
- config.interaction = { routerBinding: "intent", answerBinding: "lead", promptVersion: "interaction-v8" };
122
+ // Availability is not qualification for this version's dispatch contract.
123
+ // Operators can bind a measured smaller candidate explicitly after evaluation.
124
+ config.bindings.intent = { useBinding: "lead" };
125
+ config.interaction = { routerBinding: "intent", answerBinding: "lead", promptVersion: INTERACTION_CONTRACT_VERSION };
122
126
  config.bindings.helper = { enabled: false };
123
127
  config.bindings.embedding = { enabled: false };
124
128
  // Only explicit operator contracts can initialize an index. Incompatible
@@ -152,11 +156,11 @@ export const setupTerminalConfig = async (destination, options = {}) => {
152
156
  config.bindings.embedding = { candidates: [...candidates, entry.id], embeddingSpace: "catalog-pinned-v1" };
153
157
  }
154
158
  for (const [binding, operation] of [["image", "images.generations"], ["audio", "audio.generations"], ["video", "videos.generations"]]) {
155
- const entries = catalog.filter(entry => entry.health === "healthy" && entry.operations.includes(operation));
159
+ const entries = catalog.filter(entry => entry.health === "healthy" && entry.backend === "openai-compatible-local" && entry.operations.includes(operation));
156
160
  for (const entry of entries) {
157
161
  const previous = config.models[entry.id];
158
- config.models[entry.id] = previous ? { ...previous, operations: [...new Set([...previous.operations, operation])] }
159
- : { provider: "mswarm", catalogId: entry.id, revision: String(entry.raw.revision ?? "catalog-unversioned"), operations: [operation], contextWindow: 8192, maxOutputTokens: 1 };
162
+ config.models[entry.id] = previous ? { ...previous, operations: [...new Set([...previous.operations, operation])], backend: "openai-compatible-local" }
163
+ : { provider: "mswarm", catalogId: entry.id, revision: String(entry.raw.revision ?? "catalog-unversioned"), operations: [operation], contextWindow: 8192, maxOutputTokens: 1, backend: "openai-compatible-local" };
160
164
  }
161
165
  config.bindings[binding] = entries.length ? { candidates: entries.map(entry => entry.id) } : { enabled: false };
162
166
  }
@@ -178,7 +182,17 @@ const usageFor = async (resolved) => {
178
182
  return Object.fromEntries(entries);
179
183
  };
180
184
  export const terminalDoctor = async (configPath) => {
181
- const report = { node: process.version, runtimeSupported: Number(process.versions.node.split(".")[0]) >= 20, isolation: executorStatus() };
185
+ const [major, minor] = process.versions.node.split(".").map(Number);
186
+ const report = { node: process.version, runtimeSupported: major >= 24 || major === 22 && minor >= 12 || major === 20 && minor >= 19, isolation: executorStatus() };
187
+ report.deterministicTools = await inspectDeterministicRuntime();
188
+ report.documentTools = await inspectDocumentRuntime();
189
+ report.tnl = await inspectTnlCredential();
190
+ try {
191
+ report.browser = { available: true, executable: await resolveBrowserBinary(), mode: "browser-use worker with isolated Chrome" };
192
+ }
193
+ catch {
194
+ report.browser = { available: false, action: "Install Chrome/Chromium or set CODALI_BROWSER_PATH" };
195
+ }
182
196
  report.nodeToolchain = discoverHostToolchain(process.cwd()).map(runtime => ({ name: runtime.name, executable: runtime.executable, readOnlyRoot: runtime.readOnlyRoot }));
183
197
  try {
184
198
  const resolved = await loadOrchestrationConfig(configPath);
@@ -307,6 +321,9 @@ export class TerminalCommand {
307
321
  output({ valid: true, source: resolved.source, hash: resolved.hash });
308
322
  return;
309
323
  }
324
+ const workspacePermissions = new WorkspacePermissions(args.workspaceRoot);
325
+ if (!argv.includes("--permissions") && !argv.includes("--permission-profile"))
326
+ args.permissions = await workspacePermissions.read() ?? args.permissions;
310
327
  const interactive = ["chat", "resume"].includes(args.command) && !!process.stdin.isTTY && !args.json;
311
328
  let rl;
312
329
  let pendingApproval;
@@ -334,7 +351,7 @@ export class TerminalCommand {
334
351
  });
335
352
  };
336
353
  const textStream = new TerminalTextStream();
337
- const controller = new SessionController({ workspaceRoot: await fs.realpath(args.workspaceRoot), resolved, effort: args.effort, permissions: args.permissions, approve, allowWeb: args.allowWeb, allowMemory: args.allowMemory, allowMedia: args.allowMedia, allowNetwork: args.allowNetwork,
354
+ const controller = new SessionController({ workspaceRoot: await fs.realpath(args.workspaceRoot), resolved, effort: args.effort, permissions: args.permissions, approve, continuous: interactive, allowWeb: args.allowWeb, allowMemory: args.allowMemory, allowMedia: args.allowMedia, allowNetwork: args.allowNetwork,
338
355
  projectTaskKey: args.projectTask, projectTaskAuthority: host.projectTaskAuthority,
339
356
  onEvent: (event) => {
340
357
  if (tui) {
@@ -472,14 +489,20 @@ export class TerminalCommand {
472
489
  output({ session: controller.usageSnapshot(), turn: controller.turnUsageSnapshot(), reconciliation, server: await usageFor(resolved) });
473
490
  }
474
491
  else if (name === "/permissions") {
475
- if (value === "clear")
492
+ const chosen = value || (tui ? await tui.choosePermissions(controller.gate.profile) : undefined);
493
+ if (closed || commandEpoch !== cancelEpoch || (!chosen && tui))
494
+ return;
495
+ if (chosen === "clear")
496
+ await controller.clearPermissionGrants();
497
+ else if (chosen) {
498
+ if (!["plan", "ask", "workspace", "full"].includes(chosen))
499
+ throw new Error("Expected plan, ask, workspace, full or clear");
500
+ await workspacePermissions.save(chosen);
501
+ controller.gate.setProfile(chosen);
476
502
  await controller.clearPermissionGrants();
477
- else if (value) {
478
- if (!["plan", "ask", "workspace"].includes(value))
479
- throw new Error("Expected plan, ask, workspace or clear");
480
- controller.gate.setProfile(value);
481
503
  }
482
- output(controller.gate.inspect());
504
+ output({ ...controller.gate.inspect(), directory: controller.workspaceRoot, savedProfile: await workspacePermissions.read(),
505
+ help: "/permissions full saves automatic approvals for this directory. /permissions ask restores prompts. CLI --permissions overrides one launch." });
483
506
  }
484
507
  else if (name === "/effort") {
485
508
  if (value) {
@@ -616,6 +639,16 @@ export class TerminalCommand {
616
639
  output({ conversation: controller.conversationSnapshot(), goal: controller.state, configHash: resolved.hash });
617
640
  else if (name === "/diff")
618
641
  output(await controller.diff());
642
+ else if (name === "/skills") {
643
+ if (value)
644
+ throw new Error("Usage: /skills. Ask Codali to use a named skill in your next message.");
645
+ if (!controller.busy)
646
+ await controller.skills.refresh();
647
+ const catalog = controller.skills.list();
648
+ const cell = (text) => text.replace(/\|/g, "\\|").replace(/[\r\n]+/g, " ");
649
+ output(["| Skill | Description |", "| --- | --- |", ...catalog.skills.map(skill => `| ${cell(skill.id)} | ${cell(skill.description)} |`),
650
+ ...(!catalog.skills.length ? ["No skills found."] : []), "", ...catalog.warnings, "", "Ask Codali to use a skill by name. Add SKILL.md folders under .codali/skills or configure skills.directories."].join("\n"));
651
+ }
619
652
  else if (name === "/tools")
620
653
  output(controller.registry.list().map(tool => ({ name: tool.name, description: tool.description })));
621
654
  else if (name === "/mcp")
@@ -18,6 +18,12 @@ export declare class TerminalInput extends Transform {
18
18
  maxPasteBytes?: number;
19
19
  onEscape?: () => void;
20
20
  onWheel?: (direction: -1 | 1) => void;
21
+ onMouse?: (event: {
22
+ button: number;
23
+ x: number;
24
+ y: number;
25
+ release: boolean;
26
+ }) => void;
21
27
  });
22
28
  private append;
23
29
  private forward;
@@ -1 +1 @@
1
- {"version":3,"file":"TerminalInput.d.ts","sourceRoot":"","sources":["../../src/cli/TerminalInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAS/C,qFAAqF;AACrF,qBAAa,aAAc,SAAQ,SAAS;IAU9B,OAAO,CAAC,QAAQ,CAAC,OAAO;IATpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAAC,CAAiB;IACrC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAM;gBACG,OAAO,EAAE;QAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;KAAE;IACrM,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,OAAO;IAmBN,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,QAA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E,CAAC,KAAK,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,OAAO,CAAA;SAAE,KAAK,IAAI,CAAA;KAAE;IAC5R,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,OAAO;IAoBf,OAAO,CAAC,OAAO;IAmBN,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAevF,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAQzC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI;CACvF;AAED,kGAAkG;AAClG,eAAO,MAAM,mBAAmB,GAAI,UAAU,SAAS,EAAE,MAAM,MAAM,KAAG,IAOvE,CAAC"}
@@ -32,13 +32,15 @@ export class TerminalInput extends Transform {
32
32
  this.pasted += text;
33
33
  }
34
34
  forward(text) {
35
- if (this.options.onWheel) {
35
+ if (this.options.onWheel || this.options.onMouse) {
36
36
  text = this.mousePending + text;
37
37
  this.mousePending = "";
38
38
  text = text.replace(/\x1b\[<(\d+);(\d+);(\d+)([Mm])/g, (_match, code, _x, _y, end) => {
39
39
  const button = Number(code);
40
40
  if (end === "M" && (button & 64) && (button & 3) < 2)
41
41
  this.options.onWheel?.((button & 1) ? 1 : -1);
42
+ else if (!(button & 64))
43
+ this.options.onMouse?.({ button, x: Number(_x) - 1, y: Number(_y) - 1, release: end === "m" });
42
44
  return "";
43
45
  });
44
46
  const partial = /\x1b\[<[0-9;]{0,40}$/.exec(text);
@@ -1 +1 @@
1
- {"version":3,"file":"ToolsCommand.d.ts","sourceRoot":"","sources":["../../src/cli/ToolsCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,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AmCxD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,KAAG,YAqC/C,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACnE,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,KAAK,YAAY,CAAC;IACjF,SAAS,CAAC,EAAE,OAAO,cAAc,CAAC;IAClC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAkBD,eAAO,MAAM,QAAQ,GACnB,MAAM,MAAM,EAAE,EACd,OAAM,iBAAsB,KAC3B,OAAO,CAAC,MAAM,CA6JhB,CAAC;AAEF,eAAO,MAAM,YAAY;cACP,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAIzC,CAAC"}
@@ -8,6 +8,7 @@ import { ToolRegistry } from "../tools/ToolRegistry.js";
8
8
  import { createDocdexTools } from "../tools/docdex/DocdexTools.js";
9
9
  import { sanitizeArgs } from "../gateway/GatewayTracer.js";
10
10
  import { inspectToolSurface } from "../gateway/ToolSurface.js";
11
+ import { runDeterministicRuntimeCommand } from "../tools/deterministic/DeterministicRuntime.js";
11
12
  /**
12
13
  * `codali tools` — inspect what an orchestration run can actually reach.
13
14
  *
@@ -15,13 +16,17 @@ import { inspectToolSurface } from "../gateway/ToolSurface.js";
15
16
  * exposes is to ask a question and read the trace, which conflates connector
16
17
  * problems with planning problems.
17
18
  */
18
- const HELP = `Usage: codali tools <list|describe|call|health> [options]
19
+ const HELP = `Usage: codali tools <list|describe|call|health|install|check> [options]
19
20
 
20
21
  Commands:
21
22
  list List every tool available to a run, grouped by capability
22
23
  describe <name> Show one tool's description and argument schema
23
24
  call <name> Invoke a tool directly (read-only connectors)
24
25
  health Show MCP server connection status
26
+ install Install pinned host Python tools, then run their checks
27
+ check Check deterministic tools without inference (--documents: document tools)
28
+
29
+ Host install/check commands accept only --json; they do not use tenant context.
25
30
 
26
31
  Options:
27
32
  --workspace-root <path> Repository to resolve config against (default: cwd)
@@ -88,6 +93,8 @@ export const runTools = async (argv, deps = {}) => {
88
93
  write(HELP);
89
94
  return 0;
90
95
  }
96
+ if (["install", "check"].includes(argv[0]))
97
+ return runDeterministicRuntimeCommand(argv, write);
91
98
  const options = parseToolsArgs(argv);
92
99
  // A host-supplied context answers the question a product actually has: not
93
100
  // "what can this machine do" but "what would this tenant's run get".
@@ -0,0 +1,6 @@
1
+ export declare const terminalLogo: string[];
2
+ export declare const plainTerminalLogo: string[];
3
+ export declare const terminalLogoWidth: number;
4
+ export declare const compactTerminalLogo: string[];
5
+ export declare const renderCompactLogo: (color: boolean) => string[];
6
+ //# sourceMappingURL=TerminalLogo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TerminalLogo.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/TerminalLogo.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY,UAAuD,CAAC;AACjF,eAAO,MAAM,iBAAiB,UAAqE,CAAC;AACpG,eAAO,MAAM,iBAAiB,QAA4C,CAAC;AAE3E,eAAO,MAAM,mBAAmB,UAA+D,CAAC;AAChG,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,MAAM,EAOxD,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { stripVTControlCharacters } from "node:util";
2
+ import { cells } from "./TerminalCells.js";
3
+ // Trusted, user-supplied artwork. Decode only SGR color markers, never input data.
4
+ const artwork = `[0;37m [0;35m▄[0;95m▄▄▄▄▄▄[0;35m▄[0;37m [0;35m▄[0;37m [0;35m▄[0;95m▄[0;95;45m▄[0;37m [0;95m█▄[0;35m▄[0;37m [0m
5
+ [0;37m [0;35m▄[0;95;45m▄[0;95m██[0;95;47m▓▀▀▀[0;95m██[0;95;45m▓▄[0;95m▄[0;37m [0;35m▄[0;95;45m▄▓[0;95m████[0;95;45m▄[0;95m▄[0;35m▄[0;37m [0;35m▄[0;95m▄[0;95;45m▄[0;95m██[0;95;45m▄[0;35m▄[0;37m [0;95;45m░[0;95m████▌[0;37m [0;35m▐[0;95m███[0;95;45m▄[0;35m▄[0;37m [0;35m▄▄[0;95m▄[0;95;45m▄▄▓[0;37m [0m
6
+ [0;37m [0;35m▄[0;95;45m▄[0;95m███[0;95;47m▄[0;95m████[0;95;47m▓▄[0;95m██▀[0;37m [0;35m▄[0;95;45m▄[0;95m████[0;95;47m▄▓[0;95m████[0;35m█[0;37m [0;95m███[0;95;45m▒[0;95;47m▄▓[0;95m██[0;95;45m▄[0;35m▄[0;37m [0;95m█[0;95;45m▓[0;97;45m▄[0;97m█[0;97;45m▓[0;95m█▌[0;37m [0;35m▐[0;95m█[0;95;45m▄[0;95m███[0;37m [0;95m▐███[0;95;45m▄[0;95m█[0;37m [0m
7
+ [0;95m▐█[0;97;45m▄[0;97m█[0;97;45m▓[0;95m█▀[0;37m [0;95m▀▀█[0;37m [0;95;41m▒[0;95;45m▓[0;97m██[0;95;47m▓[0;95m▀[0;37m [0;95m▀█[0;97;45m▄[0;97m█[0;95m█[0;37m [0;95m█[0;97;45m▓[0;97m█[0;97;45m▄[0;95m█▀███[0;95;47m▓▓[0;95;45m▄▄[0;37m [0;95m▐█[0;97m█████[0;95;45m▓[0;95m▌[0;37m [0;95m▐█[0;97;45m▄[0;97m█[0;97;45m▓[0;95m█[0;35m▌[0;37m [0;95m▐█[0;97;45m▓[0;97m█[0;97;45m▄[0;95m█[0;37m [0m
8
+ [0;37m [0;97;47m▐[0;97m███[0;97;47m▓[0;37m [0;97;41m░[0;97;47m▓[0;97m███[0;37m▌ [0;97;47m▐[0;97m██[0;97;45m▓[0;37m▌[0;97;47m▐[0;97m████[0;37m [0;95;41m▀[0;95;47m▒▒[0;97;47m▒▒[0;95;41m▓[0;37m [0;31;47m░[0;97m███████[0;97;47m▌[0;37m [0;35m▐[0;97;47m▐[0;97m███[0;97;47m▓[0;35m▌[0;37m ▐[0;97;47m▓[0;97m███[0;97;47m▌[0;37m [0m
9
+ [0;37m▐[0;97m██[0;34m██[0;97m█[0;97;47m▌[0;37m ▐[0;97m████[0;97;47m▌[0;37m [0;97;47m▐[0;97m███[0;97;47m▌[0;37m▐[0;97m████[0;37m▌ [0;97;47m▐▓▓[0;97m█[0;97;41m▓[0;37m ▐[0;97m███[0;97;47m▓[0;37m [0;97m▀███[0;97;47m▌[0;37m ▐[0;97m██[0;34m██[0;97m█[0;97;47m▌[0;37m ▐[0;97m████[0;97;47m▌[0;37m▌[0m
10
+ [0;37m [0;92;47m▐[0;92m█[0;92;46m▄▄[0;97m██[0;97;47m▄[0;37m▄ [0;97;47m▐[0;97m███[0;97;47m▓[0;37m▄ [0;97m▐[0;97;47m▓[0;97m██[0;97;47m▌[0;37m [0;97;47m▐[0;97m███[0;97;47m▌[0;37m ▐[0;97m███[0;97;47m▌[0;37m [0;97;47m▐[0;97m██████████[0;37m▌ [0;92;47m▐[0;92m█[0;92;46m▄▄[0;97m██[0;97;47m▄[0;37m▄ [0;97;47m▐[0;97m███[0;97;47m▌[0;37m [0m
11
+ [0;37m ▀[0;97;47m▐[0;93m██[0;97m███[0;97;47m▓[0;97m████[0;97;43m▓░[0;33m█[0;37m [0;93m▀██[0;97m███[0;97;47m▓[0;97m██████[0;93m█[0;37m [0;97;47m▐[0;97m███[0;97;47m▄[0;97m▄▄▄[0;97;47m▄[0;97m███[0;97;47m▌[0;37m [0;93m▐█[0;97m██[0;93m██[0;97m█▀██[0;97;47m▓[0;97m██[0;37m▌ ▀[0;97;47m▐[0;93m██[0;97m███[0;97;47m▓[0;97m████[0;97;43m▓░[0;33m█[0;37m [0;93m██[0;97m██[0;93m█[0;37m [0m
12
+ [0;37m [0;93m▀▀▀[0;93;43m▀[0;93m██████[0;93;43m▓[0;37m [0;93m▀▀▀[0;93;43m▀[0;93m████[0;93;43m▀[0;93m▀[0;37m [0;93m▐[0;93;47m▓[0;93m███████[0;93;43m▀[0;93m▀▀[0;37m [0;93;43m▀▓[0;93m█[0;93;47m▓[0;37m [0;93m▐█[0;97m██[0;93m██[0;37m [0;93m▀▀▀[0;93;43m▀[0;93m██████[0;93;43m▓[0;37m [0;33m▐[0;93;43m▀[0;93m███[0;37m [0m
13
+ [0;37m [0;33m▀[0;93m▀▀▀[0;37m [0;93m█[0;93;43m▀[0;93m▀▀[0;33m▀[0;37m [0m`;
14
+ export const terminalLogo = artwork.replace(/\[[0-9;]+m/g, "\x1b$&").split("\n");
15
+ export const plainTerminalLogo = terminalLogo.map(line => stripVTControlCharacters(line).trimEnd());
16
+ export const terminalLogoWidth = Math.max(...plainTerminalLogo.map(cells));
17
+ export const compactTerminalLogo = ["┏┓ ┏┓ ┳┓ ┏┓ ┓ ∙", "┃ ┃┃ ┃┃ ┣┫ ┃ ┃", "┗┛ ┗┛ ┻┛ ┛┗ ┗┛ ┻"];
18
+ export const renderCompactLogo = (color) => {
19
+ if (!color)
20
+ return [...compactTerminalLogo];
21
+ return compactTerminalLogo.map(line => [...line].map((character, index) => {
22
+ const fraction = index / (line.length - 1);
23
+ const red = Math.round(255 - 95 * fraction), green = Math.round(130 - 40 * fraction), blue = Math.round(215 + 25 * fraction);
24
+ return `\x1b[38;2;${red};${green};${blue}m${character}`;
25
+ }).join("") + "\x1b[0m");
26
+ };
@@ -0,0 +1,5 @@
1
+ /** Pipes inside code spans and escaped pipes are cell content, not separators. */
2
+ export declare const splitTableRow: (line: string) => string[];
3
+ /** Render Markdown blocks before wrapping; no source text becomes terminal control. */
4
+ export declare const markdownRows: (text: string, width: number) => string[];
5
+ //# sourceMappingURL=TerminalMarkdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TerminalMarkdown.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/TerminalMarkdown.ts"],"names":[],"mappings":"AAGA,kFAAkF;AAClF,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAAM,EAoBlD,CAAC;AA6CF,uFAAuF;AACvF,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAAM,EAwBhE,CAAC"}
@@ -0,0 +1,118 @@
1
+ import { terminalText } from "../TerminalText.js";
2
+ import { cells, padCells, wrapCells } from "./TerminalCells.js";
3
+ /** Pipes inside code spans and escaped pipes are cell content, not separators. */
4
+ export const splitTableRow = (line) => {
5
+ const input = line.trim(), result = [];
6
+ let current = "", ticks = 0;
7
+ for (let i = 0; i < input.length;) {
8
+ const character = input[i];
9
+ if (character === "\\" && i + 1 < input.length) {
10
+ current += input[i + 1] === "|" ? "|" : input.slice(i, i + 2);
11
+ i += 2;
12
+ }
13
+ else if (character === "`") {
14
+ let end = i + 1;
15
+ while (input[end] === "`")
16
+ end++;
17
+ const count = end - i;
18
+ if (!ticks)
19
+ ticks = count;
20
+ else if (ticks === count)
21
+ ticks = 0;
22
+ current += input.slice(i, end);
23
+ i = end;
24
+ }
25
+ else if (character === "|" && !ticks) {
26
+ result.push(current.trim());
27
+ current = "";
28
+ i++;
29
+ }
30
+ else {
31
+ current += character;
32
+ i++;
33
+ }
34
+ }
35
+ result.push(current.trim());
36
+ if (result.length > 1 && result[0] === "")
37
+ result.shift();
38
+ if (result.length > 1 && result.at(-1) === "")
39
+ result.pop();
40
+ return result;
41
+ };
42
+ const plainCell = (value) => value
43
+ .replace(/(`+)(.*?)\1/g, "$2")
44
+ .replace(/\*\*([^*]+)\*\*/g, "$1")
45
+ .replace(/<br\s*\/?\s*>/gi, "\n");
46
+ const tableRows = (header, body, separators, width) => {
47
+ const records = [header, ...body].map(row => row.map(plainCell));
48
+ const count = header.length, space = width - 3 * count - 1;
49
+ if (space < count * 7) {
50
+ // A narrow screen shows each record as labeled fields instead of dropping
51
+ // columns or squeezing words into unreadable one-character cells.
52
+ if (!body.length)
53
+ return records[0].flatMap(value => wrapCells(value, width));
54
+ return records.slice(1).flatMap((record, index) => [
55
+ ...(index ? ["─".repeat(width)] : []),
56
+ ...record.flatMap((value, column) => wrapCells(`${records[0][column] || `Column ${column + 1}`}: ${value}`, width)),
57
+ ]);
58
+ }
59
+ const widths = header.map((_, column) => Math.min(space, records.reduce((largest, record) => Math.max(largest, ...record[column].split("\n").map(cells)), 3)));
60
+ while (widths.reduce((sum, value) => sum + value, 0) > space) {
61
+ const largest = Math.max(...widths);
62
+ widths[widths.indexOf(largest)]--;
63
+ }
64
+ const border = (left, joint, right) => left + widths.map(value => "─".repeat(value + 2)).join(joint) + right;
65
+ const aligned = (value, column) => {
66
+ const padding = Math.max(0, widths[column] - cells(value));
67
+ if (separators[column].endsWith(":")) {
68
+ const left = separators[column].startsWith(":") ? Math.floor(padding / 2) : padding;
69
+ return " ".repeat(left) + value + " ".repeat(padding - left);
70
+ }
71
+ return padCells(value, widths[column]);
72
+ };
73
+ const lines = [border("┌", "┬", "┐")];
74
+ records.forEach((record, index) => {
75
+ const wrapped = record.map((value, column) => wrapCells(value, widths[column]));
76
+ for (let line = 0; line < Math.max(...wrapped.map(value => value.length)); line++) {
77
+ lines.push("│ " + wrapped.map((value, column) => aligned(value[line] ?? "", column)).join(" │ ") + " │");
78
+ }
79
+ if (index === 0)
80
+ lines.push(border("├", "┼", "┤"));
81
+ });
82
+ lines.push(border("└", "┴", "┘"));
83
+ return lines;
84
+ };
85
+ /** Render Markdown blocks before wrapping; no source text becomes terminal control. */
86
+ export const markdownRows = (text, width) => {
87
+ width = Math.max(1, Math.floor(width));
88
+ const source = terminalText(text).replace(/\t/g, " ").split("\n"), rows = [];
89
+ let fence = "";
90
+ for (let i = 0; i < source.length; i++) {
91
+ const line = source[i], marker = /^\s{0,3}(`{3,}|~{3,})/.exec(line)?.[1];
92
+ if (marker) {
93
+ if (!fence)
94
+ fence = marker;
95
+ else if (marker[0] === fence[0] && marker.length >= fence.length)
96
+ fence = "";
97
+ rows.push(...wrapCells(line, width));
98
+ continue;
99
+ }
100
+ const header = splitTableRow(line), separators = splitTableRow(source[i + 1] ?? "");
101
+ if (!fence && line.includes("|") && header.length <= 16 && header.length === separators.length
102
+ && separators.every(value => /^:?-{3,}:?$/.test(value))) {
103
+ const body = [];
104
+ let end = i + 2;
105
+ for (; end < source.length && source[end].includes("|"); end++) {
106
+ const row = splitTableRow(source[end]);
107
+ if (row.length !== header.length)
108
+ break; // Streaming/malformed rows remain visible as source.
109
+ body.push(row);
110
+ }
111
+ rows.push(...tableRows(header, body, separators, width));
112
+ i = end - 1;
113
+ }
114
+ else
115
+ rows.push(...wrapCells(line, width));
116
+ }
117
+ return rows;
118
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"TerminalPresentation.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/TerminalPresentation.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,MAAM,OAAO,KAAG,MAoB1D,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,MAOpB,CAAC;AAEb,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,MA4B9C,CAAC"}
1
+ {"version":3,"file":"TerminalPresentation.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/TerminalPresentation.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,MAAM,OAAO,KAAG,MA6B1D,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,MAOpB,CAAC;AAEb,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,MA4B9C,CAAC"}
@@ -15,6 +15,15 @@ export const toolActivity = (name, args) => {
15
15
  case "docdex_symbols":
16
16
  case "docdex_ast": return `Understanding the structure of ${file || "the code"}`;
17
17
  case "docdex_impact_graph": return `Checking what depends on ${file || "this code"}`;
18
+ case "docdex_web_research": return query ? `Looking up “${query}” on the web` : "Looking up web sources";
19
+ case "server_time": return `Checking the server clock${data.timezone ? ` in ${fragment(data.timezone)}` : ""}`;
20
+ case "calculate": return `Calculating ${fragment(data.expression)}`;
21
+ case "browser_open": return `Opening ${fragment(data.url)} in the browser`;
22
+ case "browser_read": return "Reading more of the browser page";
23
+ case "skill_list": return "Finding relevant skills";
24
+ case "skill_load": return `Loading ${fragment(data.id) || "a skill"}`;
25
+ case "skill_read": return "Reading a skill reference";
26
+ case "context_read": return "Recovering earlier conversation details";
18
27
  case "work_claim": return "Starting the next task";
19
28
  case "work_verify": return "Reviewing the work and its checks";
20
29
  case "work_complete": return "Checking that every requirement is complete";
@@ -30,9 +39,9 @@ export const terminalHelp = () => [
30
39
  "GET STARTED", " Just type a message. Ask a question, inspect your project, or request a change.", "",
31
40
  "CONVERSATION", " /new Start fresh; keep the saved session", " /sessions Browse saved conversations", " /resume ID Pick up a saved session", " /continue Resume the active work", " /stop Stop safely and keep progress", " /quit Close Codali", "",
32
41
  "WORK & REVIEW", " /status Current workspace and progress", " /goal · /plan · /tasks · /decisions", " /diff Inspect workspace changes", " /review Review the current work", " /artifacts Browse, open or export generated files", "",
33
- "MODELS & LIMITS", " /usage Tokens, model calls and account limits", " /model · /models Inspect or select model routes", " /effort low · medium · high · max", " /permissions plan · ask · workspace", " /config Inspect, validate or reload configuration", "",
34
- "CONTEXT & RECOVERY", " /context · /compact · /checkpoint · /fork", " /tools · /mcp · /docdex", " /reconcile · /reconcile-media · /retention", "",
35
- "KEYBOARD & MOUSE", " Enter Send or queue a message", " Alt+Enter New line (Ctrl+J also works)", " Wheel / PgUp↓ Scroll messages and command views", " Ctrl+End Return to the latest message", " Shift+drag Select text in mouse-aware terminals", " Ctrl+O Show tool details", " Ctrl+P / Ctrl+R Commands / input history", " Tab Complete a command or @file", " Ctrl+S Interrupt and steer", " Esc / Ctrl+C Cancel; Esc also closes views",
42
+ "MODELS & LIMITS", " /usage Tokens, model calls and account limits", " /model · /models Inspect or select model routes", " /effort low · medium · high · max", " /permissions plan · ask · workspace · full (saved per directory)", " /config Inspect, validate or reload configuration", "",
43
+ "CONTEXT & RECOVERY", " /context · /compact · /checkpoint · /fork", " /skills Browse available local skills", " /tools · /mcp · /docdex", " /reconcile · /reconcile-media · /retention", "",
44
+ "KEYBOARD & MOUSE", " Enter / Tab Send/queue; Tab completes /commands", " Alt+Enter New line (Ctrl+J also works)", " Wheel / PgUp↓ Scroll messages and command views", " Ctrl+End Return to the latest message", " Drag Select and auto-copy text (OSC52)", " Ctrl+O Show tool details", " Ctrl+P / Ctrl+R Commands / input history", " Shift+Tab Complete a command or @file", " Ctrl+S Interrupt and steer", " Ctrl+C / Ctrl+Z Cancel work; press again to exit",
36
45
  ].join("\n");
37
46
  export const terminalUsage = (value) => {
38
47
  const data = record(value), usage = record(data.session), turn = record(data.turn);
@@ -35,6 +35,7 @@ export interface TerminalScreenState {
35
35
  overlay?: TerminalOverlay;
36
36
  suggestions?: string[];
37
37
  selectedSuggestion?: number;
38
+ introDismissed?: boolean;
38
39
  }
39
40
  export interface TerminalFrame {
40
41
  lines: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"TerminalScreen.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/TerminalScreen.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC3E,MAAM,WAAW,eAAe;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAAE;AAChH,MAAM,WAAW,eAAe;IAAG,KAAK,EAAE,MAAM,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AAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC/E,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AACD,MAAM,WAAW,aAAa;IAAG,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;CAAE;AAc3I,eAAO,MAAM,oBAAoB,GAAI,OAAO,mBAAmB,EAAE,SAAS,MAAM,EAAE,MAAM,MAAM,EAAE,eAAY,KAAG,aAwF9G,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import { cells, fitCells, padCells, wrapCells } from "./TerminalCells.js";
2
+ import { markdownRows } from "./TerminalMarkdown.js";
3
+ import { terminalLogo, plainTerminalLogo, terminalLogoWidth, renderCompactLogo } from "./TerminalLogo.js";
2
4
  const blockRows = new WeakMap();
3
5
  const overlayRows = new WeakMap();
4
6
  const clipStyled = (text, width) => {
@@ -35,7 +37,12 @@ export const renderTerminalScreen = (state, columns, rows, color = true) => {
35
37
  }
36
38
  const editorRows = Math.min(Math.max(1, draftRows.length), Math.max(1, Math.min(6, rows - 12)));
37
39
  const editorOffset = Math.max(0, cursorLine - editorRows + 1);
38
- const viewportRows = Math.max(1, rows - editorRows - 8);
40
+ const showLogo = !state.introDismissed && !state.blocks.length && !state.scroll && width >= terminalLogoWidth && rows - editorRows >= 23;
41
+ const heading = showLogo ? (color ? terminalLogo : plainTerminalLogo)
42
+ : columns >= 100 && rows >= 28 ? renderCompactLogo(color)
43
+ : [paint("1;36", "◈ CODALI") + dim(` ${fitCells(state.version, width - 10)}`)];
44
+ const headerRows = heading.length + 2;
45
+ const viewportRows = Math.max(1, rows - editorRows - 8 - (heading.length - 1));
39
46
  const transcript = [];
40
47
  for (const block of state.blocks) {
41
48
  const label = block.kind === "user" ? "YOU" : block.kind === "assistant" ? "CODALI" : block.title;
@@ -43,7 +50,7 @@ export const renderTerminalScreen = (state, columns, rows, color = true) => {
43
50
  transcript.push(paint(tone, fitCells(label, width)));
44
51
  let cached = blockRows.get(block);
45
52
  if (!cached || cached.text !== block.text || cached.width !== width) {
46
- cached = { text: block.text, width, rows: wrapCells(block.text.replace(/\t/g, " "), width) };
53
+ cached = { text: block.text, width, rows: markdownRows(block.text, width) };
47
54
  blockRows.set(block, cached);
48
55
  }
49
56
  const content = cached.rows;
@@ -80,7 +87,7 @@ export const renderTerminalScreen = (state, columns, rows, color = true) => {
80
87
  while (view.length < viewportRows)
81
88
  view.push("");
82
89
  const lines = [
83
- " " + paint("1;36", "◈ CODALI") + dim(` ${fitCells(state.version, width - 10)}`),
90
+ ...heading.map(line => " " + line),
84
91
  " " + dim(fitCells(state.workspace + (state.branch ? ` · ${state.branch}` : "") + (state.session ? ` · ${state.session.slice(0, 8)}` : ""), width)),
85
92
  " " + dim("─".repeat(width)),
86
93
  ...view.map(line => " " + line),
@@ -96,14 +103,14 @@ export const renderTerminalScreen = (state, columns, rows, color = true) => {
96
103
  lines.push(" " + paint("36", "╰" + "─".repeat(width - 2) + "╯"));
97
104
  const tokens = state.tokens >= 1000 ? `${(state.tokens / 1000).toFixed(1)}k` : String(state.tokens);
98
105
  lines.push(" " + dim(fitCells(`${state.route || state.profile} · ${state.effort} · ${state.permissions} · ${tokens} tokens`, width)));
99
- lines.push(" " + dim(fitCells(state.busy ? "Enter queue · Ctrl+S steer · Esc cancel · Wheel/PgUp scroll" : "Enter send · Alt+Enter newline · Ctrl+P commands · Wheel/PgUp scroll", width)));
106
+ lines.push(" " + dim(fitCells(state.busy ? "Tab/Enter queue · Ctrl+S steer · Esc cancel · Wheel/PgUp scroll" : "Tab/Enter send · Alt+Enter newline · Ctrl+P commands · Wheel/PgUp scroll", width)));
100
107
  let cursor = { row: editorTop + cursorLine - editorOffset, column: 5 + cursorCell };
101
108
  const overlay = state.overlay;
102
109
  if (overlay) {
103
110
  const bodyWidth = width - 4, available = Math.max(1, rows - 5 - (overlay.choices ? overlay.choices.length + 1 : 0));
104
111
  let cached = overlayRows.get(overlay);
105
112
  if (!cached || cached.lines !== overlay.lines || cached.width !== bodyWidth) {
106
- cached = { lines: overlay.lines, width: bodyWidth, rows: overlay.lines.flatMap(line => wrapCells(line.replace(/\t/g, " "), bodyWidth)) };
113
+ cached = { lines: overlay.lines, width: bodyWidth, rows: markdownRows(overlay.lines.join("\n"), bodyWidth) };
107
114
  overlayRows.set(overlay, cached);
108
115
  }
109
116
  const contents = cached.rows;
@@ -123,7 +130,7 @@ export const renderTerminalScreen = (state, columns, rows, color = true) => {
123
130
  }
124
131
  else if (state.suggestions?.length) {
125
132
  const suggestions = state.suggestions.slice(0, Math.min(5, viewportRows));
126
- const top = 3 + viewportRows - suggestions.length;
133
+ const top = headerRows + viewportRows - suggestions.length;
127
134
  suggestions.forEach((item, i) => { lines[top + i] = " " + paint(i === state.selectedSuggestion ? "7" : "2", padCells(item, width)); });
128
135
  }
129
136
  return { lines: lines.slice(0, rows).map(line => clipStyled(line, columns)), cursor, transcriptRows: transcript.length, viewportRows };
@@ -0,0 +1,15 @@
1
+ export interface CellPosition {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ export declare class TerminalSelection {
6
+ readonly start: CellPosition;
7
+ readonly lines: string[];
8
+ end: CellPosition;
9
+ constructor(lines: string[], start: CellPosition);
10
+ private range;
11
+ text(): string;
12
+ frame(): string[];
13
+ }
14
+ export declare const clipboardSequence: (text: string) => string;
15
+ //# sourceMappingURL=TerminalSelection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TerminalSelection.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/TerminalSelection.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAAG,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;CAAE;AACvD,qBAAa,iBAAiB;IAGC,QAAQ,CAAC,KAAK,EAAE,YAAY;IAFzD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,GAAG,EAAE,YAAY,CAAC;gBACN,KAAK,EAAE,MAAM,EAAE,EAAW,KAAK,EAAE,YAAY;IAGzD,OAAO,CAAC,KAAK;IAIb,IAAI,IAAI,MAAM;IAUd,KAAK,IAAI,MAAM,EAAE;CAMlB;AACD,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MAAyE,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { cells, graphemes } from "./TerminalCells.js";
2
+ import { terminalText } from "../TerminalText.js";
3
+ export class TerminalSelection {
4
+ constructor(lines, start) {
5
+ this.start = start;
6
+ this.lines = lines.map(terminalText);
7
+ this.end = { ...start };
8
+ }
9
+ range(row) {
10
+ const [a, b] = this.start.y < this.end.y || this.start.y === this.end.y && this.start.x <= this.end.x ? [this.start, this.end] : [this.end, this.start];
11
+ return row < a.y || row > b.y ? [0, 0] : [row === a.y ? a.x : 0, row === b.y ? b.x + 1 : Infinity];
12
+ }
13
+ text() {
14
+ const result = [];
15
+ this.lines.forEach((line, row) => {
16
+ const [from, to] = this.range(row);
17
+ if (from === to)
18
+ return;
19
+ let column = 0, selected = "";
20
+ for (const part of graphemes(line)) {
21
+ const width = cells(part);
22
+ if (column < to && column + width > from)
23
+ selected += part;
24
+ column += width;
25
+ }
26
+ result.push(selected.trimEnd());
27
+ });
28
+ return result.join("\n");
29
+ }
30
+ frame() {
31
+ return this.lines.map((line, row) => {
32
+ const [from, to] = this.range(row);
33
+ let column = 0;
34
+ return graphemes(line).map(part => { const width = cells(part), selected = column < to && column + width > from; column += width; return selected ? `\x1b[7m${part}\x1b[27m` : part; }).join("");
35
+ });
36
+ }
37
+ }
38
+ export const clipboardSequence = (text) => `\x1b]52;c;${Buffer.from(text, "utf8").toString("base64")}\x07`;