@aui.io/apollo 0.1.43 → 0.1.47
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/README.md +6 -14
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/auth.js +5 -12
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/auth.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/shell.d.ts +10 -4
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/shell.js +15 -7
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/shell.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/index.d.ts +5 -2
- package/node_modules/@aui.io/apollo-cli/dist/src/index.js +5 -7
- package/node_modules/@aui.io/apollo-cli/dist/src/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/package.json +9 -4
- package/node_modules/@aui.io/apollo-core/dist/src/api/capture.d.ts +14 -4
- package/node_modules/@aui.io/apollo-core/dist/src/api/capture.js +21 -10
- package/node_modules/@aui.io/apollo-core/dist/src/api/capture.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/api/lane.d.ts +19 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/lane.js +26 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/lane.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.d.ts +13 -19
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js +16 -31
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/api/transport.d.ts +7 -1
- package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js +10 -2
- package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.d.ts +0 -2
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.js +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/checkouts/registry.js +4 -5
- package/node_modules/@aui.io/apollo-core/dist/src/checkouts/registry.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/index.d.ts +10 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/index.js +51 -28
- package/node_modules/@aui.io/apollo-core/dist/src/config/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/types.d.ts +6 -2
- package/node_modules/@aui.io/apollo-core/dist/src/config/types.js +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/types.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/index.d.ts +4 -3
- package/node_modules/@aui.io/apollo-core/dist/src/index.js +3 -3
- package/node_modules/@aui.io/apollo-core/dist/src/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +7 -3
- package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/env.service.d.ts +11 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/env.service.js +7 -11
- package/node_modules/@aui.io/apollo-core/dist/src/services/env.service.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.d.ts +0 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.js +0 -3
- package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/skills/agents-page.d.ts +5 -7
- package/node_modules/@aui.io/apollo-core/dist/src/skills/agents-page.js +8 -9
- package/node_modules/@aui.io/apollo-core/dist/src/skills/agents-page.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/package.json +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js +6 -10
- package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/activity/ActivityDrawer.js +3 -3
- package/node_modules/@aui.io/apollo-tui/dist/src/activity/ActivityDrawer.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/author/ValidationView.js +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/author/ValidationView.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/index.d.ts +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/index.js +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.d.ts +2 -2
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +25 -46
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js +28 -23
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/diagnostics.js +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/diagnostics.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/keydiag.js +1 -3
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/keydiag.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/keys.d.ts +0 -6
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/keys.js +0 -8
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/keys.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js +13 -19
- package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/shell/FooterHints.js +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/shell/FooterHints.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/talk/InspectorPane.d.ts +2 -2
- package/node_modules/@aui.io/apollo-tui/dist/src/talk/InspectorPane.js +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/talk/TalkView.d.ts +2 -2
- package/node_modules/@aui.io/apollo-tui/dist/src/talk/TalkView.js +2 -2
- package/node_modules/@aui.io/apollo-tui/dist/src/talk/TalkView.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/talk/data.d.ts +2 -2
- package/node_modules/@aui.io/apollo-tui/dist/src/talk/data.js +0 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/talk/data.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/package.json +2 -2
- package/package.json +4 -4
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/curl.d.ts +0 -10
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/curl.js +0 -63
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/curl.js.map +0 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/env.d.ts +0 -3
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/env.js +0 -34
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/env.js.map +0 -1
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ apollo upgrade --check # show the available version only
|
|
|
40
40
|
## Quick start
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
apollo login # browser flow
|
|
43
|
+
apollo login # browser flow
|
|
44
44
|
apollo agent import <agent-id> # or: apollo agent create <name>
|
|
45
45
|
cd <the printed checkout directory> # defaults to ~/apollo/<profile>/<env>/<name>-<id>
|
|
46
46
|
|
|
@@ -59,7 +59,6 @@ selects the agent you are working on. `apollo status` always tells you where you
|
|
|
59
59
|
| Layer | What it is | Commands |
|
|
60
60
|
|---|---|---|
|
|
61
61
|
| **Profile** | Named credential slot (e.g. `default`, `work`) | `profile *` |
|
|
62
|
-
| **Environment** | `staging` or `production` | `env *` |
|
|
63
62
|
| **Checkout** | Local directory holding one agent (`.apollorc` + `bundle/src/`) | `agent use / import / create` |
|
|
64
63
|
| **Organization** | Identity / billing org (on the access token) | `org *` |
|
|
65
64
|
| **Project** | Container for agents | `project *` |
|
|
@@ -71,10 +70,8 @@ selects the agent you are working on. `apollo status` always tells you where you
|
|
|
71
70
|
```text
|
|
72
71
|
status [--check] # active context (+ service connectivity)
|
|
73
72
|
doctor [--offline] # diagnose setup; exit 2 on problems
|
|
74
|
-
curl [--failed] [--last <n>] [--method <verb>] [--search <text>]
|
|
75
73
|
upgrade [version] [--check] [--force]
|
|
76
74
|
login | logout
|
|
77
|
-
env current | list | use <name>
|
|
78
75
|
profile current | list | use <name>
|
|
79
76
|
org list | use <id>
|
|
80
77
|
project list | use <id> | create <name>
|
|
@@ -118,7 +115,7 @@ resources, scenarios) and **Talk** (converse with the running agent).
|
|
|
118
115
|
|---|---|
|
|
119
116
|
| `Ctrl+1` / `Ctrl+2` (or `Tab`) | Author / Talk |
|
|
120
117
|
| `Ctrl+K` | Action palette — every operation, with CLI equivalents |
|
|
121
|
-
| `Ctrl+G` | Context switcher —
|
|
118
|
+
| `Ctrl+G` | Context switcher — profile / agent / project / org |
|
|
122
119
|
| `Ctrl+J` | Activity drawer — operations, retry, output, live API-request tail |
|
|
123
120
|
| `Esc` | Close overlay / cancel |
|
|
124
121
|
|
|
@@ -132,8 +129,6 @@ everything to the agent verbatim.
|
|
|
132
129
|
```bash
|
|
133
130
|
apollo doctor # diagnose the setup end to end; exit 2 on problems
|
|
134
131
|
apollo status --check # context + per-service reachability/auth
|
|
135
|
-
apollo curl # recent API requests replayed as curl commands
|
|
136
|
-
apollo curl --failed # only status ≥ 400 or no-response entries
|
|
137
132
|
apollo --verbose <cmd> # stream each API call live to stderr
|
|
138
133
|
```
|
|
139
134
|
|
|
@@ -143,11 +138,9 @@ permissions, token expiry, the current checkout, and service reachability —
|
|
|
143
138
|
read-only, with the fix attached to every finding. Share its output when
|
|
144
139
|
reporting issues.
|
|
145
140
|
|
|
146
|
-
|
|
147
|
-
never
|
|
148
|
-
|
|
149
|
-
redacted auth headers are emitted as `$APOLLO_TOKEN` placeholders. The TUI shows the
|
|
150
|
-
same stream live in its activity drawer.
|
|
141
|
+
`--verbose` streams one **redacted** line per API request (auth/token/key/secret
|
|
142
|
+
values never appear) to stderr; the TUI shows the same stream live in its
|
|
143
|
+
activity drawer.
|
|
151
144
|
|
|
152
145
|
## Files and environment variables
|
|
153
146
|
|
|
@@ -157,13 +150,12 @@ same stream live in its activity drawer.
|
|
|
157
150
|
credentials.json # tokens (mode 0600 — the only secret-bearing file)
|
|
158
151
|
checkouts.json # known-checkouts registry
|
|
159
152
|
baselines/… # sync hashes for diff/push
|
|
160
|
-
last-requests.json # redacted recent HTTP captures
|
|
161
153
|
|
|
162
154
|
<checkout>/.apollorc # org / project / agent / version_tag binding
|
|
163
155
|
<checkout>/bundle/src/ # the editable program source
|
|
164
156
|
```
|
|
165
157
|
|
|
166
|
-
`
|
|
158
|
+
`APOLLO_PROFILE`, `APOLLO_TOKEN` (CI auth), `APOLLO_ORG_ID`,
|
|
167
159
|
`APOLLO_PROJECT_ID`, `APOLLO_TIMEOUT_MS`, and per-service `APOLLO_*_URL` overrides are
|
|
168
160
|
honored everywhere; see the User Guide for the full table.
|
|
169
161
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
|
-
import {
|
|
2
|
+
import { environmentDefinition, readCredentials, writeCredentials, } from "@aui.io/apollo-core/config/index.js";
|
|
3
3
|
import { ConfigError } from "@aui.io/apollo-core/errors/index.js";
|
|
4
4
|
import { loginWithBrowser, loginWithOtp, loginWithToken, logout, requestOtp, } from "@aui.io/apollo-core/services/auth.js";
|
|
5
5
|
import { createClients } from "@aui.io/apollo-core/services/clients.js";
|
|
6
6
|
import { prompt } from "./prompts.js";
|
|
7
|
-
const PLAYGROUND_URL = "https://apollo.aui.io";
|
|
8
7
|
export function registerAuth(program, runtime) {
|
|
9
8
|
program
|
|
10
9
|
.command("login")
|
|
@@ -16,15 +15,9 @@ export function registerAuth(program, runtime) {
|
|
|
16
15
|
.option("--url <url>", "override the playground login URL")
|
|
17
16
|
.action(async (options) => {
|
|
18
17
|
const current = runtime();
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
env: "production",
|
|
23
|
-
profile: current.context.profile,
|
|
24
|
-
timeout: String(current.context.timeoutMs),
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
const { output } = current;
|
|
18
|
+
// Login lands on the active environment — which for this build can
|
|
19
|
+
// only be one the environment registry knows.
|
|
20
|
+
const { context, output } = current;
|
|
28
21
|
const clients = createClients(context);
|
|
29
22
|
let stored;
|
|
30
23
|
if (options.token) {
|
|
@@ -47,7 +40,7 @@ export function registerAuth(program, runtime) {
|
|
|
47
40
|
}
|
|
48
41
|
else {
|
|
49
42
|
output.progress("Opening browser login...");
|
|
50
|
-
const result = await loginWithBrowser(context, options.url ??
|
|
43
|
+
const result = await loginWithBrowser(context, options.url ?? environmentDefinition(context.environment).playgroundUrl);
|
|
51
44
|
stored = result.credential;
|
|
52
45
|
}
|
|
53
46
|
output.result({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,OAAO,EACL,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,gBAAgB,GAEjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,MAAM,EACN,UAAU,GACX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAUtC,MAAM,UAAU,YAAY,CAC1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ACtB,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAAuB,EACvB,KAAa,EACb,YAAqB;IAErB,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,MAAM,OAAO,GACX,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC5C,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG;QACnE,YAAY,EAAE,KAAK;QACnB,GAAG,CAAC,YAAY;YACd,CAAC,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE;YACjC,CAAC,CAAC,OAAO,EAAE,aAAa;gBACtB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE;gBAC1C,CAAC,CAAC,EAAE,CAAC;QACT,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1D,CAAC;IACF,MAAM,gBAAgB,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -3,12 +3,18 @@ import type { Command } from "commander";
|
|
|
3
3
|
* Shell wrapper sourced via `eval "$(apollo shell-init)"` (installed into the
|
|
4
4
|
* user's rc file by the @aui.io/apollo postinstall). A child process cannot
|
|
5
5
|
* change the parent shell's cwd, so auto-cd after `agent use/import/create`
|
|
6
|
-
* has to live in the shell itself. Account commands (`
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* has to live in the shell itself. Account commands (`profile use`) never
|
|
7
|
+
* cd — your position binds context, so moving is always an explicit agent
|
|
8
|
+
* action. APOLLO_SHELL_WRAPPED lets the CLI drop the
|
|
9
9
|
* "cd <path>" tip when the wrapper is about to do it anyway.
|
|
10
|
+
*
|
|
11
|
+
* Parameterized on the bin name so distributions with their own bin
|
|
12
|
+
* (`apollo-internal`) wrap their own command instead of shadowing this one.
|
|
13
|
+
* zsh/bash both accept hyphens in `name() {}` function names; the local
|
|
14
|
+
* variables keep a fixed spelling because hyphens are not legal there.
|
|
10
15
|
*/
|
|
11
|
-
export declare
|
|
16
|
+
export declare function shellInitScript(bin: string): string;
|
|
17
|
+
export declare const SHELL_INIT_SCRIPT: string;
|
|
12
18
|
/**
|
|
13
19
|
* Reaching this point means the auto-cd wrapper is not active in this shell
|
|
14
20
|
* session. npm hides postinstall output, so this is the user's only signal.
|
|
@@ -5,14 +5,20 @@ import path from "node:path";
|
|
|
5
5
|
* Shell wrapper sourced via `eval "$(apollo shell-init)"` (installed into the
|
|
6
6
|
* user's rc file by the @aui.io/apollo postinstall). A child process cannot
|
|
7
7
|
* change the parent shell's cwd, so auto-cd after `agent use/import/create`
|
|
8
|
-
* has to live in the shell itself. Account commands (`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* has to live in the shell itself. Account commands (`profile use`) never
|
|
9
|
+
* cd — your position binds context, so moving is always an explicit agent
|
|
10
|
+
* action. APOLLO_SHELL_WRAPPED lets the CLI drop the
|
|
11
11
|
* "cd <path>" tip when the wrapper is about to do it anyway.
|
|
12
|
+
*
|
|
13
|
+
* Parameterized on the bin name so distributions with their own bin
|
|
14
|
+
* (`apollo-internal`) wrap their own command instead of shadowing this one.
|
|
15
|
+
* zsh/bash both accept hyphens in `name() {}` function names; the local
|
|
16
|
+
* variables keep a fixed spelling because hyphens are not legal there.
|
|
12
17
|
*/
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
export function shellInitScript(bin) {
|
|
19
|
+
return `# ${bin} shell integration (zsh/bash)
|
|
20
|
+
${bin}() {
|
|
21
|
+
APOLLO_SHELL_WRAPPED=1 command ${bin} "$@"
|
|
16
22
|
local apollo_exit=$?
|
|
17
23
|
if [ "$apollo_exit" -eq 0 ] && [ "$1" = "agent" ]; then
|
|
18
24
|
case "$2" in
|
|
@@ -20,7 +26,7 @@ apollo() {
|
|
|
20
26
|
# The command just touched the registry; resolve the checkout so
|
|
21
27
|
# name arguments and the interactive picker land in the right place.
|
|
22
28
|
local apollo_target
|
|
23
|
-
apollo_target="$(APOLLO_SHELL_WRAPPED=1 command
|
|
29
|
+
apollo_target="$(APOLLO_SHELL_WRAPPED=1 command ${bin} agent path 2>/dev/null)"
|
|
24
30
|
if [ -n "$apollo_target" ] && [ -d "$apollo_target" ]; then
|
|
25
31
|
cd "$apollo_target" || return
|
|
26
32
|
fi
|
|
@@ -30,6 +36,8 @@ apollo() {
|
|
|
30
36
|
return "$apollo_exit"
|
|
31
37
|
}
|
|
32
38
|
`;
|
|
39
|
+
}
|
|
40
|
+
export const SHELL_INIT_SCRIPT = shellInitScript("apollo");
|
|
33
41
|
/**
|
|
34
42
|
* Reaching this point means the auto-cd wrapper is not active in this shell
|
|
35
43
|
* session. npm hides postinstall output, so this is the user's only signal.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../src/commands/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../src/commands/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,KAAK,GAAG;EACf,GAAG;mCAC8B,GAAG;;;;;;;;0DAQoB,GAAG;;;;;;;;;CAS5D,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC1B,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACrE,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QACnF,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,SAAS;QACd,CAAC,CAAC,kIAAkI;QACpI,CAAC,CAAC,wGAAwG,CAAC;AAC/G,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,OAAO;SACJ,OAAO,CAAC,YAAY,CAAC;SACrB,WAAW,CAAC,qEAAqE,CAAC;SAClF,MAAM,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
import type { CommandRuntime } from "./commands/runtime.js";
|
|
2
3
|
import { type Context } from "@aui.io/apollo-core/config/index.js";
|
|
3
4
|
import { Output } from "@aui.io/apollo-core/output/index.js";
|
|
4
5
|
interface ProgramState {
|
|
@@ -6,6 +7,8 @@ interface ProgramState {
|
|
|
6
7
|
output?: Output;
|
|
7
8
|
captureUnsubscribe?: () => void;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
export
|
|
10
|
+
/** A distribution's extra command modules, registered after the stock set. */
|
|
11
|
+
export type CommandExtension = (program: Command, runtime: () => CommandRuntime) => void;
|
|
12
|
+
export declare function createProgram(state?: ProgramState, extensions?: readonly CommandExtension[]): Command;
|
|
13
|
+
export declare function main(argv?: string[], extensions?: readonly CommandExtension[]): Promise<number>;
|
|
11
14
|
export {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Command, CommanderError, Option } from "commander";
|
|
2
2
|
import { normalizeArgv } from "@aui.io/apollo-core/argv.js";
|
|
3
3
|
import { captureLog } from "@aui.io/apollo-core/api/capture.js";
|
|
4
|
-
import { registerEnv } from "./commands/env.js";
|
|
5
4
|
import { registerAuth } from "./commands/auth.js";
|
|
6
5
|
import { registerBundles } from "./commands/bundles.js";
|
|
7
|
-
import { registerCurl } from "./commands/curl.js";
|
|
8
6
|
import { registerDoctor } from "./commands/doctor.js";
|
|
9
7
|
import { registerHierarchy } from "./commands/hierarchy.js";
|
|
10
8
|
import { registerOperate } from "./commands/operate.js";
|
|
@@ -21,7 +19,7 @@ import { ConfigError, toCliError } from "@aui.io/apollo-core/errors/index.js";
|
|
|
21
19
|
import { CLI_VERSION } from "./meta.js";
|
|
22
20
|
import { Output } from "@aui.io/apollo-core/output/index.js";
|
|
23
21
|
import { renderWelcome, welcomeData } from "./output/welcome.js";
|
|
24
|
-
export function createProgram(state = {}) {
|
|
22
|
+
export function createProgram(state = {}, extensions = []) {
|
|
25
23
|
const program = new Command()
|
|
26
24
|
.name("apollo")
|
|
27
25
|
.description("Manage and operate Apollo agents")
|
|
@@ -82,9 +80,7 @@ export function createProgram(state = {}) {
|
|
|
82
80
|
};
|
|
83
81
|
registerStatus(program, runtime);
|
|
84
82
|
registerDoctor(program, runtime);
|
|
85
|
-
registerCurl(program, runtime);
|
|
86
83
|
registerUpgrade(program, runtime);
|
|
87
|
-
registerEnv(program, runtime);
|
|
88
84
|
registerProfile(program, runtime);
|
|
89
85
|
registerAuth(program, runtime);
|
|
90
86
|
registerHierarchy(program, runtime);
|
|
@@ -95,11 +91,13 @@ export function createProgram(state = {}) {
|
|
|
95
91
|
registerVault(program, runtime);
|
|
96
92
|
registerKb(program, runtime);
|
|
97
93
|
registerShellInit(program);
|
|
94
|
+
for (const extension of extensions)
|
|
95
|
+
extension(program, runtime);
|
|
98
96
|
return program;
|
|
99
97
|
}
|
|
100
|
-
export async function main(argv = process.argv) {
|
|
98
|
+
export async function main(argv = process.argv, extensions = []) {
|
|
101
99
|
const state = {};
|
|
102
|
-
const program = createProgram(state);
|
|
100
|
+
const program = createProgram(state, extensions);
|
|
103
101
|
try {
|
|
104
102
|
await program.parseAsync(normalizeArgv(argv));
|
|
105
103
|
// Commands may set a non-zero exit code without aborting (doctor's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,u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,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aui.io/apollo-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.47",
|
|
4
4
|
"description": "Command-line client for the Apollo runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
"apollo": "./bin/apollo.js"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
|
-
"
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/src/index.d.ts",
|
|
15
|
+
"import": "./dist/src/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./bin/apollo.js": "./bin/apollo.js",
|
|
18
|
+
"./dist/*": "./dist/*"
|
|
14
19
|
},
|
|
15
20
|
"files": [
|
|
16
21
|
"bin",
|
|
@@ -28,12 +33,12 @@
|
|
|
28
33
|
"test": "vitest run"
|
|
29
34
|
},
|
|
30
35
|
"dependencies": {
|
|
31
|
-
"@aui.io/apollo-core": "0.1.
|
|
36
|
+
"@aui.io/apollo-core": "0.1.47",
|
|
32
37
|
"commander": "^14.0.3",
|
|
33
38
|
"picocolors": "^1.1.1"
|
|
34
39
|
},
|
|
35
40
|
"optionalDependencies": {
|
|
36
|
-
"@aui.io/apollo-tui": "0.1.
|
|
41
|
+
"@aui.io/apollo-tui": "0.1.47"
|
|
37
42
|
},
|
|
38
43
|
"devDependencies": {
|
|
39
44
|
"@eslint/js": "^9.39.5",
|
|
@@ -5,18 +5,28 @@ export interface CaptureSink {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function defaultCapturePath(): string;
|
|
7
7
|
export declare class CaptureLog implements CaptureSink {
|
|
8
|
-
private readonly filePath?;
|
|
9
8
|
private entries;
|
|
10
9
|
private readonly listeners;
|
|
11
10
|
/** Per-write suffix — see `persist`. */
|
|
12
11
|
private writeSeq;
|
|
13
|
-
/**
|
|
14
|
-
|
|
12
|
+
/** Where flushes land — unset means in-memory only (the default). */
|
|
13
|
+
private target?;
|
|
14
|
+
/** No path = in-memory only; a string turns persistence on from birth. */
|
|
15
|
+
constructor(filePath?: string);
|
|
16
|
+
/**
|
|
17
|
+
* Turn on file persistence — the replay lane. A distribution that wants
|
|
18
|
+
* requests to survive the process calls this once at startup; no
|
|
19
|
+
* argument means the default path.
|
|
20
|
+
*/
|
|
21
|
+
persistTo(filePath?: string): void;
|
|
15
22
|
/** Stable reference between mutations — safe for useSyncExternalStore. */
|
|
16
23
|
snapshot: () => readonly RequestCapture[];
|
|
17
24
|
subscribe: (listener: () => void) => (() => void);
|
|
18
25
|
add(entry: RequestCapture): Promise<void>;
|
|
19
26
|
private persist;
|
|
20
27
|
}
|
|
21
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* The one log — module-level so the CLI process and TUI session share it.
|
|
30
|
+
* In-memory only until a distribution opts into persistence at startup.
|
|
31
|
+
*/
|
|
22
32
|
export declare const captureLog: CaptureLog;
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
* - the TUI activity drawer subscribes for its live "api requests" tail
|
|
12
12
|
*
|
|
13
13
|
* Entries arrive already redacted (transport.ts) — nothing here may ever
|
|
14
|
-
* see a raw secret.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* see a raw secret. The log is in-memory by default; file persistence is
|
|
15
|
+
* opt-in (`persistTo`), so the stock build leaves nothing in `~/.apollo`.
|
|
16
|
+
* When enabled, writes are atomic tmp+rename, dir 0700 / file 0600, and
|
|
17
|
+
* best-effort (a failed write can never fail an API request).
|
|
18
18
|
*/
|
|
19
19
|
import { mkdir, rename, writeFile } from "node:fs/promises";
|
|
20
20
|
import { homedir } from "node:os";
|
|
@@ -25,14 +25,23 @@ export function defaultCapturePath() {
|
|
|
25
25
|
return path.join(homedir(), ".apollo", "last-requests.json");
|
|
26
26
|
}
|
|
27
27
|
export class CaptureLog {
|
|
28
|
-
filePath;
|
|
29
28
|
entries = [];
|
|
30
29
|
listeners = new Set();
|
|
31
30
|
/** Per-write suffix — see `persist`. */
|
|
32
31
|
writeSeq = 0;
|
|
33
|
-
/**
|
|
32
|
+
/** Where flushes land — unset means in-memory only (the default). */
|
|
33
|
+
target;
|
|
34
|
+
/** No path = in-memory only; a string turns persistence on from birth. */
|
|
34
35
|
constructor(filePath) {
|
|
35
|
-
this.
|
|
36
|
+
this.target = filePath;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Turn on file persistence — the replay lane. A distribution that wants
|
|
40
|
+
* requests to survive the process calls this once at startup; no
|
|
41
|
+
* argument means the default path.
|
|
42
|
+
*/
|
|
43
|
+
persistTo(filePath = defaultCapturePath()) {
|
|
44
|
+
this.target = filePath;
|
|
36
45
|
}
|
|
37
46
|
/** Stable reference between mutations — safe for useSyncExternalStore. */
|
|
38
47
|
snapshot = () => this.entries;
|
|
@@ -47,8 +56,7 @@ export class CaptureLog {
|
|
|
47
56
|
await this.persist();
|
|
48
57
|
}
|
|
49
58
|
async persist() {
|
|
50
|
-
const target = this.
|
|
51
|
-
(process.env.NODE_ENV === "test" ? undefined : defaultCapturePath());
|
|
59
|
+
const target = this.target;
|
|
52
60
|
if (target === undefined)
|
|
53
61
|
return;
|
|
54
62
|
try {
|
|
@@ -70,6 +78,9 @@ export class CaptureLog {
|
|
|
70
78
|
}
|
|
71
79
|
}
|
|
72
80
|
}
|
|
73
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* The one log — module-level so the CLI process and TUI session share it.
|
|
83
|
+
* In-memory only until a distribution opts into persistence at startup.
|
|
84
|
+
*/
|
|
74
85
|
export const captureLog = new CaptureLog();
|
|
75
86
|
//# sourceMappingURL=capture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture.js","sourceRoot":"","sources":["../../../src/api/capture.ts"],"names":[],"mappings":"AAAA;;;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E,MAAM,CAAC,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,iEAAiE;QACnE,CAAC;IACH,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine-page lane — which flavor of the runtime's authoring surface
|
|
3
|
+
* (the AGENTS page and the skills index) this process asks for.
|
|
4
|
+
*
|
|
5
|
+
* The stock build sends no query parameters at all and relies on the
|
|
6
|
+
* server's defaults; the only client-side rule is the echo check — a page
|
|
7
|
+
* whose echoed audience is not one this build accepts is refused rather
|
|
8
|
+
* than written into a checkout (that is how an older engine that defaults
|
|
9
|
+
* to a different page gets caught). A distribution can pin its own lane at
|
|
10
|
+
* startup, before the first pull, and every fetch after that carries it.
|
|
11
|
+
*/
|
|
12
|
+
export interface PageLane {
|
|
13
|
+
/** Extra query parameters for `/agents-md` and `/skills` reads. */
|
|
14
|
+
query: Readonly<Record<string, string>>;
|
|
15
|
+
/** The audience echoes this build accepts on the AGENTS page. */
|
|
16
|
+
acceptedEchoes: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function setPageLane(next: PageLane): void;
|
|
19
|
+
export declare function pageLane(): PageLane;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine-page lane — which flavor of the runtime's authoring surface
|
|
3
|
+
* (the AGENTS page and the skills index) this process asks for.
|
|
4
|
+
*
|
|
5
|
+
* The stock build sends no query parameters at all and relies on the
|
|
6
|
+
* server's defaults; the only client-side rule is the echo check — a page
|
|
7
|
+
* whose echoed audience is not one this build accepts is refused rather
|
|
8
|
+
* than written into a checkout (that is how an older engine that defaults
|
|
9
|
+
* to a different page gets caught). A distribution can pin its own lane at
|
|
10
|
+
* startup, before the first pull, and every fetch after that carries it.
|
|
11
|
+
*/
|
|
12
|
+
let lane = {
|
|
13
|
+
query: {},
|
|
14
|
+
// `headless` is the pre-rename spelling of the same page on older engines.
|
|
15
|
+
acceptedEchoes: ["public", "headless"],
|
|
16
|
+
};
|
|
17
|
+
export function setPageLane(next) {
|
|
18
|
+
lane = {
|
|
19
|
+
query: Object.freeze({ ...next.query }),
|
|
20
|
+
acceptedEchoes: [...next.acceptedEchoes],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function pageLane() {
|
|
24
|
+
return lane;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=lane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lane.js","sourceRoot":"","sources":["../../../src/api/lane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,IAAI,IAAI,GAAa;IACnB,KAAK,EAAE,EAAE;IACT,2EAA2E;IAC3E,cAAc,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;CACvC,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,IAAc;IACxC,IAAI,GAAG;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QACvC,cAAc,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC;KACzC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -62,11 +62,10 @@ export interface SkillFile {
|
|
|
62
62
|
export interface AgentsMd {
|
|
63
63
|
content: string;
|
|
64
64
|
/**
|
|
65
|
-
* Which page this is — echoed by engines that ship per-audience pages
|
|
66
|
-
*
|
|
67
|
-
* that
|
|
68
|
-
*
|
|
69
|
-
* this before trusting the content.
|
|
65
|
+
* Which page this is — echoed by engines that ship per-audience pages
|
|
66
|
+
* (`public`, or `headless` on engines that predate the rename). Absent on
|
|
67
|
+
* older engines that serve a single page; a caller MUST check this
|
|
68
|
+
* against the lane's accepted echoes before trusting the content.
|
|
70
69
|
*/
|
|
71
70
|
audience?: string;
|
|
72
71
|
}
|
|
@@ -116,25 +115,20 @@ export declare class RuntimeApiClient {
|
|
|
116
115
|
listMessages(threadId: string): Promise<Message[]>;
|
|
117
116
|
threadTrace(threadId: string): Promise<RuntimeTrace[]>;
|
|
118
117
|
interactionTrace(interactionId: string): Promise<RuntimeTrace>;
|
|
119
|
-
interactionDebug(interactionId: string): Promise<Record<string, unknown>>;
|
|
120
118
|
listSkills(): Promise<SkillIndexItem[]>;
|
|
121
119
|
getSkill(skillId: string, file?: string): Promise<SkillFile>;
|
|
122
120
|
/**
|
|
123
|
-
* The checkout's standing brief
|
|
124
|
-
*
|
|
125
|
-
* docs/authoring-modes-design.md §3.3; the internal page ships inside the
|
|
126
|
-
* runtime package and never rides this endpoint). Not a skill: it belongs
|
|
127
|
-
* at the checkout root, so it has its own endpoint rather than a slot in
|
|
128
|
-
* the skills index.
|
|
121
|
+
* The checkout's standing brief. Not a skill: it belongs at the checkout
|
|
122
|
+
* root, so it has its own endpoint rather than a slot in the skills index.
|
|
129
123
|
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
124
|
+
* The stock build sends no query and takes the server's default page;
|
|
125
|
+
* which pages this build accepts is the lane's echo check, applied by the
|
|
126
|
+
* caller (skills/agents-page.ts) — a page whose echoed audience is not
|
|
127
|
+
* accepted is refused rather than written into a checkout, which is how
|
|
128
|
+
* an engine that defaults to a different page gets caught. Engines older
|
|
129
|
+
* than the endpoint answer 404.
|
|
136
130
|
*/
|
|
137
|
-
getAgentsMd(
|
|
131
|
+
getAgentsMd(): Promise<AgentsMd>;
|
|
138
132
|
getProgramSchemas(file?: string): Promise<Record<string, unknown>>;
|
|
139
133
|
validateProgram(bundle: Record<string, unknown>): Promise<{
|
|
140
134
|
valid: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { pageLane } from "./lane.js";
|
|
2
2
|
/**
|
|
3
3
|
* A send is synchronous on the wire — the response IS the agent's turn, and
|
|
4
4
|
* normal turn latency can exceed the 60s transport default (REPORTS-27).
|
|
@@ -81,11 +81,10 @@ export class RuntimeApiClient {
|
|
|
81
81
|
interactionTrace(interactionId) {
|
|
82
82
|
return this.http.request(`/messaging/v1/interactions/${interactionId}/trace`);
|
|
83
83
|
}
|
|
84
|
-
interactionDebug(interactionId) {
|
|
85
|
-
return this.http.request(`/api/v1/interactions/${interactionId}/debug`);
|
|
86
|
-
}
|
|
87
84
|
listSkills() {
|
|
88
|
-
return this.http.request("/api/v1/skills"
|
|
85
|
+
return this.http.request("/api/v1/skills", {
|
|
86
|
+
query: { ...pageLane().query },
|
|
87
|
+
});
|
|
89
88
|
}
|
|
90
89
|
getSkill(skillId, file) {
|
|
91
90
|
return this.http.request(`/api/v1/skills/${encodeURIComponent(skillId)}`, {
|
|
@@ -93,34 +92,20 @@ export class RuntimeApiClient {
|
|
|
93
92
|
});
|
|
94
93
|
}
|
|
95
94
|
/**
|
|
96
|
-
* The checkout's standing brief
|
|
97
|
-
*
|
|
98
|
-
* docs/authoring-modes-design.md §3.3; the internal page ships inside the
|
|
99
|
-
* runtime package and never rides this endpoint). Not a skill: it belongs
|
|
100
|
-
* at the checkout root, so it has its own endpoint rather than a slot in
|
|
101
|
-
* the skills index.
|
|
95
|
+
* The checkout's standing brief. Not a skill: it belongs at the checkout
|
|
96
|
+
* root, so it has its own endpoint rather than a slot in the skills index.
|
|
102
97
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
98
|
+
* The stock build sends no query and takes the server's default page;
|
|
99
|
+
* which pages this build accepts is the lane's echo check, applied by the
|
|
100
|
+
* caller (skills/agents-page.ts) — a page whose echoed audience is not
|
|
101
|
+
* accepted is refused rather than written into a checkout, which is how
|
|
102
|
+
* an engine that defaults to a different page gets caught. Engines older
|
|
103
|
+
* than the endpoint answer 404.
|
|
109
104
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
if (audience && error instanceof ApiError && error.status === 422) {
|
|
118
|
-
return this.http.request("/api/v1/agents-md", {
|
|
119
|
-
query: { audience: "headless" },
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
throw error;
|
|
123
|
-
}
|
|
105
|
+
getAgentsMd() {
|
|
106
|
+
return this.http.request("/api/v1/agents-md", {
|
|
107
|
+
query: { ...pageLane().query },
|
|
108
|
+
});
|
|
124
109
|
}
|
|
125
110
|
getProgramSchemas(file) {
|
|
126
111
|
return this.http.request("/api/v1/programs/schema", {
|