@zaip-ai/cli 4.6.0 → 4.7.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/commands/init.js +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/services/adapters.d.ts +1 -1
- package/dist/services/adapters.d.ts.map +1 -1
- package/dist/services/adapters.js +3 -3
- package/dist/services/adapters.js.map +1 -1
- package/dist/services/codex-config-overlay.d.ts.map +1 -1
- package/dist/services/codex-config-overlay.js +27 -10
- package/dist/services/codex-config-overlay.js.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.test.js +1 -1
- package/dist/services/codex-pre-tool-hook-template.test.js.map +1 -1
- package/dist/services/global-codex-config.d.ts.map +1 -1
- package/dist/services/global-codex-config.js +2 -1
- package/dist/services/global-codex-config.js.map +1 -1
- package/dist/services/global-codex-config.test.js +3 -1
- package/dist/services/global-codex-config.test.js.map +1 -1
- package/dist/services/hook-readiness.d.ts.map +1 -1
- package/dist/services/hook-readiness.js.map +1 -1
- package/dist/services/install-agents-template.js +2 -2
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/logger.d.ts +1 -1
- package/dist/services/logger.d.ts.map +1 -1
- package/dist/services/logger.js.map +1 -1
- package/dist/services/logger.test.js +9 -3
- package/dist/services/logger.test.js.map +1 -1
- package/dist/services/runtime-template-integrity.test.d.ts +2 -0
- package/dist/services/runtime-template-integrity.test.d.ts.map +1 -0
- package/dist/services/runtime-template-integrity.test.js +26 -0
- package/dist/services/runtime-template-integrity.test.js.map +1 -0
- package/dist/services/runtime-template-test-support.d.ts.map +1 -1
- package/dist/services/runtime-template-test-support.js.map +1 -1
- package/dist/services/runtime-template.test.js +18 -21
- package/dist/services/runtime-template.test.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/config/agents/discovery.json +1 -1
- package/templates/.agents/dashboard/.zaip-managed.json +62 -46
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-BRtiPijr.js → CostCalculationGuidePage-OUjdwEcM.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-BR4ZeYpE.js → DashboardHelpDialog-Cei1ChjE.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-Dr4QDFmn.js → PricingSettingsDialog-_woNCrTT.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{ProjectSettingsPage-BG0N5dw_.js → ProjectSettingsPage-B2_7MVOP.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-BvoM-YQ0.js → TraceabilityWorkspace-C_jCsSZe.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{cost-monitor-fTQhSL85.js → cost-monitor-C8zQDBT7.js} +2 -2
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-Bc6vux5t.js → icons-vendor-iMPXot7Y.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{index-BMfzKaAR.js → index-DiCwz0sr.js} +2 -2
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-DNJQFov3.js → react-vendor-721Re3Ss.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-B7tjIB7W.js → traceability-BjdTkWS0.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +5 -5
- package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.macro-metrics.test.ts +7 -2
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +6 -6
- package/templates/.agents/dashboard/modules/operations/src/react/overview-duration-hint.ts +14 -0
- package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
- package/templates/.agents/dashboard/packages/branding/package.json +1 -1
- package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
- package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +238 -171
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +227 -160
- package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +240 -173
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-summary-elapsed.ts +107 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-summary.ts +41 -54
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-canonical.ts +7 -7
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-counts-every-root-execution-day-returns.test.ts +5 -5
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-multi-provider.test.ts +4 -4
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-schema.ts +3 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-base-views.ts +9 -7
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-dashboard-views.ts +10 -8
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-spec-root-elapsed-view.ts +61 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-spec-root-elapsed.test.ts +210 -0
- package/templates/.agents/dashboard/packages/ui/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
- package/templates/.agents/design/.zaip-managed.json +3 -3
- package/templates/.agents/design/apps/catalog/package.json +1 -1
- package/templates/.agents/design/packages/local-runtime/package.json +1 -1
- 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/VERSION +1 -1
- package/templates/.agents/runtime/bin/zaip.mjs +9 -10
- package/templates/.agents/runtime/checksums.sha256 +5 -5
- package/templates/.agents/runtime/manifest.json +1 -1
- package/templates/.agents/runtime/provenance.json +4 -4
- package/templates/.agents/runtime/sbom.cdx.json +1 -1
- package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.mjs +6 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.test.mjs +3 -0
- package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-release-qualification/references/local-preparation.md +9 -0
- package/templates/.agents/zaip-aios/VERSION +1 -1
- package/templates/template-manifest.json +96 -80
package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-spec-root-elapsed.test.ts
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { mkdir, mkdtemp, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { DatabaseSync } from "node:sqlite";
|
|
4
|
+
import { afterEach, expect, it } from "vitest";
|
|
5
|
+
import { rebuildSqliteReadModel, SqliteReadModelFileSystem } from "./sqlite-read-model.js";
|
|
6
|
+
|
|
7
|
+
const roots: string[] = [];
|
|
8
|
+
afterEach(async () => {
|
|
9
|
+
await Promise.all(
|
|
10
|
+
roots
|
|
11
|
+
.splice(0)
|
|
12
|
+
.map((root) =>
|
|
13
|
+
import("node:fs/promises").then(({ rm }) => rm(root, { recursive: true, force: true })),
|
|
14
|
+
),
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("shows a 21-hour source-observed SPEC root and splits Cost elapsed without child double counting", async () => {
|
|
19
|
+
const temp = resolve(import.meta.dirname, "../../../../../..", ".tmp", "sqlite-read-model-tests");
|
|
20
|
+
await mkdir(temp, { recursive: true });
|
|
21
|
+
const root = await mkdtemp(join(temp, "spec-elapsed-"));
|
|
22
|
+
roots.push(root);
|
|
23
|
+
const records = join(root, ".agents", "records");
|
|
24
|
+
await mkdir(join(records, "runs", "2026", "09"), { recursive: true });
|
|
25
|
+
await mkdir(join(records, "specs", "2026", "09"), { recursive: true });
|
|
26
|
+
await mkdir(join(root, ".agents", "config"), { recursive: true });
|
|
27
|
+
await writeFile(join(root, ".agents", "config", "project.yaml"), "zaip:\n enabled: true\n");
|
|
28
|
+
for (const id of ["SPEC-ROOT", "SPEC-CHILD"])
|
|
29
|
+
await writeFile(
|
|
30
|
+
join(records, "specs", "2026", "09", `${id}.md`),
|
|
31
|
+
`---\nid: ${id}\ntitle: ${id}\nstatus: active\nrisk: standard\ncreated_at: 2026-09-30T22:00:00.000Z\n---\n# ${id}\n`,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const sourceStart = "2026-09-30T22:41:41.072Z";
|
|
35
|
+
const sourceEnd = "2026-10-01T19:55:46.569Z";
|
|
36
|
+
const run = (id: string, specId: string, start: string, end: string, parent: string | null) => {
|
|
37
|
+
const invocation = `AINV-${id}`;
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
schema_version: 2,
|
|
41
|
+
event_id: `${id}:1`,
|
|
42
|
+
run_id: id,
|
|
43
|
+
sequence: 1,
|
|
44
|
+
occurred_at: start,
|
|
45
|
+
type: "run.started",
|
|
46
|
+
attribution_status: "attributed",
|
|
47
|
+
phase: "execution",
|
|
48
|
+
run_role: parent === null ? "orchestrator" : "subagent",
|
|
49
|
+
run_purpose: "execution",
|
|
50
|
+
requires_finalizer: false,
|
|
51
|
+
execution_kind: "delivery",
|
|
52
|
+
execution_eligibility: ["delivery"],
|
|
53
|
+
entrypoint: "spec",
|
|
54
|
+
work_type: "new",
|
|
55
|
+
storage_mode: "tracked_sanitized",
|
|
56
|
+
client: "codex",
|
|
57
|
+
agent: "agent",
|
|
58
|
+
agent_name: "agent",
|
|
59
|
+
provider: "openai",
|
|
60
|
+
model: "gpt-6-sol",
|
|
61
|
+
reasoning_effort: null,
|
|
62
|
+
client_thread_id: `thread-${id}`,
|
|
63
|
+
client_turn_id: `turn-${id}`,
|
|
64
|
+
conversation_id: "CONV-SPEC",
|
|
65
|
+
execution_id: "EXEC-SPEC",
|
|
66
|
+
task_id: null,
|
|
67
|
+
spec_id: specId,
|
|
68
|
+
prd_id: null,
|
|
69
|
+
change_id: null,
|
|
70
|
+
parent_run_id: parent,
|
|
71
|
+
continuation_of_run_id: null,
|
|
72
|
+
retry_of_run_id: null,
|
|
73
|
+
agent_invocation_id: invocation,
|
|
74
|
+
root_agent_invocation_id: parent === null ? invocation : "AINV-RUN-ROOT",
|
|
75
|
+
parent_agent_invocation_id: parent === null ? null : "AINV-RUN-ROOT",
|
|
76
|
+
invocation_kind: parent === null ? "orchestrator" : "delegated",
|
|
77
|
+
delegation_depth: parent === null ? 0 : 1,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
schema_version: 2,
|
|
81
|
+
event_id: `${id}:2`,
|
|
82
|
+
run_id: id,
|
|
83
|
+
sequence: 2,
|
|
84
|
+
occurred_at: end,
|
|
85
|
+
type: "usage.recorded",
|
|
86
|
+
phase: "execution",
|
|
87
|
+
activity_kind: "model_usage",
|
|
88
|
+
classification_source: "explicit",
|
|
89
|
+
tokens: {
|
|
90
|
+
input: 100,
|
|
91
|
+
cached_input: 0,
|
|
92
|
+
output: 20,
|
|
93
|
+
reasoning: 0,
|
|
94
|
+
total: 120,
|
|
95
|
+
source: "provider_reported",
|
|
96
|
+
},
|
|
97
|
+
cost: { usd: 1, brl: 5, fx_rate: 5 },
|
|
98
|
+
provider: "openai",
|
|
99
|
+
model: "gpt-6-sol",
|
|
100
|
+
source_segment_key: id,
|
|
101
|
+
model_call_id: `MCALL-${id}`,
|
|
102
|
+
runtime: { reasoning_effort: null, service_tier: null },
|
|
103
|
+
supersedes_event_id: null,
|
|
104
|
+
source_occurred_at: end,
|
|
105
|
+
source_started_at: start,
|
|
106
|
+
source_finished_at: end,
|
|
107
|
+
duration_ms: null,
|
|
108
|
+
duration_provenance: null,
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
};
|
|
112
|
+
for (const [id, specId, start, end, parent] of [
|
|
113
|
+
["RUN-ROOT", "SPEC-ROOT", sourceStart, sourceEnd, null],
|
|
114
|
+
["RUN-OVERLAP", "SPEC-ROOT", "2026-10-01T04:30:00.000Z", "2026-10-01T05:30:00.000Z", null],
|
|
115
|
+
["RUN-CHILD", "SPEC-CHILD", "2026-10-01T04:00:00.000Z", "2026-10-01T05:00:00.000Z", "RUN-ROOT"],
|
|
116
|
+
["RUN-UNKNOWN", "SPEC-CHILD", "2026-10-02T12:00:00.000Z", "2026-10-02T12:00:00.000Z", null],
|
|
117
|
+
] as const)
|
|
118
|
+
await writeFile(
|
|
119
|
+
join(records, "runs", "2026", "09", `${id}.jsonl`),
|
|
120
|
+
`${run(id, specId, start, end, parent)
|
|
121
|
+
.map((event) => JSON.stringify(event))
|
|
122
|
+
.join("\n")}\n`,
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
await rebuildSqliteReadModel(root);
|
|
126
|
+
const db = new DatabaseSync(resolve(root, ".local/sqlite/zaip-aios-dashboard.sqlite"), {
|
|
127
|
+
readOnly: true,
|
|
128
|
+
});
|
|
129
|
+
const observed = Date.parse(sourceEnd) - Date.parse(sourceStart);
|
|
130
|
+
expect(observed).toBe(76_445_497);
|
|
131
|
+
expect(
|
|
132
|
+
db.prepare("SELECT source_duration_ms FROM zaip_aios_activities WHERE run_id='RUN-ROOT'").get(),
|
|
133
|
+
).toEqual({ source_duration_ms: observed });
|
|
134
|
+
expect(
|
|
135
|
+
db
|
|
136
|
+
.prepare("SELECT spec_id, total_duration_ms FROM zaip_vw_spec_root_elapsed ORDER BY spec_id")
|
|
137
|
+
.all(),
|
|
138
|
+
).toEqual([{ spec_id: "SPEC-ROOT", total_duration_ms: observed }]);
|
|
139
|
+
expect(
|
|
140
|
+
db
|
|
141
|
+
.prepare(
|
|
142
|
+
"SELECT entity_id, total_duration_ms FROM zaip_vw_first_fold_top_specs_all_time ORDER BY rank LIMIT 1",
|
|
143
|
+
)
|
|
144
|
+
.get(),
|
|
145
|
+
).toEqual({ entity_id: "SPEC-ROOT", total_duration_ms: observed });
|
|
146
|
+
expect(
|
|
147
|
+
db.prepare("SELECT total_duration_ms FROM zaip_vw_first_fold_spec_metrics_all_time").get(),
|
|
148
|
+
).toEqual({ total_duration_ms: observed });
|
|
149
|
+
expect(
|
|
150
|
+
db
|
|
151
|
+
.prepare("SELECT period_key, total_duration FROM zaip_vw_cost_daily ORDER BY period_key")
|
|
152
|
+
.all(),
|
|
153
|
+
).toEqual([
|
|
154
|
+
{ period_key: "2026-09-30", total_duration: 15_498_928 },
|
|
155
|
+
{ period_key: "2026-10-01", total_duration: 60_946_569 },
|
|
156
|
+
{ period_key: "2026-10-02", total_duration: null },
|
|
157
|
+
]);
|
|
158
|
+
db.close();
|
|
159
|
+
const filesystem = new SqliteReadModelFileSystem(root);
|
|
160
|
+
const allTimeCost = filesystem.costMonitorSummaryAggregate({ from: null, to: null });
|
|
161
|
+
expect(allTimeCost.cost_monitor_daily_duration).toMatchObject({
|
|
162
|
+
"2026-09-30": { known_sum: 15_498_928 },
|
|
163
|
+
"2026-10-01": { known_sum: 60_946_569 },
|
|
164
|
+
"2026-10-02": { known_sum: 0, known_runs: 0, eligible_runs: 1 },
|
|
165
|
+
});
|
|
166
|
+
expect(allTimeCost.daily_rows).toContainEqual(
|
|
167
|
+
expect.objectContaining({ key: "2026-10-02", total_duration: null }),
|
|
168
|
+
);
|
|
169
|
+
const unknownFiltered = filesystem.costMonitorSummaryAggregate({
|
|
170
|
+
from: "2026-10-02",
|
|
171
|
+
to: "2026-10-02",
|
|
172
|
+
specs: ["SPEC-CHILD"],
|
|
173
|
+
});
|
|
174
|
+
expect(unknownFiltered.cost_monitor_daily_duration).toMatchObject({
|
|
175
|
+
"2026-10-02": { known_sum: 0, known_runs: 0, eligible_runs: 1 },
|
|
176
|
+
});
|
|
177
|
+
expect(unknownFiltered.daily_rows).toContainEqual(
|
|
178
|
+
expect.objectContaining({ key: "2026-10-02", total_duration: null }),
|
|
179
|
+
);
|
|
180
|
+
const secondDayCost = filesystem.costMonitorSummaryAggregate({
|
|
181
|
+
from: "2026-10-01",
|
|
182
|
+
to: "2026-10-01",
|
|
183
|
+
});
|
|
184
|
+
expect(secondDayCost.cost_monitor_daily_duration).toMatchObject({
|
|
185
|
+
"2026-10-01": { known_sum: 60_946_569 },
|
|
186
|
+
});
|
|
187
|
+
expect(secondDayCost.cost_monitor_daily_duration).not.toHaveProperty("2026-09-30");
|
|
188
|
+
const filteredCost = filesystem.costMonitorSummaryAggregate({
|
|
189
|
+
from: "2026-10-01",
|
|
190
|
+
to: "2026-10-01",
|
|
191
|
+
specs: ["SPEC-ROOT"],
|
|
192
|
+
});
|
|
193
|
+
expect(filteredCost.cost_monitor_daily_duration).toMatchObject({
|
|
194
|
+
"2026-10-01": { known_sum: 60_946_569 },
|
|
195
|
+
});
|
|
196
|
+
const unknownDay = { from: "2026-10-02", to: "2026-10-02" };
|
|
197
|
+
expect(
|
|
198
|
+
filesystem.costMonitorSummaryAggregate(unknownDay).cost_monitor_daily_duration,
|
|
199
|
+
).toMatchObject({
|
|
200
|
+
"2026-10-02": { known_sum: 0, eligible_runs: 1, known_runs: 0 },
|
|
201
|
+
});
|
|
202
|
+
expect(
|
|
203
|
+
filesystem.costMonitorSummaryAggregate({ ...unknownDay, specs: ["SPEC-CHILD"] })
|
|
204
|
+
.cost_monitor_daily_duration,
|
|
205
|
+
).toMatchObject({ "2026-10-02": { known_sum: 0, eligible_runs: 1, known_runs: 0 } });
|
|
206
|
+
expect(filesystem.summaryPage("spec", { from: null, to: null }, 0, 10).rows).toContainEqual(
|
|
207
|
+
expect.objectContaining({ id: "SPEC-ROOT", total_duration: observed }),
|
|
208
|
+
);
|
|
209
|
+
filesystem.close();
|
|
210
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"files": [
|
|
5
5
|
{
|
|
6
6
|
"path": "DESIGN.md",
|
|
@@ -276,7 +276,7 @@
|
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
278
|
"path": "apps/catalog/package.json",
|
|
279
|
-
"sha256": "
|
|
279
|
+
"sha256": "16b609f2cc84fbca57eac28dbf45969f8969fcac8d3a964a211530a69d76e007"
|
|
280
280
|
},
|
|
281
281
|
{
|
|
282
282
|
"path": "apps/catalog/public/logo_novo_azul.png",
|
|
@@ -408,7 +408,7 @@
|
|
|
408
408
|
},
|
|
409
409
|
{
|
|
410
410
|
"path": "packages/local-runtime/package.json",
|
|
411
|
-
"sha256": "
|
|
411
|
+
"sha256": "f42120a471dd8ea2816129960206cc9952360645e4a3cd6d09cbbe891973cde8"
|
|
412
412
|
},
|
|
413
413
|
{
|
|
414
414
|
"path": "packages/local-runtime/runtime.mjs",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.7.0
|