@alexkroman1/aai-cli 6.5.0 → 6.6.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-vGW5SBnX.mjs → _agent-DpH2pBJd.mjs} +1 -5
- package/dist/{_bundler-BapCUUJN.mjs → _bundler-C2BDwU7r.mjs} +5 -7
- package/dist/{_dev-server-DQ1t9sbw.mjs → _dev-server-LLLWnFBs.mjs} +3 -3
- package/dist/_e2e-test-utils.d.ts +17 -17
- package/dist/{_init-CpISqoR8.mjs → _init-C57bWAQ8.mjs} +2 -2
- package/dist/{_slug-api-D2heILuC.mjs → _slug-api-BxrsJXVI.mjs} +3 -3
- package/dist/_slug-api.d.ts +1 -1
- package/dist/{_api-client-LgLksMhN.mjs → _studio-U3jhKlA3.mjs} +105 -2
- package/dist/_studio.d.ts +11 -0
- package/dist/{_templates-iDGjGiPf.mjs → _templates-Dxb_P2Wz.mjs} +1 -1
- package/dist/bin.d.mts +2 -0
- package/dist/{build-BO1Ni6oJ.mjs → build-Dfza2pRI.mjs} +2 -2
- package/dist/cli.mjs +43 -42
- package/dist/{client-bundler-B8Q9F8gJ.mjs → client-bundler-BEIqgOtd.mjs} +2 -2
- package/dist/client-bundler.mjs +1 -1
- package/dist/{delete-4I0uNR4a.mjs → delete-vbpjGzqs.mjs} +3 -3
- package/dist/{deploy-DJ3HRcia.mjs → deploy-B8lubiRT.mjs} +3 -4
- package/dist/{dev-C6SWaAZP.mjs → dev-Uq5ujP8a.mjs} +1 -1
- package/dist/{eject-Zrzk5KV3.mjs → eject-31gjtaHF.mjs} +2 -2
- package/dist/{init-BTRGiPQr.mjs → init-l6xfU4xX.mjs} +3 -3
- package/dist/{login-k0Z3VQu9.mjs → login-C71-qz8F.mjs} +1 -1
- package/dist/scaffold/.env.example +21 -0
- package/dist/scaffold/CLAUDE.md +23 -0
- package/dist/scaffold/package.json +3 -3
- package/dist/{secret-DzSQx1Ds.mjs → secret-BuMuFR4B.mjs} +2 -2
- package/dist/{storage-C-Do0mIA.mjs → storage-DzRZ-eCw.mjs} +2 -2
- package/dist/{studio-BGVmCA2G.mjs → studio-BCNUpDgP.mjs} +4 -5
- package/dist/templates/retail/resolve.ts +16 -0
- package/dist/templates/retail/store.ts +20 -0
- package/dist/templates/retail/tools/cancel_pending_order.ts +2 -5
- package/dist/templates/retail/tools/exchange_delivered_order_items.ts +2 -5
- package/dist/templates/retail/tools/get_order_details.ts +4 -6
- package/dist/templates/retail/tools/get_user_details.ts +2 -7
- package/dist/templates/retail/tools/modify_pending_order_address.ts +2 -5
- package/dist/templates/retail/tools/modify_pending_order_items.ts +2 -5
- package/dist/templates/retail/tools/modify_pending_order_payment.ts +2 -5
- package/dist/templates/retail/tools/modify_user_address.ts +2 -7
- package/dist/templates/retail/tools/return_delivered_order_items.ts +2 -5
- package/dist/templates/transcription-workflow/agent.test.ts +2 -3
- package/dist/templates/transcription-workflow/client.tsx +9 -6
- package/dist/templates/transcription-workflow/workflows/batch.ts +2 -13
- package/dist/templates/transcription-workflow/workflows/stream.ts +1 -10
- package/dist/templates/transcription-workflow/workflows/sync-api.ts +8 -2
- package/dist/templates/transcription-workflow/workflows/transcribe.ts +8 -2
- package/dist/{test-B6ZBxSpk.mjs → test-9kPKJI-w.mjs} +1 -3
- package/dist/typecheck.mjs +4 -5
- package/dist/{worker-bundler-CIdDhZ0c.mjs → worker-bundler-CGD4r8Kc.mjs} +25 -11
- package/dist/worker-bundler.mjs +1 -1
- package/dist/{workflow-B-O97AqI.mjs → workflow-CFpxOFfQ.mjs} +1 -1
- package/package.json +4 -4
- package/dist/_studio-zAJycZ8j.mjs +0 -94
|
@@ -145,8 +145,19 @@ var AaiWorkflowBuilder = class extends BaseBuilder {
|
|
|
145
145
|
* repo's `erasableSyntaxOnly`, so the fields are declared the long way too.
|
|
146
146
|
*/
|
|
147
147
|
output;
|
|
148
|
-
|
|
148
|
+
/**
|
|
149
|
+
* The two bundles `build()` reads back.
|
|
150
|
+
*
|
|
151
|
+
* Held as fields because `super()` is also told where to write them: derived
|
|
152
|
+
* a second time inside `build()`, the two spellings of each path were free to
|
|
153
|
+
* disagree, and a `build()` reading a file the builder never wrote is a
|
|
154
|
+
* "produced nothing" failure that names neither path.
|
|
155
|
+
*/
|
|
156
|
+
flowFile;
|
|
157
|
+
stepFile;
|
|
149
158
|
constructor(cwd, outDir) {
|
|
159
|
+
const flowFile = path.join(outDir, "flow.mjs");
|
|
160
|
+
const stepFile = path.join(outDir, "step.mjs");
|
|
150
161
|
super({
|
|
151
162
|
buildTarget: "standalone",
|
|
152
163
|
dirs: [`./${WORKFLOWS_DIR}`],
|
|
@@ -154,31 +165,30 @@ var AaiWorkflowBuilder = class extends BaseBuilder {
|
|
|
154
165
|
projectRoot: cwd,
|
|
155
166
|
moduleSpecifierRoot: cwd,
|
|
156
167
|
externalPackages: [...WDK_EXTERNAL],
|
|
157
|
-
stepsBundlePath:
|
|
158
|
-
workflowsBundlePath:
|
|
168
|
+
stepsBundlePath: stepFile,
|
|
169
|
+
workflowsBundlePath: flowFile,
|
|
159
170
|
webhookBundlePath: path.join(outDir, "webhook.mjs"),
|
|
160
171
|
suppressCreateWorkflowsBundleLogs: true,
|
|
161
172
|
suppressCreateWebhookBundleLogs: true,
|
|
162
173
|
suppressCreateManifestLogs: true
|
|
163
174
|
});
|
|
164
|
-
this.
|
|
175
|
+
this.flowFile = flowFile;
|
|
176
|
+
this.stepFile = stepFile;
|
|
165
177
|
}
|
|
166
178
|
async build() {
|
|
167
179
|
const inputFiles = await this.getInputFiles();
|
|
168
|
-
const flowFile = path.join(this.outDir, "flow.mjs");
|
|
169
|
-
const stepFile = path.join(this.outDir, "step.mjs");
|
|
170
180
|
const { manifest } = await this.createWorkflowsBundle({
|
|
171
181
|
inputFiles,
|
|
172
182
|
format: "esm",
|
|
173
|
-
outfile: flowFile,
|
|
183
|
+
outfile: this.flowFile,
|
|
174
184
|
bundleFinalOutput: false
|
|
175
185
|
});
|
|
176
186
|
await this.createStepsBundle({
|
|
177
187
|
inputFiles,
|
|
178
188
|
format: "esm",
|
|
179
|
-
outfile: stepFile
|
|
189
|
+
outfile: this.stepFile
|
|
180
190
|
});
|
|
181
|
-
const [workflowCode, stepCode] = await Promise.all([fs.readFile(flowFile, "utf-8"), fs.readFile(stepFile, "utf-8")]);
|
|
191
|
+
const [workflowCode, stepCode] = await Promise.all([fs.readFile(this.flowFile, "utf-8"), fs.readFile(this.stepFile, "utf-8")]);
|
|
182
192
|
this.output = {
|
|
183
193
|
workflowCode,
|
|
184
194
|
stepCode: STEP_REQUIRE_SHIM + stepCode,
|
|
@@ -358,8 +368,12 @@ export const __aaiStepCode = ${JSON.stringify(workflows.stepCode)};
|
|
|
358
368
|
*/
|
|
359
369
|
async function buildWorker(cwd, opts = {}) {
|
|
360
370
|
const wrapperPath = path.join(cwd, WRAPPER_ENTRY_REL);
|
|
361
|
-
|
|
362
|
-
|
|
371
|
+
const [, toolFiles, systemPromptFile] = await Promise.all([
|
|
372
|
+
fs.mkdir(path.dirname(wrapperPath), { recursive: true }),
|
|
373
|
+
discoverToolFiles(cwd),
|
|
374
|
+
hasSystemPromptFile(cwd)
|
|
375
|
+
]);
|
|
376
|
+
await fs.writeFile(wrapperPath, wrapperEntrySource(opts.runtime !== false, opts.workflows, toolFiles, systemPromptFile), "utf-8");
|
|
363
377
|
const plugins = [...opts.plugins ?? [], ...opts.workflows ? [workflowClientPlugin(cwd, opts.workflows.inputFiles)] : []];
|
|
364
378
|
let result;
|
|
365
379
|
try {
|
package/dist/worker-bundler.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as ok, n as fail } from "./_output-CKkmWs7i.mjs";
|
|
3
3
|
import { n as log } from "./_ui-u7T4YooX.mjs";
|
|
4
|
-
import { n as getServerInfo } from "./_agent-
|
|
4
|
+
import { n as getServerInfo } from "./_agent-DpH2pBJd.mjs";
|
|
5
5
|
import { errorMessage, omitUndefined } from "@alexkroman1/aai/utils";
|
|
6
6
|
import { createWorkflowApiClient } from "@alexkroman1/aai/workflow-api";
|
|
7
7
|
//#region workflow.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexkroman1/aai-cli",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"aai": "bin.mjs"
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"p-timeout": "^7.0.1",
|
|
45
45
|
"vite": "^8.2.1",
|
|
46
46
|
"zod": "^4.4.3",
|
|
47
|
-
"@alexkroman1/aai": "6.
|
|
48
|
-
"@alexkroman1/aai-ui": "6.
|
|
47
|
+
"@alexkroman1/aai": "6.6.0",
|
|
48
|
+
"@alexkroman1/aai-ui": "6.6.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"playwright": "^1.62.1",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"verdaccio": "^6.9.2",
|
|
54
54
|
"vitest": "^4.1.10",
|
|
55
55
|
"workflow": "4.8.2",
|
|
56
|
-
"aai-templates": "0.3.
|
|
56
|
+
"aai-templates": "0.3.6"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"vitest": "^4.1.10"
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { a as isStringArray, i as checkedResponse, n as apiRequest } from "./_api-client-LgLksMhN.mjs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { MAX_SLUG_LENGTH, PREVIEW_SLUG_SUFFIX, VALID_SLUG_RE, isRecord } from "@alexkroman1/aai/utils";
|
|
5
|
-
import { slugifyName } from "@alexkroman1/aai/slugify";
|
|
6
|
-
import { isLocalOnlyFile, snapshotWorkspaceFiles } from "@alexkroman1/aai/workspace-files";
|
|
7
|
-
//#region _studio.ts
|
|
8
|
-
/**
|
|
9
|
-
* Internals of the studio-workspace commands (`aai list/pull/push/publish`):
|
|
10
|
-
* the local source-file walk and the thin clients for the platform's
|
|
11
|
-
* `/studio/projects` routes. The workspace is the single source of truth —
|
|
12
|
-
* these helpers only move files between a local directory and the project's
|
|
13
|
-
* workspace row; production deploys happen exclusively through the studio's
|
|
14
|
-
* Publish route (which runs the deploy machinery in the project's sandbox).
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Snapshot the local project into a workspace file map.
|
|
18
|
-
*
|
|
19
|
-
* The walk, the caps, the skip rules and the strict UTF-8 decode all come
|
|
20
|
-
* from the SDK (`@alexkroman1/aai/workspace-files`), which is also what the
|
|
21
|
-
* guest's end-of-turn sync uses — the two write the same map from opposite
|
|
22
|
-
* ends, and a disagreement between them is not an error but a file silently
|
|
23
|
-
* dropped here and resurrected there.
|
|
24
|
-
*
|
|
25
|
-
* `isLocalOnlyFile` is the one rule this side adds: `.env` rides the secret
|
|
26
|
-
* routes and lockfiles are install output, so neither belongs in a row.
|
|
27
|
-
*/
|
|
28
|
-
function collectSourceFiles(dir) {
|
|
29
|
-
return snapshotWorkspaceFiles(dir, {
|
|
30
|
-
subject: "Project",
|
|
31
|
-
skipFile: isLocalOnlyFile
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* A studio project name derived from a directory name, or null if unusable.
|
|
36
|
-
*
|
|
37
|
-
* The normalization is the platform's own (`slugifyName`), not a local
|
|
38
|
-
* regex. This used to strip `[^a-z0-9-_]` by hand, which differs from the
|
|
39
|
-
* studio's slugifier on exactly the names people give agents: `Café
|
|
40
|
-
* Ordering` reduced to `caf-ordering` here and `cafe-ordering` there, so the
|
|
41
|
-
* same directory produced a different project depending on whether it was
|
|
42
|
-
* created by `aai push` or by typing the name into the studio.
|
|
43
|
-
*
|
|
44
|
-
* A `-preview` suffix is deliberately unusable. Publishing a project deploys
|
|
45
|
-
* it under the project's own name, so a `*-preview` project would claim a
|
|
46
|
-
* slug the studio's orphan-preview sweep reaps hourly — deleting the agent,
|
|
47
|
-
* its app-database schema, and its secrets on a schedule the user never
|
|
48
|
-
* asked for. Refusing the name is recoverable (rename the directory); losing
|
|
49
|
-
* a published agent to the reaper is not.
|
|
50
|
-
*/
|
|
51
|
-
function projectNameFromDir(dir) {
|
|
52
|
-
const name = slugifyName(path.basename(dir), MAX_SLUG_LENGTH);
|
|
53
|
-
if (name.endsWith(PREVIEW_SLUG_SUFFIX)) return null;
|
|
54
|
-
return VALID_SLUG_RE.test(name) ? name : null;
|
|
55
|
-
}
|
|
56
|
-
/** The shareable studio URL for a project — what every command prints. */
|
|
57
|
-
function studioProjectUrl(serverUrl, project) {
|
|
58
|
-
return `${serverUrl}/studio/chat/${project}`;
|
|
59
|
-
}
|
|
60
|
-
function listStudioProjects(serverUrl, apiKey) {
|
|
61
|
-
return apiRequest(`${serverUrl}/studio/projects`, {
|
|
62
|
-
apiKey,
|
|
63
|
-
action: "list"
|
|
64
|
-
}).then((res) => checkedResponse(res, (value) => isRecord(value) && isStringArray(value.projects), `the studio project list at ${serverUrl}`).projects);
|
|
65
|
-
}
|
|
66
|
-
/** Fetch a project, or null when it doesn't exist (the push existence probe). */
|
|
67
|
-
function fetchStudioProject(serverUrl, apiKey, project) {
|
|
68
|
-
return apiRequest(`${serverUrl}/studio/projects/${encodeURIComponent(project)}`, {
|
|
69
|
-
apiKey,
|
|
70
|
-
action: "pull",
|
|
71
|
-
allow404: true
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/** `PUT /studio/projects/:project/source` — the atomic whole-tree push. */
|
|
75
|
-
function pushStudioSource(serverUrl, apiKey, project, body) {
|
|
76
|
-
return apiRequest(`${serverUrl}/studio/projects/${encodeURIComponent(project)}/source`, {
|
|
77
|
-
apiKey,
|
|
78
|
-
action: "push",
|
|
79
|
-
method: "PUT",
|
|
80
|
-
body,
|
|
81
|
-
hints: { 409: "The studio has newer changes. Run `aai pull` to fetch them, or `aai push --force` to overwrite." }
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
/** `POST /studio/projects/:project/deploy` — Publish, in the project's sandbox. */
|
|
85
|
-
function publishStudioProject(serverUrl, apiKey, project) {
|
|
86
|
-
return apiRequest(`${serverUrl}/studio/projects/${encodeURIComponent(project)}/deploy`, {
|
|
87
|
-
apiKey,
|
|
88
|
-
action: "publish",
|
|
89
|
-
method: "POST",
|
|
90
|
-
retry: 0
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
//#endregion
|
|
94
|
-
export { publishStudioProject as a, projectNameFromDir as i, fetchStudioProject as n, pushStudioSource as o, listStudioProjects as r, studioProjectUrl as s, collectSourceFiles as t };
|