@galaxy-stack/blackhole-cli 2.0.0-alpha.10

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 (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +133 -0
  3. package/dist/application.d.ts +63 -0
  4. package/dist/application.d.ts.map +1 -0
  5. package/dist/application.js +272 -0
  6. package/dist/application.js.map +1 -0
  7. package/dist/cli-meta.d.ts +15 -0
  8. package/dist/cli-meta.d.ts.map +1 -0
  9. package/dist/cli-meta.js +37 -0
  10. package/dist/cli-meta.js.map +1 -0
  11. package/dist/cli.d.ts +3 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +177 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/composer.d.ts +13 -0
  16. package/dist/composer.d.ts.map +1 -0
  17. package/dist/composer.js +115 -0
  18. package/dist/composer.js.map +1 -0
  19. package/dist/flow.d.ts +44 -0
  20. package/dist/flow.d.ts.map +1 -0
  21. package/dist/flow.js +102 -0
  22. package/dist/flow.js.map +1 -0
  23. package/dist/logs.d.ts +25 -0
  24. package/dist/logs.d.ts.map +1 -0
  25. package/dist/logs.js +80 -0
  26. package/dist/logs.js.map +1 -0
  27. package/dist/memory-import.d.ts +28 -0
  28. package/dist/memory-import.d.ts.map +1 -0
  29. package/dist/memory-import.js +51 -0
  30. package/dist/memory-import.js.map +1 -0
  31. package/dist/options.d.ts +32 -0
  32. package/dist/options.d.ts.map +1 -0
  33. package/dist/options.js +121 -0
  34. package/dist/options.js.map +1 -0
  35. package/dist/sessions.d.ts +16 -0
  36. package/dist/sessions.d.ts.map +1 -0
  37. package/dist/sessions.js +56 -0
  38. package/dist/sessions.js.map +1 -0
  39. package/dist/spill.d.ts +30 -0
  40. package/dist/spill.d.ts.map +1 -0
  41. package/dist/spill.js +44 -0
  42. package/dist/spill.js.map +1 -0
  43. package/dist/terminal-input.d.ts +10 -0
  44. package/dist/terminal-input.d.ts.map +1 -0
  45. package/dist/terminal-input.js +10 -0
  46. package/dist/terminal-input.js.map +1 -0
  47. package/dist/timeline.d.ts +31 -0
  48. package/dist/timeline.d.ts.map +1 -0
  49. package/dist/timeline.js +280 -0
  50. package/dist/timeline.js.map +1 -0
  51. package/dist/tui.d.ts +11 -0
  52. package/dist/tui.d.ts.map +1 -0
  53. package/dist/tui.js +269 -0
  54. package/dist/tui.js.map +1 -0
  55. package/dist/web/command.d.ts +3 -0
  56. package/dist/web/command.d.ts.map +1 -0
  57. package/dist/web/command.js +37 -0
  58. package/dist/web/command.js.map +1 -0
  59. package/dist/web/credentials.d.ts +17 -0
  60. package/dist/web/credentials.d.ts.map +1 -0
  61. package/dist/web/credentials.js +36 -0
  62. package/dist/web/credentials.js.map +1 -0
  63. package/dist/web/doctor.d.ts +4 -0
  64. package/dist/web/doctor.d.ts.map +1 -0
  65. package/dist/web/doctor.js +79 -0
  66. package/dist/web/doctor.js.map +1 -0
  67. package/dist/web/dsh.d.ts +11 -0
  68. package/dist/web/dsh.d.ts.map +1 -0
  69. package/dist/web/dsh.js +59 -0
  70. package/dist/web/dsh.js.map +1 -0
  71. package/dist/web/open-browser.d.ts +3 -0
  72. package/dist/web/open-browser.d.ts.map +1 -0
  73. package/dist/web/open-browser.js +19 -0
  74. package/dist/web/open-browser.js.map +1 -0
  75. package/dist/web/options.d.ts +23 -0
  76. package/dist/web/options.d.ts.map +1 -0
  77. package/dist/web/options.js +154 -0
  78. package/dist/web/options.js.map +1 -0
  79. package/dist/web/paths.d.ts +17 -0
  80. package/dist/web/paths.d.ts.map +1 -0
  81. package/dist/web/paths.js +39 -0
  82. package/dist/web/paths.js.map +1 -0
  83. package/dist/web/web.d.ts +17 -0
  84. package/dist/web/web.d.ts.map +1 -0
  85. package/dist/web/web.js +153 -0
  86. package/dist/web/web.js.map +1 -0
  87. package/package.json +65 -0
  88. package/skills/galaxy-ui/SKILL.md +56 -0
  89. package/skills/galaxy-ui/references/cli-workflows.md +54 -0
  90. package/skills/galaxy-ui/references/component-patterns.md +46 -0
  91. package/skills/galaxy-ui/references/framework-notes.md +35 -0
  92. package/skills/galaxy-ui/references/tailwind.md +23 -0
  93. package/skills/orbit-framework/SKILL.md +126 -0
  94. package/web/brand/client.template.js +217 -0
  95. package/web/brand/favicon.png +0 -0
  96. package/web/brand/lib/client.js +1205 -0
  97. package/web/brand/lib/favicon.js +1 -0
  98. package/web/brand/lib/index.js +143 -0
  99. package/web/brand/logo.png +0 -0
  100. package/web/brand/package.json +35 -0
  101. package/web/brand/vi.locales.json +989 -0
  102. package/web/patches/gbh-brand.patch.yml +13 -0
  103. package/web/patches/gbh-ui.patch.yml +18 -0
  104. package/web/patches/gbh-web.patch.yml +68 -0
@@ -0,0 +1,28 @@
1
+ import type { AgentMemoryPort } from "@galaxy-stack/ai-coder-core/agent";
2
+ export interface QuasarMemoryNode {
3
+ id: string;
4
+ kind: string;
5
+ title: string;
6
+ content_md: string;
7
+ source: string;
8
+ source_ref: string;
9
+ content_hash: string;
10
+ status: string;
11
+ created_at: number;
12
+ }
13
+ export interface QuasarImportResult {
14
+ source: string;
15
+ backup: string;
16
+ imported: number;
17
+ skippedDuplicates: number;
18
+ skippedInvalid: number;
19
+ keys: string[];
20
+ }
21
+ /**
22
+ * E06 migration: copy active Quasar Memory Tree leaves into the agent memory
23
+ * port after creating a timestamped backup copy of the source database. Notes
24
+ * arrive as confirmed user data with preserved provenance; re-running the
25
+ * import is idempotent because identical active content is skipped.
26
+ */
27
+ export declare function importQuasarMemory(memory: AgentMemoryPort, dbPath: string, backupDir: string): Promise<QuasarImportResult>;
28
+ //# sourceMappingURL=memory-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-import.d.ts","sourceRoot":"","sources":["../src/memory-import.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAC5E,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;CAC9E;AACD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;CACrH;AAMD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAqBhI"}
@@ -0,0 +1,51 @@
1
+ import { copyFile, mkdir } from "node:fs/promises";
2
+ import { basename, join } from "node:path";
3
+ import { DatabaseSync } from "node:sqlite";
4
+ /** Stable, provenance-carrying memory keys for migrated Quasar nodes. */
5
+ function memoryKey(node) {
6
+ const base = node.source_ref?.trim() || node.content_hash.slice(0, 16);
7
+ return `quasar/${base}`.slice(0, 256);
8
+ }
9
+ /**
10
+ * E06 migration: copy active Quasar Memory Tree leaves into the agent memory
11
+ * port after creating a timestamped backup copy of the source database. Notes
12
+ * arrive as confirmed user data with preserved provenance; re-running the
13
+ * import is idempotent because identical active content is skipped.
14
+ */
15
+ export async function importQuasarMemory(memory, dbPath, backupDir) {
16
+ await mkdir(backupDir, { recursive: true, mode: 0o700 });
17
+ const backup = join(backupDir, `${basename(dbPath)}.backup-${new Date().toISOString().replaceAll(/[:.]/g, "-")}`);
18
+ await copyFile(dbPath, backup);
19
+ const source = new DatabaseSync(backup, { readOnly: true });
20
+ try {
21
+ const version = source.prepare("SELECT MAX(version) AS v FROM memory_schema_version").get();
22
+ if (!version?.v || version.v > 6)
23
+ throw new Error(`Unsupported Quasar memory schema version: ${version?.v ?? "unknown"}.`);
24
+ const nodes = source.prepare("SELECT id, kind, title, content_md, source, source_ref, content_hash, status FROM memory_tree WHERE status='active' AND kind='leaf' ORDER BY created_at").all();
25
+ let imported = 0;
26
+ let skippedDuplicates = 0;
27
+ let skippedInvalid = 0;
28
+ const keys = [];
29
+ for (const node of nodes) {
30
+ const content = String(node.content_md ?? "");
31
+ const key = memoryKey(node);
32
+ if (!content.trim() || content.length > 16000) {
33
+ skippedInvalid++;
34
+ continue;
35
+ }
36
+ const existing = await memory.history(key);
37
+ if (existing.some(r => r.contentHash !== "" && r.content === content)) {
38
+ skippedDuplicates++;
39
+ continue;
40
+ }
41
+ await memory.remember({ key, content, source: `quasar:${node.source || "unknown"}`, trust: "confirmed" });
42
+ imported++;
43
+ keys.push(key);
44
+ }
45
+ return { source: dbPath, backup, imported, skippedDuplicates, skippedInvalid, keys };
46
+ }
47
+ finally {
48
+ source.close();
49
+ }
50
+ }
51
+ //# sourceMappingURL=memory-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-import.js","sourceRoot":"","sources":["../src/memory-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAU3C,yEAAyE;AACzE,SAAS,SAAS,CAAC,IAAkD;IACnE,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvE,OAAO,UAAU,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC;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C,OAAO,CAAC,IAAI,EAAE,IAAI,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;gBAAC,cAAc,EAAE,CAAC;gBAAC,SAAS;YAAC,CAAC;YAC9E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC3C,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,EAAE,CAAC;gBAAC,iBAAiB,EAAE,CAAC;gBAAC,SAAS;YAAC,CAAC;YACzG,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,IAAI,CAAC,MAAM,IAAI,SAAS,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;YAC1G,QAAQ,EAAE,CAAC;YAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;IACvF,CAAC;YAAS,CAAC;QAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { AgentProfile } from "@galaxy-stack/ai-coder-core/agent";
2
+ export interface CliOptions {
3
+ command: "chat" | "run" | "flow" | "skills" | "memory" | "mcp" | "sessions" | "logs" | "help";
4
+ args: string[];
5
+ workspace: string;
6
+ profile: AgentProfile;
7
+ json: boolean;
8
+ allowTools: string[];
9
+ thinking?: boolean | "low" | "medium" | "high";
10
+ approval: "full" | "balanced";
11
+ noGalaxyMcp?: boolean;
12
+ embeddingBaseUrl?: string;
13
+ embeddingModel?: string;
14
+ model?: string;
15
+ baseUrl?: string;
16
+ config?: string;
17
+ agentConfig?: string;
18
+ stateDir?: string;
19
+ session?: string;
20
+ skillVersion?: string;
21
+ skillsDir?: string;
22
+ skillsIndex?: string;
23
+ flowOut?: string;
24
+ flowStopOnError?: boolean;
25
+ noSystemPromptInHistory?: boolean;
26
+ research?: boolean;
27
+ skillsPublicKey?: string;
28
+ systemPromptInHistory?: boolean;
29
+ }
30
+ export declare function parseOptions(args: readonly string[]): CliOptions;
31
+ export declare const HELP = "Galaxy Code \u2014 CLI / TUI for Galaxy Agent\n\nblackhole chat Interactive terminal UI (default)\nblackhole web [options] Open the Galaxy Blackhole web GUI (DeepSeek Harness)\nblackhole run \"task\" [--json] One task; JSON writes one final result\nblackhole flow <file.json> Run sequential prompts in one session and log each step\nblackhole skills [show <id>] Discover or inspect skills\nblackhole skills search <query> Search a configured skill index\nblackhole skills install <id> Install a skill (--skill-version <range>)\nblackhole skills update Update installed skills\nblackhole skills remove <id> Remove an installed skill\nblackhole mcp Connect configured servers and list tools\nblackhole mcp login <server> Browser login for an HTTP server with auth=oauth\nblackhole mcp logout <server> Forget stored OAuth tokens for a server\nblackhole memory search <query> Recall confirmed workspace notes\nblackhole memory list List notes, including candidates\nblackhole memory consolidate Prune superseded revisions and orphan vectors\nblackhole memory remember <key> <text> Store a user-confirmed note\nblackhole memory confirm <key> Confirm the current candidate\nblackhole memory history <key> Show revisions and provenance\nblackhole memory forget <key> Delete all revisions of a key\nblackhole sessions List conversation sessions\nblackhole logs [n] Show the last n runtime log entries (default 20)\n\nOptions: --version | -v (print the CLI version)\n --no-galaxy-mcp (skip bundled orbit/nebula servers)\n --workspace <dir> --model <id> --base-url <url> --config <legacy-config>\n --agent-config <json> --state-dir <outside-workspace> --session <id>\n --profile coding|assistant|research --allow-tool <canonical-id>\n --approval full|balanced (default full: no permission prompts; balanced asks)\n --thinking auto|on|off|low|medium|high (Ollama/model specific)\n --embedding-model <id> --embedding-base-url <url> (semantic memory; e.g. bge-m3)\n --skills-index <path-or-url> --skills-dir <dir> --skills-public-key <pem> (skill marketplace; --skill-version <range>)\n --system-prompt-in-history | --no-system-prompt-in-history (force on/off; default follows the verified-model list)\n --research (enable Ollama web search/fetch; search_web stays lazy and is discovered via search_tools)\n\nTUI: Enter sends \u00B7 Esc cancels \u00B7 Ctrl+C exits \u00B7 y/n answers a tool permission.\nNoninteractive tool permissions must be explicit; repeat --allow-tool as needed.\nLab: cd ../galaxy-ai-coder-core/testing && npm run dev -- --help\n";
32
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEtE,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IAC9F,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAC;IAC9F,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC7G,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAC/J;AACD,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAoChE;AACD,eAAO,MAAM,IAAI,oxFAsChB,CAAC"}
@@ -0,0 +1,121 @@
1
+ import { resolve } from "node:path";
2
+ export function parseOptions(args) {
3
+ const result = { command: "chat", args: [], workspace: process.cwd(), profile: "coding", json: false, allowTools: [], approval: "full" };
4
+ let command = false;
5
+ const values = { "--model": "model", "--base-url": "baseUrl", "--config": "config", "--agent-config": "agentConfig", "--state-dir": "stateDir", "--session": "session", "--workspace": "workspace", "--embedding-model": "embeddingModel", "--embedding-base-url": "embeddingBaseUrl", "--skills-index": "skillsIndex", "--skills-dir": "skillsDir", "--skill-version": "skillVersion", "--flow-out": "flowOut", "--skills-public-key": "skillsPublicKey" };
6
+ for (let i = 0; i < args.length; i++) {
7
+ const arg = args[i];
8
+ if (arg === "--help" || arg === "-h") {
9
+ result.command = "help";
10
+ continue;
11
+ }
12
+ if (arg === "--json") {
13
+ result.json = true;
14
+ continue;
15
+ }
16
+ if (arg === "--no-galaxy-mcp") {
17
+ result.noGalaxyMcp = true;
18
+ continue;
19
+ }
20
+ if (arg === "--flow-stop-on-error") {
21
+ result.flowStopOnError = true;
22
+ continue;
23
+ }
24
+ if (arg === "--system-prompt-in-history") {
25
+ result.systemPromptInHistory = true;
26
+ continue;
27
+ }
28
+ if (arg === "--research") {
29
+ result.research = true;
30
+ continue;
31
+ }
32
+ if (arg === "--no-system-prompt-in-history") {
33
+ result.noSystemPromptInHistory = true;
34
+ continue;
35
+ }
36
+ if (arg === "--") {
37
+ result.args.push(...args.slice(i + 1));
38
+ break;
39
+ }
40
+ if (values[arg] || arg === "--profile" || arg === "--allow-tool" || arg === "--thinking" || arg === "--approval") {
41
+ const value = args[++i];
42
+ if (!value || value.startsWith("--"))
43
+ throw new Error(`${arg} requires a value.`);
44
+ if (arg === "--thinking") {
45
+ if (!["auto", "on", "off", "low", "medium", "high"].includes(value))
46
+ throw new Error("Invalid thinking setting.");
47
+ if (value !== "auto")
48
+ result.thinking = value === "on" ? true : value === "off" ? false : value;
49
+ }
50
+ else if (arg === "--profile") {
51
+ if (!["coding", "assistant", "research"].includes(value))
52
+ throw new Error("Unknown agent profile.");
53
+ result.profile = value;
54
+ }
55
+ else if (arg === "--approval") {
56
+ if (!["full", "balanced"].includes(value))
57
+ throw new Error("Invalid approval mode.");
58
+ result.approval = value;
59
+ }
60
+ else if (arg === "--allow-tool")
61
+ result.allowTools.push(value);
62
+ else
63
+ result[values[arg]] = value;
64
+ continue;
65
+ }
66
+ if (arg.startsWith("-"))
67
+ throw new Error(`Unknown option: ${arg}`);
68
+ if (!command) {
69
+ if (!["chat", "run", "flow", "skills", "memory", "mcp", "sessions", "logs", "help"].includes(arg))
70
+ throw new Error(`Unknown command: ${arg}`);
71
+ result.command = arg;
72
+ command = true;
73
+ }
74
+ else
75
+ result.args.push(arg);
76
+ }
77
+ result.workspace = resolve(result.workspace);
78
+ if (result.skillsDir)
79
+ result.skillsDir = resolve(result.skillsDir);
80
+ return result;
81
+ }
82
+ export const HELP = `Galaxy Code — CLI / TUI for Galaxy Agent
83
+
84
+ blackhole chat Interactive terminal UI (default)
85
+ blackhole web [options] Open the Galaxy Blackhole web GUI (DeepSeek Harness)
86
+ blackhole run "task" [--json] One task; JSON writes one final result
87
+ blackhole flow <file.json> Run sequential prompts in one session and log each step
88
+ blackhole skills [show <id>] Discover or inspect skills
89
+ blackhole skills search <query> Search a configured skill index
90
+ blackhole skills install <id> Install a skill (--skill-version <range>)
91
+ blackhole skills update Update installed skills
92
+ blackhole skills remove <id> Remove an installed skill
93
+ blackhole mcp Connect configured servers and list tools
94
+ blackhole mcp login <server> Browser login for an HTTP server with auth=oauth
95
+ blackhole mcp logout <server> Forget stored OAuth tokens for a server
96
+ blackhole memory search <query> Recall confirmed workspace notes
97
+ blackhole memory list List notes, including candidates
98
+ blackhole memory consolidate Prune superseded revisions and orphan vectors
99
+ blackhole memory remember <key> <text> Store a user-confirmed note
100
+ blackhole memory confirm <key> Confirm the current candidate
101
+ blackhole memory history <key> Show revisions and provenance
102
+ blackhole memory forget <key> Delete all revisions of a key
103
+ blackhole sessions List conversation sessions
104
+ blackhole logs [n] Show the last n runtime log entries (default 20)
105
+
106
+ Options: --version | -v (print the CLI version)
107
+ --no-galaxy-mcp (skip bundled orbit/nebula servers)
108
+ --workspace <dir> --model <id> --base-url <url> --config <legacy-config>
109
+ --agent-config <json> --state-dir <outside-workspace> --session <id>
110
+ --profile coding|assistant|research --allow-tool <canonical-id>\n --approval full|balanced (default full: no permission prompts; balanced asks)
111
+ --thinking auto|on|off|low|medium|high (Ollama/model specific)
112
+ --embedding-model <id> --embedding-base-url <url> (semantic memory; e.g. bge-m3)
113
+ --skills-index <path-or-url> --skills-dir <dir> --skills-public-key <pem> (skill marketplace; --skill-version <range>)
114
+ --system-prompt-in-history | --no-system-prompt-in-history (force on/off; default follows the verified-model list)
115
+ --research (enable Ollama web search/fetch; search_web stays lazy and is discovered via search_tools)
116
+
117
+ TUI: Enter sends · Esc cancels · Ctrl+C exits · y/n answers a tool permission.
118
+ Noninteractive tool permissions must be explicit; repeat --allow-tool as needed.
119
+ Lab: cd ../galaxy-ai-coder-core/testing && npm run dev -- --help
120
+ `;
121
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;A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GAAG,IAAI,CAAC;QAChE,CAAC;;YAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,SAAS;QAAE,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACnE,OAAO,MAAM,CAAC;AAChB,CAAC;AACD,MAAM,CAAC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCnB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare class Sessions {
2
+ private readonly scope;
3
+ private readonly db;
4
+ private held;
5
+ constructor(path: string, scope: string);
6
+ private readonly token;
7
+ acquire(session: string): void;
8
+ history(session: string): {
9
+ role: string;
10
+ content: string;
11
+ }[];
12
+ append(session: string, role: "user" | "assistant", content: string): void;
13
+ list(): Record<string, import("node:sqlite").SQLOutputValue>[];
14
+ close(): void;
15
+ }
16
+ //# sourceMappingURL=sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../src/sessions.ts"],"names":[],"mappings":"AAEA,qBAAa,QAAQ;IAGO,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFhD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAe;IAClC,OAAO,CAAC,IAAI,CAAqB;gBACrB,IAAI,EAAE,MAAM,EAAmB,KAAK,EAAE,MAAM;IAMxD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAe9B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE;IAI7D,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAI1E,IAAI;IACJ,KAAK,IAAI,IAAI;CACd"}
@@ -0,0 +1,56 @@
1
+ import { DatabaseSync } from "node:sqlite";
2
+ import { randomUUID } from "node:crypto";
3
+ export class Sessions {
4
+ scope;
5
+ db;
6
+ held;
7
+ constructor(path, scope) {
8
+ this.scope = scope;
9
+ this.db = new DatabaseSync(path);
10
+ this.db.exec(`PRAGMA busy_timeout=5000; PRAGMA journal_mode=WAL;
11
+ CREATE TABLE IF NOT EXISTS chat_turns(id INTEGER PRIMARY KEY,scope TEXT NOT NULL,session TEXT NOT NULL,role TEXT NOT NULL,content TEXT NOT NULL,created TEXT NOT NULL);
12
+ CREATE TABLE IF NOT EXISTS chat_locks(scope TEXT NOT NULL,session TEXT NOT NULL,pid INTEGER NOT NULL,token TEXT NOT NULL,PRIMARY KEY(scope,session));`);
13
+ }
14
+ token = randomUUID();
15
+ acquire(session) {
16
+ if (!/^[a-zA-Z0-9_-]{1,100}$/.test(session))
17
+ throw new Error("Session id must use letters, digits, underscores or hyphens (max 100).");
18
+ this.db.exec("BEGIN IMMEDIATE");
19
+ try {
20
+ const lock = this.db.prepare("SELECT pid FROM chat_locks WHERE scope=? AND session=?").get(this.scope, session);
21
+ if (lock) {
22
+ let active = true;
23
+ try {
24
+ process.kill(Number(lock.pid), 0);
25
+ }
26
+ catch (e) {
27
+ if (e.code === "ESRCH")
28
+ active = false;
29
+ }
30
+ if (active)
31
+ throw new Error("This session is already open in another running process. Use a new --session.");
32
+ this.db.prepare("DELETE FROM chat_locks WHERE scope=? AND session=?").run(this.scope, session);
33
+ }
34
+ this.db.prepare("INSERT INTO chat_locks VALUES(?,?,?,?)").run(this.scope, session, process.pid, this.token);
35
+ this.db.exec("COMMIT");
36
+ this.held = session;
37
+ }
38
+ catch (e) {
39
+ this.db.exec("ROLLBACK");
40
+ throw e;
41
+ }
42
+ }
43
+ history(session) {
44
+ const rows = this.db.prepare("SELECT role,content FROM chat_turns WHERE scope=? AND session=? ORDER BY id DESC LIMIT 20").all(this.scope, session).reverse();
45
+ return rows.map(r => ({ role: String(r.role), content: String(r.content).slice(-8000) }));
46
+ }
47
+ append(session, role, content) {
48
+ if (this.held !== session)
49
+ throw new Error("Session must be acquired before writing.");
50
+ this.db.prepare("INSERT INTO chat_turns(scope,session,role,content,created) VALUES(?,?,?,?,?)").run(this.scope, session, role, content, new Date().toISOString());
51
+ }
52
+ list() { return this.db.prepare("SELECT session,MAX(created) AS updated,COUNT(*) AS messages FROM chat_turns WHERE scope=? GROUP BY session ORDER BY updated DESC").all(this.scope); }
53
+ close() { if (this.held)
54
+ this.db.prepare("DELETE FROM chat_locks WHERE scope=? AND session=? AND token=?").run(this.scope, this.held, this.token); this.db.close(); }
55
+ }
56
+ //# sourceMappingURL=sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.js","sourceRoot":"","sources":["../src/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,MAAM,OAAO,QAAQ;IAGwB;IAF1B,EAAE,CAAe;IAC1B,IAAI,CAAqB;IACjC,YAAY,IAAY,EAAmB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QACtD,IAAI,CAAC,EAAE,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;;4JAE2I,CAAC,CAAC;IAC5J,CAAC;IACgB,KAAK,GAAG,UAAU,EAAE,CAAC;IACtC,OAAO,CAAC,OAAe;QACrB,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;QACvI,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAChC,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AAC,OAAO,EAAE,CAAC;QAC7J,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5F,CAAC;IACD,MAAM,CAAC,OAAe,EAAE,IAA0B,EAAE,OAAe;QACjE,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QACvF,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,8EAA8E,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IACpK,CAAC;IACD,IAAI,KAAK,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,kIAAkI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtL,KAAK,KAAW,IAAI,IAAI,CAAC,IAAI;QAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,gEAAgE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC5K"}
@@ -0,0 +1,30 @@
1
+ import type { AiCoderToolOutputSpill } from "@galaxy-stack/ai-coder-core/context";
2
+ export interface SpillArtifact {
3
+ id: string;
4
+ mimeType: string;
5
+ }
6
+ /**
7
+ * Persists oversized tool output outside the model-writable workspace so the
8
+ * bounded context can reference `artifact://<id>` and the agent can read the
9
+ * full text back on demand through the read-only artifact.read tool.
10
+ */
11
+ export declare class FileToolOutputSpill implements AiCoderToolOutputSpill {
12
+ private readonly stateDir;
13
+ private sequence;
14
+ constructor(stateDir: string);
15
+ private runDir;
16
+ write(input: Readonly<{
17
+ content: string;
18
+ contentType?: string;
19
+ runId: string;
20
+ toolCallId: string;
21
+ toolName: string;
22
+ }>): Promise<SpillArtifact>;
23
+ /** Reads a spill artifact back; ids are sanitized so traversal cannot escape the spill dir. */
24
+ read(runId: string, id: string, offset?: number, length?: number): Promise<{
25
+ content: string;
26
+ truncated: boolean;
27
+ }>;
28
+ totalSize(): Promise<number>;
29
+ }
30
+ //# sourceMappingURL=spill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spill.d.ts","sourceRoot":"","sources":["../src/spill.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAElF,MAAM,WAAW,aAAa;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AAE/D;;;;GAIG;AACH,qBAAa,mBAAoB,YAAW,sBAAsB;IAEpD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IADrC,OAAO,CAAC,QAAQ,CAAK;gBACQ,QAAQ,EAAE,MAAM;IAC7C,OAAO,CAAC,MAAM;IACR,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAQpJ,+FAA+F;IACzF,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,SAAI,EAAE,MAAM,SAAS,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAO9G,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;CASnC"}
package/dist/spill.js ADDED
@@ -0,0 +1,44 @@
1
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ const MAX_SPILL_BYTES = 8 * 1024 * 1024;
4
+ /**
5
+ * Persists oversized tool output outside the model-writable workspace so the
6
+ * bounded context can reference `artifact://<id>` and the agent can read the
7
+ * full text back on demand through the read-only artifact.read tool.
8
+ */
9
+ export class FileToolOutputSpill {
10
+ stateDir;
11
+ sequence = 0;
12
+ constructor(stateDir) {
13
+ this.stateDir = stateDir;
14
+ }
15
+ runDir(runId) { return join(this.stateDir, "spill", runId.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 96)); }
16
+ async write(input) {
17
+ const dir = this.runDir(input.runId);
18
+ await mkdir(dir, { recursive: true, mode: 0o700 });
19
+ const id = `${input.toolCallId.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 64)}-${this.sequence += 1}`;
20
+ const bounded = input.content.length > MAX_SPILL_BYTES ? input.content.slice(0, MAX_SPILL_BYTES) : input.content;
21
+ await writeFile(join(dir, `${id}.log`), bounded, { encoding: "utf8", mode: 0o600 });
22
+ return { id, mimeType: input.contentType ?? "text/plain" };
23
+ }
24
+ /** Reads a spill artifact back; ids are sanitized so traversal cannot escape the spill dir. */
25
+ async read(runId, id, offset = 0, length = 16_000) {
26
+ if (!/^[A-Za-z0-9._-]{1,80}$/.test(id))
27
+ throw new Error("Invalid artifact id.");
28
+ const safeRunId = runId.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 96);
29
+ const content = await readFile(join(this.stateDir, "spill", safeRunId, `${id}.log`), "utf8");
30
+ const slice = content.slice(offset, offset + length);
31
+ return { content: slice, truncated: offset + length < content.length };
32
+ }
33
+ async totalSize() {
34
+ const { readdir, stat } = await import("node:fs/promises");
35
+ let total = 0;
36
+ for (const run of await readdir(join(this.stateDir, "spill"), { recursive: true }).catch(() => [])) {
37
+ const info = await stat(join(this.stateDir, "spill", run)).catch(() => undefined);
38
+ if (info?.isFile())
39
+ total += info.size;
40
+ }
41
+ return total;
42
+ }
43
+ }
44
+ //# sourceMappingURL=spill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spill.js","sourceRoot":"","sources":["../src/spill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACxC;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IAED;IADrB,QAAQ,GAAG,CAAC,CAAC;IACrB,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IACzC,MAAM,CAAC,KAAa,IAAY,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACnI,KAAK,CAAC,KAAK,CAAC,KAA+G;QACzH,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACnD,MAAM,EAAE,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,CAAC;QACrG,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,e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;QACd,KAAK,MAAM,GAAG,IAAI,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAc,CAAC,EAAE,CAAC;YAC/G,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAClF,IAAI,IAAI,EAAE,MAAM,EAAE;gBAAE,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC;QACzC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ /** SGR mouse reports arrive with their leading ESC removed by Ink's useInput. */
2
+ export declare function parseMouseInput(input: string): {
3
+ button: number;
4
+ column: number;
5
+ row: number;
6
+ released: boolean;
7
+ } | undefined;
8
+ export declare const ENABLE_MOUSE = "\u001B[?1000h\u001B[?1006h";
9
+ export declare const DISABLE_MOUSE = "\u001B[?1006l\u001B[?1000l";
10
+ //# sourceMappingURL=terminal-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-input.d.ts","sourceRoot":"","sources":["../src/terminal-input.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAI7H;AACD,eAAO,MAAM,YAAY,+BAA2B,CAAC;AACrD,eAAO,MAAM,aAAa,+BAA2B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** SGR mouse reports arrive with their leading ESC removed by Ink's useInput. */
2
+ export function parseMouseInput(input) {
3
+ const match = /^(?:\x1b)?\[<(\d+);(\d+);(\d+)([Mm])$/.exec(input);
4
+ if (!match)
5
+ return undefined;
6
+ return { button: Number(match[1]), column: Number(match[2]), row: Number(match[3]), released: match[4] === "m" };
7
+ }
8
+ export const ENABLE_MOUSE = "\x1b[?1000h\x1b[?1006h";
9
+ export const DISABLE_MOUSE = "\x1b[?1006l\x1b[?1000l";
10
+ //# sourceMappingURL=terminal-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-input.js","sourceRoot":"","sources":["../src/terminal-input.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,MAAM,KAAK,GAAG,uCAAuC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClE,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;AACnH,CAAC;AACD,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAwB,CAAC;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,wBAAwB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { AiCoderRuntimeEvent } from "@galaxy-stack/ai-coder-core";
2
+ import type { ThreadAssistantMessagePart, ThreadMessage } from "@assistant-ui/react-ink";
3
+ /** Strip terminal controls from every provider, tool and workspace string. */
4
+ export declare function terminalText(text: string): string;
5
+ export type ToolActivity = {
6
+ id: string;
7
+ label: string;
8
+ status: "running" | "success" | "error" | "cancelled";
9
+ summary: string;
10
+ details: string;
11
+ };
12
+ export type TimelineRow = {
13
+ text: string;
14
+ tone: "plain" | "user" | "assistant" | "thinking" | "running" | "success" | "error" | "muted";
15
+ };
16
+ export declare function toolLabel(name: string, args: Readonly<Record<string, unknown>>): string;
17
+ /** Tool identifiers stay out of user-visible prose; labels carry the meaning. */
18
+ export declare function humanizeToolMentions(text: string): string;
19
+ /** A tool is presentation data, never an assistant-ui executable tool call. Core owns execution. */
20
+ export declare class RunTimeline {
21
+ parts: ThreadAssistantMessagePart[];
22
+ private turn;
23
+ private turnStart;
24
+ private readonly calls;
25
+ private append;
26
+ notice(text: string): void;
27
+ event(event: AiCoderRuntimeEvent): void;
28
+ finish(content: string, state: string, error?: string): void;
29
+ }
30
+ export declare function transcriptRows(messages: readonly Pick<ThreadMessage, "role" | "content">[], width: number, showThinking: boolean, showToolDetails?: boolean): TimelineRow[];
31
+ //# sourceMappingURL=timeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEzF,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AACD,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAClJ,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;CAAE,CAAC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