mthds 0.0.7 → 0.0.9
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 +1 -1
- package/README.md +56 -16
- package/dist/agent/commands/build.d.ts +35 -0
- package/dist/agent/commands/build.js +334 -0
- package/dist/agent/commands/build.js.map +1 -0
- package/dist/agent/commands/config.d.ts +6 -0
- package/dist/agent/commands/config.js +50 -0
- package/dist/agent/commands/config.js.map +1 -0
- package/dist/agent/commands/install.d.ts +14 -0
- package/dist/agent/commands/install.js +179 -0
- package/dist/agent/commands/install.js.map +1 -0
- package/dist/agent/commands/pipelex.d.ts +7 -0
- package/dist/agent/commands/pipelex.js +56 -0
- package/dist/agent/commands/pipelex.js.map +1 -0
- package/dist/agent/commands/plxt.d.ts +7 -0
- package/dist/agent/commands/plxt.js +27 -0
- package/dist/agent/commands/plxt.js.map +1 -0
- package/dist/agent/commands/validate.d.ts +15 -0
- package/dist/agent/commands/validate.js +118 -0
- package/dist/agent/commands/validate.js.map +1 -0
- package/dist/agent/output.d.ts +25 -0
- package/dist/agent/output.js +53 -0
- package/dist/agent/output.js.map +1 -0
- package/dist/agent/passthrough.d.ts +5 -0
- package/dist/agent/passthrough.js +19 -0
- package/dist/agent/passthrough.js.map +1 -0
- package/dist/agent-cli.d.ts +8 -0
- package/dist/agent-cli.js +237 -0
- package/dist/agent-cli.js.map +1 -0
- package/dist/cli/commands/build.d.ts +31 -0
- package/dist/cli/commands/build.js +305 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/{commands → cli/commands}/config.js +9 -6
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/index.js +58 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/install.js +276 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/package/init.d.ts +3 -0
- package/dist/cli/commands/package/init.js +108 -0
- package/dist/cli/commands/package/init.js.map +1 -0
- package/dist/cli/commands/package/list.d.ts +3 -0
- package/dist/cli/commands/package/list.js +58 -0
- package/dist/cli/commands/package/list.js.map +1 -0
- package/dist/cli/commands/package/validate.d.ts +3 -0
- package/dist/cli/commands/package/validate.js +76 -0
- package/dist/cli/commands/package/validate.js.map +1 -0
- package/dist/cli/commands/run.d.ts +12 -0
- package/dist/cli/commands/run.js +95 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +3 -0
- package/dist/cli/commands/setup.js +164 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/utils.d.ts +10 -0
- package/dist/cli/commands/utils.js +41 -0
- package/dist/cli/commands/utils.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +10 -0
- package/dist/cli/commands/validate.js +93 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli.js +236 -95
- package/dist/cli.js.map +1 -1
- package/dist/client/client.js +2 -2
- package/dist/client/client.js.map +1 -1
- package/dist/config/config.d.ts +5 -20
- package/dist/config/config.js +5 -78
- package/dist/config/config.js.map +1 -1
- package/dist/config/credentials.d.ts +25 -0
- package/dist/config/credentials.js +230 -0
- package/dist/config/credentials.js.map +1 -0
- package/dist/installer/agents/registry.d.ts +12 -0
- package/dist/installer/agents/registry.js +78 -0
- package/dist/installer/agents/registry.js.map +1 -0
- package/dist/installer/agents/types.d.ts +16 -0
- package/dist/installer/agents/types.js +6 -0
- package/dist/installer/agents/types.js.map +1 -0
- package/dist/installer/resolver/address.d.ts +2 -0
- package/dist/{resolver → installer/resolver}/address.js +6 -4
- package/dist/installer/resolver/address.js.map +1 -0
- package/dist/{resolver → installer/resolver}/github.d.ts +1 -1
- package/dist/{resolver → installer/resolver}/github.js +44 -27
- package/dist/installer/resolver/github.js.map +1 -0
- package/dist/installer/resolver/index.d.ts +6 -0
- package/dist/{resolver → installer/resolver}/index.js +1 -1
- package/dist/installer/resolver/index.js.map +1 -0
- package/dist/{resolver → installer/resolver}/local.d.ts +1 -1
- package/dist/{resolver → installer/resolver}/local.js +12 -19
- package/dist/installer/resolver/local.js.map +1 -0
- package/dist/installer/runtime/check.js.map +1 -0
- package/dist/installer/runtime/installer.js.map +1 -0
- package/dist/installer/runtime/spawn.js.map +1 -0
- package/dist/{telemetry → installer/telemetry}/posthog.d.ts +4 -6
- package/dist/installer/telemetry/posthog.js +56 -0
- package/dist/installer/telemetry/posthog.js.map +1 -0
- package/dist/package/bundle-metadata.d.ts +8 -0
- package/dist/package/bundle-metadata.js +2 -0
- package/dist/package/bundle-metadata.js.map +1 -0
- package/dist/package/bundle-scanner.d.ts +18 -0
- package/dist/package/bundle-scanner.js +77 -0
- package/dist/package/bundle-scanner.js.map +1 -0
- package/dist/package/dependency-resolver.d.ts +32 -0
- package/dist/package/dependency-resolver.js +298 -0
- package/dist/package/dependency-resolver.js.map +1 -0
- package/dist/package/discovery.d.ts +9 -0
- package/dist/package/discovery.js +32 -0
- package/dist/package/discovery.js.map +1 -0
- package/dist/package/exceptions.d.ts +36 -0
- package/dist/package/exceptions.js +73 -0
- package/dist/package/exceptions.js.map +1 -0
- package/dist/package/lock-file.d.ts +27 -0
- package/dist/package/lock-file.js +137 -0
- package/dist/package/lock-file.js.map +1 -0
- package/dist/package/manifest/convert.d.ts +14 -0
- package/dist/package/manifest/convert.js +83 -0
- package/dist/package/manifest/convert.js.map +1 -0
- package/dist/package/manifest/parser.d.ts +9 -0
- package/dist/package/manifest/parser.js +261 -0
- package/dist/package/manifest/parser.js.map +1 -0
- package/dist/package/manifest/schema.d.ts +71 -0
- package/dist/package/manifest/schema.js +73 -0
- package/dist/package/manifest/schema.js.map +1 -0
- package/dist/{resolver → package/manifest}/types.d.ts +4 -7
- package/dist/{resolver → package/manifest}/types.js.map +1 -1
- package/dist/{resolver → package/manifest}/validate.d.ts +0 -5
- package/dist/{resolver → package/manifest}/validate.js +25 -38
- package/dist/package/manifest/validate.js.map +1 -0
- package/dist/package/manifest/validation.d.ts +10 -0
- package/dist/package/manifest/validation.js +34 -0
- package/dist/package/manifest/validation.js.map +1 -0
- package/dist/package/package-cache.d.ts +24 -0
- package/dist/package/package-cache.js +92 -0
- package/dist/package/package-cache.js.map +1 -0
- package/dist/package/qualified-ref.d.ts +41 -0
- package/dist/package/qualified-ref.js +105 -0
- package/dist/package/qualified-ref.js.map +1 -0
- package/dist/package/semver.d.ts +33 -0
- package/dist/package/semver.js +77 -0
- package/dist/package/semver.js.map +1 -0
- package/dist/package/vcs-resolver.d.ts +19 -0
- package/dist/package/vcs-resolver.js +115 -0
- package/dist/package/vcs-resolver.js.map +1 -0
- package/dist/package/visibility.d.ts +25 -0
- package/dist/package/visibility.js +132 -0
- package/dist/package/visibility.js.map +1 -0
- package/dist/runners/api-runner.d.ts +3 -0
- package/dist/runners/api-runner.js +9 -1
- package/dist/runners/api-runner.js.map +1 -1
- package/dist/runners/pipelex-runner.d.ts +16 -2
- package/dist/runners/pipelex-runner.js +155 -41
- package/dist/runners/pipelex-runner.js.map +1 -1
- package/dist/runners/registry.d.ts +1 -1
- package/dist/runners/registry.js +5 -4
- package/dist/runners/registry.js.map +1 -1
- package/dist/runners/types.d.ts +17 -10
- package/dist/runners/types.js +6 -1
- package/dist/runners/types.js.map +1 -1
- package/package.json +7 -4
- package/dist/agents/claude-code.d.ts +0 -2
- package/dist/agents/claude-code.js +0 -36
- package/dist/agents/claude-code.js.map +0 -1
- package/dist/agents/cursor.d.ts +0 -2
- package/dist/agents/cursor.js +0 -11
- package/dist/agents/cursor.js.map +0 -1
- package/dist/agents/github-copilot.d.ts +0 -2
- package/dist/agents/github-copilot.js +0 -11
- package/dist/agents/github-copilot.js.map +0 -1
- package/dist/agents/registry.d.ts +0 -4
- package/dist/agents/registry.js +0 -24
- package/dist/agents/registry.js.map +0 -1
- package/dist/agents/types.d.ts +0 -25
- package/dist/agents/types.js +0 -11
- package/dist/agents/types.js.map +0 -1
- package/dist/agents/windsurf.d.ts +0 -2
- package/dist/agents/windsurf.js +0 -11
- package/dist/agents/windsurf.js.map +0 -1
- package/dist/commands/build.d.ts +0 -19
- package/dist/commands/build.js +0 -128
- package/dist/commands/build.js.map +0 -1
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/index.js +0 -63
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/install.js +0 -259
- package/dist/commands/install.js.map +0 -1
- package/dist/commands/run.d.ts +0 -11
- package/dist/commands/run.js +0 -44
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/runner.d.ts +0 -2
- package/dist/commands/runner.js +0 -59
- package/dist/commands/runner.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -1
- package/dist/commands/setup.js +0 -45
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/telemetry.d.ts +0 -3
- package/dist/commands/telemetry.js +0 -49
- package/dist/commands/telemetry.js.map +0 -1
- package/dist/commands/validate.d.ts +0 -6
- package/dist/commands/validate.js +0 -41
- package/dist/commands/validate.js.map +0 -1
- package/dist/resolver/address.d.ts +0 -2
- package/dist/resolver/address.js.map +0 -1
- package/dist/resolver/github.js.map +0 -1
- package/dist/resolver/index.d.ts +0 -6
- package/dist/resolver/index.js.map +0 -1
- package/dist/resolver/local.js.map +0 -1
- package/dist/resolver/validate.js.map +0 -1
- package/dist/runtime/check.js.map +0 -1
- package/dist/runtime/installer.js.map +0 -1
- package/dist/runtime/spawn.js.map +0 -1
- package/dist/supabase/client.d.ts +0 -4
- package/dist/supabase/client.js +0 -5
- package/dist/supabase/client.js.map +0 -1
- package/dist/supabase/methods.d.ts +0 -2
- package/dist/supabase/methods.js +0 -13
- package/dist/supabase/methods.js.map +0 -1
- package/dist/supabase/types.d.ts +0 -30
- package/dist/supabase/types.js +0 -2
- package/dist/supabase/types.js.map +0 -1
- package/dist/telemetry/posthog.js +0 -117
- package/dist/telemetry/posthog.js.map +0 -1
- /package/dist/{commands → cli/commands}/config.d.ts +0 -0
- /package/dist/{commands → cli/commands}/index.d.ts +0 -0
- /package/dist/{commands → cli/commands}/install.d.ts +0 -0
- /package/dist/{runtime → installer/runtime}/check.d.ts +0 -0
- /package/dist/{runtime → installer/runtime}/check.js +0 -0
- /package/dist/{runtime → installer/runtime}/installer.d.ts +0 -0
- /package/dist/{runtime → installer/runtime}/installer.js +0 -0
- /package/dist/{runtime → installer/runtime}/spawn.d.ts +0 -0
- /package/dist/{runtime → installer/runtime}/spawn.js +0 -0
- /package/dist/{resolver → package/manifest}/types.js +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -6,10 +6,31 @@ The MTHDS open standard is defined at [mthds.ai](https://mthds.ai). Browse and d
|
|
|
6
6
|
|
|
7
7
|
## What is a method?
|
|
8
8
|
|
|
9
|
-
A method is a packaged workflow that an AI agent (like Claude Code) can use. Methods are stored in a registry and installed locally via their unique
|
|
9
|
+
A method is a packaged workflow that an AI agent (like Claude Code) can use. Methods are stored in a registry and installed locally via their unique name.
|
|
10
10
|
|
|
11
11
|
## CLI Usage
|
|
12
12
|
|
|
13
|
+
For the full CLI reference, see [CLI.md](./CLI.md).
|
|
14
|
+
|
|
15
|
+
### Quick Start
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Set up the API runner (interactive — prompts for URL and key)
|
|
19
|
+
mthds setup runner api
|
|
20
|
+
|
|
21
|
+
# Or set up the pipelex runner (local)
|
|
22
|
+
mthds setup runner pipelex
|
|
23
|
+
|
|
24
|
+
# Run a pipeline
|
|
25
|
+
mthds run pipe my_pipe_code
|
|
26
|
+
|
|
27
|
+
# Validate a bundle
|
|
28
|
+
mthds validate ./bundle.mthds
|
|
29
|
+
|
|
30
|
+
# Install a method from the hub
|
|
31
|
+
mthds install org/repo
|
|
32
|
+
```
|
|
33
|
+
|
|
13
34
|
### Install a method
|
|
14
35
|
|
|
15
36
|
```bash
|
|
@@ -26,11 +47,11 @@ The CLI will:
|
|
|
26
47
|
|
|
27
48
|
1. Fetch the `methods/` folder from the GitHub repository
|
|
28
49
|
2. Validate each method's `METHODS.toml` manifest
|
|
29
|
-
3. If `--method <
|
|
50
|
+
3. If `--method <name>` is provided, install only that method (errors if name not found)
|
|
30
51
|
4. Ask which AI agent to install it for (Claude Code, with more coming soon)
|
|
31
52
|
5. Ask where to install — **local** (current project) or **global** (your machine)
|
|
32
53
|
6. Optionally install a [runner](#runners)
|
|
33
|
-
7. Copy all `.mthds` files to `.claude/methods/<
|
|
54
|
+
7. Copy all `.mthds` files to `.claude/methods/<name>/`
|
|
34
55
|
|
|
35
56
|
You can also install from a local directory:
|
|
36
57
|
|
|
@@ -42,8 +63,8 @@ npx mthds install --local /path/to/repo
|
|
|
42
63
|
|
|
43
64
|
| Location | Path |
|
|
44
65
|
|----------|------|
|
|
45
|
-
| Local | `<cwd>/.claude/methods/<
|
|
46
|
-
| Global | `~/.claude/methods/<
|
|
66
|
+
| Local | `<cwd>/.claude/methods/<name>/` |
|
|
67
|
+
| Global | `~/.claude/methods/<name>/` |
|
|
47
68
|
|
|
48
69
|
## Publishing a method
|
|
49
70
|
|
|
@@ -66,9 +87,9 @@ org/repo-name (or user-name/repo-name)
|
|
|
66
87
|
|
|
67
88
|
### Rules
|
|
68
89
|
|
|
69
|
-
1. The repository must be **public** on GitHub
|
|
90
|
+
1. The repository must be **public** on GitHub. You can use `org/repo-name`, `user-name/repo-name`, or the full URL `https://github.com/org/repo-name`
|
|
70
91
|
2. The repository must contain a `methods/` folder at its root
|
|
71
|
-
3. Inside `methods/`, each subfolder is a **method package
|
|
92
|
+
3. Inside `methods/`, each subfolder is a **method package**
|
|
72
93
|
4. Each method package folder must contain a `METHODS.toml` file that follows the [manifest specification](https://mthds.ai/latest/packages/manifest/)
|
|
73
94
|
5. Each method package folder should contain one or more `.mthds` files (the actual method definitions)
|
|
74
95
|
|
|
@@ -78,6 +99,7 @@ The `METHODS.toml` manifest is validated during installation. A minimal valid ma
|
|
|
78
99
|
|
|
79
100
|
```toml
|
|
80
101
|
[package]
|
|
102
|
+
name = "your-method"
|
|
81
103
|
address = "github.com/your-org/your-repo"
|
|
82
104
|
version = "1.0.0"
|
|
83
105
|
description = "A short description of what this method does"
|
|
@@ -91,9 +113,8 @@ See the full specification at [mthds.ai/latest/packages/manifest](https://mthds.
|
|
|
91
113
|
|
|
92
114
|
The CLI validates everything during install:
|
|
93
115
|
|
|
94
|
-
- Slug must be kebab-case, start with a letter, max 64 characters
|
|
95
116
|
- `METHODS.toml` must parse as valid TOML
|
|
96
|
-
- `[package]` section with `address`, `version` (semver), and `description` are required
|
|
117
|
+
- `[package]` section with `name`, `address`, `version` (semver), and `description` are required
|
|
97
118
|
- `address` must include a hostname with a dot (e.g. `github.com/...`)
|
|
98
119
|
- Invalid methods are skipped with detailed error messages; valid ones proceed to install
|
|
99
120
|
|
|
@@ -116,9 +137,28 @@ These are the only runners that exist today. Feel free to create your own runner
|
|
|
116
137
|
npx mthds setup runner pipelex
|
|
117
138
|
```
|
|
118
139
|
|
|
119
|
-
###
|
|
140
|
+
### Configure the API runner
|
|
141
|
+
|
|
142
|
+
The API runner is the default. Set it up interactively:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
mthds setup runner api
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
This prompts for the API URL and API key (masked input) and saves them to `~/.mthds/credentials`.
|
|
149
|
+
|
|
150
|
+
You can also set values directly:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
mthds config set api-key YOUR_KEY
|
|
154
|
+
mthds config set api-url https://your-api-instance.com
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Credentials are stored in `~/.mthds/credentials` and shared between mthds-js and mthds-python.
|
|
158
|
+
|
|
159
|
+
You can also use environment variables (`PIPELEX_API_KEY`, `PIPELEX_API_URL`) which take precedence over the credentials file.
|
|
120
160
|
|
|
121
|
-
See the [SDK Usage](#sdk-usage) section below to connect to a Pipelex API instance.
|
|
161
|
+
See the [SDK Usage](#sdk-usage) section below to connect to a Pipelex API instance programmatically.
|
|
122
162
|
|
|
123
163
|
## SDK Usage
|
|
124
164
|
|
|
@@ -165,11 +205,11 @@ Instead of passing options to the constructor, you can set environment variables
|
|
|
165
205
|
|
|
166
206
|
| Variable | Description |
|
|
167
207
|
|----------|-------------|
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
208
|
+
| `PIPELEX_API_URL` | Base URL of the API |
|
|
209
|
+
| `PIPELEX_API_KEY` | API authentication token |
|
|
170
210
|
|
|
171
211
|
```typescript
|
|
172
|
-
// Reads
|
|
212
|
+
// Reads PIPELEX_API_URL and PIPELEX_API_KEY from the environment
|
|
173
213
|
const client = new MthdsApiClient();
|
|
174
214
|
```
|
|
175
215
|
|
|
@@ -195,12 +235,12 @@ Either `pipe_code` or `mthds_content` must be provided.
|
|
|
195
235
|
|
|
196
236
|
## Telemetry
|
|
197
237
|
|
|
198
|
-
Anonymous usage data is collected to help rank methods on the leaderboard. Each `install` event includes the package address,
|
|
238
|
+
Anonymous usage data is collected to help rank methods on the leaderboard. Each `install` event includes the package address, name, version, and manifest metadata. No personal or device information is collected.
|
|
199
239
|
|
|
200
240
|
To opt out:
|
|
201
241
|
|
|
202
242
|
```bash
|
|
203
|
-
|
|
243
|
+
mthds telemetry disable
|
|
204
244
|
```
|
|
205
245
|
|
|
206
246
|
## Development
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent build subcommands — generate pipelines, runner code, inputs, and output schemas.
|
|
3
|
+
* Outputs JSON only.
|
|
4
|
+
*/
|
|
5
|
+
import type { RunnerType } from "../../runners/types.js";
|
|
6
|
+
interface WithRunner {
|
|
7
|
+
runner?: RunnerType;
|
|
8
|
+
libraryDir?: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function agentBuildPipe(brief: string, options: {
|
|
11
|
+
output?: string;
|
|
12
|
+
} & WithRunner): Promise<void>;
|
|
13
|
+
export declare function agentBuildRunnerMethod(name: string, options: {
|
|
14
|
+
pipe?: string;
|
|
15
|
+
output?: string;
|
|
16
|
+
} & WithRunner): Promise<void>;
|
|
17
|
+
export declare function agentBuildRunnerPipe(target: string, options: {
|
|
18
|
+
pipe?: string;
|
|
19
|
+
output?: string;
|
|
20
|
+
} & WithRunner): Promise<void>;
|
|
21
|
+
export declare function agentBuildInputsMethod(name: string, options: {
|
|
22
|
+
pipe?: string;
|
|
23
|
+
} & WithRunner): Promise<void>;
|
|
24
|
+
export declare function agentBuildInputsPipe(target: string, options: {
|
|
25
|
+
pipe?: string;
|
|
26
|
+
} & WithRunner): Promise<void>;
|
|
27
|
+
export declare function agentBuildOutputMethod(name: string, options: {
|
|
28
|
+
pipe?: string;
|
|
29
|
+
format?: string;
|
|
30
|
+
} & WithRunner): Promise<void>;
|
|
31
|
+
export declare function agentBuildOutputPipe(target: string, options: {
|
|
32
|
+
pipe?: string;
|
|
33
|
+
format?: string;
|
|
34
|
+
} & WithRunner): Promise<void>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent build subcommands — generate pipelines, runner code, inputs, and output schemas.
|
|
3
|
+
* Outputs JSON only.
|
|
4
|
+
*/
|
|
5
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { agentSuccess, agentError, AGENT_ERROR_DOMAINS } from "../output.js";
|
|
7
|
+
import { createRunner } from "../../runners/registry.js";
|
|
8
|
+
import { isPipelexRunner } from "../../cli/commands/utils.js";
|
|
9
|
+
/** Extract raw args after `build <subcommand>`, filtering out --runner, -L/--library-dir, and --log-level */
|
|
10
|
+
function extractPassthroughArgs() {
|
|
11
|
+
const argv = process.argv;
|
|
12
|
+
const buildIdx = argv.indexOf("build");
|
|
13
|
+
if (buildIdx === -1)
|
|
14
|
+
return [];
|
|
15
|
+
const raw = argv.slice(buildIdx + 2); // skip "build" + subcommand
|
|
16
|
+
const result = [];
|
|
17
|
+
let i = 0;
|
|
18
|
+
while (i < raw.length) {
|
|
19
|
+
if (raw[i] === "--runner" ||
|
|
20
|
+
raw[i] === "-L" ||
|
|
21
|
+
raw[i] === "--library-dir" ||
|
|
22
|
+
raw[i] === "--log-level") {
|
|
23
|
+
i += 2; // skip flag + value
|
|
24
|
+
}
|
|
25
|
+
else if (raw[i].startsWith("--runner=") ||
|
|
26
|
+
raw[i].startsWith("--library-dir=") ||
|
|
27
|
+
raw[i].startsWith("--log-level=")) {
|
|
28
|
+
i += 1; // skip combined flag=value
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
result.push(raw[i]);
|
|
32
|
+
i++;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
// ── build pipe ────────────────────────────────────────────────────────
|
|
38
|
+
export async function agentBuildPipe(brief, options) {
|
|
39
|
+
const libraryDirs = options.libraryDir?.length
|
|
40
|
+
? options.libraryDir
|
|
41
|
+
: undefined;
|
|
42
|
+
let runner;
|
|
43
|
+
try {
|
|
44
|
+
runner = createRunner(options.runner, libraryDirs);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
agentError(err.message, "RunnerError", {
|
|
48
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (isPipelexRunner(runner)) {
|
|
52
|
+
try {
|
|
53
|
+
await runner.buildPassthrough("pipe", extractPassthroughArgs());
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
agentError(err.message, "RunnerError", {
|
|
57
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const result = await runner.buildPipe({ brief, output: options.output });
|
|
64
|
+
if (result.mthds_content && options.output) {
|
|
65
|
+
writeFileSync(options.output, result.mthds_content, "utf-8");
|
|
66
|
+
}
|
|
67
|
+
agentSuccess({
|
|
68
|
+
success: result.success,
|
|
69
|
+
message: result.message,
|
|
70
|
+
mthds_content: result.mthds_content,
|
|
71
|
+
pipelex_bundle_blueprint: result.pipelex_bundle_blueprint,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
agentError(err.message, "RunnerError", {
|
|
76
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// ── build runner method ──────────────────────────────────────────────
|
|
81
|
+
export async function agentBuildRunnerMethod(name, options) {
|
|
82
|
+
const libraryDirs = options.libraryDir?.length
|
|
83
|
+
? options.libraryDir
|
|
84
|
+
: undefined;
|
|
85
|
+
let runner;
|
|
86
|
+
try {
|
|
87
|
+
runner = createRunner(options.runner, libraryDirs);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
agentError(err.message, "RunnerError", {
|
|
91
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (isPipelexRunner(runner)) {
|
|
95
|
+
try {
|
|
96
|
+
await runner.buildPassthrough("runner", extractPassthroughArgs());
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
agentError(err.message, "RunnerError", {
|
|
100
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
agentError("Method target is not yet supported for the API runner. Use 'mthds-agent build runner pipe <target>' instead, or specify a different runner with --runner <name>.", "ArgumentError", { error_domain: AGENT_ERROR_DOMAINS.ARGUMENT });
|
|
106
|
+
}
|
|
107
|
+
// ── build runner pipe ────────────────────────────────────────────────
|
|
108
|
+
export async function agentBuildRunnerPipe(target, options) {
|
|
109
|
+
const libraryDirs = options.libraryDir?.length
|
|
110
|
+
? options.libraryDir
|
|
111
|
+
: undefined;
|
|
112
|
+
let runner;
|
|
113
|
+
try {
|
|
114
|
+
runner = createRunner(options.runner, libraryDirs);
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
agentError(err.message, "RunnerError", {
|
|
118
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
if (isPipelexRunner(runner)) {
|
|
122
|
+
try {
|
|
123
|
+
await runner.buildPassthrough("runner", extractPassthroughArgs());
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
agentError(err.message, "RunnerError", {
|
|
127
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (!target.endsWith(".mthds")) {
|
|
133
|
+
agentError("build runner requires a .mthds bundle file as the target.", "ArgumentError", { error_domain: AGENT_ERROR_DOMAINS.ARGUMENT });
|
|
134
|
+
}
|
|
135
|
+
if (!options.pipe) {
|
|
136
|
+
agentError("--pipe is required when using the API runner.", "ArgumentError", {
|
|
137
|
+
error_domain: AGENT_ERROR_DOMAINS.ARGUMENT,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
let mthdsContent;
|
|
141
|
+
try {
|
|
142
|
+
mthdsContent = readFileSync(target, "utf-8");
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
agentError(`Cannot read bundle: ${err.message}`, "IOError", { error_domain: AGENT_ERROR_DOMAINS.IO });
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
const result = await runner.buildRunner({
|
|
149
|
+
mthds_content: mthdsContent,
|
|
150
|
+
pipe_code: options.pipe,
|
|
151
|
+
});
|
|
152
|
+
if (options.output) {
|
|
153
|
+
writeFileSync(options.output, result.python_code, "utf-8");
|
|
154
|
+
}
|
|
155
|
+
agentSuccess({
|
|
156
|
+
success: result.success,
|
|
157
|
+
message: result.message,
|
|
158
|
+
python_code: result.python_code,
|
|
159
|
+
pipe_code: result.pipe_code,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
agentError(err.message, "RunnerError", {
|
|
164
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// ── build inputs method ──────────────────────────────────────────────
|
|
169
|
+
export async function agentBuildInputsMethod(name, options) {
|
|
170
|
+
const libraryDirs = options.libraryDir?.length
|
|
171
|
+
? options.libraryDir
|
|
172
|
+
: undefined;
|
|
173
|
+
let runner;
|
|
174
|
+
try {
|
|
175
|
+
runner = createRunner(options.runner, libraryDirs);
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
agentError(err.message, "RunnerError", {
|
|
179
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
if (isPipelexRunner(runner)) {
|
|
183
|
+
try {
|
|
184
|
+
await runner.buildPassthrough("inputs", extractPassthroughArgs());
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
agentError(err.message, "RunnerError", {
|
|
188
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
agentError("Method target is not yet supported for the API runner. Use 'mthds-agent build inputs pipe <target>' instead, or specify a different runner with --runner <name>.", "ArgumentError", { error_domain: AGENT_ERROR_DOMAINS.ARGUMENT });
|
|
194
|
+
}
|
|
195
|
+
// ── build inputs pipe ────────────────────────────────────────────────
|
|
196
|
+
export async function agentBuildInputsPipe(target, options) {
|
|
197
|
+
const libraryDirs = options.libraryDir?.length
|
|
198
|
+
? options.libraryDir
|
|
199
|
+
: undefined;
|
|
200
|
+
let runner;
|
|
201
|
+
try {
|
|
202
|
+
runner = createRunner(options.runner, libraryDirs);
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
agentError(err.message, "RunnerError", {
|
|
206
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
if (isPipelexRunner(runner)) {
|
|
210
|
+
try {
|
|
211
|
+
await runner.buildPassthrough("inputs", extractPassthroughArgs());
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
agentError(err.message, "RunnerError", {
|
|
215
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (!options.pipe) {
|
|
221
|
+
agentError("--pipe is required when using the API runner.", "ArgumentError", {
|
|
222
|
+
error_domain: AGENT_ERROR_DOMAINS.ARGUMENT,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
let mthdsContent;
|
|
226
|
+
try {
|
|
227
|
+
mthdsContent = readFileSync(target, "utf-8");
|
|
228
|
+
}
|
|
229
|
+
catch (err) {
|
|
230
|
+
agentError(`Cannot read bundle: ${err.message}`, "IOError", { error_domain: AGENT_ERROR_DOMAINS.IO });
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
const result = await runner.buildInputs({
|
|
234
|
+
mthds_content: mthdsContent,
|
|
235
|
+
pipe_code: options.pipe,
|
|
236
|
+
});
|
|
237
|
+
agentSuccess({
|
|
238
|
+
success: true,
|
|
239
|
+
inputs: result,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
catch (err) {
|
|
243
|
+
agentError(err.message, "RunnerError", {
|
|
244
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
// ── build output method ──────────────────────────────────────────────
|
|
249
|
+
export async function agentBuildOutputMethod(name, options) {
|
|
250
|
+
const libraryDirs = options.libraryDir?.length
|
|
251
|
+
? options.libraryDir
|
|
252
|
+
: undefined;
|
|
253
|
+
let runner;
|
|
254
|
+
try {
|
|
255
|
+
runner = createRunner(options.runner, libraryDirs);
|
|
256
|
+
}
|
|
257
|
+
catch (err) {
|
|
258
|
+
agentError(err.message, "RunnerError", {
|
|
259
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
if (isPipelexRunner(runner)) {
|
|
263
|
+
try {
|
|
264
|
+
await runner.buildPassthrough("output", extractPassthroughArgs());
|
|
265
|
+
}
|
|
266
|
+
catch (err) {
|
|
267
|
+
agentError(err.message, "RunnerError", {
|
|
268
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
agentError("Method target is not yet supported for the API runner. Use 'mthds-agent build output pipe <target>' instead, or specify a different runner with --runner <name>.", "ArgumentError", { error_domain: AGENT_ERROR_DOMAINS.ARGUMENT });
|
|
274
|
+
}
|
|
275
|
+
// ── build output pipe ────────────────────────────────────────────────
|
|
276
|
+
export async function agentBuildOutputPipe(target, options) {
|
|
277
|
+
const libraryDirs = options.libraryDir?.length
|
|
278
|
+
? options.libraryDir
|
|
279
|
+
: undefined;
|
|
280
|
+
let runner;
|
|
281
|
+
try {
|
|
282
|
+
runner = createRunner(options.runner, libraryDirs);
|
|
283
|
+
}
|
|
284
|
+
catch (err) {
|
|
285
|
+
agentError(err.message, "RunnerError", {
|
|
286
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
if (isPipelexRunner(runner)) {
|
|
290
|
+
try {
|
|
291
|
+
await runner.buildPassthrough("output", extractPassthroughArgs());
|
|
292
|
+
}
|
|
293
|
+
catch (err) {
|
|
294
|
+
agentError(err.message, "RunnerError", {
|
|
295
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (!options.pipe) {
|
|
301
|
+
agentError("--pipe is required when using the API runner.", "ArgumentError", {
|
|
302
|
+
error_domain: AGENT_ERROR_DOMAINS.ARGUMENT,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
let mthdsContent;
|
|
306
|
+
try {
|
|
307
|
+
mthdsContent = readFileSync(target, "utf-8");
|
|
308
|
+
}
|
|
309
|
+
catch (err) {
|
|
310
|
+
agentError(`Cannot read bundle: ${err.message}`, "IOError", { error_domain: AGENT_ERROR_DOMAINS.IO });
|
|
311
|
+
}
|
|
312
|
+
const validFormats = ["json", "python", "schema"];
|
|
313
|
+
const format = (options.format ?? "schema");
|
|
314
|
+
if (!validFormats.includes(format)) {
|
|
315
|
+
agentError(`Invalid format "${format}". Must be one of: ${validFormats.join(", ")}`, "ArgumentError", { error_domain: AGENT_ERROR_DOMAINS.ARGUMENT });
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
const result = await runner.buildOutput({
|
|
319
|
+
mthds_content: mthdsContent,
|
|
320
|
+
pipe_code: options.pipe,
|
|
321
|
+
format: format,
|
|
322
|
+
});
|
|
323
|
+
agentSuccess({
|
|
324
|
+
success: true,
|
|
325
|
+
output: result,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
catch (err) {
|
|
329
|
+
agentError(err.message, "RunnerError", {
|
|
330
|
+
error_domain: AGENT_ERROR_DOMAINS.RUNNER,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/agent/commands/build.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC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 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent config commands — manage configuration with JSON output.
|
|
3
|
+
*/
|
|
4
|
+
export declare function agentConfigSet(cliKey: string, value: string): Promise<void>;
|
|
5
|
+
export declare function agentConfigGet(cliKey: string): Promise<void>;
|
|
6
|
+
export declare function agentConfigList(): Promise<void>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent config commands — manage configuration with JSON output.
|
|
3
|
+
*/
|
|
4
|
+
import { agentSuccess, agentError, AGENT_ERROR_DOMAINS } from "../output.js";
|
|
5
|
+
import { VALID_KEYS, resolveKey, getConfigValue, setConfigValue, listConfig, } from "../../config/config.js";
|
|
6
|
+
import { RUNNER_NAMES } from "../../runners/types.js";
|
|
7
|
+
function isValidUrl(s) {
|
|
8
|
+
try {
|
|
9
|
+
new URL(s);
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export async function agentConfigSet(cliKey, value) {
|
|
17
|
+
const configKey = resolveKey(cliKey);
|
|
18
|
+
if (!configKey) {
|
|
19
|
+
agentError(`Unknown config key: ${cliKey}. Valid keys: ${VALID_KEYS.join(", ")}`, "ConfigError", { error_domain: AGENT_ERROR_DOMAINS.CONFIG });
|
|
20
|
+
}
|
|
21
|
+
if (configKey === "runner" && !RUNNER_NAMES.includes(value)) {
|
|
22
|
+
agentError(`Invalid runner: ${value}. Valid runners: ${RUNNER_NAMES.join(", ")}`, "ConfigError", { error_domain: AGENT_ERROR_DOMAINS.CONFIG });
|
|
23
|
+
}
|
|
24
|
+
if (configKey === "apiUrl" && !isValidUrl(value)) {
|
|
25
|
+
agentError(`Invalid URL: ${value}`, "ConfigError", {
|
|
26
|
+
error_domain: AGENT_ERROR_DOMAINS.CONFIG,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
setConfigValue(configKey, value);
|
|
30
|
+
agentSuccess({ success: true, key: cliKey, value });
|
|
31
|
+
}
|
|
32
|
+
export async function agentConfigGet(cliKey) {
|
|
33
|
+
const configKey = resolveKey(cliKey);
|
|
34
|
+
if (!configKey) {
|
|
35
|
+
agentError(`Unknown config key: ${cliKey}. Valid keys: ${VALID_KEYS.join(", ")}`, "ConfigError", { error_domain: AGENT_ERROR_DOMAINS.CONFIG });
|
|
36
|
+
}
|
|
37
|
+
const { value, source } = getConfigValue(configKey);
|
|
38
|
+
agentSuccess({ key: cliKey, value, source });
|
|
39
|
+
}
|
|
40
|
+
export async function agentConfigList() {
|
|
41
|
+
const entries = listConfig();
|
|
42
|
+
agentSuccess({
|
|
43
|
+
config: entries.map((e) => ({
|
|
44
|
+
key: e.cliKey,
|
|
45
|
+
value: e.value,
|
|
46
|
+
source: e.source,
|
|
47
|
+
})),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/agent/commands/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EACL,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,UAAU,GACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,SAAS,UAAU,CAAC,CAAS;IAC3B,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,KAAa;IAEb,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC,SAAS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AK,EAAE,MAAM,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,YAAY,CAAC;QACX,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC1B,GAAG,EAAE,CAAC,CAAC,MAAM;YACb,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,MAAM,EAAE,CAAC,CAAC,MAAM;SACjB,CAAC,CAAC;KACJ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Non-interactive agent install command.
|
|
3
|
+
* All choices are required CLI flags — no prompts, no clack.
|
|
4
|
+
*/
|
|
5
|
+
interface AgentInstallOptions {
|
|
6
|
+
local?: string;
|
|
7
|
+
agent?: string;
|
|
8
|
+
location?: string;
|
|
9
|
+
method?: string;
|
|
10
|
+
skills?: boolean;
|
|
11
|
+
noRunner?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function agentInstall(address: string | undefined, options: AgentInstallOptions): Promise<void>;
|
|
14
|
+
export {};
|