@substrat-run/contracts 0.205.0 → 0.207.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ci.d.ts.map +1 -1
- package/dist/ci.js +14 -2
- package/dist/ci.js.map +1 -1
- package/dist/control-plane.d.ts +200 -1
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +139 -4
- package/dist/control-plane.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/introspection.d.ts +40 -0
- package/dist/introspection.d.ts.map +1 -1
- package/dist/introspection.js +32 -0
- package/dist/introspection.js.map +1 -1
- package/dist/markup.d.ts +157 -0
- package/dist/markup.d.ts.map +1 -0
- package/dist/markup.js +192 -0
- package/dist/markup.js.map +1 -0
- package/dist/model-usage.d.ts +161 -3
- package/dist/model-usage.d.ts.map +1 -1
- package/dist/model-usage.js +103 -4
- package/dist/model-usage.js.map +1 -1
- package/package.json +1 -1
package/dist/markup.d.ts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The markup schedule (#3316, Pricing): what the platform charges over what a tenant's usage
|
|
3
|
+
* costs it. One mechanism for every priced thing — Cloudflare's billed dimensions, model calls,
|
|
4
|
+
* build time — so the builder's model markup and the ledger's are rows here, not constants.
|
|
5
|
+
*
|
|
6
|
+
* - **Data, not code.** A default plus overrides per tenant, per billed dimension and per kind
|
|
7
|
+
* (live or preview). The most specific row wins: a tenant row over a platform row, then a
|
|
8
|
+
* dimension row over a dimension-wide one, then a kind row over a kind-wide one
|
|
9
|
+
* (`MARKUP_PRECEDENCE`).
|
|
10
|
+
* - **Dated, never edited.** A change is a new row with the UTC day it takes effect. A past day
|
|
11
|
+
* is priced at the row in force on that day, so a change never reprices history. A row with
|
|
12
|
+
* `percent: null` ends an override: that level falls through to the next less specific one,
|
|
13
|
+
* so a tenant once given its own rate is not frozen off every later change to the default.
|
|
14
|
+
* - **Applied at read.** Cost is what is stored; price = cost × (1 + markup), computed here with
|
|
15
|
+
* `mulDecimal`/`marginFactor`, never floated and never stored.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
/** The dimensions a tenant is billed on: Cloudflare's, plus model calls and build time. */
|
|
19
|
+
export declare const BILLED_DIMENSIONS: readonly ['requests', 'cpu', 'do-requests', 'duration', 'rows-read', 'rows-written', 'storage', 'model-calls', 'build-time'];
|
|
20
|
+
export declare const billedDimension: z.ZodEnum<{
|
|
21
|
+
"build-time": "build-time";
|
|
22
|
+
cpu: "cpu";
|
|
23
|
+
"do-requests": "do-requests";
|
|
24
|
+
duration: "duration";
|
|
25
|
+
"model-calls": "model-calls";
|
|
26
|
+
requests: "requests";
|
|
27
|
+
"rows-read": "rows-read";
|
|
28
|
+
"rows-written": "rows-written";
|
|
29
|
+
storage: "storage";
|
|
30
|
+
}>;
|
|
31
|
+
export type BilledDimension = z.infer<typeof billedDimension>;
|
|
32
|
+
/** Live usage, or a preview's (a fork, a PR version). */
|
|
33
|
+
export declare const usageKind: z.ZodEnum<{
|
|
34
|
+
live: "live";
|
|
35
|
+
preview: "preview";
|
|
36
|
+
}>;
|
|
37
|
+
export type UsageKind = z.infer<typeof usageKind>;
|
|
38
|
+
/** The highest markup a row may carry, whole percent: 10× cost. A bound on a typo, not a policy. */
|
|
39
|
+
export declare const MARKUP_PERCENT_MAX = 1000;
|
|
40
|
+
/** One row of the schedule, as stored. */
|
|
41
|
+
export declare const markupRow: z.ZodObject<{
|
|
42
|
+
tenantId: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "TenantId", "out">>;
|
|
43
|
+
dimension: z.ZodNullable<z.ZodEnum<{
|
|
44
|
+
"build-time": "build-time";
|
|
45
|
+
cpu: "cpu";
|
|
46
|
+
"do-requests": "do-requests";
|
|
47
|
+
duration: "duration";
|
|
48
|
+
"model-calls": "model-calls";
|
|
49
|
+
requests: "requests";
|
|
50
|
+
"rows-read": "rows-read";
|
|
51
|
+
"rows-written": "rows-written";
|
|
52
|
+
storage: "storage";
|
|
53
|
+
}>>;
|
|
54
|
+
kind: z.ZodNullable<z.ZodEnum<{
|
|
55
|
+
live: "live";
|
|
56
|
+
preview: "preview";
|
|
57
|
+
}>>;
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
effectiveFrom: z.ZodString;
|
|
60
|
+
percent: z.ZodNullable<z.ZodNumber>;
|
|
61
|
+
reason: z.ZodString;
|
|
62
|
+
setAt: z.ZodString;
|
|
63
|
+
setBy: z.ZodString;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
export type MarkupRow = z.infer<typeof markupRow>;
|
|
66
|
+
/**
|
|
67
|
+
* What staff send to add a row. Omitted target fields mean "every". The platform default (no
|
|
68
|
+
* target at all) must carry a percent: it is the floor every other row falls through to.
|
|
69
|
+
*/
|
|
70
|
+
export declare const markupRowInput: z.ZodObject<{
|
|
71
|
+
tenantId: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodString, "TenantId", "out">>>;
|
|
72
|
+
dimension: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
73
|
+
"build-time": "build-time";
|
|
74
|
+
cpu: "cpu";
|
|
75
|
+
"do-requests": "do-requests";
|
|
76
|
+
duration: "duration";
|
|
77
|
+
"model-calls": "model-calls";
|
|
78
|
+
requests: "requests";
|
|
79
|
+
"rows-read": "rows-read";
|
|
80
|
+
"rows-written": "rows-written";
|
|
81
|
+
storage: "storage";
|
|
82
|
+
}>>>;
|
|
83
|
+
kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
84
|
+
live: "live";
|
|
85
|
+
preview: "preview";
|
|
86
|
+
}>>>;
|
|
87
|
+
effectiveFrom: z.ZodString;
|
|
88
|
+
percent: z.ZodNullable<z.ZodNumber>;
|
|
89
|
+
reason: z.ZodString;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
export type MarkupRowInput = z.infer<typeof markupRowInput>;
|
|
92
|
+
/** Who the seed rows name as their setter: the platform, not a person. */
|
|
93
|
+
export declare const MARKUP_SEED_ACTOR = "platform-seed";
|
|
94
|
+
/** The day the seed rows take effect from: before any usage the platform holds, so every day it can price has a row. */
|
|
95
|
+
export declare const MARKUP_SEED_EFFECTIVE_FROM = "2000-01-01";
|
|
96
|
+
/**
|
|
97
|
+
* The owner's decisions of 2026-11-21 on #3316: the rows every schedule holds beneath what staff
|
|
98
|
+
* add. Read beneath the stored rows rather than inserted (the kernel's `markupScheduleOf`), with
|
|
99
|
+
* fixed ids, so a later row supersedes them and none can be lost or duplicated by a restore.
|
|
100
|
+
*/
|
|
101
|
+
export declare const MARKUP_SEED: readonly MarkupRow[];
|
|
102
|
+
/** What a price is asked for: whose usage, on what, of which kind, on which UTC day. */
|
|
103
|
+
export interface MarkupQuery {
|
|
104
|
+
/** Null asks for the platform's rate, ignoring every tenant row. */
|
|
105
|
+
tenantId: string | null;
|
|
106
|
+
dimension: BilledDimension;
|
|
107
|
+
kind: UsageKind;
|
|
108
|
+
day: string;
|
|
109
|
+
}
|
|
110
|
+
type Level = readonly [tenant: boolean, dimension: boolean, kind: boolean];
|
|
111
|
+
/**
|
|
112
|
+
* The order rows are tried in, most specific first: tenant, then dimension, then kind. So a
|
|
113
|
+
* tenant's own rate beats every platform row, and a dimension's rate beats a kind's (a model
|
|
114
|
+
* call made by a preview is priced as a model call).
|
|
115
|
+
*/
|
|
116
|
+
export declare const MARKUP_PRECEDENCE: readonly Level[];
|
|
117
|
+
/**
|
|
118
|
+
* The row in force for one query, or null when the schedule holds none (a price is then unknown,
|
|
119
|
+
* never guessed). At each level the latest row in force on `day` decides; a `null` percent there
|
|
120
|
+
* passes the question to the next level.
|
|
121
|
+
*/
|
|
122
|
+
export declare function markupInForce(schedule: readonly MarkupRow[], query: MarkupQuery): MarkupRow | null;
|
|
123
|
+
/** The percent in force for one query, or null when no row covers it. */
|
|
124
|
+
export declare function markupPercentFor(schedule: readonly MarkupRow[], query: MarkupQuery): number | null;
|
|
125
|
+
/** cost × (1 + percent/100), exact to the decimal scale. */
|
|
126
|
+
export declare function priceOf(costUsd: string, percent: number): string;
|
|
127
|
+
/**
|
|
128
|
+
* One day's attributed cost on one billed dimension, as the daily cost rollup (#3316) holds it.
|
|
129
|
+
* Deliberately narrow: the rollup's own row carries more (vertical, scope, confidence), and
|
|
130
|
+
* pricing needs only these.
|
|
131
|
+
*/
|
|
132
|
+
export interface DailyCostRow {
|
|
133
|
+
day: string;
|
|
134
|
+
tenantId: string;
|
|
135
|
+
dimension: BilledDimension;
|
|
136
|
+
kind: UsageKind;
|
|
137
|
+
/** List-price cost, USD decimal string. */
|
|
138
|
+
costUsd: string;
|
|
139
|
+
}
|
|
140
|
+
/** What staff see: cost, markup and price side by side. Null markup and price: no row in force. */
|
|
141
|
+
export interface StaffPricedRow extends DailyCostRow {
|
|
142
|
+
markupPercent: number | null;
|
|
143
|
+
priceUsd: string | null;
|
|
144
|
+
}
|
|
145
|
+
/** What a tenant sees: the price, with neither the cost nor the markup behind it. */
|
|
146
|
+
export interface TenantPricedRow {
|
|
147
|
+
day: string;
|
|
148
|
+
dimension: BilledDimension;
|
|
149
|
+
kind: UsageKind;
|
|
150
|
+
priceUsd: string | null;
|
|
151
|
+
}
|
|
152
|
+
/** Price cost rows for staff, each at the markup in force on its own day. */
|
|
153
|
+
export declare function priceCostRows(rows: readonly DailyCostRow[], schedule: readonly MarkupRow[]): StaffPricedRow[];
|
|
154
|
+
/** Price cost rows for the tenant: the price only. */
|
|
155
|
+
export declare function tenantPricedRows(rows: readonly DailyCostRow[], schedule: readonly MarkupRow[]): TenantPricedRow[];
|
|
156
|
+
export {};
|
|
157
|
+
//# sourceMappingURL=markup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markup.d.ts","sourceRoot":"","sources":["../src/markup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,E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AY,EAAE,EAAE,QAAQ,EAAE,SAAS,SAAS,EAAE,GAAG,eAAe,EAAE,CAEjH"}
|
package/dist/markup.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The markup schedule (#3316, Pricing): what the platform charges over what a tenant's usage
|
|
3
|
+
* costs it. One mechanism for every priced thing — Cloudflare's billed dimensions, model calls,
|
|
4
|
+
* build time — so the builder's model markup and the ledger's are rows here, not constants.
|
|
5
|
+
*
|
|
6
|
+
* - **Data, not code.** A default plus overrides per tenant, per billed dimension and per kind
|
|
7
|
+
* (live or preview). The most specific row wins: a tenant row over a platform row, then a
|
|
8
|
+
* dimension row over a dimension-wide one, then a kind row over a kind-wide one
|
|
9
|
+
* (`MARKUP_PRECEDENCE`).
|
|
10
|
+
* - **Dated, never edited.** A change is a new row with the UTC day it takes effect. A past day
|
|
11
|
+
* is priced at the row in force on that day, so a change never reprices history. A row with
|
|
12
|
+
* `percent: null` ends an override: that level falls through to the next less specific one,
|
|
13
|
+
* so a tenant once given its own rate is not frozen off every later change to the default.
|
|
14
|
+
* - **Applied at read.** Cost is what is stored; price = cost × (1 + markup), computed here with
|
|
15
|
+
* `mulDecimal`/`marginFactor`, never floated and never stored.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
import { utcDay } from './control-plane.js';
|
|
19
|
+
import { tenantId } from './ids.js';
|
|
20
|
+
import { marginFactor } from './model-usage.js';
|
|
21
|
+
import { mulDecimal } from './money.js';
|
|
22
|
+
/** The dimensions a tenant is billed on: Cloudflare's, plus model calls and build time. */
|
|
23
|
+
export const BILLED_DIMENSIONS = [
|
|
24
|
+
'requests',
|
|
25
|
+
'cpu',
|
|
26
|
+
'do-requests',
|
|
27
|
+
'duration',
|
|
28
|
+
'rows-read',
|
|
29
|
+
'rows-written',
|
|
30
|
+
'storage',
|
|
31
|
+
'model-calls',
|
|
32
|
+
'build-time',
|
|
33
|
+
];
|
|
34
|
+
export const billedDimension = z.enum(BILLED_DIMENSIONS);
|
|
35
|
+
/** Live usage, or a preview's (a fork, a PR version). */
|
|
36
|
+
export const usageKind = z.enum(['live', 'preview']);
|
|
37
|
+
/** The highest markup a row may carry, whole percent: 10× cost. A bound on a typo, not a policy. */
|
|
38
|
+
export const MARKUP_PERCENT_MAX = 1000;
|
|
39
|
+
const markupPercent = z.number().int().min(0).max(MARKUP_PERCENT_MAX);
|
|
40
|
+
/** The fields that name what a row applies to. `null` is "every": every tenant, dimension, kind. */
|
|
41
|
+
const markupTarget = {
|
|
42
|
+
tenantId: tenantId.nullable(),
|
|
43
|
+
dimension: billedDimension.nullable(),
|
|
44
|
+
kind: usageKind.nullable(),
|
|
45
|
+
};
|
|
46
|
+
/** One row of the schedule, as stored. */
|
|
47
|
+
export const markupRow = z
|
|
48
|
+
.object({
|
|
49
|
+
id: z.string().min(1),
|
|
50
|
+
...markupTarget,
|
|
51
|
+
/** The first UTC day the row prices. */
|
|
52
|
+
effectiveFrom: utcDay,
|
|
53
|
+
/** Whole percent over cost; `null` ends an override at this level (it falls through). */
|
|
54
|
+
percent: markupPercent.nullable(),
|
|
55
|
+
/** Why — the admin log carries who; this carries the decision. */
|
|
56
|
+
reason: z.string().min(1).max(500),
|
|
57
|
+
setAt: z.string().min(1),
|
|
58
|
+
setBy: z.string().min(1),
|
|
59
|
+
})
|
|
60
|
+
.strict();
|
|
61
|
+
/**
|
|
62
|
+
* What staff send to add a row. Omitted target fields mean "every". The platform default (no
|
|
63
|
+
* target at all) must carry a percent: it is the floor every other row falls through to.
|
|
64
|
+
*/
|
|
65
|
+
export const markupRowInput = z
|
|
66
|
+
.object({
|
|
67
|
+
tenantId: tenantId.nullable().optional(),
|
|
68
|
+
dimension: billedDimension.nullable().optional(),
|
|
69
|
+
kind: usageKind.nullable().optional(),
|
|
70
|
+
effectiveFrom: utcDay,
|
|
71
|
+
percent: markupPercent.nullable(),
|
|
72
|
+
reason: z.string().trim().min(1).max(500),
|
|
73
|
+
})
|
|
74
|
+
.strict()
|
|
75
|
+
.refine((r) => r.percent !== null || r.tenantId != null || r.dimension != null || r.kind != null, {
|
|
76
|
+
message: 'the platform default must carry a percent',
|
|
77
|
+
path: ['percent'],
|
|
78
|
+
});
|
|
79
|
+
/** Who the seed rows name as their setter: the platform, not a person. */
|
|
80
|
+
export const MARKUP_SEED_ACTOR = 'platform-seed';
|
|
81
|
+
/** The day the seed rows take effect from: before any usage the platform holds, so every day it can price has a row. */
|
|
82
|
+
export const MARKUP_SEED_EFFECTIVE_FROM = '2000-01-01';
|
|
83
|
+
/**
|
|
84
|
+
* The owner's decisions of 2026-11-21 on #3316: the rows every schedule holds beneath what staff
|
|
85
|
+
* add. Read beneath the stored rows rather than inserted (the kernel's `markupScheduleOf`), with
|
|
86
|
+
* fixed ids, so a later row supersedes them and none can be lost or duplicated by a restore.
|
|
87
|
+
*/
|
|
88
|
+
export const MARKUP_SEED = [
|
|
89
|
+
{
|
|
90
|
+
id: '01KAKX00000000000000MARK01',
|
|
91
|
+
tenantId: null,
|
|
92
|
+
dimension: null,
|
|
93
|
+
kind: null,
|
|
94
|
+
effectiveFrom: MARKUP_SEED_EFFECTIVE_FROM,
|
|
95
|
+
percent: 100,
|
|
96
|
+
reason: 'Default markup over attributed cost, owner decision 2026-11-21 (#3316).',
|
|
97
|
+
setAt: '2026-11-21T00:00:00.000Z',
|
|
98
|
+
setBy: MARKUP_SEED_ACTOR,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: '01KAKX00000000000000MARK02',
|
|
102
|
+
tenantId: null,
|
|
103
|
+
dimension: null,
|
|
104
|
+
kind: 'preview',
|
|
105
|
+
effectiveFrom: MARKUP_SEED_EFFECTIVE_FROM,
|
|
106
|
+
percent: 0,
|
|
107
|
+
reason: 'Previews are priced at cost, owner decision 2026-11-21 (#3316).',
|
|
108
|
+
setAt: '2026-11-21T00:00:00.000Z',
|
|
109
|
+
setBy: MARKUP_SEED_ACTOR,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: '01KAKX00000000000000MARK03',
|
|
113
|
+
tenantId: null,
|
|
114
|
+
dimension: 'model-calls',
|
|
115
|
+
kind: null,
|
|
116
|
+
effectiveFrom: MARKUP_SEED_EFFECTIVE_FROM,
|
|
117
|
+
percent: 30,
|
|
118
|
+
reason: 'Model usage markup, owner decision 2026-11-21 (#3316); the builder studio and the model ledger both price at it.',
|
|
119
|
+
setAt: '2026-11-21T00:00:00.000Z',
|
|
120
|
+
setBy: MARKUP_SEED_ACTOR,
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
/**
|
|
124
|
+
* The order rows are tried in, most specific first: tenant, then dimension, then kind. So a
|
|
125
|
+
* tenant's own rate beats every platform row, and a dimension's rate beats a kind's (a model
|
|
126
|
+
* call made by a preview is priced as a model call).
|
|
127
|
+
*/
|
|
128
|
+
export const MARKUP_PRECEDENCE = [
|
|
129
|
+
[true, true, true],
|
|
130
|
+
[true, true, false],
|
|
131
|
+
[true, false, true],
|
|
132
|
+
[true, false, false],
|
|
133
|
+
[false, true, true],
|
|
134
|
+
[false, true, false],
|
|
135
|
+
[false, false, true],
|
|
136
|
+
[false, false, false],
|
|
137
|
+
];
|
|
138
|
+
const levelOf = (r) => `${r.tenantId !== null}${r.dimension !== null}${r.kind !== null}`;
|
|
139
|
+
/** Later wins: the later effective day, then the later setting, then the later id. */
|
|
140
|
+
const later = (a, b) => a.effectiveFrom !== b.effectiveFrom
|
|
141
|
+
? a.effectiveFrom > b.effectiveFrom
|
|
142
|
+
: a.setAt !== b.setAt
|
|
143
|
+
? a.setAt > b.setAt
|
|
144
|
+
: a.id > b.id;
|
|
145
|
+
/**
|
|
146
|
+
* The row in force for one query, or null when the schedule holds none (a price is then unknown,
|
|
147
|
+
* never guessed). At each level the latest row in force on `day` decides; a `null` percent there
|
|
148
|
+
* passes the question to the next level.
|
|
149
|
+
*/
|
|
150
|
+
export function markupInForce(schedule, query) {
|
|
151
|
+
const latest = new Map();
|
|
152
|
+
for (const row of schedule) {
|
|
153
|
+
if (row.effectiveFrom > query.day)
|
|
154
|
+
continue;
|
|
155
|
+
if (row.tenantId !== null && row.tenantId !== query.tenantId)
|
|
156
|
+
continue;
|
|
157
|
+
if (row.dimension !== null && row.dimension !== query.dimension)
|
|
158
|
+
continue;
|
|
159
|
+
if (row.kind !== null && row.kind !== query.kind)
|
|
160
|
+
continue;
|
|
161
|
+
const level = levelOf(row);
|
|
162
|
+
const held = latest.get(level);
|
|
163
|
+
if (!held || later(row, held))
|
|
164
|
+
latest.set(level, row);
|
|
165
|
+
}
|
|
166
|
+
for (const level of MARKUP_PRECEDENCE) {
|
|
167
|
+
const row = latest.get(`${level[0]}${level[1]}${level[2]}`);
|
|
168
|
+
if (row && row.percent !== null)
|
|
169
|
+
return row;
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
/** The percent in force for one query, or null when no row covers it. */
|
|
174
|
+
export function markupPercentFor(schedule, query) {
|
|
175
|
+
return markupInForce(schedule, query)?.percent ?? null;
|
|
176
|
+
}
|
|
177
|
+
/** cost × (1 + percent/100), exact to the decimal scale. */
|
|
178
|
+
export function priceOf(costUsd, percent) {
|
|
179
|
+
return mulDecimal(costUsd, marginFactor(percent));
|
|
180
|
+
}
|
|
181
|
+
/** Price cost rows for staff, each at the markup in force on its own day. */
|
|
182
|
+
export function priceCostRows(rows, schedule) {
|
|
183
|
+
return rows.map((row) => {
|
|
184
|
+
const percent = markupPercentFor(schedule, row);
|
|
185
|
+
return { ...row, markupPercent: percent, priceUsd: percent === null ? null : priceOf(row.costUsd, percent) };
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/** Price cost rows for the tenant: the price only. */
|
|
189
|
+
export function tenantPricedRows(rows, schedule) {
|
|
190
|
+
return priceCostRows(rows, schedule).map(({ day, dimension, kind, priceUsd }) => ({ day, dimension, kind, priceUsd }));
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=markup.js.map
|
|
@@ -0,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C;IAC/G,CAAC,CAAC,CAAC;AACL,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,gBAAgB,CAAC,IAA6B,EAAE,QAA8B;IAC5F,OAAO,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACzH,CAAC"}
|
package/dist/model-usage.d.ts
CHANGED
|
@@ -112,9 +112,9 @@ export type ModelUsageEntry = z.infer<typeof modelUsageEntry>;
|
|
|
112
112
|
* directory is exactly that fan-in, for this one kind of usage.
|
|
113
113
|
*
|
|
114
114
|
* One row per (tenant, vertical, model). Token sums are integers; money is folded with
|
|
115
|
-
* `addDecimal`, never floated, and `billedUsd` is `listUsd × marginFactor(
|
|
116
|
-
*
|
|
117
|
-
*
|
|
115
|
+
* `addDecimal`, never floated, and `billedUsd` is `listUsd × marginFactor(percent)` applied at
|
|
116
|
+
* READ time. With the markup schedule (#3316) each line is priced at the `model-calls` row in
|
|
117
|
+
* force for its tenant on its own day, so a dated change never reprices the days before it. `unpriced` counts calls whose
|
|
118
118
|
* model the rate card did not know: shown beside the money, never folded into it as $0.
|
|
119
119
|
*/
|
|
120
120
|
export declare const modelUsageSummaryRow: z.ZodObject<{
|
|
@@ -175,4 +175,162 @@ export type ModelUsageSummary = z.infer<typeof modelUsageSummary>;
|
|
|
175
175
|
* a factor the 6-dp decimal scale cannot always carry, and nobody prices at 12.5%.
|
|
176
176
|
*/
|
|
177
177
|
export declare function marginFactor(percent: number): string;
|
|
178
|
+
export declare const modelReconciliationStatus: z.ZodEnum<{
|
|
179
|
+
discrepancy: "discrepancy";
|
|
180
|
+
"gateway-only": "gateway-only";
|
|
181
|
+
"ledger-only": "ledger-only";
|
|
182
|
+
matched: "matched";
|
|
183
|
+
}>;
|
|
184
|
+
export type ModelReconciliationStatus = z.infer<typeof modelReconciliationStatus>;
|
|
185
|
+
export declare const modelReconciliationRow: z.ZodObject<{
|
|
186
|
+
tenantId: z.ZodString;
|
|
187
|
+
scopeId: z.ZodString;
|
|
188
|
+
vertical: z.ZodNullable<z.ZodString>;
|
|
189
|
+
modelId: z.ZodString;
|
|
190
|
+
status: z.ZodEnum<{
|
|
191
|
+
discrepancy: "discrepancy";
|
|
192
|
+
"gateway-only": "gateway-only";
|
|
193
|
+
"ledger-only": "ledger-only";
|
|
194
|
+
matched: "matched";
|
|
195
|
+
}>;
|
|
196
|
+
differs: z.ZodArray<z.ZodEnum<{
|
|
197
|
+
calls: "calls";
|
|
198
|
+
cost: "cost";
|
|
199
|
+
}>>;
|
|
200
|
+
ledger: z.ZodObject<{
|
|
201
|
+
calls: z.ZodNumber;
|
|
202
|
+
inputTokens: z.ZodNumber;
|
|
203
|
+
outputTokens: z.ZodNumber;
|
|
204
|
+
listUsd: z.ZodString;
|
|
205
|
+
unpriced: z.ZodNumber;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
gateway: z.ZodObject<{
|
|
208
|
+
calls: z.ZodNumber;
|
|
209
|
+
inputTokens: z.ZodNumber;
|
|
210
|
+
outputTokens: z.ZodNumber;
|
|
211
|
+
costUsd: z.ZodString;
|
|
212
|
+
}, z.core.$strip>;
|
|
213
|
+
deltaUsd: z.ZodString;
|
|
214
|
+
}, z.core.$strip>;
|
|
215
|
+
export type ModelReconciliationRow = z.infer<typeof modelReconciliationRow>;
|
|
216
|
+
export declare const modelReconciliationDay: z.ZodObject<{
|
|
217
|
+
day: z.ZodString;
|
|
218
|
+
readAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
219
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
220
|
+
tenantId: z.ZodString;
|
|
221
|
+
scopeId: z.ZodString;
|
|
222
|
+
vertical: z.ZodNullable<z.ZodString>;
|
|
223
|
+
modelId: z.ZodString;
|
|
224
|
+
status: z.ZodEnum<{
|
|
225
|
+
discrepancy: "discrepancy";
|
|
226
|
+
"gateway-only": "gateway-only";
|
|
227
|
+
"ledger-only": "ledger-only";
|
|
228
|
+
matched: "matched";
|
|
229
|
+
}>;
|
|
230
|
+
differs: z.ZodArray<z.ZodEnum<{
|
|
231
|
+
calls: "calls";
|
|
232
|
+
cost: "cost";
|
|
233
|
+
}>>;
|
|
234
|
+
ledger: z.ZodObject<{
|
|
235
|
+
calls: z.ZodNumber;
|
|
236
|
+
inputTokens: z.ZodNumber;
|
|
237
|
+
outputTokens: z.ZodNumber;
|
|
238
|
+
listUsd: z.ZodString;
|
|
239
|
+
unpriced: z.ZodNumber;
|
|
240
|
+
}, z.core.$strip>;
|
|
241
|
+
gateway: z.ZodObject<{
|
|
242
|
+
calls: z.ZodNumber;
|
|
243
|
+
inputTokens: z.ZodNumber;
|
|
244
|
+
outputTokens: z.ZodNumber;
|
|
245
|
+
costUsd: z.ZodString;
|
|
246
|
+
}, z.core.$strip>;
|
|
247
|
+
deltaUsd: z.ZodString;
|
|
248
|
+
}, z.core.$strip>>;
|
|
249
|
+
unattributedGateway: z.ZodArray<z.ZodObject<{
|
|
250
|
+
provider: z.ZodString;
|
|
251
|
+
modelId: z.ZodString;
|
|
252
|
+
calls: z.ZodNumber;
|
|
253
|
+
costUsd: z.ZodString;
|
|
254
|
+
}, z.core.$strip>>;
|
|
255
|
+
workersAiWithoutGateway: z.ZodArray<z.ZodObject<{
|
|
256
|
+
modelId: z.ZodString;
|
|
257
|
+
requestSource: z.ZodString;
|
|
258
|
+
calls: z.ZodNumber;
|
|
259
|
+
neurons: z.ZodString;
|
|
260
|
+
estimatedUsd: z.ZodString;
|
|
261
|
+
}, z.core.$strip>>;
|
|
262
|
+
otherDirectoryGateway: z.ZodObject<{
|
|
263
|
+
calls: z.ZodNumber;
|
|
264
|
+
costUsd: z.ZodString;
|
|
265
|
+
}, z.core.$strip>;
|
|
266
|
+
offGatewayLedgerCalls: z.ZodNumber;
|
|
267
|
+
totals: z.ZodObject<{
|
|
268
|
+
ledgerListUsd: z.ZodString;
|
|
269
|
+
gatewayCostUsd: z.ZodString;
|
|
270
|
+
workersAiWithoutGatewayUsd: z.ZodString;
|
|
271
|
+
}, z.core.$strip>;
|
|
272
|
+
}, z.core.$strip>;
|
|
273
|
+
export type ModelReconciliationDay = z.infer<typeof modelReconciliationDay>;
|
|
274
|
+
export declare const modelReconciliation: z.ZodObject<{
|
|
275
|
+
since: z.ZodString;
|
|
276
|
+
until: z.ZodString;
|
|
277
|
+
days: z.ZodArray<z.ZodObject<{
|
|
278
|
+
day: z.ZodString;
|
|
279
|
+
readAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
280
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
281
|
+
tenantId: z.ZodString;
|
|
282
|
+
scopeId: z.ZodString;
|
|
283
|
+
vertical: z.ZodNullable<z.ZodString>;
|
|
284
|
+
modelId: z.ZodString;
|
|
285
|
+
status: z.ZodEnum<{
|
|
286
|
+
discrepancy: "discrepancy";
|
|
287
|
+
"gateway-only": "gateway-only";
|
|
288
|
+
"ledger-only": "ledger-only";
|
|
289
|
+
matched: "matched";
|
|
290
|
+
}>;
|
|
291
|
+
differs: z.ZodArray<z.ZodEnum<{
|
|
292
|
+
calls: "calls";
|
|
293
|
+
cost: "cost";
|
|
294
|
+
}>>;
|
|
295
|
+
ledger: z.ZodObject<{
|
|
296
|
+
calls: z.ZodNumber;
|
|
297
|
+
inputTokens: z.ZodNumber;
|
|
298
|
+
outputTokens: z.ZodNumber;
|
|
299
|
+
listUsd: z.ZodString;
|
|
300
|
+
unpriced: z.ZodNumber;
|
|
301
|
+
}, z.core.$strip>;
|
|
302
|
+
gateway: z.ZodObject<{
|
|
303
|
+
calls: z.ZodNumber;
|
|
304
|
+
inputTokens: z.ZodNumber;
|
|
305
|
+
outputTokens: z.ZodNumber;
|
|
306
|
+
costUsd: z.ZodString;
|
|
307
|
+
}, z.core.$strip>;
|
|
308
|
+
deltaUsd: z.ZodString;
|
|
309
|
+
}, z.core.$strip>>;
|
|
310
|
+
unattributedGateway: z.ZodArray<z.ZodObject<{
|
|
311
|
+
provider: z.ZodString;
|
|
312
|
+
modelId: z.ZodString;
|
|
313
|
+
calls: z.ZodNumber;
|
|
314
|
+
costUsd: z.ZodString;
|
|
315
|
+
}, z.core.$strip>>;
|
|
316
|
+
workersAiWithoutGateway: z.ZodArray<z.ZodObject<{
|
|
317
|
+
modelId: z.ZodString;
|
|
318
|
+
requestSource: z.ZodString;
|
|
319
|
+
calls: z.ZodNumber;
|
|
320
|
+
neurons: z.ZodString;
|
|
321
|
+
estimatedUsd: z.ZodString;
|
|
322
|
+
}, z.core.$strip>>;
|
|
323
|
+
otherDirectoryGateway: z.ZodObject<{
|
|
324
|
+
calls: z.ZodNumber;
|
|
325
|
+
costUsd: z.ZodString;
|
|
326
|
+
}, z.core.$strip>;
|
|
327
|
+
offGatewayLedgerCalls: z.ZodNumber;
|
|
328
|
+
totals: z.ZodObject<{
|
|
329
|
+
ledgerListUsd: z.ZodString;
|
|
330
|
+
gatewayCostUsd: z.ZodString;
|
|
331
|
+
workersAiWithoutGatewayUsd: z.ZodString;
|
|
332
|
+
}, z.core.$strip>;
|
|
333
|
+
}, z.core.$strip>>;
|
|
334
|
+
}, z.core.$strip>;
|
|
335
|
+
export type ModelReconciliation = z.infer<typeof modelReconciliation>;
|
|
178
336
|
//# sourceMappingURL=model-usage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-usage.d.ts","sourceRoot":"","sources":["../src/model-usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB;;;;;;kBAclB,CAAC;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,QAA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