@yiaany/ghostapi 0.1.7 → 0.1.9
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/CHANGELOG.md +42 -2
- package/CONTRIBUTING.md +119 -117
- package/LICENSE +21 -21
- package/README.md +208 -181
- package/SECURITY.md +53 -37
- package/dist/actions/gateway.d.ts +179 -0
- package/dist/actions/gateway.js +514 -0
- package/dist/actions/gateway.js.map +1 -0
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.js +2 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/ai/aiClient.js +4 -4
- package/dist/ai/aiClient.js.map +1 -1
- package/dist/ai/aiGenerator.d.ts +2 -2
- package/dist/ai/aiGenerator.js +21 -72
- package/dist/ai/aiGenerator.js.map +1 -1
- package/dist/ai/prompts.js +51 -51
- package/dist/ai/prompts.js.map +1 -1
- package/dist/approvals/approvalInbox.d.ts +150 -0
- package/dist/approvals/approvalInbox.js +412 -0
- package/dist/approvals/approvalInbox.js.map +1 -0
- package/dist/approvals/index.d.ts +2 -0
- package/dist/approvals/index.js +2 -0
- package/dist/approvals/index.js.map +1 -0
- package/dist/behavior/behaviorStore.d.ts +2 -0
- package/dist/behavior/behaviorStore.js +50 -46
- package/dist/behavior/behaviorStore.js.map +1 -1
- package/dist/cache/index.d.ts +2 -0
- package/dist/cache/index.js +58 -14
- package/dist/cache/index.js.map +1 -1
- package/dist/cli/index.js +438 -58
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/openUrl.d.ts +10 -0
- package/dist/cli/openUrl.js +31 -0
- package/dist/cli/openUrl.js.map +1 -0
- package/dist/cli/parser.d.ts +155 -0
- package/dist/cli/parser.js +504 -2
- package/dist/cli/parser.js.map +1 -1
- package/dist/config/dataPaths.d.ts +31 -0
- package/dist/config/dataPaths.js +45 -0
- package/dist/config/dataPaths.js.map +1 -0
- package/dist/config/localConfig.d.ts +1 -2
- package/dist/config/localConfig.js +27 -21
- package/dist/config/localConfig.js.map +1 -1
- package/dist/config/serverConfig.d.ts +2 -0
- package/dist/config/serverConfig.js +8 -1
- package/dist/config/serverConfig.js.map +1 -1
- package/dist/contracts/contract.d.ts +76 -0
- package/dist/contracts/contract.js +603 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/index.d.ts +2 -0
- package/dist/contracts/index.js +2 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/credentials/credentialBroker.d.ts +207 -0
- package/dist/credentials/credentialBroker.js +588 -0
- package/dist/credentials/credentialBroker.js.map +1 -0
- package/dist/credentials/index.d.ts +2 -0
- package/dist/credentials/index.js +2 -0
- package/dist/credentials/index.js.map +1 -0
- package/dist/dashboard/app.js +685 -615
- package/dist/dashboard/index.html +13 -7
- package/dist/dashboard/styles.css +349 -349
- package/dist/egress/capabilities.d.ts +32 -0
- package/dist/egress/capabilities.js +165 -0
- package/dist/egress/capabilities.js.map +1 -0
- package/dist/egress/linuxBootstrap.d.ts +1 -0
- package/dist/egress/linuxBootstrap.js +121 -0
- package/dist/egress/linuxBootstrap.js.map +1 -0
- package/dist/egress/run.d.ts +18 -0
- package/dist/egress/run.js +305 -0
- package/dist/egress/run.js.map +1 -0
- package/dist/errors/errorEngine.d.ts +2 -2
- package/dist/errors/errorEngine.js +3 -40
- package/dist/errors/errorEngine.js.map +1 -1
- package/dist/evals/evals.d.ts +126 -0
- package/dist/evals/evals.js +466 -0
- package/dist/evals/evals.js.map +1 -0
- package/dist/evals/index.d.ts +2 -0
- package/dist/evals/index.js +2 -0
- package/dist/evals/index.js.map +1 -0
- package/dist/evidence/index.d.ts +2 -0
- package/dist/evidence/index.js +2 -0
- package/dist/evidence/index.js.map +1 -0
- package/dist/evidence/report.d.ts +143 -0
- package/dist/evidence/report.js +556 -0
- package/dist/evidence/report.js.map +1 -0
- package/dist/fault/faultLab.d.ts +5 -4
- package/dist/fault/faultLab.js +66 -24
- package/dist/fault/faultLab.js.map +1 -1
- package/dist/index.d.ts +46 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/inventory/analysis.d.ts +12 -0
- package/dist/inventory/analysis.js +457 -0
- package/dist/inventory/analysis.js.map +1 -0
- package/dist/inventory/index.d.ts +5 -0
- package/dist/inventory/index.js +4 -0
- package/dist/inventory/index.js.map +1 -0
- package/dist/inventory/inventoryController.d.ts +53 -0
- package/dist/inventory/inventoryController.js +1044 -0
- package/dist/inventory/inventoryController.js.map +1 -0
- package/dist/inventory/types.d.ts +579 -0
- package/dist/inventory/types.js +787 -0
- package/dist/inventory/types.js.map +1 -0
- package/dist/landing/assets/index-CxWsopzP.css +1 -0
- package/dist/landing/assets/index-DZlpyhqd.js +55 -0
- package/dist/landing/assets/index-Dk-Xezs3.js +55 -0
- package/dist/landing/index.html +15 -15
- package/dist/ledger/actionLedger.d.ts +125 -0
- package/dist/ledger/actionLedger.js +594 -0
- package/dist/ledger/actionLedger.js.map +1 -0
- package/dist/ledger/index.d.ts +2 -0
- package/dist/ledger/index.js +2 -0
- package/dist/ledger/index.js.map +1 -0
- package/dist/mcp/server.js +4 -3
- package/dist/mcp/server.js.map +1 -1
- package/dist/policy/index.d.ts +3 -0
- package/dist/policy/index.js +2 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/policy.d.ts +14 -0
- package/dist/policy/policy.js +282 -0
- package/dist/policy/policy.js.map +1 -0
- package/dist/policy/types.d.ts +52 -0
- package/dist/policy/types.js +2 -0
- package/dist/policy/types.js.map +1 -0
- package/dist/productTelemetry/index.d.ts +16 -0
- package/dist/productTelemetry/index.js +142 -0
- package/dist/productTelemetry/index.js.map +1 -0
- package/dist/providers/conformance.d.ts +7 -0
- package/dist/providers/conformance.js +48 -0
- package/dist/providers/conformance.js.map +1 -0
- package/dist/providers/index.d.ts +4 -2
- package/dist/providers/index.js +3 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/packs/resendPack.d.ts +2 -0
- package/dist/providers/packs/resendPack.js +147 -0
- package/dist/providers/packs/resendPack.js.map +1 -0
- package/dist/providers/packs/stripePack.d.ts +2 -0
- package/dist/providers/packs/stripePack.js +852 -0
- package/dist/providers/packs/stripePack.js.map +1 -0
- package/dist/providers/registry.d.ts +7 -3
- package/dist/providers/registry.js +55 -4
- package/dist/providers/registry.js.map +1 -1
- package/dist/providers/resend.js +2 -11
- package/dist/providers/resend.js.map +1 -1
- package/dist/providers/runtime.d.ts +8 -0
- package/dist/providers/runtime.js +48 -0
- package/dist/providers/runtime.js.map +1 -0
- package/dist/providers/stripeWebhook.d.ts +13 -0
- package/dist/providers/stripeWebhook.js +50 -0
- package/dist/providers/stripeWebhook.js.map +1 -0
- package/dist/providers/types.d.ts +153 -0
- package/dist/proxy/cacheKey.js +3 -3
- package/dist/proxy/cacheKey.js.map +1 -1
- package/dist/proxy/providerDetector.d.ts +2 -7
- package/dist/proxy/providerDetector.js +4 -4
- package/dist/proxy/providerDetector.js.map +1 -1
- package/dist/proxy/proxyHandler.js +116 -12
- package/dist/proxy/proxyHandler.js.map +1 -1
- package/dist/proxy/requestNormalizer.d.ts +0 -1
- package/dist/proxy/requestNormalizer.js +2 -5
- package/dist/proxy/requestNormalizer.js.map +1 -1
- package/dist/reliability/costGovernance.d.ts +175 -0
- package/dist/reliability/costGovernance.js +515 -0
- package/dist/reliability/costGovernance.js.map +1 -0
- package/dist/reliability/index.d.ts +8 -0
- package/dist/reliability/index.js +5 -0
- package/dist/reliability/index.js.map +1 -0
- package/dist/reliability/reconciliation.d.ts +157 -0
- package/dist/reliability/reconciliation.js +522 -0
- package/dist/reliability/reconciliation.js.map +1 -0
- package/dist/reliability/runtimeHealth.d.ts +60 -0
- package/dist/reliability/runtimeHealth.js +356 -0
- package/dist/reliability/runtimeHealth.js.map +1 -0
- package/dist/reliability/slo.d.ts +131 -0
- package/dist/reliability/slo.js +375 -0
- package/dist/reliability/slo.js.map +1 -0
- package/dist/report/safetyReport.js +7 -3
- package/dist/report/safetyReport.js.map +1 -1
- package/dist/safety/index.d.ts +2 -0
- package/dist/safety/index.js +2 -0
- package/dist/safety/index.js.map +1 -0
- package/dist/safety/safetyController.d.ts +187 -0
- package/dist/safety/safetyController.js +477 -0
- package/dist/safety/safetyController.js.map +1 -0
- package/dist/scenarios/scenarioBundle.d.ts +75 -0
- package/dist/scenarios/scenarioBundle.js +750 -0
- package/dist/scenarios/scenarioBundle.js.map +1 -0
- package/dist/scenarios/scenarioStore.d.ts +1 -0
- package/dist/scenarios/scenarioStore.js +47 -32
- package/dist/scenarios/scenarioStore.js.map +1 -1
- package/dist/security/headerSanitizer.d.ts +2 -0
- package/dist/security/headerSanitizer.js +36 -1
- package/dist/security/headerSanitizer.js.map +1 -1
- package/dist/security/secrets.js +24 -4
- package/dist/security/secrets.js.map +1 -1
- package/dist/server/accessControl.d.ts +5 -0
- package/dist/server/accessControl.js +100 -0
- package/dist/server/accessControl.js.map +1 -0
- package/dist/server/createServer.d.ts +0 -5
- package/dist/server/createServer.js +9 -29
- package/dist/server/createServer.js.map +1 -1
- package/dist/server/eventsStore.d.ts +6 -1
- package/dist/server/eventsStore.js +83 -15
- package/dist/server/eventsStore.js.map +1 -1
- package/dist/server/routes.js +42 -10
- package/dist/server/routes.js.map +1 -1
- package/dist/server/sse.d.ts +2 -1
- package/dist/server/sse.js +15 -3
- package/dist/server/sse.js.map +1 -1
- package/dist/setup/setupGenerator.js +53 -6
- package/dist/setup/setupGenerator.js.map +1 -1
- package/dist/state/stateStore.d.ts +5 -0
- package/dist/state/stateStore.js +48 -62
- package/dist/state/stateStore.js.map +1 -1
- package/dist/storage/fileStore.d.ts +10 -0
- package/dist/storage/fileStore.js +131 -0
- package/dist/storage/fileStore.js.map +1 -0
- package/dist/teamControl/controlPlane.d.ts +255 -0
- package/dist/teamControl/controlPlane.js +918 -0
- package/dist/teamControl/controlPlane.js.map +1 -0
- package/dist/teamControl/deployment.d.ts +33 -0
- package/dist/teamControl/deployment.js +67 -0
- package/dist/teamControl/deployment.js.map +1 -0
- package/dist/teamControl/index.d.ts +4 -0
- package/dist/teamControl/index.js +3 -0
- package/dist/teamControl/index.js.map +1 -0
- package/dist/tests/testGenerator.js +4 -1
- package/dist/tests/testGenerator.js.map +1 -1
- package/dist/trust/index.d.ts +2 -0
- package/dist/trust/index.js +2 -0
- package/dist/trust/index.js.map +1 -0
- package/dist/trust/trustLadder.d.ts +182 -0
- package/dist/trust/trustLadder.js +560 -0
- package/dist/trust/trustLadder.js.map +1 -0
- package/dist/worlds/index.d.ts +2 -0
- package/dist/worlds/index.js +2 -0
- package/dist/worlds/index.js.map +1 -0
- package/dist/worlds/worlds.d.ts +160 -0
- package/dist/worlds/worlds.js +491 -0
- package/dist/worlds/worlds.js.map +1 -0
- package/docs/assets/dashboard.png +0 -0
- package/docs/ci.md +49 -0
- package/docs/commercial/README.md +29 -0
- package/docs/commercial/data-inventory.md +36 -0
- package/docs/commercial/manual-invoicing.md +44 -0
- package/docs/commercial/metrics.md +51 -0
- package/docs/commercial/pricing.md +103 -0
- package/docs/commercial/privacy-policy-draft.md +41 -0
- package/docs/commercial/terms-topics-for-counsel.md +51 -0
- package/docs/design-partners/README.md +52 -0
- package/docs/design-partners/demo-narratives.md +33 -0
- package/docs/design-partners/design-partner-offer.md +39 -0
- package/docs/design-partners/discovery-questions.md +28 -0
- package/docs/design-partners/feedback-capture-template.md +48 -0
- package/docs/design-partners/icp-one-pager.md +43 -0
- package/docs/design-partners/onboarding-checklist.md +33 -0
- package/docs/design-partners/pilot-success-criteria.md +27 -0
- package/docs/design-partners/pricing-interview-script.md +18 -0
- package/docs/design-partners/telemetry-plan.md +48 -0
- package/docs/development/baseline.md +114 -0
- package/docs/development/onboarding-smoke.md +37 -0
- package/docs/development/verification-0.1.8.md +25 -0
- package/docs/enterprise-product-roadmap-ru.md +1879 -0
- package/docs/fundraising/README.md +87 -0
- package/docs/fundraising/data-room-checklist.md +72 -0
- package/docs/fundraising/demo-script.md +52 -0
- package/docs/fundraising/design-partners-50.md +74 -0
- package/docs/fundraising/launch-posts.md +37 -0
- package/docs/fundraising/metrics-and-evidence.md +30 -0
- package/docs/fundraising/roadmap-12-month.md +25 -0
- package/docs/fundraising/technical-due-diligence-index.md +37 -0
- package/docs/fundraising/yc-application.md +25 -0
- package/docs/github-actions.md +84 -0
- package/docs/hosted-pilot.md +111 -0
- package/docs/mcp.md +52 -50
- package/docs/operations/disaster-recovery-runbook.md +81 -0
- package/docs/operations/kill-switch-runbook.md +32 -0
- package/docs/policy.md +61 -0
- package/docs/providers/authoring-packs.md +175 -0
- package/docs/providers/stripe-core-pack.md +82 -0
- package/docs/release-checklist.md +83 -71
- package/docs/release-migration-and-rollback.md +63 -0
- package/docs/release-readiness.md +39 -0
- package/docs/security/action-gateway-threat-model.md +34 -0
- package/docs/security/action-ledger-incident-replay-threat-model.md +42 -0
- package/docs/security/approval-inbox-threat-model.md +35 -0
- package/docs/security/credential-broker-threat-model.md +52 -0
- package/docs/security/egress-threat-model.md +126 -0
- package/docs/security/inventory-threat-model.md +104 -0
- package/docs/security/kill-switch-budgets-threat-model.md +37 -0
- package/docs/security/reliability-threat-model.md +111 -0
- package/docs/security/trust-ladder-threat-model.md +33 -0
- package/docs/team-control-plane.md +72 -0
- package/docs/usage.md +571 -57
- package/examples/README.md +10 -0
- package/examples/agent-instructions/README.md +39 -39
- package/examples/ci-smoke/README.md +21 -0
- package/examples/ci-smoke/ghostapi.policy.yaml +22 -0
- package/examples/ci-smoke/package.json +9 -0
- package/examples/ci-smoke/production-egress.mjs +2 -0
- package/examples/ci-smoke/safe.mjs +17 -0
- package/examples/evals/README.md +24 -0
- package/examples/evals/retry-after.eval.json +52 -0
- package/examples/generic-rest/README.md +27 -27
- package/examples/github-fetch/README.md +35 -35
- package/examples/openai-streaming/README.md +16 -0
- package/examples/openai-streaming/streaming-tool-call.mjs +31 -0
- package/examples/policy/ghostapi.policy.yaml +27 -0
- package/examples/record-replay/README.md +19 -0
- package/examples/record-replay/replay-requests.json +22 -0
- package/examples/record-replay/stripe-checkout.har.json +30 -0
- package/examples/resend-node/README.md +22 -22
- package/examples/stripe-node/README.md +35 -29
- package/examples/stripe-node/checkout-flow.mjs +61 -0
- package/examples/twilio-node/README.md +21 -21
- package/examples/worlds/README.md +19 -0
- package/examples/worlds/subscription-recovery.mjs +12 -0
- package/package.json +27 -12
- package/dist/providers/stripe.d.ts +0 -2
- package/dist/providers/stripe.js +0 -15
- package/dist/providers/stripe.js.map +0 -1
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { lstat, readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
import { getDataPaths } from "../config/dataPaths.js";
|
|
5
|
+
import { sanitizeSecretString } from "../security/secrets.js";
|
|
6
|
+
import { atomicWriteJson, ensurePrivateDirectory, withFileLock } from "../storage/fileStore.js";
|
|
7
|
+
const SCHEMA_VERSION = 1;
|
|
8
|
+
const KIND = "ghostapi.costs";
|
|
9
|
+
const MAX_STORE_BYTES = 4 * 1024 * 1024;
|
|
10
|
+
const MAX_RECORDS = 10_000;
|
|
11
|
+
const MAX_BUDGETS = 32;
|
|
12
|
+
const MAX_ALERTS = 100;
|
|
13
|
+
const MAX_WINDOW_MS = 90 * 24 * 60 * 60 * 1000;
|
|
14
|
+
const IDENTIFIER = /^[a-z0-9][a-z0-9._-]{0,127}$/;
|
|
15
|
+
export const COST_DIMENSIONS = ["agent", "project", "provider", "action_class", "workflow"];
|
|
16
|
+
export const COST_AMOUNT_KEYS = ["monetaryAmountMinor", "requests", "messages", "mutations", "deletes", "tokenCost"];
|
|
17
|
+
const ATTRIBUTION_DIMENSION_KEY = {
|
|
18
|
+
agent: "agentId",
|
|
19
|
+
project: "projectId",
|
|
20
|
+
provider: "provider",
|
|
21
|
+
action_class: "actionClass",
|
|
22
|
+
workflow: "workflowId"
|
|
23
|
+
};
|
|
24
|
+
export class CostGovernanceError extends Error {
|
|
25
|
+
constructor(message) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = "CostGovernanceError";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function createLocalCostGovernance(options = {}) {
|
|
31
|
+
return new LocalCostGovernance(options);
|
|
32
|
+
}
|
|
33
|
+
export class LocalCostGovernance {
|
|
34
|
+
path;
|
|
35
|
+
now;
|
|
36
|
+
operatorAuthorizer;
|
|
37
|
+
constructor(options = {}) {
|
|
38
|
+
this.path = options.path ?? getDataPaths().costStore;
|
|
39
|
+
this.now = options.now ?? (() => new Date());
|
|
40
|
+
this.operatorAuthorizer = options.operatorAuthorizer ?? createDisabledCostOperatorAuthorizer();
|
|
41
|
+
}
|
|
42
|
+
async recordCost(input) {
|
|
43
|
+
await this.authorize(input.identity, "cost.record");
|
|
44
|
+
const record = validateRecordInput(input.record, this.timestamp());
|
|
45
|
+
return this.mutate((state) => {
|
|
46
|
+
if (state.records.some((candidate) => candidate.tenantId === record.tenantId && candidate.actionId === record.actionId))
|
|
47
|
+
throw new CostGovernanceError("Cost record already exists for this tenant and action.");
|
|
48
|
+
if (state.records.length >= MAX_RECORDS)
|
|
49
|
+
throw new CostGovernanceError("Cost record limit was reached; export and retention review are required.");
|
|
50
|
+
state.records.push(record);
|
|
51
|
+
return clone(record);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async configureBudget(input) {
|
|
55
|
+
await this.authorize(input.identity, "cost.configure");
|
|
56
|
+
const budget = validateBudget(input.budget);
|
|
57
|
+
return this.mutate((state) => {
|
|
58
|
+
const existing = state.budgets.find((candidate) => candidate.id === budget.id);
|
|
59
|
+
if (existing === undefined) {
|
|
60
|
+
if (state.budgets.length >= MAX_BUDGETS)
|
|
61
|
+
throw new CostGovernanceError("Cost budget limit was reached.");
|
|
62
|
+
state.budgets.push(budget);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
Object.assign(existing, budget);
|
|
66
|
+
}
|
|
67
|
+
return clone(budget);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async removeBudget(input) {
|
|
71
|
+
await this.authorize(input.identity, "cost.configure");
|
|
72
|
+
const budgetId = identifier(input.budgetId, "Cost budget id");
|
|
73
|
+
await this.mutate((state) => {
|
|
74
|
+
const index = state.budgets.findIndex((candidate) => candidate.id === budgetId);
|
|
75
|
+
if (index === -1)
|
|
76
|
+
throw new CostGovernanceError("Cost budget was not found.");
|
|
77
|
+
state.budgets.splice(index, 1);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async report(input) {
|
|
81
|
+
const operator = await this.authorize(input.identity, "cost.inspect");
|
|
82
|
+
const windowMs = input.windowMs === undefined ? 30 * 24 * 60 * 60 * 1000 : boundedMs(input.windowMs, "Cost report window");
|
|
83
|
+
const projectionDays = input.projectionDays === undefined ? 7 : boundedDays(input.projectionDays, "Cost projection days");
|
|
84
|
+
const now = this.timestamp();
|
|
85
|
+
const runId = input.runId === undefined ? `cost-${randomUUID().replace(/-/g, "").slice(0, 32)}` : identifier(input.runId, "Cost report run id");
|
|
86
|
+
const state = await this.read();
|
|
87
|
+
const inWindow = tenantScoped(state.records, operator.tenantId).filter((record) => Date.parse(record.recordedAt) >= Date.parse(now) - windowMs && Date.parse(record.recordedAt) <= Date.parse(now) + 1_000);
|
|
88
|
+
const totals = sumAmounts(inWindow.map((record) => record.amounts));
|
|
89
|
+
const attribution = aggregateAttribution(inWindow);
|
|
90
|
+
const evaluations = state.budgets.map((budget) => evaluateBudget(budget, inWindow, now));
|
|
91
|
+
const alerts = deriveAlerts(state.alerts, evaluations, state.budgets, now);
|
|
92
|
+
const forecast = buildForecast(inWindow, projectionDays, now, windowMs);
|
|
93
|
+
return {
|
|
94
|
+
schemaVersion: 1,
|
|
95
|
+
kind: "ghostapi.cost-report",
|
|
96
|
+
tenantId: operator.tenantId ?? "ghostapi-local",
|
|
97
|
+
generatedAt: now,
|
|
98
|
+
runId,
|
|
99
|
+
windowMs,
|
|
100
|
+
windowStart: new Date(Date.parse(now) - windowMs).toISOString(),
|
|
101
|
+
windowEnd: now,
|
|
102
|
+
source: "Local cost records are synthetic action metadata (counts and token estimates). They are not provider invoices and must be calibrated against real billing during the pilot.",
|
|
103
|
+
totals,
|
|
104
|
+
attribution,
|
|
105
|
+
budgets: evaluations,
|
|
106
|
+
alerts: clone(alerts),
|
|
107
|
+
forecast
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
async listAlerts(input) {
|
|
111
|
+
await this.authorize(input.identity, "cost.inspect");
|
|
112
|
+
const now = this.timestamp();
|
|
113
|
+
return this.mutate((state) => {
|
|
114
|
+
const inWindow = state.records.filter((record) => Date.parse(record.recordedAt) >= Date.parse(now) - MAX_WINDOW_MS);
|
|
115
|
+
const evaluations = state.budgets.map((budget) => evaluateBudget(budget, inWindow, now));
|
|
116
|
+
state.alerts = deriveAlerts(state.alerts, evaluations, state.budgets, now);
|
|
117
|
+
return clone(state.alerts);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async acknowledgeAlert(input) {
|
|
121
|
+
const operator = await this.authorize(input.identity, "cost.acknowledge");
|
|
122
|
+
const alertId = identifier(input.alertId, "Cost alert id");
|
|
123
|
+
return this.mutate((state) => {
|
|
124
|
+
const alert = state.alerts.find((candidate) => candidate.id === alertId);
|
|
125
|
+
if (alert === undefined)
|
|
126
|
+
throw new CostGovernanceError("Cost alert was not found.");
|
|
127
|
+
if (alert.status === "acknowledged")
|
|
128
|
+
throw new CostGovernanceError("Cost alert is already acknowledged.");
|
|
129
|
+
alert.status = "acknowledged";
|
|
130
|
+
alert.acknowledgedBy = operator.principalId;
|
|
131
|
+
alert.acknowledgedAt = this.timestamp();
|
|
132
|
+
return clone(alert);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async authorize(identity, permission) {
|
|
136
|
+
const operator = validateOperator(await this.operatorAuthorizer.authenticate(identity));
|
|
137
|
+
if (!operator.permissions.includes(permission))
|
|
138
|
+
throw new CostGovernanceError(`Cost operator lacks required permission: ${permission}.`);
|
|
139
|
+
return operator;
|
|
140
|
+
}
|
|
141
|
+
timestamp() {
|
|
142
|
+
const value = this.now();
|
|
143
|
+
if (!(value instanceof Date) || !Number.isFinite(value.getTime()))
|
|
144
|
+
throw new CostGovernanceError("Cost governance clock is invalid.");
|
|
145
|
+
return value.toISOString();
|
|
146
|
+
}
|
|
147
|
+
async read() {
|
|
148
|
+
await ensurePrivateDirectory(dirname(this.path));
|
|
149
|
+
const info = await lstat(this.path).catch((error) => isErrorCode(error, "ENOENT") ? null : Promise.reject(error));
|
|
150
|
+
if (info === null)
|
|
151
|
+
return emptyState();
|
|
152
|
+
if (!info.isFile() || info.isSymbolicLink())
|
|
153
|
+
throw new CostGovernanceError("Cost store must be a regular non-symlink file.");
|
|
154
|
+
const source = await readFile(this.path, "utf8");
|
|
155
|
+
if (Buffer.byteLength(source, "utf8") > MAX_STORE_BYTES)
|
|
156
|
+
throw new CostGovernanceError("Cost store exceeds its size limit.");
|
|
157
|
+
try {
|
|
158
|
+
return validateState(JSON.parse(source));
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
if (error instanceof CostGovernanceError)
|
|
162
|
+
throw error;
|
|
163
|
+
throw new CostGovernanceError("Cost store is not valid JSON.");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async mutate(operation) {
|
|
167
|
+
return withFileLock(this.path, async () => {
|
|
168
|
+
const state = await this.read();
|
|
169
|
+
const result = operation(state);
|
|
170
|
+
await atomicWriteJson(this.path, validateState(state));
|
|
171
|
+
return result;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
export function createDisabledCostOperatorAuthorizer() {
|
|
176
|
+
return { async authenticate() { throw new CostGovernanceError("Cost operator authorization is not configured."); } };
|
|
177
|
+
}
|
|
178
|
+
export function createTestCostOperatorAuthorizer() {
|
|
179
|
+
const issued = new WeakSet();
|
|
180
|
+
return {
|
|
181
|
+
authorizer: { async authenticate(identity) { if (identity === null || typeof identity !== "object" || !issued.has(identity))
|
|
182
|
+
throw new CostGovernanceError("Cost operator identity is not authenticated."); return validateOperator(identity); } },
|
|
183
|
+
issue(input) { const operator = Object.freeze(validateOperator(input)); issued.add(operator); return operator; }
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
export function formatCostReport(report) {
|
|
187
|
+
const lines = [`Cost report ${report.runId} at ${report.generatedAt}`];
|
|
188
|
+
lines.push(` window ${report.windowStart} -> ${report.windowEnd}`);
|
|
189
|
+
lines.push(` totals: requests=${report.totals.requests} messages=${report.totals.messages} mutations=${report.totals.mutations} tokenCost=${report.totals.tokenCost} monetaryAmountMinor=${report.totals.monetaryAmountMinor}`);
|
|
190
|
+
for (const entry of report.attribution) {
|
|
191
|
+
lines.push(` by ${entry.dimension}:${entry.value} requests=${entry.totals.requests} tokenCost=${entry.totals.tokenCost} monetaryAmountMinor=${entry.totals.monetaryAmountMinor}`);
|
|
192
|
+
}
|
|
193
|
+
for (const budget of report.budgets) {
|
|
194
|
+
const exceeded = budget.status === "exceeded" ? ` EXCEEDED (${budget.exceeded.map((entry) => `${entry.key} ${entry.total}/${entry.limit}`).join(", ")})` : "";
|
|
195
|
+
lines.push(` budget ${budget.id} ${budget.scope.dimension}:${budget.scope.value} ${budget.status}${exceeded}`);
|
|
196
|
+
}
|
|
197
|
+
lines.push(` forecast: approximate linear extrapolation over ${report.forecast.sampleDays} day(s), next ${report.forecast.projectionDays} day(s) estimate requests=${report.forecast.nextPeriodEstimate.requests} tokenCost=${report.forecast.nextPeriodEstimate.tokenCost}`);
|
|
198
|
+
lines.push(` source: ${report.source}`);
|
|
199
|
+
return lines.join("\n");
|
|
200
|
+
}
|
|
201
|
+
function emptyState() {
|
|
202
|
+
return { schemaVersion: 1, kind: "ghostapi.costs", records: [], budgets: [], alerts: [] };
|
|
203
|
+
}
|
|
204
|
+
function validateState(value) {
|
|
205
|
+
const state = object(value, "Cost store must be an object.");
|
|
206
|
+
exactKeys(state, ["schemaVersion", "kind", "records", "budgets", "alerts"], "Cost store");
|
|
207
|
+
if (state.schemaVersion !== SCHEMA_VERSION || state.kind !== KIND)
|
|
208
|
+
throw new CostGovernanceError("Unsupported cost store schema.");
|
|
209
|
+
const records = array(state.records, "Cost records", MAX_RECORDS).map(validateRecord);
|
|
210
|
+
unique(records.map((record) => record.recordId), "Cost record ids");
|
|
211
|
+
const budgets = array(state.budgets, "Cost budgets", MAX_BUDGETS).map(validateBudget);
|
|
212
|
+
unique(budgets.map((budget) => budget.id), "Cost budget ids");
|
|
213
|
+
const alerts = array(state.alerts, "Cost alerts", MAX_ALERTS).map(validateAlert);
|
|
214
|
+
unique(alerts.map((alert) => alert.id), "Cost alert ids");
|
|
215
|
+
return { schemaVersion: 1, kind: "ghostapi.costs", records, budgets, alerts };
|
|
216
|
+
}
|
|
217
|
+
function validateRecordInput(input, now) {
|
|
218
|
+
const attribution = validateAttribution(input.attribution);
|
|
219
|
+
const amounts = validateAmounts(input.amounts, "Cost record");
|
|
220
|
+
return {
|
|
221
|
+
schemaVersion: 1,
|
|
222
|
+
kind: "ghostapi.cost-record",
|
|
223
|
+
recordId: `record-${randomUUID().replace(/-/g, "").slice(0, 32)}`,
|
|
224
|
+
tenantId: identifier(input.tenantId, "Cost tenant id"),
|
|
225
|
+
runId: identifier(input.runId, "Cost run id"),
|
|
226
|
+
actionId: identifier(input.actionId, "Cost action id"),
|
|
227
|
+
recordedAt: now,
|
|
228
|
+
attribution,
|
|
229
|
+
amounts
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function validateRecord(value) {
|
|
233
|
+
const record = object(value, "Cost record is invalid.");
|
|
234
|
+
exactKeys(record, ["schemaVersion", "kind", "recordId", "tenantId", "runId", "actionId", "recordedAt", "attribution", "amounts"], "Cost record");
|
|
235
|
+
if (record.schemaVersion !== SCHEMA_VERSION || record.kind !== "ghostapi.cost-record")
|
|
236
|
+
throw new CostGovernanceError("Unsupported cost record schema.");
|
|
237
|
+
return {
|
|
238
|
+
schemaVersion: 1,
|
|
239
|
+
kind: "ghostapi.cost-record",
|
|
240
|
+
recordId: identifier(record.recordId, "Cost record id"),
|
|
241
|
+
tenantId: identifier(record.tenantId, "Cost tenant id"),
|
|
242
|
+
runId: identifier(record.runId, "Cost run id"),
|
|
243
|
+
actionId: identifier(record.actionId, "Cost action id"),
|
|
244
|
+
recordedAt: timestamp(record.recordedAt, "Cost record time"),
|
|
245
|
+
attribution: validateAttribution(record.attribution),
|
|
246
|
+
amounts: validateAmounts(record.amounts, "Cost record")
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function validateBudget(value) {
|
|
250
|
+
const budget = object(value, "Cost budget is invalid.");
|
|
251
|
+
exactKeys(budget, ["id", "scope", "windowMs", "limits", "alertOnExceed"], "Cost budget");
|
|
252
|
+
const scope = object(budget.scope, "Cost budget scope is invalid.");
|
|
253
|
+
exactKeys(scope, ["dimension", "value"], "Cost budget scope");
|
|
254
|
+
if (!COST_DIMENSIONS.includes(scope.dimension))
|
|
255
|
+
throw new CostGovernanceError("Cost budget dimension is invalid.");
|
|
256
|
+
const limits = validateLimits(budget.limits);
|
|
257
|
+
if (typeof budget.alertOnExceed !== "boolean")
|
|
258
|
+
throw new CostGovernanceError("Cost budget alertOnExceed flag is invalid.");
|
|
259
|
+
return { id: identifier(budget.id, "Cost budget id"), scope: { dimension: scope.dimension, value: identifier(scope.value, "Cost budget scope value") }, windowMs: boundedMs(budget.windowMs, "Cost budget window"), limits, alertOnExceed: budget.alertOnExceed };
|
|
260
|
+
}
|
|
261
|
+
function validateAlert(value) {
|
|
262
|
+
const alert = object(value, "Cost alert is invalid.");
|
|
263
|
+
exactKeys(alert, ["id", "budgetId", "scope", "windowMs", "windowStart", "windowEnd", "exceeded", "created", "status", "acknowledgedBy", "acknowledgedAt"], "Cost alert", ["acknowledgedBy", "acknowledgedAt"]);
|
|
264
|
+
if (alert.status !== "open" && alert.status !== "acknowledged")
|
|
265
|
+
throw new CostGovernanceError("Cost alert status is invalid.");
|
|
266
|
+
const exceeded = array(alert.exceeded, "Cost alert exceeded entries", COST_AMOUNT_KEYS.length).map((entry) => {
|
|
267
|
+
const value = object(entry, "Cost alert exceeded entry is invalid.");
|
|
268
|
+
exactKeys(value, ["key", "limit", "total"], "Cost alert exceeded entry");
|
|
269
|
+
if (!COST_AMOUNT_KEYS.includes(value.key))
|
|
270
|
+
throw new CostGovernanceError("Cost alert exceeded key is invalid.");
|
|
271
|
+
return { key: value.key, limit: nonNegative(value.limit, "Cost alert limit", Number.MAX_SAFE_INTEGER), total: nonNegative(value.total, "Cost alert total", Number.MAX_SAFE_INTEGER) };
|
|
272
|
+
});
|
|
273
|
+
const scope = object(alert.scope, "Cost alert scope is invalid.");
|
|
274
|
+
exactKeys(scope, ["dimension", "value"], "Cost alert scope");
|
|
275
|
+
if (!COST_DIMENSIONS.includes(scope.dimension))
|
|
276
|
+
throw new CostGovernanceError("Cost alert dimension is invalid.");
|
|
277
|
+
const result = {
|
|
278
|
+
id: identifier(alert.id, "Cost alert id"),
|
|
279
|
+
budgetId: identifier(alert.budgetId, "Cost budget id"),
|
|
280
|
+
scope: { dimension: scope.dimension, value: identifier(scope.value, "Cost alert scope value") },
|
|
281
|
+
windowMs: boundedMs(alert.windowMs, "Cost alert window"),
|
|
282
|
+
windowStart: timestamp(alert.windowStart, "Cost alert window start"),
|
|
283
|
+
windowEnd: timestamp(alert.windowEnd, "Cost alert window end"),
|
|
284
|
+
exceeded,
|
|
285
|
+
created: timestamp(alert.created, "Cost alert creation time"),
|
|
286
|
+
status: alert.status,
|
|
287
|
+
...(alert.acknowledgedBy === undefined ? {} : { acknowledgedBy: identifier(alert.acknowledgedBy, "Cost alert operator") }),
|
|
288
|
+
...(alert.acknowledgedAt === undefined ? {} : { acknowledgedAt: timestamp(alert.acknowledgedAt, "Cost alert acknowledgement time") })
|
|
289
|
+
};
|
|
290
|
+
if (result.status === "acknowledged" && (result.acknowledgedBy === undefined || result.acknowledgedAt === undefined))
|
|
291
|
+
throw new CostGovernanceError("Acknowledged cost alerts require audit metadata.");
|
|
292
|
+
if (result.status === "open" && result.acknowledgedBy !== undefined)
|
|
293
|
+
throw new CostGovernanceError("Open cost alerts cannot carry acknowledgement metadata.");
|
|
294
|
+
return result;
|
|
295
|
+
}
|
|
296
|
+
function validateAttribution(value) {
|
|
297
|
+
const attribution = object(value, "Cost attribution is invalid.");
|
|
298
|
+
exactKeys(attribution, ["agentId", "projectId", "provider", "actionClass", "workflowId"], "Cost attribution");
|
|
299
|
+
return {
|
|
300
|
+
agentId: identifier(attribution.agentId, "Cost agent id"),
|
|
301
|
+
projectId: identifier(attribution.projectId, "Cost project id"),
|
|
302
|
+
provider: identifier(attribution.provider, "Cost provider"),
|
|
303
|
+
actionClass: identifier(attribution.actionClass, "Cost action class"),
|
|
304
|
+
workflowId: identifier(attribution.workflowId, "Cost workflow id")
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
function validateAmounts(value, label) {
|
|
308
|
+
const amounts = object(value, `${label} amounts are invalid.`);
|
|
309
|
+
exactKeys(amounts, [...COST_AMOUNT_KEYS], label);
|
|
310
|
+
return {
|
|
311
|
+
monetaryAmountMinor: nonNegative(amounts.monetaryAmountMinor, `${label} monetary amount`, Number.MAX_SAFE_INTEGER),
|
|
312
|
+
requests: nonNegative(amounts.requests, `${label} requests`, Number.MAX_SAFE_INTEGER),
|
|
313
|
+
messages: nonNegative(amounts.messages, `${label} messages`, Number.MAX_SAFE_INTEGER),
|
|
314
|
+
mutations: nonNegative(amounts.mutations, `${label} mutations`, Number.MAX_SAFE_INTEGER),
|
|
315
|
+
deletes: nonNegative(amounts.deletes, `${label} deletes`, Number.MAX_SAFE_INTEGER),
|
|
316
|
+
tokenCost: nonNegative(amounts.tokenCost, `${label} token cost`, Number.MAX_SAFE_INTEGER)
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function validateLimits(value) {
|
|
320
|
+
const limits = object(value, "Cost budget limits are invalid.");
|
|
321
|
+
exactKeys(limits, [...COST_AMOUNT_KEYS], "Cost budget limits");
|
|
322
|
+
const parsed = {};
|
|
323
|
+
for (const key of COST_AMOUNT_KEYS)
|
|
324
|
+
if (limits[key] !== undefined)
|
|
325
|
+
parsed[key] = nonNegative(limits[key], `Cost budget ${key}`, Number.MAX_SAFE_INTEGER);
|
|
326
|
+
if (Object.keys(parsed).length === 0)
|
|
327
|
+
throw new CostGovernanceError("Cost budget requires at least one limit.");
|
|
328
|
+
return parsed;
|
|
329
|
+
}
|
|
330
|
+
function evaluateBudget(budget, records, now) {
|
|
331
|
+
const windowStart = Date.parse(now) - budget.windowMs;
|
|
332
|
+
const inWindow = records.filter((record) => Date.parse(record.recordedAt) >= windowStart && record.attribution[ATTRIBUTION_DIMENSION_KEY[budget.scope.dimension]] === budget.scope.value);
|
|
333
|
+
const totals = sumAmounts(inWindow.map((record) => record.amounts));
|
|
334
|
+
const exceeded = [];
|
|
335
|
+
for (const key of COST_AMOUNT_KEYS) {
|
|
336
|
+
if (budget.limits[key] !== undefined && totals[key] > budget.limits[key])
|
|
337
|
+
exceeded.push({ key, limit: budget.limits[key], total: totals[key] });
|
|
338
|
+
}
|
|
339
|
+
return { id: budget.id, scope: budget.scope, windowMs: budget.windowMs, limits: budget.limits, totals, status: exceeded.length === 0 ? "within" : "exceeded", exceeded };
|
|
340
|
+
}
|
|
341
|
+
function tenantScoped(records, tenantId) {
|
|
342
|
+
return tenantId === undefined ? records : records.filter((record) => record.tenantId === tenantId);
|
|
343
|
+
}
|
|
344
|
+
function deriveAlerts(existing, evaluations, budgets, now) {
|
|
345
|
+
if (evaluations.every((evaluation) => evaluation.status === "within"))
|
|
346
|
+
return existing;
|
|
347
|
+
const alerts = [...existing];
|
|
348
|
+
for (const evaluation of evaluations) {
|
|
349
|
+
if (evaluation.status !== "exceeded")
|
|
350
|
+
continue;
|
|
351
|
+
const budget = budgets.find((candidate) => candidate.id === evaluation.id);
|
|
352
|
+
if (budget !== undefined && !budget.alertOnExceed)
|
|
353
|
+
continue;
|
|
354
|
+
const current = alerts.find((candidate) => candidate.budgetId === evaluation.id && candidate.status === "open");
|
|
355
|
+
const payload = { budgetId: evaluation.id, scope: evaluation.scope, windowMs: evaluation.windowMs, windowStart: new Date(Date.parse(now) - evaluation.windowMs).toISOString(), windowEnd: now, exceeded: evaluation.exceeded };
|
|
356
|
+
if (current !== undefined) {
|
|
357
|
+
Object.assign(current, payload);
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
if (alerts.length >= MAX_ALERTS) {
|
|
361
|
+
const removable = alerts.findIndex((candidate) => candidate.status === "acknowledged");
|
|
362
|
+
if (removable === -1)
|
|
363
|
+
throw new CostGovernanceError("Cost alert limit was reached.");
|
|
364
|
+
alerts.splice(removable, 1);
|
|
365
|
+
}
|
|
366
|
+
alerts.push({ id: `alert-${randomUUID().replace(/-/g, "").slice(0, 32)}`, ...payload, created: now, status: "open" });
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return alerts;
|
|
370
|
+
}
|
|
371
|
+
function aggregateAttribution(records) {
|
|
372
|
+
const result = [];
|
|
373
|
+
for (const dimension of COST_DIMENSIONS) {
|
|
374
|
+
const byValue = new Map();
|
|
375
|
+
for (const record of records) {
|
|
376
|
+
const value = record.attribution[ATTRIBUTION_DIMENSION_KEY[dimension]];
|
|
377
|
+
const current = byValue.get(value) ?? zeroAmounts();
|
|
378
|
+
byValue.set(value, addAmounts(current, record.amounts));
|
|
379
|
+
}
|
|
380
|
+
for (const [value, totals] of byValue)
|
|
381
|
+
result.push({ dimension, value, totals });
|
|
382
|
+
}
|
|
383
|
+
return result;
|
|
384
|
+
}
|
|
385
|
+
function buildForecast(records, projectionDays, now, windowMs) {
|
|
386
|
+
const sampleStartMs = Date.parse(now) - Math.min(windowMs, 30 * 24 * 60 * 60 * 1000);
|
|
387
|
+
const byDay = new Map();
|
|
388
|
+
for (const record of records) {
|
|
389
|
+
const recordedAt = Date.parse(record.recordedAt);
|
|
390
|
+
if (recordedAt < sampleStartMs)
|
|
391
|
+
continue;
|
|
392
|
+
const day = new Date(recordedAt).toISOString().slice(0, 10);
|
|
393
|
+
byDay.set(day, addAmounts(byDay.get(day) ?? zeroAmounts(), record.amounts));
|
|
394
|
+
}
|
|
395
|
+
const days = [...byDay.keys()].sort();
|
|
396
|
+
const sampleStart = days[0] ?? now;
|
|
397
|
+
const sampleEnd = days.at(-1) ?? now;
|
|
398
|
+
const averagePerDay = zeroAmounts();
|
|
399
|
+
const trendPerDay = zeroAmounts();
|
|
400
|
+
if (days.length >= 2) {
|
|
401
|
+
const points = days.map((day, index) => ({ x: index, totals: byDay.get(day) }));
|
|
402
|
+
for (const key of COST_AMOUNT_KEYS) {
|
|
403
|
+
const values = points.map((point) => ({ x: point.x, y: point.totals[key] }));
|
|
404
|
+
const slope = linearSlope(values);
|
|
405
|
+
trendPerDay[key] = Math.max(0, Math.round(slope));
|
|
406
|
+
averagePerDay[key] = Math.round(points.reduce((sum, point) => sum + point.totals[key], 0) / points.length);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
else if (days.length === 1) {
|
|
410
|
+
const totals = byDay.get(days[0]);
|
|
411
|
+
for (const key of COST_AMOUNT_KEYS) {
|
|
412
|
+
averagePerDay[key] = totals[key];
|
|
413
|
+
trendPerDay[key] = 0;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
const nextPeriodEstimate = { ...zeroAmounts() };
|
|
417
|
+
for (const key of COST_AMOUNT_KEYS)
|
|
418
|
+
nextPeriodEstimate[key] = Math.max(0, averagePerDay[key] * projectionDays);
|
|
419
|
+
return {
|
|
420
|
+
method: "linear-extrapolation",
|
|
421
|
+
approximation: true,
|
|
422
|
+
projectionDays,
|
|
423
|
+
sampleDays: days.length,
|
|
424
|
+
sampleStart,
|
|
425
|
+
sampleEnd,
|
|
426
|
+
averagePerDay,
|
|
427
|
+
trendPerDay,
|
|
428
|
+
nextPeriodEstimate,
|
|
429
|
+
disclaimer: "This forecast is an explainable linear approximation of local synthetic cost metadata. It is not a provider invoice, not a commitment, and not a prediction of real billing; calibrate it against provider billing during the pilot."
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
function linearSlope(values) {
|
|
433
|
+
const n = values.length;
|
|
434
|
+
if (n < 2)
|
|
435
|
+
return 0;
|
|
436
|
+
const sumX = values.reduce((sum, point) => sum + point.x, 0);
|
|
437
|
+
const sumY = values.reduce((sum, point) => sum + point.y, 0);
|
|
438
|
+
const sumXy = values.reduce((sum, point) => sum + point.x * point.y, 0);
|
|
439
|
+
const sumXx = values.reduce((sum, point) => sum + point.x * point.x, 0);
|
|
440
|
+
const denominator = n * sumXx - sumX * sumX;
|
|
441
|
+
if (denominator === 0)
|
|
442
|
+
return 0;
|
|
443
|
+
return (n * sumXy - sumX * sumY) / denominator;
|
|
444
|
+
}
|
|
445
|
+
function zeroAmounts() {
|
|
446
|
+
return { monetaryAmountMinor: 0, requests: 0, messages: 0, mutations: 0, deletes: 0, tokenCost: 0 };
|
|
447
|
+
}
|
|
448
|
+
function addAmounts(left, right) {
|
|
449
|
+
return { monetaryAmountMinor: left.monetaryAmountMinor + right.monetaryAmountMinor, requests: left.requests + right.requests, messages: left.messages + right.messages, mutations: left.mutations + right.mutations, deletes: left.deletes + right.deletes, tokenCost: left.tokenCost + right.tokenCost };
|
|
450
|
+
}
|
|
451
|
+
function sumAmounts(values) {
|
|
452
|
+
return values.reduce(addAmounts, zeroAmounts());
|
|
453
|
+
}
|
|
454
|
+
function validateOperator(value) {
|
|
455
|
+
const operator = object(value, "Cost operator is invalid.");
|
|
456
|
+
exactKeys(operator, ["id", "principalId", "permissions", "tenantId"], "Cost operator", ["tenantId"]);
|
|
457
|
+
const permissions = array(operator.permissions, "Cost operator permissions", 8).map((permission) => {
|
|
458
|
+
if (permission !== "cost.record" && permission !== "cost.configure" && permission !== "cost.inspect" && permission !== "cost.acknowledge")
|
|
459
|
+
throw new CostGovernanceError("Cost operator permission is invalid.");
|
|
460
|
+
return permission;
|
|
461
|
+
});
|
|
462
|
+
unique(permissions, "Cost operator permissions");
|
|
463
|
+
return { id: identifier(operator.id, "Cost operator id"), principalId: identifier(operator.principalId, "Cost operator principal id"), permissions, ...(operator.tenantId === undefined ? {} : { tenantId: identifier(operator.tenantId, "Cost operator tenant id") }) };
|
|
464
|
+
}
|
|
465
|
+
function boundedMs(value, label) {
|
|
466
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 60 * 60 * 1000 || value > MAX_WINDOW_MS)
|
|
467
|
+
throw new CostGovernanceError(`${label} must be between one hour and 90 days.`);
|
|
468
|
+
return value;
|
|
469
|
+
}
|
|
470
|
+
function boundedDays(value, label) {
|
|
471
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 1 || value > 30)
|
|
472
|
+
throw new CostGovernanceError(`${label} must be from 1 through 30 days.`);
|
|
473
|
+
return value;
|
|
474
|
+
}
|
|
475
|
+
function nonNegative(value, label, max) {
|
|
476
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 0 || value > max)
|
|
477
|
+
throw new CostGovernanceError(`${label} is invalid.`);
|
|
478
|
+
return value;
|
|
479
|
+
}
|
|
480
|
+
function identifier(value, label) {
|
|
481
|
+
if (typeof value !== "string" || !IDENTIFIER.test(value) || sanitizeSecretString(value) !== value)
|
|
482
|
+
throw new CostGovernanceError(`${label} must be a safe identifier.`);
|
|
483
|
+
return value;
|
|
484
|
+
}
|
|
485
|
+
function timestamp(value, label) {
|
|
486
|
+
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(value) || !Number.isFinite(Date.parse(value)))
|
|
487
|
+
throw new CostGovernanceError(`${label} must be an ISO UTC timestamp.`);
|
|
488
|
+
return value;
|
|
489
|
+
}
|
|
490
|
+
function object(value, message) {
|
|
491
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
492
|
+
throw new CostGovernanceError(message);
|
|
493
|
+
return value;
|
|
494
|
+
}
|
|
495
|
+
function array(value, label, max) {
|
|
496
|
+
if (!Array.isArray(value) || value.length > max)
|
|
497
|
+
throw new CostGovernanceError(`${label} is invalid.`);
|
|
498
|
+
return value;
|
|
499
|
+
}
|
|
500
|
+
function exactKeys(value, keys, label, optional = []) {
|
|
501
|
+
for (const key of Object.keys(value))
|
|
502
|
+
if (!keys.includes(key) || (value[key] === undefined && !optional.includes(key)))
|
|
503
|
+
throw new CostGovernanceError(`${label} contains unsupported field: ${key}`);
|
|
504
|
+
}
|
|
505
|
+
function unique(values, label) {
|
|
506
|
+
if (new Set(values).size !== values.length)
|
|
507
|
+
throw new CostGovernanceError(`${label} must be unique.`);
|
|
508
|
+
}
|
|
509
|
+
function clone(value) {
|
|
510
|
+
return structuredClone(value);
|
|
511
|
+
}
|
|
512
|
+
function isErrorCode(error, code) {
|
|
513
|
+
return error instanceof Error && "code" in error && error.code === code;
|
|
514
|
+
}
|
|
515
|
+
//# sourceMappingURL=costGovernance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"costGovernance.js","sourceRoot":"","sources":["../../src/reliability/costGovernance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEhG,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAC9B,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACxC,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MA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,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAAE,MAAM,IAAI,mBAAmB,CAAC,GAAG,KAAK,gCAAgC,GAAG,EAAE,CAAC,CAAC;AACvM,CAAC;AAED,SAAS,MAAM,CAAC,MAAgB,EAAE,KAAa;IAC7C,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM;QAAE,MAAM,IAAI,mBAAmB,CAAC,GAAG,KAAK,kBAAkB,CAAC,CAAC;AACxG,CAAC;AAED,SAAS,KAAK,CAAI,KAAQ;IACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,WAAW,CAAC,KAAc,EAAE,IAAY;IAC/C,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { LocalSloController, SloError, SLO_LATENCY_METRICS, SLO_METRICS, createDisabledSloOperatorAuthorizer, createLocalSloController, createSloRecordIdentity, createTestSloOperatorAuthorizer, examplePilotSloTargets, formatSloReport } from "./slo.js";
|
|
2
|
+
export type { SloControllerOptions, SloEvaluation, SloMetric, SloOperator, SloOperatorAuthorizer, SloOperatorPermission, SloRecordSampleInput, SloReport, SloSample, SloStoreState, SloTarget } from "./slo.js";
|
|
3
|
+
export { LocalReconciliationService, ReconciliationError, RECONCILIATION_OUTCOMES, createDisabledReconciliationOperatorAuthorizer, createLocalReconciliationService, createTestReconciliationOperatorAuthorizer, createWorldStateReconciliationProvider, formatReconciliationReport } from "./reconciliation.js";
|
|
4
|
+
export type { ReconciliationActionResult, ReconciliationFinding, ReconciliationLedgerIntent, ReconciliationOperator, ReconciliationOperatorAuthorizer, ReconciliationOperatorPermission, ReconciliationOutcome, ReconciliationProvider, ReconciliationProviderState, ReconciliationReport, ReconciliationServiceOptions, ReconciliationSli, ReconciliationState } from "./reconciliation.js";
|
|
5
|
+
export { CostGovernanceError, COST_AMOUNT_KEYS, COST_DIMENSIONS, LocalCostGovernance, createDisabledCostOperatorAuthorizer, createLocalCostGovernance, createTestCostOperatorAuthorizer, formatCostReport } from "./costGovernance.js";
|
|
6
|
+
export type { CostAlert, CostAmountKey, CostAmounts, CostAttribution, CostBudget, CostBudgetEvaluation, CostControllerOptions, CostDimension, CostForecast, CostOperator, CostOperatorAuthorizer, CostOperatorPermission, CostRecord, CostReport, CostStoreState, RecordCostInput } from "./costGovernance.js";
|
|
7
|
+
export { RuntimeHealthError, backupRuntime, checkRuntimeHealth, formatRuntimeHealth, restoreRuntimeBackup } from "./runtimeHealth.js";
|
|
8
|
+
export type { BackupManifest, BackupManifestEntry, BackupResult, RestoreResult, RuntimeDependencyStatus, RuntimeHealthReport, RuntimeStoreCheck } from "./runtimeHealth.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { LocalSloController, SloError, SLO_LATENCY_METRICS, SLO_METRICS, createDisabledSloOperatorAuthorizer, createLocalSloController, createSloRecordIdentity, createTestSloOperatorAuthorizer, examplePilotSloTargets, formatSloReport } from "./slo.js";
|
|
2
|
+
export { LocalReconciliationService, ReconciliationError, RECONCILIATION_OUTCOMES, createDisabledReconciliationOperatorAuthorizer, createLocalReconciliationService, createTestReconciliationOperatorAuthorizer, createWorldStateReconciliationProvider, formatReconciliationReport } from "./reconciliation.js";
|
|
3
|
+
export { CostGovernanceError, COST_AMOUNT_KEYS, COST_DIMENSIONS, LocalCostGovernance, createDisabledCostOperatorAuthorizer, createLocalCostGovernance, createTestCostOperatorAuthorizer, formatCostReport } from "./costGovernance.js";
|
|
4
|
+
export { RuntimeHealthError, backupRuntime, checkRuntimeHealth, formatRuntimeHealth, restoreRuntimeBackup } from "./runtimeHealth.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reliability/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,WAAW,EAAE,mCAAmC,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE5P,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,8CAA8C,EAAE,gCAAgC,EAAE,0CAA0C,EAAE,sCAAsC,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjT,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,oCAAoC,EAAE,yBAAyB,EAAE,gCAAgC,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvO,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|