@usenaive-sdk/cli 0.15.0 → 1.0.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 +43 -354
- package/dist/index.js +51775 -502
- package/package.json +22 -18
- package/dist/client.d.ts +0 -108
- package/dist/client.js +0 -458
- package/dist/client.js.map +0 -1
- package/dist/commands/account-kits.d.ts +0 -2
- package/dist/commands/account-kits.js +0 -71
- package/dist/commands/account-kits.js.map +0 -1
- package/dist/commands/aeo.d.ts +0 -2
- package/dist/commands/aeo.js +0 -451
- package/dist/commands/aeo.js.map +0 -1
- package/dist/commands/agent-profiles.d.ts +0 -11
- package/dist/commands/agent-profiles.js +0 -120
- package/dist/commands/agent-profiles.js.map +0 -1
- package/dist/commands/agents.d.ts +0 -2
- package/dist/commands/agents.js +0 -916
- package/dist/commands/agents.js.map +0 -1
- package/dist/commands/app-data.d.ts +0 -2
- package/dist/commands/app-data.js +0 -445
- package/dist/commands/app-data.js.map +0 -1
- package/dist/commands/approvals.d.ts +0 -2
- package/dist/commands/approvals.js +0 -242
- package/dist/commands/approvals.js.map +0 -1
- package/dist/commands/apps.d.ts +0 -9
- package/dist/commands/apps.js +0 -844
- package/dist/commands/apps.js.map +0 -1
- package/dist/commands/audio.d.ts +0 -9
- package/dist/commands/audio.js +0 -391
- package/dist/commands/audio.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -31
- package/dist/commands/auth.js +0 -428
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/billing.d.ts +0 -2
- package/dist/commands/billing.js +0 -245
- package/dist/commands/billing.js.map +0 -1
- package/dist/commands/brain.d.ts +0 -2
- package/dist/commands/brain.js +0 -1300
- package/dist/commands/brain.js.map +0 -1
- package/dist/commands/browser.d.ts +0 -2
- package/dist/commands/browser.js +0 -378
- package/dist/commands/browser.js.map +0 -1
- package/dist/commands/business.d.ts +0 -2
- package/dist/commands/business.js +0 -566
- package/dist/commands/business.js.map +0 -1
- package/dist/commands/cards.d.ts +0 -2
- package/dist/commands/cards.js +0 -419
- package/dist/commands/cards.js.map +0 -1
- package/dist/commands/ceo.d.ts +0 -2
- package/dist/commands/ceo.js +0 -369
- package/dist/commands/ceo.js.map +0 -1
- package/dist/commands/clone.d.ts +0 -2
- package/dist/commands/clone.js +0 -203
- package/dist/commands/clone.js.map +0 -1
- package/dist/commands/companies.d.ts +0 -10
- package/dist/commands/companies.js +0 -283
- package/dist/commands/companies.js.map +0 -1
- package/dist/commands/company-data.d.ts +0 -2
- package/dist/commands/company-data.js +0 -168
- package/dist/commands/company-data.js.map +0 -1
- package/dist/commands/compute.d.ts +0 -2
- package/dist/commands/compute.js +0 -498
- package/dist/commands/compute.js.map +0 -1
- package/dist/commands/config.d.ts +0 -2
- package/dist/commands/config.js +0 -36
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/connections.d.ts +0 -8
- package/dist/commands/connections.js +0 -137
- package/dist/commands/connections.js.map +0 -1
- package/dist/commands/cron-jobs.d.ts +0 -2
- package/dist/commands/cron-jobs.js +0 -245
- package/dist/commands/cron-jobs.js.map +0 -1
- package/dist/commands/domains.d.ts +0 -2
- package/dist/commands/domains.js +0 -474
- package/dist/commands/domains.js.map +0 -1
- package/dist/commands/ecommerce.d.ts +0 -2
- package/dist/commands/ecommerce.js +0 -277
- package/dist/commands/ecommerce.js.map +0 -1
- package/dist/commands/email.d.ts +0 -2
- package/dist/commands/email.js +0 -336
- package/dist/commands/email.js.map +0 -1
- package/dist/commands/employees.d.ts +0 -2
- package/dist/commands/employees.js +0 -190
- package/dist/commands/employees.js.map +0 -1
- package/dist/commands/env.d.ts +0 -7
- package/dist/commands/env.js +0 -112
- package/dist/commands/env.js.map +0 -1
- package/dist/commands/formation.d.ts +0 -2
- package/dist/commands/formation.js +0 -273
- package/dist/commands/formation.js.map +0 -1
- package/dist/commands/identity.d.ts +0 -2
- package/dist/commands/identity.js +0 -110
- package/dist/commands/identity.js.map +0 -1
- package/dist/commands/images.d.ts +0 -2
- package/dist/commands/images.js +0 -371
- package/dist/commands/images.js.map +0 -1
- package/dist/commands/init.d.ts +0 -5
- package/dist/commands/init.js +0 -43
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/jobs.d.ts +0 -2
- package/dist/commands/jobs.js +0 -144
- package/dist/commands/jobs.js.map +0 -1
- package/dist/commands/keys.d.ts +0 -2
- package/dist/commands/keys.js +0 -156
- package/dist/commands/keys.js.map +0 -1
- package/dist/commands/legacy-auth.d.ts +0 -27
- package/dist/commands/legacy-auth.js +0 -64
- package/dist/commands/legacy-auth.js.map +0 -1
- package/dist/commands/llm.d.ts +0 -2
- package/dist/commands/llm.js +0 -106
- package/dist/commands/llm.js.map +0 -1
- package/dist/commands/login.d.ts +0 -2
- package/dist/commands/login.js +0 -65
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -7
- package/dist/commands/logout.js +0 -55
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/logs.d.ts +0 -2
- package/dist/commands/logs.js +0 -42
- package/dist/commands/logs.js.map +0 -1
- package/dist/commands/loops.d.ts +0 -2
- package/dist/commands/loops.js +0 -260
- package/dist/commands/loops.js.map +0 -1
- package/dist/commands/media.d.ts +0 -2
- package/dist/commands/media.js +0 -183
- package/dist/commands/media.js.map +0 -1
- package/dist/commands/memory.d.ts +0 -2
- package/dist/commands/memory.js +0 -151
- package/dist/commands/memory.js.map +0 -1
- package/dist/commands/mobile.d.ts +0 -4
- package/dist/commands/mobile.js +0 -382
- package/dist/commands/mobile.js.map +0 -1
- package/dist/commands/module.d.ts +0 -8
- package/dist/commands/module.js +0 -48
- package/dist/commands/module.js.map +0 -1
- package/dist/commands/objectives.d.ts +0 -2
- package/dist/commands/objectives.js +0 -243
- package/dist/commands/objectives.js.map +0 -1
- package/dist/commands/payments.d.ts +0 -2
- package/dist/commands/payments.js +0 -131
- package/dist/commands/payments.js.map +0 -1
- package/dist/commands/people.d.ts +0 -2
- package/dist/commands/people.js +0 -197
- package/dist/commands/people.js.map +0 -1
- package/dist/commands/phone.d.ts +0 -2
- package/dist/commands/phone.js +0 -289
- package/dist/commands/phone.js.map +0 -1
- package/dist/commands/projects.d.ts +0 -13
- package/dist/commands/projects.js +0 -220
- package/dist/commands/projects.js.map +0 -1
- package/dist/commands/queue.d.ts +0 -2
- package/dist/commands/queue.js +0 -121
- package/dist/commands/queue.js.map +0 -1
- package/dist/commands/register.d.ts +0 -2
- package/dist/commands/register.js +0 -80
- package/dist/commands/register.js.map +0 -1
- package/dist/commands/report.d.ts +0 -17
- package/dist/commands/report.js +0 -109
- package/dist/commands/report.js.map +0 -1
- package/dist/commands/sandbox.d.ts +0 -2
- package/dist/commands/sandbox.js +0 -558
- package/dist/commands/sandbox.js.map +0 -1
- package/dist/commands/search.d.ts +0 -2
- package/dist/commands/search.js +0 -223
- package/dist/commands/search.js.map +0 -1
- package/dist/commands/seo.d.ts +0 -2
- package/dist/commands/seo.js +0 -528
- package/dist/commands/seo.js.map +0 -1
- package/dist/commands/sessions.d.ts +0 -6
- package/dist/commands/sessions.js +0 -109
- package/dist/commands/sessions.js.map +0 -1
- package/dist/commands/social-data.d.ts +0 -2
- package/dist/commands/social-data.js +0 -245
- package/dist/commands/social-data.js.map +0 -1
- package/dist/commands/social.d.ts +0 -2
- package/dist/commands/social.js +0 -407
- package/dist/commands/social.js.map +0 -1
- package/dist/commands/status.d.ts +0 -2
- package/dist/commands/status.js +0 -73
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/support.d.ts +0 -2
- package/dist/commands/support.js +0 -134
- package/dist/commands/support.js.map +0 -1
- package/dist/commands/tasks.d.ts +0 -2
- package/dist/commands/tasks.js +0 -409
- package/dist/commands/tasks.js.map +0 -1
- package/dist/commands/teams.d.ts +0 -69
- package/dist/commands/teams.js +0 -503
- package/dist/commands/teams.js.map +0 -1
- package/dist/commands/trading.d.ts +0 -2
- package/dist/commands/trading.js +0 -333
- package/dist/commands/trading.js.map +0 -1
- package/dist/commands/up.d.ts +0 -551
- package/dist/commands/up.js +0 -1149
- package/dist/commands/up.js.map +0 -1
- package/dist/commands/usage.d.ts +0 -2
- package/dist/commands/usage.js +0 -73
- package/dist/commands/usage.js.map +0 -1
- package/dist/commands/use.d.ts +0 -12
- package/dist/commands/use.js +0 -96
- package/dist/commands/use.js.map +0 -1
- package/dist/commands/users.d.ts +0 -10
- package/dist/commands/users.js +0 -82
- package/dist/commands/users.js.map +0 -1
- package/dist/commands/vault.d.ts +0 -2
- package/dist/commands/vault.js +0 -101
- package/dist/commands/vault.js.map +0 -1
- package/dist/commands/verification.d.ts +0 -2
- package/dist/commands/verification.js +0 -152
- package/dist/commands/verification.js.map +0 -1
- package/dist/commands/verify-email.d.ts +0 -19
- package/dist/commands/verify-email.js +0 -112
- package/dist/commands/verify-email.js.map +0 -1
- package/dist/commands/video.d.ts +0 -2
- package/dist/commands/video.js +0 -417
- package/dist/commands/video.js.map +0 -1
- package/dist/commands/voice.d.ts +0 -2
- package/dist/commands/voice.js +0 -516
- package/dist/commands/voice.js.map +0 -1
- package/dist/commands/wallet.d.ts +0 -2
- package/dist/commands/wallet.js +0 -244
- package/dist/commands/wallet.js.map +0 -1
- package/dist/commands/webhooks.d.ts +0 -13
- package/dist/commands/webhooks.js +0 -119
- package/dist/commands/webhooks.js.map +0 -1
- package/dist/commands/whoami.d.ts +0 -2
- package/dist/commands/whoami.js +0 -53
- package/dist/commands/whoami.js.map +0 -1
- package/dist/config.d.ts +0 -42
- package/dist/config.js +0 -83
- package/dist/config.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js.map +0 -1
- package/dist/lib/brain-select.d.ts +0 -193
- package/dist/lib/brain-select.js +0 -403
- package/dist/lib/brain-select.js.map +0 -1
- package/dist/lib/cli-validation.d.ts +0 -12
- package/dist/lib/cli-validation.js +0 -46
- package/dist/lib/cli-validation.js.map +0 -1
- package/dist/lib/config-errors.d.ts +0 -4
- package/dist/lib/config-errors.js +0 -13
- package/dist/lib/config-errors.js.map +0 -1
- package/dist/lib/deprecation.d.ts +0 -158
- package/dist/lib/deprecation.js +0 -140
- package/dist/lib/deprecation.js.map +0 -1
- package/dist/lib/duration.d.ts +0 -8
- package/dist/lib/duration.js +0 -11
- package/dist/lib/duration.js.map +0 -1
- package/dist/lib/http-response.d.ts +0 -11
- package/dist/lib/http-response.js +0 -96
- package/dist/lib/http-response.js.map +0 -1
- package/dist/lib/pricing.d.ts +0 -132
- package/dist/lib/pricing.js +0 -148
- package/dist/lib/pricing.js.map +0 -1
- package/dist/lib/starter-config.d.ts +0 -13
- package/dist/lib/starter-config.js +0 -71
- package/dist/lib/starter-config.js.map +0 -1
- package/dist/lib/stream-frames.d.ts +0 -114
- package/dist/lib/stream-frames.js +0 -169
- package/dist/lib/stream-frames.js.map +0 -1
- package/dist/lib/teams-catalog.d.ts +0 -141
- package/dist/lib/teams-catalog.js +0 -841
- package/dist/lib/teams-catalog.js.map +0 -1
- package/dist/lib/unknown-command.d.ts +0 -71
- package/dist/lib/unknown-command.js +0 -132
- package/dist/lib/unknown-command.js.map +0 -1
- package/dist/lib/version-check.d.ts +0 -26
- package/dist/lib/version-check.js +0 -21
- package/dist/lib/version-check.js.map +0 -1
- package/dist/output.d.ts +0 -174
- package/dist/output.js +0 -435
- package/dist/output.js.map +0 -1
- package/dist/prompt.d.ts +0 -17
- package/dist/prompt.js +0 -70
- package/dist/prompt.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -14
- package/dist/version.js.map +0 -1
package/dist/lib/pricing.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fixed public prices mirrored from the API meters, so CLI copy cannot silently
|
|
3
|
-
* drift from billing. Keep dynamic model costs out of this table.
|
|
4
|
-
*
|
|
5
|
-
* The source of truth is `FIXED_CREDIT_COSTS` in platform/billing/src/pricing.ts
|
|
6
|
-
* and `pricing-parity.test.ts` holds the two equal. This header used to name
|
|
7
|
-
* packages/api/src/lib/pricing.ts — a path the #497 restructure deleted — and
|
|
8
|
-
* to promise a "dogfood contract test" that no file in the repo implemented.
|
|
9
|
-
*/
|
|
10
|
-
export const FIXED_CREDIT_COSTS = {
|
|
11
|
-
emailSend: 0.016,
|
|
12
|
-
webSearch: 0.2,
|
|
13
|
-
urlRead: 0.05,
|
|
14
|
-
researchQuick: 0.5,
|
|
15
|
-
researchThorough: 1,
|
|
16
|
-
researchExhaustive: 1.6,
|
|
17
|
-
brainQuery: 0.08,
|
|
18
|
-
brainIngestBase: 0.1,
|
|
19
|
-
brainIngestPerKb: 0.0002,
|
|
20
|
-
brainIngestMaxCredits: 10,
|
|
21
|
-
socialPost: 2.5,
|
|
22
|
-
socialXPost: 0.5,
|
|
23
|
-
socialXPostWithLink: 5,
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* The DataForSEO-backed data primitives (seo / aeo / app-data / business /
|
|
27
|
-
* ecommerce), mirrored from `DATA_API_CREDIT_COSTS` in
|
|
28
|
-
* platform/billing/src/pricing.ts, which is where the reasoning, the vendor list
|
|
29
|
-
* price behind each number and the market anchor live. Held equal to it by
|
|
30
|
-
* packages/api/src/__tests__/credit-price-parity.test.ts.
|
|
31
|
-
*
|
|
32
|
-
* These are LIST prices. A charge is additionally floored at 1.2× what the call
|
|
33
|
-
* cost us upstream, so a row-heavy response can settle above the figure quoted
|
|
34
|
-
* here — which is why every CLI hint renders the response's own `credits_used`
|
|
35
|
-
* and only the `--help` epilogues quote this table.
|
|
36
|
-
*/
|
|
37
|
-
export const DATA_API_CREDIT_COSTS = {
|
|
38
|
-
seoKeywordsAdsLive: 2,
|
|
39
|
-
seoKeywordsAdsStandard: 1.5,
|
|
40
|
-
seoKeywordsTrendsLive: 0.25,
|
|
41
|
-
seoKeywordsTrendsStandard: 0.2,
|
|
42
|
-
seoBacklinksStandard: 1.8,
|
|
43
|
-
seoBacklinksBulk: 17,
|
|
44
|
-
seoLabsStandard: 0.75,
|
|
45
|
-
seoLabsBulk: 5.4,
|
|
46
|
-
seoLabsHistorical: 10,
|
|
47
|
-
aeoLlmResponsesLive: 1.2,
|
|
48
|
-
aeoLlmResponsesStandard: 1.2,
|
|
49
|
-
aeoLlmScraperLive: 0.16,
|
|
50
|
-
aeoLlmScraperStandard: 0.08,
|
|
51
|
-
appDataAppSearches: 0.85,
|
|
52
|
-
appDataAppList: 0.85,
|
|
53
|
-
appDataAppInfo: 0.05,
|
|
54
|
-
appDataAppReviews: 6,
|
|
55
|
-
businessGoogleInfoLive: 0.13,
|
|
56
|
-
businessGoogleInfoStandard: 0.09,
|
|
57
|
-
businessGoogleUpdatesStandard: 3,
|
|
58
|
-
businessGoogleReviewsStandard: 1.5,
|
|
59
|
-
businessGoogleQaLive: 0.3,
|
|
60
|
-
businessGoogleQaStandard: 0.18,
|
|
61
|
-
businessGoogleHotelLive: 0.1,
|
|
62
|
-
businessGoogleHotelStandard: 0.07,
|
|
63
|
-
businessTrustpilotSearchStandard: 0.34,
|
|
64
|
-
businessTrustpilotReviewsStandard: 0.85,
|
|
65
|
-
businessTripadvisorSearchStandard: 0.85,
|
|
66
|
-
businessTripadvisorReviewsStandard: 1.25,
|
|
67
|
-
businessSocialLive: 0.1,
|
|
68
|
-
ecommerceGoogleProducts: 0.15,
|
|
69
|
-
ecommerceGoogleProductInfo: 0.14,
|
|
70
|
-
ecommerceGoogleSellers: 0.24,
|
|
71
|
-
ecommerceGoogleReviews: 2.2,
|
|
72
|
-
ecommerceAmazonProducts: 0.14,
|
|
73
|
-
ecommerceAmazonAsin: 0.04,
|
|
74
|
-
ecommerceAmazonSellers: 0.14,
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* The two row-metered families, whose price is a base plus a per-row rate rather
|
|
78
|
-
* than a flat figure. Mirrored from the same module; `appListingsCredits` /
|
|
79
|
-
* `aeoLlmMentionsCredits` there are the functions that bill.
|
|
80
|
-
*/
|
|
81
|
-
export const METERED_DATA_API_CREDITS = {
|
|
82
|
-
llmMentionsBase: 2.4,
|
|
83
|
-
llmMentionsPerRow: 0.024,
|
|
84
|
-
llmMentionsMaxRows: 1000,
|
|
85
|
-
llmMentionsDefaultRows: 100,
|
|
86
|
-
appListingsBase: 2.4,
|
|
87
|
-
appListingsPerItem: 0.024,
|
|
88
|
-
aiKeywordsBase: 0.4,
|
|
89
|
-
aiKeywordsPerKeyword: 0.004,
|
|
90
|
-
};
|
|
91
|
-
/** `2.4 + 0.024 × rows`, the LLM Mentions price the API charges for `rows` rows. */
|
|
92
|
-
export function llmMentionsCredits(rows) {
|
|
93
|
-
const capped = Math.min(Math.max(rows, 1), METERED_DATA_API_CREDITS.llmMentionsMaxRows);
|
|
94
|
-
return Math.ceil((METERED_DATA_API_CREDITS.llmMentionsBase + METERED_DATA_API_CREDITS.llmMentionsPerRow * capped) * 100) / 100;
|
|
95
|
-
}
|
|
96
|
-
/** `2.4 + 0.024 × limit`, the live app-listings price for a given `--limit`. */
|
|
97
|
-
export function appListingsCredits(limit) {
|
|
98
|
-
return Math.ceil((METERED_DATA_API_CREDITS.appListingsBase + METERED_DATA_API_CREDITS.appListingsPerItem * Math.max(limit, 1)) * 100) / 100;
|
|
99
|
-
}
|
|
100
|
-
export function reportedCreditsUsed(data, fallback) {
|
|
101
|
-
const value = data?.credits_used;
|
|
102
|
-
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* The one-time credit packs, mirrored field-for-field from `CREDIT_PACKS` in
|
|
106
|
-
* platform/billing/src/billing.ts — the table `createTopupCheckout` bills
|
|
107
|
-
* Stripe from. The CLI ships to npm with five runtime dependencies and cannot
|
|
108
|
-
* import the billing package, so this is a mirror; `pricing-parity.test.ts`
|
|
109
|
-
* imports both and fails on any divergence.
|
|
110
|
-
*
|
|
111
|
-
* 🔴 EVERY pack figure the CLI prints must come from here. The `--help`
|
|
112
|
-
* epilogue and the `--pack` option description used to carry two independent
|
|
113
|
-
* hand-typed copies, and one of them drifted to a tenth of the real price.
|
|
114
|
-
*/
|
|
115
|
-
export const CREDIT_PACKS = [
|
|
116
|
-
{ id: "small", credits: 200, priceInCents: 1000 },
|
|
117
|
-
{ id: "medium", credits: 500, priceInCents: 2300, badge: "Popular" },
|
|
118
|
-
{ id: "large", credits: 1000, priceInCents: 4400, badge: "Best Value" },
|
|
119
|
-
{ id: "xl", credits: 2500, priceInCents: 10000 },
|
|
120
|
-
];
|
|
121
|
-
/** `$23` — whole dollars, matching how the API renders `getCreditPacks().price`. */
|
|
122
|
-
export function packPrice(pack) {
|
|
123
|
-
return `$${(pack.priceInCents / 100).toFixed(0)}`;
|
|
124
|
-
}
|
|
125
|
-
/** `medium (500 credits, $23)` — the inline form for an option description. */
|
|
126
|
-
export function packInline(pack) {
|
|
127
|
-
return `${pack.id} (${pack.credits} credits, ${packPrice(pack)})`;
|
|
128
|
-
}
|
|
129
|
-
/** One column-aligned row of the pack table in `naive billing --help`. */
|
|
130
|
-
export function packRow(pack) {
|
|
131
|
-
const credits = `${pack.credits} credits`.padEnd(15);
|
|
132
|
-
const price = pack.badge ? `${packPrice(pack).padEnd(6)}(${pack.badge})` : packPrice(pack);
|
|
133
|
-
return ` ${pack.id.padEnd(10)}${credits}${price}`;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* The flat 9:16 vertical-reframe / face-tracking fee, in credits, mirrored from
|
|
137
|
-
* `usdToBillableCredits(REFRAME_FEE_USD_PER_JOB)` in
|
|
138
|
-
* platform/billing/src/pricing.ts — the value clipCost() adds to a reframed
|
|
139
|
-
* job's subtotal. Charged once per job, not per clip.
|
|
140
|
-
*
|
|
141
|
-
* The CLI used to advertise this as "typically $0.05–$0.30 per job", which is
|
|
142
|
-
* the band clip-job-cost-audit.md records the CLI advertising while the code
|
|
143
|
-
* charged nothing at all. It is now a flat fee, billed in credits like every
|
|
144
|
-
* other driver, and this constant is held equal to the meter by
|
|
145
|
-
* packages/api/src/__tests__/credit-price-parity.test.ts.
|
|
146
|
-
*/
|
|
147
|
-
export const REFRAME_FEE_CREDITS = 4;
|
|
148
|
-
//# sourceMappingURL=pricing.js.map
|
package/dist/lib/pricing.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../src/lib/pricing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,GAAG;IACd,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,GAAG;IAClB,gBAAgB,EAAE,CAAC;IACnB,kBAAkB,EAAE,GAAG;IACvB,UAAU,EAAE,IAAI;IAChB,eAAe,EAAE,GAAG;IACpB,gBAAgB,EAAE,MAAM;IACxB,qBAAqB,EAAE,EAAE;IACzB,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,GAAG;IAChB,mBAAmB,EAAE,CAAC;CACd,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,kBAAkB,EAAE,CAAC;IACrB,sBAAsB,EAAE,GAAG;IAC3B,qBAAqB,EAAE,IAAI;IAC3B,yBAAyB,EAAE,GAAG;IAC9B,oBAAoB,EAAE,GAAG;IACzB,gBAAgB,EAAE,EAAE;IACpB,eAAe,EAAE,IAAI;IACrB,WAAW,EAAE,GAAG;IAChB,iBAAiB,EAAE,EAAE;IACrB,mBAAmB,EAAE,GAAG;IACxB,uBAAuB,EAAE,GAAG;IAC5B,iBAAiB,EAAE,IAAI;IACvB,qBAAqB,EAAE,IAAI;IAC3B,kBAAkB,EAAE,IAAI;IACxB,cAAc,EAAE,IAAI;IACpB,cAAc,EAAE,IAAI;IACpB,iBAAiB,EAAE,CAAC;IACpB,sBAAsB,EAAE,IAAI;IAC5B,0BAA0B,EAAE,IAAI;IAChC,6BAA6B,EAAE,CAAC;IAChC,6BAA6B,EAAE,GAAG;IAClC,oBAAoB,EAAE,GAAG;IACzB,wBAAwB,EAAE,IAAI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G,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3F,OAAO,KAAK,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,OAAO,GAAG,KAAK,EAAE,CAAC;AACrD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `naive init` starter, extracted so the suite can compile it with the real
|
|
3
|
-
* DSL instead of asserting on substrings of a template literal.
|
|
4
|
-
*
|
|
5
|
-
* CONTENT IS MAIN'S, NOT THIS BRANCH'S. The extraction is this branch's idea and
|
|
6
|
-
* is kept; the template it originally carried scaffolded the RETIRED surface
|
|
7
|
-
* (`defineConfig` + `system(...)` + `business`/`identity`). Landing that would
|
|
8
|
-
* have made `naive init` — the first command a new user runs — emit a config
|
|
9
|
-
* against a deprecated API, which is a worse regression than the refactor is an
|
|
10
|
-
* improvement. The body below is the `defineProject`/`kit`/`team` starter from
|
|
11
|
-
* main, verbatim.
|
|
12
|
-
*/
|
|
13
|
-
export declare const STARTER_CONFIG = "import { defineProject, cloud, agent, kit, runtime, team, skills } from \"@usenaive-sdk/iac\";\n\n// Na\u00EFve gives every agent its own governed, real-world identity. Declare the\n// project's shared infrastructure ONCE, then your teams. Run `naive up` to\n// plan and apply. `defineProject` is STRICT: a field nothing consumes is a\n// named refusal at define time, never a green apply that enforces nothing.\nexport default defineProject({\n project: \"my-project\",\n\n // \u2500\u2500 infrastructure: set up ONCE for the whole project \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Cloud \u2014 one instance, shared by everyone. Na\u00EFve injects the secrets\n // (database URL, storage credentials\u2026) into your runtime automatically.\n infrastructure: {\n cloud: {\n website: cloud.web({ framework: \"nextjs\", dir: \".\" }),\n database: cloud.postgres({ size: \"serverless\" }),\n },\n },\n\n // \u2500\u2500 kits: roles declared now, instantiated later \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // `naive up` registers each kit; nothing runs until you stamp an instance\n // for one child project from your own code:\n // await naive.forProject(\"my-project\").forChild(childId).provision(\"sdr\");\n kits: {\n sdr: kit({\n instructions: \"Research prospects and draft outreach for one customer.\",\n can: [skills.search, skills.email],\n }),\n },\n\n // \u2500\u2500 teams: N agents behind one lead \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // `naive up` materializes each team's agents and places the team.\n // `runtime.durable()` is the current lane and it is LIVE: production has\n // VETTA_CONTROL_URL and both cutover prerequisites signed off, so this team\n // places for real. Export NAIVE_DURABLE_CREDENTIAL_SUPPORT before your first\n // `naive up` \u2014 without it the team alone comes back\n // `runtime_credential_required` while the rest of the config applies. The\n // line is written out even though `team()` defaults to the same value: you\n // should be able to read which runtime you are on without knowing the default.\n // On a deployment that has no durable runtime, change it to runtime.hermes().\n teams: {\n support: team({\n runtime: runtime.durable(),\n lead: agent({\n instructions: \"You run the support team. Triage incoming work and delegate.\",\n can: [skills.search, skills.llm],\n }),\n agents: {\n triage: agent({\n instructions: \"Answer support questions. Escalate anything you cannot resolve.\",\n can: [skills.search, skills.llm],\n }),\n },\n edges: [[\"lead\", \"triage\"]],\n }),\n },\n});\n";
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `naive init` starter, extracted so the suite can compile it with the real
|
|
3
|
-
* DSL instead of asserting on substrings of a template literal.
|
|
4
|
-
*
|
|
5
|
-
* CONTENT IS MAIN'S, NOT THIS BRANCH'S. The extraction is this branch's idea and
|
|
6
|
-
* is kept; the template it originally carried scaffolded the RETIRED surface
|
|
7
|
-
* (`defineConfig` + `system(...)` + `business`/`identity`). Landing that would
|
|
8
|
-
* have made `naive init` — the first command a new user runs — emit a config
|
|
9
|
-
* against a deprecated API, which is a worse regression than the refactor is an
|
|
10
|
-
* improvement. The body below is the `defineProject`/`kit`/`team` starter from
|
|
11
|
-
* main, verbatim.
|
|
12
|
-
*/
|
|
13
|
-
export const STARTER_CONFIG = `import { defineProject, cloud, agent, kit, runtime, team, skills } from "@usenaive-sdk/iac";
|
|
14
|
-
|
|
15
|
-
// Naïve gives every agent its own governed, real-world identity. Declare the
|
|
16
|
-
// project's shared infrastructure ONCE, then your teams. Run \`naive up\` to
|
|
17
|
-
// plan and apply. \`defineProject\` is STRICT: a field nothing consumes is a
|
|
18
|
-
// named refusal at define time, never a green apply that enforces nothing.
|
|
19
|
-
export default defineProject({
|
|
20
|
-
project: "my-project",
|
|
21
|
-
|
|
22
|
-
// ── infrastructure: set up ONCE for the whole project ────────────────────
|
|
23
|
-
// Cloud — one instance, shared by everyone. Naïve injects the secrets
|
|
24
|
-
// (database URL, storage credentials…) into your runtime automatically.
|
|
25
|
-
infrastructure: {
|
|
26
|
-
cloud: {
|
|
27
|
-
website: cloud.web({ framework: "nextjs", dir: "." }),
|
|
28
|
-
database: cloud.postgres({ size: "serverless" }),
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
// ── kits: roles declared now, instantiated later ──────────────────────────
|
|
33
|
-
// \`naive up\` registers each kit; nothing runs until you stamp an instance
|
|
34
|
-
// for one child project from your own code:
|
|
35
|
-
// await naive.forProject("my-project").forChild(childId).provision("sdr");
|
|
36
|
-
kits: {
|
|
37
|
-
sdr: kit({
|
|
38
|
-
instructions: "Research prospects and draft outreach for one customer.",
|
|
39
|
-
can: [skills.search, skills.email],
|
|
40
|
-
}),
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
// ── teams: N agents behind one lead ──────────────────────────────────────
|
|
44
|
-
// \`naive up\` materializes each team's agents and places the team.
|
|
45
|
-
// \`runtime.durable()\` is the current lane and it is LIVE: production has
|
|
46
|
-
// VETTA_CONTROL_URL and both cutover prerequisites signed off, so this team
|
|
47
|
-
// places for real. Export NAIVE_DURABLE_CREDENTIAL_SUPPORT before your first
|
|
48
|
-
// \`naive up\` — without it the team alone comes back
|
|
49
|
-
// \`runtime_credential_required\` while the rest of the config applies. The
|
|
50
|
-
// line is written out even though \`team()\` defaults to the same value: you
|
|
51
|
-
// should be able to read which runtime you are on without knowing the default.
|
|
52
|
-
// On a deployment that has no durable runtime, change it to runtime.hermes().
|
|
53
|
-
teams: {
|
|
54
|
-
support: team({
|
|
55
|
-
runtime: runtime.durable(),
|
|
56
|
-
lead: agent({
|
|
57
|
-
instructions: "You run the support team. Triage incoming work and delegate.",
|
|
58
|
-
can: [skills.search, skills.llm],
|
|
59
|
-
}),
|
|
60
|
-
agents: {
|
|
61
|
-
triage: agent({
|
|
62
|
-
instructions: "Answer support questions. Escalate anything you cannot resolve.",
|
|
63
|
-
can: [skills.search, skills.llm],
|
|
64
|
-
}),
|
|
65
|
-
},
|
|
66
|
-
edges: [["lead", "triage"]],
|
|
67
|
-
}),
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
`;
|
|
71
|
-
//# sourceMappingURL=starter-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"starter-config.js","sourceRoot":"","sources":["../../src/lib/starter-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyD7B,CAAC"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `naive teams watch` — the pure half (06 §1.6).
|
|
3
|
-
*
|
|
4
|
-
* Everything here is a function of its input, so the framing, the resume
|
|
5
|
-
* position, the redaction and the termination rule are tests rather than
|
|
6
|
-
* behaviour you have to run a server to observe.
|
|
7
|
-
*
|
|
8
|
-
* THE OUTPUT IS NDJSON, ONE OBJECT PER LINE — not a JSON array. A stream has no
|
|
9
|
-
* closing bracket, so an array can only be completed by a client that already
|
|
10
|
-
* knows the stream ended, which is the one thing a consumer of a live stream
|
|
11
|
-
* does not know.
|
|
12
|
-
*
|
|
13
|
-
* TERMINATION IS `{"type":"stream.end"}` WITH A REASON, NEVER `[DONE]`. That
|
|
14
|
-
* token belongs to the OpenAI-compatible lane; reusing it here would make one
|
|
15
|
-
* word mean two protocols.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Secrets that must never reach a transcript.
|
|
19
|
-
*
|
|
20
|
-
* `nv_sk_…` is the platform api key — the same shape `output.ts` already guards
|
|
21
|
-
* in `next_steps`. `vt_<company>_<hex>` is the per-team runtime credential, which
|
|
22
|
-
* `output.ts` has never seen because nothing else prints one. A transcript prints
|
|
23
|
-
* TOOL ARGUMENTS, so it is the one surface where either can arrive inside an
|
|
24
|
-
* arbitrary payload rather than in a field with a known name.
|
|
25
|
-
*/
|
|
26
|
-
export declare const SECRET_PATTERNS: readonly RegExp[];
|
|
27
|
-
/**
|
|
28
|
-
* Redact a decoded frame in place-free fashion.
|
|
29
|
-
*
|
|
30
|
-
* `showArgs` is false by default and the frame's `args` are replaced by whatever
|
|
31
|
-
* `args_digest` the server sent. That is the honest default: a digest still lets
|
|
32
|
-
* a reader correlate two frames, and it cannot leak a value nobody audited.
|
|
33
|
-
* `commands/teams.ts` additionally refuses `--show-args` outside an interactive
|
|
34
|
-
* terminal, so a pipe or a CI job cannot turn it on.
|
|
35
|
-
*/
|
|
36
|
-
export declare function redactFrame(frame: unknown, opts: {
|
|
37
|
-
showArgs: boolean;
|
|
38
|
-
}): unknown;
|
|
39
|
-
export interface SseEvent {
|
|
40
|
-
/** The `id:` field, which is what a resume sends back as `Last-Event-ID`. */
|
|
41
|
-
readonly id?: string;
|
|
42
|
-
/** The concatenated `data:` lines. */
|
|
43
|
-
readonly data: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Split a buffer into complete SSE events, returning the unconsumed tail.
|
|
47
|
-
*
|
|
48
|
-
* The tail matters: a chunk boundary lands mid-event far more often than test
|
|
49
|
-
* fixtures suggest, and a parser that discards a partial event drops exactly the
|
|
50
|
-
* frames that arrive under load.
|
|
51
|
-
*/
|
|
52
|
-
export declare function parseSse(buffer: string): {
|
|
53
|
-
events: SseEvent[];
|
|
54
|
-
rest: string;
|
|
55
|
-
};
|
|
56
|
-
/** The terminal states that are NOT success. `unverified` is the reason exit 3
|
|
57
|
-
* exists at all: a CI script reading exit 0 as "the work is done" would count an
|
|
58
|
-
* unattested task as a pass. */
|
|
59
|
-
export declare const NON_SUCCESS_TERMINAL: readonly ["unverified", "failed", "blocked"];
|
|
60
|
-
export type StreamEndReason = "run_terminal" | "client_closed" | "timeout" | "fence_closed";
|
|
61
|
-
/**
|
|
62
|
-
* The exit code for a finished stream. `--fail-on-terminal` is opt-in because
|
|
63
|
-
* changing the exit code of an existing command is a wire break; without it a
|
|
64
|
-
* watch always exits 0 and the caller reads `status` itself.
|
|
65
|
-
*/
|
|
66
|
-
export declare function watchExitCode(finalStatus: string | undefined, failOnTerminal: boolean): 0 | 3;
|
|
67
|
-
/**
|
|
68
|
-
* One board card, in the three fields this gate is allowed to read.
|
|
69
|
-
*
|
|
70
|
-
* Deliberately structural and deliberately narrow: `extractCards` hands over
|
|
71
|
-
* whatever the wire said, and a gate that reads more of a card than it needs is
|
|
72
|
-
* a gate that breaks when an unrelated field is renamed.
|
|
73
|
-
*/
|
|
74
|
-
export type GateCard = {
|
|
75
|
-
status?: string;
|
|
76
|
-
/** `durableCard`: naive adjudicated and the verdict never reached the runtime. */
|
|
77
|
-
verdict_delivery_failed?: unknown;
|
|
78
|
-
/** `durableCard`: naive granted a terminal the runtime does not hold. */
|
|
79
|
-
boards_disagree?: unknown;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Is this card's verification state anything other than SETTLED AND AGREED?
|
|
83
|
-
*
|
|
84
|
-
* 🔴 A CARD THE TWO BOARDS DISAGREE ABOUT IS NOT A VERIFIED CARD, and this gate
|
|
85
|
-
* used to say it was. It read one field -- `status === "unverified"` -- and the
|
|
86
|
-
* durable lane has two more that mean the verification did not conclude:
|
|
87
|
-
*
|
|
88
|
-
* - `verdict_delivery_failed`. naive REJECTED the card and the verdict did not
|
|
89
|
-
* reach the runtime, so the runtime still holds its own terminal. The board
|
|
90
|
-
* row carries the failure and says, in its own `meaning` field, that "the two
|
|
91
|
-
* boards disagree about it".
|
|
92
|
-
* - `boards_disagree`. naive granted a terminal the runtime does not hold, with
|
|
93
|
-
* no delivery to fail -- an accept is written on naive's own row and is never
|
|
94
|
-
* delivered, so this is the ONLY signal that case has. Its own text calls it
|
|
95
|
-
* "the disagreement that bills for work the runtime says did not finish".
|
|
96
|
-
*
|
|
97
|
-
* Measured on staging: card A carried `verdict_delivery_failed` and
|
|
98
|
-
* `naive teams tasks … --fail-on-unverified` exited 0 on it. A CI job reading
|
|
99
|
-
* that exit code as "attested" is the exact failure this flag exists to prevent,
|
|
100
|
-
* and the file's own history records it happening once already through a
|
|
101
|
-
* different field (see `extractCards`).
|
|
102
|
-
*
|
|
103
|
-
* PRESENCE, not shape. Both fields are objects the server composes and neither is
|
|
104
|
-
* ever emitted as a negative -- `durableCard` omits them entirely for a card with
|
|
105
|
-
* nothing to report -- so asking whether one is there is the whole test, and it
|
|
106
|
-
* cannot go stale when their contents change.
|
|
107
|
-
*/
|
|
108
|
-
export declare function cardIsUnverified(card: GateCard): boolean;
|
|
109
|
-
/** The same rule for a single board card, used by `tasks`/`task --fail-on-unverified`. */
|
|
110
|
-
export declare function unverifiedExitCode(cards: readonly GateCard[], failOnUnverified: boolean): 0 | 3;
|
|
111
|
-
/** The highest `seq` printed so far — the position a reconnect resumes from.
|
|
112
|
-
* `sequence >` is strict on the server, so nothing is lost and nothing is
|
|
113
|
-
* duplicated. */
|
|
114
|
-
export declare function highestSeq(current: number | undefined, frame: unknown): number | undefined;
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `naive teams watch` — the pure half (06 §1.6).
|
|
3
|
-
*
|
|
4
|
-
* Everything here is a function of its input, so the framing, the resume
|
|
5
|
-
* position, the redaction and the termination rule are tests rather than
|
|
6
|
-
* behaviour you have to run a server to observe.
|
|
7
|
-
*
|
|
8
|
-
* THE OUTPUT IS NDJSON, ONE OBJECT PER LINE — not a JSON array. A stream has no
|
|
9
|
-
* closing bracket, so an array can only be completed by a client that already
|
|
10
|
-
* knows the stream ended, which is the one thing a consumer of a live stream
|
|
11
|
-
* does not know.
|
|
12
|
-
*
|
|
13
|
-
* TERMINATION IS `{"type":"stream.end"}` WITH A REASON, NEVER `[DONE]`. That
|
|
14
|
-
* token belongs to the OpenAI-compatible lane; reusing it here would make one
|
|
15
|
-
* word mean two protocols.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Secrets that must never reach a transcript.
|
|
19
|
-
*
|
|
20
|
-
* `nv_sk_…` is the platform api key — the same shape `output.ts` already guards
|
|
21
|
-
* in `next_steps`. `vt_<company>_<hex>` is the per-team runtime credential, which
|
|
22
|
-
* `output.ts` has never seen because nothing else prints one. A transcript prints
|
|
23
|
-
* TOOL ARGUMENTS, so it is the one surface where either can arrive inside an
|
|
24
|
-
* arbitrary payload rather than in a field with a known name.
|
|
25
|
-
*/
|
|
26
|
-
export const SECRET_PATTERNS = [
|
|
27
|
-
/nv_sk_[A-Za-z0-9_-]+/g,
|
|
28
|
-
/vt_[A-Za-z0-9-]+_[A-Fa-f0-9]{8,}/g,
|
|
29
|
-
];
|
|
30
|
-
/** Field names whose VALUE is a secret whatever it looks like. */
|
|
31
|
-
const SECRET_FIELDS = new Set(["api_key", "session_token", "token", "credential", "secret"]);
|
|
32
|
-
const REDACTED = "[redacted]";
|
|
33
|
-
function scrubString(s) {
|
|
34
|
-
let out = s;
|
|
35
|
-
for (const re of SECRET_PATTERNS)
|
|
36
|
-
out = out.replace(new RegExp(re.source, re.flags), REDACTED);
|
|
37
|
-
return out;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Redact a decoded frame in place-free fashion.
|
|
41
|
-
*
|
|
42
|
-
* `showArgs` is false by default and the frame's `args` are replaced by whatever
|
|
43
|
-
* `args_digest` the server sent. That is the honest default: a digest still lets
|
|
44
|
-
* a reader correlate two frames, and it cannot leak a value nobody audited.
|
|
45
|
-
* `commands/teams.ts` additionally refuses `--show-args` outside an interactive
|
|
46
|
-
* terminal, so a pipe or a CI job cannot turn it on.
|
|
47
|
-
*/
|
|
48
|
-
export function redactFrame(frame, opts) {
|
|
49
|
-
const seen = new WeakSet();
|
|
50
|
-
const walk = (v, key) => {
|
|
51
|
-
if (typeof v === "string") {
|
|
52
|
-
if (key !== undefined && SECRET_FIELDS.has(key))
|
|
53
|
-
return REDACTED;
|
|
54
|
-
return scrubString(v);
|
|
55
|
-
}
|
|
56
|
-
if (Array.isArray(v))
|
|
57
|
-
return v.map((e) => walk(e));
|
|
58
|
-
if (typeof v === "object" && v !== null) {
|
|
59
|
-
if (seen.has(v))
|
|
60
|
-
return "[circular]";
|
|
61
|
-
seen.add(v);
|
|
62
|
-
const out = {};
|
|
63
|
-
for (const [k, val] of Object.entries(v)) {
|
|
64
|
-
if (k === "args" && !opts.showArgs) {
|
|
65
|
-
out.args = REDACTED;
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
out[k] = walk(val, k);
|
|
69
|
-
}
|
|
70
|
-
return out;
|
|
71
|
-
}
|
|
72
|
-
return v;
|
|
73
|
-
};
|
|
74
|
-
return walk(frame);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Split a buffer into complete SSE events, returning the unconsumed tail.
|
|
78
|
-
*
|
|
79
|
-
* The tail matters: a chunk boundary lands mid-event far more often than test
|
|
80
|
-
* fixtures suggest, and a parser that discards a partial event drops exactly the
|
|
81
|
-
* frames that arrive under load.
|
|
82
|
-
*/
|
|
83
|
-
export function parseSse(buffer) {
|
|
84
|
-
const events = [];
|
|
85
|
-
// An event ends at a blank line. \r\n is legal per the spec and some proxies
|
|
86
|
-
// rewrite line endings, so both are accepted.
|
|
87
|
-
const parts = buffer.split(/\r?\n\r?\n/);
|
|
88
|
-
const rest = parts.pop() ?? "";
|
|
89
|
-
for (const block of parts) {
|
|
90
|
-
let id;
|
|
91
|
-
const data = [];
|
|
92
|
-
for (const line of block.split(/\r?\n/)) {
|
|
93
|
-
if (line.startsWith(":"))
|
|
94
|
-
continue; // a comment / keep-alive
|
|
95
|
-
const colon = line.indexOf(":");
|
|
96
|
-
const field = colon === -1 ? line : line.slice(0, colon);
|
|
97
|
-
const value = colon === -1 ? "" : line.slice(colon + 1).replace(/^ /, "");
|
|
98
|
-
if (field === "data")
|
|
99
|
-
data.push(value);
|
|
100
|
-
else if (field === "id")
|
|
101
|
-
id = value;
|
|
102
|
-
}
|
|
103
|
-
if (data.length > 0)
|
|
104
|
-
events.push({ ...(id !== undefined && { id }), data: data.join("\n") });
|
|
105
|
-
}
|
|
106
|
-
return { events, rest };
|
|
107
|
-
}
|
|
108
|
-
/** The terminal states that are NOT success. `unverified` is the reason exit 3
|
|
109
|
-
* exists at all: a CI script reading exit 0 as "the work is done" would count an
|
|
110
|
-
* unattested task as a pass. */
|
|
111
|
-
export const NON_SUCCESS_TERMINAL = ["unverified", "failed", "blocked"];
|
|
112
|
-
/**
|
|
113
|
-
* The exit code for a finished stream. `--fail-on-terminal` is opt-in because
|
|
114
|
-
* changing the exit code of an existing command is a wire break; without it a
|
|
115
|
-
* watch always exits 0 and the caller reads `status` itself.
|
|
116
|
-
*/
|
|
117
|
-
export function watchExitCode(finalStatus, failOnTerminal) {
|
|
118
|
-
if (!failOnTerminal || finalStatus === undefined)
|
|
119
|
-
return 0;
|
|
120
|
-
return NON_SUCCESS_TERMINAL.includes(finalStatus) ? 3 : 0;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Is this card's verification state anything other than SETTLED AND AGREED?
|
|
124
|
-
*
|
|
125
|
-
* 🔴 A CARD THE TWO BOARDS DISAGREE ABOUT IS NOT A VERIFIED CARD, and this gate
|
|
126
|
-
* used to say it was. It read one field -- `status === "unverified"` -- and the
|
|
127
|
-
* durable lane has two more that mean the verification did not conclude:
|
|
128
|
-
*
|
|
129
|
-
* - `verdict_delivery_failed`. naive REJECTED the card and the verdict did not
|
|
130
|
-
* reach the runtime, so the runtime still holds its own terminal. The board
|
|
131
|
-
* row carries the failure and says, in its own `meaning` field, that "the two
|
|
132
|
-
* boards disagree about it".
|
|
133
|
-
* - `boards_disagree`. naive granted a terminal the runtime does not hold, with
|
|
134
|
-
* no delivery to fail -- an accept is written on naive's own row and is never
|
|
135
|
-
* delivered, so this is the ONLY signal that case has. Its own text calls it
|
|
136
|
-
* "the disagreement that bills for work the runtime says did not finish".
|
|
137
|
-
*
|
|
138
|
-
* Measured on staging: card A carried `verdict_delivery_failed` and
|
|
139
|
-
* `naive teams tasks … --fail-on-unverified` exited 0 on it. A CI job reading
|
|
140
|
-
* that exit code as "attested" is the exact failure this flag exists to prevent,
|
|
141
|
-
* and the file's own history records it happening once already through a
|
|
142
|
-
* different field (see `extractCards`).
|
|
143
|
-
*
|
|
144
|
-
* PRESENCE, not shape. Both fields are objects the server composes and neither is
|
|
145
|
-
* ever emitted as a negative -- `durableCard` omits them entirely for a card with
|
|
146
|
-
* nothing to report -- so asking whether one is there is the whole test, and it
|
|
147
|
-
* cannot go stale when their contents change.
|
|
148
|
-
*/
|
|
149
|
-
export function cardIsUnverified(card) {
|
|
150
|
-
return (card.status === "unverified" ||
|
|
151
|
-
card.verdict_delivery_failed != null ||
|
|
152
|
-
card.boards_disagree != null);
|
|
153
|
-
}
|
|
154
|
-
/** The same rule for a single board card, used by `tasks`/`task --fail-on-unverified`. */
|
|
155
|
-
export function unverifiedExitCode(cards, failOnUnverified) {
|
|
156
|
-
if (!failOnUnverified)
|
|
157
|
-
return 0;
|
|
158
|
-
return cards.some(cardIsUnverified) ? 3 : 0;
|
|
159
|
-
}
|
|
160
|
-
/** The highest `seq` printed so far — the position a reconnect resumes from.
|
|
161
|
-
* `sequence >` is strict on the server, so nothing is lost and nothing is
|
|
162
|
-
* duplicated. */
|
|
163
|
-
export function highestSeq(current, frame) {
|
|
164
|
-
const seq = frame?.seq;
|
|
165
|
-
if (typeof seq !== "number" || !Number.isFinite(seq))
|
|
166
|
-
return current;
|
|
167
|
-
return current === undefined || seq > current ? seq : current;
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=stream-frames.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream-frames.js","sourceRoot":"","sources":["../../src/lib/stream-frames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,uBAAuB;IACvB,mCAAmC;CACpC,CAAC;AAEF,kEAAkE;AAClE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE7F,MAAM,QAAQ,GAAG,YAAY,CAAC;AAE9B,SAAS,WAAW,CAAC,CAAS;IAC5B,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,MAAM,EAAE,IAAI,eAAe;QAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,QAAQ,CAA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