@zaip-ai/cli 1.4.1 → 1.4.3
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/services/install-agents-template.d.ts.map +1 -1
- package/dist/services/install-agents-template.js +9 -0
- package/dist/services/install-agents-template.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/architecture/software-architecture.md +61 -0
- package/templates/.agents/dashboard/.zaip-managed.json +12 -4
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +183 -183
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +2 -2
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +183 -183
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-runtime-selection.mjs +36 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-runtime-selection.test.mjs +63 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +31 -28
- package/templates/.agents/requirements/autonomous-assurance.md +1 -1
- package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
- package/templates/.agents/requirements/comparative-audit.md +1 -1
- package/templates/.agents/requirements/context-engine.md +1 -1
- package/templates/.agents/requirements/cost-observability.md +1 -1
- package/templates/.agents/requirements/dashboard-launch.md +1 -1
- package/templates/.agents/requirements/data-export.md +1 -1
- package/templates/.agents/requirements/design-system.md +1 -1
- package/templates/.agents/requirements/execution-engine.md +1 -1
- package/templates/.agents/requirements/kanban-dashboard.md +1 -1
- package/templates/.agents/requirements/model-orchestration.md +1 -1
- package/templates/.agents/requirements/public-distribution.md +1 -1
- package/templates/.agents/requirements/software-architecture.md +1 -1
- package/templates/.agents/requirements/strategic-improvements.md +1 -1
- package/templates/.agents/requirements/work-lifecycle.md +1 -1
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/runtime/bin/zaip.mjs +42 -35
- package/templates/.agents/runtime/checksums.sha256 +2 -2
- package/templates/.agents/runtime/provenance.json +2 -2
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-execution/references/candidate-workflow.md +23 -0
- package/templates/.agents/skills/zaip-skill-task/SKILL.md +1 -0
- package/templates/template-manifest.json +44 -32
- package/templates/.agents/architecture/.gitkeep +0 -0
package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-runtime-selection.mjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { readFile, stat } from "node:fs/promises";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
|
|
4
|
+
async function exists(path) {
|
|
5
|
+
return stat(path).then(
|
|
6
|
+
() => true,
|
|
7
|
+
() => false,
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function isDashboardSourceWorkspace(root) {
|
|
12
|
+
if (!(await exists(resolve(root, "pnpm-workspace.yaml")))) return false;
|
|
13
|
+
try {
|
|
14
|
+
return (
|
|
15
|
+
JSON.parse(await readFile(resolve(root, "package.json"), "utf8"))?.name === "@zaip-ai/aios"
|
|
16
|
+
);
|
|
17
|
+
} catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function dashboardServerPathForWorkspace({ root, sourcePath, installedPath }) {
|
|
23
|
+
return (await isDashboardSourceWorkspace(root)) && (await exists(sourcePath))
|
|
24
|
+
? sourcePath
|
|
25
|
+
: installedPath;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function assertInstalledDashboardArtifacts(paths) {
|
|
29
|
+
const missing = (
|
|
30
|
+
await Promise.all(paths.map(async (path) => ((await exists(path)) ? null : path)))
|
|
31
|
+
).filter(Boolean);
|
|
32
|
+
if (missing.length > 0)
|
|
33
|
+
throw new Error(
|
|
34
|
+
"Dashboard package artifacts are missing; reinstall ZAIP-AIOS to restore the bundled dashboard.",
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
5
|
+
import { dashboardServerPathForWorkspace, isDashboardSourceWorkspace } from "./start-dashboard.mjs";
|
|
6
|
+
import { assertInstalledDashboardArtifacts } from "./start-dashboard-runtime-selection.mjs";
|
|
7
|
+
|
|
8
|
+
const roots = [];
|
|
9
|
+
|
|
10
|
+
afterEach(async () => {
|
|
11
|
+
await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe("installed dashboard runtime selection", () => {
|
|
15
|
+
it("uses the installed runtime for a consumer with partial build tooling", async () => {
|
|
16
|
+
const root = await mkdtemp(join(tmpdir(), "zaip-dashboard-consumer-"));
|
|
17
|
+
roots.push(root);
|
|
18
|
+
const sourcePath = join(root, ".agents/dashboard/packages/local-runtime/dist/server.cjs");
|
|
19
|
+
const installedPath = join(root, ".agents/dashboard/packages/local-runtime/server.mjs");
|
|
20
|
+
await Promise.all([
|
|
21
|
+
mkdir(join(root, ".agents/dashboard/apps/frontend/dist"), { recursive: true }),
|
|
22
|
+
mkdir(join(root, ".agents/dashboard/packages/local-runtime/dist"), { recursive: true }),
|
|
23
|
+
]);
|
|
24
|
+
await Promise.all([
|
|
25
|
+
mkdir(join(root, "node_modules/esbuild"), { recursive: true }),
|
|
26
|
+
mkdir(join(root, "node_modules/vite"), { recursive: true }),
|
|
27
|
+
writeFile(join(root, "package.json"), '{"name":"consumer-project"}\n'),
|
|
28
|
+
writeFile(join(root, "pnpm-workspace.yaml"), "packages: []\n"),
|
|
29
|
+
writeFile(join(root, ".agents/dashboard/apps/frontend/dist/index.html"), "bundle\n"),
|
|
30
|
+
writeFile(sourcePath, "source\n"),
|
|
31
|
+
writeFile(installedPath, "installed\n"),
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
expect(await isDashboardSourceWorkspace(root)).toBe(false);
|
|
35
|
+
await expect(
|
|
36
|
+
dashboardServerPathForWorkspace({ root, sourcePath, installedPath }),
|
|
37
|
+
).resolves.toBe(installedPath);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("selects source only for the explicit ZAIP workspace identity", async () => {
|
|
41
|
+
const root = await mkdtemp(join(tmpdir(), "zaip-dashboard-source-"));
|
|
42
|
+
roots.push(root);
|
|
43
|
+
const sourcePath = join(root, "server.cjs");
|
|
44
|
+
const installedPath = join(root, "server.mjs");
|
|
45
|
+
await Promise.all([
|
|
46
|
+
writeFile(join(root, "package.json"), '{"name":"@zaip-ai/aios"}\n'),
|
|
47
|
+
writeFile(join(root, "pnpm-workspace.yaml"), "packages: []\n"),
|
|
48
|
+
writeFile(sourcePath, "source\n"),
|
|
49
|
+
writeFile(installedPath, "installed\n"),
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
expect(await isDashboardSourceWorkspace(root)).toBe(true);
|
|
53
|
+
await expect(
|
|
54
|
+
dashboardServerPathForWorkspace({ root, sourcePath, installedPath }),
|
|
55
|
+
).resolves.toBe(sourcePath);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("rejects an incomplete consumer bundle without attempting a source build", async () => {
|
|
59
|
+
await expect(
|
|
60
|
+
assertInstalledDashboardArtifacts(["missing-server.mjs", "missing-index.html"]),
|
|
61
|
+
).rejects.toThrow("reinstall ZAIP-AIOS");
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -22,6 +22,11 @@ import {
|
|
|
22
22
|
stopProcessTree,
|
|
23
23
|
teardownWarning,
|
|
24
24
|
} from "./start-dashboard-processes.mjs";
|
|
25
|
+
import {
|
|
26
|
+
assertInstalledDashboardArtifacts,
|
|
27
|
+
isDashboardSourceWorkspace as hasDashboardSourceWorkspace,
|
|
28
|
+
dashboardServerPathForWorkspace as selectDashboardServerPath,
|
|
29
|
+
} from "./start-dashboard-runtime-selection.mjs";
|
|
25
30
|
import {
|
|
26
31
|
isPortFree,
|
|
27
32
|
startDashboardServer as launchDashboardServer,
|
|
@@ -557,31 +562,22 @@ export async function refreshDashboardBuildTargets({
|
|
|
557
562
|
return { artifacts: Object.values(targets).flatMap((target) => target.artifacts), builtTargets };
|
|
558
563
|
}
|
|
559
564
|
async function ensureFreshDashboardBuild(onProgress = () => {}) {
|
|
560
|
-
|
|
561
|
-
// not receive development-only esbuild, so never turn the first dashboard
|
|
562
|
-
// click into a pnpm-install requirement when that packaged runtime exists.
|
|
563
|
-
const buildTool = resolve(workspaceRoot, "node_modules/esbuild");
|
|
564
|
-
if (!(await exists(buildTool))) {
|
|
565
|
+
if (!(await hasDashboardSourceWorkspace(workspaceRoot))) {
|
|
565
566
|
const packagedArtifacts = [installedServer, resolve(frontendRoot, "index.html")];
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
return `${path}:${details.size}:${details.mtimeMs}`;
|
|
581
|
-
}),
|
|
582
|
-
);
|
|
583
|
-
return createHash("sha256").update(signature.join("|")).digest("hex");
|
|
584
|
-
}
|
|
567
|
+
await assertInstalledDashboardArtifacts(packagedArtifacts);
|
|
568
|
+
buildProgress(
|
|
569
|
+
onProgress,
|
|
570
|
+
39,
|
|
571
|
+
"Usando runtime empacotado",
|
|
572
|
+
"O pacote npm já inclui o dashboard pronto; nenhuma instalação de desenvolvimento é necessária.",
|
|
573
|
+
);
|
|
574
|
+
const signature = await Promise.all(
|
|
575
|
+
[...packagedArtifacts, resolve(packageRoot, "start-dashboard.mjs")].map(async (path) => {
|
|
576
|
+
const details = await stat(path);
|
|
577
|
+
return `${path}:${details.size}:${details.mtimeMs}`;
|
|
578
|
+
}),
|
|
579
|
+
);
|
|
580
|
+
return createHash("sha256").update(signature.join("|")).digest("hex");
|
|
585
581
|
}
|
|
586
582
|
const { artifacts } = await refreshDashboardBuildTargets({ onProgress });
|
|
587
583
|
const artifactFingerprint = await Promise.all(
|
|
@@ -592,6 +588,16 @@ async function ensureFreshDashboardBuild(onProgress = () => {}) {
|
|
|
592
588
|
);
|
|
593
589
|
return createHash("sha256").update(artifactFingerprint.join("|")).digest("hex");
|
|
594
590
|
}
|
|
591
|
+
export async function isDashboardSourceWorkspace(root = workspaceRoot) {
|
|
592
|
+
return hasDashboardSourceWorkspace(root);
|
|
593
|
+
}
|
|
594
|
+
export async function dashboardServerPathForWorkspace({
|
|
595
|
+
root = workspaceRoot,
|
|
596
|
+
sourcePath = sourceServer,
|
|
597
|
+
installedPath = installedServer,
|
|
598
|
+
} = {}) {
|
|
599
|
+
return selectDashboardServerPath({ root, sourcePath, installedPath });
|
|
600
|
+
}
|
|
595
601
|
export async function withLauncherLock(
|
|
596
602
|
action,
|
|
597
603
|
{
|
|
@@ -766,10 +772,7 @@ async function redirectLaunchPage(launchPage, target) {
|
|
|
766
772
|
launchPage.closeAfterHandoffGrace();
|
|
767
773
|
}
|
|
768
774
|
async function assertRuntimeReady() {
|
|
769
|
-
const serverPath =
|
|
770
|
-
(await exists(resolve(workspaceRoot, "node_modules/esbuild"))) && (await exists(sourceServer))
|
|
771
|
-
? sourceServer
|
|
772
|
-
: installedServer;
|
|
775
|
+
const serverPath = await dashboardServerPathForWorkspace();
|
|
773
776
|
if (!(await exists(serverPath))) {
|
|
774
777
|
throw new Error(
|
|
775
778
|
"Dashboard server bundle is missing; run the ZAIP release build or reinstall ZAIP-AIOS",
|