@action-llama/action-llama 0.13.7 → 0.14.1
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/agent-docs/AGENTS.md +123 -207
- package/dist/agents/container-entry.d.ts +1 -3
- package/dist/agents/container-entry.d.ts.map +1 -1
- package/dist/agents/container-entry.js +208 -154
- package/dist/agents/container-entry.js.map +1 -1
- package/dist/agents/container-runner.d.ts.map +1 -1
- package/dist/agents/container-runner.js +19 -8
- package/dist/agents/container-runner.js.map +1 -1
- package/dist/agents/context-injection.d.ts +7 -0
- package/dist/agents/context-injection.d.ts.map +1 -0
- package/dist/agents/context-injection.js +27 -0
- package/dist/agents/context-injection.js.map +1 -0
- package/dist/agents/execution-engine.d.ts.map +1 -1
- package/dist/agents/execution-engine.js +99 -109
- package/dist/agents/execution-engine.js.map +1 -1
- package/dist/agents/model-fallback.d.ts +18 -0
- package/dist/agents/model-fallback.d.ts.map +1 -0
- package/dist/agents/model-fallback.js +40 -0
- package/dist/agents/model-fallback.js.map +1 -0
- package/dist/agents/prompt.d.ts +9 -2
- package/dist/agents/prompt.d.ts.map +1 -1
- package/dist/agents/prompt.js +21 -49
- package/dist/agents/prompt.js.map +1 -1
- package/dist/agents/runner.d.ts +2 -0
- package/dist/agents/runner.d.ts.map +1 -1
- package/dist/agents/runner.js +142 -124
- package/dist/agents/runner.js.map +1 -1
- package/dist/agents/session-factory.d.ts +13 -0
- package/dist/agents/session-factory.d.ts.map +1 -0
- package/dist/agents/session-factory.js +27 -0
- package/dist/agents/session-factory.js.map +1 -0
- package/dist/build-info.json +1 -1
- package/dist/cli/commands/agent.d.ts.map +1 -1
- package/dist/cli/commands/agent.js +43 -23
- package/dist/cli/commands/agent.js.map +1 -1
- package/dist/cli/commands/chat.d.ts.map +1 -1
- package/dist/cli/commands/chat.js +26 -43
- package/dist/cli/commands/chat.js.map +1 -1
- package/dist/cli/commands/claude.d.ts +4 -0
- package/dist/cli/commands/claude.d.ts.map +1 -0
- package/dist/cli/commands/claude.js +8 -0
- package/dist/cli/commands/claude.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +24 -6
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/mcp.d.ts +8 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/mcp.js +31 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/new.d.ts.map +1 -1
- package/dist/cli/commands/new.js +15 -6
- package/dist/cli/commands/new.js.map +1 -1
- package/dist/cli/commands/run.js +1 -1
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/start.js +2 -2
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/stats.d.ts +9 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +149 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +3 -0
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/main.js +50 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/gateway/index.d.ts +3 -0
- package/dist/gateway/index.d.ts.map +1 -1
- package/dist/gateway/index.js +7 -1
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/lock-store.d.ts +10 -0
- package/dist/gateway/lock-store.d.ts.map +1 -1
- package/dist/gateway/lock-store.js +38 -0
- package/dist/gateway/lock-store.js.map +1 -1
- package/dist/gateway/routes/dashboard.d.ts +2 -1
- package/dist/gateway/routes/dashboard.d.ts.map +1 -1
- package/dist/gateway/routes/dashboard.js +26 -6
- package/dist/gateway/routes/dashboard.js.map +1 -1
- package/dist/gateway/routes/locks.d.ts.map +1 -1
- package/dist/gateway/routes/locks.js +39 -0
- package/dist/gateway/routes/locks.js.map +1 -1
- package/dist/gateway/routes/logs.d.ts.map +1 -1
- package/dist/gateway/routes/logs.js +4 -5
- package/dist/gateway/routes/logs.js.map +1 -1
- package/dist/gateway/routes/stats.d.ts +4 -0
- package/dist/gateway/routes/stats.d.ts.map +1 -0
- package/dist/gateway/routes/stats.js +25 -0
- package/dist/gateway/routes/stats.js.map +1 -0
- package/dist/gateway/views/agent-detail-page.d.ts +12 -0
- package/dist/gateway/views/agent-detail-page.d.ts.map +1 -0
- package/dist/gateway/views/agent-detail-page.js +303 -0
- package/dist/gateway/views/agent-detail-page.js.map +1 -0
- package/dist/gateway/views/dashboard-page.d.ts.map +1 -1
- package/dist/gateway/views/dashboard-page.js +179 -245
- package/dist/gateway/views/dashboard-page.js.map +1 -1
- package/dist/gateway/views/instance-detail-page.d.ts +24 -0
- package/dist/gateway/views/instance-detail-page.d.ts.map +1 -0
- package/dist/gateway/views/instance-detail-page.js +277 -0
- package/dist/gateway/views/instance-detail-page.js.map +1 -0
- package/dist/gateway/views/layout.d.ts +17 -0
- package/dist/gateway/views/layout.d.ts.map +1 -0
- package/dist/gateway/views/layout.js +153 -0
- package/dist/gateway/views/layout.js.map +1 -0
- package/dist/gateway/views/login-page.d.ts.map +1 -1
- package/dist/gateway/views/login-page.js +24 -37
- package/dist/gateway/views/login-page.js.map +1 -1
- package/dist/hooks/runner.d.ts +12 -0
- package/dist/hooks/runner.d.ts.map +1 -0
- package/dist/hooks/runner.js +32 -0
- package/dist/hooks/runner.js.map +1 -0
- package/dist/mcp/server.d.ts +5 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +336 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/scheduler/call-dispatcher.d.ts +2 -2
- package/dist/scheduler/call-dispatcher.js +3 -3
- package/dist/scheduler/call-dispatcher.js.map +1 -1
- package/dist/scheduler/execution.d.ts +5 -2
- package/dist/scheduler/execution.d.ts.map +1 -1
- package/dist/scheduler/execution.js +75 -4
- package/dist/scheduler/execution.js.map +1 -1
- package/dist/scheduler/gateway-setup.d.ts +2 -0
- package/dist/scheduler/gateway-setup.d.ts.map +1 -1
- package/dist/scheduler/gateway-setup.js +3 -2
- package/dist/scheduler/gateway-setup.js.map +1 -1
- package/dist/scheduler/image-builder.js +3 -3
- package/dist/scheduler/image-builder.js.map +1 -1
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +16 -3
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/shutdown.d.ts +2 -0
- package/dist/scheduler/shutdown.d.ts.map +1 -1
- package/dist/scheduler/shutdown.js +4 -1
- package/dist/scheduler/shutdown.js.map +1 -1
- package/dist/scheduler/validation.d.ts.map +1 -1
- package/dist/scheduler/validation.js +5 -3
- package/dist/scheduler/validation.js.map +1 -1
- package/dist/scheduler/watcher.d.ts +1 -1
- package/dist/scheduler/watcher.js +1 -1
- package/dist/scheduler/webhook-setup.d.ts +2 -0
- package/dist/scheduler/webhook-setup.d.ts.map +1 -1
- package/dist/scheduler/webhook-setup.js +2 -0
- package/dist/scheduler/webhook-setup.js.map +1 -1
- package/dist/setup/prompts.d.ts.map +1 -1
- package/dist/setup/prompts.js +35 -6
- package/dist/setup/prompts.js.map +1 -1
- package/dist/setup/scaffold.d.ts +6 -0
- package/dist/setup/scaffold.d.ts.map +1 -1
- package/dist/setup/scaffold.js +185 -7
- package/dist/setup/scaffold.js.map +1 -1
- package/dist/shared/config.d.ts +16 -5
- package/dist/shared/config.d.ts.map +1 -1
- package/dist/shared/config.js +75 -18
- package/dist/shared/config.js.map +1 -1
- package/dist/shared/credential-refs.d.ts.map +1 -1
- package/dist/shared/credential-refs.js +8 -0
- package/dist/shared/credential-refs.js.map +1 -1
- package/dist/shared/environment.d.ts +0 -1
- package/dist/shared/environment.d.ts.map +1 -1
- package/dist/shared/environment.js +19 -3
- package/dist/shared/environment.js.map +1 -1
- package/dist/shared/frontmatter.d.ts +11 -0
- package/dist/shared/frontmatter.d.ts.map +1 -0
- package/dist/shared/frontmatter.js +30 -0
- package/dist/shared/frontmatter.js.map +1 -0
- package/dist/shared/paths.d.ts +1 -0
- package/dist/shared/paths.d.ts.map +1 -1
- package/dist/shared/paths.js +3 -0
- package/dist/shared/paths.js.map +1 -1
- package/dist/stats/index.d.ts +3 -0
- package/dist/stats/index.d.ts.map +1 -0
- package/dist/stats/index.js +2 -0
- package/dist/stats/index.js.map +1 -0
- package/dist/stats/store.d.ts +89 -0
- package/dist/stats/store.d.ts.map +1 -0
- package/dist/stats/store.js +242 -0
- package/dist/stats/store.js.map +1 -0
- package/dist/tui/status-tracker.d.ts +6 -1
- package/dist/tui/status-tracker.d.ts.map +1 -1
- package/dist/tui/status-tracker.js +11 -1
- package/dist/tui/status-tracker.js.map +1 -1
- package/docker/bin/{al-call → al-subagent} +2 -2
- package/docker/bin/{al-check → al-subagent-check} +2 -2
- package/docker/bin/{al-wait → al-subagent-wait} +2 -2
- package/package.json +8 -21
- package/LICENSE +0 -21
- package/README.md +0 -192
- package/dist/gateway/views/logs-page.d.ts +0 -2
- package/dist/gateway/views/logs-page.d.ts.map +0 -1
- package/dist/gateway/views/logs-page.js +0 -280
- package/dist/gateway/views/logs-page.js.map +0 -1
- package/dist/preflight/interpolate.d.ts +0 -10
- package/dist/preflight/interpolate.d.ts.map +0 -1
- package/dist/preflight/interpolate.js +0 -33
- package/dist/preflight/interpolate.js.map +0 -1
- package/dist/preflight/providers/git-clone.d.ts +0 -3
- package/dist/preflight/providers/git-clone.d.ts.map +0 -1
- package/dist/preflight/providers/git-clone.js +0 -36
- package/dist/preflight/providers/git-clone.js.map +0 -1
- package/dist/preflight/providers/http.d.ts +0 -3
- package/dist/preflight/providers/http.d.ts.map +0 -1
- package/dist/preflight/providers/http.js +0 -36
- package/dist/preflight/providers/http.js.map +0 -1
- package/dist/preflight/providers/shell.d.ts +0 -3
- package/dist/preflight/providers/shell.d.ts.map +0 -1
- package/dist/preflight/providers/shell.js +0 -28
- package/dist/preflight/providers/shell.js.map +0 -1
- package/dist/preflight/registry.d.ts +0 -4
- package/dist/preflight/registry.d.ts.map +0 -1
- package/dist/preflight/registry.js +0 -20
- package/dist/preflight/registry.js.map +0 -1
- package/dist/preflight/runner.d.ts +0 -7
- package/dist/preflight/runner.d.ts.map +0 -1
- package/dist/preflight/runner.js +0 -28
- package/dist/preflight/runner.js.map +0 -1
- package/dist/preflight/schema.d.ts +0 -21
- package/dist/preflight/schema.d.ts.map +0 -1
- package/dist/preflight/schema.js +0 -9
- package/dist/preflight/schema.js.map +0 -1
package/README.md
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
# Action Llama
|
|
2
|
-
|
|
3
|
-
[](https://github.com/Action-Llama/action-llama/actions/workflows/ci.yml)
|
|
4
|
-
[](https://www.npmjs.com/package/@action-llama/action-llama)
|
|
5
|
-
|
|
6
|
-
Deploy agent workflows to the cloud.
|
|
7
|
-
|
|
8
|
-
- [**Documentation**](https://docs.actionllama.org)
|
|
9
|
-
- [**actionllama.org**](https://actionllama.org)
|
|
10
|
-
|
|
11
|
-
Built on [pi.dev](https://github.com/badlogic/pi-mono) as the agent harness.
|
|
12
|
-
|
|
13
|
-
## How to get started
|
|
14
|
-
|
|
15
|
-
### 1. Create a project
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npx @action-llama/action-llama@next new my-project
|
|
19
|
-
cd my-project
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
This scaffolds the project and sets up your model credentials and defaults.
|
|
23
|
-
|
|
24
|
-
### 2. Create and manage agents
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npx al chat
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
The chat console helps you create and manage agents. If no agents exist yet, it will offer to create one for you.
|
|
31
|
-
|
|
32
|
-
You can also create agents manually — see the [creating agents guide](docs/creating-agents.md).
|
|
33
|
-
|
|
34
|
-
Or, if you're using your own coding agent just make sure it reads the AGENTS.md in your project root.
|
|
35
|
-
|
|
36
|
-
### 3. Run
|
|
37
|
-
|
|
38
|
-
Once your agents are ready, start the scheduler!
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npx al start
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
If any credentials are missing, it will prompt you for them. Credentials are stored in `~/.action-llama/credentials/` (shared across projects, not committed to git). See [credentials docs](docs/credentials.md) for details.
|
|
45
|
-
|
|
46
|
-
### Project structure
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
my-project/
|
|
50
|
-
package.json # Includes @action-llama/action-llama as a dependency
|
|
51
|
-
Dockerfile # Project base image. Generated. Shared customizations for all agents
|
|
52
|
-
AGENTS.md # Project overview, Generated. Credential/webhook reference, example agent
|
|
53
|
-
config.toml # Global config: [local], [model], gateway, webhooks (no secrets)
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Each agent subdirectory:
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
dev/ # Agent name
|
|
60
|
-
agent-config.toml # Agent config: credentials, model, schedule, webhooks, params
|
|
61
|
-
ACTIONS.md # Agent instructions (system prompt) — edit to customize behavior
|
|
62
|
-
Dockerfile # (optional) Custom Docker image for this agent
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Deployment
|
|
66
|
-
|
|
67
|
-
For production, deploy agents to a VPS for cost-effective remote hosting.
|
|
68
|
-
|
|
69
|
-
Action Llama supports:
|
|
70
|
-
|
|
71
|
-
- **VPS** (Vultr, DigitalOcean, Hetzner, etc.) — SSH + Docker, no registry needed
|
|
72
|
-
|
|
73
|
-
See the [VPS deployment docs](docs/vps-deployment.md) for setup details.
|
|
74
|
-
|
|
75
|
-
## CLI commands
|
|
76
|
-
|
|
77
|
-
If you installed globally (`npm install -g @action-llama/action-llama`), you can use `al` directly. Otherwise, prefix commands with `npx` (e.g., `npx al start`).
|
|
78
|
-
|
|
79
|
-
| Command | Description |
|
|
80
|
-
|---------|-------------|
|
|
81
|
-
| `al new <name>` | Interactive setup — creates project directory and credentials |
|
|
82
|
-
| `al chat [agent]` | Interactive console — or agent-scoped session with credentials loaded |
|
|
83
|
-
| `al doctor` | Check agents, credentials, webhooks, and config — prompt to fix |
|
|
84
|
-
| `al creds ls` | List stored credentials (names only, no secrets) |
|
|
85
|
-
| `al run <agent>` | Manually run a single agent |
|
|
86
|
-
| `al start` | Start the scheduler |
|
|
87
|
-
| `al stat` | Show agent status |
|
|
88
|
-
| `al logs <agent>` | View agent log files |
|
|
89
|
-
| `al pause [name]` | Pause the scheduler, or a single agent by name |
|
|
90
|
-
| `al resume [name]` | Resume the scheduler, or a single agent by name |
|
|
91
|
-
| `al kill <target>` | Kill an agent (all instances) or a single instance by ID |
|
|
92
|
-
|
|
93
|
-
Most commands accept `-p <dir>` to set the project directory. See the [CLI command reference](docs/commands.md) for all options and flags.
|
|
94
|
-
|
|
95
|
-
## Configuration
|
|
96
|
-
|
|
97
|
-
Configuration lives in two places:
|
|
98
|
-
|
|
99
|
-
- [**`config.toml`**](docs/config-reference.md) (project root) — global settings: default model (`[model]`), local Docker options (`[local]`), gateway, webhooks, and scheduler options like `maxReruns`.
|
|
100
|
-
- [**`agent-config.toml`**](docs/agent-config-reference.md) (per agent) — model, credentials, schedule, webhooks, and parameters. Each agent can use a different model or provider (e.g., Claude Opus for dev, GPT-4o for review, Gemini for devops).
|
|
101
|
-
|
|
102
|
-
Credentials are stored outside the project in `~/.action-llama/credentials/` and referenced by name in agent configs. Run `al doctor` to configure them interactively.
|
|
103
|
-
|
|
104
|
-
Agents run in isolated Docker containers for security and consistency.
|
|
105
|
-
|
|
106
|
-
See also the [credentials](docs/credentials.md), [webhooks](docs/webhooks.md), and [Docker](docs/docker.md) docs for details.
|
|
107
|
-
|
|
108
|
-
## Documentation
|
|
109
|
-
|
|
110
|
-
| Doc | Description |
|
|
111
|
-
|-----|-------------|
|
|
112
|
-
| [Agents](docs/agents.md) | What an agent is: config, ACTIONS.md, Dockerfile, runtime prompt |
|
|
113
|
-
| [CLI Commands](docs/commands.md) | All CLI commands with options and flags |
|
|
114
|
-
| [Creating Agents](docs/creating-agents.md) | Step-by-step guide to creating a new agent |
|
|
115
|
-
| [config.toml Reference](docs/config-reference.md) | Project-level config: model, Docker, gateway, webhooks |
|
|
116
|
-
| [agent-config.toml Reference](docs/agent-config-reference.md) | Per-agent config fields with examples |
|
|
117
|
-
| [Models](docs/models.md) | Supported LLM providers, model IDs, auth types, thinking levels |
|
|
118
|
-
| [Credentials](docs/credentials.md) | Credential types, storage layout, named instances |
|
|
119
|
-
| [Webhooks](docs/webhooks.md) | Webhook setup, filter fields, Sentry integration |
|
|
120
|
-
| [Docker](docs/docker.md) | Container isolation, custom Dockerfiles, filesystem layout |
|
|
121
|
-
| [Deployment](docs/deployment.md) | Deployment overview, VPS deployment guide |
|
|
122
|
-
| [VPS Deployment](docs/vps-deployment.md) | Running agents on any VPS via SSH + Docker |
|
|
123
|
-
| [Example Agents](docs/examples/index.md) | Dev, reviewer, and devops agent templates |
|
|
124
|
-
|
|
125
|
-
## Developing
|
|
126
|
-
|
|
127
|
-
### Prerequisites
|
|
128
|
-
|
|
129
|
-
- Node.js >= 20, Git, Docker
|
|
130
|
-
- GitHub PAT with `repo` + `workflow` scopes
|
|
131
|
-
- Anthropic auth (pi auth, API key, or OAuth token)
|
|
132
|
-
|
|
133
|
-
### Setup
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
git clone <repo>
|
|
137
|
-
cd action-llama
|
|
138
|
-
npm install
|
|
139
|
-
npm run build
|
|
140
|
-
npm test
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### How it works
|
|
144
|
-
|
|
145
|
-
`al start` runs a single Node.js process (the **scheduler**) that:
|
|
146
|
-
|
|
147
|
-
1. Discovers agents in the project directory (each subdirectory with an `agent-config.toml`)
|
|
148
|
-
2. Starts a **gateway** HTTP server if webhooks or Docker mode are enabled (health check, webhook receiver, shutdown kill switch)
|
|
149
|
-
3. Creates a **runner** per agent — either `AgentRunner` (host mode) or `ContainerAgentRunner` (Docker mode)
|
|
150
|
-
4. Wires up **cron jobs** and/or **webhook bindings** to trigger each runner
|
|
151
|
-
5. On trigger, the runner builds a prompt (injecting `<agent-config>` and optionally `<webhook-trigger>` blocks), starts a [pi-coding-agent](https://github.com/badlogic/pi-mono) session, and streams output to the logger
|
|
152
|
-
|
|
153
|
-
### Source layout
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
src/
|
|
157
|
-
cli/ # Command definitions (new, doctor, start, status, logs, push, env)
|
|
158
|
-
setup/ # Project scaffolding
|
|
159
|
-
scheduler/ # Scheduler: discovers agents, starts gateway, wires cron + webhooks
|
|
160
|
-
agents/ # Agent runners (host + Docker), prompt builder
|
|
161
|
-
gateway/ # HTTP server: router, health, shutdown, webhook routes
|
|
162
|
-
docker/ # Container lifecycle (launch, wait, logs, remove), image + network
|
|
163
|
-
webhooks/ # Webhook registry, provider interface, GitHub provider
|
|
164
|
-
tui/ # Ink-based terminal UI (App.tsx, status tracker)
|
|
165
|
-
shared/ # Config loader, credentials, logger, paths, git helpers
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### Tests
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
npm run test:unit # unit tests only (fast, run during development)
|
|
172
|
-
npm test # all tests including integration (run before committing)
|
|
173
|
-
npm run test:integration # integration tests only (Docker-based, slow)
|
|
174
|
-
npm run test:watch # watch mode (unit tests only)
|
|
175
|
-
npm run test:coverage # V8 coverage report
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
Tests live in `test/` mirroring `src/`. Integration tests are in `test/integration/` and require Docker. Coverage excludes entry points (`cli/main.ts`), interactive prompts (`setup/prompts.ts`), and type-only files.
|
|
179
|
-
|
|
180
|
-
### Publishing
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
npm login # need @action-llama org access
|
|
184
|
-
npm version patch # or minor / major — bumps, tags, pushes
|
|
185
|
-
npm publish --access public # build + tests run automatically via prepublishOnly
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
Published tarball includes `dist/`, `docker/`, `README.md`, `LICENSE`, and `package.json`.
|
|
189
|
-
|
|
190
|
-
## License
|
|
191
|
-
|
|
192
|
-
MIT
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logs-page.d.ts","sourceRoot":"","sources":["../../../src/gateway/views/logs-page.ts"],"names":[],"mappings":"AAQA,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA+QxD"}
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
function escapeHtml(str) {
|
|
2
|
-
return str
|
|
3
|
-
.replace(/&/g, "&")
|
|
4
|
-
.replace(/</g, "<")
|
|
5
|
-
.replace(/>/g, ">")
|
|
6
|
-
.replace(/"/g, """);
|
|
7
|
-
}
|
|
8
|
-
export function renderLogsPage(agentName) {
|
|
9
|
-
return `<!DOCTYPE html>
|
|
10
|
-
<html lang="en">
|
|
11
|
-
<head>
|
|
12
|
-
<meta charset="utf-8">
|
|
13
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
14
|
-
<title>${escapeHtml(agentName)} — Logs — Action Llama</title>
|
|
15
|
-
<style>
|
|
16
|
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
17
|
-
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: #0f172a; color: #e2e8f0; padding: 16px; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
|
|
18
|
-
.top-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-shrink: 0; flex-wrap: wrap; }
|
|
19
|
-
.top-bar a { color: #60a5fa; text-decoration: none; font-size: 0.9rem; }
|
|
20
|
-
.top-bar a:hover { text-decoration: underline; }
|
|
21
|
-
h1 { font-size: 1.2rem; color: #f8fafc; }
|
|
22
|
-
.agent-state { font-size: 0.85rem; color: #94a3b8; }
|
|
23
|
-
.state-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
|
|
24
|
-
.controls { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-shrink: 0; flex-wrap: wrap; }
|
|
25
|
-
.controls button { background: #334155; color: #e2e8f0; border: 1px solid #475569; border-radius: 4px; padding: 6px 14px; cursor: pointer; font-size: 0.8rem; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
|
|
26
|
-
.controls button:hover { background: #475569; }
|
|
27
|
-
.controls button.active { background: #3b82f6; border-color: #3b82f6; }
|
|
28
|
-
.controls .status { font-size: 0.8rem; color: #64748b; }
|
|
29
|
-
.log-container { flex: 1; background: #1e293b; border-radius: 8px; padding: 12px; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.75rem; line-height: 1.5; overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; }
|
|
30
|
-
.log-line { white-space: pre-wrap; word-break: break-all; padding: 1px 0; }
|
|
31
|
-
.log-time { color: #64748b; }
|
|
32
|
-
.log-msg { color: #cbd5e1; }
|
|
33
|
-
.log-assistant { color: #f8fafc; font-weight: 500; }
|
|
34
|
-
.log-assistant-cont { color: #f8fafc; padding-left: 7.5em; display: block; }
|
|
35
|
-
.log-bash { color: #22d3ee; }
|
|
36
|
-
.log-tool { color: #60a5fa; }
|
|
37
|
-
.log-tool-error { color: #ef4444; }
|
|
38
|
-
.log-lifecycle { color: #c084fc; font-weight: 600; }
|
|
39
|
-
.log-completed { color: #22c55e; font-weight: 600; }
|
|
40
|
-
.log-dim { color: #64748b; }
|
|
41
|
-
.log-warn { color: #eab308; }
|
|
42
|
-
.log-error { color: #ef4444; font-weight: 600; }
|
|
43
|
-
.log-detail { color: #64748b; padding-left: 7.5em; display: block; font-size: 0.9em; }
|
|
44
|
-
.run-header { border-top: 1px solid #334155; margin-top: 8px; padding-top: 6px; color: #c084fc; font-weight: 600; }
|
|
45
|
-
.empty { color: #475569; font-style: italic; }
|
|
46
|
-
.connection-status { font-size: 0.75rem; padding: 2px 8px; border-radius: 3px; }
|
|
47
|
-
.connection-status.connected { color: #22c55e; }
|
|
48
|
-
.connection-status.disconnected { color: #ef4444; }
|
|
49
|
-
|
|
50
|
-
@media (max-width: 640px) {
|
|
51
|
-
body { padding: 10px; }
|
|
52
|
-
h1 { font-size: 1.05rem; }
|
|
53
|
-
.top-bar { gap: 8px; margin-bottom: 8px; }
|
|
54
|
-
.top-bar a { font-size: 0.8rem; }
|
|
55
|
-
.controls button { padding: 8px 14px; font-size: 0.8rem; }
|
|
56
|
-
.log-container { padding: 10px; font-size: 0.65rem; line-height: 1.45; border-radius: 6px; }
|
|
57
|
-
.agent-state { font-size: 0.75rem; }
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@media (min-width: 641px) {
|
|
61
|
-
body { padding: 24px; }
|
|
62
|
-
.log-container { padding: 16px; font-size: 0.8rem; line-height: 1.6; }
|
|
63
|
-
}
|
|
64
|
-
</style>
|
|
65
|
-
</head>
|
|
66
|
-
<body>
|
|
67
|
-
<div class="top-bar">
|
|
68
|
-
<a href="/dashboard">← Dashboard</a>
|
|
69
|
-
<h1>${escapeHtml(agentName)}</h1>
|
|
70
|
-
<span class="agent-state" id="agent-state"></span>
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<div class="controls">
|
|
74
|
-
<button id="follow-btn" class="active" onclick="toggleFollow()">Follow</button>
|
|
75
|
-
<button onclick="clearLogs()">Clear</button>
|
|
76
|
-
<span class="status" id="line-count">0 lines</span>
|
|
77
|
-
<span class="connection-status connected" id="conn-status">connected</span>
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
<div class="log-container" id="log-container">
|
|
81
|
-
<div class="empty" id="empty-msg">Waiting for logs...</div>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<script>
|
|
85
|
-
const agentName = ${JSON.stringify(agentName)};
|
|
86
|
-
const container = document.getElementById("log-container");
|
|
87
|
-
const emptyMsg = document.getElementById("empty-msg");
|
|
88
|
-
const followBtn = document.getElementById("follow-btn");
|
|
89
|
-
const lineCountEl = document.getElementById("line-count");
|
|
90
|
-
const connStatus = document.getElementById("conn-status");
|
|
91
|
-
const agentStateEl = document.getElementById("agent-state");
|
|
92
|
-
|
|
93
|
-
const stateColors = { running: "#22c55e", building: "#eab308", error: "#ef4444", idle: "#6b7280" };
|
|
94
|
-
let follow = true;
|
|
95
|
-
let lineCount = 0;
|
|
96
|
-
|
|
97
|
-
function esc(s) { const d = document.createElement("div"); d.textContent = s; return d.innerHTML; }
|
|
98
|
-
|
|
99
|
-
function toggleFollow() {
|
|
100
|
-
follow = !follow;
|
|
101
|
-
followBtn.classList.toggle("active", follow);
|
|
102
|
-
if (follow) container.scrollTop = container.scrollHeight;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function clearLogs() {
|
|
106
|
-
container.innerHTML = "";
|
|
107
|
-
lineCount = 0;
|
|
108
|
-
lineCountEl.textContent = "0 lines";
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const SKIP_MSGS = new Set(["event", "tool done"]);
|
|
112
|
-
|
|
113
|
-
function fmtTime(ts) {
|
|
114
|
-
return new Date(ts).toLocaleTimeString("en-US", { hour12: false });
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function formatEntry(p) {
|
|
118
|
-
var time = '<span class="log-time">' + esc(fmtTime(p.time)) + '</span> ';
|
|
119
|
-
var msg = p.msg || "";
|
|
120
|
-
var lvl = p.level || 30;
|
|
121
|
-
|
|
122
|
-
// Skip noise
|
|
123
|
-
if (SKIP_MSGS.has(msg)) return null;
|
|
124
|
-
if (lvl <= 20 && msg !== "tool start") return null;
|
|
125
|
-
|
|
126
|
-
// Assistant text
|
|
127
|
-
if (msg === "assistant") {
|
|
128
|
-
var text = p.text || "";
|
|
129
|
-
if (!text) return null;
|
|
130
|
-
var lines = text.split("\\n");
|
|
131
|
-
var out = time + '<span class="log-assistant">' + esc(lines[0]) + '</span>';
|
|
132
|
-
for (var i = 1; i < lines.length; i++) {
|
|
133
|
-
out += '<span class="log-assistant-cont">' + esc(lines[i]) + '</span>';
|
|
134
|
-
}
|
|
135
|
-
return out;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Bash command
|
|
139
|
-
if (msg === "bash") {
|
|
140
|
-
return time + '<span class="log-bash">$ ' + esc(p.cmd || "") + '</span>';
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Tool start
|
|
144
|
-
if (msg === "tool start") {
|
|
145
|
-
return time + '<span class="log-tool">\\u25b8 ' + esc(p.tool || "unknown") + '</span>';
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Tool error
|
|
149
|
-
if (msg === "tool error") {
|
|
150
|
-
var out = time + '<span class="log-tool-error">\\u2717 ' + esc(p.tool || "unknown") + ' failed</span>';
|
|
151
|
-
if (p.cmd) out += '<span class="log-detail">$ ' + esc(String(p.cmd)) + '</span>';
|
|
152
|
-
if (p.result) out += '<span class="log-detail">' + esc(String(p.result).slice(0, 300)) + '</span>';
|
|
153
|
-
return out;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// Run start
|
|
157
|
-
if (msg.startsWith && msg.startsWith("Starting ")) {
|
|
158
|
-
var ctr = p.container ? ' <span class="log-dim">(' + esc(p.container) + ')</span>' : "";
|
|
159
|
-
return time + '<span class="log-lifecycle">' + esc(msg) + '</span>' + ctr;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Run completed
|
|
163
|
-
if (msg === "run completed" || msg === "run completed, rerun requested") {
|
|
164
|
-
var suffix = msg.includes("rerun") ? ' <span class="log-warn">(rerun requested)</span>' : "";
|
|
165
|
-
return time + '<span class="log-completed">Run completed</span>' + suffix;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Container lifecycle
|
|
169
|
-
if (msg === "container launched") {
|
|
170
|
-
var ctr = p.container ? ' ' + esc(p.container) : "";
|
|
171
|
-
return time + '<span class="log-dim">Container launched' + ctr + '</span>';
|
|
172
|
-
}
|
|
173
|
-
if (msg === "container finished" || msg === "container finished (rerun requested)") {
|
|
174
|
-
var el = p.elapsed ? ' (' + esc(p.elapsed) + ')' : "";
|
|
175
|
-
return time + '<span class="log-dim">Container finished' + el + '</span>';
|
|
176
|
-
}
|
|
177
|
-
if (msg === "container starting") {
|
|
178
|
-
var model = p.modelId ? ' <span class="log-dim">model=' + esc(p.modelId) + '</span>' : "";
|
|
179
|
-
return time + '<span class="log-lifecycle">Container starting: ' + esc(p.agentName || "") + '</span>' + model;
|
|
180
|
-
}
|
|
181
|
-
if (msg === "creating agent session" || msg === "session created, sending prompt") {
|
|
182
|
-
return time + '<span class="log-dim">' + esc(msg) + '</span>';
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Errors
|
|
186
|
-
if (lvl >= 50) {
|
|
187
|
-
var detail = p.err ? '<span class="log-detail">' + esc(JSON.stringify(p.err).slice(0, 300)) + '</span>' : "";
|
|
188
|
-
return time + '<span class="log-error">ERROR: ' + esc(msg) + '</span>' + detail;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// Warnings
|
|
192
|
-
if (lvl >= 40) {
|
|
193
|
-
return time + '<span class="log-warn">WARN: ' + esc(msg) + '</span>';
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Catch-all
|
|
197
|
-
return time + '<span class="log-dim">' + esc(msg) + '</span>';
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function maybeRunHeader(p) {
|
|
201
|
-
var msg = p.msg || "";
|
|
202
|
-
if (msg.startsWith && msg.startsWith("Starting ") && (msg.includes(" run") || msg.includes(" container run"))) {
|
|
203
|
-
var name = p.name || "agent";
|
|
204
|
-
var ctr = p.container ? " " + p.container : "";
|
|
205
|
-
return '<div class="log-line run-header">\\u2500\\u2500 ' + esc(name + ctr) + ' ' + "\\u2500".repeat(50) + '</div>';
|
|
206
|
-
}
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
function appendEntry(p) {
|
|
211
|
-
if (emptyMsg && emptyMsg.parentNode) emptyMsg.remove();
|
|
212
|
-
var header = maybeRunHeader(p);
|
|
213
|
-
if (header) {
|
|
214
|
-
var hdiv = document.createElement("div");
|
|
215
|
-
hdiv.innerHTML = header;
|
|
216
|
-
container.appendChild(hdiv.firstChild);
|
|
217
|
-
}
|
|
218
|
-
var html = formatEntry(p);
|
|
219
|
-
if (!html) return;
|
|
220
|
-
var div = document.createElement("div");
|
|
221
|
-
div.className = "log-line";
|
|
222
|
-
div.innerHTML = html;
|
|
223
|
-
container.appendChild(div);
|
|
224
|
-
lineCount++;
|
|
225
|
-
lineCountEl.textContent = lineCount + " line" + (lineCount !== 1 ? "s" : "");
|
|
226
|
-
if (follow) container.scrollTop = container.scrollHeight;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Pause follow when user scrolls up
|
|
230
|
-
container.addEventListener("scroll", () => {
|
|
231
|
-
const atBottom = container.scrollHeight - container.scrollTop - container.clientHeight < 50;
|
|
232
|
-
if (!atBottom && follow) {
|
|
233
|
-
follow = false;
|
|
234
|
-
followBtn.classList.remove("active");
|
|
235
|
-
} else if (atBottom && !follow) {
|
|
236
|
-
follow = true;
|
|
237
|
-
followBtn.classList.add("active");
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
// Log polling via cursor-based API
|
|
242
|
-
let logCursor = null;
|
|
243
|
-
let pollTimer = null;
|
|
244
|
-
async function fetchLogs(initial) {
|
|
245
|
-
try {
|
|
246
|
-
const params = new URLSearchParams();
|
|
247
|
-
if (initial) params.set("lines", "100");
|
|
248
|
-
if (logCursor) params.set("cursor", logCursor);
|
|
249
|
-
const res = await fetch("/api/logs/agents/" + encodeURIComponent(agentName) + "?" + params, { credentials: "same-origin" });
|
|
250
|
-
if (!res.ok) throw new Error(res.status);
|
|
251
|
-
const data = await res.json();
|
|
252
|
-
for (const entry of data.entries) appendEntry(entry);
|
|
253
|
-
if (data.cursor) logCursor = data.cursor;
|
|
254
|
-
connStatus.textContent = "connected";
|
|
255
|
-
connStatus.className = "connection-status connected";
|
|
256
|
-
} catch {
|
|
257
|
-
connStatus.textContent = "disconnected";
|
|
258
|
-
connStatus.className = "connection-status disconnected";
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
fetchLogs(true);
|
|
262
|
-
pollTimer = setInterval(function() { fetchLogs(false); }, 1500);
|
|
263
|
-
|
|
264
|
-
// Status stream for agent state
|
|
265
|
-
const statusEs = new EventSource("/dashboard/api/status-stream");
|
|
266
|
-
statusEs.onmessage = function(e) {
|
|
267
|
-
const data = JSON.parse(e.data);
|
|
268
|
-
if (data.agents) {
|
|
269
|
-
const agent = data.agents.find(a => a.name === agentName);
|
|
270
|
-
if (agent) {
|
|
271
|
-
const color = stateColors[agent.state] || "#6b7280";
|
|
272
|
-
agentStateEl.innerHTML = '<span class="state-dot" style="background:' + color + '"></span> ' + esc(agent.state);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
</script>
|
|
277
|
-
</body>
|
|
278
|
-
</html>`;
|
|
279
|
-
}
|
|
280
|
-
//# sourceMappingURL=logs-page.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logs-page.js","sourceRoot":"","sources":["../../../src/gateway/views/logs-page.ts"],"names":[],"mappings":"AAAA,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAO,GAAG;SACP,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,OAAO;;;;;SAKA,UAAU,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAuDpB,UAAU,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;wBAgBP,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAiMzC,CAAC;AACT,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment variable interpolation for preflight params.
|
|
3
|
-
*
|
|
4
|
-
* Replaces `${VAR_NAME}` tokens in string values with the corresponding
|
|
5
|
-
* value from the provided env map. Nested objects and arrays are traversed
|
|
6
|
-
* recursively; non-string leaves are returned as-is.
|
|
7
|
-
*/
|
|
8
|
-
export declare function interpolateString(template: string, env: Record<string, string>): string;
|
|
9
|
-
export declare function interpolateParams(params: Record<string, unknown>, env: Record<string, string>): Record<string, unknown>;
|
|
10
|
-
//# sourceMappingURL=interpolate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../../src/preflight/interpolate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAIvF;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMzB"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment variable interpolation for preflight params.
|
|
3
|
-
*
|
|
4
|
-
* Replaces `${VAR_NAME}` tokens in string values with the corresponding
|
|
5
|
-
* value from the provided env map. Nested objects and arrays are traversed
|
|
6
|
-
* recursively; non-string leaves are returned as-is.
|
|
7
|
-
*/
|
|
8
|
-
const ENV_VAR_RE = /\$\{([A-Za-z_][A-Za-z0-9_]*)}/g;
|
|
9
|
-
export function interpolateString(template, env) {
|
|
10
|
-
return template.replace(ENV_VAR_RE, (_match, name) => {
|
|
11
|
-
return env[name] ?? "";
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
export function interpolateParams(params, env) {
|
|
15
|
-
const result = {};
|
|
16
|
-
for (const [key, value] of Object.entries(params)) {
|
|
17
|
-
result[key] = interpolateValue(value, env);
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
function interpolateValue(value, env) {
|
|
22
|
-
if (typeof value === "string") {
|
|
23
|
-
return interpolateString(value, env);
|
|
24
|
-
}
|
|
25
|
-
if (Array.isArray(value)) {
|
|
26
|
-
return value.map((v) => interpolateValue(v, env));
|
|
27
|
-
}
|
|
28
|
-
if (value !== null && typeof value === "object") {
|
|
29
|
-
return interpolateParams(value, env);
|
|
30
|
-
}
|
|
31
|
-
return value;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=interpolate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interpolate.js","sourceRoot":"","sources":["../../src/preflight/interpolate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,UAAU,GAAG,gCAAgC,CAAC;AAEpD,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,GAA2B;IAC7E,OAAO,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE;QAC3D,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,MAA+B,EAC/B,GAA2B;IAE3B,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc,EAAE,GAA2B;IACnE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,iBAAiB,CAAC,KAAgC,EAAE,GAAG,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-clone.d.ts","sourceRoot":"","sources":["../../../src/preflight/providers/git-clone.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,cAAc,CAAC;AAGxE,eAAO,MAAM,gBAAgB,EAAE,iBAsC9B,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { execSync } from "child_process";
|
|
2
|
-
import { interpolateParams } from "../interpolate.js";
|
|
3
|
-
export const gitCloneProvider = {
|
|
4
|
-
id: "git-clone",
|
|
5
|
-
async run(params, ctx) {
|
|
6
|
-
const resolved = interpolateParams(params, ctx.env);
|
|
7
|
-
const repo = resolved.repo;
|
|
8
|
-
if (typeof repo !== "string" || !repo) {
|
|
9
|
-
throw new Error("git-clone provider requires a 'repo' param");
|
|
10
|
-
}
|
|
11
|
-
const dest = resolved.dest;
|
|
12
|
-
if (typeof dest !== "string" || !dest) {
|
|
13
|
-
throw new Error("git-clone provider requires a 'dest' param");
|
|
14
|
-
}
|
|
15
|
-
// Expand short "owner/repo" to SSH URL; full URLs pass through
|
|
16
|
-
const repoUrl = repo.includes("://") || repo.startsWith("git@")
|
|
17
|
-
? repo
|
|
18
|
-
: `git@github.com:${repo}.git`;
|
|
19
|
-
const args = ["git", "clone"];
|
|
20
|
-
if (typeof resolved.branch === "string" && resolved.branch) {
|
|
21
|
-
args.push("--branch", resolved.branch);
|
|
22
|
-
}
|
|
23
|
-
if (typeof resolved.depth === "number" && resolved.depth > 0) {
|
|
24
|
-
args.push("--depth", String(resolved.depth));
|
|
25
|
-
}
|
|
26
|
-
args.push(repoUrl, dest);
|
|
27
|
-
const cmd = args.join(" ");
|
|
28
|
-
ctx.logger("info", "preflight git-clone", { repo: repoUrl, dest });
|
|
29
|
-
execSync(cmd, {
|
|
30
|
-
env: ctx.env,
|
|
31
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
32
|
-
});
|
|
33
|
-
ctx.logger("info", "preflight git-clone done", { dest });
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=git-clone.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-clone.js","sourceRoot":"","sources":["../../../src/preflight/providers/git-clone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD,EAAE,EAAE,WAAW;IAEf,KAAK,CAAC,GAAG,CAAC,MAA+B,EAAE,GAAqB;QAC9D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC3B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QACD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC3B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QAED,+DAA+D;QAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAC7D,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,kBAAkB,IAAI,MAAM,CAAC;QAEjC,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9B,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3D,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAEzB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3B,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAEnE,QAAQ,CAAC,GAAG,EAAE;YACZ,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC;QAEH,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,0BAA0B,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/preflight/providers/http.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,cAAc,CAAC;AAGxE,eAAO,MAAM,YAAY,EAAE,iBAmC1B,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { writeFileSync, mkdirSync } from "fs";
|
|
2
|
-
import { dirname } from "path";
|
|
3
|
-
import { interpolateParams } from "../interpolate.js";
|
|
4
|
-
export const httpProvider = {
|
|
5
|
-
id: "http",
|
|
6
|
-
async run(params, ctx) {
|
|
7
|
-
const resolved = interpolateParams(params, ctx.env);
|
|
8
|
-
const url = resolved.url;
|
|
9
|
-
if (typeof url !== "string" || !url) {
|
|
10
|
-
throw new Error("http provider requires a 'url' param");
|
|
11
|
-
}
|
|
12
|
-
const output = resolved.output;
|
|
13
|
-
if (typeof output !== "string" || !output) {
|
|
14
|
-
throw new Error("http provider requires an 'output' param");
|
|
15
|
-
}
|
|
16
|
-
const method = (typeof resolved.method === "string" ? resolved.method : "GET").toUpperCase();
|
|
17
|
-
const headers = {};
|
|
18
|
-
if (resolved.headers && typeof resolved.headers === "object" && !Array.isArray(resolved.headers)) {
|
|
19
|
-
for (const [k, v] of Object.entries(resolved.headers)) {
|
|
20
|
-
if (typeof v === "string")
|
|
21
|
-
headers[k] = v;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const body = typeof resolved.body === "string" ? resolved.body : undefined;
|
|
25
|
-
ctx.logger("info", "preflight http", { method, url: url.slice(0, 200) });
|
|
26
|
-
const response = await fetch(url, { method, headers, body });
|
|
27
|
-
if (!response.ok) {
|
|
28
|
-
throw new Error(`HTTP ${response.status} ${response.statusText} from ${url}`);
|
|
29
|
-
}
|
|
30
|
-
const buffer = Buffer.from(await response.arrayBuffer());
|
|
31
|
-
mkdirSync(dirname(output), { recursive: true });
|
|
32
|
-
writeFileSync(output, buffer);
|
|
33
|
-
ctx.logger("info", "preflight http output written", { path: output, bytes: buffer.length });
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=http.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/preflight/providers/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAqB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,EAAE,EAAE,MAAM;IAEV,KAAK,CAAC,GAAG,CAAC,MAA+B,EAAE,GAAqB;QAC9D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QACpD,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;QACzB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAC7F,MAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,IAAI,QAAQ,CAAC,OAAO,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACjG,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAkC,CAAC,EAAE,CAAC;gBACjF,IAAI,OAAO,CAAC,KAAK,QAAQ;oBAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAE3E,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAEzE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,QAAQ,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,SAAS,GAAG,EAAE,CAAC,CAAC;QAChF,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QACzD,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,+BAA+B,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9F,CAAC;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/preflight/providers/shell.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,cAAc,CAAC;AAGxE,eAAO,MAAM,aAAa,EAAE,iBA0B3B,CAAC"}
|