@zaip-ai/cli 7.5.0 → 7.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.
Files changed (118) hide show
  1. package/README.md +12 -20
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +2 -2
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/services/adapters.d.ts +1 -1
  6. package/dist/services/adapters.js +1 -1
  7. package/dist/services/codex-task-delivery-authority-template.d.ts.map +1 -1
  8. package/dist/services/codex-task-delivery-authority-template.js +39 -1
  9. package/dist/services/codex-task-delivery-authority-template.js.map +1 -1
  10. package/dist/services/global-codex-project-trust.d.ts +1 -1
  11. package/dist/services/global-codex-project-trust.d.ts.map +1 -1
  12. package/dist/services/global-codex-project-trust.js +46 -11
  13. package/dist/services/global-codex-project-trust.js.map +1 -1
  14. package/dist/services/global-codex-project-trust.test.js +35 -4
  15. package/dist/services/global-codex-project-trust.test.js.map +1 -1
  16. package/dist/services/install-agents-template.js +2 -2
  17. package/dist/services/install-agents-template.js.map +1 -1
  18. package/dist/services/install-target-windows.test.d.ts +2 -0
  19. package/dist/services/install-target-windows.test.d.ts.map +1 -0
  20. package/dist/services/install-target-windows.test.js +39 -0
  21. package/dist/services/install-target-windows.test.js.map +1 -0
  22. package/dist/services/install-target.d.ts +6 -0
  23. package/dist/services/install-target.d.ts.map +1 -0
  24. package/dist/services/install-target.js +89 -0
  25. package/dist/services/install-target.js.map +1 -0
  26. package/dist/services/install-target.test.d.ts +2 -0
  27. package/dist/services/install-target.test.d.ts.map +1 -0
  28. package/dist/services/install-target.test.js +47 -0
  29. package/dist/services/install-target.test.js.map +1 -0
  30. package/dist/services/logger.js +5 -3
  31. package/dist/services/logger.js.map +1 -1
  32. package/package.json +1 -1
  33. package/templates/.agents/config/agents/discovery.json +1 -1
  34. package/templates/.agents/dashboard/.zaip-managed.json +72 -32
  35. package/templates/.agents/dashboard/apps/frontend/dist/assets/{ProjectSettingsPage-BCsdQtWG.js → ProjectSettingsPage-86kLUrXm.js} +1 -1
  36. package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-BN8FwP5S.js → TraceabilityWorkspace-BZ1rH1vl.js} +1 -1
  37. package/templates/.agents/dashboard/apps/frontend/dist/assets/{index-uIVtG2ZR.js → index-C4uiRYHu.js} +2 -2
  38. package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-DFY7ZDlu.css → traceability-s5SzQnzt.css} +1 -1
  39. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-vQx9R6BQ.js +1 -0
  40. package/templates/.agents/dashboard/apps/frontend/dist/index.html +3 -3
  41. package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-fixture.mjs +117 -0
  42. package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-lab.mjs +246 -0
  43. package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-receipt.mjs +65 -0
  44. package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
  45. package/templates/.agents/dashboard/apps/frontend/src/dashboard-runtime-status.ts +5 -1
  46. package/templates/.agents/dashboard/apps/frontend/src/release-delivery.test.tsx +78 -0
  47. package/templates/.agents/dashboard/apps/frontend/src/use-runtime-status.dom.test.ts +28 -6
  48. package/templates/.agents/dashboard/apps/frontend/src/use-runtime-status.ts +18 -7
  49. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  50. package/templates/.agents/dashboard/modules/operations/package.json +1 -1
  51. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  52. package/templates/.agents/dashboard/modules/traceability/src/contracts.ts +11 -0
  53. package/templates/.agents/dashboard/modules/traceability/src/react/ReleaseDeliveryPanel.tsx +60 -0
  54. package/templates/.agents/dashboard/modules/traceability/src/react/TaskTracePanel.tsx +9 -57
  55. package/templates/.agents/dashboard/modules/traceability/src/react/release-delivery-panel.css +26 -0
  56. package/templates/.agents/dashboard/modules/traceability/src/react/trace-date-format.ts +33 -0
  57. package/templates/.agents/dashboard/modules/traceability/src/react/trace-stage-labels.ts +28 -0
  58. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  59. package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
  60. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  61. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +236 -235
  62. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +81 -81
  63. package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
  64. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +236 -235
  65. package/templates/.agents/dashboard/packages/local-runtime/src/server-release-receipt.ts +71 -0
  66. package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-release-delivery.ts +120 -0
  67. package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-routes.ts +5 -4
  68. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  69. package/templates/.agents/dashboard/stack-dependencies.json +3 -3
  70. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  71. package/templates/.agents/design/.zaip-managed.json +4 -4
  72. package/templates/.agents/design/apps/catalog/package.json +1 -1
  73. package/templates/.agents/design/design-system-maker/build.json +94 -79
  74. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  75. package/templates/.agents/requirements/autonomous-assurance.md +1 -1
  76. package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
  77. package/templates/.agents/requirements/comparative-audit.md +1 -1
  78. package/templates/.agents/requirements/context-engine.md +1 -1
  79. package/templates/.agents/requirements/cost-observability.md +1 -1
  80. package/templates/.agents/requirements/dashboard-launch.md +1 -1
  81. package/templates/.agents/requirements/data-export.md +1 -1
  82. package/templates/.agents/requirements/design-system.md +1 -1
  83. package/templates/.agents/requirements/execution-engine.md +1 -1
  84. package/templates/.agents/requirements/kanban-dashboard.md +1 -1
  85. package/templates/.agents/requirements/landing-page-forms.md +1 -1
  86. package/templates/.agents/requirements/model-orchestration.md +1 -1
  87. package/templates/.agents/requirements/public-distribution.md +1 -1
  88. package/templates/.agents/requirements/site-performance.md +1 -1
  89. package/templates/.agents/requirements/software-architecture.md +1 -1
  90. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  91. package/templates/.agents/requirements/work-lifecycle.md +1 -1
  92. package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
  93. package/templates/.agents/runtime/VERSION +1 -1
  94. package/templates/.agents/runtime/bin/historical-catalog-b6b6516200bdb412c92063e887ccef329d7c5193b5610cba5346e97c71301394.mjs +318 -0
  95. package/templates/.agents/runtime/bin/zaip.mjs +149 -109
  96. package/templates/.agents/runtime/checksums.sha256 +6 -5
  97. package/templates/.agents/runtime/manifest.json +2 -1
  98. package/templates/.agents/runtime/provenance.json +4 -4
  99. package/templates/.agents/runtime/sbom.cdx.json +1 -1
  100. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.mjs +49 -70
  101. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-idempotent-intent.test.mjs +39 -0
  102. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-next-release.mjs +57 -0
  103. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-request.mjs +15 -0
  104. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-intent.mjs +4 -1
  105. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/{chunk-A3ZCURGS.mjs → chunk-CJ5ZQF6M.mjs} +6 -6
  106. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/{chunk-ZOGCYGYB.mjs → chunk-EQTZ3Y7R.mjs} +1 -1
  107. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-FMNUSV2P.mjs +139 -0
  108. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/{chunk-7SBOEN6U.mjs → chunk-LWS3QVJO.mjs} +2 -2
  109. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/lifecycle-records.mjs +1 -1
  110. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/manifest.json +14 -13
  111. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/native-authority.mjs +1 -1
  112. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/proof.mjs +1 -1
  113. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/run-records.mjs +1 -1
  114. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-schema.mjs +1 -1
  115. package/templates/.agents/zaip-aios/VERSION +1 -1
  116. package/templates/template-manifest.json +141 -92
  117. package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-Boz50W9b.js +0 -1
  118. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-NJOFXS7P.mjs +0 -137
