@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.
Files changed (36) hide show
  1. package/dist/services/install-agents-template.d.ts.map +1 -1
  2. package/dist/services/install-agents-template.js +9 -0
  3. package/dist/services/install-agents-template.js.map +1 -1
  4. package/package.json +1 -1
  5. package/templates/.agents/architecture/software-architecture.md +61 -0
  6. package/templates/.agents/dashboard/.zaip-managed.json +12 -4
  7. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +183 -183
  8. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +2 -2
  9. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +183 -183
  10. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-runtime-selection.mjs +36 -0
  11. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-runtime-selection.test.mjs +63 -0
  12. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +31 -28
  13. package/templates/.agents/requirements/autonomous-assurance.md +1 -1
  14. package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
  15. package/templates/.agents/requirements/comparative-audit.md +1 -1
  16. package/templates/.agents/requirements/context-engine.md +1 -1
  17. package/templates/.agents/requirements/cost-observability.md +1 -1
  18. package/templates/.agents/requirements/dashboard-launch.md +1 -1
  19. package/templates/.agents/requirements/data-export.md +1 -1
  20. package/templates/.agents/requirements/design-system.md +1 -1
  21. package/templates/.agents/requirements/execution-engine.md +1 -1
  22. package/templates/.agents/requirements/kanban-dashboard.md +1 -1
  23. package/templates/.agents/requirements/model-orchestration.md +1 -1
  24. package/templates/.agents/requirements/public-distribution.md +1 -1
  25. package/templates/.agents/requirements/software-architecture.md +1 -1
  26. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  27. package/templates/.agents/requirements/work-lifecycle.md +1 -1
  28. package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
  29. package/templates/.agents/runtime/bin/zaip.mjs +42 -35
  30. package/templates/.agents/runtime/checksums.sha256 +2 -2
  31. package/templates/.agents/runtime/provenance.json +2 -2
  32. package/templates/.agents/skills/zaip-skill-execution/SKILL.md +1 -1
  33. package/templates/.agents/skills/zaip-skill-execution/references/candidate-workflow.md +23 -0
  34. package/templates/.agents/skills/zaip-skill-task/SKILL.md +1 -0
  35. package/templates/template-manifest.json +44 -32
  36. package/templates/.agents/architecture/.gitkeep +0 -0
@@ -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
- // npm consumers receive a ready-to-run server and frontend bundle. They do
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
- if (
567
- await Promise.all(packagedArtifacts.map((path) => exists(path))).then((entries) =>
568
- entries.every(Boolean),
569
- )
570
- ) {
571
- buildProgress(
572
- onProgress,
573
- 39,
574
- "Usando runtime empacotado",
575
- "O pacote npm já inclui o dashboard pronto; nenhuma instalação de desenvolvimento é necessária.",
576
- );
577
- const signature = await Promise.all(
578
- [...packagedArtifacts, resolve(packageRoot, "start-dashboard.mjs")].map(async (path) => {
579
- const details = await stat(path);
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",
@@ -6,7 +6,7 @@ title: Garantia adaptativa e execução autônoma
6
6
  status: active
7
7
  version: 3
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Garantia adaptativa e execução autônoma
@@ -6,7 +6,7 @@ title: Autonomia delimitada para Cloudflare e Hostinger
6
6
  status: proposed
7
7
  version: 1
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Cloudflare e Hostinger (proposta de requisito)
@@ -6,7 +6,7 @@ title: Auditoria comparativa e plano de evolução
6
6
  status: active
7
7
  version: 1
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Auditoria comparativa e plano de evolução
@@ -6,7 +6,7 @@ title: Contexto mínimo, seguro e navegável
6
6
  status: active
7
7
  version: 8
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Context engine
@@ -6,7 +6,7 @@ title: Tokens, custos e cobertura
6
6
  status: active
7
7
  version: 10
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Cost observability
@@ -6,7 +6,7 @@ title: Inicialização e hidratação confiável do dashboard
6
6
  status: active
7
7
  version: 1
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Inicialização e hidratação confiável do dashboard
@@ -6,7 +6,7 @@ title: Exportação contextual de dados para Excel
6
6
  status: proposed
7
7
  version: 2
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Exportação contextual de dados
@@ -6,7 +6,7 @@ title: Contrato visual e catálogo executável
6
6
  status: active
7
7
  version: 3
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Design system
@@ -6,7 +6,7 @@ title: Preparação, materialização e DAG
6
6
  status: active
7
7
  version: 11
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Execution engine
@@ -6,7 +6,7 @@ title: Projeções operacionais e analíticas
6
6
  status: active
7
7
  version: 14
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Kanban and dashboard
@@ -6,7 +6,7 @@ title: Seleção automática e observável de modelo e effort
6
6
  status: active
7
7
  version: 7
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Orquestração de modelos
@@ -6,7 +6,7 @@ title: Distribuição pública e ativação
6
6
  status: active
7
7
  version: 3
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Distribuição pública e ativação
@@ -6,7 +6,7 @@ title: Layout modular e limites de código-fonte
6
6
  status: active
7
7
  version: 5
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Software architecture
@@ -6,7 +6,7 @@ title: Melhorias estratégicas de custo, qualidade e resiliência
6
6
  status: active
7
7
  version: 1
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Melhorias estratégicas de custo, qualidade e resiliência
@@ -6,7 +6,7 @@ title: Ciclo de vida do trabalho
6
6
  status: active
7
7
  version: 24
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Work lifecycle
@@ -6,7 +6,7 @@ title: Evidências, custo por Task e autonomia por SPEC
6
6
  status: active
7
7
  version: 1
8
8
  source_change: null
9
- source_release: "1.4.1"
9
+ source_release: "1.4.3"
10
10
  ---
11
11
 
12
12
  # Evidências, custo por Task e autonomia por SPEC