@alexkroman1/aai-cli 13.3.0 → 14.0.0
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/dist/{_agent-Clbq3a4h.mjs → _agent-BzUeqOdj.mjs} +32 -9
- package/dist/_agent.d.ts +23 -0
- package/dist/{_bundler-DEkjO1d8.mjs → _bundler-DolUCMxu.mjs} +8 -7
- package/dist/_cli-common.d.ts +45 -6
- package/dist/{_config-ZY2euhdh.mjs → _config-DYzC6WMD.mjs} +2 -2
- package/dist/_dev-env.d.ts +1 -1
- package/dist/{_dev-server-C13xuGB1.mjs → _dev-server-CSMqF8PN.mjs} +20 -22
- package/dist/_dev-vite-config.d.ts +3 -3
- package/dist/{_init-Ci4QGjp8.mjs → _init-CQ8idAwo.mjs} +9 -23
- package/dist/{_output-DbJt9gsl.mjs → _output-DBP9Op_d.mjs} +22 -13
- package/dist/_output.d.ts +10 -9
- package/dist/{_preflight-B2laWPdU.mjs → _preflight-CcAR577V.mjs} +2 -2
- package/dist/_resource-commands.d.ts +9 -9
- package/dist/{_server-common-BV4_CrP3.mjs → _server-common-vILJp3it.mjs} +1 -1
- package/dist/{_slug-api-DlKpj91X.mjs → _slug-api-CGvc2YSQ.mjs} +18 -9
- package/dist/_slug-api.d.ts +19 -0
- package/dist/{_studio-DTi3EdXQ.mjs → _studio-DnR_BqFp.mjs} +7 -3
- package/dist/_studio-commands.d.ts +13 -13
- package/dist/{_templates-V4l5sZJy.mjs → _templates-CK4oKoeX.mjs} +3 -3
- package/dist/{_typecheck-gate-sV4N5F93.mjs → _typecheck-gate-U3jcil8L.mjs} +3 -2
- package/dist/_typecheck-gate.d.ts +3 -1
- package/dist/{_utils-Dhd058D9.mjs → _utils-D5JGcjiW.mjs} +43 -1
- package/dist/_utils.d.ts +35 -0
- package/dist/{_workflow-determinism-C9l8uC2R.mjs → _workflow-determinism-CvpqMpdh.mjs} +18 -26
- package/dist/_workflow-determinism.d.ts +3 -3
- package/dist/{build-CWyFGe-W.mjs → build-Mxk8gWvX.mjs} +46 -7
- package/dist/build.d.ts +5 -0
- package/dist/cli.d.ts +1 -2
- package/dist/cli.mjs +117 -135
- package/dist/{client-bundler-CT-_26c5.mjs → client-bundler-BJgREAh6.mjs} +1 -1
- package/dist/client-bundler.mjs +1 -1
- package/dist/{delete-RqlQZ6Y_.mjs → delete-BdFnbnVR.mjs} +4 -4
- package/dist/{deploy-B7f3CK7v.mjs → deploy-uAJ4NukN.mjs} +11 -11
- package/dist/{dev-DamXieW_.mjs → dev-DApPSaE_.mjs} +3 -3
- package/dist/{eval-h3DTVfRw.mjs → eval-BK47A_K5.mjs} +3 -3
- package/dist/{init-D-vFrV8h.mjs → init-DukDxECd.mjs} +11 -19
- package/dist/{login-CDiemNmC.mjs → login-DaLrPOFg.mjs} +4 -6
- package/dist/{logs-DGwPNCzB.mjs → logs-7BRwq0cG.mjs} +21 -14
- package/dist/project-config.mjs +1 -1
- package/dist/scaffold/CLAUDE.md +84 -56
- package/dist/scaffold/package.json +4 -4
- package/dist/scaffold/server.mjs +129 -25
- package/dist/{secret-V1w7y9-j.mjs → secret-Cjp912yF.mjs} +5 -5
- package/dist/secret.d.ts +8 -6
- package/dist/{studio-BpMCfUNx.mjs → studio-CpHlNHUZ.mjs} +13 -15
- package/dist/templates/call-audit/agent.test.ts +11 -6
- package/dist/templates/call-audit/agent.ts +2 -2
- package/dist/templates/call-audit/client.tsx +27 -42
- package/dist/templates/call-audit/workflows/audit.ts +7 -5
- package/dist/templates/call-audit/workflows/ingest.ts +7 -7
- package/dist/templates/call-audit/workflows/media.ts +12 -37
- package/dist/templates/call-audit/workflows/summarize.ts +8 -8
- package/dist/templates/call-audit/workflows/sync-api.ts +3 -3
- package/dist/templates/dispatch-center/agent.test.ts +7 -7
- package/dist/templates/dispatch-center/client.tsx +53 -61
- package/dist/templates/dispatch-center/shared.ts +0 -8
- package/dist/templates/dispatch-center/tools/ops_dashboard.ts +4 -1
- package/dist/templates/embedded-assets/agent.eval.test.ts +4 -2
- package/dist/templates/health-assistant/agent.eval.test.ts +4 -2
- package/dist/templates/infocom-adventure/client.tsx +40 -36
- package/dist/templates/link-digest/agent.test.ts +3 -3
- package/dist/templates/link-digest/agent.ts +2 -2
- package/dist/templates/link-digest/client.tsx +27 -17
- package/dist/templates/link-digest/workflows/digest.ts +13 -16
- package/dist/templates/night-owl/agent.eval.test.ts +4 -2
- package/dist/templates/night-owl/client.tsx +8 -2
- package/dist/templates/pipeline-simple/agent.test.ts +2 -2
- package/dist/templates/pizza-ordering/client.tsx +5 -4
- package/dist/templates/pizza-ordering/shared.ts +3 -8
- package/dist/templates/pizza-ordering/tools/add_pizza.ts +3 -2
- package/dist/templates/pizza-ordering/tools/place_order.ts +3 -2
- package/dist/templates/pizza-ordering/tools/remove_pizza.ts +3 -2
- package/dist/templates/pizza-ordering/tools/update_pizza.ts +3 -2
- package/dist/templates/pizza-ordering/tools/view_order.ts +3 -2
- package/dist/templates/plan-and-execute/agent.test.ts +10 -5
- package/dist/templates/plan-and-execute/client.tsx +2 -2
- package/dist/templates/podcast-digest/agent.test.ts +20 -11
- package/dist/templates/podcast-digest/client.tsx +16 -22
- package/dist/templates/podcast-digest/workflows/digest.ts +21 -19
- package/dist/templates/podcast-digest/workflows/feeds.ts +61 -33
- package/dist/templates/podcast-digest/workflows/slack.ts +7 -7
- package/dist/templates/recap-workflow/agent.eval.test.ts +21 -13
- package/dist/templates/recap-workflow/agent.test.ts +27 -23
- package/dist/templates/recap-workflow/workflows/recap.ts +24 -28
- package/dist/templates/redline/agent.eval.test.ts +5 -8
- package/dist/templates/redline/agent.test.ts +1 -1
- package/dist/templates/redline/client.tsx +36 -34
- package/dist/templates/redline/workflows/redline.ts +17 -17
- package/dist/templates/research-workflow/agent.eval.test.ts +5 -5
- package/dist/templates/research-workflow/agent.test.ts +10 -7
- package/dist/templates/research-workflow/workflows/research.ts +28 -30
- package/dist/templates/retail/agent.test.ts +17 -15
- package/dist/templates/retail/cancel.ts +7 -6
- package/dist/templates/retail/client.tsx +39 -58
- package/dist/templates/retail/payment.ts +4 -3
- package/dist/templates/retail/pending.test.ts +19 -19
- package/dist/templates/retail/store.test.ts +5 -5
- package/dist/templates/retail/swap.ts +8 -11
- package/dist/templates/solo-rpg/agent.eval.test.ts +2 -16
- package/dist/templates/solo-rpg/agent.test.ts +12 -12
- package/dist/templates/solo-rpg/client.tsx +3 -3
- package/dist/templates/spoken-summary/agent.test.ts +9 -9
- package/dist/templates/spoken-summary/agent.ts +3 -3
- package/dist/templates/spoken-summary/client.tsx +23 -30
- package/dist/templates/spoken-summary/workflows/summarize.ts +11 -11
- package/dist/templates/spoken-summary/workflows/transcribe.ts +14 -14
- package/dist/templates/support-line/client.tsx +4 -3
- package/dist/templates/support-line/prompts.ts +0 -2
- package/dist/templates/transcription-workflow/agent.test.ts +20 -12
- package/dist/templates/transcription-workflow/agent.ts +2 -2
- package/dist/templates/transcription-workflow/client.tsx +15 -14
- package/dist/templates/transcription-workflow/recover.ts +1 -1
- package/dist/templates/transcription-workflow/run-panel.tsx +34 -14
- package/dist/templates/transcription-workflow/total-latency.tsx +46 -20
- package/dist/templates/transcription-workflow/workflows/batch.ts +15 -15
- package/dist/templates/transcription-workflow/workflows/downsample.ts +1 -1
- package/dist/templates/transcription-workflow/workflows/normalize.ts +15 -19
- package/dist/templates/transcription-workflow/workflows/stream.ts +12 -12
- package/dist/templates/transcription-workflow/workflows/sync-api.ts +3 -3
- package/dist/templates/transcription-workflow/workflows/transcribe.ts +23 -34
- package/dist/templates/travel-concierge/agent.eval.test.ts +2 -2
- package/dist/templates/travel-concierge/agent.test.ts +15 -7
- package/dist/templates/travel-concierge/client.tsx +2 -2
- package/dist/templates/travel-concierge/shared.ts +10 -14
- package/dist/templates/travel-concierge/tools/lookup_booking.ts +4 -3
- package/dist/templates/travel-concierge/tools/search_car_rentals.ts +3 -2
- package/dist/templates/travel-concierge/tools/search_excursions.ts +3 -2
- package/dist/templates/travel-concierge/tools/search_flights.ts +3 -2
- package/dist/templates/travel-concierge/tools/search_hotels.ts +3 -2
- package/dist/{test-guenJUxi.mjs → test-D032V2cA.mjs} +4 -17
- package/dist/typecheck.mjs +1 -1
- package/dist/worker-bundler.mjs +1 -1
- package/dist/{workflow-BZyKLkhV.mjs → workflow-CVioyO3V.mjs} +6 -5
- package/package.json +4 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { m as stripTrailingSlash } from "./_utils-D5JGcjiW.mjs";
|
|
3
|
+
import { a as serverOrigin, i as readProjectConfig, n as ensureApiKey, r as readGlobalConfig, t as approveServer } from "./_config-DYzC6WMD.mjs";
|
|
3
4
|
import { existsSync } from "node:fs";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -18,9 +19,6 @@ function isDevMode() {
|
|
|
18
19
|
if (process.env.AAI_NO_DEV === "1") return false;
|
|
19
20
|
return getMonorepoRoot() !== null;
|
|
20
21
|
}
|
|
21
|
-
function stripTrailingSlash(url) {
|
|
22
|
-
return url.replace(/\/+$/, "");
|
|
23
|
-
}
|
|
24
22
|
/**
|
|
25
23
|
* Whether `origin` may receive a credential without prior user approval.
|
|
26
24
|
*
|
|
@@ -82,14 +80,39 @@ function assertValidConfigSlug(slug) {
|
|
|
82
80
|
throw new Error(`Invalid slug in .aai/project.json: ${JSON.stringify(slug)}\n Expected lowercase letters, digits, \`-\`, \`_\` (2-64 chars). Fix or delete the file — \`aai publish\` will create a fresh deployment.`);
|
|
83
81
|
}
|
|
84
82
|
/**
|
|
85
|
-
*
|
|
86
|
-
* the project
|
|
83
|
+
* Everything `resolveDeployTarget` decides BEFORE a credential is involved:
|
|
84
|
+
* the project config (null when never deployed, or when `cwd` is null), the
|
|
85
|
+
* user's global config, and the trust-checked, approved server URL.
|
|
87
86
|
*/
|
|
88
|
-
async function
|
|
89
|
-
const [config, globalConfig] = await Promise.all([readProjectConfig(cwd), readGlobalConfig()]);
|
|
87
|
+
async function resolveApprovedServer(cwd, explicitServer) {
|
|
88
|
+
const [config, globalConfig] = await Promise.all([cwd === null ? null : readProjectConfig(cwd), readGlobalConfig()]);
|
|
90
89
|
const serverUrl = resolveServerUrl(explicitServer, config?.serverUrl, globalConfig.approvedServers ?? []);
|
|
91
90
|
if (explicitServer) await approveServer(serverUrl);
|
|
92
91
|
assertValidConfigSlug(config?.slug);
|
|
92
|
+
return {
|
|
93
|
+
config,
|
|
94
|
+
globalConfig,
|
|
95
|
+
serverUrl
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolve everything needed to talk to the platform: project config (null if
|
|
100
|
+
* the project has never been deployed), server URL, and API key.
|
|
101
|
+
*
|
|
102
|
+
* `resolveApprovedServer` plus the key, rather than one function, because
|
|
103
|
+
* `aai login` needs the first half and cannot have the second — it is the
|
|
104
|
+
* command that PUTS the key on disk. It had its own copy of the
|
|
105
|
+
* read → `resolveServerUrl` → `approveServer` sequence, which is security
|
|
106
|
+
* policy ("passing `--server` is what approves an origin"), so a change to that
|
|
107
|
+
* policy landed here and silently missed the one command whose whole job is to
|
|
108
|
+
* write a credential for the origin in question. Same shape as the slug-guard
|
|
109
|
+
* incident `assertValidConfigSlug` was moved down here for.
|
|
110
|
+
*
|
|
111
|
+
* The key comes from the config document already in hand — `ensureApiKey` would
|
|
112
|
+
* read and parse the same file a second time, on every platform command.
|
|
113
|
+
*/
|
|
114
|
+
async function resolveDeployTarget(cwd, explicitServer) {
|
|
115
|
+
const { config, serverUrl } = await resolveApprovedServer(cwd, explicitServer);
|
|
93
116
|
return {
|
|
94
117
|
config,
|
|
95
118
|
serverUrl,
|
|
@@ -126,4 +149,4 @@ async function getServerInfo(cwd, explicitServer) {
|
|
|
126
149
|
};
|
|
127
150
|
}
|
|
128
151
|
//#endregion
|
|
129
|
-
export {
|
|
152
|
+
export { resolveApprovedServer as a, requireDeployedSlug as i, getServerInfo as n, resolveDeployTarget as o, isDevMode as r, getMonorepoRoot as t };
|
package/dist/_agent.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type GlobalConfig, type ProjectConfig } from "./_config.ts";
|
|
1
2
|
export declare const DEFAULT_SERVER = "https://alexkroman--aai-server-web-server.modal.run";
|
|
2
3
|
export declare const DEFAULT_DEV_SERVER = "http://localhost:8080";
|
|
3
4
|
export declare function getMonorepoRoot(): string | null;
|
|
@@ -19,9 +20,31 @@ export declare function isDevMode(): boolean;
|
|
|
19
20
|
* @param approvedOrigins - Origins from the user-owned global config.
|
|
20
21
|
*/
|
|
21
22
|
export declare function resolveServerUrl(explicit?: string, configUrl?: string, approvedOrigins?: readonly string[]): string;
|
|
23
|
+
/**
|
|
24
|
+
* Everything `resolveDeployTarget` decides BEFORE a credential is involved:
|
|
25
|
+
* the project config (null when never deployed, or when `cwd` is null), the
|
|
26
|
+
* user's global config, and the trust-checked, approved server URL.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveApprovedServer(cwd: string | null, explicitServer?: string): Promise<{
|
|
29
|
+
config: ProjectConfig | null;
|
|
30
|
+
globalConfig: GlobalConfig;
|
|
31
|
+
serverUrl: string;
|
|
32
|
+
}>;
|
|
22
33
|
/**
|
|
23
34
|
* Resolve everything needed to talk to the platform: project config (null if
|
|
24
35
|
* the project has never been deployed), server URL, and API key.
|
|
36
|
+
*
|
|
37
|
+
* `resolveApprovedServer` plus the key, rather than one function, because
|
|
38
|
+
* `aai login` needs the first half and cannot have the second — it is the
|
|
39
|
+
* command that PUTS the key on disk. It had its own copy of the
|
|
40
|
+
* read → `resolveServerUrl` → `approveServer` sequence, which is security
|
|
41
|
+
* policy ("passing `--server` is what approves an origin"), so a change to that
|
|
42
|
+
* policy landed here and silently missed the one command whose whole job is to
|
|
43
|
+
* write a credential for the origin in question. Same shape as the slug-guard
|
|
44
|
+
* incident `assertValidConfigSlug` was moved down here for.
|
|
45
|
+
*
|
|
46
|
+
* The key comes from the config document already in hand — `ensureApiKey` would
|
|
47
|
+
* read and parse the same file a second time, on every platform command.
|
|
25
48
|
*/
|
|
26
49
|
export declare function resolveDeployTarget(cwd: string, explicitServer?: string): Promise<{
|
|
27
50
|
config: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { t as buildClient } from "./client-bundler-
|
|
2
|
+
import { h as validateAgentExport } from "./_utils-D5JGcjiW.mjs";
|
|
3
|
+
import { t as buildClient } from "./client-bundler-BJgREAh6.mjs";
|
|
4
4
|
import { buildWorker } from "./worker-bundler.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
@@ -86,14 +86,15 @@ async function evalWorkerConfig(code) {
|
|
|
86
86
|
* distinct-build leak is accepted for the reasons documented there.
|
|
87
87
|
*/
|
|
88
88
|
function createWorkerEvaluator() {
|
|
89
|
-
let
|
|
90
|
-
let lastWorker;
|
|
89
|
+
let last;
|
|
91
90
|
return async (code) => {
|
|
92
91
|
const codeHash = hash("sha256", code);
|
|
93
|
-
if (
|
|
92
|
+
if (last?.hash === codeHash) return last.worker;
|
|
94
93
|
const worker = await evalWorkerBundle(code);
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
last = {
|
|
95
|
+
hash: codeHash,
|
|
96
|
+
worker
|
|
97
|
+
};
|
|
97
98
|
return worker;
|
|
98
99
|
};
|
|
99
100
|
}
|
package/dist/_cli-common.d.ts
CHANGED
|
@@ -17,6 +17,26 @@ export declare const sharedArgs: {
|
|
|
17
17
|
readonly description: "Output JSON (auto-detected in non-TTY)";
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* What every PLATFORM command accepts — the pair, as a group to spread.
|
|
22
|
+
*
|
|
23
|
+
* `sharedArgs` supplies the field VALUES, so each of the twelve credentialed
|
|
24
|
+
* commands still restated the shape (`server: sharedArgs.server, json:
|
|
25
|
+
* sharedArgs.json`). A flag all of them should take is then twelve edits, and
|
|
26
|
+
* `assertKnownArgv` refuses the flag on whichever one was missed — after
|
|
27
|
+
* release. `cli-workflow.ts`'s `workflowArgs` is the same pattern for its group.
|
|
28
|
+
*/
|
|
29
|
+
export declare const platformArgs: {
|
|
30
|
+
readonly server: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
readonly alias: "s";
|
|
33
|
+
readonly description: "Platform server URL";
|
|
34
|
+
};
|
|
35
|
+
readonly json: {
|
|
36
|
+
readonly type: "boolean";
|
|
37
|
+
readonly description: "Output JSON (auto-detected in non-TTY)";
|
|
38
|
+
};
|
|
39
|
+
};
|
|
20
40
|
/**
|
|
21
41
|
* Flags in `rawArgs` that `argsDef` doesn't declare, in the form the user
|
|
22
42
|
* typed them.
|
|
@@ -44,15 +64,34 @@ type AnyCommandDef = CommandDef<ArgsDef>;
|
|
|
44
64
|
* the narrowing.
|
|
45
65
|
*/
|
|
46
66
|
export declare function commandPath<T extends ArgsDef>(cmd: CommandDef<T>, parent?: CommandDef<T>): string;
|
|
67
|
+
/** What {@link resolveArgv} learned by walking the command tree once. */
|
|
68
|
+
export type ArgvSelection = {
|
|
69
|
+
/** `["aai", "secret", "put"]` — the path walked, for a `--help` sentence. */
|
|
70
|
+
named: string[];
|
|
71
|
+
/**
|
|
72
|
+
* The first non-flag token that named no subcommand where one was expected,
|
|
73
|
+
* i.e. a mistyped command. `undefined` when the walk reached a real command.
|
|
74
|
+
*/
|
|
75
|
+
unknownCommand?: string;
|
|
76
|
+
/** Args declared by the command the argv selected. */
|
|
77
|
+
argsDef: ArgsDef;
|
|
78
|
+
/** argv from the first token that is not a subcommand — flags and positionals. */
|
|
79
|
+
rest: string[];
|
|
80
|
+
};
|
|
47
81
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
82
|
+
* Walk the real command tree for `argv` and report everything the pre-parse
|
|
83
|
+
* guards in `cli.ts` need: which command it selects, what that command
|
|
84
|
+
* declares, and whether a token mistyped a subcommand.
|
|
50
85
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
86
|
+
* ONE walk, because there used to be two — this one and a copy in `cli.ts`,
|
|
87
|
+
* each with its own `Resolvable` narrowing, whose only difference was the
|
|
88
|
+
* terminal action. The copies also had an ORDERING dependency nothing
|
|
89
|
+
* enforced: the flag guard reports nothing for a mistyped subcommand (the
|
|
90
|
+
* flags would be matched against the wrong command's definition), which is
|
|
91
|
+
* only safe because the command guard ran first. Answering both from one
|
|
92
|
+
* result removes the ordering rather than documenting it.
|
|
54
93
|
*/
|
|
55
|
-
export declare function
|
|
94
|
+
export declare function resolveArgv(root: AnyCommandDef, argv: string[]): Promise<ArgvSelection>;
|
|
56
95
|
/** Shared command setup: resolve cwd, optionally require agent.ts. */
|
|
57
96
|
export declare function setup(opts?: {
|
|
58
97
|
agent?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as CliError } from "./_output-
|
|
3
|
-
import {
|
|
2
|
+
import { t as CliError } from "./_output-DBP9Op_d.mjs";
|
|
3
|
+
import { d as readJson, g as writeJson, s as errorMessage, u as isEexist } from "./_utils-D5JGcjiW.mjs";
|
|
4
4
|
import { mkdtempSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import fs from "node:fs/promises";
|
package/dist/_dev-env.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import type { Logger } from "@alexkroman1/aai-runtime";
|
|
19
19
|
/**
|
|
20
|
-
* The env handed to `
|
|
20
|
+
* The env handed to `createRuntimeServer` for host-mode connections: provider
|
|
21
21
|
* credentials plus the `AAI_ALLOW_HOST` gate read straight from the shell
|
|
22
22
|
* (it is a control variable, not something an agent declares in `.env`).
|
|
23
23
|
*/
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { i as outputSilenced, r as notify } from "./_ui-DCt4qZrk.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { n as fallbackHtmlPlugin } from "./client-bundler-
|
|
3
|
+
import { a as errorCode, s as errorMessage$1 } from "./_utils-D5JGcjiW.mjs";
|
|
4
|
+
import { n as fallbackHtmlPlugin } from "./client-bundler-BJgREAh6.mjs";
|
|
5
5
|
import { t as DEDUPED_PEERS } from "./_vite-env-kejF0p2L.mjs";
|
|
6
6
|
import { buildWorker } from "./worker-bundler.mjs";
|
|
7
7
|
import { typecheckProject } from "./typecheck.mjs";
|
|
8
|
-
import { n as ensureApiKey } from "./_config-
|
|
9
|
-
import { n as createWorkerEvaluator } from "./_bundler-
|
|
10
|
-
import { t as resolveServerEnv } from "./_server-common-
|
|
8
|
+
import { n as ensureApiKey } from "./_config-DYzC6WMD.mjs";
|
|
9
|
+
import { n as createWorkerEvaluator } from "./_bundler-DolUCMxu.mjs";
|
|
10
|
+
import { t as resolveServerEnv } from "./_server-common-vILJp3it.mjs";
|
|
11
11
|
import { existsSync, statSync } from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
13
|
-
import { omitUndefined } from "@alexkroman1/aai/utils";
|
|
13
|
+
import { omitUndefined, plural } from "@alexkroman1/aai/utils";
|
|
14
14
|
import { createCoalescingRunner, requestPath, sleep } from "@alexkroman1/aai/internal";
|
|
15
15
|
import { agentConfigWarnings } from "@alexkroman1/aai/manifest";
|
|
16
|
-
import { DEFAULT_LISTEN_HOST, WORKFLOW_API_PREFIX, createRuntime,
|
|
17
|
-
import { WORKFLOW_DATA_DIR_ENV, consoleLogger, createMemoryJournal, handleWorkflowRequest, publishStepEnv } from "@alexkroman1/aai-runtime/internal";
|
|
16
|
+
import { DEFAULT_LISTEN_HOST, WORKFLOW_API_PREFIX, createRuntime, createRuntimeServer, ensureSessionStateSchema, ensureWorkflowJournalSchema, requiredProviderEnvVars, withHostCredentialFallback } from "@alexkroman1/aai-runtime";
|
|
17
|
+
import { WORKFLOW_DATA_DIR_ENV, consoleLogger, createMemoryJournal, handleWorkflowRequest, isPathInside, publishStepEnv } from "@alexkroman1/aai-runtime/internal";
|
|
18
18
|
import { defaultClientDir } from "@alexkroman1/aai-ui/client-dir";
|
|
19
19
|
import { watch } from "chokidar";
|
|
20
20
|
import getPort, { portNumbers } from "get-port";
|
|
21
21
|
import pDebounce from "p-debounce";
|
|
22
22
|
//#region src/_dev-env.ts
|
|
23
23
|
/**
|
|
24
|
-
* The env handed to `
|
|
24
|
+
* The env handed to `createRuntimeServer` for host-mode connections: provider
|
|
25
25
|
* credentials plus the `AAI_ALLOW_HOST` gate read straight from the shell
|
|
26
26
|
* (it is a control variable, not something an agent declares in `.env`).
|
|
27
27
|
*/
|
|
@@ -338,7 +338,7 @@ function createDevTypecheck(cwd, report = notify) {
|
|
|
338
338
|
* send `..` where a browser would normalize it — and a malformed percent-escape
|
|
339
339
|
* is left to the API, which is where a path we cannot resolve belongs.
|
|
340
340
|
*/
|
|
341
|
-
function workflowPathServedByVite(
|
|
341
|
+
function workflowPathServedByVite(base, rawUrl) {
|
|
342
342
|
if (rawUrl === void 0) return void 0;
|
|
343
343
|
let decoded;
|
|
344
344
|
try {
|
|
@@ -346,9 +346,8 @@ function workflowPathServedByVite(root, rawUrl) {
|
|
|
346
346
|
} catch {
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
|
-
const base = path.resolve(root);
|
|
350
349
|
const resolved = path.resolve(base, `.${decoded}`);
|
|
351
|
-
if (
|
|
350
|
+
if (!isPathInside(base, resolved)) return void 0;
|
|
352
351
|
try {
|
|
353
352
|
if (!statSync(resolved).isFile()) return void 0;
|
|
354
353
|
} catch {
|
|
@@ -362,13 +361,13 @@ function workflowPathServedByVite(root, rawUrl) {
|
|
|
362
361
|
* with a `client.tsx` serves a page whose WebSocket never connects.
|
|
363
362
|
*
|
|
364
363
|
* **This table is the whole agent API as the browser can see it**, which is
|
|
365
|
-
* the thing to hold in mind before adding a route to `
|
|
364
|
+
* the thing to hold in mind before adding a route to `createRuntimeServer`. Vite owns
|
|
366
365
|
* the port the user is told to open and answers everything not listed here
|
|
367
366
|
* itself — with a bare 404 carrying none of the agent server's headers, so the
|
|
368
367
|
* failure looks like a missing route rather than a missing proxy entry.
|
|
369
368
|
*
|
|
370
369
|
* `/workflows` is why that matters beyond voice. A WORKFLOW APP
|
|
371
|
-
* (`workflowApp()`) has no session and no socket: `
|
|
370
|
+
* (`workflowApp()`) has no session and no socket: `mountPage()` mounts a
|
|
372
371
|
* form and every single thing it does — listing workflows, starting a run,
|
|
373
372
|
* polling it, streaming its events — is a same-origin `fetch` under that
|
|
374
373
|
* prefix. Unproxied, the two workflow-app templates were dead on arrival under
|
|
@@ -396,7 +395,7 @@ function workflowPathServedByVite(root, rawUrl) {
|
|
|
396
395
|
* `http://localhost:<port>` either way — a caller that resolves IPv4-only, or
|
|
397
396
|
* dials the literal, gets a connection refused against a server that is up.
|
|
398
397
|
*
|
|
399
|
-
* The two halves of `aai dev` also disagreed: `
|
|
398
|
+
* The two halves of `aai dev` also disagreed: `createRuntimeServer` binds
|
|
400
399
|
* {@link DEFAULT_LISTEN_HOST} explicitly, Vite took its own default, and only a
|
|
401
400
|
* set `AAI_DEV_HOST` brought them back together. Taking the same constant is
|
|
402
401
|
* what makes them agree by construction rather than by two matching literals.
|
|
@@ -444,6 +443,7 @@ function workflowPathServedByVite(root, rawUrl) {
|
|
|
444
443
|
*/
|
|
445
444
|
function viteDevConfig(cwd, vitePort, backendPort) {
|
|
446
445
|
const target = `http://127.0.0.1:${backendPort}`;
|
|
446
|
+
const viteRoot = path.resolve(cwd);
|
|
447
447
|
return {
|
|
448
448
|
root: cwd,
|
|
449
449
|
plugins: [fallbackHtmlPlugin(cwd)],
|
|
@@ -461,7 +461,7 @@ function viteDevConfig(cwd, vitePort, backendPort) {
|
|
|
461
461
|
},
|
|
462
462
|
[WORKFLOW_API_PREFIX]: {
|
|
463
463
|
target,
|
|
464
|
-
bypass: (req) => workflowPathServedByVite(
|
|
464
|
+
bypass: (req) => workflowPathServedByVite(viteRoot, req.url)
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
}
|
|
@@ -491,16 +491,14 @@ function viteDevConfig(cwd, vitePort, backendPort) {
|
|
|
491
491
|
* can't mask one that would be missing both here and after deploy.
|
|
492
492
|
*/
|
|
493
493
|
function agentEnvWarnings(agentDef, env, shellEnv = process.env) {
|
|
494
|
-
const s = (names) => names.length > 1 ? "s" : "";
|
|
495
|
-
const them = (names) => names.length > 1 ? "them" : "it";
|
|
496
494
|
const required = requiredProviderEnvVars(agentDef);
|
|
497
495
|
const warnings = [];
|
|
498
496
|
const missing = required.filter((name) => !(env[name] || shellEnv[name]));
|
|
499
|
-
if (missing.length > 0) warnings.push(`Missing provider
|
|
497
|
+
if (missing.length > 0) warnings.push(`Missing provider ${plural(missing.length, "credential")}: ${missing.join(", ")}. Set ${plural(missing.length, "it", "them")} in .env or the environment.`);
|
|
500
498
|
const shellOnly = required.filter((name) => !env[name] && shellEnv[name]);
|
|
501
|
-
if (shellOnly.length > 0) warnings.push(`${shellOnly.join(", ")} resolved from your shell, not .env — deployed agents won't have ${
|
|
499
|
+
if (shellOnly.length > 0) warnings.push(`${shellOnly.join(", ")} resolved from your shell, not .env — deployed agents won't have ${plural(shellOnly.length, "it", "them")}. Declare ${plural(shellOnly.length, "it", "them")} in .env before \`aai publish\`.`);
|
|
502
500
|
const declared = (agentDef.requiredEnv ?? []).filter((name) => !env[name]);
|
|
503
|
-
if (declared.length > 0) warnings.push(`Missing requiredEnv
|
|
501
|
+
if (declared.length > 0) warnings.push(`Missing requiredEnv ${plural(declared.length, "key")} declared by the agent: ${declared.join(", ")}. Set ${plural(declared.length, "it", "them")} in .env — ctx.env will not contain ${plural(declared.length, "it", "them")} otherwise.`);
|
|
504
502
|
return warnings;
|
|
505
503
|
}
|
|
506
504
|
async function resolveAgentEnv(root, agentDef) {
|
|
@@ -634,7 +632,7 @@ async function startDevServer(opts) {
|
|
|
634
632
|
journal,
|
|
635
633
|
publicUrl: process.env.PUBLIC_URL?.trim() || `http://localhost:${backendPort}`
|
|
636
634
|
});
|
|
637
|
-
return
|
|
635
|
+
return createRuntimeServer({
|
|
638
636
|
runtime,
|
|
639
637
|
name: agentDef.name,
|
|
640
638
|
env: hostModeEnv(providerEnv),
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
* with a `client.tsx` serves a page whose WebSocket never connects.
|
|
13
13
|
*
|
|
14
14
|
* **This table is the whole agent API as the browser can see it**, which is
|
|
15
|
-
* the thing to hold in mind before adding a route to `
|
|
15
|
+
* the thing to hold in mind before adding a route to `createRuntimeServer`. Vite owns
|
|
16
16
|
* the port the user is told to open and answers everything not listed here
|
|
17
17
|
* itself — with a bare 404 carrying none of the agent server's headers, so the
|
|
18
18
|
* failure looks like a missing route rather than a missing proxy entry.
|
|
19
19
|
*
|
|
20
20
|
* `/workflows` is why that matters beyond voice. A WORKFLOW APP
|
|
21
|
-
* (`workflowApp()`) has no session and no socket: `
|
|
21
|
+
* (`workflowApp()`) has no session and no socket: `mountPage()` mounts a
|
|
22
22
|
* form and every single thing it does — listing workflows, starting a run,
|
|
23
23
|
* polling it, streaming its events — is a same-origin `fetch` under that
|
|
24
24
|
* prefix. Unproxied, the two workflow-app templates were dead on arrival under
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* `http://localhost:<port>` either way — a caller that resolves IPv4-only, or
|
|
47
47
|
* dials the literal, gets a connection refused against a server that is up.
|
|
48
48
|
*
|
|
49
|
-
* The two halves of `aai dev` also disagreed: `
|
|
49
|
+
* The two halves of `aai dev` also disagreed: `createRuntimeServer` binds
|
|
50
50
|
* {@link DEFAULT_LISTEN_HOST} explicitly, Vite took its own default, and only a
|
|
51
51
|
* set `AAI_DEV_HOST` brought them back together. Taking the same constant is
|
|
52
52
|
* what makes them agree by construction rather than by two matching literals.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { r as isDevMode, t as getMonorepoRoot } from "./_agent-
|
|
4
|
-
import { REPO_URL, downloadAndMergeTemplate } from "./_templates-
|
|
2
|
+
import { d as readJson, g as writeJson, i as compareCodeUnits, u as isEexist } from "./_utils-D5JGcjiW.mjs";
|
|
3
|
+
import { r as isDevMode, t as getMonorepoRoot } from "./_agent-BzUeqOdj.mjs";
|
|
4
|
+
import { REPO_URL, downloadAndMergeTemplate } from "./_templates-CK4oKoeX.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
7
|
//#region src/_init.ts
|
|
@@ -119,17 +119,6 @@ async function patchPackageJsonForWorkspace(targetDir) {
|
|
|
119
119
|
await pinSharedDeps(targetDir, packagesDir, pkgJson);
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
|
-
* Code-unit ordering, never `localeCompare`.
|
|
123
|
-
*
|
|
124
|
-
* With no explicit locale that answers to the runtime's ICU default, so the same
|
|
125
|
-
* project would scaffold a differently-ordered file on a different machine —
|
|
126
|
-
* which is the reason the repo's own generated artifacts sort this way too.
|
|
127
|
-
*/
|
|
128
|
-
function compareNames(a, b) {
|
|
129
|
-
if (a === b) return 0;
|
|
130
|
-
return a < b ? -1 : 1;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
122
|
* Pin every THIRD-PARTY dependency this project shares with a linked workspace
|
|
134
123
|
* package to the copy that workspace package resolved.
|
|
135
124
|
*
|
|
@@ -162,17 +151,14 @@ async function pinSharedDeps(targetDir, packagesDir, pkgJson) {
|
|
|
162
151
|
...pkgJson.devDependencies
|
|
163
152
|
};
|
|
164
153
|
const linked = Object.entries(WORKSPACE_PKG_DIRS).filter(([name]) => name in declared).map(([, dir]) => dir);
|
|
165
|
-
const
|
|
166
|
-
for (const name of Object.keys(declared)) {
|
|
167
|
-
if (name in WORKSPACE_PKG_DIRS) continue;
|
|
154
|
+
const resolved = await Promise.all(Object.keys(declared).filter((name) => !(name in WORKSPACE_PKG_DIRS)).map(async (name) => {
|
|
168
155
|
for (const dir of linked) {
|
|
169
156
|
const manifest = await readJson(path.join(packagesDir, dir, "node_modules", name, "package.json"));
|
|
170
|
-
if (typeof manifest?.version === "string")
|
|
171
|
-
pins.set(name, manifest.version);
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
157
|
+
if (typeof manifest?.version === "string") return [name, manifest.version];
|
|
174
158
|
}
|
|
175
|
-
|
|
159
|
+
return null;
|
|
160
|
+
}));
|
|
161
|
+
const pins = new Map(resolved.filter((entry) => entry !== null));
|
|
176
162
|
if (pins.size === 0) return;
|
|
177
163
|
const file = path.join(targetDir, "pnpm-workspace.yaml");
|
|
178
164
|
let existing;
|
|
@@ -181,7 +167,7 @@ async function pinSharedDeps(targetDir, packagesDir, pkgJson) {
|
|
|
181
167
|
} catch {
|
|
182
168
|
return;
|
|
183
169
|
}
|
|
184
|
-
const block = [...pins].sort(([a], [b]) =>
|
|
170
|
+
const block = [...pins].sort(([a], [b]) => compareCodeUnits(a, b)).map(([name, version]) => ` "${name}": "${version}"`).join("\n");
|
|
185
171
|
await fs.writeFile(file, `${existing.trimEnd()}\n\n# Added by \`aai init\` in DEV MODE only — see pinSharedDeps in\n# packages/aai-cli/src/_init.ts. The @alexkroman1/* packages above are LINKED to
|
|
186
172
|
# this checkout, so anything they and this project both depend on has to be
|
|
187
173
|
# ONE copy: two copies of xstate are two incompatible sets of types, and the
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { stripVTControlCharacters } from "node:util";
|
|
2
3
|
//#region src/_output.ts
|
|
3
4
|
/**
|
|
5
|
+
* Structured output support for CLI commands.
|
|
6
|
+
*
|
|
7
|
+
* In JSON mode (non-TTY or --json), commands emit exactly one JSON line to
|
|
8
|
+
* stdout. In human mode (TTY, default), commands use @clack/prompts as before.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
4
11
|
* Determine output mode from CLI flags and TTY state.
|
|
5
12
|
*
|
|
6
13
|
* Priority: --json flag > --no-json flag > TTY auto-detection.
|
|
@@ -11,27 +18,29 @@ function getOutputMode(args, isTTY = Boolean(process.stdout.isTTY)) {
|
|
|
11
18
|
return isTTY ? "human" : "json";
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
|
-
* A
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
const ANSI_RAW = new RegExp(`${String.fromCharCode(27)}\\[[0-?]*[ -/]*[@-~]`, "g");
|
|
19
|
-
/**
|
|
20
|
-
* The same sequence AFTER `JSON.stringify`, which escapes the ESC byte as the
|
|
21
|
-
* six characters `\u001b`. Both forms are needed because a caller stringifies
|
|
22
|
-
* a whole result and hands the line here — see {@link writeLine}.
|
|
21
|
+
* A terminal escape sequence AFTER `JSON.stringify`, which escapes the ESC
|
|
22
|
+
* byte as the six characters `\u001b`. Needed alongside the raw form because a
|
|
23
|
+
* caller stringifies a whole result and hands the line here — see
|
|
24
|
+
* {@link writeLine} — and no builtin reads that spelling.
|
|
23
25
|
*/
|
|
24
26
|
const ANSI_JSON = /\\u001[bB]\[[0-?]*[ -/]*[@-~]/g;
|
|
25
27
|
/**
|
|
26
28
|
* Remove ANSI escape sequences, in raw or JSON-escaped form.
|
|
27
29
|
*
|
|
28
30
|
* A bundler colours its own diagnostics unconditionally, so `aai build`'s
|
|
29
|
-
* failure reached the JSON envelope as per-character SGR pairs
|
|
30
|
-
*
|
|
31
|
-
*
|
|
31
|
+
* failure reached the JSON envelope as per-character SGR pairs — illegible in a
|
|
32
|
+
* CI log and meaningless to a `jq` consumer, which is the audience JSON mode
|
|
33
|
+
* has.
|
|
34
|
+
*
|
|
35
|
+
* The raw half is `node:util`'s, not a local CSI regex. A/B'd on Node 26: the
|
|
36
|
+
* two agree on every SGR pair and cursor move the hand-built pattern was
|
|
37
|
+
* written for, and the builtin ALSO strips OSC-8 hyperlinks (`ESC ] 8 ;; url`)
|
|
38
|
+
* and charset selects (`ESC ( B`), which that pattern left in the envelope — so
|
|
39
|
+
* its claim to cover what a diagnostic arrives wearing was the incomplete part.
|
|
40
|
+
* The JSON-escaped half has no builtin and stays.
|
|
32
41
|
*/
|
|
33
42
|
function stripAnsi(text) {
|
|
34
|
-
return text
|
|
43
|
+
return stripVTControlCharacters(text).replace(ANSI_JSON, "");
|
|
35
44
|
}
|
|
36
45
|
/**
|
|
37
46
|
* Write a machine-readable line to stdout, resolving only once it has been
|
package/dist/_output.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Structured output support for CLI commands.
|
|
3
|
-
*
|
|
4
|
-
* In JSON mode (non-TTY or --json), commands emit exactly one JSON line to
|
|
5
|
-
* stdout. In human mode (TTY, default), commands use @clack/prompts as before.
|
|
6
|
-
*/
|
|
7
1
|
export type OutputMode = "json" | "human";
|
|
8
2
|
export type CommandResult<T> = {
|
|
9
3
|
ok: true;
|
|
@@ -26,9 +20,16 @@ export declare function getOutputMode(args: {
|
|
|
26
20
|
* Remove ANSI escape sequences, in raw or JSON-escaped form.
|
|
27
21
|
*
|
|
28
22
|
* A bundler colours its own diagnostics unconditionally, so `aai build`'s
|
|
29
|
-
* failure reached the JSON envelope as per-character SGR pairs
|
|
30
|
-
*
|
|
31
|
-
*
|
|
23
|
+
* failure reached the JSON envelope as per-character SGR pairs — illegible in a
|
|
24
|
+
* CI log and meaningless to a `jq` consumer, which is the audience JSON mode
|
|
25
|
+
* has.
|
|
26
|
+
*
|
|
27
|
+
* The raw half is `node:util`'s, not a local CSI regex. A/B'd on Node 26: the
|
|
28
|
+
* two agree on every SGR pair and cursor move the hand-built pattern was
|
|
29
|
+
* written for, and the builtin ALSO strips OSC-8 hyperlinks (`ESC ] 8 ;; url`)
|
|
30
|
+
* and charset selects (`ESC ( B`), which that pattern left in the envelope — so
|
|
31
|
+
* its claim to cover what a diagnostic arrives wearing was the incomplete part.
|
|
32
|
+
* The JSON-escaped half has no builtin and stays.
|
|
32
33
|
*/
|
|
33
34
|
export declare function stripAnsi(text: string): string;
|
|
34
35
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { plural } from "@alexkroman1/aai/utils";
|
|
2
3
|
import { requiredProviderEnvVars } from "@alexkroman1/aai-runtime";
|
|
3
4
|
//#region src/_preflight.ts
|
|
4
5
|
/**
|
|
@@ -39,8 +40,7 @@ function missingCredentials(config, env) {
|
|
|
39
40
|
}
|
|
40
41
|
/** One line naming the missing keys and what to do about them. */
|
|
41
42
|
function missingCredentialMessage(missing) {
|
|
42
|
-
|
|
43
|
-
return `Missing credential${plural ? "s" : ""} the agent needs to start: ${missing.join(", ")}. Declare ${plural ? "them" : "it"} in .env and redeploy (already set on the platform with \`aai secret put\`? then this is already handled).`;
|
|
43
|
+
return `Missing ${plural(missing.length, "credential")} the agent needs to start: ${missing.join(", ")}. Declare ${plural(missing.length, "it", "them")} in .env and redeploy (already set on the platform with \`aai secret put\`? then this is already handled).`;
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
export { missingCredentialMessage, missingCredentials };
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export declare const secret: import("citty").CommandDef<import("citty").ArgsDef>;
|
|
2
2
|
export declare const logs: import("citty").CommandDef<{
|
|
3
|
+
readonly server: {
|
|
4
|
+
readonly type: "string";
|
|
5
|
+
readonly alias: "s";
|
|
6
|
+
readonly description: "Platform server URL";
|
|
7
|
+
};
|
|
8
|
+
readonly json: {
|
|
9
|
+
readonly type: "boolean";
|
|
10
|
+
readonly description: "Output JSON (auto-detected in non-TTY)";
|
|
11
|
+
};
|
|
3
12
|
readonly dir: {
|
|
4
13
|
readonly type: "positional";
|
|
5
14
|
readonly description: "Project directory";
|
|
@@ -10,13 +19,4 @@ export declare const logs: import("citty").CommandDef<{
|
|
|
10
19
|
readonly alias: "f";
|
|
11
20
|
readonly description: "Keep printing new output";
|
|
12
21
|
};
|
|
13
|
-
readonly server: {
|
|
14
|
-
readonly type: "string";
|
|
15
|
-
readonly alias: "s";
|
|
16
|
-
readonly description: "Platform server URL";
|
|
17
|
-
};
|
|
18
|
-
readonly json: {
|
|
19
|
-
readonly type: "boolean";
|
|
20
|
-
readonly description: "Output JSON (auto-detected in non-TTY)";
|
|
21
|
-
};
|
|
22
22
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as getServerInfo } from "./_agent-
|
|
3
|
-
import { l as HINT_NOT_DEPLOYED, s as studioProjectApiUrl, u as apiRequest } from "./_studio-
|
|
2
|
+
import { n as getServerInfo } from "./_agent-BzUeqOdj.mjs";
|
|
3
|
+
import { l as HINT_NOT_DEPLOYED, s as studioProjectApiUrl, u as apiRequest } from "./_studio-DnR_BqFp.mjs";
|
|
4
4
|
//#region src/_slug-api.ts
|
|
5
5
|
/**
|
|
6
6
|
* Authenticated request against a deployed agent's slug-scoped resource
|
|
@@ -43,12 +43,21 @@ async function secretRequest(cwd, resourcePath, init, server) {
|
|
|
43
43
|
target: studioProject ?? slug
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
/**
|
|
47
|
+
* A slug-scoped request against an ALREADY-resolved target.
|
|
48
|
+
*
|
|
49
|
+
* {@link slugRequest} resolves per call, which is right for a command that
|
|
50
|
+
* issues one request and wrong for one that POLLS. `aai logs --follow` re-entered
|
|
51
|
+
* `getServerInfo` on every tick — a read and zod parse of `.aai/project.json`, a
|
|
52
|
+
* read of the global config, a `new URL` trust check, a slug-shape test, and with
|
|
53
|
+
* `--server` an `approveServer` that takes the CROSS-PROCESS config lock — once a
|
|
54
|
+
* second for the life of the follow, all of it re-deriving an immutable answer.
|
|
55
|
+
* `delete.ts` documents the same cost and answers it the same way, by hand; this
|
|
56
|
+
* is the general version, so the next polling command inherits it.
|
|
57
|
+
*/
|
|
58
|
+
async function slugRequestOn(target, resourcePath, init) {
|
|
59
|
+
const { serverUrl, slug, apiKey } = target;
|
|
60
|
+
return deployedAgentRequest(`${serverUrl}/${slug}${resourcePath}`, init, apiKey);
|
|
52
61
|
}
|
|
53
62
|
//#endregion
|
|
54
|
-
export {
|
|
63
|
+
export { slugRequestOn as n, secretRequest as t };
|