@zaip-ai/cli 0.1.0 → 1.0.1
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/README.md +17 -9
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +5 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -2
- package/dist/index.js.map +1 -1
- package/dist/services/adapters.d.ts +17 -0
- package/dist/services/adapters.d.ts.map +1 -0
- package/dist/services/adapters.js +790 -0
- package/dist/services/adapters.js.map +1 -0
- package/dist/services/adapters.test.d.ts +2 -0
- package/dist/services/adapters.test.d.ts.map +1 -0
- package/dist/services/adapters.test.js +25 -0
- package/dist/services/adapters.test.js.map +1 -0
- package/dist/services/agent-adapters.d.ts +41 -0
- package/dist/services/agent-adapters.d.ts.map +1 -0
- package/dist/services/agent-adapters.js +122 -0
- package/dist/services/agent-adapters.js.map +1 -0
- package/dist/services/agent-adapters.test.d.ts +2 -0
- package/dist/services/agent-adapters.test.d.ts.map +1 -0
- package/dist/services/agent-adapters.test.js +40 -0
- package/dist/services/agent-adapters.test.js.map +1 -0
- package/dist/services/codex-rules.d.ts +3 -0
- package/dist/services/codex-rules.d.ts.map +1 -0
- package/dist/services/codex-rules.js +114 -0
- package/dist/services/codex-rules.js.map +1 -0
- package/dist/services/doctor.d.ts +12 -0
- package/dist/services/doctor.d.ts.map +1 -0
- package/dist/services/doctor.js +207 -0
- package/dist/services/doctor.js.map +1 -0
- package/dist/services/global-codex-config.d.ts +15 -0
- package/dist/services/global-codex-config.d.ts.map +1 -0
- package/dist/services/global-codex-config.js +48 -0
- package/dist/services/global-codex-config.js.map +1 -0
- package/dist/services/global-codex-config.test.d.ts +2 -0
- package/dist/services/global-codex-config.test.d.ts.map +1 -0
- package/dist/services/global-codex-config.test.js +102 -0
- package/dist/services/global-codex-config.test.js.map +1 -0
- package/dist/services/install-agents-template.d.ts.map +1 -1
- package/dist/services/install-agents-template.js +174 -79
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/logger.d.ts.map +1 -1
- package/dist/services/logger.js +13 -3
- package/dist/services/logger.js.map +1 -1
- package/dist/services/logger.test.d.ts +2 -0
- package/dist/services/logger.test.d.ts.map +1 -0
- package/dist/services/logger.test.js +32 -0
- package/dist/services/logger.test.js.map +1 -0
- package/dist/services/runtime-template.test.d.ts +2 -0
- package/dist/services/runtime-template.test.d.ts.map +1 -0
- package/dist/services/runtime-template.test.js +199 -0
- package/dist/services/runtime-template.test.js.map +1 -0
- package/dist/services/template-manifest.d.ts +6 -2
- package/dist/services/template-manifest.d.ts.map +1 -1
- package/dist/services/template-manifest.js +93 -10
- package/dist/services/template-manifest.js.map +1 -1
- package/dist/services/transactional-files.d.ts +11 -0
- package/dist/services/transactional-files.d.ts.map +1 -0
- package/dist/services/transactional-files.js +114 -0
- package/dist/services/transactional-files.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +4 -2
- package/templates/.agents/config/agents/catalog.yaml +246 -0
- package/templates/.agents/config/framework.lock.yaml +1 -1
- package/templates/.agents/config/project.yaml +8 -0
- package/templates/.agents/config/src/icon_zaip.png +0 -0
- package/templates/.agents/dashboard/.zaip-managed.json +46 -0
- package/templates/.agents/dashboard/README.md +91 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-BOLwg8VW.js +1009 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-_yxs47Hd.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/logo_novo_azul-BBx5pA2B.png +0 -0
- package/templates/.agents/dashboard/apps/frontend/dist/icon_zaip.png +0 -0
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +15 -0
- package/templates/.agents/dashboard/apps/frontend/dist/logo_novo_azul.png +0 -0
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +179 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +726 -0
- package/templates/.agents/dashboard/zaip-dashboard.exe +0 -0
- package/templates/.agents/design/DESIGN.md +180 -0
- package/templates/.agents/design/README.md +47 -0
- package/templates/.agents/design/apps/catalog/.storybook/main.ts +15 -0
- package/templates/.agents/design/apps/catalog/.storybook/preview.ts +21 -0
- package/templates/.agents/design/apps/catalog/dist/assets/index-B4pfFtvJ.css +1 -0
- package/templates/.agents/design/apps/catalog/dist/assets/index-Bvwc3Bgw.js +9 -0
- package/templates/.agents/design/apps/catalog/dist/index.html +14 -0
- package/templates/.agents/design/apps/catalog/dist/logo_novo_azul.png +0 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/Color-6AOWCN3U-D8qyAXo4.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/Components.stories-DkBtOSHX.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/DesignSystem.stories-BttERyCr.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/DocsRenderer-JROSPFPF-LmiVo77Q.js +46 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/Primitives-HZpQ6PjX.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/WithTooltip-7X4HQR7L-CTMWAwDe.js +9 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/axe-Bk3eEgJf.js +20 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/chunk-242VQQM5-DB2JSNUA.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/chunk-DRQKCCAG-DUhJxxRU.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/chunk-QQBDHPVZ-nYh9QWsm.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/chunk-W22LQPXL-9RCn9-l7.js +18 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/components-BX1OfYUi.js +243 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/formatter-L2YTDE3Q-Bu6KfEwW.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/iframe-B4pfFtvJ.css +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/iframe-LMhZM1ce.js +1154 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/jsx-runtime-f3rHp9ZU.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/matchers-JIUQ3HVY-9iRExWZO.js +28 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/preload-helper-BdFrVu1K.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/react-18-jAz3avmR.js +9 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/react-DvDPBd6Q.js +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/syntaxhighlighter-YFXUGROL-DV8X2acD.js +6 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/assets/theming-CHbHkcNi.js +39 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/favicon-wrapper.svg +46 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/favicon.svg +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/iframe.html +710 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/index.html +152 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/index.json +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/logo_novo_azul.png +0 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/nunito-sans-bold-italic.woff2 +0 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/nunito-sans-bold.woff2 +0 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/nunito-sans-italic.woff2 +0 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/nunito-sans-regular.woff2 +0 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/a11y-2/manager-bundle.js +57 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/docs-1/manager-bundle.js +18 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +632 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/favicon-wrapper.svg +46 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/favicon.svg +1 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-manager/globals-runtime.js +78957 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-manager/globals.js +24 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-manager/manager-stores.js +23 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/sb-manager/runtime.js +28253 -0
- package/templates/.agents/design/apps/catalog/dist/storybook/vite-inject-mocker-entry.js +2 -0
- package/templates/.agents/design/apps/catalog/index.html +13 -0
- package/templates/.agents/design/apps/catalog/package.json +32 -0
- package/templates/.agents/design/apps/catalog/public/logo_novo_azul.png +0 -0
- package/templates/.agents/design/apps/catalog/src/App.tsx +29 -0
- package/templates/.agents/design/apps/catalog/src/components/CatalogShell.tsx +78 -0
- package/templates/.agents/design/apps/catalog/src/components/Primitives.tsx +137 -0
- package/templates/.agents/design/apps/catalog/src/design-contract.test.ts +33 -0
- package/templates/.agents/design/apps/catalog/src/main.tsx +13 -0
- package/templates/.agents/design/apps/catalog/src/pages/ComponentsPage.tsx +83 -0
- package/templates/.agents/design/apps/catalog/src/pages/DesignSystemPage.tsx +185 -0
- package/templates/.agents/design/apps/catalog/src/stories/Components.stories.tsx +12 -0
- package/templates/.agents/design/apps/catalog/src/stories/DesignSystem.stories.tsx +12 -0
- package/templates/.agents/design/apps/catalog/src/styles/catalog.css +315 -0
- package/templates/.agents/design/apps/catalog/src/styles/components.css +228 -0
- package/templates/.agents/design/apps/catalog/src/styles/design-system.css +137 -0
- package/templates/.agents/design/apps/catalog/src/styles.css +85 -0
- package/templates/.agents/design/apps/catalog/tsconfig.json +16 -0
- package/templates/.agents/design/apps/catalog/vite.config.ts +10 -0
- package/templates/.agents/design/apps/catalog/vitest.config.ts +5 -0
- package/templates/.agents/design/packages/local-runtime/package.json +9 -0
- package/templates/.agents/design/packages/local-runtime/runtime.mjs +238 -0
- package/templates/.agents/design/packages/local-runtime/runtime.test.mjs +66 -0
- package/templates/.agents/design/packages/local-runtime/start-design.mjs +46 -0
- package/templates/.agents/design/packages/windows-launcher/Program.cs +110 -0
- package/templates/.agents/design/packages/windows-launcher/build-design-launcher.ps1 +107 -0
- package/templates/.agents/design/tokens.json +52 -0
- package/templates/.agents/design/zaip-design.exe +0 -0
- package/templates/.agents/requirements/autonomous-assurance.md +63 -0
- package/templates/.agents/requirements/context-engine.md +27 -3
- package/templates/.agents/requirements/cost-observability.md +22 -3
- package/templates/.agents/requirements/design-system.md +48 -0
- package/templates/.agents/requirements/execution-engine.md +33 -8
- package/templates/.agents/requirements/kanban-dashboard.md +13 -4
- package/templates/.agents/requirements/model-orchestration.md +58 -0
- package/templates/.agents/requirements/public-distribution.md +40 -0
- package/templates/.agents/requirements/software-architecture.md +57 -0
- package/templates/.agents/requirements/work-lifecycle.md +61 -6
- package/templates/.agents/rules/project/.gitkeep +0 -0
- package/templates/.agents/rules/zaip/architecture.md +28 -0
- package/templates/.agents/rules/zaip/context.md +22 -0
- package/templates/.agents/rules/zaip/core.md +24 -0
- package/templates/.agents/rules/zaip/evolution.md +22 -0
- package/templates/.agents/rules/zaip/model-orchestration.md +48 -0
- package/templates/.agents/rules/zaip/workflow.md +35 -0
- package/templates/.agents/skills/zaip-skill-adapt-stack/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-adapt-stack/agents/openai.yaml +3 -3
- package/templates/.agents/skills/zaip-skill-adapters/SKILL.md +9 -6
- package/templates/.agents/skills/zaip-skill-adapters/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-api-to-mcp/SKILL.md +19 -0
- package/templates/.agents/skills/zaip-skill-api-to-mcp/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-api-to-mcp/assets/adapter.example.yaml +26 -0
- package/templates/.agents/skills/zaip-skill-api-to-mcp/references/security-contract.md +10 -0
- package/templates/.agents/skills/zaip-skill-api-to-mcp/references/server-layout.md +19 -0
- package/templates/.agents/skills/zaip-skill-api-to-mcp/scripts/inspect-openapi.mjs +60 -0
- package/templates/.agents/skills/zaip-skill-api-to-mcp/scripts/scaffold-local-mcp.mjs +47 -0
- package/templates/.agents/skills/zaip-skill-author-skills/SKILL.md +21 -0
- package/templates/.agents/skills/zaip-skill-author-skills/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-change/SKILL.md +20 -0
- package/templates/.agents/skills/zaip-skill-change/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-config/SKILL.md +22 -0
- package/templates/.agents/skills/zaip-skill-config/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-context/SKILL.md +10 -6
- package/templates/.agents/skills/zaip-skill-context/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-cqrs/SKILL.md +2 -2
- package/templates/.agents/skills/zaip-skill-cqrs/agents/openai.yaml +3 -3
- package/templates/.agents/skills/zaip-skill-decisions/SKILL.md +7 -5
- package/templates/.agents/skills/zaip-skill-decisions/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-enforce-architecture/SKILL.md +8 -5
- package/templates/.agents/skills/zaip-skill-enforce-architecture/agents/openai.yaml +3 -3
- package/templates/.agents/skills/zaip-skill-eval/SKILL.md +7 -5
- package/templates/.agents/skills/zaip-skill-eval/agents/openai.yaml +3 -3
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +36 -0
- package/templates/.agents/skills/zaip-skill-execution/agents/openai.yaml +6 -0
- package/templates/.agents/skills/zaip-skill-execution/references/prepared-plan.md +31 -0
- package/templates/.agents/skills/zaip-skill-frontend-launcher/SKILL.md +29 -0
- package/templates/.agents/skills/zaip-skill-frontend-launcher/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-frontend-launcher/references/launcher-contract.md +36 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +49 -58
- package/templates/.agents/skills/zaip-skill-github-deploy/agents/openai.yaml +3 -3
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.mjs +256 -0
- package/templates/.agents/skills/zaip-skill-github-setup/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-move-prd/SKILL.md +37 -0
- package/templates/.agents/skills/zaip-skill-move-prd/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-move-spec/SKILL.md +38 -0
- package/templates/.agents/skills/zaip-skill-move-spec/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-navigate-work/SKILL.md +9 -6
- package/templates/.agents/skills/zaip-skill-navigate-work/agents/openai.yaml +3 -3
- package/templates/.agents/skills/zaip-skill-observability/SKILL.md +24 -0
- package/templates/.agents/skills/zaip-skill-observability/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-openai-docs/SKILL.md +17 -0
- package/templates/.agents/skills/zaip-skill-openai-docs/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-openai-docs/references/routing.md +11 -0
- package/templates/.agents/skills/zaip-skill-prd/SKILL.md +37 -6
- package/templates/.agents/skills/zaip-skill-prd/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-preview/SKILL.md +16 -0
- package/templates/.agents/skills/zaip-skill-preview/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/SKILL.md +39 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/inspect-local-sqlite.py +52 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/normalize-run-agents.mjs +63 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +698 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +361 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +187 -0
- package/templates/.agents/skills/zaip-skill-requirements/SKILL.md +10 -6
- package/templates/.agents/skills/zaip-skill-requirements/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-review/SKILL.md +18 -0
- package/templates/.agents/skills/zaip-skill-review/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-rules/SKILL.md +19 -0
- package/templates/.agents/skills/zaip-skill-rules/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-security/SKILL.md +30 -0
- package/templates/.agents/skills/zaip-skill-security/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-setup/SKILL.md +19 -6
- package/templates/.agents/skills/zaip-skill-setup/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-spec/SKILL.md +39 -6
- package/templates/.agents/skills/zaip-skill-spec/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-task/SKILL.md +36 -8
- package/templates/.agents/skills/zaip-skill-task/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-text-encoding/SKILL.md +3 -3
- package/templates/.agents/skills/zaip-skill-tool-setup/SKILL.md +22 -0
- package/templates/.agents/skills/zaip-skill-tool-setup/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-tool-setup/references/codex-config.md +24 -0
- package/templates/.agents/skills/zaip-skill-tool-setup/references/secrets.md +8 -0
- package/templates/.agents/skills/zaip-skill-tool-setup/scripts/configure-local-mcp.mjs +52 -0
- package/templates/.agents/skills/zaip-skill-tool-setup/scripts/inspect-tool.mjs +35 -0
- package/templates/.agents/skills/zaip-skill-tool-setup/scripts/tool-state.mjs +26 -0
- package/templates/.agents/tools/README.md +9 -0
- package/templates/.agents/tools/api/asaas/README.md +22 -0
- package/templates/.agents/tools/api/asaas/manifest.yaml +20 -0
- package/templates/.agents/tools/api/github/README.md +22 -0
- package/templates/.agents/tools/api/github/manifest.yaml +20 -0
- package/templates/.agents/tools/api/google-ads/README.md +23 -0
- package/templates/.agents/tools/api/google-ads/manifest.yaml +21 -0
- package/templates/.agents/tools/api/google-analytics/README.md +22 -0
- package/templates/.agents/tools/api/google-analytics/manifest.yaml +20 -0
- package/templates/.agents/tools/api/google-search-console/README.md +21 -0
- package/templates/.agents/tools/api/google-search-console/manifest.yaml +19 -0
- package/templates/.agents/tools/api/google-tag-manager/README.md +22 -0
- package/templates/.agents/tools/api/google-tag-manager/manifest.yaml +20 -0
- package/templates/.agents/tools/api/hubspot/README.md +22 -0
- package/templates/.agents/tools/api/hubspot/manifest.yaml +20 -0
- package/templates/.agents/tools/api/instagram-graph/README.md +23 -0
- package/templates/.agents/tools/api/instagram-graph/manifest.yaml +21 -0
- package/templates/.agents/tools/api/kommo-crm/README.md +23 -0
- package/templates/.agents/tools/api/kommo-crm/manifest.yaml +21 -0
- package/templates/.agents/tools/api/linkedin-ads/README.md +23 -0
- package/templates/.agents/tools/api/linkedin-ads/manifest.yaml +21 -0
- package/templates/.agents/tools/api/meta-ads/README.md +23 -0
- package/templates/.agents/tools/api/meta-ads/manifest.yaml +21 -0
- package/templates/.agents/tools/api/openai/README.md +22 -0
- package/templates/.agents/tools/api/openai/manifest.yaml +20 -0
- package/templates/.agents/tools/api/shopify/README.md +23 -0
- package/templates/.agents/tools/api/shopify/manifest.yaml +21 -0
- package/templates/.agents/tools/api/slack/README.md +22 -0
- package/templates/.agents/tools/api/slack/manifest.yaml +20 -0
- package/templates/.agents/tools/api/stripe/README.md +22 -0
- package/templates/.agents/tools/api/stripe/manifest.yaml +20 -0
- package/templates/.agents/tools/api/tiktok-ads/README.md +23 -0
- package/templates/.agents/tools/api/tiktok-ads/manifest.yaml +21 -0
- package/templates/.agents/tools/api/youtube-analytics/README.md +22 -0
- package/templates/.agents/tools/api/youtube-analytics/manifest.yaml +20 -0
- package/templates/.agents/tools/catalog.yaml +358 -0
- package/templates/.agents/tools/mcp/development/browser/README.md +20 -0
- package/templates/.agents/tools/mcp/development/browser/manifest.yaml +24 -0
- package/templates/.agents/tools/mcp/development/filesystem/README.md +20 -0
- package/templates/.agents/tools/mcp/development/filesystem/manifest.yaml +24 -0
- package/templates/.agents/tools/mcp/development/git/README.md +20 -0
- package/templates/.agents/tools/mcp/development/git/manifest.yaml +24 -0
- package/templates/.agents/tools/mcp/development/github/README.md +20 -0
- package/templates/.agents/tools/mcp/development/github/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/development/gitlab/README.md +20 -0
- package/templates/.agents/tools/mcp/development/gitlab/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/development/jira/README.md +21 -0
- package/templates/.agents/tools/mcp/development/jira/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/development/linear/README.md +20 -0
- package/templates/.agents/tools/mcp/development/linear/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/development/notion/README.md +20 -0
- package/templates/.agents/tools/mcp/development/notion/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/development/openai-docs/README.md +15 -0
- package/templates/.agents/tools/mcp/development/openai-docs/manifest.yaml +21 -0
- package/templates/.agents/tools/mcp/development/postgresql/README.md +20 -0
- package/templates/.agents/tools/mcp/development/postgresql/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/development/slack/README.md +20 -0
- package/templates/.agents/tools/mcp/development/slack/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/development/sqlite/README.md +20 -0
- package/templates/.agents/tools/mcp/development/sqlite/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/infra/aws/README.md +21 -0
- package/templates/.agents/tools/mcp/infra/aws/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/infra/azure/README.md +20 -0
- package/templates/.agents/tools/mcp/infra/azure/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/infra/cloudflare/README.md +21 -0
- package/templates/.agents/tools/mcp/infra/cloudflare/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/infra/docker/README.md +20 -0
- package/templates/.agents/tools/mcp/infra/docker/manifest.yaml +24 -0
- package/templates/.agents/tools/mcp/infra/gcp/README.md +21 -0
- package/templates/.agents/tools/mcp/infra/gcp/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/infra/hostinger/README.md +20 -0
- package/templates/.agents/tools/mcp/infra/hostinger/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/infra/kubernetes/README.md +20 -0
- package/templates/.agents/tools/mcp/infra/kubernetes/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/infra/terraform/README.md +20 -0
- package/templates/.agents/tools/mcp/infra/terraform/manifest.yaml +24 -0
- package/templates/.agents/tools/mcp/marketing/google-ads/README.md +21 -0
- package/templates/.agents/tools/mcp/marketing/google-ads/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/marketing/google-analytics/README.md +20 -0
- package/templates/.agents/tools/mcp/marketing/google-analytics/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/marketing/google-search-console/README.md +19 -0
- package/templates/.agents/tools/mcp/marketing/google-search-console/manifest.yaml +24 -0
- package/templates/.agents/tools/mcp/marketing/google-tag-manager/README.md +21 -0
- package/templates/.agents/tools/mcp/marketing/google-tag-manager/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/marketing/hubspot/README.md +20 -0
- package/templates/.agents/tools/mcp/marketing/hubspot/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/marketing/instagram-insights/README.md +21 -0
- package/templates/.agents/tools/mcp/marketing/instagram-insights/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/marketing/linkedin-ads/README.md +21 -0
- package/templates/.agents/tools/mcp/marketing/linkedin-ads/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/marketing/mailchimp/README.md +21 -0
- package/templates/.agents/tools/mcp/marketing/mailchimp/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/marketing/meta-ads/README.md +21 -0
- package/templates/.agents/tools/mcp/marketing/meta-ads/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/marketing/semrush/README.md +20 -0
- package/templates/.agents/tools/mcp/marketing/semrush/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/marketing/tiktok-ads/README.md +21 -0
- package/templates/.agents/tools/mcp/marketing/tiktok-ads/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/marketing/youtube-analytics/README.md +21 -0
- package/templates/.agents/tools/mcp/marketing/youtube-analytics/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/observability/cloudwatch/README.md +21 -0
- package/templates/.agents/tools/mcp/observability/cloudwatch/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/observability/datadog/README.md +21 -0
- package/templates/.agents/tools/mcp/observability/datadog/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/observability/elasticsearch/README.md +21 -0
- package/templates/.agents/tools/mcp/observability/elasticsearch/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/observability/grafana/README.md +21 -0
- package/templates/.agents/tools/mcp/observability/grafana/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/observability/kibana/README.md +21 -0
- package/templates/.agents/tools/mcp/observability/kibana/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/observability/loki/README.md +19 -0
- package/templates/.agents/tools/mcp/observability/loki/manifest.yaml +24 -0
- package/templates/.agents/tools/mcp/observability/new-relic/README.md +21 -0
- package/templates/.agents/tools/mcp/observability/new-relic/manifest.yaml +26 -0
- package/templates/.agents/tools/mcp/observability/opentelemetry/README.md +20 -0
- package/templates/.agents/tools/mcp/observability/opentelemetry/manifest.yaml +25 -0
- package/templates/.agents/tools/mcp/observability/prometheus/README.md +19 -0
- package/templates/.agents/tools/mcp/observability/prometheus/manifest.yaml +24 -0
- package/templates/.agents/tools/mcp/observability/sentry/README.md +21 -0
- package/templates/.agents/tools/mcp/observability/sentry/manifest.yaml +26 -0
- package/templates/.agents/tools/policies/approval-rules.yaml +8 -0
- package/templates/.agents/tools/policies/financial-limits.yaml +6 -0
- package/templates/.agents/tools/policies/permissions.yaml +8 -0
- package/templates/.agents/tools/policies/secret-handling.md +7 -0
- package/templates/.agents/tools/profiles/business.yaml +8 -0
- package/templates/.agents/tools/profiles/default.yaml +8 -0
- package/templates/.agents/tools/profiles/development.yaml +13 -0
- package/templates/.agents/tools/profiles/infrastructure.yaml +8 -0
- package/templates/.agents/tools/profiles/marketing.yaml +9 -0
- package/templates/.agents/tools/profiles/observability.yaml +8 -0
- package/templates/.agents/tools/runtime/README.md +3 -0
- package/templates/.agents/tools/runtime/api-mcp-runtime.mjs +217 -0
- package/templates/.agents/tools/runtime/api-mcp-runtime.test.mjs +56 -0
- package/templates/.agents/tools/runtime/fixtures/definition.json +17 -0
- package/templates/.agents/tools/runtime/runner.mjs +16 -0
- package/templates/.agents/tools/runtime/stdio.test.mjs +32 -0
- package/templates/.agents/tools/state.example.yaml +8 -0
- package/templates/.agents/zaip-aios/INDEX.md +26 -0
- package/templates/.agents/zaip-aios/README.md +13 -0
- package/templates/.agents/zaip-aios/VERSION +1 -0
- package/templates/.agents/zaip-aios/guides/01-primeiros-passos.md +10 -0
- package/templates/.agents/zaip-aios/guides/02-requirements.md +12 -0
- package/templates/.agents/zaip-aios/guides/03-tasks.md +12 -0
- package/templates/.agents/zaip-aios/guides/04-specs.md +16 -0
- package/templates/.agents/zaip-aios/guides/05-prds.md +13 -0
- package/templates/.agents/zaip-aios/guides/06-execucao.md +13 -0
- package/templates/.agents/zaip-aios/guides/07-revisao-e-validacao.md +8 -0
- package/templates/.agents/zaip-aios/guides/08-contexto-e-tokens.md +10 -0
- package/templates/.agents/zaip-aios/guides/09-agentes-e-squads.md +8 -0
- package/templates/.agents/zaip-aios/guides/10-seguranca.md +206 -0
- package/templates/.agents/zaip-aios/guides/11-observabilidade-e-custos.md +10 -0
- package/templates/.agents/zaip-aios/guides/12-instalacao-e-upgrade.md +10 -0
- package/templates/.agents/zaip-aios/guides/13-boas-praticas.md +12 -0
- package/templates/.agents/zaip-aios/guides/14-troubleshooting.md +12 -0
- package/templates/.agents/zaip-aios/guides/15-tools-e-codex.md +25 -0
- package/templates/.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +47 -0
- package/templates/.zaip-aios/LICENSE +1 -0
- package/templates/.zaip-aios/THIRD_PARTY_NOTICES.md +10 -0
- package/templates/.zaip-aios/VERSION +1 -0
- package/templates/.zaip-aios/bin/zaip.mjs +1285 -0
- package/templates/.zaip-aios/checksums.sha256 +369 -0
- package/templates/.zaip-aios/dashboard/.zaip-managed.json +46 -0
- package/templates/.zaip-aios/dashboard/README.md +91 -0
- package/templates/.zaip-aios/dashboard/apps/frontend/dist/assets/index-BOLwg8VW.js +1009 -0
- package/templates/.zaip-aios/dashboard/apps/frontend/dist/assets/index-_yxs47Hd.css +1 -0
- package/templates/.zaip-aios/dashboard/apps/frontend/dist/assets/logo_novo_azul-BBx5pA2B.png +0 -0
- package/templates/.zaip-aios/dashboard/apps/frontend/dist/icon_zaip.png +0 -0
- package/templates/.zaip-aios/dashboard/apps/frontend/dist/index.html +15 -0
- package/templates/.zaip-aios/dashboard/apps/frontend/dist/logo_novo_azul.png +0 -0
- package/templates/.zaip-aios/dashboard/packages/local-runtime/server.mjs +179 -0
- package/templates/.zaip-aios/dashboard/packages/local-runtime/start-dashboard.mjs +726 -0
- package/templates/.zaip-aios/dashboard/zaip-dashboard.exe +0 -0
- package/templates/.zaip-aios/design/.zaip-managed.json +330 -0
- package/templates/.zaip-aios/design/DESIGN.md +180 -0
- package/templates/.zaip-aios/design/README.md +47 -0
- package/templates/.zaip-aios/design/apps/catalog/.storybook/main.ts +15 -0
- package/templates/.zaip-aios/design/apps/catalog/.storybook/preview.ts +21 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/assets/index-B4pfFtvJ.css +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/assets/index-Bvwc3Bgw.js +9 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/index.html +14 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/logo_novo_azul.png +0 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/Color-6AOWCN3U-D8qyAXo4.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/Components.stories-DkBtOSHX.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/DesignSystem.stories-BttERyCr.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/DocsRenderer-JROSPFPF-LmiVo77Q.js +46 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/Primitives-HZpQ6PjX.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/WithTooltip-7X4HQR7L-CTMWAwDe.js +9 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/axe-Bk3eEgJf.js +20 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/chunk-242VQQM5-DB2JSNUA.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/chunk-DRQKCCAG-DUhJxxRU.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/chunk-QQBDHPVZ-nYh9QWsm.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/chunk-W22LQPXL-9RCn9-l7.js +18 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/components-BX1OfYUi.js +243 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/formatter-L2YTDE3Q-Bu6KfEwW.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/iframe-B4pfFtvJ.css +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/iframe-LMhZM1ce.js +1154 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/jsx-runtime-f3rHp9ZU.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/matchers-JIUQ3HVY-9iRExWZO.js +28 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/preload-helper-BdFrVu1K.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/react-18-jAz3avmR.js +9 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/react-DvDPBd6Q.js +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/syntaxhighlighter-YFXUGROL-DV8X2acD.js +6 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/theming-CHbHkcNi.js +39 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/favicon-wrapper.svg +46 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/favicon.svg +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/iframe.html +710 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/index.html +152 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/index.json +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/logo_novo_azul.png +0 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/nunito-sans-bold-italic.woff2 +0 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/nunito-sans-bold.woff2 +0 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/nunito-sans-italic.woff2 +0 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/nunito-sans-regular.woff2 +0 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-addons/a11y-2/manager-bundle.js +57 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-addons/docs-1/manager-bundle.js +18 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +632 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/favicon-wrapper.svg +46 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/favicon.svg +1 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-manager/globals-runtime.js +78957 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-manager/globals.js +24 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-manager/manager-stores.js +23 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-manager/runtime.js +28253 -0
- package/templates/.zaip-aios/design/apps/catalog/dist/storybook/vite-inject-mocker-entry.js +2 -0
- package/templates/.zaip-aios/design/apps/catalog/index.html +13 -0
- package/templates/.zaip-aios/design/apps/catalog/package.json +32 -0
- package/templates/.zaip-aios/design/apps/catalog/public/logo_novo_azul.png +0 -0
- package/templates/.zaip-aios/design/apps/catalog/src/App.tsx +29 -0
- package/templates/.zaip-aios/design/apps/catalog/src/components/CatalogShell.tsx +78 -0
- package/templates/.zaip-aios/design/apps/catalog/src/components/Primitives.tsx +137 -0
- package/templates/.zaip-aios/design/apps/catalog/src/design-contract.test.ts +33 -0
- package/templates/.zaip-aios/design/apps/catalog/src/main.tsx +13 -0
- package/templates/.zaip-aios/design/apps/catalog/src/pages/ComponentsPage.tsx +83 -0
- package/templates/.zaip-aios/design/apps/catalog/src/pages/DesignSystemPage.tsx +185 -0
- package/templates/.zaip-aios/design/apps/catalog/src/stories/Components.stories.tsx +12 -0
- package/templates/.zaip-aios/design/apps/catalog/src/stories/DesignSystem.stories.tsx +12 -0
- package/templates/.zaip-aios/design/apps/catalog/src/styles/catalog.css +315 -0
- package/templates/.zaip-aios/design/apps/catalog/src/styles/components.css +228 -0
- package/templates/.zaip-aios/design/apps/catalog/src/styles/design-system.css +137 -0
- package/templates/.zaip-aios/design/apps/catalog/src/styles.css +85 -0
- package/templates/.zaip-aios/design/apps/catalog/tsconfig.json +16 -0
- package/templates/.zaip-aios/design/apps/catalog/vite.config.ts +10 -0
- package/templates/.zaip-aios/design/apps/catalog/vitest.config.ts +5 -0
- package/templates/.zaip-aios/design/packages/local-runtime/package.json +9 -0
- package/templates/.zaip-aios/design/packages/local-runtime/runtime.mjs +238 -0
- package/templates/.zaip-aios/design/packages/local-runtime/runtime.test.mjs +66 -0
- package/templates/.zaip-aios/design/packages/local-runtime/start-design.mjs +46 -0
- package/templates/.zaip-aios/design/packages/windows-launcher/Program.cs +110 -0
- package/templates/.zaip-aios/design/packages/windows-launcher/build-design-launcher.ps1 +107 -0
- package/templates/.zaip-aios/design/tokens.json +52 -0
- package/templates/.zaip-aios/design/zaip-design.exe +0 -0
- package/templates/.zaip-aios/manifest.json +376 -0
- package/templates/.zaip-aios/migrations/001-layout-v1.json +5 -0
- package/templates/.zaip-aios/migrations/002-layout-v2.json +6 -0
- package/templates/.zaip-aios/pricing/fx/2026/07/12/usd-brl.json +9 -0
- package/templates/.zaip-aios/pricing/models.json +172 -0
- package/templates/.zaip-aios/profiles/clients.json +506 -0
- package/templates/.zaip-aios/profiles/fixtures/architecture/negative/modules/orders/application/queries/list.query.ts +5 -0
- package/templates/.zaip-aios/profiles/fixtures/architecture/negative/modules/orders/domain/order.ts +3 -0
- package/templates/.zaip-aios/profiles/fixtures/architecture/positive/modules/orders/application/queries/list.query.ts +5 -0
- package/templates/.zaip-aios/profiles/typescript-hono-kysely.json +41 -0
- package/templates/.zaip-aios/sbom.cdx.json +3440 -0
- package/templates/.zaip-aios/schemas/contracts.schema.json +243 -0
- package/templates/.zaip-aios/templates/config/agents/catalog.yaml +246 -0
- package/templates/.zaip-aios/templates/requirements/.gitkeep +0 -0
- package/templates/.zaip-aios/templates/requirements/autonomous-assurance.md +63 -0
- package/templates/.zaip-aios/templates/requirements/context-engine.md +44 -0
- package/templates/.zaip-aios/templates/requirements/cost-observability.md +39 -0
- package/templates/.zaip-aios/templates/requirements/design-system.md +48 -0
- package/templates/.zaip-aios/templates/requirements/execution-engine.md +60 -0
- package/templates/.zaip-aios/templates/requirements/kanban-dashboard.md +30 -0
- package/templates/.zaip-aios/templates/requirements/model-orchestration.md +58 -0
- package/templates/.zaip-aios/templates/requirements/public-distribution.md +40 -0
- package/templates/.zaip-aios/templates/requirements/software-architecture.md +57 -0
- package/templates/.zaip-aios/templates/requirements/work-lifecycle.md +82 -0
- package/templates/.zaip-aios/templates/rules/project/.gitkeep +0 -0
- package/templates/.zaip-aios/templates/rules/zaip/architecture.md +28 -0
- package/templates/.zaip-aios/templates/rules/zaip/context.md +22 -0
- package/templates/.zaip-aios/templates/rules/zaip/core.md +24 -0
- package/templates/.zaip-aios/templates/rules/zaip/evolution.md +22 -0
- package/templates/.zaip-aios/templates/rules/zaip/model-orchestration.md +48 -0
- package/templates/.zaip-aios/templates/rules/zaip/security.md +20 -0
- package/templates/.zaip-aios/templates/rules/zaip/workflow.md +35 -0
- package/templates/.zaip-aios/templates/skills/.gitkeep +0 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-adapt-stack/SKILL.md +11 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-adapt-stack/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-adapters/SKILL.md +15 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-adapters/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/SKILL.md +19 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/assets/adapter.example.yaml +26 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/references/security-contract.md +10 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/references/server-layout.md +19 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/scripts/inspect-openapi.mjs +60 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/scripts/scaffold-local-mcp.mjs +47 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-author-skills/SKILL.md +21 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-author-skills/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-change/SKILL.md +20 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-change/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-config/SKILL.md +22 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-config/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-context/SKILL.md +16 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-context/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-cqrs/SKILL.md +11 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-cqrs/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-decisions/SKILL.md +14 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-decisions/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-enforce-architecture/SKILL.md +14 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-enforce-architecture/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-eval/SKILL.md +14 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-eval/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-execution/SKILL.md +36 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-execution/agents/openai.yaml +6 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-execution/references/prepared-plan.md +31 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-frontend-launcher/SKILL.md +29 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-frontend-launcher/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-frontend-launcher/references/launcher-contract.md +36 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-github-deploy/SKILL.md +75 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-github-deploy/agents/openai.yaml +6 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-github-deploy/scripts/preflight.mjs +256 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-github-setup/SKILL.md +80 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-github-setup/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-move-prd/SKILL.md +37 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-move-prd/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-move-spec/SKILL.md +38 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-move-spec/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-navigate-work/SKILL.md +16 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-navigate-work/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-observability/SKILL.md +24 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-observability/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-openai-docs/SKILL.md +17 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-openai-docs/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-openai-docs/references/routing.md +11 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-prd/SKILL.md +44 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-prd/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-preview/SKILL.md +16 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-preview/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/SKILL.md +39 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/scripts/inspect-local-sqlite.py +52 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/scripts/normalize-run-agents.mjs +63 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +698 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +361 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +187 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-requirements/SKILL.md +16 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-requirements/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-review/SKILL.md +18 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-review/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-rules/SKILL.md +19 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-rules/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-security/SKILL.md +30 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-security/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-setup/SKILL.md +25 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-setup/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-spec/SKILL.md +45 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-spec/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-task/SKILL.md +41 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-task/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-text-encoding/SKILL.md +27 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-text-encoding/agents/openai.yaml +6 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/SKILL.md +22 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/agents/openai.yaml +4 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/references/codex-config.md +24 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/references/secrets.md +8 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/scripts/configure-local-mcp.mjs +52 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/scripts/inspect-tool.mjs +35 -0
- package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/scripts/tool-state.mjs +26 -0
- package/templates/.zaip-aios/templates/tools/README.md +9 -0
- package/templates/.zaip-aios/templates/tools/api/asaas/README.md +22 -0
- package/templates/.zaip-aios/templates/tools/api/asaas/manifest.yaml +20 -0
- package/templates/.zaip-aios/templates/tools/api/github/README.md +22 -0
- package/templates/.zaip-aios/templates/tools/api/github/manifest.yaml +20 -0
- package/templates/.zaip-aios/templates/tools/api/google-ads/README.md +23 -0
- package/templates/.zaip-aios/templates/tools/api/google-ads/manifest.yaml +21 -0
- package/templates/.zaip-aios/templates/tools/api/google-analytics/README.md +22 -0
- package/templates/.zaip-aios/templates/tools/api/google-analytics/manifest.yaml +20 -0
- package/templates/.zaip-aios/templates/tools/api/google-search-console/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/api/google-search-console/manifest.yaml +19 -0
- package/templates/.zaip-aios/templates/tools/api/google-tag-manager/README.md +22 -0
- package/templates/.zaip-aios/templates/tools/api/google-tag-manager/manifest.yaml +20 -0
- package/templates/.zaip-aios/templates/tools/api/hubspot/README.md +22 -0
- package/templates/.zaip-aios/templates/tools/api/hubspot/manifest.yaml +20 -0
- package/templates/.zaip-aios/templates/tools/api/instagram-graph/README.md +23 -0
- package/templates/.zaip-aios/templates/tools/api/instagram-graph/manifest.yaml +21 -0
- package/templates/.zaip-aios/templates/tools/api/kommo-crm/README.md +23 -0
- package/templates/.zaip-aios/templates/tools/api/kommo-crm/manifest.yaml +21 -0
- package/templates/.zaip-aios/templates/tools/api/linkedin-ads/README.md +23 -0
- package/templates/.zaip-aios/templates/tools/api/linkedin-ads/manifest.yaml +21 -0
- package/templates/.zaip-aios/templates/tools/api/meta-ads/README.md +23 -0
- package/templates/.zaip-aios/templates/tools/api/meta-ads/manifest.yaml +21 -0
- package/templates/.zaip-aios/templates/tools/api/openai/README.md +22 -0
- package/templates/.zaip-aios/templates/tools/api/openai/manifest.yaml +20 -0
- package/templates/.zaip-aios/templates/tools/api/shopify/README.md +23 -0
- package/templates/.zaip-aios/templates/tools/api/shopify/manifest.yaml +21 -0
- package/templates/.zaip-aios/templates/tools/api/slack/README.md +22 -0
- package/templates/.zaip-aios/templates/tools/api/slack/manifest.yaml +20 -0
- package/templates/.zaip-aios/templates/tools/api/stripe/README.md +22 -0
- package/templates/.zaip-aios/templates/tools/api/stripe/manifest.yaml +20 -0
- package/templates/.zaip-aios/templates/tools/api/tiktok-ads/README.md +23 -0
- package/templates/.zaip-aios/templates/tools/api/tiktok-ads/manifest.yaml +21 -0
- package/templates/.zaip-aios/templates/tools/api/youtube-analytics/README.md +22 -0
- package/templates/.zaip-aios/templates/tools/api/youtube-analytics/manifest.yaml +20 -0
- package/templates/.zaip-aios/templates/tools/catalog.yaml +358 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/browser/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/browser/manifest.yaml +24 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/filesystem/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/filesystem/manifest.yaml +24 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/git/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/git/manifest.yaml +24 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/github/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/github/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/gitlab/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/gitlab/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/jira/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/jira/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/linear/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/linear/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/notion/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/notion/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/openai-docs/README.md +15 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/openai-docs/manifest.yaml +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/postgresql/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/postgresql/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/slack/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/slack/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/sqlite/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/development/sqlite/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/aws/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/aws/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/azure/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/azure/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/cloudflare/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/cloudflare/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/docker/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/docker/manifest.yaml +24 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/gcp/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/gcp/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/hostinger/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/hostinger/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/kubernetes/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/kubernetes/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/terraform/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/infra/terraform/manifest.yaml +24 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/google-ads/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/google-ads/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/google-analytics/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/google-analytics/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/google-search-console/README.md +19 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/google-search-console/manifest.yaml +24 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/google-tag-manager/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/google-tag-manager/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/hubspot/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/hubspot/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/instagram-insights/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/instagram-insights/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/linkedin-ads/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/linkedin-ads/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/mailchimp/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/mailchimp/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/meta-ads/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/meta-ads/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/semrush/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/semrush/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/tiktok-ads/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/tiktok-ads/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/youtube-analytics/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/marketing/youtube-analytics/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/cloudwatch/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/cloudwatch/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/datadog/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/datadog/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/elasticsearch/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/elasticsearch/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/grafana/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/grafana/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/kibana/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/kibana/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/loki/README.md +19 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/loki/manifest.yaml +24 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/new-relic/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/new-relic/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/opentelemetry/README.md +20 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/opentelemetry/manifest.yaml +25 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/prometheus/README.md +19 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/prometheus/manifest.yaml +24 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/sentry/README.md +21 -0
- package/templates/.zaip-aios/templates/tools/mcp/observability/sentry/manifest.yaml +26 -0
- package/templates/.zaip-aios/templates/tools/policies/approval-rules.yaml +8 -0
- package/templates/.zaip-aios/templates/tools/policies/financial-limits.yaml +6 -0
- package/templates/.zaip-aios/templates/tools/policies/permissions.yaml +8 -0
- package/templates/.zaip-aios/templates/tools/policies/secret-handling.md +7 -0
- package/templates/.zaip-aios/templates/tools/profiles/business.yaml +8 -0
- package/templates/.zaip-aios/templates/tools/profiles/default.yaml +8 -0
- package/templates/.zaip-aios/templates/tools/profiles/development.yaml +13 -0
- package/templates/.zaip-aios/templates/tools/profiles/infrastructure.yaml +8 -0
- package/templates/.zaip-aios/templates/tools/profiles/marketing.yaml +9 -0
- package/templates/.zaip-aios/templates/tools/profiles/observability.yaml +8 -0
- package/templates/.zaip-aios/templates/tools/runtime/README.md +3 -0
- package/templates/.zaip-aios/templates/tools/runtime/api-mcp-runtime.mjs +217 -0
- package/templates/.zaip-aios/templates/tools/runtime/api-mcp-runtime.test.mjs +56 -0
- package/templates/.zaip-aios/templates/tools/runtime/fixtures/definition.json +17 -0
- package/templates/.zaip-aios/templates/tools/runtime/runner.mjs +16 -0
- package/templates/.zaip-aios/templates/tools/runtime/stdio.test.mjs +32 -0
- package/templates/.zaip-aios/templates/tools/state.example.yaml +8 -0
- package/templates/.zaip-aios/templates/zaip-aios/INDEX.md +26 -0
- package/templates/.zaip-aios/templates/zaip-aios/README.md +13 -0
- package/templates/.zaip-aios/templates/zaip-aios/VERSION +1 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/01-primeiros-passos.md +10 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/02-requirements.md +12 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/03-tasks.md +12 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/04-specs.md +16 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/05-prds.md +13 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/06-execucao.md +13 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/07-revisao-e-validacao.md +8 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/08-contexto-e-tokens.md +10 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/09-agentes-e-squads.md +8 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/10-seguranca.md +206 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/11-observabilidade-e-custos.md +10 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/12-instalacao-e-upgrade.md +10 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/13-boas-praticas.md +12 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/14-troubleshooting.md +12 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/15-tools-e-codex.md +25 -0
- package/templates/.zaip-aios/templates/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +47 -0
- package/templates/template-manifest.json +3210 -69
- package/templates/.agents/rules/architecture.md +0 -21
- package/templates/.agents/rules/context.md +0 -18
- package/templates/.agents/rules/core.md +0 -16
- package/templates/.agents/rules/workflow.md +0 -21
- /package/templates/.agents/rules/{security.md → zaip/security.md} +0 -0
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
import { readFile, rename, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
aggregate,
|
|
5
|
+
duplicateUsageAssignments,
|
|
6
|
+
exactCompletedSegment,
|
|
7
|
+
filesUnder,
|
|
8
|
+
jsonLines,
|
|
9
|
+
loadSegments,
|
|
10
|
+
pricingFor,
|
|
11
|
+
recordOccurredAt,
|
|
12
|
+
recordSequence,
|
|
13
|
+
recordType,
|
|
14
|
+
sameCost,
|
|
15
|
+
usageStatus,
|
|
16
|
+
usageView,
|
|
17
|
+
withSequence,
|
|
18
|
+
} from "./reconcile-telemetry-lib.mjs";
|
|
19
|
+
|
|
20
|
+
const workspace = resolve(process.cwd());
|
|
21
|
+
const apply = process.argv.includes("--apply");
|
|
22
|
+
const approximate = process.argv.includes("--approximate");
|
|
23
|
+
const reprice = process.argv.includes("--reprice");
|
|
24
|
+
const deduplicate = process.argv.includes("--deduplicate");
|
|
25
|
+
const applyBackfill = apply && !deduplicate;
|
|
26
|
+
|
|
27
|
+
const runFiles = await filesUnder(join(workspace, ".agents", "records", "runs"), ".jsonl");
|
|
28
|
+
const runs = [];
|
|
29
|
+
const usedKeys = new Set();
|
|
30
|
+
let danglingSupersessionRepairs = 0;
|
|
31
|
+
for (const file of runFiles) {
|
|
32
|
+
let records = jsonLines(await readFile(file, "utf8"));
|
|
33
|
+
const finishedRecord = records.find((record) => recordType(record) === "run.finished");
|
|
34
|
+
const canonicalCorrectionTime = finishedRecord
|
|
35
|
+
? new Date(Date.parse(recordOccurredAt(finishedRecord)) - 1).toISOString()
|
|
36
|
+
: null;
|
|
37
|
+
const staleCorrectionTime =
|
|
38
|
+
canonicalCorrectionTime !== null &&
|
|
39
|
+
records.some(
|
|
40
|
+
(record) =>
|
|
41
|
+
usageView(record)?.activity_kind === "retrospective_local_reconciliation" &&
|
|
42
|
+
recordOccurredAt(record) !== canonicalCorrectionTime,
|
|
43
|
+
);
|
|
44
|
+
if (applyBackfill && staleCorrectionTime) {
|
|
45
|
+
records = records.map((record) =>
|
|
46
|
+
usageView(record)?.activity_kind === "retrospective_local_reconciliation"
|
|
47
|
+
? { ...record, occurred_at: canonicalCorrectionTime }
|
|
48
|
+
: record,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const nativeMeasured = records.some((record) => {
|
|
52
|
+
const usage = usageView(record);
|
|
53
|
+
return (
|
|
54
|
+
usage &&
|
|
55
|
+
usage.activity_kind !== "retrospective_local_reconciliation" &&
|
|
56
|
+
usage.tokens.input !== null &&
|
|
57
|
+
usage.tokens.output !== null
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
const referencedUsageIds = new Set(
|
|
61
|
+
records
|
|
62
|
+
.map(usageView)
|
|
63
|
+
.filter(Boolean)
|
|
64
|
+
.map((usage) => usage.supersedes_event_id)
|
|
65
|
+
.filter(Boolean),
|
|
66
|
+
);
|
|
67
|
+
if (applyBackfill && nativeMeasured)
|
|
68
|
+
records = records.filter((record) => {
|
|
69
|
+
const usage = usageView(record);
|
|
70
|
+
return (
|
|
71
|
+
usage?.activity_kind !== "retrospective_local_reconciliation" ||
|
|
72
|
+
referencedUsageIds.has(usage.event_id)
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
const priorUsageIds = [];
|
|
76
|
+
let repairedDangling = false;
|
|
77
|
+
records = records.map((record) => {
|
|
78
|
+
const usage = usageView(record);
|
|
79
|
+
if (!usage) return record;
|
|
80
|
+
let next = record;
|
|
81
|
+
if (usage.supersedes_event_id !== null && !priorUsageIds.includes(usage.supersedes_event_id)) {
|
|
82
|
+
danglingSupersessionRepairs += 1;
|
|
83
|
+
if (applyBackfill) {
|
|
84
|
+
repairedDangling = true;
|
|
85
|
+
const replacement = priorUsageIds.at(-1) ?? null;
|
|
86
|
+
next = Array.isArray(record)
|
|
87
|
+
? (() => {
|
|
88
|
+
const copy = [...record];
|
|
89
|
+
copy[13] = replacement;
|
|
90
|
+
return copy;
|
|
91
|
+
})()
|
|
92
|
+
: { ...record, supersedes_event_id: replacement };
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
priorUsageIds.push(usage.event_id);
|
|
96
|
+
return next;
|
|
97
|
+
});
|
|
98
|
+
if (applyBackfill && repairedDangling) {
|
|
99
|
+
const temporary = `${file}.supersession.tmp`;
|
|
100
|
+
await writeFile(
|
|
101
|
+
temporary,
|
|
102
|
+
`${records.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
103
|
+
"utf8",
|
|
104
|
+
);
|
|
105
|
+
await rename(temporary, file);
|
|
106
|
+
}
|
|
107
|
+
const finishIndex = records.findIndex((record) => recordType(record) === "run.finished");
|
|
108
|
+
const misplaced = records.filter(
|
|
109
|
+
(record, index) =>
|
|
110
|
+
usageView(record)?.activity_kind === "retrospective_local_reconciliation" &&
|
|
111
|
+
index > finishIndex &&
|
|
112
|
+
finishIndex >= 0,
|
|
113
|
+
);
|
|
114
|
+
if (applyBackfill && (misplaced.length || staleCorrectionTime)) {
|
|
115
|
+
const retained = records.filter((record) => !misplaced.includes(record));
|
|
116
|
+
const insertAt = retained.findIndex((record) => recordType(record) === "run.finished");
|
|
117
|
+
records = [...retained.slice(0, insertAt), ...misplaced, ...retained.slice(insertAt)];
|
|
118
|
+
const temporary = `${file}.reconcile.tmp`;
|
|
119
|
+
await writeFile(
|
|
120
|
+
temporary,
|
|
121
|
+
`${records.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
122
|
+
"utf8",
|
|
123
|
+
);
|
|
124
|
+
await rename(temporary, file);
|
|
125
|
+
}
|
|
126
|
+
const hasCorrection = records.some(
|
|
127
|
+
(record) => usageView(record)?.activity_kind === "retrospective_local_reconciliation",
|
|
128
|
+
);
|
|
129
|
+
if (
|
|
130
|
+
applyBackfill &&
|
|
131
|
+
(hasCorrection || nativeMeasured) &&
|
|
132
|
+
records.some((record, index) => recordSequence(record) !== index + 1)
|
|
133
|
+
) {
|
|
134
|
+
records = records.map((record, index) => withSequence(record, index + 1));
|
|
135
|
+
const temporary = `${file}.reconcile.tmp`;
|
|
136
|
+
await writeFile(
|
|
137
|
+
temporary,
|
|
138
|
+
`${records.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
139
|
+
"utf8",
|
|
140
|
+
);
|
|
141
|
+
await rename(temporary, file);
|
|
142
|
+
}
|
|
143
|
+
const started = records.find((record) => recordType(record) === "run.started");
|
|
144
|
+
const usage = records.filter((record) => recordType(record) === "usage.recorded").map(usageView);
|
|
145
|
+
for (const event of usage)
|
|
146
|
+
if (event.source_segment_key && event.tokens?.total !== null)
|
|
147
|
+
usedKeys.add(event.source_segment_key);
|
|
148
|
+
const { measured, deduplicated } = usageStatus(usage);
|
|
149
|
+
if (started) runs.push({ file, records, started, usage, measured, deduplicated });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const allSegments = await loadSegments(workspace);
|
|
153
|
+
const unfinished = runs.filter(
|
|
154
|
+
(run) => !run.records.some((record) => recordType(record) === "run.finished"),
|
|
155
|
+
);
|
|
156
|
+
const unfinishedMatches = unfinished.map((run) => ({
|
|
157
|
+
run,
|
|
158
|
+
...exactCompletedSegment(run.started, allSegments),
|
|
159
|
+
}));
|
|
160
|
+
const finishEligible = unfinishedMatches.filter(({ segment }) => segment !== null);
|
|
161
|
+
const finishAmbiguous = unfinishedMatches.filter(({ ambiguous }) => ambiguous);
|
|
162
|
+
if (applyBackfill) {
|
|
163
|
+
for (const { run, segment } of finishEligible) {
|
|
164
|
+
const sequence = Math.max(...run.records.map((record) => recordSequence(record) ?? 0)) + 1;
|
|
165
|
+
const finished = {
|
|
166
|
+
schema_version: 2,
|
|
167
|
+
event_id: `${run.started.run_id}:reconcile-finish:${String(sequence).padStart(6, "0")}`,
|
|
168
|
+
run_id: run.started.run_id,
|
|
169
|
+
sequence,
|
|
170
|
+
occurred_at: segment.finished_at,
|
|
171
|
+
type: "run.finished",
|
|
172
|
+
phase: run.started.phase,
|
|
173
|
+
status: "completed",
|
|
174
|
+
};
|
|
175
|
+
run.records = [...run.records, finished].map((record, index) =>
|
|
176
|
+
withSequence(record, index + 1),
|
|
177
|
+
);
|
|
178
|
+
const temporary = `${run.file}.finish.tmp`;
|
|
179
|
+
await writeFile(
|
|
180
|
+
temporary,
|
|
181
|
+
`${run.records.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
182
|
+
"utf8",
|
|
183
|
+
);
|
|
184
|
+
await rename(temporary, run.file);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const missing = runs.filter(
|
|
188
|
+
(run) =>
|
|
189
|
+
!run.measured &&
|
|
190
|
+
!run.deduplicated &&
|
|
191
|
+
run.records.some((record) => recordType(record) === "run.finished"),
|
|
192
|
+
);
|
|
193
|
+
const segments = allSegments.filter((segment) => !usedKeys.has(segment.key));
|
|
194
|
+
|
|
195
|
+
let repricedEvents = 0;
|
|
196
|
+
let repricedRuns = 0;
|
|
197
|
+
if (reprice) {
|
|
198
|
+
for (const run of runs) {
|
|
199
|
+
const superseded = new Set(run.usage.map((usage) => usage.supersedes_event_id).filter(Boolean));
|
|
200
|
+
const effective = run.usage.filter((usage) => !superseded.has(usage.event_id));
|
|
201
|
+
const corrections = [];
|
|
202
|
+
for (const usage of effective) {
|
|
203
|
+
if (usage.tokens.input === null || usage.tokens.output === null) continue;
|
|
204
|
+
const expected = await pricingFor(workspace, usage.model ?? run.started.model, usage.tokens);
|
|
205
|
+
if (expected.usd === null || sameCost(usage.cost, expected)) continue;
|
|
206
|
+
corrections.push({ usage, expected });
|
|
207
|
+
}
|
|
208
|
+
if (corrections.length === 0) continue;
|
|
209
|
+
repricedRuns += 1;
|
|
210
|
+
repricedEvents += corrections.length;
|
|
211
|
+
if (!applyBackfill) continue;
|
|
212
|
+
|
|
213
|
+
const correctionByTarget = new Map(corrections.map((item) => [item.usage.event_id, item]));
|
|
214
|
+
const updated = [];
|
|
215
|
+
let correctionIndex = run.usage.filter(
|
|
216
|
+
(usage) => usage.activity_kind === "pricing_catalog_reconciliation",
|
|
217
|
+
).length;
|
|
218
|
+
for (const record of run.records) {
|
|
219
|
+
updated.push(record);
|
|
220
|
+
const original = usageView(record);
|
|
221
|
+
const correction = original ? correctionByTarget.get(original.event_id) : null;
|
|
222
|
+
if (!correction) continue;
|
|
223
|
+
correctionIndex += 1;
|
|
224
|
+
updated.push({
|
|
225
|
+
schema_version: 2,
|
|
226
|
+
event_id: `${run.started.run_id}:reprice:${String(correctionIndex).padStart(6, "0")}`,
|
|
227
|
+
run_id: run.started.run_id,
|
|
228
|
+
sequence: 0,
|
|
229
|
+
occurred_at: original.occurred_at,
|
|
230
|
+
type: "usage.recorded",
|
|
231
|
+
phase: original.phase,
|
|
232
|
+
activity_kind: "pricing_catalog_reconciliation",
|
|
233
|
+
classification_source: original.classification_source ?? "current_context",
|
|
234
|
+
tokens: original.tokens,
|
|
235
|
+
cost: correction.expected,
|
|
236
|
+
provider: original.provider ?? run.started.provider,
|
|
237
|
+
model: original.model ?? run.started.model,
|
|
238
|
+
source_segment_key: original.source_segment_key,
|
|
239
|
+
supersedes_event_id: original.event_id,
|
|
240
|
+
...(original.source_occurred_at === null
|
|
241
|
+
? {}
|
|
242
|
+
: { source_occurred_at: original.source_occurred_at }),
|
|
243
|
+
...(original.context_stats === undefined ? {} : { context_stats: original.context_stats }),
|
|
244
|
+
...(original.runtime === undefined ? {} : { runtime: original.runtime }),
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
const resequenced = updated.map((record, index) => withSequence(record, index + 1));
|
|
248
|
+
const temporary = `${run.file}.reprice.tmp`;
|
|
249
|
+
await writeFile(
|
|
250
|
+
temporary,
|
|
251
|
+
`${resequenced.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
252
|
+
"utf8",
|
|
253
|
+
);
|
|
254
|
+
await rename(temporary, run.file);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const segmentsByKey = new Map(allSegments.map((segment) => [segment.key, segment]));
|
|
259
|
+
const genericModel = (model) => typeof model === "string" && /^gpt-5$/i.test(model.trim());
|
|
260
|
+
let modelIdentityCorrections = 0;
|
|
261
|
+
for (const run of runs) {
|
|
262
|
+
const superseded = new Set(run.usage.map((usage) => usage.supersedes_event_id).filter(Boolean));
|
|
263
|
+
const effective = run.usage.filter((usage) => !superseded.has(usage.event_id));
|
|
264
|
+
const corrections = effective.flatMap((usage) => {
|
|
265
|
+
if (!genericModel(usage.model ?? run.started.model)) return [];
|
|
266
|
+
const segment = usage.source_segment_key
|
|
267
|
+
? (segmentsByKey.get(usage.source_segment_key) ?? null)
|
|
268
|
+
: null;
|
|
269
|
+
return segment?.model && !genericModel(segment.model) ? [{ usage, segment }] : [];
|
|
270
|
+
});
|
|
271
|
+
modelIdentityCorrections += corrections.length;
|
|
272
|
+
if (!applyBackfill || corrections.length === 0) continue;
|
|
273
|
+
|
|
274
|
+
const correctionByTarget = new Map(corrections.map((item) => [item.usage.event_id, item]));
|
|
275
|
+
const updated = [];
|
|
276
|
+
let correctionIndex = run.usage.filter(
|
|
277
|
+
(usage) => usage.activity_kind === "model_identity_reconciliation",
|
|
278
|
+
).length;
|
|
279
|
+
for (const record of run.records) {
|
|
280
|
+
updated.push(record);
|
|
281
|
+
const original = usageView(record);
|
|
282
|
+
const correction = original ? correctionByTarget.get(original.event_id) : null;
|
|
283
|
+
if (!correction) continue;
|
|
284
|
+
correctionIndex += 1;
|
|
285
|
+
const cost = await pricingFor(workspace, correction.segment.model, original.tokens);
|
|
286
|
+
updated.push({
|
|
287
|
+
schema_version: 2,
|
|
288
|
+
event_id: `${run.started.run_id}:model:${String(correctionIndex).padStart(6, "0")}`,
|
|
289
|
+
run_id: run.started.run_id,
|
|
290
|
+
sequence: 0,
|
|
291
|
+
occurred_at: original.occurred_at,
|
|
292
|
+
type: "usage.recorded",
|
|
293
|
+
phase: original.phase,
|
|
294
|
+
activity_kind: "model_identity_reconciliation",
|
|
295
|
+
classification_source: original.classification_source ?? "current_context",
|
|
296
|
+
tokens: original.tokens,
|
|
297
|
+
cost,
|
|
298
|
+
provider: original.provider ?? run.started.provider ?? "openai",
|
|
299
|
+
model: correction.segment.model,
|
|
300
|
+
source_segment_key: original.source_segment_key,
|
|
301
|
+
supersedes_event_id: original.event_id,
|
|
302
|
+
source_occurred_at:
|
|
303
|
+
original.source_occurred_at ??
|
|
304
|
+
correction.segment.finished_at ??
|
|
305
|
+
correction.segment.started_at,
|
|
306
|
+
...(original.context_stats === undefined ? {} : { context_stats: original.context_stats }),
|
|
307
|
+
runtime: {
|
|
308
|
+
reasoning_effort: correction.segment.effort ?? original.runtime?.reasoning_effort ?? null,
|
|
309
|
+
service_tier: correction.segment.service_tier ?? original.runtime?.service_tier ?? null,
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
const resequenced = updated.map((record, index) => withSequence(record, index + 1));
|
|
314
|
+
const temporary = `${run.file}.model.tmp`;
|
|
315
|
+
await writeFile(
|
|
316
|
+
temporary,
|
|
317
|
+
`${resequenced.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
318
|
+
"utf8",
|
|
319
|
+
);
|
|
320
|
+
await rename(temporary, run.file);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const duplicateGroups = duplicateUsageAssignments(runs);
|
|
324
|
+
const duplicateAssignments = duplicateGroups.flatMap((group) => group.slice(1));
|
|
325
|
+
let deduplicatedEvents = 0;
|
|
326
|
+
if (apply && deduplicate) {
|
|
327
|
+
for (const { run, usage } of duplicateAssignments) {
|
|
328
|
+
const finish = run.records.find((record) => recordType(record) === "run.finished");
|
|
329
|
+
const correctionIndex =
|
|
330
|
+
run.usage.filter((event) => event.activity_kind === "duplicate_segment_reconciliation")
|
|
331
|
+
.length + 1;
|
|
332
|
+
const correction = {
|
|
333
|
+
schema_version: 2,
|
|
334
|
+
event_id: `${run.started.run_id}:deduplicate:${String(correctionIndex).padStart(6, "0")}`,
|
|
335
|
+
run_id: run.started.run_id,
|
|
336
|
+
sequence: 0,
|
|
337
|
+
occurred_at: finish
|
|
338
|
+
? new Date(Date.parse(recordOccurredAt(finish)) - 1).toISOString()
|
|
339
|
+
: new Date().toISOString(),
|
|
340
|
+
type: "usage.recorded",
|
|
341
|
+
phase: usage.phase ?? run.started.phase,
|
|
342
|
+
activity_kind: "duplicate_segment_reconciliation",
|
|
343
|
+
classification_source: "current_context",
|
|
344
|
+
tokens: {
|
|
345
|
+
input: null,
|
|
346
|
+
cached_input: null,
|
|
347
|
+
output: null,
|
|
348
|
+
reasoning: null,
|
|
349
|
+
total: null,
|
|
350
|
+
source: "unavailable",
|
|
351
|
+
},
|
|
352
|
+
cost: { usd: null, brl: null, fx_rate: null },
|
|
353
|
+
provider: usage.provider ?? run.started.provider ?? null,
|
|
354
|
+
model: usage.model ?? run.started.model ?? "unknown",
|
|
355
|
+
source_segment_key: usage.source_segment_key,
|
|
356
|
+
supersedes_event_id: usage.event_id,
|
|
357
|
+
...(usage.source_occurred_at === null
|
|
358
|
+
? {}
|
|
359
|
+
: { source_occurred_at: usage.source_occurred_at }),
|
|
360
|
+
...(usage.runtime === undefined ? {} : { runtime: usage.runtime }),
|
|
361
|
+
};
|
|
362
|
+
const finishIndex = run.records.findIndex((record) => recordType(record) === "run.finished");
|
|
363
|
+
const insertAt = finishIndex < 0 ? run.records.length : finishIndex;
|
|
364
|
+
const updated = [
|
|
365
|
+
...run.records.slice(0, insertAt),
|
|
366
|
+
correction,
|
|
367
|
+
...run.records.slice(insertAt),
|
|
368
|
+
].map((record, index) => withSequence(record, index + 1));
|
|
369
|
+
const temporary = `${run.file}.deduplicate.tmp`;
|
|
370
|
+
await writeFile(
|
|
371
|
+
temporary,
|
|
372
|
+
`${updated.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
373
|
+
"utf8",
|
|
374
|
+
);
|
|
375
|
+
await rename(temporary, run.file);
|
|
376
|
+
deduplicatedEvents += 1;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
let candidates = [];
|
|
381
|
+
for (const segment of segments) {
|
|
382
|
+
const exactTurn = missing.filter(
|
|
383
|
+
(run) => run.started.client_turn_id && run.started.client_turn_id === segment.turn_id,
|
|
384
|
+
);
|
|
385
|
+
for (const run of exactTurn) {
|
|
386
|
+
const runStart = Date.parse(run.started.occurred_at);
|
|
387
|
+
const finished = run.records.find((record) => recordType(record) === "run.finished");
|
|
388
|
+
const runFinish = finished ? Date.parse(recordOccurredAt(finished)) : Date.now();
|
|
389
|
+
const scopedUsage = segment.usage.filter((usage) => {
|
|
390
|
+
const timestamp = Date.parse(usage.source_timestamp ?? "");
|
|
391
|
+
return Number.isFinite(timestamp) && timestamp >= runStart && timestamp <= runFinish;
|
|
392
|
+
});
|
|
393
|
+
if (scopedUsage.length > 0)
|
|
394
|
+
candidates.push({
|
|
395
|
+
run,
|
|
396
|
+
segment: {
|
|
397
|
+
...segment,
|
|
398
|
+
key: `${segment.key}@${run.started.run_id}`,
|
|
399
|
+
usage: scopedUsage,
|
|
400
|
+
},
|
|
401
|
+
confidence: "exact_client_turn_time_slice",
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
const legacyMissing = missing.filter((run) => !run.started.client_turn_id);
|
|
405
|
+
const exact =
|
|
406
|
+
exactTurn.length === 0
|
|
407
|
+
? legacyMissing.filter((run) => segment.raw.includes(run.started.run_id))
|
|
408
|
+
: [];
|
|
409
|
+
if (exact.length === 1) candidates.push({ run: exact[0], segment, confidence: "exact_run_id" });
|
|
410
|
+
if (exactTurn.length === 0 && exact.length === 0) {
|
|
411
|
+
const taskMatches = legacyMissing.filter(
|
|
412
|
+
(run) => run.started.task_id && segment.raw.includes(run.started.task_id),
|
|
413
|
+
);
|
|
414
|
+
if (taskMatches.length === 1)
|
|
415
|
+
candidates.push({ run: taskMatches[0], segment, confidence: "exact_task_id" });
|
|
416
|
+
else if (taskMatches.length > 1 && segment.started_at && segment.finished_at) {
|
|
417
|
+
const start = Date.parse(segment.started_at);
|
|
418
|
+
const finish = Date.parse(segment.finished_at);
|
|
419
|
+
const contained = taskMatches.filter((run) => {
|
|
420
|
+
const occurred = Date.parse(run.started.occurred_at);
|
|
421
|
+
return Number.isFinite(occurred) && occurred >= start && occurred <= finish;
|
|
422
|
+
});
|
|
423
|
+
if (contained.length === 1)
|
|
424
|
+
candidates.push({ run: contained[0], segment, confidence: "task_id_time_containment" });
|
|
425
|
+
}
|
|
426
|
+
const conversationMatches = legacyMissing.filter(
|
|
427
|
+
(run) => run.started.conversation_id && segment.raw.includes(run.started.conversation_id),
|
|
428
|
+
);
|
|
429
|
+
if (taskMatches.length === 0 && conversationMatches.length === 1)
|
|
430
|
+
candidates.push({
|
|
431
|
+
run: conversationMatches[0],
|
|
432
|
+
segment,
|
|
433
|
+
confidence: "exact_conversation_id",
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
const alreadyCandidate = candidates.some((candidate) => candidate.segment.key === segment.key);
|
|
437
|
+
if (!alreadyCandidate && segment.started_at && segment.finished_at) {
|
|
438
|
+
const start = Date.parse(segment.started_at);
|
|
439
|
+
const finish = Date.parse(segment.finished_at);
|
|
440
|
+
const contained = legacyMissing.filter((run) => {
|
|
441
|
+
const occurred = Date.parse(run.started.occurred_at);
|
|
442
|
+
return Number.isFinite(occurred) && occurred >= start && occurred <= finish;
|
|
443
|
+
});
|
|
444
|
+
if (contained.length === 1)
|
|
445
|
+
candidates.push({ run: contained[0], segment, confidence: "exclusive_time_containment" });
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
const candidateRunIds = new Set(candidates.map((candidate) => candidate.run.started.run_id));
|
|
449
|
+
const candidateSegmentKeys = new Set(candidates.map((candidate) => candidate.segment.key));
|
|
450
|
+
const remainingRuns = missing.filter(
|
|
451
|
+
(run) => !run.started.client_turn_id && !candidateRunIds.has(run.started.run_id),
|
|
452
|
+
);
|
|
453
|
+
const remainingSegments = segments.filter(
|
|
454
|
+
(segment) => !candidateSegmentKeys.has(segment.key) && segment.started_at,
|
|
455
|
+
);
|
|
456
|
+
const distance = (run, segment) =>
|
|
457
|
+
Math.abs(Date.parse(run.started.occurred_at) - Date.parse(segment.started_at));
|
|
458
|
+
for (const run of remainingRuns) {
|
|
459
|
+
const orderedSegments = remainingSegments
|
|
460
|
+
.map((segment) => ({ segment, distance: distance(run, segment) }))
|
|
461
|
+
.sort((a, b) => a.distance - b.distance);
|
|
462
|
+
const nearest = orderedSegments[0];
|
|
463
|
+
if (!nearest || nearest.distance > 120_000 || nearest.distance === orderedSegments[1]?.distance)
|
|
464
|
+
continue;
|
|
465
|
+
const orderedRuns = remainingRuns
|
|
466
|
+
.map((other) => ({ run: other, distance: distance(other, nearest.segment) }))
|
|
467
|
+
.sort((a, b) => a.distance - b.distance);
|
|
468
|
+
if (
|
|
469
|
+
orderedRuns[0]?.run.started.run_id === run.started.run_id &&
|
|
470
|
+
orderedRuns[0].distance !== orderedRuns[1]?.distance
|
|
471
|
+
) {
|
|
472
|
+
candidates.push({ run, segment: nearest.segment, confidence: "mutual_nearest_start_120s" });
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
if (approximate) {
|
|
476
|
+
const hints = new Map(
|
|
477
|
+
candidates.map((candidate) => [
|
|
478
|
+
`${candidate.run.started.run_id}|${candidate.segment.key}`,
|
|
479
|
+
candidate.confidence,
|
|
480
|
+
]),
|
|
481
|
+
);
|
|
482
|
+
const canonical = candidates.filter((candidate) =>
|
|
483
|
+
candidate.confidence.startsWith("exact_client_turn"),
|
|
484
|
+
);
|
|
485
|
+
const assignedRuns = new Set(canonical.map((candidate) => candidate.run.started.run_id));
|
|
486
|
+
const assignedSegments = new Set(canonical.map((candidate) => candidate.segment.key));
|
|
487
|
+
const approximateRuns = missing.filter(
|
|
488
|
+
(run) => !run.started.client_turn_id && !assignedRuns.has(run.started.run_id),
|
|
489
|
+
);
|
|
490
|
+
const approximateSegments = segments.filter(
|
|
491
|
+
(segment) => !assignedSegments.has(segment.key) && segment.started_at,
|
|
492
|
+
);
|
|
493
|
+
const pairs = [];
|
|
494
|
+
for (const run of approximateRuns) {
|
|
495
|
+
const runFinished = run.records.find((record) => recordType(record) === "run.finished");
|
|
496
|
+
const runDuration = runFinished
|
|
497
|
+
? Math.max(0, Date.parse(recordOccurredAt(runFinished)) - Date.parse(run.started.occurred_at))
|
|
498
|
+
: null;
|
|
499
|
+
for (const segment of approximateSegments) {
|
|
500
|
+
const startDelta = Math.abs(
|
|
501
|
+
Date.parse(run.started.occurred_at) - Date.parse(segment.started_at),
|
|
502
|
+
);
|
|
503
|
+
const segmentDuration = segment.finished_at
|
|
504
|
+
? Math.max(0, Date.parse(segment.finished_at) - Date.parse(segment.started_at))
|
|
505
|
+
: null;
|
|
506
|
+
const durationDelta =
|
|
507
|
+
runDuration !== null && segmentDuration !== null
|
|
508
|
+
? Math.abs(runDuration - segmentDuration)
|
|
509
|
+
: 0;
|
|
510
|
+
const hint = hints.get(`${run.started.run_id}|${segment.key}`) ?? null;
|
|
511
|
+
const hintBonus =
|
|
512
|
+
hint === "exact_run_id"
|
|
513
|
+
? 1e15
|
|
514
|
+
: hint === "exact_task_id"
|
|
515
|
+
? 1e14
|
|
516
|
+
: hint === "exact_conversation_id"
|
|
517
|
+
? 1e13
|
|
518
|
+
: hint?.includes("containment")
|
|
519
|
+
? 1e12
|
|
520
|
+
: hint === "mutual_nearest_start_120s"
|
|
521
|
+
? 1e11
|
|
522
|
+
: 0;
|
|
523
|
+
pairs.push({
|
|
524
|
+
run,
|
|
525
|
+
segment,
|
|
526
|
+
score: startDelta + durationDelta * 0.35 - hintBonus,
|
|
527
|
+
startDelta,
|
|
528
|
+
durationDelta,
|
|
529
|
+
hint,
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
pairs.sort(
|
|
534
|
+
(left, right) =>
|
|
535
|
+
left.score - right.score ||
|
|
536
|
+
left.startDelta - right.startDelta ||
|
|
537
|
+
left.durationDelta - right.durationDelta,
|
|
538
|
+
);
|
|
539
|
+
const usedRuns = new Set();
|
|
540
|
+
const usedSegments = new Set();
|
|
541
|
+
candidates = [...canonical];
|
|
542
|
+
for (const pair of pairs) {
|
|
543
|
+
const runId = pair.run.started.run_id;
|
|
544
|
+
if (usedRuns.has(runId) || usedSegments.has(pair.segment.key)) continue;
|
|
545
|
+
usedRuns.add(runId);
|
|
546
|
+
usedSegments.add(pair.segment.key);
|
|
547
|
+
candidates.push({
|
|
548
|
+
...pair,
|
|
549
|
+
confidence: `approximate_global_${pair.hint ?? "time_duration"}`,
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
const byRun = new Map();
|
|
554
|
+
const bySegment = new Map();
|
|
555
|
+
for (const candidate of candidates) {
|
|
556
|
+
byRun.set(candidate.run.started.run_id, [
|
|
557
|
+
...(byRun.get(candidate.run.started.run_id) ?? []),
|
|
558
|
+
candidate,
|
|
559
|
+
]);
|
|
560
|
+
bySegment.set(candidate.segment.key, [
|
|
561
|
+
...(bySegment.get(candidate.segment.key) ?? []),
|
|
562
|
+
candidate,
|
|
563
|
+
]);
|
|
564
|
+
}
|
|
565
|
+
const eligible = candidates.filter(
|
|
566
|
+
(candidate) =>
|
|
567
|
+
byRun.get(candidate.run.started.run_id).length === 1 &&
|
|
568
|
+
bySegment.get(candidate.segment.key).length === 1,
|
|
569
|
+
);
|
|
570
|
+
|
|
571
|
+
if (applyBackfill) {
|
|
572
|
+
for (const { run, segment, confidence } of eligible) {
|
|
573
|
+
const tokens = aggregate(segment);
|
|
574
|
+
const model = segment.model ?? run.started.model ?? null;
|
|
575
|
+
const cost = await pricingFor(workspace, model, tokens);
|
|
576
|
+
const superseded = [...run.usage]
|
|
577
|
+
.reverse()
|
|
578
|
+
.find(
|
|
579
|
+
(event) =>
|
|
580
|
+
event.tokens?.total === null &&
|
|
581
|
+
!run.usage.some((other) => other.supersedes_event_id === event.event_id),
|
|
582
|
+
);
|
|
583
|
+
const sequence = Math.max(...run.records.map((record) => recordSequence(record) ?? 0)) + 1;
|
|
584
|
+
const event = {
|
|
585
|
+
schema_version: 2,
|
|
586
|
+
event_id: `${run.started.run_id}:reconcile:${String(sequence).padStart(6, "0")}`,
|
|
587
|
+
run_id: run.started.run_id,
|
|
588
|
+
sequence,
|
|
589
|
+
occurred_at: run.records.find((record) => recordType(record) === "run.finished")
|
|
590
|
+
? new Date(
|
|
591
|
+
Date.parse(
|
|
592
|
+
recordOccurredAt(run.records.find((record) => recordType(record) === "run.finished")),
|
|
593
|
+
) - 1,
|
|
594
|
+
).toISOString()
|
|
595
|
+
: new Date().toISOString(),
|
|
596
|
+
type: "usage.recorded",
|
|
597
|
+
phase: run.started.phase,
|
|
598
|
+
activity_kind: "retrospective_local_reconciliation",
|
|
599
|
+
classification_source: confidence.startsWith("approximate_")
|
|
600
|
+
? "legacy_inferred"
|
|
601
|
+
: "current_context",
|
|
602
|
+
tokens: { ...tokens, source: "provider_reported" },
|
|
603
|
+
cost,
|
|
604
|
+
provider: run.started.provider ?? "openai",
|
|
605
|
+
model,
|
|
606
|
+
source_segment_key: segment.key,
|
|
607
|
+
supersedes_event_id: superseded?.event_id ?? null,
|
|
608
|
+
source_occurred_at: segment.finished_at ?? segment.started_at,
|
|
609
|
+
runtime: { reasoning_effort: segment.effort, service_tier: segment.service_tier },
|
|
610
|
+
};
|
|
611
|
+
const finishIndex = run.records.findIndex((record) => recordType(record) === "run.finished");
|
|
612
|
+
const insertAt = finishIndex < 0 ? run.records.length : finishIndex;
|
|
613
|
+
const updated = [...run.records.slice(0, insertAt), event, ...run.records.slice(insertAt)].map(
|
|
614
|
+
(record, index) => withSequence(record, index + 1),
|
|
615
|
+
);
|
|
616
|
+
const temporary = `${run.file}.reconcile.tmp`;
|
|
617
|
+
await writeFile(
|
|
618
|
+
temporary,
|
|
619
|
+
`${updated.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
620
|
+
"utf8",
|
|
621
|
+
);
|
|
622
|
+
await rename(temporary, run.file);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
const ambiguousRunIds = [
|
|
627
|
+
...new Set([
|
|
628
|
+
...[...byRun.entries()].filter(([, values]) => values.length > 1).map(([id]) => id),
|
|
629
|
+
...[...bySegment.values()]
|
|
630
|
+
.filter((values) => values.length > 1)
|
|
631
|
+
.flatMap((values) => values.map(({ run }) => run.started.run_id)),
|
|
632
|
+
]),
|
|
633
|
+
];
|
|
634
|
+
const matchedIds = new Set(eligible.map(({ run }) => run.started.run_id));
|
|
635
|
+
const corrections = runs.flatMap((run) =>
|
|
636
|
+
run.usage.filter((usage) => usage.activity_kind === "retrospective_local_reconciliation"),
|
|
637
|
+
);
|
|
638
|
+
const correctionKeys = corrections.map((usage) => usage.source_segment_key).filter(Boolean);
|
|
639
|
+
console.log(
|
|
640
|
+
JSON.stringify(
|
|
641
|
+
{
|
|
642
|
+
mode: deduplicate
|
|
643
|
+
? apply
|
|
644
|
+
? "apply-deduplicate"
|
|
645
|
+
: "dry-run-deduplicate"
|
|
646
|
+
: apply
|
|
647
|
+
? reprice
|
|
648
|
+
? "apply-reprice"
|
|
649
|
+
: approximate
|
|
650
|
+
? "apply-approximate"
|
|
651
|
+
: "apply"
|
|
652
|
+
: reprice
|
|
653
|
+
? "dry-run-reprice"
|
|
654
|
+
: approximate
|
|
655
|
+
? "dry-run-approximate"
|
|
656
|
+
: "dry-run",
|
|
657
|
+
run_files: runs.length,
|
|
658
|
+
local_session_files: new Set(segments.map((segment) => segment.file)).size,
|
|
659
|
+
local_segments_available: segments.length,
|
|
660
|
+
already_measured: runs.filter((run) => run.measured).length,
|
|
661
|
+
missing_before: missing.length,
|
|
662
|
+
unfinished_before: unfinished.length,
|
|
663
|
+
unfinished_finish_eligible: finishEligible.length,
|
|
664
|
+
unfinished_finish_applied: applyBackfill ? finishEligible.length : 0,
|
|
665
|
+
unfinished_finish_ambiguous: finishAmbiguous.length,
|
|
666
|
+
eligible: eligible.length,
|
|
667
|
+
applied: applyBackfill ? eligible.length : 0,
|
|
668
|
+
ambiguous: ambiguousRunIds.length,
|
|
669
|
+
unmatched: missing.filter(
|
|
670
|
+
(run) =>
|
|
671
|
+
!matchedIds.has(run.started.run_id) && !ambiguousRunIds.includes(run.started.run_id),
|
|
672
|
+
).length,
|
|
673
|
+
corrections_recorded: corrections.length,
|
|
674
|
+
invalid_correction_totals: corrections.filter(
|
|
675
|
+
(usage) => usage.tokens.total !== usage.tokens.input + usage.tokens.output,
|
|
676
|
+
).length,
|
|
677
|
+
duplicated_correction_segments: correctionKeys.length - new Set(correctionKeys).size,
|
|
678
|
+
duplicate_segment_groups: duplicateGroups.length,
|
|
679
|
+
duplicate_segment_assignments: duplicateAssignments.length,
|
|
680
|
+
duplicate_segment_run_ids: duplicateGroups.map((group) =>
|
|
681
|
+
group.map(({ run }) => run.started.run_id),
|
|
682
|
+
),
|
|
683
|
+
deduplicated_runs_excluded_from_backfill: runs.filter((run) => run.deduplicated).length,
|
|
684
|
+
deduplicated_events: deduplicatedEvents,
|
|
685
|
+
repriced_runs: repricedRuns,
|
|
686
|
+
repriced_events: repricedEvents,
|
|
687
|
+
model_identity_corrections: modelIdentityCorrections,
|
|
688
|
+
dangling_supersession_repairs: danglingSupersessionRepairs,
|
|
689
|
+
eligible_run_ids: eligible.map(({ run }) => run.started.run_id),
|
|
690
|
+
finish_eligible_run_ids: finishEligible.map(({ run }) => run.started.run_id),
|
|
691
|
+
confidence: Object.fromEntries(
|
|
692
|
+
eligible.map(({ run, confidence }) => [run.started.run_id, confidence]),
|
|
693
|
+
),
|
|
694
|
+
},
|
|
695
|
+
null,
|
|
696
|
+
2,
|
|
697
|
+
),
|
|
698
|
+
);
|