@zaip-ai/cli 1.0.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/services/adapters.d.ts +1 -1
- package/dist/services/adapters.js +1 -1
- package/dist/services/agent-adapters.js +2 -2
- package/dist/services/agent-adapters.js.map +1 -1
- package/dist/services/agent-adapters.test.js +5 -0
- package/dist/services/agent-adapters.test.js.map +1 -1
- package/dist/services/logger.test.js +2 -2
- package/dist/services/runtime-template.test.js +6 -6
- package/dist/services/template-manifest.d.ts.map +1 -1
- package/dist/services/template-manifest.js +5 -0
- package/dist/services/template-manifest.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/architecture/software-architecture.md +131 -0
- package/templates/.agents/branding/brandbook.docx +0 -0
- package/templates/.agents/branding/brandbook.md +60 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-finalizer.toml +1 -1
- package/templates/.agents/config/clients/codex/agents/zaip-agent-orchestrator.toml +1 -1
- package/templates/.agents/dashboard/.tmp-run-list.json +254 -0
- package/templates/.agents/dashboard/.zaip-managed.json +252 -136
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-Z60df2r-.js → CostCalculationGuidePage-DxR_pgSV.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/DashboardHelpDialog-4jZLTWE_.js +2156 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-Coc6pA-1.js → PricingSettingsDialog-CKcsqb-r.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-BomxqCBU.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-DmmJD2Th.js +3 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BwtitWa_.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-N5Csr0RP.js +68 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-DFBuc_qp.js → icons-vendor-C0fj2uU9.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-C4aIB1PV.js +2 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-CCQOHdVI.js → react-vendor-BEsJ-FYH.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-pC2_0J8x.js → traceability-B6y6Gw12.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +5 -5
- package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/App.tsx +204 -32
- package/templates/.agents/dashboard/apps/frontend/src/DashboardAlternateContent.tsx +11 -11
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +14 -7
- package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +4 -2
- package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.test.ts +3 -1
- package/templates/.agents/dashboard/apps/frontend/src/TraceabilityWorkspace.tsx +14 -11
- package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +19 -4
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.test.ts +24 -2
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +22 -1
- package/templates/.agents/dashboard/apps/frontend/src/overview-status-page.test.ts +3 -1
- package/templates/.agents/dashboard/apps/frontend/src/project-settings-page.css +36 -26
- package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +2 -2
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-banner-semantics.test.ts +40 -6
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +39 -1
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.test.ts +89 -23
- package/templates/.agents/dashboard/apps/frontend/src/use-app-cost-loaders.ts +219 -29
- package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +61 -7
- package/templates/.agents/dashboard/apps/frontend/src/use-app-operations-pages.ts +3 -6
- package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.test.ts +2 -2
- package/templates/.agents/dashboard/apps/frontend/src/work-list-pagination.ts +3 -4
- package/templates/.agents/dashboard/apps/frontend/vite.config.ts +4 -1
- package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.test.ts +89 -19
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CompactLifecycleCostTable.tsx +31 -16
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.test.ts +43 -14
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostCharts.tsx +5 -5
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostModelsAuditTable.tsx +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorContent.tsx +67 -42
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +115 -39
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +188 -38
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +75 -17
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +147 -58
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor.css +5 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/index.ts +2 -2
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/period-cost-groups.ts +2 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-compact-cost-page.ts +18 -7
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-group-page.ts +95 -9
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/use-cost-run-page.ts +29 -17
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.test.ts +0 -24
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.test.ts +225 -424
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +24 -15
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-terminal-day.test.ts +6 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/source-size-cost-server/build-cost-monitor-projection-agents.test.ts +31 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/source-size-cost-server/build-cost-summary-projection-duration.test.ts +414 -0
- package/templates/.agents/dashboard/modules/operations/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/src/contracts.ts +26 -23
- package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.tsx +31 -11
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +3 -1
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +51 -21
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +47 -5
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPageNavigation.tsx +1 -4
- package/templates/.agents/dashboard/modules/operations/src/react/PeriodSummaryTable.tsx +32 -10
- package/templates/.agents/dashboard/modules/operations/src/react/TaskDetailsDialog.tsx +9 -3
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkBoard.tsx +13 -5
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.test.ts +12 -4
- package/templates/.agents/dashboard/modules/operations/src/react/UnifiedWorkList.tsx +1 -4
- package/templates/.agents/dashboard/modules/operations/src/react/conversation-rows.ts +1 -2
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.test.ts +385 -4
- package/templates/.agents/dashboard/modules/operations/src/react/export/ExcelExportAction.tsx +481 -61
- package/templates/.agents/dashboard/modules/operations/src/react/export/export-layout.test.ts +14 -1
- package/templates/.agents/dashboard/modules/operations/src/react/export/xlsx-runtime-e2e.test.ts +248 -0
- package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.test.ts +4 -4
- package/templates/.agents/dashboard/modules/operations/src/react/operation-duration.ts +6 -4
- package/templates/.agents/dashboard/modules/operations/src/react/operations-global-filters.test.ts +4 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +1 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.status-cards.test.ts +1 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +46 -6
- package/templates/.agents/dashboard/modules/operations/src/react/operations-view-order.test.ts +1 -4
- package/templates/.agents/dashboard/modules/operations/src/react/period-summary.test.ts +82 -6
- package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.test.ts +2 -1
- package/templates/.agents/dashboard/modules/operations/src/react/work-board-model.ts +1 -1
- package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.test.ts +19 -7
- package/templates/.agents/dashboard/modules/operations/src/server/execution-relationship-counts.ts +4 -1
- package/templates/.agents/dashboard/modules/operations/src/server/quick-daily-operations-projection.ts +11 -5
- package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
- package/templates/.agents/dashboard/packages/branding/package.json +1 -1
- package/templates/.agents/dashboard/packages/branding/src/index.ts +1 -1
- package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
- package/templates/.agents/dashboard/packages/contracts/src/index.ts +1 -0
- package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +152 -149
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs.metafile.json +7333 -0
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +149 -146
- package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-dashboard.mjs +15 -7
- package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +44 -13
- package/templates/.agents/dashboard/packages/local-runtime/scripts/rebuild-sqlite-read-model.mjs +5 -2
- package/templates/.agents/dashboard/packages/local-runtime/scripts/source-size-runtime-scripts/sqlite-read-model-fixture.mjs +397 -0
- package/templates/.agents/dashboard/packages/local-runtime/scripts/test-sqlite-read-model.mjs +472 -145
- package/templates/.agents/dashboard/packages/local-runtime/scripts/test-unix-launchers.mjs +15 -3
- package/templates/.agents/dashboard/packages/local-runtime/scripts/validate-sqlite-read-model.mjs +129 -31
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +153 -150
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +6 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +3 -3
- package/templates/.agents/dashboard/packages/local-runtime/src/server-board.test.ts +55 -16
- package/templates/.agents/dashboard/packages/local-runtime/src/server-board.ts +23 -13
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +19 -4
- package/templates/.agents/dashboard/packages/local-runtime/src/server-workspace.ts +7 -3
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +132 -9
- package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +126 -60
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.ts +16 -2
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +1861 -350
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +1218 -352
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +119 -42
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +45 -20
- package/templates/.agents/dashboard/packages/ui/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/specs/dashboard.spec.ts +7 -5
- package/templates/.agents/design/.zaip-managed.json +3 -3
- package/templates/.agents/design/apps/catalog/package.json +1 -1
- package/templates/.agents/design/packages/local-runtime/package.json +1 -1
- package/templates/.agents/growth/estrategia-bootstrap-90-dias.md +169 -0
- package/templates/.agents/growth/strategy.md +27 -0
- package/templates/.agents/marketing/estrategia-marketing-zaip-90-dias.md +197 -0
- package/templates/.agents/marketing/strategy.md +29 -0
- package/templates/.agents/requirements/autonomous-assurance.md +1 -1
- package/templates/.agents/requirements/comparative-audit.md +1 -1
- package/templates/.agents/requirements/context-engine.md +1 -1
- package/templates/.agents/requirements/cost-observability.md +1 -1
- package/templates/.agents/requirements/dashboard-launch.md +1 -1
- package/templates/.agents/requirements/data-export.md +1 -1
- package/templates/.agents/requirements/design-system.md +1 -1
- package/templates/.agents/requirements/execution-engine.md +1 -1
- package/templates/.agents/requirements/kanban-dashboard.md +1 -1
- package/templates/.agents/requirements/model-orchestration.md +1 -1
- package/templates/.agents/requirements/public-distribution.md +1 -1
- package/templates/.agents/requirements/software-architecture.md +1 -1
- package/templates/.agents/requirements/strategic-improvements.md +1 -1
- package/templates/.agents/requirements/work-lifecycle.md +1 -1
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/runtime/VERSION +1 -1
- package/templates/.agents/runtime/bin/zaip.mjs +30 -29
- package/templates/.agents/runtime/checksums.sha256 +6 -6
- package/templates/.agents/runtime/manifest.json +1 -1
- package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
- package/templates/.agents/runtime/provenance.json +5 -5
- package/templates/.agents/runtime/sbom.cdx.json +3 -3
- package/templates/.agents/sales/playbook.md +32 -0
- package/templates/.agents/sales/roteiro-comercial-zaip.md +252 -0
- package/templates/.agents/skills/zaip-aios/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-brand-governance/SKILL.md +9 -2
- package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-framework.md +39 -0
- package/templates/.agents/skills/zaip-skill-brand-governance/references/brandbook-standards.md +1 -1
- package/templates/.agents/skills/zaip-skill-enforce-architecture/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-growth-strategy-revops/SKILL.md +6 -0
- package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +6 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +39 -82
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +13 -8
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +44 -14
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.mjs +19 -9
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.test.mjs +29 -5
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/source-size-telemetry/model-identity-reconciliation.mjs +77 -0
- package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +6 -0
- package/templates/.agents/skills/zaip-skill-sqlite-read-model/scripts/ensure-node.mjs +28 -5
- package/templates/.agents/zaip-aios/INDEX.md +10 -0
- package/templates/.agents/zaip-aios/README.md +2 -1
- package/templates/.agents/zaip-aios/VERSION +1 -1
- package/templates/.agents/zaip-aios/guides/18-catalogo-de-agentes.md +76 -0
- package/templates/.agents/zaip-aios/guides/19-assurance-e-autonomia.md +72 -0
- package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +330 -0
- package/templates/.agents/zaip-aios/guides/21-telemetria-monitor-custos.md +52 -0
- package/templates/.agents/zaip-aios/guides/22-fluxos-e-roteamento.md +69 -0
- package/templates/.agents/zaip-aios/guides/23-orquestracao-de-modelos.md +483 -0
- package/templates/.agents/zaip-aios/guides/24-calculo-de-custos-openai.md +85 -0
- package/templates/.agents/zaip-aios/guides/25-fontes-de-precos-openai.md +18 -0
- package/templates/.agents/zaip-aios/guides/26-qualidade-e-release.md +44 -0
- package/templates/.agents/zaip-aios/guides/27-telemetria-git-native.md +167 -0
- package/templates/.agents/zaip-aios/guides/28-lifecycle-completo.md +144 -0
- package/templates/.agents/zaip-aios/guides/assets/diagrams/lifecycles-task-spec-prd.png +0 -0
- package/templates/.agents/zaip-aios/guides/assets/diagrams/prd-lifecycle.png +0 -0
- package/templates/.agents/zaip-aios/guides/assets/diagrams/spec-lifecycle.png +0 -0
- package/templates/.agents/zaip-aios/guides/assets/diagrams/task-lifecycle.png +0 -0
- package/templates/template-manifest.json +313 -177
- package/templates/.agents/dashboard/apps/frontend/dist/assets/DashboardHelpDialog-Cs6dzDmW.js +0 -1505
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-QE1k9yZB.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-_Pf5DA_A.js +0 -3
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BVlz3DLZ.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-Cf9ctPVt.js +0 -68
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-8A4DcNXM.js +0 -2
|
@@ -6,23 +6,24 @@ import {
|
|
|
6
6
|
duplicateUsageImpact,
|
|
7
7
|
exactCompletedSegment,
|
|
8
8
|
filesUnder,
|
|
9
|
-
jsonLines,
|
|
10
9
|
isExactDuplicateUsageGroup,
|
|
10
|
+
jsonLines,
|
|
11
11
|
loadSegments,
|
|
12
12
|
pricingFor,
|
|
13
13
|
recordOccurredAt,
|
|
14
14
|
recordSequence,
|
|
15
15
|
recordType,
|
|
16
16
|
sameCost,
|
|
17
|
+
supersedableUsageBeforeTerminal,
|
|
17
18
|
usageStatus,
|
|
18
19
|
usageView,
|
|
19
|
-
supersedableUsageBeforeTerminal,
|
|
20
20
|
withSequence,
|
|
21
21
|
} from "./reconcile-telemetry-lib.mjs";
|
|
22
22
|
import {
|
|
23
23
|
remeasureSelectedRuns,
|
|
24
24
|
timingEnrichmentRunIds,
|
|
25
25
|
} from "./reconcile-telemetry-remeasurement.mjs";
|
|
26
|
+
import { reconcileGenericModelIdentities } from "./source-size-telemetry/model-identity-reconciliation.mjs";
|
|
26
27
|
|
|
27
28
|
const workspace = resolve(process.cwd());
|
|
28
29
|
const apply = process.argv.includes("--apply");
|
|
@@ -318,86 +319,35 @@ if (reprice) {
|
|
|
318
319
|
}
|
|
319
320
|
}
|
|
320
321
|
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
? (segmentsByKey.get(usage.source_segment_key) ?? null)
|
|
331
|
-
: null;
|
|
332
|
-
return segment?.model && !genericModel(segment.model) ? [{ usage, segment }] : [];
|
|
333
|
-
});
|
|
334
|
-
modelIdentityCorrections += corrections.length;
|
|
335
|
-
if (!applyBackfill || corrections.length === 0) continue;
|
|
336
|
-
|
|
337
|
-
const correctionByTarget = new Map(corrections.map((item) => [item.usage.event_id, item]));
|
|
338
|
-
const updated = [];
|
|
339
|
-
let correctionIndex = run.usage.filter(
|
|
340
|
-
(usage) => usage.activity_kind === "model_identity_reconciliation",
|
|
341
|
-
).length;
|
|
342
|
-
for (const record of run.records) {
|
|
343
|
-
updated.push(record);
|
|
344
|
-
const original = usageView(record);
|
|
345
|
-
const correction = original ? correctionByTarget.get(original.event_id) : null;
|
|
346
|
-
if (!correction) continue;
|
|
347
|
-
correctionIndex += 1;
|
|
348
|
-
const cost = await pricingFor(workspace, correction.segment.model, original.tokens);
|
|
349
|
-
updated.push({
|
|
350
|
-
schema_version: 2,
|
|
351
|
-
event_id: `${run.started.run_id}:model:${String(correctionIndex).padStart(6, "0")}`,
|
|
352
|
-
run_id: run.started.run_id,
|
|
353
|
-
sequence: 0,
|
|
354
|
-
occurred_at: original.occurred_at,
|
|
355
|
-
type: "usage.recorded",
|
|
356
|
-
phase: original.phase,
|
|
357
|
-
activity_kind: "model_identity_reconciliation",
|
|
358
|
-
classification_source: original.classification_source ?? "current_context",
|
|
359
|
-
tokens: original.tokens,
|
|
360
|
-
cost,
|
|
361
|
-
provider: original.provider ?? run.started.provider ?? "openai",
|
|
362
|
-
model: correction.segment.model,
|
|
363
|
-
source_segment_key: original.source_segment_key,
|
|
364
|
-
supersedes_event_id: original.event_id,
|
|
365
|
-
source_occurred_at:
|
|
366
|
-
original.source_occurred_at ??
|
|
367
|
-
correction.segment.finished_at ??
|
|
368
|
-
correction.segment.started_at,
|
|
369
|
-
...(original.context_stats === undefined ? {} : { context_stats: original.context_stats }),
|
|
370
|
-
runtime: {
|
|
371
|
-
reasoning_effort: correction.segment.effort ?? original.runtime?.reasoning_effort ?? null,
|
|
372
|
-
service_tier: correction.segment.service_tier ?? original.runtime?.service_tier ?? null,
|
|
373
|
-
},
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
const resequenced = updated.map((record, index) => withSequence(record, index + 1));
|
|
377
|
-
const temporary = `${run.file}.model.tmp`;
|
|
378
|
-
await writeFile(
|
|
379
|
-
temporary,
|
|
380
|
-
`${resequenced.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
381
|
-
"utf8",
|
|
382
|
-
);
|
|
383
|
-
await rename(temporary, run.file);
|
|
384
|
-
}
|
|
322
|
+
const modelIdentityCorrections = await reconcileGenericModelIdentities({
|
|
323
|
+
applyBackfill,
|
|
324
|
+
pricingFor,
|
|
325
|
+
runs,
|
|
326
|
+
segments: allSegments,
|
|
327
|
+
usageView,
|
|
328
|
+
withSequence,
|
|
329
|
+
workspace,
|
|
330
|
+
});
|
|
385
331
|
|
|
386
332
|
const duplicateGroups = duplicateUsageAssignments(runs);
|
|
387
333
|
const exactDuplicateGroups = duplicateGroups.filter(isExactDuplicateUsageGroup);
|
|
388
334
|
const aliasReviewGroups = duplicateGroups.filter((group) => !isExactDuplicateUsageGroup(group));
|
|
389
|
-
const selectedDuplicateGroups =
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
)
|
|
335
|
+
const selectedDuplicateGroups =
|
|
336
|
+
selectedRunIds.size === 0
|
|
337
|
+
? exactDuplicateGroups
|
|
338
|
+
: exactDuplicateGroups.filter((group) =>
|
|
339
|
+
group.some(({ run }) => selectedRunIds.has(run.started.run_id)),
|
|
340
|
+
);
|
|
341
|
+
const selectedAliasReviewGroups =
|
|
342
|
+
selectedRunIds.size === 0
|
|
343
|
+
? aliasReviewGroups
|
|
344
|
+
: aliasReviewGroups.filter((group) =>
|
|
345
|
+
group.some(({ run }) => selectedRunIds.has(run.started.run_id)),
|
|
346
|
+
);
|
|
399
347
|
const duplicateAssignments = selectedDuplicateGroups.flatMap((group) =>
|
|
400
|
-
group
|
|
348
|
+
group
|
|
349
|
+
.slice(1)
|
|
350
|
+
.filter(({ run }) => selectedRunIds.size === 0 || selectedRunIds.has(run.started.run_id)),
|
|
401
351
|
);
|
|
402
352
|
let deduplicatedEvents = 0;
|
|
403
353
|
if (apply && deduplicate) {
|
|
@@ -641,6 +591,7 @@ for (const candidate of candidates) {
|
|
|
641
591
|
}
|
|
642
592
|
const eligible = candidates.filter(
|
|
643
593
|
(candidate) =>
|
|
594
|
+
(selectedRunIds.size === 0 || selectedRunIds.has(candidate.run.started.run_id)) &&
|
|
644
595
|
byRun.get(candidate.run.started.run_id).length === 1 &&
|
|
645
596
|
bySegment.get(candidate.segment.key).length === 1,
|
|
646
597
|
);
|
|
@@ -650,7 +601,9 @@ if (applyBackfill) {
|
|
|
650
601
|
// Re-read each Run under the serial apply loop: a preceding timing repair may
|
|
651
602
|
// have reordered or appended a correction after the initial scan.
|
|
652
603
|
const persistedRecords = jsonLines(await readFile(run.file, "utf8"));
|
|
653
|
-
const finishIndex = persistedRecords.findIndex(
|
|
604
|
+
const finishIndex = persistedRecords.findIndex(
|
|
605
|
+
(record) => recordType(record) === "run.finished",
|
|
606
|
+
);
|
|
654
607
|
const insertAt = finishIndex < 0 ? persistedRecords.length : finishIndex;
|
|
655
608
|
const tokens = aggregate(segment);
|
|
656
609
|
const model = segment.model ?? run.started.model ?? null;
|
|
@@ -665,7 +618,9 @@ if (applyBackfill) {
|
|
|
665
618
|
occurred_at: persistedRecords.find((record) => recordType(record) === "run.finished")
|
|
666
619
|
? new Date(
|
|
667
620
|
Date.parse(
|
|
668
|
-
recordOccurredAt(
|
|
621
|
+
recordOccurredAt(
|
|
622
|
+
persistedRecords.find((record) => recordType(record) === "run.finished"),
|
|
623
|
+
),
|
|
669
624
|
) - 1,
|
|
670
625
|
).toISOString()
|
|
671
626
|
: new Date().toISOString(),
|
|
@@ -686,9 +641,11 @@ if (applyBackfill) {
|
|
|
686
641
|
...(segment.finished_at ? { source_finished_at: segment.finished_at } : {}),
|
|
687
642
|
runtime: { reasoning_effort: segment.effort, service_tier: segment.service_tier },
|
|
688
643
|
};
|
|
689
|
-
const updated = [
|
|
690
|
-
(
|
|
691
|
-
|
|
644
|
+
const updated = [
|
|
645
|
+
...persistedRecords.slice(0, insertAt),
|
|
646
|
+
event,
|
|
647
|
+
...persistedRecords.slice(insertAt),
|
|
648
|
+
].map((record, index) => withSequence(record, index + 1));
|
|
692
649
|
const temporary = `${run.file}.reconcile.tmp`;
|
|
693
650
|
await writeFile(
|
|
694
651
|
temporary,
|
package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs
CHANGED
|
@@ -116,12 +116,15 @@ export function supersedableUsageBeforeTerminal(records) {
|
|
|
116
116
|
const finishIndex = records.findIndex((record) => recordType(record) === "run.finished");
|
|
117
117
|
const beforeTerminal = records.slice(0, finishIndex < 0 ? records.length : finishIndex);
|
|
118
118
|
const usage = beforeTerminal.map(usageView).filter(Boolean);
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
(
|
|
123
|
-
event
|
|
124
|
-
|
|
119
|
+
return (
|
|
120
|
+
[...usage]
|
|
121
|
+
.reverse()
|
|
122
|
+
.find(
|
|
123
|
+
(event) =>
|
|
124
|
+
event.tokens?.total === null &&
|
|
125
|
+
!usage.some((other) => other.supersedes_event_id === event.event_id),
|
|
126
|
+
) ?? null
|
|
127
|
+
);
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
export function withSequence(record, sequence) {
|
|
@@ -183,11 +186,13 @@ export function duplicateUsageAssignments(runs) {
|
|
|
183
186
|
return [...groups.values()]
|
|
184
187
|
.filter((group) => new Set(group.map(({ run }) => run.started.run_id)).size > 1)
|
|
185
188
|
.map((group) =>
|
|
186
|
-
[...group].sort(
|
|
189
|
+
[...group].sort(
|
|
190
|
+
(left, right) =>
|
|
187
191
|
provenanceRank(left.usage) - provenanceRank(right.usage) ||
|
|
188
192
|
String(left.run.started.occurred_at).localeCompare(
|
|
189
193
|
String(right.run.started.occurred_at),
|
|
190
|
-
) ||
|
|
194
|
+
) ||
|
|
195
|
+
left.run.started.run_id.localeCompare(right.run.started.run_id),
|
|
191
196
|
),
|
|
192
197
|
);
|
|
193
198
|
}
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
duplicateUsageImpact,
|
|
12
12
|
exactCompletedSegment,
|
|
13
13
|
exactRemeasurementSegment,
|
|
14
|
-
jsonLines,
|
|
15
14
|
isExactDuplicateUsageGroup,
|
|
15
|
+
jsonLines,
|
|
16
16
|
pricingFor,
|
|
17
17
|
recordSequence,
|
|
18
18
|
recordType,
|
|
@@ -27,7 +27,28 @@ const roots = [];
|
|
|
27
27
|
after(async () => Promise.all(roots.map((root) => rm(root, { recursive: true, force: true }))));
|
|
28
28
|
|
|
29
29
|
test("sums duplicate assignment impact without inventing duration", () => {
|
|
30
|
-
assert.deepEqual(
|
|
30
|
+
assert.deepEqual(
|
|
31
|
+
duplicateUsageImpact([
|
|
32
|
+
{
|
|
33
|
+
usage: {
|
|
34
|
+
tokens: { input: 2, output: 3, total: 5 },
|
|
35
|
+
cost: { usd: 1, brl: 5 },
|
|
36
|
+
source_started_at: "2026-01-01T00:00:00Z",
|
|
37
|
+
source_finished_at: "2026-01-01T00:00:01Z",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
]),
|
|
41
|
+
{
|
|
42
|
+
assignments: 1,
|
|
43
|
+
input_tokens: 2,
|
|
44
|
+
output_tokens: 3,
|
|
45
|
+
total_tokens: 5,
|
|
46
|
+
cost_usd: 1,
|
|
47
|
+
cost_brl: 5,
|
|
48
|
+
duration_ms: 1000,
|
|
49
|
+
duration_assignments: 1,
|
|
50
|
+
},
|
|
51
|
+
);
|
|
31
52
|
});
|
|
32
53
|
|
|
33
54
|
test("never supersedes usage recorded after run.finished", () => {
|
|
@@ -318,11 +339,10 @@ test("detects only exact duplicate segment assignments across Runs", () => {
|
|
|
318
339
|
const groups = duplicateUsageAssignments([duplicate, legitimateDelta, first]);
|
|
319
340
|
|
|
320
341
|
assert.equal(groups.length, 1);
|
|
321
|
-
assert.deepEqual(
|
|
322
|
-
|
|
323
|
-
"RUN-DUPLICATE",
|
|
324
|
-
|
|
325
|
-
]);
|
|
342
|
+
assert.deepEqual(
|
|
343
|
+
groups[0].map(({ run: item }) => item.started.run_id),
|
|
344
|
+
["RUN-FIRST", "RUN-DUPLICATE", "RUN-DELTA"],
|
|
345
|
+
);
|
|
326
346
|
assert.equal(groups[0][0].base_segment_key, "sessions/2026/07/17/session.jsonl#1");
|
|
327
347
|
});
|
|
328
348
|
|
|
@@ -350,7 +370,15 @@ test("keeps duplicate reconciliation unavailable and protected from backfill", (
|
|
|
350
370
|
test("prefers later current-context assignment over earlier legacy assignment", () => {
|
|
351
371
|
const run = (id, occurred_at, client_turn_id, classification_source, total) => ({
|
|
352
372
|
started: { run_id: id, occurred_at, client_turn_id },
|
|
353
|
-
usage: [
|
|
373
|
+
usage: [
|
|
374
|
+
{
|
|
375
|
+
event_id: `${id}:usage`,
|
|
376
|
+
source_segment_key: "sessions/x.jsonl#1",
|
|
377
|
+
supersedes_event_id: null,
|
|
378
|
+
classification_source,
|
|
379
|
+
tokens: { input: total - 1, output: 1, total },
|
|
380
|
+
},
|
|
381
|
+
],
|
|
354
382
|
});
|
|
355
383
|
const [group] = duplicateUsageAssignments([
|
|
356
384
|
run("XCHW", "2026-07-01T00:00:00.000Z", "legacy-turn", "legacy_inferred", 9_278_701),
|
|
@@ -363,12 +391,14 @@ test("prefers later current-context assignment over earlier legacy assignment",
|
|
|
363
391
|
test("keeps canonical aliases in review instead of making them apply candidates", () => {
|
|
364
392
|
const run = (id, source_segment_key) => ({
|
|
365
393
|
started: { run_id: id, occurred_at: "2026-07-01T00:00:00.000Z" },
|
|
366
|
-
usage: [
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
394
|
+
usage: [
|
|
395
|
+
{
|
|
396
|
+
event_id: `${id}:usage`,
|
|
397
|
+
source_segment_key,
|
|
398
|
+
supersedes_event_id: null,
|
|
399
|
+
tokens: { input: 1, output: 1, total: 2 },
|
|
400
|
+
},
|
|
401
|
+
],
|
|
372
402
|
});
|
|
373
403
|
const [aliasGroup] = duplicateUsageAssignments([
|
|
374
404
|
run("RUN-A", "sessions/x.jsonl#1@RUN-A"),
|
|
@@ -172,18 +172,26 @@ export async function appendRetrospectiveUsage(file, expectedRecords, event) {
|
|
|
172
172
|
const beforeFinish = persisted.slice(0, finishIndex);
|
|
173
173
|
const finish = persisted[finishIndex];
|
|
174
174
|
const historicalCorrections = persisted.slice(finishIndex + 1);
|
|
175
|
-
const updated = [...beforeFinish, ...historicalCorrections, event, finish].map(
|
|
176
|
-
withSequence(record, index + 1),
|
|
175
|
+
const updated = [...beforeFinish, ...historicalCorrections, event, finish].map(
|
|
176
|
+
(record, index) => withSequence(record, index + 1),
|
|
177
177
|
);
|
|
178
178
|
const temporary = `${file}.remeasure.tmp`;
|
|
179
|
-
await writeFile(
|
|
179
|
+
await writeFile(
|
|
180
|
+
temporary,
|
|
181
|
+
`${updated.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
182
|
+
"utf8",
|
|
183
|
+
);
|
|
180
184
|
await rename(temporary, file);
|
|
181
185
|
} finally {
|
|
182
186
|
await rm(lockPath, { force: true });
|
|
183
187
|
}
|
|
184
188
|
}
|
|
185
189
|
|
|
186
|
-
export function assertRetrospectiveAppend(
|
|
190
|
+
export function assertRetrospectiveAppend(
|
|
191
|
+
records,
|
|
192
|
+
event,
|
|
193
|
+
{ allowPostTerminalCorrections = false } = {},
|
|
194
|
+
) {
|
|
187
195
|
const finishIndex = records.findIndex((record) => recordType(record) === "run.finished");
|
|
188
196
|
const finished = records[finishIndex];
|
|
189
197
|
const target = records.find(
|
|
@@ -193,11 +201,13 @@ export function assertRetrospectiveAppend(records, event, { allowPostTerminalCor
|
|
|
193
201
|
recordType(finished) !== "run.finished" ||
|
|
194
202
|
(!allowPostTerminalCorrections && finishIndex !== records.length - 1) ||
|
|
195
203
|
(allowPostTerminalCorrections &&
|
|
196
|
-
records
|
|
197
|
-
(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
204
|
+
records
|
|
205
|
+
.slice(finishIndex + 1)
|
|
206
|
+
.some(
|
|
207
|
+
(record) =>
|
|
208
|
+
usageView(record)?.activity_kind !== "retrospective_local_remeasurement" ||
|
|
209
|
+
usageView(record)?.retrospective_correction !== true,
|
|
210
|
+
)) ||
|
|
201
211
|
event.type !== "usage.recorded" ||
|
|
202
212
|
event.retrospective_correction !== true ||
|
|
203
213
|
event.activity_kind !== "retrospective_local_remeasurement" ||
|
|
@@ -63,7 +63,10 @@ test("inserts a correction before the terminal event under an exclusive lock", a
|
|
|
63
63
|
const events = jsonLines(persisted);
|
|
64
64
|
assert.equal(events.at(-2).event_id, correction.event_id);
|
|
65
65
|
assert.equal(events.at(-1).type, "run.finished");
|
|
66
|
-
assert.deepEqual(
|
|
66
|
+
assert.deepEqual(
|
|
67
|
+
events.map((event) => event.sequence),
|
|
68
|
+
[1, 2, 3, 4],
|
|
69
|
+
);
|
|
67
70
|
});
|
|
68
71
|
|
|
69
72
|
test("restores historical retrospective corrections before the terminal event", async () => {
|
|
@@ -74,13 +77,34 @@ test("restores historical retrospective corrections before the terminal event",
|
|
|
74
77
|
{ type: "run.started", event_id: "RUN:1", sequence: 1, phase: "execution" },
|
|
75
78
|
{ type: "usage.recorded", event_id: "RUN:2", sequence: 2, phase: "execution" },
|
|
76
79
|
{ type: "run.finished", event_id: "RUN:3", sequence: 3, phase: "execution" },
|
|
77
|
-
{
|
|
80
|
+
{
|
|
81
|
+
type: "usage.recorded",
|
|
82
|
+
event_id: "RUN:4",
|
|
83
|
+
sequence: 4,
|
|
84
|
+
phase: "execution",
|
|
85
|
+
activity_kind: "retrospective_local_remeasurement",
|
|
86
|
+
retrospective_correction: true,
|
|
87
|
+
},
|
|
78
88
|
];
|
|
79
89
|
await writeFile(file, `${records.map((record) => JSON.stringify(record)).join("\n")}\n`, "utf8");
|
|
80
|
-
await appendRetrospectiveUsage(file, records, {
|
|
90
|
+
await appendRetrospectiveUsage(file, records, {
|
|
91
|
+
type: "usage.recorded",
|
|
92
|
+
event_id: "RUN:5",
|
|
93
|
+
sequence: 5,
|
|
94
|
+
phase: "execution",
|
|
95
|
+
activity_kind: "retrospective_local_remeasurement",
|
|
96
|
+
supersedes_event_id: "RUN:2",
|
|
97
|
+
retrospective_correction: true,
|
|
98
|
+
});
|
|
81
99
|
const events = jsonLines(await readFile(file, "utf8"));
|
|
82
|
-
assert.deepEqual(
|
|
83
|
-
|
|
100
|
+
assert.deepEqual(
|
|
101
|
+
events.map((event) => event.event_id),
|
|
102
|
+
["RUN:1", "RUN:2", "RUN:4", "RUN:5", "RUN:3"],
|
|
103
|
+
);
|
|
104
|
+
assert.deepEqual(
|
|
105
|
+
events.map((event) => event.sequence),
|
|
106
|
+
[1, 2, 3, 4, 5],
|
|
107
|
+
);
|
|
84
108
|
});
|
|
85
109
|
|
|
86
110
|
test("an unavailable lock leaves the original history byte-identical", async () => {
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { rename, writeFile } from "node:fs/promises";
|
|
2
|
+
|
|
3
|
+
export async function reconcileGenericModelIdentities({
|
|
4
|
+
applyBackfill,
|
|
5
|
+
pricingFor,
|
|
6
|
+
runs,
|
|
7
|
+
segments,
|
|
8
|
+
usageView,
|
|
9
|
+
withSequence,
|
|
10
|
+
workspace,
|
|
11
|
+
}) {
|
|
12
|
+
const segmentsByKey = new Map(segments.map((segment) => [segment.key, segment]));
|
|
13
|
+
const genericModel = (model) => typeof model === "string" && /^gpt-5$/i.test(model.trim());
|
|
14
|
+
let correctionsCount = 0;
|
|
15
|
+
for (const run of runs) {
|
|
16
|
+
const superseded = new Set(run.usage.map((usage) => usage.supersedes_event_id).filter(Boolean));
|
|
17
|
+
const effective = run.usage.filter((usage) => !superseded.has(usage.event_id));
|
|
18
|
+
const corrections = effective.flatMap((usage) => {
|
|
19
|
+
if (!genericModel(usage.model ?? run.started.model)) return [];
|
|
20
|
+
const segment = usage.source_segment_key
|
|
21
|
+
? (segmentsByKey.get(usage.source_segment_key) ?? null)
|
|
22
|
+
: null;
|
|
23
|
+
return segment?.model && !genericModel(segment.model) ? [{ usage, segment }] : [];
|
|
24
|
+
});
|
|
25
|
+
correctionsCount += corrections.length;
|
|
26
|
+
if (!applyBackfill || corrections.length === 0) continue;
|
|
27
|
+
|
|
28
|
+
const correctionByTarget = new Map(corrections.map((item) => [item.usage.event_id, item]));
|
|
29
|
+
const updated = [];
|
|
30
|
+
let correctionIndex = run.usage.filter(
|
|
31
|
+
(usage) => usage.activity_kind === "model_identity_reconciliation",
|
|
32
|
+
).length;
|
|
33
|
+
for (const record of run.records) {
|
|
34
|
+
updated.push(record);
|
|
35
|
+
const original = usageView(record);
|
|
36
|
+
const correction = original ? correctionByTarget.get(original.event_id) : null;
|
|
37
|
+
if (!correction) continue;
|
|
38
|
+
correctionIndex += 1;
|
|
39
|
+
const cost = await pricingFor(workspace, correction.segment.model, original.tokens);
|
|
40
|
+
updated.push({
|
|
41
|
+
schema_version: 2,
|
|
42
|
+
event_id: `${run.started.run_id}:model:${String(correctionIndex).padStart(6, "0")}`,
|
|
43
|
+
run_id: run.started.run_id,
|
|
44
|
+
sequence: 0,
|
|
45
|
+
occurred_at: original.occurred_at,
|
|
46
|
+
type: "usage.recorded",
|
|
47
|
+
phase: original.phase,
|
|
48
|
+
activity_kind: "model_identity_reconciliation",
|
|
49
|
+
classification_source: original.classification_source ?? "current_context",
|
|
50
|
+
tokens: original.tokens,
|
|
51
|
+
cost,
|
|
52
|
+
provider: original.provider ?? run.started.provider ?? "openai",
|
|
53
|
+
model: correction.segment.model,
|
|
54
|
+
source_segment_key: original.source_segment_key,
|
|
55
|
+
supersedes_event_id: original.event_id,
|
|
56
|
+
source_occurred_at:
|
|
57
|
+
original.source_occurred_at ??
|
|
58
|
+
correction.segment.finished_at ??
|
|
59
|
+
correction.segment.started_at,
|
|
60
|
+
...(original.context_stats === undefined ? {} : { context_stats: original.context_stats }),
|
|
61
|
+
runtime: {
|
|
62
|
+
reasoning_effort: correction.segment.effort ?? original.runtime?.reasoning_effort ?? null,
|
|
63
|
+
service_tier: correction.segment.service_tier ?? original.runtime?.service_tier ?? null,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const resequenced = updated.map((record, index) => withSequence(record, index + 1));
|
|
68
|
+
const temporary = `${run.file}.model.tmp`;
|
|
69
|
+
await writeFile(
|
|
70
|
+
temporary,
|
|
71
|
+
`${resequenced.map((record) => JSON.stringify(record)).join("\n")}\n`,
|
|
72
|
+
"utf8",
|
|
73
|
+
);
|
|
74
|
+
await rename(temporary, run.file);
|
|
75
|
+
}
|
|
76
|
+
return correctionsCount;
|
|
77
|
+
}
|
|
@@ -5,6 +5,12 @@ description: Design evidence-backed sales processes, qualification playbooks, an
|
|
|
5
5
|
|
|
6
6
|
# Metodologia comercial
|
|
7
7
|
|
|
8
|
+
## Localização canônica
|
|
9
|
+
|
|
10
|
+
Salve processos comerciais, playbooks, scripts internos, matrizes de objeções e materiais de enablement em `.agents/sales/`. Não salve esses artefatos em `docs/`, na raiz do repositório ou em diretórios de brand, marketing ou growth.
|
|
11
|
+
|
|
12
|
+
O arquivo central da área é `.agents/sales/playbook.md`; atualize-o quando uma decisão mudar o processo comercial, qualificação, handoff ou narrativa sales-facing. Materiais específicos podem ser arquivos adicionais na mesma pasta.
|
|
13
|
+
|
|
8
14
|
1. Delimite empresa, oferta, ICP, persona, canal, origem inbound/outbound, etapa, nível de awareness, complexidade, ticket, ciclo, regiões, compliance e autoridade. Separe fato, evidência, hipótese e decisão; não fabrique consciência, urgência, prova, ROI, preço ou autoridade.
|
|
9
15
|
2. Desenhe um playbook por etapa com objetivo, dono, entrada, abertura, perguntas, evidência, campos SPIN/BANT, transição, objeções, prova autorizada, microcompromisso, saída, CRM, handoff/SLA e próximo passo. Inclua caminhos de not-qualified, nurture e no-decision.
|
|
10
16
|
3. Use as três etapas ZAIP: descoberta/pré-qualificação (tipicamente SDR), alinhamento/qualificação com handoff definido para closer, e fechamento/negociação pelo closer. O preço só pode ser apresentado como aprovado; proposta e contrato seguem o handoff autorizado.
|
|
@@ -2,17 +2,40 @@ import { execFileSync } from "node:child_process";
|
|
|
2
2
|
|
|
3
3
|
const minimumMajor = 22;
|
|
4
4
|
function version() {
|
|
5
|
-
try {
|
|
5
|
+
try {
|
|
6
|
+
return execFileSync(process.execPath, ["--version"], { encoding: "utf8" }).trim();
|
|
7
|
+
} catch {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
6
10
|
}
|
|
7
11
|
const current = version();
|
|
8
12
|
if (current && Number.parseInt(current.slice(1), 10) >= minimumMajor) {
|
|
9
13
|
process.stdout.write(`${current} is ready\n`);
|
|
10
14
|
process.exit(0);
|
|
11
15
|
}
|
|
12
|
-
if (process.platform !== "win32")
|
|
16
|
+
if (process.platform !== "win32")
|
|
17
|
+
throw new Error(
|
|
18
|
+
`Node.js ${minimumMajor}+ is required; automatic installation is only configured for Windows.`,
|
|
19
|
+
);
|
|
13
20
|
try {
|
|
14
|
-
execFileSync(
|
|
21
|
+
execFileSync(
|
|
22
|
+
"winget",
|
|
23
|
+
[
|
|
24
|
+
"install",
|
|
25
|
+
"--id",
|
|
26
|
+
"OpenJS.NodeJS.LTS",
|
|
27
|
+
"--exact",
|
|
28
|
+
"--accept-source-agreements",
|
|
29
|
+
"--accept-package-agreements",
|
|
30
|
+
],
|
|
31
|
+
{ stdio: "inherit" },
|
|
32
|
+
);
|
|
15
33
|
} catch (error) {
|
|
16
|
-
throw new Error(
|
|
34
|
+
throw new Error(
|
|
35
|
+
"Node.js 22+ is missing and winget could not install the LTS release. Install Node.js manually and retry.",
|
|
36
|
+
{ cause: error },
|
|
37
|
+
);
|
|
17
38
|
}
|
|
18
|
-
process.stdout.write(
|
|
39
|
+
process.stdout.write(
|
|
40
|
+
"Node.js LTS installation completed. Restart the terminal before running the SQLite generator.\n",
|
|
41
|
+
);
|
|
@@ -21,6 +21,16 @@ Use esta pagina como roteador de baixo custo de tokens.
|
|
|
21
21
|
| Configurar MCPs, APIs e Codex | `guides/15-tools-e-codex.md` |
|
|
22
22
|
| Entender status, Runs e reconciliação | `guides/16-lifecycle-e-reconciliacao.md` |
|
|
23
23
|
| Entender tokens, precificacao e conversao de moeda | `guides/17-como-o-custo-e-calculado.md` |
|
|
24
|
+
| Consultar o catálogo completo de agentes | `guides/18-catalogo-de-agentes.md` |
|
|
25
|
+
| Entender assurance e autonomia | `guides/19-assurance-e-autonomia.md` |
|
|
26
|
+
| Consultar instalação detalhada | `guides/20-instalacao-detalhada.md` |
|
|
27
|
+
| Consultar telemetria do Monitor de Custos | `guides/21-telemetria-monitor-custos.md` |
|
|
28
|
+
| Entender fluxos e roteamento | `guides/22-fluxos-e-roteamento.md` |
|
|
29
|
+
| Consultar a política de modelos | `guides/23-orquestracao-de-modelos.md` |
|
|
30
|
+
| Entender cálculo e fontes de custo OpenAI | `guides/24-calculo-de-custos-openai.md` e `guides/25-fontes-de-precos-openai.md` |
|
|
31
|
+
| Consultar qualidade e release | `guides/26-qualidade-e-release.md` |
|
|
32
|
+
| Entender a telemetria Git-native | `guides/27-telemetria-git-native.md` |
|
|
33
|
+
| Consultar o lifecycle completo | `guides/28-lifecycle-completo.md` |
|
|
24
34
|
| Escolher MCP ou API | `../tools/catalog.yaml` |
|
|
25
35
|
|
|
26
36
|
Antes de agir, prevalecem `../config/project.yaml`, as Rules aplicaveis e os
|
|
@@ -35,7 +35,8 @@ Quando houver conflito, prevalece a configuracao do projeto e a regra aplicavel.
|
|
|
35
35
|
- Use os guias 03 a 06 para Tasks, SPECs, PRDs e execucao com evidencias.
|
|
36
36
|
- Use o guia 09 para delegacao entre os 23 agentes e 6 squads registrados.
|
|
37
37
|
- Use o guia 16 para entender status, reconciliacao e a ordem de finalizacao.
|
|
38
|
-
- Use
|
|
38
|
+
- Use os guias 17 e 24 a 25 para interpretar tokens, precificacao e conversao de moeda.
|
|
39
|
+
- Use os guias 18 a 28 quando precisar do contrato completo de agentes, lifecycle, telemetria, qualidade, instalacao ou roteamento.
|
|
39
40
|
|
|
40
41
|
O instalador npm projeta esta pasta da `.agents` canonica para o tarball e a
|
|
41
42
|
recria no projeto consumidor. Arquivos em `public-cli/packages/cli/templates`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0
|
|
1
|
+
1.3.0
|