@@ -0,0 +1,71 @@
1
+ import { lstat, open, realpath } from "node:fs/promises";
2
+ import { resolve } from "node:path";
3
+ import { isDeepStrictEqual } from "node:util";
4
+ import {
5
+ type PostPublicationReceipt,
6
+ postPublicationAuthorization,
7
+ postPublicationIssuance,
8
+ postPublicationIssuanceId,
9
+ postPublicationReceiptPath,
10
+ } from "@zaip-ai/core";
11
+
12
+ type Fields = Record<string, unknown>;
13
+ export type PublicAttestation = { record: Fields; payload: Fields; path: string };
14
+
15
+ // Read one bounded file from the local workspace. The browser receives only the
16
+ // public decision locator. SQLite never copies the private receipt into its index.
17
+ export async function confirmsReleaseReceipt(
18
+ root: string,
19
+ issuer: PublicAttestation,
20
+ human: PublicAttestation,
21
+ ) {
22
+ const digest = issuer.payload.receipt_sha256;
23
+ if (typeof digest !== "string" || !/^[a-f0-9]{64}$/.test(digest)) return false;
24
+ const relative = `.agents/private/state/recovery/post-publication/${digest}.json`;
25
+ const target = resolve(await realpath(root), relative);
26
+ try {
27
+ if ((await realpath(target)) !== target) return false;
28
+ const original = await lstat(target);
29
+ if (!original.isFile() || original.nlink !== 1) return false;
30
+ const handle = await open(target, "r");
31
+ try {
32
+ const info = await handle.stat();
33
+ if (
34
+ info.ino !== original.ino ||
35
+ info.dev !== original.dev ||
36
+ !info.isFile() ||
37
+ info.nlink !== 1 ||
38
+ info.size < 2 ||
39
+ info.size > 2 * 1024 * 1024
40
+ )
41
+ return false;
42
+ const bytes = Buffer.alloc(info.size);
43
+ let offset = 0;
44
+ while (offset < bytes.length) {
45
+ const { bytesRead } = await handle.read(bytes, offset, bytes.length - offset, offset);
46
+ if (!bytesRead) return false;
47
+ offset += bytesRead;
48
+ }
49
+ const source = bytes.toString("utf8");
50
+ const receipt = JSON.parse(source) as PostPublicationReceipt;
51
+ if (source !== JSON.stringify(receipt) + "\n") return false;
52
+ const { issuance_decision_id, ...base } = receipt;
53
+ return (
54
+ [1, 2, 3].includes(receipt.schema_version) &&
55
+ receipt.kind === "post_publication_closure" &&
56
+ typeof human.record.confirmed_at === "string" &&
57
+ Number.isFinite(Date.parse(human.record.confirmed_at)) &&
58
+ postPublicationReceiptPath(receipt) === relative &&
59
+ postPublicationIssuanceId(base) === issuance_decision_id &&
60
+ issuer.record.id === issuance_decision_id &&
61
+ human.record.id === receipt.human_decision_id &&
62
+ isDeepStrictEqual(issuer.payload, JSON.parse(postPublicationIssuance(receipt))) &&
63
+ isDeepStrictEqual(human.payload, postPublicationAuthorization(receipt))
64
+ );
65
+ } finally {
66
+ await handle.close();
67
+ }
68
+ } catch {
69
+ return false;
70
+ }
71
+ }
@@ -0,0 +1,120 @@
1
+ import {
2
+ parseYaml,
3
+ resolveArtifactReadPath,
4
+ type WorkspaceFileSystem,
5
+ type WorkspaceLayout,
6
+ } from "@zaip-ai/core";
7
+ import type {
8
+ ReleaseDeliveryProjection,
9
+ TaskTrace,
10
+ } from "@zaip-ai/dashboard-traceability/contracts";
11
+ import { confirmsReleaseReceipt, type PublicAttestation } from "./server-release-receipt.js";
12
+
13
+ type Fields = Record<string, unknown>;
14
+ const fields = (value: unknown): Fields =>
15
+ value !== null && typeof value === "object" && !Array.isArray(value) ? (value as Fields) : {};
16
+
17
+ function metadata(content: string): Fields {
18
+ const front = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(content);
19
+ return front ? fields(parseYaml(front[1]!)) : {};
20
+ }
21
+
22
+ // Project the public attestation produced by the verified closure workflow. No private
23
+ // receipt contents or provider credentials belong in the dashboard's SQLite database.
24
+ export async function traceReleaseDelivery(
25
+ filesystem: WorkspaceFileSystem,
26
+ layout: WorkspaceLayout,
27
+ trace: TaskTrace,
28
+ ): Promise<ReleaseDeliveryProjection | undefined> {
29
+ const attestations = trace.documents.flatMap((doc) => {
30
+ if (!/\/decisions\/DEC-(?:AI-POSTPUB-|HUMAN-)[A-Z0-9-]+\.md$/.test(doc.path)) return [];
31
+ try {
32
+ const record = metadata(doc.content);
33
+ if (
34
+ typeof record.decision !== "string" ||
35
+ record.category !== "contract" ||
36
+ record.scope_type !== "change" ||
37
+ !doc.path.endsWith(`/${record.scope_id}/decisions/${record.id}.md`)
38
+ )
39
+ return [];
40
+ const payload = fields(JSON.parse(record.decision));
41
+ return payload.target_task_id === trace.task_id ? [{ record, payload, path: doc.path }] : [];
42
+ } catch {
43
+ return [];
44
+ }
45
+ });
46
+ const human = attestations.filter(
47
+ ({ record, payload }) =>
48
+ record.origin === "human" &&
49
+ String(record.id).startsWith("DEC-HUMAN-") &&
50
+ payload.target_change_id === trace.change_id &&
51
+ typeof payload.published_sha === "string" &&
52
+ /^[a-f0-9]{40}$/.test(payload.published_sha) &&
53
+ /^sha512-[A-Za-z0-9+/]{86}==$/.test(String(payload.npm_integrity)),
54
+ );
55
+ const issued = attestations.filter(
56
+ ({ record, payload }) =>
57
+ record.origin === "agent" &&
58
+ /^DEC-AI-POSTPUB-[0-9A-F]{24}$/.test(String(record.id)) &&
59
+ payload.kind === "post_publication_closure",
60
+ );
61
+ if (!issued.length && !human.length) return;
62
+
63
+ const readRecord = async (kind: "task" | "change" | "execution", id: string) => {
64
+ const path = await resolveArtifactReadPath(filesystem, layout, kind, id);
65
+ if (!path) return {};
66
+ const result = metadata(await filesystem.readText(path));
67
+ return result.id === id ? result : {};
68
+ };
69
+ const task = await readRecord("task", trace.task_id);
70
+ const executionId = fields(task.plan_ref).execution_id;
71
+ const matching = human.filter(
72
+ ({ payload }) =>
73
+ payload.target_execution_id === executionId &&
74
+ payload.target_release === task.target_release &&
75
+ task.change_id === trace.change_id,
76
+ );
77
+ let proof: PublicAttestation | undefined;
78
+ for (const issuer of issued) {
79
+ if (issuer.payload.target_execution_id !== executionId) continue;
80
+ for (const auth of matching) {
81
+ if (
82
+ auth.record.scope_id === issuer.record.scope_id &&
83
+ (await confirmsReleaseReceipt(filesystem.root, issuer, auth))
84
+ ) {
85
+ proof = issuer;
86
+ break;
87
+ }
88
+ }
89
+ if (proof) break;
90
+ }
91
+ const change = await readRecord("change", trace.change_id);
92
+ const execution =
93
+ typeof executionId === "string" && /^EXEC-[A-Z0-9-]+$/.test(executionId)
94
+ ? await readRecord("execution", executionId)
95
+ : {};
96
+ const status = (record: Fields) => (typeof record.status === "string" ? record.status : null);
97
+ const pending = [
98
+ ["Task", task],
99
+ ["Change", change],
100
+ ["Execution", execution],
101
+ ] as const;
102
+ const next = pending.find(([, record]) => status(record) !== "completed");
103
+ return {
104
+ publication: proof ? "verified" : "unverified",
105
+ receipt_path: proof?.path ?? null,
106
+ task_status: status(task) ?? "unknown",
107
+ change_status: status(change),
108
+ execution_status: status(execution),
109
+ blocker: !proof
110
+ ? "Falta a confirmação de publicação vinculada a esta Task."
111
+ : next
112
+ ? `${next[0]} · ${status(next[1]) ?? "registro ausente"}`
113
+ : null,
114
+ next_action: !proof
115
+ ? "Confira a decisão de emissão e o vínculo com o recibo da publicação."
116
+ : next
117
+ ? `Retome o fechamento de ${next[0]} no ZAIP usando a prova indicada.`
118
+ : null,
119
+ };
120
+ }
@@ -8,6 +8,7 @@ import type { Hono } from "hono";
8
8
  import { API_PREFIX, headOrJson, V2WorkspaceRequiredError } from "./server-http-contracts.js";
