@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.
- package/LICENSE +21 -0
- package/README.md +133 -0
- package/dist/application.d.ts +63 -0
- package/dist/application.d.ts.map +1 -0
- package/dist/application.js +272 -0
- package/dist/application.js.map +1 -0
- package/dist/cli-meta.d.ts +15 -0
- package/dist/cli-meta.d.ts.map +1 -0
- package/dist/cli-meta.js +37 -0
- package/dist/cli-meta.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +177 -0
- package/dist/cli.js.map +1 -0
- package/dist/composer.d.ts +13 -0
- package/dist/composer.d.ts.map +1 -0
- package/dist/composer.js +115 -0
- package/dist/composer.js.map +1 -0
- package/dist/flow.d.ts +44 -0
- package/dist/flow.d.ts.map +1 -0
- package/dist/flow.js +102 -0
- package/dist/flow.js.map +1 -0
- package/dist/logs.d.ts +25 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +80 -0
- package/dist/logs.js.map +1 -0
- package/dist/memory-import.d.ts +28 -0
- package/dist/memory-import.d.ts.map +1 -0
- package/dist/memory-import.js +51 -0
- package/dist/memory-import.js.map +1 -0
- package/dist/options.d.ts +32 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +121 -0
- package/dist/options.js.map +1 -0
- package/dist/sessions.d.ts +16 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/sessions.js +56 -0
- package/dist/sessions.js.map +1 -0
- package/dist/spill.d.ts +30 -0
- package/dist/spill.d.ts.map +1 -0
- package/dist/spill.js +44 -0
- package/dist/spill.js.map +1 -0
- package/dist/terminal-input.d.ts +10 -0
- package/dist/terminal-input.d.ts.map +1 -0
- package/dist/terminal-input.js +10 -0
- package/dist/terminal-input.js.map +1 -0
- package/dist/timeline.d.ts +31 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +280 -0
- package/dist/timeline.js.map +1 -0
- package/dist/tui.d.ts +11 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +269 -0
- package/dist/tui.js.map +1 -0
- package/dist/web/command.d.ts +3 -0
- package/dist/web/command.d.ts.map +1 -0
- package/dist/web/command.js +37 -0
- package/dist/web/command.js.map +1 -0
- package/dist/web/credentials.d.ts +17 -0
- package/dist/web/credentials.d.ts.map +1 -0
- package/dist/web/credentials.js +36 -0
- package/dist/web/credentials.js.map +1 -0
- package/dist/web/doctor.d.ts +4 -0
- package/dist/web/doctor.d.ts.map +1 -0
- package/dist/web/doctor.js +79 -0
- package/dist/web/doctor.js.map +1 -0
- package/dist/web/dsh.d.ts +11 -0
- package/dist/web/dsh.d.ts.map +1 -0
- package/dist/web/dsh.js +59 -0
- package/dist/web/dsh.js.map +1 -0
- package/dist/web/open-browser.d.ts +3 -0
- package/dist/web/open-browser.d.ts.map +1 -0
- package/dist/web/open-browser.js +19 -0
- package/dist/web/open-browser.js.map +1 -0
- package/dist/web/options.d.ts +23 -0
- package/dist/web/options.d.ts.map +1 -0
- package/dist/web/options.js +154 -0
- package/dist/web/options.js.map +1 -0
- package/dist/web/paths.d.ts +17 -0
- package/dist/web/paths.d.ts.map +1 -0
- package/dist/web/paths.js +39 -0
- package/dist/web/paths.js.map +1 -0
- package/dist/web/web.d.ts +17 -0
- package/dist/web/web.d.ts.map +1 -0
- package/dist/web/web.js +153 -0
- package/dist/web/web.js.map +1 -0
- package/package.json +65 -0
- package/skills/galaxy-ui/SKILL.md +56 -0
- package/skills/galaxy-ui/references/cli-workflows.md +54 -0
- package/skills/galaxy-ui/references/component-patterns.md +46 -0
- package/skills/galaxy-ui/references/framework-notes.md +35 -0
- package/skills/galaxy-ui/references/tailwind.md +23 -0
- package/skills/orbit-framework/SKILL.md +126 -0
- package/web/brand/client.template.js +217 -0
- package/web/brand/favicon.png +0 -0
- package/web/brand/lib/client.js +1205 -0
- package/web/brand/lib/favicon.js +1 -0
- package/web/brand/lib/index.js +143 -0
- package/web/brand/logo.png +0 -0
- package/web/brand/package.json +35 -0
- package/web/brand/vi.locales.json +989 -0
- package/web/patches/gbh-brand.patch.yml +13 -0
- package/web/patches/gbh-ui.patch.yml +18 -0
- package/web/patches/gbh-web.patch.yml +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Galaxy Agent
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Galaxy Code
|
|
2
|
+
|
|
3
|
+
CLI and terminal UI for the shared Galaxy agent runtime. Published identity remains `@galaxy-stack/blackhole-cli`, executable `blackhole`.
|
|
4
|
+
|
|
5
|
+
The agent loop, context, tool execution and completion evidence run in `@galaxy-stack/ai-coder-core`. React 19 + Ink 7.1.1 render the fullscreen terminal. `@assistant-ui/react-ink` supplies conversation/composer state; a fixed viewport and grapheme-aware input render that state. The CLI owns configuration, session lifecycle and permissions.
|
|
6
|
+
|
|
7
|
+
## Development
|
|
8
|
+
|
|
9
|
+
Node.js >=22.13 is required for the optional SQLite adapter. Node may print an experimental SQLite warning. Use a current Node 22 or 24 release.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
cd ../galaxy-ai-coder-core
|
|
13
|
+
npm ci
|
|
14
|
+
npm run build
|
|
15
|
+
cd ../galaxy-code
|
|
16
|
+
npm ci
|
|
17
|
+
npm run check
|
|
18
|
+
npm run dev -- chat --workspace /path/to/project
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The source checkout intentionally uses `file:../galaxy-ai-coder-core`. Before a standalone npm release, publish a compatible core version and pin that version in the CLI manifest/lockfile. Do not publish a CLI whose dependency refers to a local filesystem path.
|
|
22
|
+
|
|
23
|
+
## CLI
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm run dev -- run "Review the parser" --workspace /path/to/project --json
|
|
27
|
+
npm run dev -- chat --profile assistant --model glm-5.3-flash:cloud
|
|
28
|
+
npm run dev -- chat --session my-project
|
|
29
|
+
npm run dev -- skills
|
|
30
|
+
npm run dev -- skills show workspace/my-skill
|
|
31
|
+
npm run dev -- memory remember architecture "Core owns the agent loop"
|
|
32
|
+
npm run dev -- memory search "agent loop"
|
|
33
|
+
npm run dev -- memory list
|
|
34
|
+
npm run dev -- memory confirm architecture
|
|
35
|
+
npm run dev -- memory history architecture
|
|
36
|
+
npm run dev -- memory forget architecture
|
|
37
|
+
npm run dev -- sessions
|
|
38
|
+
npm run dev -- mcp
|
|
39
|
+
npm run dev -- web
|
|
40
|
+
npm run dev -- web doctor
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`blackhole web` boots the DeepSeek Harness web surface with the Galaxy overlay
|
|
44
|
+
in `web/`: patches under `web/patches` add the Galaxy route/UI, and the client
|
|
45
|
+
package in `web/brand` supplies the Galaxy Blackhole brand, Vietnamese locale,
|
|
46
|
+
key dialog, and reasoning-effort control. The Galaxy key comes from
|
|
47
|
+
`GBH_GALAXY_API_KEY` or the DSH credential store `~/.galaxy/gbh/.credentials.yaml`
|
|
48
|
+
(written by the in-app dialog). `blackhole web --help` lists its flags.
|
|
49
|
+
|
|
50
|
+
`run --json` writes a single final JSON result to stdout. Successful completion exits 0, failure/paused exits 1, cancellation exits 130. Chat needs a TTY; scripts should use `run`.
|
|
51
|
+
|
|
52
|
+
The TUI uses the terminal's alternate screen, with a pinned header and bottom input, and a scrollable center. Thinking, messages and tool calls share one ordered transcript. Tool badges distinguish running, success, error and cancellation; commands and paths are shown in their labels. Thinking is displayed only when the provider emits it. Ollama NDJSON is decoded and forwarded as each line arrives; text/thinking does not wait for the response to close. Scrolling up pauses auto-follow; Ctrl+G or scrolling back to the bottom resumes it. The status line shows the visible range while browsing history. Mouse reports are consumed by the viewport and never entered into the draft. Mouse reporting is disabled again on exit.
|
|
53
|
+
|
|
54
|
+
| Key | Action |
|
|
55
|
+
|---|---|
|
|
56
|
+
| Enter | Send the request |
|
|
57
|
+
| Esc | Cancel the active request |
|
|
58
|
+
| Ctrl+C | Exit and restore the terminal |
|
|
59
|
+
| Mouse wheel / trackpad over messages | Scroll the transcript using terminal mouse reporting |
|
|
60
|
+
| ↑ / ↓, PageUp / PageDown | Scroll by a line / page (Fn+↑ / Fn+↓ on compact Mac keyboards) |
|
|
61
|
+
| Ctrl+G | Return to the latest output and resume following it |
|
|
62
|
+
| Ctrl+T | Show/hide provider thinking |
|
|
63
|
+
| Ctrl+O | Expand/collapse tool details; pending calls include their arguments |
|
|
64
|
+
| ← / →, Home / End, Ctrl+A / Ctrl+E | Edit the input without moving the transcript |
|
|
65
|
+
| Delete / Backspace, Fn+Delete | Delete the previous / next grapheme (including Vietnamese accents and emoji) |
|
|
66
|
+
| Ctrl+U / Ctrl+W | Delete input before the cursor / previous word |
|
|
67
|
+
|
|
68
|
+
Approval stays above the input and accepts `y/n`. It expires after at most five minutes (or earlier if the run ends); expiration dismisses the prompt and denies the request. Long input scrolls horizontally so the caret stays visible. The compact layout is tested down to 40×8; 80×24 or larger is more comfortable. In noninteractive mode, tools requiring approval are denied unless their canonical ID is explicitly passed with `--allow-tool` (repeatable). Read-only tools and the core's balanced workspace policy remain available.
|
|
69
|
+
|
|
70
|
+
Scratch directories do not need `git init`. The host detects Git availability; outside a repository, `review_changes` compares text files against the start of the task and provides completion evidence. Validation is still required after changes. The scratch reviewer is deliberately bounded: an 8 MiB baseline text cache, 128 KiB per-file reads, and a 24 KiB change report. Oversized, binary/special-entry or unstable changes return an error instead of claiming review success; use a Git repository for those projects.
|
|
71
|
+
|
|
72
|
+
`--profile coding` retains workspace inspection/completion guarantees. `assistant` and `research` allow tasks that do not require code edits; research is currently a prompt profile, not a preconfigured web search service. Use configured MCP research tools when needed.
|
|
73
|
+
|
|
74
|
+
## Provider configuration
|
|
75
|
+
|
|
76
|
+
The working provider adapter is Ollama, including remote/cloud models. Existing `~/.galaxy/config.json` manual-provider configuration and `OLLAMA_API_KEY` continue to work. `--model`, `--base-url` and `--config` override selection. No credentials are placed in the TUI header or source examples.
|
|
77
|
+
|
|
78
|
+
`--thinking auto|on|off|low|medium|high` is handled by the Ollama adapter. Turning thinking on/off controls the provider; Ctrl+T only changes what the TUI displays. Named effort levels are provider/model-specific; unsupported values are surfaced as provider errors rather than translated to a universal thinking scale. Full provider capability pickers and direct Gemini/Anthropic/OpenAI-compatible adapters remain planned.
|
|
79
|
+
|
|
80
|
+
## MCP
|
|
81
|
+
|
|
82
|
+
Explicit host configuration is read from `~/.galaxy/agent.json` or `--agent-config`:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": [
|
|
87
|
+
{ "name": "project", "transport": "stdio", "command": "my-mcp-server", "args": [], "timeoutMs": 30000 },
|
|
88
|
+
{ "name": "remote", "transport": "http", "url": "http://127.0.0.1:8080/mcp" }
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Stdio commands execute only when a configured server is connected. Tool names are namespaced; canonical permissions are `mcp.<server>.<tool>`. All MCP calls require explicit host permission even if a server advertises `readOnlyHint`. Tool results cannot attest validation or filesystem effects. SDK resources/prompts APIs are available to adapters.
|
|
94
|
+
|
|
95
|
+
Remote HTTP servers can use browser OAuth: set `"auth": "oauth"` on the connection, then run `blackhole mcp login <server>` (opens the system browser, captures the localhost callback, stores tokens in `<state-dir>/mcp-auth.json` with 0600 permissions and refreshes them automatically). `blackhole mcp logout <server>` forgets the stored credentials. Browsing resources/prompts from the TUI is not implemented yet; the adapter APIs are.
|
|
96
|
+
|
|
97
|
+
The CLI also ships first-party servers and skills: `orbit` and `nebula` MCP servers are used by default (skip with `--no-galaxy-mcp`), and `orbit-framework` plus `galaxy-ui` ship as `bundled/` skills. Memory data from the Galaxy desktop (Quasar Memory Tree) can be migrated with `blackhole memory import-quasar <path-to-memory.db>`: it backs up the source database into `<state-dir>/import-backups/`, imports active notes as confirmed entries with preserved provenance, and is safe to re-run.
|
|
98
|
+
|
|
99
|
+
## Skills and memory
|
|
100
|
+
|
|
101
|
+
Skills are discovered in `~/.agents/skills/<name>/SKILL.md` and `<workspace>/.agents/skills/<name>/SKILL.md`. IDs include `user/` or `workspace/`; catalog discovery is bounded to 256 entries. Content/resources load on demand with path/hash/size checks. Loading a skill grants no new execution permissions.
|
|
102
|
+
|
|
103
|
+
Host state defaults to `~/.galaxy/agent/` and must be outside the selected workspace; override with `--state-dir`. Memory and conversation rows use a hash of the workspace's canonical path as scope. Another worktree is a separate scope. This version does not automatically merge memory across clones.
|
|
104
|
+
|
|
105
|
+
Memory uses SQLite WAL + FTS5 with revision checks, provenance and supersession. Explicit CLI notes are confirmed. Model-generated notes are candidates, require permission to write, and are excluded from automatic recall until `memory confirm`. Confirmed notes are still historical data, not policy or proof that current tests passed. `forget` removes all revisions and search entries for the key; external backups are outside that operation.
|
|
106
|
+
|
|
107
|
+
## Runtime logs
|
|
108
|
+
|
|
109
|
+
Every command writes JSON lines to `<state-dir>/logs/cli-<date>.ndjson` (0600, rotated at 5 MB, three segments kept): command lifecycle, run state transitions, tool failures with stacks, MCP connect errors, model retries, OAuth session events and crashes (`uncaughtException`/`unhandledRejection`). Secrets in messages are redacted before hitting disk. `blackhole logs [n]` prints the newest entries so a failure can be traced after the terminal is gone.
|
|
110
|
+
|
|
111
|
+
Session history resumes with `--session`; simultaneous writers to the same session are rejected. This restores user/final-answer text; the detailed thinking/tool timeline currently lasts for the open TUI session. It does not resume a paused runtime checkpoint. Runtime checkpoints remain in the host store; crash-resume for production CLI is a future extension. Lab checkpoint/crash-resume testing remains available in core/testing.
|
|
112
|
+
|
|
113
|
+
## Testing and migration
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
npm run check
|
|
117
|
+
cd ../galaxy-ai-coder-core/testing
|
|
118
|
+
npm ci
|
|
119
|
+
npm run test:local
|
|
120
|
+
npm run dev -- health --live --scenario live/scenarios/01-write-and-validate.json --json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`doctor`, `eval`, `campaign`, `health`, `run --fixture` and their scenarios now belong to `galaxy-ai-coder-core/testing`. See [MIGRATION.md](MIGRATION.md) and the [core adapter guide](../galaxy-ai-coder-core/docs/AGENT_PLATFORM.md). Build cleans generated output before compilation so old lab code cannot remain in the CLI npm artifact.
|
|
124
|
+
|
|
125
|
+
### Input and activity feedback
|
|
126
|
+
|
|
127
|
+
The composer positions the native terminal caret so the terminal's IME preedit appears inside the input. Delete on macOS removes the preceding character; Fn+Delete removes the following character. Repeated deletes in one stdin packet and combining marks are handled without losing draft changes.
|
|
128
|
+
|
|
129
|
+
While a run is active, a spinner and animated label report Connecting, Thinking, Responding, Running tools, Validating or Review. Successful completion removes this activity label; failure/cancellation feedback remains visible. The context token count sits at the right edge of the keyboard-help footer. Narrow terminals truncate the help before the count.
|
|
130
|
+
|
|
131
|
+
A single blank terminal row below the footer is reserved for Ink's render newline. This avoids the native-cursor drift in Ink 7.1.1's full-height, no-newline rendering path. At eight terminal rows the composer drops its border to retain the input and approval controls. Keep the native-cursor PTY check when changing Ink versions.
|
|
132
|
+
|
|
133
|
+
For a terminal protocol regression on macOS/Linux, run `python3 scripts/verify-tui-input.py` with `pyte` installed in that Python environment. It starts an isolated CLI without sending provider requests and checks cursor coordinates, Unicode editing, resize and terminal cleanup. It does not automate the operating system's IME UI.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type CodingModelAdapter, type AiCoderRuntimeEvent } from "@galaxy-stack/ai-coder-core";
|
|
2
|
+
import { type AgentTool } from "@galaxy-stack/ai-coder-core/agent";
|
|
3
|
+
import { DirectorySkills } from "@galaxy-stack/ai-coder-core/adapters/node/skills/directory-skills";
|
|
4
|
+
import { SkillMarketplace } from "@galaxy-stack/ai-coder-core/adapters/node/skills/skill-marketplace";
|
|
5
|
+
import { SqliteAgentMemory } from "@galaxy-stack/ai-coder-core/adapters/node/memory/sqlite-memory";
|
|
6
|
+
import { type McpConnection } from "@galaxy-stack/ai-coder-core/adapters/node/mcp/mcp-client";
|
|
7
|
+
import { Sessions } from "./sessions.js";
|
|
8
|
+
import type { CliOptions } from "./options.js";
|
|
9
|
+
import { CliLogger } from "./logs.js";
|
|
10
|
+
export type PermissionPrompt = (name: string, args: Readonly<Record<string, unknown>>, signal: AbortSignal) => Promise<boolean>;
|
|
11
|
+
export interface AgentConfig {
|
|
12
|
+
mcpServers?: McpConnection[];
|
|
13
|
+
}
|
|
14
|
+
/** First-party MCP servers shipped with the Galaxy stack; user config overrides them. */
|
|
15
|
+
export declare const GALAXY_MCP_SERVERS: readonly McpConnection[];
|
|
16
|
+
/** First-party skills bundled with the CLI package (synced from galaxy-orbit and galaxy-nebula). */
|
|
17
|
+
export declare const BUNDLED_SKILLS_DIR: string;
|
|
18
|
+
export declare class GalaxyApplication {
|
|
19
|
+
readonly options: CliOptions;
|
|
20
|
+
readonly stateDir: string;
|
|
21
|
+
readonly scope: string;
|
|
22
|
+
readonly config: AgentConfig;
|
|
23
|
+
readonly logger: CliLogger;
|
|
24
|
+
private readonly spill;
|
|
25
|
+
readonly session: string;
|
|
26
|
+
providerLabel: string;
|
|
27
|
+
readonly memory: SqliteAgentMemory;
|
|
28
|
+
readonly skills: DirectorySkills;
|
|
29
|
+
readonly marketplace: SkillMarketplace | undefined;
|
|
30
|
+
readonly sessions: Sessions;
|
|
31
|
+
private readonly mcp;
|
|
32
|
+
get mcpServerConfigs(): readonly McpConnection[];
|
|
33
|
+
get mcpServerNames(): readonly string[];
|
|
34
|
+
private running;
|
|
35
|
+
private active;
|
|
36
|
+
private idle;
|
|
37
|
+
private sessionAcquired;
|
|
38
|
+
private constructor();
|
|
39
|
+
static create(options: CliOptions): Promise<GalaxyApplication>;
|
|
40
|
+
connectMcp(signal?: AbortSignal): Promise<AgentTool[]>;
|
|
41
|
+
run(goal: string, signal: AbortSignal, onEvent?: (event: AiCoderRuntimeEvent) => void, permission?: PermissionPrompt, injectedModel?: CodingModelAdapter): Promise<Readonly<{
|
|
42
|
+
checkpoint: import("@galaxy-stack/ai-coder-core").AiCoderRunCheckpoint | null;
|
|
43
|
+
content: string;
|
|
44
|
+
error: Readonly<{
|
|
45
|
+
code: string;
|
|
46
|
+
message: string;
|
|
47
|
+
}> | null;
|
|
48
|
+
runId: string;
|
|
49
|
+
state: Extract<import("@galaxy-stack/ai-coder-core").AiCoderRunState, "cancelled" | "completed" | "failed" | "paused">;
|
|
50
|
+
taskId: string;
|
|
51
|
+
transitions: readonly import("@galaxy-stack/ai-coder-core").AiCoderStateTransition[];
|
|
52
|
+
validation: readonly import("@galaxy-stack/ai-coder-core").AiCoderCompletionValidation[];
|
|
53
|
+
writes: readonly import("@galaxy-stack/ai-coder-core").AiCoderCompletionWrite[];
|
|
54
|
+
}>>;
|
|
55
|
+
/**
|
|
56
|
+
* Auto-activate a bundled first-party skill when the task clearly needs it.
|
|
57
|
+
* Relying on the model to call skill_load left the Orbit/Galaxy UI guidance
|
|
58
|
+
* unloaded, so it hand-rolled scaffolding the framework CLI already performs.
|
|
59
|
+
*/
|
|
60
|
+
private loadRelevantSkills;
|
|
61
|
+
close(): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=application.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,kBAAkB,EAAE,KAAK,mBAAmB,EAA+C,MAAM,6BAA6B,CAAC;AACnK,OAAO,EAA6G,KAAK,SAAS,EAAwB,MAAM,mCAAmC,CAAC;AAWpM,OAAO,EAAE,eAAe,EAAE,MAAM,mEAAmE,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oEAAoE,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gEAAgE,CAAC;AAGnG,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,0DAA0D,CAAC;AAM9G,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAChI,MAAM,WAAW,WAAW;IAAG,UAAU,CAAC,EAAE,aAAa,EAAE,CAAA;CAAE;AAC7D,yFAAyF;AACzF,eAAO,MAAM,kBAAkB,EAAE,SAAS,aAAa,EA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,kBAAkB;IAgB1B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAC7B"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { AiCoderRunController } from "@galaxy-stack/ai-coder-core";
|
|
2
|
+
import { agentFunction, AgentToolExecutor, CompositeToolExecutor, memoryTools, skillTools } from "@galaxy-stack/ai-coder-core/agent";
|
|
3
|
+
import { NodeToolExecutor } from "@galaxy-stack/ai-coder-core/adapters/node/tools/tool-executor";
|
|
4
|
+
import { NodeWorkspaceReviewExecutor } from "@galaxy-stack/ai-coder-core/adapters/node/tools/workspace-review";
|
|
5
|
+
import { execFile } from "node:child_process";
|
|
6
|
+
import { promisify } from "node:util";
|
|
7
|
+
import { NodeWorkspacePort } from "@galaxy-stack/ai-coder-core/adapters/node/host/node-workspace-port";
|
|
8
|
+
import { NodeCommandPort } from "@galaxy-stack/ai-coder-core/adapters/node/host/node-command-port";
|
|
9
|
+
import { NodeWorkspaceEvidenceVerifier } from "@galaxy-stack/ai-coder-core/adapters/node/host/node-workspace-evidence-verifier";
|
|
10
|
+
import { FileRunStore } from "@galaxy-stack/ai-coder-core/adapters/node/host/file-run-store";
|
|
11
|
+
import { OllamaCodingModel } from "@galaxy-stack/ai-coder-core/adapters/node/provider/ollama-coding-model";
|
|
12
|
+
import { resolveOllamaConnection } from "@galaxy-stack/ai-coder-core/adapters/node/config/manual-provider-config";
|
|
13
|
+
import { DirectorySkills } from "@galaxy-stack/ai-coder-core/adapters/node/skills/directory-skills";
|
|
14
|
+
import { SkillMarketplace } from "@galaxy-stack/ai-coder-core/adapters/node/skills/skill-marketplace";
|
|
15
|
+
import { SqliteAgentMemory } from "@galaxy-stack/ai-coder-core/adapters/node/memory/sqlite-memory";
|
|
16
|
+
import { OllamaEmbeddings } from "@galaxy-stack/ai-coder-core/adapters/node/memory/ollama-embeddings";
|
|
17
|
+
import { OllamaResearchPort } from "@galaxy-stack/ai-coder-core/adapters/node/provider/ollama-research-port";
|
|
18
|
+
import { McpAgentClient } from "@galaxy-stack/ai-coder-core/adapters/node/mcp/mcp-client";
|
|
19
|
+
import { randomUUID, createHash } from "node:crypto";
|
|
20
|
+
import { fileURLToPath } from "node:url";
|
|
21
|
+
import { mkdir, readFile, realpath } from "node:fs/promises";
|
|
22
|
+
import { homedir } from "node:os";
|
|
23
|
+
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
24
|
+
import { Sessions } from "./sessions.js";
|
|
25
|
+
import { CliLogger } from "./logs.js";
|
|
26
|
+
import { FileToolOutputSpill } from "./spill.js";
|
|
27
|
+
/** First-party MCP servers shipped with the Galaxy stack; user config overrides them. */
|
|
28
|
+
export const GALAXY_MCP_SERVERS = [
|
|
29
|
+
{ name: "orbit", transport: "stdio", command: "npx", args: ["-y", "@galaxy-stack/orbit-mcp"], timeoutMs: 120000 },
|
|
30
|
+
{ name: "nebula", transport: "stdio", command: "npx", args: ["-y", "@galaxy-stack/nebula-mcp"], timeoutMs: 120000 },
|
|
31
|
+
];
|
|
32
|
+
/** First-party skills bundled with the CLI package (synced from galaxy-orbit and galaxy-nebula). */
|
|
33
|
+
export const BUNDLED_SKILLS_DIR = fileURLToPath(new URL("../skills/", import.meta.url));
|
|
34
|
+
export class GalaxyApplication {
|
|
35
|
+
options;
|
|
36
|
+
stateDir;
|
|
37
|
+
scope;
|
|
38
|
+
config;
|
|
39
|
+
logger;
|
|
40
|
+
spill;
|
|
41
|
+
session;
|
|
42
|
+
providerLabel;
|
|
43
|
+
memory;
|
|
44
|
+
skills;
|
|
45
|
+
marketplace;
|
|
46
|
+
sessions;
|
|
47
|
+
mcp = [];
|
|
48
|
+
get mcpServerConfigs() { return this.config.mcpServers ?? []; }
|
|
49
|
+
get mcpServerNames() { return (this.config.mcpServers ?? []).map(c => c.name); }
|
|
50
|
+
running = false;
|
|
51
|
+
active;
|
|
52
|
+
idle = Promise.resolve();
|
|
53
|
+
sessionAcquired = false;
|
|
54
|
+
constructor(options, stateDir, scope, config, logger, spill, embeddings, skillsPublicKeyPem) {
|
|
55
|
+
this.options = options;
|
|
56
|
+
this.stateDir = stateDir;
|
|
57
|
+
this.scope = scope;
|
|
58
|
+
this.config = config;
|
|
59
|
+
this.logger = logger;
|
|
60
|
+
this.spill = spill;
|
|
61
|
+
this.session = options.session ?? randomUUID();
|
|
62
|
+
this.providerLabel = options.model ?? "theo cấu hình";
|
|
63
|
+
const db = join(stateDir, "agent.db");
|
|
64
|
+
this.memory = new SqliteAgentMemory(db, scope, embeddings ? { embeddings } : {});
|
|
65
|
+
this.sessions = new Sessions(db, scope);
|
|
66
|
+
const managedSkills = options.skillsDir ?? join(stateDir, "skills");
|
|
67
|
+
this.skills = new DirectorySkills({ bundled: BUNDLED_SKILLS_DIR, managed: managedSkills, user: join(homedir(), ".agents", "skills"), workspace: join(options.workspace, ".agents", "skills") });
|
|
68
|
+
this.marketplace = options.skillsIndex ? new SkillMarketplace({ index: options.skillsIndex, installRoot: managedSkills, ...(skillsPublicKeyPem === undefined ? {} : { publicKey: skillsPublicKeyPem }) }) : undefined;
|
|
69
|
+
}
|
|
70
|
+
static async create(options) {
|
|
71
|
+
const workspace = await realpath(options.workspace);
|
|
72
|
+
const requested = resolve(options.stateDir ?? join(homedir(), ".galaxy", "agent"));
|
|
73
|
+
await mkdir(requested, { recursive: true, mode: 0o700 });
|
|
74
|
+
const stateDir = await realpath(requested);
|
|
75
|
+
const rel = relative(workspace, stateDir);
|
|
76
|
+
if (!isAbsolute(rel) && rel !== ".." && !rel.startsWith(`..${sep}`))
|
|
77
|
+
throw new Error("Agent state must be outside the model-writable workspace. Choose --state-dir elsewhere.");
|
|
78
|
+
let config = {};
|
|
79
|
+
try {
|
|
80
|
+
const raw = await readFile(options.agentConfig ?? join(homedir(), ".galaxy", "agent.json"), "utf8");
|
|
81
|
+
if (raw.length > 65536)
|
|
82
|
+
throw new Error("Agent config exceeds 64 KiB.");
|
|
83
|
+
config = JSON.parse(raw);
|
|
84
|
+
if (!config || typeof config !== "object" || (config.mcpServers !== undefined && (!Array.isArray(config.mcpServers) || config.mcpServers.length > 16)))
|
|
85
|
+
throw new Error("Invalid agent config.");
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
if (e.code !== "ENOENT" || options.agentConfig)
|
|
89
|
+
throw e;
|
|
90
|
+
}
|
|
91
|
+
const mcpServers = options.noGalaxyMcp ? config.mcpServers ?? [] : config.mcpServers ?? [...GALAXY_MCP_SERVERS];
|
|
92
|
+
config = { ...config, mcpServers };
|
|
93
|
+
const scope = `workspace:${createHash("sha256").update(workspace).digest("hex")}`;
|
|
94
|
+
const logger = await CliLogger.open(stateDir).catch(() => undefined);
|
|
95
|
+
if (!logger)
|
|
96
|
+
throw new Error(`Cannot create the runtime log under ${stateDir}.`);
|
|
97
|
+
logger.log("info", "session_open", { workspace, profile: options.profile, session: options.session ?? undefined });
|
|
98
|
+
const connection = await resolveOllamaConnection({ ...(options.config ? { configPath: options.config } : {}) }).catch(() => undefined);
|
|
99
|
+
const embeddingModel = options.embeddingModel ?? connection?.embeddingModel;
|
|
100
|
+
const embeddings = embeddingModel
|
|
101
|
+
? new OllamaEmbeddings({
|
|
102
|
+
...(connection?.apiKey === undefined ? {} : { apiKey: connection.apiKey }),
|
|
103
|
+
baseUrl: options.embeddingBaseUrl ?? connection?.embeddingBaseUrl ?? connection?.baseUrl ?? "http://127.0.0.1:11434",
|
|
104
|
+
model: embeddingModel,
|
|
105
|
+
})
|
|
106
|
+
: undefined;
|
|
107
|
+
if (embeddings)
|
|
108
|
+
logger.log("info", "embeddings_enabled", { model: embeddings.model });
|
|
109
|
+
const skillsPublicKeyPem = options.skillsPublicKey ? await readFile(resolve(options.skillsPublicKey), "utf8") : undefined;
|
|
110
|
+
return new GalaxyApplication({ ...options, workspace }, stateDir, scope, config, logger, new FileToolOutputSpill(stateDir), embeddings, skillsPublicKeyPem);
|
|
111
|
+
}
|
|
112
|
+
async connectMcp(signal) {
|
|
113
|
+
const tools = [];
|
|
114
|
+
const names = new Set();
|
|
115
|
+
try {
|
|
116
|
+
for (const config of this.config.mcpServers ?? []) {
|
|
117
|
+
if (names.has(config.name))
|
|
118
|
+
throw new Error("Duplicate MCP server name.");
|
|
119
|
+
names.add(config.name);
|
|
120
|
+
// Reuse a live connection but re-list tools each run so an updated
|
|
121
|
+
// server catalog is picked up instead of being cached forever.
|
|
122
|
+
let client = this.mcp.find(candidate => candidate.name === config.name);
|
|
123
|
+
if (!client) {
|
|
124
|
+
client = await McpAgentClient.connect(config, signal, { stateDir: this.stateDir });
|
|
125
|
+
this.mcp.push(client);
|
|
126
|
+
}
|
|
127
|
+
tools.push(...await client.tools(signal));
|
|
128
|
+
}
|
|
129
|
+
return tools;
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
this.logger.log("error", "mcp_connect_failed", { error: e instanceof Error ? e : new Error(String(e)), servers: this.config.mcpServers?.map(c => c.name) });
|
|
133
|
+
throw e;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async run(goal, signal, onEvent = () => { }, permission, injectedModel) {
|
|
137
|
+
if (!goal.trim())
|
|
138
|
+
throw new Error("A task is required.");
|
|
139
|
+
if (this.running)
|
|
140
|
+
throw new Error("Only one run per session can execute at a time.");
|
|
141
|
+
this.running = true;
|
|
142
|
+
this.active = new AbortController();
|
|
143
|
+
signal = AbortSignal.any([signal, this.active.signal]);
|
|
144
|
+
let settled;
|
|
145
|
+
this.idle = new Promise(resolve => { settled = resolve; });
|
|
146
|
+
this.logger.log("info", "run_started", { goal: goal.slice(0, 400), session: this.session, profile: this.options.profile });
|
|
147
|
+
try {
|
|
148
|
+
if (!this.sessionAcquired) {
|
|
149
|
+
this.sessions.acquire(this.session);
|
|
150
|
+
this.sessionAcquired = true;
|
|
151
|
+
}
|
|
152
|
+
signal.throwIfAborted();
|
|
153
|
+
const connection = injectedModel ? undefined : await resolveOllamaConnection({ ...(this.options.model ? { model: this.options.model } : {}), ...(this.options.baseUrl ? { baseUrl: this.options.baseUrl } : {}), ...(this.options.config ? { configPath: this.options.config } : {}) });
|
|
154
|
+
this.providerLabel = injectedModel?.identity.model ?? connection.model;
|
|
155
|
+
const model = injectedModel ?? new OllamaCodingModel({ ...connection, ...(this.options.thinking === undefined ? {} : { thinking: this.options.thinking }), ...(this.options.systemPromptInHistory ? { systemPromptUpdate: "in-history" } : this.options.noSystemPromptInHistory ? { systemPromptUpdate: "in-place" } : {}) });
|
|
156
|
+
const context = { runId: randomUUID(), taskId: randomUUID(), workspaceRoot: this.options.workspace, mode: "auto", deadline: Date.now() + 15 * 60000, signal };
|
|
157
|
+
const capability = await model.capabilities(context);
|
|
158
|
+
if (!capability.ok)
|
|
159
|
+
throw new Error(capability.error.message);
|
|
160
|
+
// approval=full (default) auto-approves every tool so long tasks run
|
|
161
|
+
// unattended; balanced restores the per-call permission prompt.
|
|
162
|
+
const fullAccess = this.options.approval !== "balanced";
|
|
163
|
+
const authorize = async (name, args, abort) => fullAccess || this.options.allowTools.includes(name) || await permission?.(name, args, AbortSignal.any([abort, AbortSignal.timeout(5 * 60000)])) === true;
|
|
164
|
+
const approval = async (request, ctx) => ({ ok: true, data: { approved: await authorize(request.tool.id, request.argumentsValue, ctx.signal), scope: "once", decidedAt: new Date().toISOString() } });
|
|
165
|
+
// A fresh run may target a workspace that does not exist yet (e.g. a new
|
|
166
|
+
// project directory for `flow`); create it instead of failing on realpath.
|
|
167
|
+
await mkdir(this.options.workspace, { recursive: true });
|
|
168
|
+
const workspace = await NodeWorkspacePort.create(this.options.workspace);
|
|
169
|
+
const command = await NodeCommandPort.create(this.options.workspace);
|
|
170
|
+
const hasGit = await promisify(execFile)("git", ["rev-parse", "--is-inside-work-tree"], { cwd: context.workspaceRoot, timeout: 5000, signal }).then(result => result.stdout.trim() === "true", () => false);
|
|
171
|
+
const hostTools = new NodeToolExecutor({ capabilities: capability.data, workspace, command, approval, approvalProfile: this.options.approval === "balanced" ? "balanced" : "trusted-workspace", approvalTimeoutMs: 5 * 60000, enableGit: hasGit, ...(this.options.research ? { research: new OllamaResearchPort({ ...(connection?.apiKey === undefined ? {} : { apiKey: connection.apiKey }) }) } : {}) });
|
|
172
|
+
const reviewTools = hasGit ? [] : [await NodeWorkspaceReviewExecutor.create(workspace, context)];
|
|
173
|
+
const artifactReader = agentFunction("tool_output.read", "Read the complete output of a previously truncated tool result by artifact id (from the artifact://<id> marker). Read-only; never grants permissions.", { id: { type: "string", minLength: 1, maxLength: 80 }, offset: { type: "integer", minimum: 0 }, length: { type: "integer", minimum: 256, maximum: 64_000 } }, ["id"], "read", async (args) => {
|
|
174
|
+
const read = await this.spill.read(context.runId, String(args.id), Math.max(0, Number(args.offset ?? 0) || 0), Math.max(256, Math.min(64_000, Number(args.length ?? 16_000) || 16_000)));
|
|
175
|
+
return { ...read, runId: context.runId };
|
|
176
|
+
}, "workspace");
|
|
177
|
+
// A first-party MCP server that cannot start must not fail the whole run;
|
|
178
|
+
// degradation is logged and the base/skill/memory tools still work.
|
|
179
|
+
const mcpTools = await this.connectMcp(signal).catch(error => {
|
|
180
|
+
this.logger.log("warn", "mcp_degraded", { error: error instanceof Error ? error.message : String(error) });
|
|
181
|
+
return [];
|
|
182
|
+
});
|
|
183
|
+
const extensions = new AgentToolExecutor([...skillTools(this.skills), ...memoryTools(this.memory), ...mcpTools, artifactReader], async (tool, call, ctx) => tool.risk === "read" || authorize(tool.id, call.arguments, ctx.signal));
|
|
184
|
+
await this.skills.list();
|
|
185
|
+
const recall = await this.memory.search(goal, { limit: 4 });
|
|
186
|
+
const history = this.sessions.history(this.session);
|
|
187
|
+
this.sessions.append(this.session, "user", goal);
|
|
188
|
+
const activatedSkills = await this.loadRelevantSkills(goal);
|
|
189
|
+
if (activatedSkills.length)
|
|
190
|
+
this.logger.log("info", "skills_activated", { skills: activatedSkills.map(skill => skill.id) });
|
|
191
|
+
const store = await FileRunStore.create(join(this.stateDir, "runs"));
|
|
192
|
+
const emit = (event) => {
|
|
193
|
+
if (event.type === "state")
|
|
194
|
+
this.logger.log("info", "state", { to: event.transition.to });
|
|
195
|
+
else if (event.type === "tool_result" && !event.result.ok)
|
|
196
|
+
this.logger.log("error", "tool_failed", { tool: event.call.name, summary: String(event.result.summary ?? "").slice(0, 400) });
|
|
197
|
+
else if (event.type === "model_retry")
|
|
198
|
+
this.logger.log("warn", "model_retry", { attempt: event.attempt, message: event.message.slice(0, 400) });
|
|
199
|
+
else if (event.type === "completion_rejected") {
|
|
200
|
+
const issueCodes = {};
|
|
201
|
+
for (const issue of event.issues) {
|
|
202
|
+
const code = String(issue).split(":")[0].trim();
|
|
203
|
+
issueCodes[code] = (issueCodes[code] ?? 0) + 1;
|
|
204
|
+
}
|
|
205
|
+
this.logger.log("warn", "completion_rejected", { issueCount: event.issues.length, codes: issueCodes, issues: event.issues.slice(0, 10) });
|
|
206
|
+
}
|
|
207
|
+
onEvent(event);
|
|
208
|
+
};
|
|
209
|
+
const controller = new AiCoderRunController({ model, toolExecutor: new CompositeToolExecutor([hostTools, ...reviewTools, extensions]), store, resumeWorkspaceVerifier: await NodeWorkspaceEvidenceVerifier.create(this.options.workspace), onEvent: emit, toolOutputSpill: this.spill,
|
|
210
|
+
trace: {
|
|
211
|
+
// Trace sinks to the runtime log file (blackhole logs) — writing to
|
|
212
|
+
// stderr fights the TUI repaint, so lines flash and vanish.
|
|
213
|
+
emit: async (event) => { this.logger.log("info", `trace.${event.kind}`, event.payload); return { ok: true, data: null }; },
|
|
214
|
+
flush: async () => ({ ok: true, data: null }),
|
|
215
|
+
} });
|
|
216
|
+
const handle = controller.start({ goal, runId: context.runId, taskId: context.taskId, workspaceRoot: context.workspaceRoot,
|
|
217
|
+
prompt: { agentProfile: this.options.profile, approvalProfile: this.options.approval === "balanced" ? "balanced" : "trusted-workspace", complexity: "standard", hostEnvironment: command.hostEnvironment, networkAccess: "policy_gated", writeAccess: "policy_gated",
|
|
218
|
+
...(activatedSkills.length === 0 ? {} : { trustedWorkspaceInstructions: activatedSkills.map(skill => ({ source: `skill:${skill.id}`, content: skill.content, contentHash: `sha256:${skill.contentHash}` })) }) },
|
|
219
|
+
completion: { requireInspection: this.options.profile === "coding", requireFinalReportPersistence: true },
|
|
220
|
+
contextData: [
|
|
221
|
+
{ source: "conversation-history", content: JSON.stringify(history).slice(-32000) },
|
|
222
|
+
{ source: "historical-memory-not-current-evidence", content: JSON.stringify(recall).slice(0, 32000) },
|
|
223
|
+
],
|
|
224
|
+
});
|
|
225
|
+
const cancel = () => handle.cancel("Canceled by user.");
|
|
226
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
227
|
+
if (signal.aborted)
|
|
228
|
+
cancel();
|
|
229
|
+
try {
|
|
230
|
+
const result = await handle.result;
|
|
231
|
+
this.logger.log(result.state === "completed" ? "info" : "error", "run_finished", { state: result.state, error: result.error?.message, durationMs: Date.now() - context.deadline + 15 * 60000 });
|
|
232
|
+
this.sessions.append(this.session, "assistant", result.content || `[${result.state}] ${result.error?.message ?? ""}`);
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
235
|
+
finally {
|
|
236
|
+
signal.removeEventListener("abort", cancel);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
finally {
|
|
240
|
+
this.running = false;
|
|
241
|
+
this.active = undefined;
|
|
242
|
+
settled();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Auto-activate a bundled first-party skill when the task clearly needs it.
|
|
247
|
+
* Relying on the model to call skill_load left the Orbit/Galaxy UI guidance
|
|
248
|
+
* unloaded, so it hand-rolled scaffolding the framework CLI already performs.
|
|
249
|
+
*/
|
|
250
|
+
async loadRelevantSkills(goal) {
|
|
251
|
+
const candidates = [
|
|
252
|
+
{ name: "orbit-framework", pattern: /\borbit\b|galaxy-orbit|nestjs/i },
|
|
253
|
+
{ name: "galaxy-ui", pattern: /galaxy\s*ui|galaxy-ui|nebula|shadcn|component library/i },
|
|
254
|
+
];
|
|
255
|
+
const available = await this.skills.list();
|
|
256
|
+
const activated = [];
|
|
257
|
+
for (const candidate of candidates) {
|
|
258
|
+
if (!candidate.pattern.test(goal))
|
|
259
|
+
continue;
|
|
260
|
+
const descriptor = available.find((skill) => skill.id === `bundled/${candidate.name}` || skill.name === candidate.name);
|
|
261
|
+
if (!descriptor)
|
|
262
|
+
continue;
|
|
263
|
+
try {
|
|
264
|
+
activated.push(await this.skills.load(descriptor.id));
|
|
265
|
+
}
|
|
266
|
+
catch { /* A changed skill is simply not auto-activated. */ }
|
|
267
|
+
}
|
|
268
|
+
return activated;
|
|
269
|
+
}
|
|
270
|
+
async close() { this.active?.abort(); await this.idle; await Promise.allSettled(this.mcp.splice(0).map(c => c.close())); this.sessions.close(); this.memory.close(); }
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAkG,MAAM,6BAA6B,CAAC;AACnK,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,WAAW,EAAE,UAAU,EAAiE,MAAM,mCAAmC,CAAC;AACpM,OAAO,EAAE,gBAAgB,EAAE,MAAM,+DAA+D,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,kEAAkE,CAAC;AAC/G,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oEAAoE,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AACnG,OAAO,EAAE,6BAA6B,EAAE,MAAM,iFAAiF,CAAC;AAChI,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,wEAAwE,CAAC;AAC3G,OAAO,EAAE,uBAAuB,EAAE,MAAM,yEAAyE,CAAC;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IAED,KAAK,CAAC,KAAK,KAAoB,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CACtL"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI version, read from the package.json that ships beside src/ or dist/.
|
|
3
|
+
* Both layouts are one directory below the package root, so one relative URL
|
|
4
|
+
* works for the tsx dev entry and the published dist entry alike.
|
|
5
|
+
*/
|
|
6
|
+
export declare function readPackageVersion(): string;
|
|
7
|
+
/** True when argv asks for the version instead of a command. */
|
|
8
|
+
export declare function isVersionRequest(argv: readonly string[]): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The state directory named by argv, or undefined when argv cannot be parsed.
|
|
11
|
+
* The fatal-error path uses this so a bad option is reported once, instead of
|
|
12
|
+
* throwing again while it tries to locate the runtime log.
|
|
13
|
+
*/
|
|
14
|
+
export declare function stateDirFromArgv(argv: readonly string[]): string | undefined;
|
|
15
|
+
//# sourceMappingURL=cli-meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-meta.d.ts","sourceRoot":"","sources":["../src/cli-meta.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAQ3C;AAED,gEAAgE;AAChE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAGjE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAM5E"}
|
package/dist/cli-meta.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { parseOptions } from "./options.js";
|
|
4
|
+
/**
|
|
5
|
+
* The CLI version, read from the package.json that ships beside src/ or dist/.
|
|
6
|
+
* Both layouts are one directory below the package root, so one relative URL
|
|
7
|
+
* works for the tsx dev entry and the published dist entry alike.
|
|
8
|
+
*/
|
|
9
|
+
export function readPackageVersion() {
|
|
10
|
+
try {
|
|
11
|
+
const path = fileURLToPath(new URL("../package.json", import.meta.url));
|
|
12
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
13
|
+
return typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : "0.0.0";
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return "0.0.0";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** True when argv asks for the version instead of a command. */
|
|
20
|
+
export function isVersionRequest(argv) {
|
|
21
|
+
const first = argv[0];
|
|
22
|
+
return first === "--version" || first === "-v";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The state directory named by argv, or undefined when argv cannot be parsed.
|
|
26
|
+
* The fatal-error path uses this so a bad option is reported once, instead of
|
|
27
|
+
* throwing again while it tries to locate the runtime log.
|
|
28
|
+
*/
|
|
29
|
+
export function stateDirFromArgv(argv) {
|
|
30
|
+
try {
|
|
31
|
+
return parseOptions(argv).stateDir;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=cli-meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-meta.js","sourceRoot":"","sources":["../src/cli-meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACxE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAA0B,CAAC;QAC/E,OAAO,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACpG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,gBAAgB,CAAC,IAAuB;IACtD,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAuB;IACtD,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|