@zaip-ai/cli 2.2.0 → 2.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/services/adapters.d.ts +1 -1
- package/dist/services/adapters.d.ts.map +1 -1
- package/dist/services/adapters.js +23 -9
- package/dist/services/adapters.js.map +1 -1
- package/dist/services/agent-adapters.js +25 -9
- package/dist/services/agent-adapters.js.map +1 -1
- package/dist/services/agent-discovery.d.ts +27 -0
- package/dist/services/agent-discovery.d.ts.map +1 -0
- package/dist/services/agent-discovery.js +73 -0
- package/dist/services/agent-discovery.js.map +1 -0
- package/dist/services/codex-conversation-lifecycle-hook.d.ts.map +1 -1
- package/dist/services/codex-conversation-lifecycle-hook.js +153 -24
- package/dist/services/codex-conversation-lifecycle-hook.js.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.d.ts.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.js +146 -72
- package/dist/services/codex-pre-tool-hook-template.js.map +1 -1
- package/dist/services/codex-rules.d.ts +1 -1
- package/dist/services/codex-rules.d.ts.map +1 -1
- package/dist/services/codex-rules.js +3 -3
- package/dist/services/codex-subagent-hook-template.d.ts +1 -1
- package/dist/services/codex-subagent-hook-template.d.ts.map +1 -1
- package/dist/services/codex-subagent-hook-template.js +117 -66
- package/dist/services/codex-subagent-hook-template.js.map +1 -1
- package/dist/services/install-agents-template.d.ts.map +1 -1
- package/dist/services/install-agents-template.js +56 -6
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/logger.js +1 -1
- package/dist/services/logger.js.map +1 -1
- package/dist/services/logger.test.js +22 -1
- package/dist/services/logger.test.js.map +1 -1
- package/dist/services/runtime-template.test.js +129 -0
- package/dist/services/runtime-template.test.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/.env.example +9 -3
- package/templates/.agents/README-ENG.md +30 -5
- package/templates/.agents/README.md +30 -7
- package/templates/.agents/architecture/software-architecture.md +1 -59
- package/templates/.agents/branding/brandbook.md +3 -0
- package/templates/.agents/config/agents/catalog.yaml +22 -10
- package/templates/.agents/config/agents/discovery.json +319 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-backend.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-builder.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-cloud-engineer.toml +11 -8
- package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-frontend.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-task-executor.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-website-developer.toml +2 -2
- package/templates/.agents/config/pricing/models.json +9 -5
- package/templates/.agents/config/project.yaml +12 -1
- package/templates/.agents/dashboard/.zaip-managed.json +375 -95
- package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-CGxeQak4.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-DaSllaJp.js → DashboardHelpDialog-tzS7YxYB.js} +57 -33
- package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-DEbCi1gP.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-1L7Qw-Gq.js +3 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-EInWr641.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-t1Om0Abw.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-B6aZfo5f.js +68 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-TPUT2IUt.js → icons-vendor-DiGC-dsJ.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DgTmNHN5.js +2 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-Ct48XHGL.js → react-vendor-kPO6yNed.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/rolldown-runtime-Bh1tDfsg.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-DQpKX9c1.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +6 -6
- package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/App.tsx +3 -1264
- package/templates/.agents/dashboard/apps/frontend/src/AppDashboardContent.tsx +363 -0
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.dom.test.ts +99 -0
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +62 -6
- package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +3 -1
- package/templates/.agents/dashboard/apps/frontend/src/__tests__/app-composition-support.ts +7 -0
- package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +9 -7
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api-settings.ts +151 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +28 -153
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-app-shell.tsx +33 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-cost-facts.ts +30 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-project-overview.ts +7 -1
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-retry.ts +17 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-setup-route.ts +29 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-view-actions.ts +66 -0
- package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +3 -2
- package/templates/.agents/dashboard/apps/frontend/src/overview-status-page.test.ts +2 -2
- package/templates/.agents/dashboard/apps/frontend/src/project-installation-status.test.ts +48 -0
- package/templates/.agents/dashboard/apps/frontend/src/project-installation-status.ts +29 -0
- package/templates/.agents/dashboard/apps/frontend/src/project-settings-page.css +68 -0
- package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +2 -2
- package/templates/.agents/dashboard/apps/frontend/src/sao-paulo-day-rollover.test.ts +36 -0
- package/templates/.agents/dashboard/apps/frontend/src/sao-paulo-day-rollover.ts +30 -0
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-banner-semantics.test.ts +2 -5
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +30 -19
- package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +9 -1
- package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-task-pagination.ts +77 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-work-board.ts +397 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-dashboard-app-model.tsx +782 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-snapshot-notice.tsx +49 -0
- package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostDeveloperPanelSlot.tsx +16 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostGroupsTable.tsx +459 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +27 -17
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +62 -186
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorRunDialog.tsx +20 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables-hides-calls-that-have-no-collected.test.ts +80 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables-keeps-legacy-codex-identity-fields-blank.test.ts +455 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +18 -525
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +32 -508
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-export-sources.ts +74 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-actions.ts +19 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-selectors.ts +49 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-table-formatters.ts +115 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.test-fixtures.ts +2 -0
- package/templates/.agents/dashboard/modules/operations/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/src/contracts.ts +4 -0
- package/templates/.agents/dashboard/modules/operations/src/react/EntityTableBadges.tsx +34 -0
- package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.tsx +8 -38
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview-keeps-structure-classes-mutually-exclusive.test.ts +243 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +27 -275
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +70 -247
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewCharts.tsx +171 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewPanels.tsx +64 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +4 -3
- package/templates/.agents/dashboard/modules/operations/src/react/PrdDocumentDialog.test.tsx +2 -1
- package/templates/.agents/dashboard/modules/operations/src/react/manual-work-priority.test.ts +2 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +6 -2
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +6 -14
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.status-cards.test.ts +3 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +2 -0
- package/templates/.agents/dashboard/modules/operations/src/react/overview-metric-format.ts +32 -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/branding/src/index.ts +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 +1458 -1458
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +1425 -1425
- package/templates/.agents/dashboard/packages/local-runtime/package.json +2 -1
- package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +7 -3
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +1458 -1459
- package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.ts +25 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/agent-catalog-settings.test.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +53 -8
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +79 -24
- package/templates/.agents/dashboard/packages/local-runtime/src/projection-refresh-diagnostics.ts +35 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-costs-routes.ts +168 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-dual-reads-manifest-summaries-without-losing.test.ts +344 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-http-contracts.ts +31 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-routes.ts +345 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-read-projections.ts +461 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-refresh.test.ts +78 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-route-context.ts +13 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.test.ts +18 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.ts +19 -3
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +22 -21
- package/templates/.agents/dashboard/packages/local-runtime/src/server-sqlite-view-allowlist.test.ts +25 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-routes.ts +64 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-work-reconciliation.test.ts +2 -30
- package/templates/.agents/dashboard/packages/local-runtime/src/server-work-reconciliation.ts +6 -23
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test-fixtures.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +2 -330
- package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +73 -1060
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-first-fold.ts +78 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-projections.ts +561 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-runs.ts +600 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.test.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-agent-dimension.ts +269 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-context.ts +32 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-entity-group.ts +244 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-filtered-dimension.ts +292 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-financial.ts +547 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-model-dimension.ts +360 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-provider-dimension.ts +169 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-summary.ts +475 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-temporal-dimension.ts +132 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-timing.ts +299 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-view-page.ts +692 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-counts-every-root-execution-day-returns.test.ts +739 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-does-not-convert-delayed-historical-finalizer.test.ts +706 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-filesystem.ts +748 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-first-fold-types.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-keeps-orphan-telemetry-out-kanban-without.test.ts +710 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-marks-token-cost-telemetry-unavailable-when.test.ts +618 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuild.ts +755 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuilds-disposable-snapshot-serves-zaip-records.test.ts +276 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-schema.ts +193 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-types.ts +123 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +1 -2805
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +17 -6930
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-base-views.ts +385 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-dashboard-views.ts +412 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/work-priority-contract.test.ts +4 -3
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-build.mjs +195 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-lifecycle.test.mjs +2 -7
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-logging.mjs +35 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-navigation.mjs +114 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-paths.mjs +90 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +89 -418
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +22 -12
- package/templates/.agents/dashboard/packages/ui/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +4 -1
- package/templates/.agents/design/.zaip-managed.json +5 -5
- package/templates/.agents/design/DESIGN.md +2 -186
- package/templates/.agents/design/README.md +12 -2
- package/templates/.agents/design/apps/catalog/package.json +1 -1
- package/templates/.agents/design/packages/local-runtime/package.json +1 -1
- package/templates/.agents/growth/strategy.md +3 -0
- package/templates/.agents/marketing/strategy.md +3 -0
- package/templates/.agents/requirements/autonomous-assurance.md +2 -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 +13 -4
- 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 +4 -2
- 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 +3 -3
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/rules/architecture.md +2 -0
- package/templates/.agents/rules/astra-diagnostic.md +1 -1
- package/templates/.agents/rules/autonomy-decision.md +3 -1
- package/templates/.agents/rules/cloud-hostinger-autonomy.md +2 -0
- package/templates/.agents/rules/context.md +2 -1
- package/templates/.agents/rules/core.md +3 -3
- package/templates/.agents/rules/design-system-central-contract.md +17 -0
- package/templates/.agents/rules/evolution.md +3 -1
- package/templates/.agents/rules/frontend-lite.md +3 -1
- package/templates/.agents/rules/local-sqlite-storage.md +2 -2
- package/templates/.agents/rules/meta-mcp.md +3 -1
- package/templates/.agents/rules/model-orchestration.md +1 -1
- package/templates/.agents/rules/run-lifecycle-closure.md +6 -4
- package/templates/.agents/rules/security.md +3 -1
- package/templates/.agents/rules/specialist-routing.md +3 -1
- package/templates/.agents/rules/text-writing-utf8.md +1 -1
- package/templates/.agents/rules/workflow.md +7 -5
- package/templates/.agents/runtime/VERSION +1 -1
- package/templates/.agents/runtime/bin/zaip.mjs +519 -247
- package/templates/.agents/runtime/checksums.sha256 +6 -6
- package/templates/.agents/runtime/manifest.json +1 -1
- package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
- package/templates/.agents/runtime/provenance.json +5 -5
- package/templates/.agents/runtime/sbom.cdx.json +1 -1
- package/templates/.agents/sales/playbook.md +3 -0
- package/templates/.agents/skills/zaip-aios/SKILL.md +5 -3
- package/templates/.agents/skills/zaip-skill-adapt-stack/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-api-contracts/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-api-contracts/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-application-observability/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-application-observability/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-application-observability/references/signal-design.md +3 -0
- package/templates/.agents/skills/zaip-skill-application-readiness/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-application-readiness/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-application-readiness/references/evidence-matrix.md +3 -0
- package/templates/.agents/skills/zaip-skill-architecture-design/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-architecture-design/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-async-jobs/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-async-jobs/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/references/data-access-paths.md +9 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/references/worker-scenario.md +5 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/scripts/worker-contract.test.mjs +27 -0
- package/templates/.agents/skills/zaip-skill-author-skills/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-author-skills/references/engineering-skill-index.md +9 -0
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/audit-skill-catalog.mjs +5 -3
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/author-skill-scripts.test.mjs +27 -0
- package/templates/.agents/skills/zaip-skill-backend/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-backend/references/deployment-environments.md +75 -0
- package/templates/.agents/skills/zaip-skill-backend/references/supabase-migration-contract.md +23 -0
- package/templates/.agents/skills/zaip-skill-brand-governance/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-cache-strategy/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-cache-strategy/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-change/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-cloud-engineering/SKILL.md +7 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/SKILL.md +37 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/agents/openai.yaml +6 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/references/workers-static-assets.md +26 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/references/workflow-templates.md +71 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/scripts/cloudflare-github-deploy-contract.test.mjs +77 -0
- package/templates/.agents/skills/zaip-skill-config/SKILL.md +21 -11
- package/templates/.agents/skills/zaip-skill-config/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-container-runtime/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-container-runtime/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-context/SKILL.md +6 -1
- package/templates/.agents/skills/zaip-skill-context/references/prd-spec-task-handoff.md +10 -0
- package/templates/.agents/skills/zaip-skill-context/references/rule-selection.md +20 -0
- package/templates/.agents/skills/zaip-skill-cqrs/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/SKILL.md +18 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/references/audit-contract.md +94 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/scripts/score-audit.mjs +185 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/scripts/score-audit.test.mjs +101 -0
- package/templates/.agents/skills/zaip-skill-data-modeling/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-data-modeling/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/SKILL.md +20 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/references/manual-mode.md +15 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/references/promotion-example.md +5 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/scripts/export-manual-sql.mjs +145 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/scripts/export-manual-sql.test.mjs +178 -0
- package/templates/.agents/skills/zaip-skill-dependency-upgrade/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-dependency-upgrade/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-deployment-pipeline/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-deployment-pipeline/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-deployment-pipeline/references/runtime-shapes.md +3 -0
- package/templates/.agents/skills/zaip-skill-design-system/SKILL.md +20 -9
- package/templates/.agents/skills/zaip-skill-dev-environment/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-dev-environment/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-dev-environment/references/inventory-contract.md +7 -0
- package/templates/.agents/skills/zaip-skill-dev-environment/scripts/inventory.mjs +77 -0
- package/templates/.agents/skills/zaip-skill-disaster-recovery/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-disaster-recovery/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-disaster-recovery/references/recovery-scope.md +3 -0
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +3 -3
- package/templates/.agents/skills/zaip-skill-execution/references/correction-cycle.md +7 -0
- package/templates/.agents/skills/zaip-skill-execution/references/runtime-governance.md +1 -5
- package/templates/.agents/skills/zaip-skill-external-integrations/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-external-integrations/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-frontend/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-frontend-componentization/SKILL.md +44 -0
- package/templates/.agents/skills/zaip-skill-frontend-componentization/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-frontend-data-flows/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-frontend-data-flows/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-general-operations/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/SKILL.md +36 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/cloudflare-pages.md +33 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/github.md +63 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/hostinger-vps.md +55 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/npm.md +30 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/check-skill.mjs +55 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/verify-cloudflare.mjs +61 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/verify-cloudflare.test.mjs +128 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/verify-ssh.integration.test.mjs +106 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +43 -76
- package/templates/.agents/skills/zaip-skill-github-deploy/references/deployment-workflow.md +131 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/github-release-workflow-template.md +31 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/release-gate-matrix.md +24 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/release-identity.md +44 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/release-notes.md +134 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/consumer-release-preparation.mjs +389 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/consumer-release-preparation.test.mjs +134 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-deploy-contract.test.mjs +25 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-readiness-api.test.mjs +134 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-readiness.mjs +98 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-readiness.test.mjs +25 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/install-github-readiness-workflow.mjs +159 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/install-github-readiness-workflow.test.mjs +160 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.mjs +149 -12
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.test.mjs +64 -5
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/release-notes-coverage.test.mjs +126 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/resolve-release-identity.mjs +78 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/resolve-release-identity.test.mjs +51 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/validate-release-notes.mjs +184 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/validate-release-notes.test.mjs +109 -0
- package/templates/.agents/skills/zaip-skill-growth-strategy-revops/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/SKILL.md +18 -10
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/agents/openai.yaml +3 -4
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/aws-cli-terraform.md +62 -0
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/guia-iniciante-hostinger-vps.md +183 -0
- package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/references/scaffold-contract.md +9 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/scripts/helpers.test.mjs +121 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/scripts/scaffold.mjs +169 -0
- package/templates/.agents/skills/zaip-skill-move-prd/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-move-spec/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-performance-engineering/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-performance-engineering/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-prd/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +1 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +26 -9
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +39 -13
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.mjs +1 -0
- package/templates/.agents/skills/zaip-skill-refactor-landing-page/SKILL.md +66 -0
- package/templates/.agents/skills/zaip-skill-refactor-landing-page/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-refactor-landing-page/references/behavioral-dry-run.md +23 -0
- package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +40 -1
- package/templates/.agents/skills/zaip-skill-release-qualification/references/local-preparation.md +98 -0
- package/templates/.agents/skills/zaip-skill-review/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-rules/SKILL.md +3 -3
- package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-setup/SKILL.md +19 -21
- package/templates/.agents/skills/zaip-skill-setup/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-spec/SKILL.md +3 -2
- package/templates/.agents/skills/zaip-skill-storage-uploads/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-storage-uploads/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-systematic-debugging/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-systematic-debugging/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-task/SKILL.md +16 -7
- package/templates/.agents/skills/zaip-skill-task/references/commit-policy.md +25 -0
- package/templates/.agents/skills/zaip-skill-test-data/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-test-data/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-test-data/scripts/generate.mjs +72 -0
- package/templates/.agents/skills/zaip-skill-testing-strategy/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-testing-strategy/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-testing-strategy/references/example-map.md +3 -0
- package/templates/.agents/skills/zaip-skill-website-readiness/SKILL.md +8 -0
- package/templates/.agents/zaip-aios/VERSION +1 -1
- package/templates/.agents/zaip-aios/guides/10-seguranca.md +2 -1
- package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +5 -3
- package/templates/scripts/validate-cloud-hostinger-contract.mjs +34 -0
- package/templates/template-manifest.json +955 -211
- package/templates/.agents/branding/.gitkeep +0 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-snUCQYTC.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-BPtVUGgs.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-3Awyaovx.js +0 -3
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-GgzpZ_PY.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BCvZFMEf.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-DbaLbU2q.js +0 -68
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-_MEktQNM.js +0 -2
- package/templates/.agents/dashboard/apps/frontend/dist/assets/rolldown-runtime-D9-fqq9M.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-BDe4_Ubl.js +0 -1
- package/templates/.agents/growth/.gitkeep +0 -0
- package/templates/.agents/marketing/.gitkeep +0 -0
- package/templates/.agents/sales/.gitkeep +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Scaffold grammar and output
|
|
2
|
+
|
|
3
|
+
Run `node .agents/skills/zaip-skill-module-scaffold/scripts/scaffold.mjs <module-name> [--root <directory>] [--dry-run]`.
|
|
4
|
+
|
|
5
|
+
The module name is lowercase kebab-case. `--root` defaults to the current directory; `--dry-run` writes nothing. Repeated flags are rejected. The helper requires stack id `zaip-aios-stack`, language `typescript`, and a safe relative `stack.layout.modules` path. It emits schema version, stack id, relative module path, dry-run state, and sorted `created` and `unchanged` paths.
|
|
6
|
+
|
|
7
|
+
The generated shell has a domain type, an application factory, a public index, and a co-located TypeScript behavior check. It deliberately has no database, Hono, Kysely, Supabase, Redis, or BullMQ import.
|
|
8
|
+
|
|
9
|
+
The consumer must provide TypeScript and `@types/node`. Compile with its project `tsconfig` or a portable temporary tsconfig that sets Node types and emits JavaScript, then run `node --test <emitted>/application.test.js`. This generated check is Node-test compatible; it does not promise automatic Vitest discovery.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import { join, resolve } from "node:path";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { promisify } from "node:util";
|
|
8
|
+
|
|
9
|
+
const run = promisify(execFile);
|
|
10
|
+
const skillRoot = resolve(import.meta.dirname, "..", "..");
|
|
11
|
+
const root = resolve(skillRoot, "..", "..");
|
|
12
|
+
const scaffold = resolve(skillRoot, "zaip-skill-module-scaffold/scripts/scaffold.mjs");
|
|
13
|
+
const inventory = resolve(skillRoot, "zaip-skill-dev-environment/scripts/inventory.mjs");
|
|
14
|
+
const fixture = resolve(skillRoot, "zaip-skill-test-data/scripts/generate.mjs");
|
|
15
|
+
|
|
16
|
+
test("helpers are deterministic and avoid local secret values", async (context) => {
|
|
17
|
+
const directory = await mkdtemp(join(os.tmpdir(), "zaip-skill-helper-"));
|
|
18
|
+
context.after(() => rm(directory, { recursive: true, force: true }));
|
|
19
|
+
await mkdir(join(directory, ".agents", "config"), { recursive: true });
|
|
20
|
+
await writeFile(
|
|
21
|
+
join(directory, ".agents", "config", "project.yaml"),
|
|
22
|
+
"project:\n id: consumer-project\nstack:\n id: zaip-aios-stack\n language: typescript\n layout:\n modules: features\n",
|
|
23
|
+
);
|
|
24
|
+
await writeFile(
|
|
25
|
+
join(directory, "package.json"),
|
|
26
|
+
JSON.stringify({ scripts: { test: "secret-command-value" } }),
|
|
27
|
+
);
|
|
28
|
+
await writeFile(join(directory, ".env"), "VISIBLE_NAME=private-value\n");
|
|
29
|
+
await writeFile(join(directory, ".env.example"), "VISIBLE_NAME=\nMISSING_NAME=\n");
|
|
30
|
+
|
|
31
|
+
const inventoryOutput = JSON.parse((await run(process.execPath, [inventory, directory])).stdout);
|
|
32
|
+
assert.deepEqual(inventoryOutput.package_scripts, ["test"]);
|
|
33
|
+
assert.deepEqual(inventoryOutput.environment_names[".env"], ["VISIBLE_NAME"]);
|
|
34
|
+
assert.equal(JSON.stringify(inventoryOutput).includes("private-value"), false);
|
|
35
|
+
assert.equal(JSON.stringify(inventoryOutput).includes("secret-command-value"), false);
|
|
36
|
+
assert.deepEqual(inventoryOutput.missing_required_environment_names, ["MISSING_NAME"]);
|
|
37
|
+
await assert.rejects(run(process.execPath, [inventory, directory, "extra"]), /Usage/);
|
|
38
|
+
|
|
39
|
+
const first = JSON.parse(
|
|
40
|
+
(await run(process.execPath, [scaffold, "orders", "--root", directory])).stdout,
|
|
41
|
+
);
|
|
42
|
+
assert.deepEqual(first.created, [
|
|
43
|
+
"src/application.test.ts",
|
|
44
|
+
"src/application.ts",
|
|
45
|
+
"src/domain.ts",
|
|
46
|
+
"src/index.ts",
|
|
47
|
+
]);
|
|
48
|
+
const second = JSON.parse(
|
|
49
|
+
(await run(process.execPath, [scaffold, "orders", "--root", directory])).stdout,
|
|
50
|
+
);
|
|
51
|
+
assert.deepEqual(second.created, []);
|
|
52
|
+
await assert.rejects(
|
|
53
|
+
run(process.execPath, [scaffold, "con", "--root", directory]),
|
|
54
|
+
/reserved name/,
|
|
55
|
+
);
|
|
56
|
+
await assert.rejects(
|
|
57
|
+
run(process.execPath, [scaffold, "../escape", "--root", directory]),
|
|
58
|
+
/module-name/,
|
|
59
|
+
);
|
|
60
|
+
await assert.rejects(
|
|
61
|
+
run(process.execPath, [scaffold, "a--b", "--root", directory]),
|
|
62
|
+
/module-name/,
|
|
63
|
+
);
|
|
64
|
+
await assert.rejects(
|
|
65
|
+
run(process.execPath, [scaffold, "another", "--root", ".", "--root", directory]),
|
|
66
|
+
/Usage/,
|
|
67
|
+
);
|
|
68
|
+
const misleading = await mkdtemp(join(os.tmpdir(), "zaip-scaffold-layout-"));
|
|
69
|
+
context.after(() => rm(misleading, { recursive: true, force: true }));
|
|
70
|
+
await mkdir(join(misleading, ".agents", "config"), { recursive: true });
|
|
71
|
+
await writeFile(
|
|
72
|
+
join(misleading, ".agents", "config", "project.yaml"),
|
|
73
|
+
"project:\n id: consumer\nstack:\n id: zaip-aios-stack\n language: typescript\n layout:\n frontend: apps/frontend\n overrides:\n modules: wrong-owned-tree\n",
|
|
74
|
+
);
|
|
75
|
+
await assert.rejects(
|
|
76
|
+
run(process.execPath, [scaffold, "orders", "--root", misleading]),
|
|
77
|
+
/stack\.layout\.modules/,
|
|
78
|
+
);
|
|
79
|
+
await writeFile(
|
|
80
|
+
join(misleading, ".agents", "config", "project.yaml"),
|
|
81
|
+
"stack:\n id: zaip-aios-stack\n language: typescript\n layout:\n modules: modules\nstack:\n id: zaip-aios-stack\n",
|
|
82
|
+
);
|
|
83
|
+
await assert.rejects(
|
|
84
|
+
run(process.execPath, [scaffold, "orders", "--root", misleading]),
|
|
85
|
+
/duplicate top-level stack/,
|
|
86
|
+
);
|
|
87
|
+
await writeFile(join(directory, "features", "orders", "src", "domain.ts"), "changed\n");
|
|
88
|
+
await assert.rejects(
|
|
89
|
+
run(process.execPath, [scaffold, "orders", "--root", directory]),
|
|
90
|
+
/divergent/,
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const output = join(directory, "fixture.json");
|
|
94
|
+
const generated = JSON.parse(
|
|
95
|
+
(await run(process.execPath, [fixture, output, "--seed", "same"])).stdout,
|
|
96
|
+
).fixture;
|
|
97
|
+
const repeated = JSON.parse(
|
|
98
|
+
(await run(process.execPath, [fixture, output, "--seed", "same"])).stdout,
|
|
99
|
+
).fixture;
|
|
100
|
+
assert.deepEqual(generated, repeated);
|
|
101
|
+
assert.equal((await readFile(output, "utf8")).includes("same"), true);
|
|
102
|
+
await writeFile(output, "{}\n");
|
|
103
|
+
await assert.rejects(run(process.execPath, [fixture, output, "--seed", "same"]), /divergent/);
|
|
104
|
+
await assert.rejects(
|
|
105
|
+
run(process.execPath, [fixture, join(directory, "other.json"), "extra"]),
|
|
106
|
+
/Usage/,
|
|
107
|
+
);
|
|
108
|
+
const outside = await mkdtemp(join(os.tmpdir(), "zaip-test-data-outside-"));
|
|
109
|
+
context.after(() => rm(outside, { recursive: true, force: true }));
|
|
110
|
+
const linked = join(directory, "linked-output");
|
|
111
|
+
try {
|
|
112
|
+
await symlink(outside, linked, process.platform === "win32" ? "junction" : "dir");
|
|
113
|
+
} catch (error) {
|
|
114
|
+
if (error.code !== "EPERM") throw error;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
await assert.rejects(
|
|
118
|
+
run(process.execPath, [fixture, join(linked, "fixture.json")]),
|
|
119
|
+
/symbolic link or junction/,
|
|
120
|
+
);
|
|
121
|
+
});
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { lstat, mkdir, readFile, realpath, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
3
|
+
|
|
4
|
+
const [name, ...args] = process.argv.slice(2);
|
|
5
|
+
let root = ".";
|
|
6
|
+
let rootSeen = false;
|
|
7
|
+
let dryRun = false;
|
|
8
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
9
|
+
if (args[index] === "--root" && typeof args[index + 1] === "string" && !rootSeen) {
|
|
10
|
+
rootSeen = true;
|
|
11
|
+
root = args[++index];
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (args[index] === "--dry-run" && !dryRun) {
|
|
15
|
+
dryRun = true;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
throw new Error("Usage: scaffold.mjs <module-name> [--root <directory>] [--dry-run]");
|
|
19
|
+
}
|
|
20
|
+
if (!/^[a-z](?:[a-z0-9]|-(?=[a-z0-9]))*$/.test(name ?? "") || reserved(name))
|
|
21
|
+
throw new Error("module-name must be lowercase kebab-case and not a Windows reserved name");
|
|
22
|
+
const rootPath = resolve(root);
|
|
23
|
+
const configPath = resolve(rootPath, ".agents/config/project.yaml");
|
|
24
|
+
const config = await readFile(configPath, "utf8").catch(() => {
|
|
25
|
+
throw new Error("missing .agents/config/project.yaml");
|
|
26
|
+
});
|
|
27
|
+
const stack = parseStackSubset(config);
|
|
28
|
+
const stackId = stack.id;
|
|
29
|
+
const language = stack.language;
|
|
30
|
+
if (stackId !== "zaip-aios-stack" || language !== "typescript")
|
|
31
|
+
throw new Error("missing or unsupported stack profile");
|
|
32
|
+
const modules = stack.modules;
|
|
33
|
+
if (!modules || !safeRelative(modules))
|
|
34
|
+
throw new Error("missing or unsupported stack.layout.modules path");
|
|
35
|
+
const modulesRoot = resolve(rootPath, modules);
|
|
36
|
+
if (!inside(rootPath, modulesRoot)) throw new Error("modules path escapes root");
|
|
37
|
+
const canonicalRoot = await realpath(rootPath);
|
|
38
|
+
await ensureNoEscape(canonicalRoot, modulesRoot);
|
|
39
|
+
const target = resolve(modulesRoot, name);
|
|
40
|
+
if (!inside(modulesRoot, target)) throw new Error("module target escapes modules path");
|
|
41
|
+
const collision = await caseCollision(modulesRoot, name);
|
|
42
|
+
if (collision) throw new Error("case-insensitive module collision");
|
|
43
|
+
await ensureNoEscape(canonicalRoot, target);
|
|
44
|
+
const files = generated(name);
|
|
45
|
+
const changes = [];
|
|
46
|
+
let existingCount = 0;
|
|
47
|
+
for (const [path, content] of Object.entries(files)) {
|
|
48
|
+
const absolute = resolve(target, path);
|
|
49
|
+
await ensureNoEscape(canonicalRoot, absolute);
|
|
50
|
+
const existing = await readFile(absolute, "utf8").catch(() => null);
|
|
51
|
+
if (existing === null) changes.push(path);
|
|
52
|
+
else {
|
|
53
|
+
existingCount += 1;
|
|
54
|
+
if (existing !== content) throw new Error(`refusing divergent or partial module file: ${path}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (existingCount > 0 && changes.length > 0)
|
|
58
|
+
throw new Error("refusing divergent or partial module");
|
|
59
|
+
if (!dryRun)
|
|
60
|
+
for (const [path, content] of Object.entries(files)) {
|
|
61
|
+
const absolute = resolve(target, path);
|
|
62
|
+
await mkdir(dirname(absolute), { recursive: true });
|
|
63
|
+
try {
|
|
64
|
+
await writeFile(absolute, content, { encoding: "utf8", flag: "wx" });
|
|
65
|
+
} catch (error) {
|
|
66
|
+
if (error.code !== "EEXIST" || (await readFile(absolute, "utf8")) !== content) throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
process.stdout.write(
|
|
70
|
+
`${JSON.stringify(
|
|
71
|
+
{
|
|
72
|
+
schema_version: 1,
|
|
73
|
+
stack_id: stackId,
|
|
74
|
+
module: `${modules}/${name}`,
|
|
75
|
+
dry_run: dryRun,
|
|
76
|
+
created: changes.sort(),
|
|
77
|
+
unchanged: Object.keys(files)
|
|
78
|
+
.filter((path) => !changes.includes(path))
|
|
79
|
+
.sort(),
|
|
80
|
+
},
|
|
81
|
+
null,
|
|
82
|
+
2,
|
|
83
|
+
)}\n`,
|
|
84
|
+
);
|
|
85
|
+
function generated(module) {
|
|
86
|
+
const symbol = module
|
|
87
|
+
.split("-")
|
|
88
|
+
.map((part) => part[0].toUpperCase() + part.slice(1))
|
|
89
|
+
.join("");
|
|
90
|
+
return {
|
|
91
|
+
"src/domain.ts": `export type ${symbol}Id = string;\nexport interface ${symbol} { id: ${symbol}Id; }\n`,
|
|
92
|
+
"src/application.ts": `import type { ${symbol} } from "./domain.js";\nexport function create${symbol}(id: string): ${symbol} { return { id }; }\n`,
|
|
93
|
+
"src/index.ts": `export * from "./application.js";\nexport * from "./domain.js";\n`,
|
|
94
|
+
"src/application.test.ts": `import assert from "node:assert/strict";\nimport test from "node:test";\nimport { create${symbol} } from "./application.js";\ntest("${module} factory", () => assert.equal(create${symbol}("id").id, "id"));\n`,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function reserved(value) {
|
|
98
|
+
return /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i.test(value);
|
|
99
|
+
}
|
|
100
|
+
function safeRelative(value) {
|
|
101
|
+
return (
|
|
102
|
+
!isAbsolute(value) && !value.split(/[\\/]+/).some((part) => part === ".." || part.length === 0)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
function inside(parent, child) {
|
|
106
|
+
const value = relative(parent, child);
|
|
107
|
+
return value === "" || (!value.startsWith(`..${sep}`) && value !== "..");
|
|
108
|
+
}
|
|
109
|
+
async function ensureNoEscape(canonicalRoot, path) {
|
|
110
|
+
let current = canonicalRoot;
|
|
111
|
+
for (const part of relative(canonicalRoot, path).split(/[\\/]+/)) {
|
|
112
|
+
if (!part) continue;
|
|
113
|
+
current = resolve(current, part);
|
|
114
|
+
const stat = await lstat(current).catch(() => null);
|
|
115
|
+
if (!stat) continue;
|
|
116
|
+
const resolved = await realpath(current);
|
|
117
|
+
if (!inside(canonicalRoot, resolved))
|
|
118
|
+
throw new Error("modules path resolves through a junction outside root");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function caseCollision(directory, candidate) {
|
|
122
|
+
const { readdir } = await import("node:fs/promises");
|
|
123
|
+
const entries = await readdir(directory).catch(() => []);
|
|
124
|
+
return entries.some(
|
|
125
|
+
(entry) => entry.toLowerCase() === candidate.toLowerCase() && entry !== candidate,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function parseStackSubset(source) {
|
|
129
|
+
const lines = source.replaceAll("\r\n", "\n").split("\n");
|
|
130
|
+
if (lines.filter((line) => /^stack:\s*(?:#.*)?$/.test(line)).length > 1)
|
|
131
|
+
throw new Error("duplicate top-level stack");
|
|
132
|
+
let inStack = false;
|
|
133
|
+
let inLayout = false;
|
|
134
|
+
const values = {};
|
|
135
|
+
for (const line of lines) {
|
|
136
|
+
if (/\t|[&*][A-Za-z_]/.test(line) && inStack)
|
|
137
|
+
throw new Error("unsupported YAML construct in stack mapping");
|
|
138
|
+
if (!inStack) {
|
|
139
|
+
if (/^stack:\s*(?:#.*)?$/.test(line)) {
|
|
140
|
+
inStack = true;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (/^[^ \t#]/.test(line)) break;
|
|
146
|
+
if (/^ {2}layout:\s*(?:#.*)?$/.test(line)) {
|
|
147
|
+
if (inLayout) throw new Error("duplicate stack.layout");
|
|
148
|
+
inLayout = true;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
const direct = line.match(/^ {2}(id|language):\s*([^#\s]+)\s*(?:#.*)?$/);
|
|
152
|
+
if (direct) {
|
|
153
|
+
inLayout = false;
|
|
154
|
+
if (values[direct[1]]) throw new Error(`duplicate stack.${direct[1]}`);
|
|
155
|
+
values[direct[1]] = direct[2];
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (/^ {2}[A-Za-z_][A-Za-z0-9_-]*:/.test(line)) {
|
|
159
|
+
inLayout = false;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const nested = line.match(/^ {4}modules:\s*([^#\s]+)\s*(?:#.*)?$/);
|
|
163
|
+
if (nested && inLayout) {
|
|
164
|
+
if (values.modules) throw new Error("duplicate stack.layout.modules");
|
|
165
|
+
values.modules = nested[1];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return values;
|
|
169
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: zaip-skill-move-prd
|
|
3
|
-
description:
|
|
3
|
+
description: Move, cancel, execute, or deliver a ZAIP PRD only on explicit lifecycle intent; preserve descendant consistency.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Mover PRD com descendentes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: zaip-skill-move-spec
|
|
3
|
-
description:
|
|
3
|
+
description: Move, cancel, execute, or deliver a ZAIP SPEC only on explicit lifecycle intent; preserve descendant consistency.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Mover SPEC com descendentes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zaip-skill-performance-engineering
|
|
3
|
+
description: Measure and improve application latency, throughput, queries, queues, and resource use under stated conditions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Engineer performance
|
|
7
|
+
|
|
8
|
+
Use for a demonstrated latency, capacity, query, memory, or queue throughput concern.
|
|
9
|
+
|
|
10
|
+
1. Define workload, data shape, environment, target metric, baseline, and success threshold before tuning.
|
|
11
|
+
2. Profile the likely bottleneck across browser, API, database, cache, worker, and network boundaries before changing code.
|
|
12
|
+
3. Change one justified cause at a time and preserve correctness, tenant isolation, and failure handling.
|
|
13
|
+
4. Compare before and after under equivalent conditions using k6, autocannon, or a project-supported tool where appropriate.
|
|
14
|
+
5. Report confidence limits, saturation behavior, and unmeasured production differences.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: zaip-skill-prd
|
|
3
|
-
description: Create, refine, prepare,
|
|
3
|
+
description: Create, refine, prepare, or analyze a ZAIP PRD on explicit PRD work; keep draft until explicit ready or execute intent.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Trabalhar com PRDs
|
package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs
CHANGED
|
@@ -102,6 +102,9 @@ export function usageView(record) {
|
|
|
102
102
|
reasoning: tokens[3] ?? null,
|
|
103
103
|
total: tokens[4] ?? null,
|
|
104
104
|
source: tokens[5] ?? "unavailable",
|
|
105
|
+
// Appended to the compact tuple to retain compatibility with historical
|
|
106
|
+
// records that have only the first six fields.
|
|
107
|
+
cache_write_input: tokens[6] ?? null,
|
|
105
108
|
},
|
|
106
109
|
source_segment_key: record[12] ?? null,
|
|
107
110
|
supersedes_event_id: record[13] ?? null,
|
|
@@ -324,6 +327,7 @@ export function exactRemeasurementSegment(
|
|
|
324
327
|
? {
|
|
325
328
|
input: last.input_tokens,
|
|
326
329
|
cached_input: last.cached_input_tokens,
|
|
330
|
+
cache_write_input: last.cache_write_input_tokens ?? null,
|
|
327
331
|
output: last.output_tokens,
|
|
328
332
|
reasoning: last.reasoning_output_tokens,
|
|
329
333
|
total: last.total_tokens,
|
|
@@ -331,8 +335,8 @@ export function exactRemeasurementSegment(
|
|
|
331
335
|
: null;
|
|
332
336
|
const same = (candidate) =>
|
|
333
337
|
candidate !== null &&
|
|
334
|
-
["input", "cached_input", "output", "reasoning", "total"].every(
|
|
335
|
-
(key) => candidate[key] === sourceTokens[key],
|
|
338
|
+
["input", "cached_input", "cache_write_input", "output", "reasoning", "total"].every(
|
|
339
|
+
(key) => candidate[key] === (sourceTokens[key] ?? null),
|
|
336
340
|
);
|
|
337
341
|
return same(tokens) || same(lastTokens);
|
|
338
342
|
})
|
|
@@ -494,6 +498,7 @@ export function sameTokenSnapshot(left, right) {
|
|
|
494
498
|
left !== null &&
|
|
495
499
|
left.input_tokens === right.input_tokens &&
|
|
496
500
|
left.cached_input_tokens === right.cached_input_tokens &&
|
|
501
|
+
left.cache_write_input_tokens === right.cache_write_input_tokens &&
|
|
497
502
|
left.output_tokens === right.output_tokens &&
|
|
498
503
|
left.reasoning_output_tokens === right.reasoning_output_tokens &&
|
|
499
504
|
left.total_tokens === right.total_tokens
|
|
@@ -522,6 +527,7 @@ export function aggregate(segment) {
|
|
|
522
527
|
return {
|
|
523
528
|
input,
|
|
524
529
|
cached_input: completeSum("cached_input_tokens"),
|
|
530
|
+
cache_write_input: completeSum("cache_write_input_tokens"),
|
|
525
531
|
output,
|
|
526
532
|
reasoning: completeSum("reasoning_output_tokens"),
|
|
527
533
|
total: reportedTotal ?? (input !== null && output !== null ? input + output : null),
|
|
@@ -534,6 +540,7 @@ function tokenSnapshot(value) {
|
|
|
534
540
|
return {
|
|
535
541
|
input_tokens: finite("input_tokens"),
|
|
536
542
|
cached_input_tokens: finite("cached_input_tokens"),
|
|
543
|
+
cache_write_input_tokens: finite("cache_write_input_tokens"),
|
|
537
544
|
output_tokens: finite("output_tokens"),
|
|
538
545
|
reasoning_output_tokens: finite("reasoning_output_tokens"),
|
|
539
546
|
total_tokens: finite("total_tokens"),
|
|
@@ -551,6 +558,7 @@ export function cumulativeSnapshotDelta(previous, current) {
|
|
|
551
558
|
return {
|
|
552
559
|
input_tokens: delta("input_tokens"),
|
|
553
560
|
cached_input_tokens: delta("cached_input_tokens"),
|
|
561
|
+
cache_write_input_tokens: delta("cache_write_input_tokens"),
|
|
554
562
|
output_tokens: delta("output_tokens"),
|
|
555
563
|
reasoning_output_tokens: delta("reasoning_output_tokens"),
|
|
556
564
|
total_tokens: delta("total_tokens"),
|
|
@@ -561,6 +569,7 @@ function hasPositiveTokenDelta(usage) {
|
|
|
561
569
|
return [
|
|
562
570
|
usage.input_tokens,
|
|
563
571
|
usage.cached_input_tokens,
|
|
572
|
+
usage.cache_write_input_tokens,
|
|
564
573
|
usage.output_tokens,
|
|
565
574
|
usage.reasoning_output_tokens,
|
|
566
575
|
usage.total_tokens,
|
|
@@ -593,22 +602,30 @@ export async function pricingFor(workspace, model, tokens) {
|
|
|
593
602
|
(item) => matchesIdentity(item.id) || item.aliases?.some(matchesIdentity),
|
|
594
603
|
) ?? null;
|
|
595
604
|
if (!price) return { usd: null, brl: null };
|
|
596
|
-
const
|
|
597
|
-
const
|
|
598
|
-
|
|
605
|
+
const cacheWriteInput = tokens.cache_write_input ?? null;
|
|
606
|
+
const cacheWriteRate = price.cache_write_input_per_million_usd ?? null;
|
|
607
|
+
if (
|
|
608
|
+
(cacheWriteRate !== null && cacheWriteInput === null) ||
|
|
609
|
+
(cacheWriteInput !== null && cacheWriteInput > tokens.input) ||
|
|
610
|
+
((cacheWriteInput ?? 0) > 0 && cacheWriteRate === null)
|
|
611
|
+
) {
|
|
612
|
+
return { usd: null, brl: null };
|
|
613
|
+
}
|
|
614
|
+
const uncached = Math.max(0, tokens.input - tokens.cached_input - (cacheWriteInput ?? 0));
|
|
599
615
|
const longContext =
|
|
600
616
|
price.long_context_threshold_tokens !== null &&
|
|
601
617
|
price.long_context_threshold_tokens !== undefined &&
|
|
602
618
|
tokens.input > price.long_context_threshold_tokens;
|
|
603
619
|
const inputMultiplier = longContext ? (price.long_context_input_multiplier ?? 1) : 1;
|
|
604
620
|
const outputMultiplier = longContext ? (price.long_context_output_multiplier ?? 1) : 1;
|
|
621
|
+
if (tokens.cached_input > 0 && price.cached_input_per_million_usd == null) {
|
|
622
|
+
return { usd: null, brl: null };
|
|
623
|
+
}
|
|
605
624
|
const usd =
|
|
606
625
|
(uncached * price.input_per_million_usd * inputMultiplier +
|
|
607
626
|
tokens.cached_input * (price.cached_input_per_million_usd ?? 0) * inputMultiplier +
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
(price.reasoning_per_million_usd ?? price.output_per_million_usd) *
|
|
611
|
-
outputMultiplier) /
|
|
627
|
+
(cacheWriteInput ?? 0) * (cacheWriteRate ?? 0) * inputMultiplier +
|
|
628
|
+
tokens.output * price.output_per_million_usd * outputMultiplier) /
|
|
612
629
|
1_000_000;
|
|
613
630
|
const fxFiles = await filesUnder(join(workspace, ".agents", "config", "pricing", "fx"), ".json");
|
|
614
631
|
let rate = null;
|
|
@@ -72,7 +72,7 @@ test("normalizes compact and object Run records without changing usage totals",
|
|
|
72
72
|
"execution",
|
|
73
73
|
"test",
|
|
74
74
|
"current_context",
|
|
75
|
-
[10, 4, 3, 1, 13, "provider_reported"],
|
|
75
|
+
[10, 4, 3, 1, 13, "provider_reported", 0],
|
|
76
76
|
[0.1, 0.5],
|
|
77
77
|
];
|
|
78
78
|
const records = jsonLines(
|
|
@@ -84,6 +84,7 @@ test("normalizes compact and object Run records without changing usage totals",
|
|
|
84
84
|
assert.deepEqual(usageView(records[1]).tokens, {
|
|
85
85
|
input: 10,
|
|
86
86
|
cached_input: 4,
|
|
87
|
+
cache_write_input: 0,
|
|
87
88
|
output: 3,
|
|
88
89
|
reasoning: 1,
|
|
89
90
|
total: 13,
|
|
@@ -93,12 +94,19 @@ test("normalizes compact and object Run records without changing usage totals",
|
|
|
93
94
|
assert.deepEqual(
|
|
94
95
|
aggregate({
|
|
95
96
|
usage: [
|
|
96
|
-
{
|
|
97
|
+
{
|
|
98
|
+
input_tokens: 10,
|
|
99
|
+
cached_input_tokens: 4,
|
|
100
|
+
cache_write_input_tokens: 0,
|
|
101
|
+
output_tokens: 3,
|
|
102
|
+
reasoning_output_tokens: 1,
|
|
103
|
+
},
|
|
97
104
|
],
|
|
98
105
|
}),
|
|
99
106
|
{
|
|
100
107
|
input: 10,
|
|
101
108
|
cached_input: 4,
|
|
109
|
+
cache_write_input: 0,
|
|
102
110
|
output: 3,
|
|
103
111
|
reasoning: 1,
|
|
104
112
|
total: 13,
|
|
@@ -106,25 +114,26 @@ test("normalizes compact and object Run records without changing usage totals",
|
|
|
106
114
|
);
|
|
107
115
|
});
|
|
108
116
|
|
|
109
|
-
test("
|
|
110
|
-
const snapshot = (input, cached, output, reasoning) => ({
|
|
117
|
+
test("preserves absent, zero, and positive cache-write snapshots through deltas", () => {
|
|
118
|
+
const snapshot = (input, cached, cacheWrite, output, reasoning) => ({
|
|
111
119
|
input_tokens: input,
|
|
112
120
|
cached_input_tokens: cached,
|
|
121
|
+
cache_write_input_tokens: cacheWrite,
|
|
113
122
|
output_tokens: output,
|
|
114
123
|
reasoning_output_tokens: reasoning,
|
|
115
124
|
total_tokens: input + output,
|
|
116
125
|
});
|
|
117
126
|
assert.deepEqual(
|
|
118
|
-
cumulativeSnapshotDelta(snapshot(100, 80, 20, 5), snapshot(100, 80, 20, 5)),
|
|
119
|
-
snapshot(0, 0, 0, 0),
|
|
127
|
+
cumulativeSnapshotDelta(snapshot(100, 80, 0, 20, 5), snapshot(100, 80, 0, 20, 5)),
|
|
128
|
+
snapshot(0, 0, 0, 0, 0),
|
|
120
129
|
);
|
|
121
130
|
assert.deepEqual(
|
|
122
|
-
cumulativeSnapshotDelta(snapshot(100, 80, 20, 5), snapshot(140, 110, 35, 9)),
|
|
123
|
-
snapshot(40, 30, 15, 4),
|
|
131
|
+
cumulativeSnapshotDelta(snapshot(100, 80, 0, 20, 5), snapshot(140, 110, 10, 35, 9)),
|
|
132
|
+
snapshot(40, 30, 10, 15, 4),
|
|
124
133
|
);
|
|
125
134
|
assert.deepEqual(
|
|
126
|
-
cumulativeSnapshotDelta(snapshot(140, 110, 35, 9), snapshot(12, 8, 3, 1)),
|
|
127
|
-
snapshot(12, 8, 3, 1),
|
|
135
|
+
cumulativeSnapshotDelta(snapshot(140, 110, 10, 35, 9), snapshot(12, 8, null, 3, 1)),
|
|
136
|
+
snapshot(12, 8, null, 3, 1),
|
|
128
137
|
);
|
|
129
138
|
});
|
|
130
139
|
|
|
@@ -132,11 +141,13 @@ test("deduplicates only consecutive identical last_token_usage fallback snapshot
|
|
|
132
141
|
const snapshot = {
|
|
133
142
|
input_tokens: 10,
|
|
134
143
|
cached_input_tokens: 2,
|
|
144
|
+
cache_write_input_tokens: 0,
|
|
135
145
|
output_tokens: 3,
|
|
136
146
|
reasoning_output_tokens: 1,
|
|
137
147
|
total_tokens: 13,
|
|
138
148
|
};
|
|
139
149
|
assert.equal(sameTokenSnapshot(snapshot, { ...snapshot }), true);
|
|
150
|
+
assert.equal(sameTokenSnapshot(snapshot, { ...snapshot, cache_write_input_tokens: 1 }), false);
|
|
140
151
|
assert.equal(sameTokenSnapshot(snapshot, { ...snapshot, output_tokens: 4 }), false);
|
|
141
152
|
assert.equal(sameTokenSnapshot(null, snapshot), false);
|
|
142
153
|
});
|
|
@@ -170,6 +181,7 @@ test("prices only exact or governed model identities", async () => {
|
|
|
170
181
|
aliases: ["gpt-test-alias"],
|
|
171
182
|
input_per_million_usd: 10,
|
|
172
183
|
cached_input_per_million_usd: 1,
|
|
184
|
+
cache_write_input_per_million_usd: 12.5,
|
|
173
185
|
output_per_million_usd: 20,
|
|
174
186
|
reasoning_per_million_usd: 30,
|
|
175
187
|
long_context_threshold_tokens: null,
|
|
@@ -177,9 +189,23 @@ test("prices only exact or governed model identities", async () => {
|
|
|
177
189
|
],
|
|
178
190
|
}),
|
|
179
191
|
);
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
192
|
+
const zeroCacheWrite = {
|
|
193
|
+
input: 100,
|
|
194
|
+
cached_input: 40,
|
|
195
|
+
cache_write_input: 0,
|
|
196
|
+
output: 20,
|
|
197
|
+
reasoning: 5,
|
|
198
|
+
};
|
|
199
|
+
assert.equal(
|
|
200
|
+
(await pricingFor(root, "gpt-test", { ...zeroCacheWrite, cache_write_input: null })).usd,
|
|
201
|
+
null,
|
|
202
|
+
);
|
|
203
|
+
assert.equal((await pricingFor(root, "gpt-test", zeroCacheWrite)).usd, 0.00104);
|
|
204
|
+
assert.equal(
|
|
205
|
+
(await pricingFor(root, "gpt-test", { ...zeroCacheWrite, cache_write_input: 10 })).usd,
|
|
206
|
+
0.001065,
|
|
207
|
+
);
|
|
208
|
+
const tokens = zeroCacheWrite;
|
|
183
209
|
assert.equal((await pricingFor(root, "unknown", tokens)).usd, null);
|
|
184
210
|
});
|
|
185
211
|
|
|
@@ -74,6 +74,7 @@ export const remeasureSelectedRuns = async ({
|
|
|
74
74
|
const unchanged =
|
|
75
75
|
superseded.tokens.input === tokens.input &&
|
|
76
76
|
superseded.tokens.cached_input === tokens.cached_input &&
|
|
77
|
+
superseded.tokens.cache_write_input === tokens.cache_write_input &&
|
|
77
78
|
superseded.tokens.output === tokens.output &&
|
|
78
79
|
superseded.tokens.reasoning === tokens.reasoning &&
|
|
79
80
|
superseded.tokens.total === tokens.total;
|