9
9
  import type { DashboardRouteContext } from "./server-route-context.js";
10
10
  import { buildSqliteTaskTrace } from "./server-sqlite-task-trace.js";
11
+ import { traceReleaseDelivery } from "./server-trace-release-delivery.js";
11
12
  import { SqliteReadModelFileSystem } from "./sqlite-read-model.js";
12
13
  export function registerTraceRoutes(app: Hono, dependencies: DashboardRouteContext) {
13
14
  const { filesystem, readLayout } = dependencies;
@@ -42,12 +43,12 @@ export function registerTraceRoutes(app: Hono, dependencies: DashboardRouteConte
42
43
  try {
43
44
  const layout = await readLayout();
44
45
  const taskId = context.req.param("id");
45
- return headOrJson(
46
- context,
46
+ const trace =
47
47
  filesystem instanceof SqliteReadModelFileSystem
48
48
  ? await buildSqliteTaskTrace(filesystem, layout, taskId)
49
- : await buildTaskTrace(filesystem, layout, taskId),
50
- );
49
+ : await buildTaskTrace(filesystem, layout, taskId);
50
+ const delivery = await traceReleaseDelivery(filesystem, layout, trace);
51
+ return headOrJson(context, delivery ? { ...trace, release_delivery: delivery } : trace);
51
52
  } catch (error) {
52
53
  if (error instanceof V2WorkspaceRequiredError) throw error;
53
54
  return headOrJson(context, { error: "Task trace not found" }, 404);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaip-ai/dashboard-ui",
3
- "version": "7.5.0",
3
+ "version": "7.6.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -3,11 +3,11 @@
3
3
  "node": "22.16.0",
4
4
  "packages": [
5
5
  { "name": "typescript", "version": "7.0.2", "development": true },
6
- { "name": "vite", "version": "8.1.4", "development": true },
7
- { "name": "astro", "version": "7.2.4", "development": true },
6
+ { "name": "vite", "version": "8.1.6", "development": true },
7
+ { "name": "astro", "version": "7.2.8", "development": true },
8
8
  { "name": "redis", "version": "6.2.1", "development": false },
9
9
  { "name": "bullmq", "version": "6.2.0", "development": false },
10
- { "name": "hono", "version": "4.12.34", "development": false },
10
+ { "name": "hono", "version": "4.13.11", "development": false },
11
11
  { "name": "react", "version": "19.2.7", "development": false },
12
12
  { "name": "react-dom", "version": "19.2.7", "development": false }
13
13
  ]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaip-ai/dashboard-e2e",
3
- "version": "7.5.0",
3
+ "version": "7.6.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "version": "7.5.0",
3
+ "version": "7.6.0",
4
4
  "files": [
5
5
  {
6
6
  "path": "DESIGN.md",
@@ -344,7 +344,7 @@
344
344
  },
345
345
  {
346
346
  "path": "apps/catalog/package.json",
347
- "sha256": "f66897db33f87b773d8b4ea90f2f2a8768901c93c0cdfa10669db07c9f48a9b8"
347
+ "sha256": "f32827d0c7e1d17419abec5a1ebd5567dc31e416c44fbcf62dab716ae6db3214"
348
348
  },
349
349
  {
350
350
  "path": "apps/catalog/public/logo_novo_azul.png",
@@ -532,7 +532,7 @@
532
532
  },
533
533
  {
534
534
  "path": "design-system-maker/build.json",
535
- "sha256": "72f11f8707328b968c9a4612949f2bbf71cf7a841cb964700560e8ea15d67dda"
535
+ "sha256": "946d4d9573678a60ba6a1dee670f37fedce17a0ff3940478ddbc5fc8befc2fee"
536
536
  },
537
537
  {
538
538
  "path": "design-system-maker/frontend/ADAPTATION.md",
@@ -860,7 +860,7 @@
860
860
  },
861
861
  {
862
862
  "path": "packages/local-runtime/package.json",
863
- "sha256": "516bb71c6c8d76780bf28a8b04895fc74c936487db9afe784924f767103dfc81"
863
+ "sha256": "4f790abb693907fa022cf3bac506dcdf7c2201dbc4b95c90da31125538738e00"
864
864
  },
865
865
  {
866
866
  "path": "packages/local-runtime/runtime.mjs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaip-ai/design-catalog",
3
- "version": "7.5.0",
3
+ "version": "7.6.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {