scaledthought 0.3.3 → 0.3.5
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 +4 -1
- package/dist/index.js +550 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,9 @@ account could be sent: a `us` account that signed up with an ad click and hasn't
|
|
|
36
36
|
`ad_measurement_opt_out` (the stored preference). Neither flag is a secret.
|
|
37
37
|
|
|
38
38
|
Inference is prepaid, and a new account has no credits: until your human pays, completions return
|
|
39
|
-
`402 insufficient_credits`.
|
|
39
|
+
`402 insufficient_credits`. (Only when `init` prints `"trial": "after_email_confirmation"`: the account should get
|
|
40
|
+
limited usage to try it once your human confirms their email, in the US region while that offer lasts; its `next_steps`
|
|
41
|
+
say what to do. Otherwise, or once that is used, top up as below.) So the first thing after `init` is usually a top-up your human approves:
|
|
40
42
|
|
|
41
43
|
```bash
|
|
42
44
|
npx -y scaledthought@0.3 billing topup --amount-usd 20 # prints approval_url and topup_id
|
|
@@ -54,6 +56,7 @@ npx -y scaledthought@0.3 chat -m <id> "Reply with OK" # one real completion (an
|
|
|
54
56
|
npx -y scaledthought@0.3 mcp # `claude mcp add …` command + JSON config
|
|
55
57
|
npx -y scaledthought@0.3 account # plan, region, spend, owner_email
|
|
56
58
|
npx -y scaledthought@0.3 account email set <address> # your human's email owns the account once they confirm
|
|
59
|
+
npx -y scaledthought@0.3 account rename "<name>" # the account's name on the dashboard ("" = the default)
|
|
57
60
|
npx -y scaledthought@0.3 account ad-measurement off # opt out of ad measurement
|
|
58
61
|
```
|
|
59
62
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.js
|
|
18
|
+
var exports_iso = {};
|
|
19
|
+
__export(exports_iso, {
|
|
20
|
+
ZodISODate: () => ZodISODate,
|
|
21
|
+
ZodISODateTime: () => ZodISODateTime,
|
|
22
|
+
ZodISODuration: () => ZodISODuration,
|
|
23
|
+
ZodISOTime: () => ZodISOTime,
|
|
24
|
+
date: () => date2,
|
|
25
|
+
datetime: () => datetime2,
|
|
26
|
+
duration: () => duration2,
|
|
27
|
+
time: () => time2
|
|
28
|
+
});
|
|
29
|
+
|
|
2
30
|
// ../../node_modules/.pnpm/citty@0.2.2/node_modules/citty/dist/_chunks/libs/scule.mjs
|
|
3
31
|
var NUMBER_CHAR_RE = /\d/;
|
|
4
32
|
var STR_SPLITTERS = [
|
|
@@ -553,7 +581,7 @@ import { join } from "node:path";
|
|
|
553
581
|
// package.json
|
|
554
582
|
var package_default = {
|
|
555
583
|
name: "scaledthought",
|
|
556
|
-
version: "0.3.
|
|
584
|
+
version: "0.3.5",
|
|
557
585
|
description: "OpenAI-compatible inference for open-weight models, set up by your coding agent. Prepaid, pay per token, no subscription. US live; Canada coming soon.",
|
|
558
586
|
license: "MIT",
|
|
559
587
|
keywords: [
|
|
@@ -696,6 +724,7 @@ var HINTS = {
|
|
|
696
724
|
network_error: "Could not reach the API. Check the network (and ST_API_URL / ST_BASE_URL if set). Safe to retry.",
|
|
697
725
|
bad_region: "Use --region us or --region ca.",
|
|
698
726
|
confirmation_mismatch: "Pass your own account id: `account delete --confirm <account_id>` (see `account`).",
|
|
727
|
+
signup_rate_limited: "Don't create another account. Reuse an existing account's key, or have your human buy credits on one (`billing topup`) or sign in to its dashboard. If the error has retry_after, you may retry after that many seconds.",
|
|
699
728
|
region_not_open: "This region doesn't take new accounts yet. Run `init --region us` for a US account, or check scaledthought.com.",
|
|
700
729
|
bad_argument: "Pass a positive number.",
|
|
701
730
|
usage_error: "Run the command with --help for its flags."
|
|
@@ -6825,6 +6854,19 @@ function refine(fn, _params = {}) {
|
|
|
6825
6854
|
function superRefine(fn, params) {
|
|
6826
6855
|
return _superRefine(fn, params);
|
|
6827
6856
|
}
|
|
6857
|
+
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.js
|
|
6858
|
+
function datetime2(params) {
|
|
6859
|
+
return _isoDateTime(ZodISODateTime, params);
|
|
6860
|
+
}
|
|
6861
|
+
function date2(params) {
|
|
6862
|
+
return _isoDate(ZodISODate, params);
|
|
6863
|
+
}
|
|
6864
|
+
function time2(params) {
|
|
6865
|
+
return _isoTime(ZodISOTime, params);
|
|
6866
|
+
}
|
|
6867
|
+
function duration2(params) {
|
|
6868
|
+
return _isoDuration(ZodISODuration, params);
|
|
6869
|
+
}
|
|
6828
6870
|
// ../../packages/growth/src/codes.ts
|
|
6829
6871
|
var CODE_RE = /^[a-z0-9]{1,3}(-[a-z0-9]{1,12}){1,2}$/;
|
|
6830
6872
|
function normalizeCode(raw) {
|
|
@@ -6847,6 +6889,7 @@ var CHANNELS = [
|
|
|
6847
6889
|
"organic"
|
|
6848
6890
|
];
|
|
6849
6891
|
var Channel = _enum(CHANNELS);
|
|
6892
|
+
var SITE_ORIGIN = "https://scaledthought.com";
|
|
6850
6893
|
|
|
6851
6894
|
// ../../packages/growth/src/ad-click.ts
|
|
6852
6895
|
var AD_CLICK_PLATFORMS = ["google", "reddit", "x", "microsoft"];
|
|
@@ -7972,6 +8015,171 @@ var AD_WRITE_CREDENTIAL_ENV = {
|
|
|
7972
8015
|
microsoft: "AD_WRITE_MICROSOFT_CREDENTIALS"
|
|
7973
8016
|
};
|
|
7974
8017
|
var AD_WRITE_CREDENTIAL_ENV_NAMES = Object.values(AD_WRITE_CREDENTIAL_ENV);
|
|
8018
|
+
// ../../packages/growth/src/campaign-google.ts
|
|
8019
|
+
var CAMPAIGN_CHANNELS = ["search", "display"];
|
|
8020
|
+
var GOOGLE_ASSET_LIMITS = {
|
|
8021
|
+
callout: 25,
|
|
8022
|
+
callouts: 20,
|
|
8023
|
+
sitelinkText: 25,
|
|
8024
|
+
sitelinkLine: 35,
|
|
8025
|
+
sitelinks: 20,
|
|
8026
|
+
snippetValue: 25,
|
|
8027
|
+
snippetValuesMin: 3,
|
|
8028
|
+
snippetValuesMax: 10,
|
|
8029
|
+
snippets: 10,
|
|
8030
|
+
businessName: 25,
|
|
8031
|
+
images: 20,
|
|
8032
|
+
customAudiences: 10,
|
|
8033
|
+
audienceMembers: 200,
|
|
8034
|
+
audienceKeyword: 80,
|
|
8035
|
+
exclusions: 5000
|
|
8036
|
+
};
|
|
8037
|
+
var CENT_MICROS = 1e4;
|
|
8038
|
+
var MAX_BID_MICROS = 1e8;
|
|
8039
|
+
var Line = (max, what) => string2().trim().min(1).refine((s) => [...s].length <= max, `${what}: at most ${max} characters`);
|
|
8040
|
+
var BidMicros = number2().int().positive().max(MAX_BID_MICROS).refine((n) => n % CENT_MICROS === 0, "whole cents (a multiple of 10,000 micros)");
|
|
8041
|
+
var CampaignBidding = discriminatedUnion("strategy", [
|
|
8042
|
+
object({ strategy: literal("maximize_clicks"), max_cpc_micros: BidMicros.nullable().default(null) }).strict(),
|
|
8043
|
+
object({ strategy: literal("maximize_conversions"), target_cpa_micros: BidMicros.nullable().default(null) }).strict(),
|
|
8044
|
+
object({ strategy: literal("manual_cpc"), default_cpc_micros: BidMicros }).strict()
|
|
8045
|
+
]);
|
|
8046
|
+
var DeviceAdjustment = number2().int().refine((n) => n === -100 || n >= -90 && n <= 900, "−100 (excluded) or −90 … +900 percent");
|
|
8047
|
+
var CampaignDevices = object({
|
|
8048
|
+
desktop: DeviceAdjustment.default(0),
|
|
8049
|
+
mobile: DeviceAdjustment.default(0),
|
|
8050
|
+
tablet: DeviceAdjustment.default(0),
|
|
8051
|
+
tv: DeviceAdjustment.default(0)
|
|
8052
|
+
}).strict();
|
|
8053
|
+
var noDeviceAdjustments = () => ({ desktop: 0, mobile: 0, tablet: 0, tv: 0 });
|
|
8054
|
+
var SiteUrl = string2().trim().max(200).refine((s) => {
|
|
8055
|
+
if (!s.startsWith(`${SITE_ORIGIN}/`) && s !== SITE_ORIGIN)
|
|
8056
|
+
return false;
|
|
8057
|
+
try {
|
|
8058
|
+
const u = new URL(s);
|
|
8059
|
+
return u.origin === SITE_ORIGIN && !u.search && !u.hash && !u.username && !u.password;
|
|
8060
|
+
} catch {
|
|
8061
|
+
return false;
|
|
8062
|
+
}
|
|
8063
|
+
}, `a page on ${SITE_ORIGIN} (https, no query string or fragment)`);
|
|
8064
|
+
var Sitelink = object({
|
|
8065
|
+
text: Line(GOOGLE_ASSET_LIMITS.sitelinkText, "sitelink text"),
|
|
8066
|
+
line1: Line(GOOGLE_ASSET_LIMITS.sitelinkLine, "sitelink line").nullable().default(null),
|
|
8067
|
+
line2: Line(GOOGLE_ASSET_LIMITS.sitelinkLine, "sitelink line").nullable().default(null),
|
|
8068
|
+
final_url: SiteUrl
|
|
8069
|
+
}).strict().refine((s) => s.line1 == null === (s.line2 == null), "sitelink lines: both or neither");
|
|
8070
|
+
var SNIPPET_HEADERS = [
|
|
8071
|
+
"Amenities",
|
|
8072
|
+
"Brands",
|
|
8073
|
+
"Courses",
|
|
8074
|
+
"Degree programs",
|
|
8075
|
+
"Destinations",
|
|
8076
|
+
"Featured hotels",
|
|
8077
|
+
"Insurance coverage",
|
|
8078
|
+
"Models",
|
|
8079
|
+
"Neighborhoods",
|
|
8080
|
+
"Service catalog",
|
|
8081
|
+
"Shows",
|
|
8082
|
+
"Styles",
|
|
8083
|
+
"Types"
|
|
8084
|
+
];
|
|
8085
|
+
var StructuredSnippet = object({
|
|
8086
|
+
header: _enum(SNIPPET_HEADERS),
|
|
8087
|
+
values: array(Line(GOOGLE_ASSET_LIMITS.snippetValue, "snippet value")).min(GOOGLE_ASSET_LIMITS.snippetValuesMin).max(GOOGLE_ASSET_LIMITS.snippetValuesMax)
|
|
8088
|
+
}).strict();
|
|
8089
|
+
var AssetId = string2().regex(/^\d{1,20}$/, "a Google Ads asset id");
|
|
8090
|
+
var emptyAssets = () => ({
|
|
8091
|
+
callouts: [],
|
|
8092
|
+
sitelinks: [],
|
|
8093
|
+
structured_snippets: [],
|
|
8094
|
+
business_name: null,
|
|
8095
|
+
logo_asset_id: null,
|
|
8096
|
+
image_asset_ids: []
|
|
8097
|
+
});
|
|
8098
|
+
var CampaignAssets = object({
|
|
8099
|
+
callouts: array(Line(GOOGLE_ASSET_LIMITS.callout, "callout")).max(GOOGLE_ASSET_LIMITS.callouts).default([]),
|
|
8100
|
+
sitelinks: array(Sitelink).max(GOOGLE_ASSET_LIMITS.sitelinks).default([]),
|
|
8101
|
+
structured_snippets: array(StructuredSnippet).max(GOOGLE_ASSET_LIMITS.snippets).default([]),
|
|
8102
|
+
business_name: Line(GOOGLE_ASSET_LIMITS.businessName, "business name").nullable().default(null),
|
|
8103
|
+
logo_asset_id: AssetId.nullable().default(null),
|
|
8104
|
+
image_asset_ids: array(AssetId).max(GOOGLE_ASSET_LIMITS.images).default([])
|
|
8105
|
+
}).strict();
|
|
8106
|
+
var CONTENT_LABELS = [
|
|
8107
|
+
"BELOW_THE_FOLD",
|
|
8108
|
+
"BRAND_SUITABILITY_CONTENT_FOR_FAMILIES",
|
|
8109
|
+
"BRAND_SUITABILITY_GAMES_FIGHTING",
|
|
8110
|
+
"BRAND_SUITABILITY_GAMES_MATURE",
|
|
8111
|
+
"BRAND_SUITABILITY_HEALTH_SENSITIVE",
|
|
8112
|
+
"BRAND_SUITABILITY_HEALTH_SOURCE_UNDETERMINED",
|
|
8113
|
+
"BRAND_SUITABILITY_NEWS_RECENT",
|
|
8114
|
+
"BRAND_SUITABILITY_NEWS_SENSITIVE",
|
|
8115
|
+
"BRAND_SUITABILITY_NEWS_SOURCE_NOT_FEATURED",
|
|
8116
|
+
"BRAND_SUITABILITY_POLITICS",
|
|
8117
|
+
"BRAND_SUITABILITY_RELIGION",
|
|
8118
|
+
"EMBEDDED_VIDEO",
|
|
8119
|
+
"JUVENILE",
|
|
8120
|
+
"LIVE_STREAMING_VIDEO",
|
|
8121
|
+
"PARKED_DOMAIN",
|
|
8122
|
+
"PROFANITY",
|
|
8123
|
+
"SEXUALLY_SUGGESTIVE",
|
|
8124
|
+
"SOCIAL_ISSUES",
|
|
8125
|
+
"TRAGEDY",
|
|
8126
|
+
"VIDEO",
|
|
8127
|
+
"VIDEO_NOT_YET_RATED",
|
|
8128
|
+
"VIDEO_RATING_DV_G",
|
|
8129
|
+
"VIDEO_RATING_DV_MA",
|
|
8130
|
+
"VIDEO_RATING_DV_PG",
|
|
8131
|
+
"VIDEO_RATING_DV_T"
|
|
8132
|
+
];
|
|
8133
|
+
var Placement = string2().trim().min(1).max(2048);
|
|
8134
|
+
var AppCategory = string2().regex(/^\d{1,12}$/, "a mobile app category id, e.g. 60008");
|
|
8135
|
+
var uniq = (xs) => new Set(xs).size === xs.length;
|
|
8136
|
+
var CampaignExclusions = object({
|
|
8137
|
+
placements: array(Placement).max(GOOGLE_ASSET_LIMITS.exclusions).default([]),
|
|
8138
|
+
mobile_app_categories: array(AppCategory).max(GOOGLE_ASSET_LIMITS.exclusions).default([]),
|
|
8139
|
+
content_labels: array(_enum(CONTENT_LABELS)).max(CONTENT_LABELS.length).default([])
|
|
8140
|
+
}).strict().refine((e) => uniq(e.placements) && uniq(e.mobile_app_categories) && uniq(e.content_labels), "exclusions are listed once");
|
|
8141
|
+
var noExclusions = () => ({
|
|
8142
|
+
placements: [],
|
|
8143
|
+
mobile_app_categories: [],
|
|
8144
|
+
content_labels: []
|
|
8145
|
+
});
|
|
8146
|
+
var CUSTOM_AUDIENCE_TYPES = ["search", "auto"];
|
|
8147
|
+
var CustomAudience = object({
|
|
8148
|
+
name: string2().trim().min(1).max(255),
|
|
8149
|
+
type: _enum(CUSTOM_AUDIENCE_TYPES),
|
|
8150
|
+
keywords: array(Line(GOOGLE_ASSET_LIMITS.audienceKeyword, "audience keyword").refine((s) => s.split(/\s+/).length <= 10, "audience keyword: at most 10 words")).max(GOOGLE_ASSET_LIMITS.audienceMembers).default([]),
|
|
8151
|
+
urls: array(string2().trim().url().max(2048)).max(GOOGLE_ASSET_LIMITS.audienceMembers).default([])
|
|
8152
|
+
}).strict().refine((a) => a.keywords.length + a.urls.length > 0, "an audience has at least one keyword or URL").refine((a) => a.type === "auto" || a.urls.length === 0, "a search audience has keywords only").refine((a) => a.keywords.length + a.urls.length <= GOOGLE_ASSET_LIMITS.audienceMembers, "at most 200 members");
|
|
8153
|
+
var emptyDisplay = () => ({
|
|
8154
|
+
optimized_targeting: false,
|
|
8155
|
+
custom_audiences: [],
|
|
8156
|
+
exclusions: noExclusions()
|
|
8157
|
+
});
|
|
8158
|
+
var CampaignDisplay = object({
|
|
8159
|
+
optimized_targeting: boolean2().default(false),
|
|
8160
|
+
custom_audiences: array(CustomAudience).max(GOOGLE_ASSET_LIMITS.customAudiences).default([]),
|
|
8161
|
+
exclusions: CampaignExclusions.default(() => noExclusions())
|
|
8162
|
+
}).strict();
|
|
8163
|
+
var AdAccountExclusions = object({
|
|
8164
|
+
placements: array(Placement).max(GOOGLE_ASSET_LIMITS.exclusions).default([]),
|
|
8165
|
+
mobile_app_categories: array(AppCategory).max(GOOGLE_ASSET_LIMITS.exclusions).default([]),
|
|
8166
|
+
content_labels: array(_enum(CONTENT_LABELS)).max(CONTENT_LABELS.length).default([]),
|
|
8167
|
+
mobile_applications: array(string2().trim().min(1).max(255)).max(GOOGLE_ASSET_LIMITS.exclusions).default([]),
|
|
8168
|
+
youtube_channels: array(string2().trim().min(1).max(128)).max(GOOGLE_ASSET_LIMITS.exclusions).default([]),
|
|
8169
|
+
youtube_videos: array(string2().trim().min(1).max(64)).max(GOOGLE_ASSET_LIMITS.exclusions).default([])
|
|
8170
|
+
}).strict().refine((e) => uniq(e.placements) && uniq(e.mobile_app_categories) && uniq(e.content_labels) && uniq(e.mobile_applications) && uniq(e.youtube_channels) && uniq(e.youtube_videos), "exclusions are listed once");
|
|
8171
|
+
var GOOGLE_AD_ACCOUNT_RE = /^\d{3}-\d{3}-\d{4}$/;
|
|
8172
|
+
var GoogleAdAccountId = string2().regex(GOOGLE_AD_ACCOUNT_RE, "a Google Ads account id, 123-456-7890");
|
|
8173
|
+
var AdAccountSettings = object({
|
|
8174
|
+
exclusions: AdAccountExclusions.default(() => ({
|
|
8175
|
+
placements: [],
|
|
8176
|
+
mobile_app_categories: [],
|
|
8177
|
+
content_labels: [],
|
|
8178
|
+
mobile_applications: [],
|
|
8179
|
+
youtube_channels: [],
|
|
8180
|
+
youtube_videos: []
|
|
8181
|
+
}))
|
|
8182
|
+
}).strict();
|
|
7975
8183
|
// ../../packages/growth/src/portfolio.ts
|
|
7976
8184
|
var PORTFOLIO_LIMITS = {
|
|
7977
8185
|
weeklyBudgetMicros: 1500000000,
|
|
@@ -8001,6 +8209,7 @@ var EXPERIMENT_METRICS = [
|
|
|
8001
8209
|
"agent_fetches",
|
|
8002
8210
|
"human_visits",
|
|
8003
8211
|
"signups",
|
|
8212
|
+
"landing_signup_rate",
|
|
8004
8213
|
"activation_rate",
|
|
8005
8214
|
"paid_rate",
|
|
8006
8215
|
"topup_request_rate",
|
|
@@ -8092,22 +8301,23 @@ var GOOGLE_AD_LIMITS = {
|
|
|
8092
8301
|
negativeKeywords: 500
|
|
8093
8302
|
};
|
|
8094
8303
|
var CampaignId = string2().regex(CAMPAIGN_ID_RE, "a campaign id, gcm_<ulid>");
|
|
8095
|
-
var
|
|
8304
|
+
var Line2 = (max, what) => string2().trim().min(1).refine((s) => [...s].length <= max, `${what}: at most ${max} characters`);
|
|
8096
8305
|
var Keyword = object({
|
|
8097
|
-
text:
|
|
8306
|
+
text: Line2(GOOGLE_AD_LIMITS.keyword, "keyword").refine((s) => s.split(/\s+/).length <= GOOGLE_AD_LIMITS.keywordWords, `keyword: at most ${GOOGLE_AD_LIMITS.keywordWords} words`),
|
|
8098
8307
|
match: _enum(KEYWORD_MATCH_TYPES)
|
|
8099
8308
|
}).strict();
|
|
8100
8309
|
var SearchAd = object({
|
|
8101
|
-
headlines: array(
|
|
8102
|
-
descriptions: array(
|
|
8103
|
-
path1:
|
|
8104
|
-
path2:
|
|
8310
|
+
headlines: array(Line2(GOOGLE_AD_LIMITS.headline, "headline")).min(GOOGLE_AD_LIMITS.headlinesMin).max(GOOGLE_AD_LIMITS.headlinesMax),
|
|
8311
|
+
descriptions: array(Line2(GOOGLE_AD_LIMITS.description, "description")).min(GOOGLE_AD_LIMITS.descriptionsMin).max(GOOGLE_AD_LIMITS.descriptionsMax),
|
|
8312
|
+
path1: Line2(GOOGLE_AD_LIMITS.path, "path").optional(),
|
|
8313
|
+
path2: Line2(GOOGLE_AD_LIMITS.path, "path").optional()
|
|
8105
8314
|
}).strict().refine((a) => !a.path2 || a.path1, "path2 needs path1");
|
|
8106
8315
|
var AdGroup2 = object({
|
|
8107
8316
|
name: string2().trim().min(1).max(255),
|
|
8108
|
-
keywords: array(Keyword).
|
|
8109
|
-
ads: array(SearchAd).
|
|
8110
|
-
negative_keywords: array(Keyword).max(GOOGLE_AD_LIMITS.negativeKeywords).default([])
|
|
8317
|
+
keywords: array(Keyword).max(GOOGLE_AD_LIMITS.keywordsPerAdGroup),
|
|
8318
|
+
ads: array(SearchAd).max(GOOGLE_AD_LIMITS.adsPerAdGroup),
|
|
8319
|
+
negative_keywords: array(Keyword).max(GOOGLE_AD_LIMITS.negativeKeywords).default([]),
|
|
8320
|
+
audiences: array(string2().trim().min(1).max(255)).max(10).default([])
|
|
8111
8321
|
}).strict();
|
|
8112
8322
|
var CampaignContent = object({
|
|
8113
8323
|
ad_groups: array(AdGroup2).min(1).max(GOOGLE_AD_LIMITS.adGroups),
|
|
@@ -8134,7 +8344,12 @@ var CAMPAIGN_FIELD_SHAPE = {
|
|
|
8134
8344
|
run_to: Day2,
|
|
8135
8345
|
targeting: CampaignTargeting,
|
|
8136
8346
|
content: CampaignContent,
|
|
8137
|
-
notes: string2().trim().max(4000).nullable()
|
|
8347
|
+
notes: string2().trim().max(4000).nullable(),
|
|
8348
|
+
channel: _enum(CAMPAIGN_CHANNELS),
|
|
8349
|
+
bidding: CampaignBidding.nullable(),
|
|
8350
|
+
devices: CampaignDevices,
|
|
8351
|
+
assets: CampaignAssets,
|
|
8352
|
+
display: CampaignDisplay
|
|
8138
8353
|
};
|
|
8139
8354
|
var CampaignFields = object({
|
|
8140
8355
|
...CAMPAIGN_FIELD_SHAPE,
|
|
@@ -8142,7 +8357,12 @@ var CampaignFields = object({
|
|
|
8142
8357
|
ad_account_id: CAMPAIGN_FIELD_SHAPE.ad_account_id.default(null),
|
|
8143
8358
|
daily_budget_micros: CAMPAIGN_FIELD_SHAPE.daily_budget_micros.default(null),
|
|
8144
8359
|
weekly_budget_micros: CAMPAIGN_FIELD_SHAPE.weekly_budget_micros.default(null),
|
|
8145
|
-
notes: CAMPAIGN_FIELD_SHAPE.notes.default(null)
|
|
8360
|
+
notes: CAMPAIGN_FIELD_SHAPE.notes.default(null),
|
|
8361
|
+
channel: CAMPAIGN_FIELD_SHAPE.channel.default("search"),
|
|
8362
|
+
bidding: CAMPAIGN_FIELD_SHAPE.bidding.default(null),
|
|
8363
|
+
devices: CAMPAIGN_FIELD_SHAPE.devices.default(noDeviceAdjustments),
|
|
8364
|
+
assets: CAMPAIGN_FIELD_SHAPE.assets.default(emptyAssets),
|
|
8365
|
+
display: CAMPAIGN_FIELD_SHAPE.display.default(emptyDisplay)
|
|
8146
8366
|
}).strict();
|
|
8147
8367
|
var CampaignFieldsPatch = object(CAMPAIGN_FIELD_SHAPE).partial().strict();
|
|
8148
8368
|
// ../../packages/growth/src/sinks/google.ts
|
|
@@ -8576,6 +8796,294 @@ var GoHit = object({
|
|
|
8576
8796
|
}).strict();
|
|
8577
8797
|
// ../../packages/growth/src/go-pages.ts
|
|
8578
8798
|
var AD_CLICK_TOKEN_RE = /^[A-Za-z0-9_-]{16,2000}\.[A-Za-z0-9_-]{43}$/;
|
|
8799
|
+
// ../../packages/growth/src/google-ads/reconcile.ts
|
|
8800
|
+
var MANAGED_ASSET_TYPES = new Set(["CALLOUT", "SITELINK", "STRUCTURED_SNIPPET"]);
|
|
8801
|
+
|
|
8802
|
+
// ../../packages/growth/src/google-ads/client.ts
|
|
8803
|
+
var MutateResponse2 = object({
|
|
8804
|
+
mutateOperationResponses: array(record(string2(), object({ resourceName: string2().optional() }).passthrough())).optional()
|
|
8805
|
+
});
|
|
8806
|
+
var AudienceResponse = object({ results: array(object({ resourceName: string2().optional() })).optional() });
|
|
8807
|
+
var Id4 = union([string2(), number2()]).transform(String);
|
|
8808
|
+
var Int = union([string2(), number2()]).optional().nullable().transform((v) => v == null || v === "" ? null : Number(v));
|
|
8809
|
+
var Str = string2().optional().nullable();
|
|
8810
|
+
var Bool = boolean2().optional().nullable();
|
|
8811
|
+
var loose = (shape) => object(shape).passthrough();
|
|
8812
|
+
var CampaignRow2 = loose({
|
|
8813
|
+
customer: loose({ currencyCode: Str, timeZone: Str }).optional(),
|
|
8814
|
+
campaign: loose({
|
|
8815
|
+
resourceName: string2(),
|
|
8816
|
+
id: Id4,
|
|
8817
|
+
name: string2().default(""),
|
|
8818
|
+
status: string2().default("UNKNOWN"),
|
|
8819
|
+
advertisingChannelType: string2().default("UNKNOWN"),
|
|
8820
|
+
biddingStrategyType: string2().default("UNKNOWN"),
|
|
8821
|
+
campaignBudget: Str,
|
|
8822
|
+
startDateTime: Str,
|
|
8823
|
+
endDateTime: Str,
|
|
8824
|
+
targetSpend: loose({ cpcBidCeilingMicros: Int }).optional(),
|
|
8825
|
+
maximizeConversions: loose({ targetCpaMicros: Int }).optional(),
|
|
8826
|
+
networkSettings: loose({
|
|
8827
|
+
targetGoogleSearch: Bool,
|
|
8828
|
+
targetSearchNetwork: Bool,
|
|
8829
|
+
targetContentNetwork: Bool
|
|
8830
|
+
}).optional(),
|
|
8831
|
+
geoTargetTypeSetting: loose({ positiveGeoTargetType: Str }).optional()
|
|
8832
|
+
}),
|
|
8833
|
+
campaignBudget: loose({
|
|
8834
|
+
resourceName: Str,
|
|
8835
|
+
amountMicros: Int,
|
|
8836
|
+
explicitlyShared: Bool,
|
|
8837
|
+
period: Str
|
|
8838
|
+
}).optional()
|
|
8839
|
+
});
|
|
8840
|
+
var Keyword2 = loose({ text: string2(), matchType: string2() }).optional();
|
|
8841
|
+
var CampaignCriterionRow = loose({
|
|
8842
|
+
campaignCriterion: loose({
|
|
8843
|
+
resourceName: string2(),
|
|
8844
|
+
type: string2().default("UNKNOWN"),
|
|
8845
|
+
status: Str,
|
|
8846
|
+
negative: Bool,
|
|
8847
|
+
bidModifier: number2().optional().nullable(),
|
|
8848
|
+
location: loose({ geoTargetConstant: string2() }).optional(),
|
|
8849
|
+
language: loose({ languageConstant: string2() }).optional(),
|
|
8850
|
+
device: loose({ type: string2() }).optional(),
|
|
8851
|
+
keyword: Keyword2,
|
|
8852
|
+
placement: loose({ url: string2() }).optional(),
|
|
8853
|
+
mobileAppCategory: loose({ mobileAppCategoryConstant: string2() }).optional(),
|
|
8854
|
+
contentLabel: loose({ type: string2() }).optional(),
|
|
8855
|
+
customAudience: loose({ customAudience: string2() }).optional()
|
|
8856
|
+
})
|
|
8857
|
+
});
|
|
8858
|
+
var AdGroupRow2 = loose({
|
|
8859
|
+
adGroup: loose({
|
|
8860
|
+
resourceName: string2(),
|
|
8861
|
+
id: Id4,
|
|
8862
|
+
name: string2().default(""),
|
|
8863
|
+
status: string2().default("UNKNOWN"),
|
|
8864
|
+
type: string2().default("UNKNOWN"),
|
|
8865
|
+
cpcBidMicros: Int,
|
|
8866
|
+
optimizedTargetingEnabled: Bool
|
|
8867
|
+
})
|
|
8868
|
+
});
|
|
8869
|
+
var AdGroupCriterionRow = loose({
|
|
8870
|
+
adGroup: loose({ resourceName: string2() }),
|
|
8871
|
+
adGroupCriterion: loose({
|
|
8872
|
+
resourceName: string2(),
|
|
8873
|
+
type: string2().default("UNKNOWN"),
|
|
8874
|
+
status: Str,
|
|
8875
|
+
negative: Bool,
|
|
8876
|
+
keyword: Keyword2,
|
|
8877
|
+
customAudience: loose({ customAudience: string2() }).optional()
|
|
8878
|
+
})
|
|
8879
|
+
});
|
|
8880
|
+
var AdText = array(loose({ text: string2().default("") })).optional();
|
|
8881
|
+
var AdRow = loose({
|
|
8882
|
+
adGroup: loose({ resourceName: string2() }),
|
|
8883
|
+
adGroupAd: loose({
|
|
8884
|
+
resourceName: string2(),
|
|
8885
|
+
status: string2().default("UNKNOWN"),
|
|
8886
|
+
ad: loose({
|
|
8887
|
+
type: string2().default("UNKNOWN"),
|
|
8888
|
+
finalUrls: array(string2()).optional(),
|
|
8889
|
+
responsiveSearchAd: loose({ headlines: AdText, descriptions: AdText, path1: Str, path2: Str }).optional()
|
|
8890
|
+
})
|
|
8891
|
+
})
|
|
8892
|
+
});
|
|
8893
|
+
var CampaignAssetRow = loose({
|
|
8894
|
+
campaignAsset: loose({ resourceName: string2(), status: string2().default("UNKNOWN"), fieldType: string2() }),
|
|
8895
|
+
asset: loose({
|
|
8896
|
+
resourceName: string2(),
|
|
8897
|
+
finalUrls: array(string2()).optional(),
|
|
8898
|
+
calloutAsset: loose({ calloutText: string2() }).optional(),
|
|
8899
|
+
sitelinkAsset: loose({ linkText: string2(), description1: Str, description2: Str }).optional(),
|
|
8900
|
+
structuredSnippetAsset: loose({ header: string2(), values: array(string2()).default([]) }).optional()
|
|
8901
|
+
})
|
|
8902
|
+
});
|
|
8903
|
+
var AudienceRow = loose({
|
|
8904
|
+
customAudience: loose({
|
|
8905
|
+
resourceName: string2(),
|
|
8906
|
+
name: string2().default(""),
|
|
8907
|
+
type: string2().default("UNKNOWN"),
|
|
8908
|
+
status: Str,
|
|
8909
|
+
members: array(loose({
|
|
8910
|
+
memberType: string2().default("UNKNOWN"),
|
|
8911
|
+
keyword: Str,
|
|
8912
|
+
url: Str,
|
|
8913
|
+
app: Str,
|
|
8914
|
+
placeCategory: union([string2(), number2()]).optional().nullable()
|
|
8915
|
+
})).optional()
|
|
8916
|
+
})
|
|
8917
|
+
});
|
|
8918
|
+
var NegativeRow = loose({
|
|
8919
|
+
customerNegativeCriterion: loose({
|
|
8920
|
+
resourceName: string2(),
|
|
8921
|
+
type: string2().default("UNKNOWN"),
|
|
8922
|
+
placement: loose({ url: string2() }).optional(),
|
|
8923
|
+
mobileAppCategory: loose({ mobileAppCategoryConstant: string2() }).optional(),
|
|
8924
|
+
contentLabel: loose({ type: string2() }).optional(),
|
|
8925
|
+
mobileApplication: loose({ appId: string2() }).optional(),
|
|
8926
|
+
youtubeChannel: loose({ channelId: string2() }).optional(),
|
|
8927
|
+
youtubeVideo: loose({ videoId: string2() }).optional()
|
|
8928
|
+
})
|
|
8929
|
+
});
|
|
8930
|
+
var CurrencyRow = loose({ customer: loose({ currencyCode: Str, timeZone: Str }).optional() });
|
|
8931
|
+
var NEG_TYPES = new Set([
|
|
8932
|
+
"PLACEMENT",
|
|
8933
|
+
"MOBILE_APP_CATEGORY",
|
|
8934
|
+
"CONTENT_LABEL",
|
|
8935
|
+
"MOBILE_APPLICATION",
|
|
8936
|
+
"YOUTUBE_CHANNEL",
|
|
8937
|
+
"YOUTUBE_VIDEO"
|
|
8938
|
+
]);
|
|
8939
|
+
// ../../packages/growth/src/insights-core.ts
|
|
8940
|
+
var VISITOR_COOKIE_MAX_AGE_S = 395 * 24 * 3600;
|
|
8941
|
+
var SESSION_IDLE_S = 30 * 60;
|
|
8942
|
+
var INSIGHTS_ID_RE = /^[A-Za-z0-9_-]{22}$/;
|
|
8943
|
+
var INSIGHTS_MAX_EVENTS_PER_BATCH = 50;
|
|
8944
|
+
var REPLAY_CHUNK_MAX_BYTES = 400000;
|
|
8945
|
+
var REPLAY_MAX_CHUNKS_PER_SEGMENT = 360;
|
|
8946
|
+
|
|
8947
|
+
// ../../packages/growth/src/insights.ts
|
|
8948
|
+
var TRACKED_COUNTRIES = ["US", "CA"];
|
|
8949
|
+
var COVERAGE_REASONS = [
|
|
8950
|
+
"tracked",
|
|
8951
|
+
"no_fetch_metadata",
|
|
8952
|
+
"not_a_page",
|
|
8953
|
+
"gpc",
|
|
8954
|
+
"dnt",
|
|
8955
|
+
"opted_out",
|
|
8956
|
+
"country",
|
|
8957
|
+
"subdivision",
|
|
8958
|
+
"not_a_browser"
|
|
8959
|
+
];
|
|
8960
|
+
var SiteCoverage = object({
|
|
8961
|
+
country: string2().regex(/^[A-Z]{2}$/),
|
|
8962
|
+
reason: _enum(COVERAGE_REASONS)
|
|
8963
|
+
}).strict();
|
|
8964
|
+
var SiteCoverageHit = object({ coverage: SiteCoverage }).strict();
|
|
8965
|
+
var Ms = number2().int().nonnegative();
|
|
8966
|
+
var Path = string2().regex(/^\/[^\s?#]{0,199}$/);
|
|
8967
|
+
var Selector = string2().min(1).max(200);
|
|
8968
|
+
var Px = number2().int().min(0).max(1e5);
|
|
8969
|
+
var Tag = string2().regex(/^[A-Za-z0-9._-]{1,60}$/).optional();
|
|
8970
|
+
var Variant = string2().regex(/^[a-z0-9][a-z0-9-]{0,39}$/).optional();
|
|
8971
|
+
var Base = { t: Ms, p: Path };
|
|
8972
|
+
var Pointer = {
|
|
8973
|
+
...Base,
|
|
8974
|
+
s: Selector,
|
|
8975
|
+
x: number2().int().min(0).max(1e4),
|
|
8976
|
+
y: Px,
|
|
8977
|
+
vw: Px,
|
|
8978
|
+
vh: Px,
|
|
8979
|
+
dh: Px
|
|
8980
|
+
};
|
|
8981
|
+
var BrowserEvent = discriminatedUnion("k", [
|
|
8982
|
+
object({
|
|
8983
|
+
k: literal("pageview"),
|
|
8984
|
+
...Base,
|
|
8985
|
+
r: string2().regex(/^[a-z0-9.-]{1,100}$/).optional(),
|
|
8986
|
+
q: object({ source: Tag, utm_source: Tag, utm_medium: Tag, utm_campaign: Tag }).strict().optional(),
|
|
8987
|
+
vw: Px,
|
|
8988
|
+
vh: Px,
|
|
8989
|
+
v: Variant
|
|
8990
|
+
}).strict(),
|
|
8991
|
+
object({ k: literal("click"), ...Pointer }).strict(),
|
|
8992
|
+
object({ k: literal("rage_click"), ...Pointer }).strict(),
|
|
8993
|
+
object({ k: literal("dead_click"), ...Pointer }).strict(),
|
|
8994
|
+
object({ k: literal("scroll"), ...Base, d: number2().int().min(0).max(100), dh: Px }).strict(),
|
|
8995
|
+
object({ k: literal("leave"), ...Base, ms: number2().int().min(0).max(86400000) }).strict()
|
|
8996
|
+
]);
|
|
8997
|
+
var INSIGHTS_EVENT_KINDS = ["pageview", "click", "rage_click", "dead_click", "scroll", "leave"];
|
|
8998
|
+
var BrowserBatch = object({
|
|
8999
|
+
v: literal(1),
|
|
9000
|
+
h: _enum(["site", "dashboard"]),
|
|
9001
|
+
e: array(BrowserEvent).min(1).max(INSIGHTS_MAX_EVENTS_PER_BATCH)
|
|
9002
|
+
}).strict();
|
|
9003
|
+
var DEVICE_CLASSES = ["desktop", "mobile", "tablet"];
|
|
9004
|
+
var BROWSER_FAMILIES = ["chrome", "safari", "firefox", "edge", "opera", "samsung", "other"];
|
|
9005
|
+
var InsightsEvent = object({
|
|
9006
|
+
kind: _enum(INSIGHTS_EVENT_KINDS),
|
|
9007
|
+
at: exports_iso.datetime(),
|
|
9008
|
+
path: Path,
|
|
9009
|
+
selector: Selector.optional(),
|
|
9010
|
+
x: number2().int().min(0).max(1e4).optional(),
|
|
9011
|
+
y: Px.optional(),
|
|
9012
|
+
vw: Px.optional(),
|
|
9013
|
+
vh: Px.optional(),
|
|
9014
|
+
doc_h: Px.optional(),
|
|
9015
|
+
scroll_pct: number2().int().min(0).max(100).optional(),
|
|
9016
|
+
duration_ms: number2().int().min(0).max(86400000).optional(),
|
|
9017
|
+
source: string2().max(110).optional(),
|
|
9018
|
+
code: string2().regex(CODE_RE).optional(),
|
|
9019
|
+
variant: Variant
|
|
9020
|
+
}).strict();
|
|
9021
|
+
var InsightsHit = object({
|
|
9022
|
+
insights: object({
|
|
9023
|
+
visitor: string2().regex(INSIGHTS_ID_RE),
|
|
9024
|
+
session: string2().regex(INSIGHTS_ID_RE),
|
|
9025
|
+
surface: _enum(["site", "dashboard"]),
|
|
9026
|
+
country: _enum(TRACKED_COUNTRIES),
|
|
9027
|
+
device: _enum(DEVICE_CLASSES),
|
|
9028
|
+
browser: _enum(BROWSER_FAMILIES),
|
|
9029
|
+
ip: string2().regex(/^[0-9a-fA-F:.]{2,45}$/).optional(),
|
|
9030
|
+
events: array(InsightsEvent).min(1).max(INSIGHTS_MAX_EVENTS_PER_BATCH)
|
|
9031
|
+
}).strict()
|
|
9032
|
+
}).strict();
|
|
9033
|
+
var InsightsForgetHit = object({ insights_forget: object({ visitor: string2().regex(INSIGHTS_ID_RE) }).strict() }).strict();
|
|
9034
|
+
var ReplayHit = object({
|
|
9035
|
+
replay: object({
|
|
9036
|
+
visitor: string2().regex(INSIGHTS_ID_RE),
|
|
9037
|
+
session: string2().regex(INSIGHTS_ID_RE),
|
|
9038
|
+
segment: string2().regex(INSIGHTS_ID_RE),
|
|
9039
|
+
seq: number2().int().min(0).max(REPLAY_MAX_CHUNKS_PER_SEGMENT - 1),
|
|
9040
|
+
surface: _enum(["site", "dashboard"]),
|
|
9041
|
+
country: _enum(TRACKED_COUNTRIES),
|
|
9042
|
+
device: _enum(DEVICE_CLASSES),
|
|
9043
|
+
browser: _enum(BROWSER_FAMILIES),
|
|
9044
|
+
path: Path,
|
|
9045
|
+
data: string2().regex(/^[A-Za-z0-9+/]+={0,2}$/).max(Math.ceil(REPLAY_CHUNK_MAX_BYTES / 3) * 4)
|
|
9046
|
+
}).strict()
|
|
9047
|
+
}).strict();
|
|
9048
|
+
// ../../packages/growth/src/landing.ts
|
|
9049
|
+
var LANDING_VARIANT_ID_RE = /^glv_[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
9050
|
+
var LandingVariantId = string2().regex(LANDING_VARIANT_ID_RE, "a landing variant id, glv_<ulid>");
|
|
9051
|
+
var LANDING_CTAS = ["agent_prompt", "cli_command", "browser_signup"];
|
|
9052
|
+
var LANDING_SNIPPETS = ["curl", "openai_sdk"];
|
|
9053
|
+
var LANDING_MOBILE_ORDERS = ["browser_signup_first", "same_as_desktop"];
|
|
9054
|
+
var LANDING_LIMITS = { name: 80, headline: 90, subhead: 240, bullet: 120, bullets: 4, trust: 240 };
|
|
9055
|
+
var LANDING_WEIGHT_MAX = 1000;
|
|
9056
|
+
var UNSAFE_TEXT = /[<>`*_[\]{}|\\#~^]|:\/\/|www\.|[\u0000-\u001f\u007f-\u009f---]/i;
|
|
9057
|
+
var plain = (min, max) => string2().trim().min(min).max(max).refine((s) => !UNSAFE_TEXT.test(s), "plain text only: no markup, links, templates or control characters");
|
|
9058
|
+
var LANDING_MODEL_ID_RE = /^[a-z0-9]+(-[a-z0-9]+){0,8}$/;
|
|
9059
|
+
var LandingContent = object({
|
|
9060
|
+
headline: plain(8, LANDING_LIMITS.headline),
|
|
9061
|
+
subhead: plain(1, LANDING_LIMITS.subhead).nullable().default(null),
|
|
9062
|
+
bullets: array(plain(3, LANDING_LIMITS.bullet)).max(LANDING_LIMITS.bullets).default([]),
|
|
9063
|
+
primary_cta: _enum(LANDING_CTAS).default("agent_prompt"),
|
|
9064
|
+
mobile_cta_order: _enum(LANDING_MOBILE_ORDERS).default("browser_signup_first"),
|
|
9065
|
+
snippet: _enum(LANDING_SNIPPETS).nullable().default(null),
|
|
9066
|
+
price_model_id: string2().regex(LANDING_MODEL_ID_RE).max(64).nullable().default(null),
|
|
9067
|
+
trust_line: plain(1, LANDING_LIMITS.trust).nullable().default(null)
|
|
9068
|
+
}).strict();
|
|
9069
|
+
var NOT_USAGE = String.raw`(?![\s-]+(?:for|credits?|tokens?|tiers?|trials?|usage|plans?|access|calls?|requests?|inference|api|models?|allowance|minutes?|hours?|days?|weeks?|months?)\b)`;
|
|
9070
|
+
var SIGN_UP = "(?:sign(?:ing)?[- ]?up)";
|
|
9071
|
+
var SIGNUP_FREE_RE = new RegExp([
|
|
9072
|
+
String.raw`\b${SIGN_UP}\s+(?:for\s+)?free\b${NOT_USAGE}`,
|
|
9073
|
+
String.raw`\bfree\s+to\s+(?:${SIGN_UP}|create\s+an\s+account)\b`,
|
|
9074
|
+
String.raw`\b(?:${SIGN_UP}|creating\s+an\s+account)\s+is\s+free\b${NOT_USAGE}`
|
|
9075
|
+
].join("|"), "gi");
|
|
9076
|
+
var LandingServeVariant = object({
|
|
9077
|
+
code: string2().regex(CODE_RE),
|
|
9078
|
+
weight: number2().int().min(1).max(LANDING_WEIGHT_MAX),
|
|
9079
|
+
sha256: string2().regex(/^[0-9a-f]{64}$/),
|
|
9080
|
+
content: LandingContent
|
|
9081
|
+
}).strict();
|
|
9082
|
+
var LandingServe = object({
|
|
9083
|
+
code: string2().regex(CODE_RE),
|
|
9084
|
+
parent: string2().regex(CODE_RE).nullable(),
|
|
9085
|
+
variants: array(LandingServeVariant).max(20)
|
|
9086
|
+
}).strict();
|
|
8579
9087
|
// ../../packages/growth/src/platforms/carbon.ts
|
|
8580
9088
|
var carbonAds = defineCsvSource({
|
|
8581
9089
|
platform: "carbon",
|
|
@@ -9506,7 +10014,7 @@ var SiteTouch = object({
|
|
|
9506
10014
|
}).strict();
|
|
9507
10015
|
var SiteTouchHit = object({ touch: SiteTouch }).strict();
|
|
9508
10016
|
// ../../packages/schemas/src/legal.ts
|
|
9509
|
-
var TERMS_VERSION = "2026-10-
|
|
10017
|
+
var TERMS_VERSION = "2026-10-13.2";
|
|
9510
10018
|
var LEGAL_SITE = "https://scaledthought.com";
|
|
9511
10019
|
var LEGAL_PATHS = {
|
|
9512
10020
|
index: "/legal",
|
|
@@ -9520,7 +10028,7 @@ var TERMS_URL = `${LEGAL_SITE}${LEGAL_PATHS.terms}`;
|
|
|
9520
10028
|
var PRIVACY_URL = `${LEGAL_SITE}${LEGAL_PATHS.privacy}`;
|
|
9521
10029
|
var ACCEPTABLE_USE_URL = `${LEGAL_SITE}${LEGAL_PATHS.acceptableUse}`;
|
|
9522
10030
|
var REFUND_POLICY_URL = `${LEGAL_SITE}${LEGAL_PATHS.creditsAndRefunds}`;
|
|
9523
|
-
var TERMS_NOTICE = `Nothing has been accepted on your behalf. You accept the ScaledThought Terms of Service (${TERMS_URL}) and the ` + `Credits & Refunds policy (${REFUND_POLICY_URL}) yourself when you buy credits. Privacy Policy: ${PRIVACY_URL}.`;
|
|
10031
|
+
var TERMS_NOTICE = `Nothing has been accepted on your behalf. You accept the ScaledThought Terms of Service (${TERMS_URL}) and the ` + `Credits & Refunds policy (${REFUND_POLICY_URL}) yourself when you buy credits (or, while a trial credit is offered, ` + `when you accept them on the email confirmation page to receive it). Privacy Policy: ${PRIVACY_URL}.`;
|
|
9524
10032
|
|
|
9525
10033
|
// src/connect.ts
|
|
9526
10034
|
import { chmodSync as chmodSync2, existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync4, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
@@ -10025,6 +10533,7 @@ var CREDIT_STEPS = [
|
|
|
10025
10533
|
var OWNER_EMAIL_QUESTION = "What email should own this account? You'll use it to sign in to the ScaledThought dashboard (billing, credits, keys). We only send it account email, such as this confirmation, sign-in links and security notices, never marketing.";
|
|
10026
10534
|
var OWNER_EMAIL_COMMAND = `${NPX} account email set <their email>`;
|
|
10027
10535
|
var OWNER_EMAIL_STEP = `This account has no owner email yet. Ask your human one question: "${OWNER_EMAIL_QUESTION}" Then run: ${OWNER_EMAIL_COMMAND} (we email them one confirmation link; relay message_for_human). If they'd rather not, carry on without it.`;
|
|
10536
|
+
var TRIAL_STEP = `Try it free: once your human clicks the confirmation link we emailed them and ticks the box accepting the Terms on that page (relay message_for_human), this account should get limited free usage to try it (US region, while available). After they confirm, run ${NPX} billing status: if balance_usd is above 0, make the call below; if it is still 0, do the top-up steps. When completions later return 402 insufficient_credits, the free usage is used up: do the top-up steps.`;
|
|
10028
10537
|
function ownerEmailFields(given, r) {
|
|
10029
10538
|
const owner = r.owner_email ?? (r.email_confirmation === "sent" ? "pending" : given ? undefined : "none");
|
|
10030
10539
|
return {
|
|
@@ -10097,7 +10606,7 @@ async function init(ctx, opts) {
|
|
|
10097
10606
|
const where = envKey ? "ST_API_KEY environment variable" : ".env (ST_API_KEY, ST_BASE_URL)";
|
|
10098
10607
|
if (opts.region && opts.region !== region)
|
|
10099
10608
|
throw new CliError("region_mismatch", `A ${region} key already exists (${where}) but --region ${opts.region} was requested. Nothing was created.`, `Accounts are pinned to one region. Use the existing ${region} account, or run init in a directory with no ST_API_KEY (and no ST_API_KEY in the environment) to create a separate ${opts.region} account.`, { existing_region: region, requested_region: opts.region });
|
|
10100
|
-
const status = await
|
|
10609
|
+
const status = await account2(ctx);
|
|
10101
10610
|
const ignored = [opts.source !== undefined && "--source", opts.adClick !== undefined && "--ad-click"].filter(Boolean);
|
|
10102
10611
|
const shown = withoutFreeFields(status);
|
|
10103
10612
|
const summary = await liveSummary(ctx, region, balanceOf(status));
|
|
@@ -10165,6 +10674,7 @@ async function init(ctx, opts) {
|
|
|
10165
10674
|
...owner,
|
|
10166
10675
|
...summary,
|
|
10167
10676
|
...owner.missing ? { next_steps: [OWNER_EMAIL_STEP, ...summary.next_steps] } : {},
|
|
10677
|
+
...acct.trial === "after_email_confirmation" && summary.needs_credits ? { trial: acct.trial, next_steps: [TRIAL_STEP, ...summary.next_steps] } : {},
|
|
10168
10678
|
...attribution.warnings.length ? { warnings: attribution.warnings } : {}
|
|
10169
10679
|
};
|
|
10170
10680
|
}
|
|
@@ -10246,7 +10756,7 @@ function withoutFreeFields(o) {
|
|
|
10246
10756
|
}
|
|
10247
10757
|
return out;
|
|
10248
10758
|
}
|
|
10249
|
-
async function
|
|
10759
|
+
async function account2(ctx) {
|
|
10250
10760
|
const a = withoutFreeFields(await api(ctx, "GET", "/v1/account"));
|
|
10251
10761
|
const fields = ["balance_usd", "auto_reload"];
|
|
10252
10762
|
if (fields.every((f) => (f in a)))
|
|
@@ -10271,6 +10781,10 @@ async function accountEmailSet(ctx, address) {
|
|
|
10271
10781
|
throw new CliError("bad_argument", `"${address}" isn't an email address.`, `Ask your human for their email, then run: ${OWNER_EMAIL_COMMAND}`);
|
|
10272
10782
|
return api(ctx, "PUT", "/v1/account/email", { body: { email } });
|
|
10273
10783
|
}
|
|
10784
|
+
async function accountRename(ctx, name) {
|
|
10785
|
+
const v = name.trim();
|
|
10786
|
+
return api(ctx, "PATCH", "/v1/account", { body: { name: v || null } });
|
|
10787
|
+
}
|
|
10274
10788
|
async function accountAdMeasurement(ctx, state) {
|
|
10275
10789
|
const v = state.trim().toLowerCase();
|
|
10276
10790
|
if (v !== "on" && v !== "off")
|
|
@@ -10279,7 +10793,7 @@ async function accountAdMeasurement(ctx, state) {
|
|
|
10279
10793
|
}
|
|
10280
10794
|
var keysList = (ctx) => api(ctx, "GET", "/v1/keys");
|
|
10281
10795
|
var DURATION_RE = /^(0|[1-9]\d{0,5}[smhd])$/;
|
|
10282
|
-
function
|
|
10796
|
+
function duration3(flag, v, allowZero = false) {
|
|
10283
10797
|
if (v === undefined)
|
|
10284
10798
|
return;
|
|
10285
10799
|
if (!DURATION_RE.test(v) || !allowZero && v === "0")
|
|
@@ -10290,14 +10804,14 @@ var keysCreate = async (ctx, o) => api(ctx, "POST", "/v1/keys", {
|
|
|
10290
10804
|
body: {
|
|
10291
10805
|
name: o.name,
|
|
10292
10806
|
daily_budget_usd: o.budgetUsd,
|
|
10293
|
-
expires_in:
|
|
10807
|
+
expires_in: duration3("expires-in", o.expiresIn),
|
|
10294
10808
|
scopes: o.scopes,
|
|
10295
10809
|
child: o.child || undefined
|
|
10296
10810
|
}
|
|
10297
10811
|
});
|
|
10298
10812
|
var keysRevoke = (ctx, id) => api(ctx, "DELETE", `/v1/keys/${encodeURIComponent(id)}`);
|
|
10299
10813
|
var keysRotate = async (ctx, id, o = {}) => api(ctx, "POST", `/v1/keys/${encodeURIComponent(id)}/rotate`, {
|
|
10300
|
-
body: { grace:
|
|
10814
|
+
body: { grace: duration3("grace", o.grace, true), expires_in: duration3("expires-in", o.expiresIn) }
|
|
10301
10815
|
});
|
|
10302
10816
|
var keysRevokeSelf = (ctx) => api(ctx, "DELETE", "/v1/keys/self");
|
|
10303
10817
|
var usage = (ctx, o) => api(ctx, "GET", `/v1/usage?days=${o.days}&group_by=${encodeURIComponent(o.by)}`);
|
|
@@ -10358,7 +10872,7 @@ async function chat(ctx, o) {
|
|
|
10358
10872
|
};
|
|
10359
10873
|
}
|
|
10360
10874
|
var billingStatus = async (ctx) => withoutFreeFields(await api(ctx, "GET", "/v1/billing"));
|
|
10361
|
-
var TOPUP_LIMITS = { min_usd:
|
|
10875
|
+
var TOPUP_LIMITS = { min_usd: 10, max_usd: 2000, daily_max_usd: 2000 };
|
|
10362
10876
|
function checkTopupLimits(amountUsd, autoReload) {
|
|
10363
10877
|
const { min_usd, max_usd, daily_max_usd } = TOPUP_LIMITS;
|
|
10364
10878
|
const range = (flag, v, lo, hi) => {
|
|
@@ -12044,14 +12558,14 @@ var models = defineCommand({
|
|
|
12044
12558
|
});
|
|
12045
12559
|
}, args)
|
|
12046
12560
|
});
|
|
12047
|
-
var ACCOUNT_SUBCOMMANDS = new Set(["delete", "ad-measurement", "email"]);
|
|
12048
|
-
var
|
|
12561
|
+
var ACCOUNT_SUBCOMMANDS = new Set(["delete", "rename", "ad-measurement", "email"]);
|
|
12562
|
+
var account3 = defineCommand({
|
|
12049
12563
|
meta: { name: "account", description: "Region, spend, credit balance, auto-reload and owner_email" },
|
|
12050
12564
|
args: jsonFlag,
|
|
12051
12565
|
run: ({ args, rawArgs }) => {
|
|
12052
12566
|
if (rawArgs.some((a) => ACCOUNT_SUBCOMMANDS.has(a)))
|
|
12053
12567
|
return;
|
|
12054
|
-
return run2(() =>
|
|
12568
|
+
return run2(() => account2(makeCtx()), args);
|
|
12055
12569
|
},
|
|
12056
12570
|
subCommands: {
|
|
12057
12571
|
delete: defineCommand({
|
|
@@ -12065,6 +12579,17 @@ var account2 = defineCommand({
|
|
|
12065
12579
|
},
|
|
12066
12580
|
run: ({ args }) => run2(() => accountDelete(makeCtx(), { confirm: args.confirm }), args)
|
|
12067
12581
|
}),
|
|
12582
|
+
rename: defineCommand({
|
|
12583
|
+
meta: {
|
|
12584
|
+
name: "rename",
|
|
12585
|
+
description: 'Rename the account (shown on the dashboard and in its emails); "" goes back to the default'
|
|
12586
|
+
},
|
|
12587
|
+
args: {
|
|
12588
|
+
...jsonFlag,
|
|
12589
|
+
name: { type: "positional", required: true, description: "The new name" }
|
|
12590
|
+
},
|
|
12591
|
+
run: ({ args }) => run2(() => accountRename(makeCtx(), args.name), args)
|
|
12592
|
+
}),
|
|
12068
12593
|
"ad-measurement": defineCommand({
|
|
12069
12594
|
meta: {
|
|
12070
12595
|
name: "ad-measurement",
|
|
@@ -12398,7 +12923,7 @@ var billing = defineCommand({
|
|
|
12398
12923
|
...jsonFlag,
|
|
12399
12924
|
"amount-usd": {
|
|
12400
12925
|
type: "string",
|
|
12401
|
-
description: "Credits to buy in USD (default 20; $
|
|
12926
|
+
description: "Credits to buy in USD (default 20; $10 to $2,000, at most $2,000 per 24 h). Your human can change it"
|
|
12402
12927
|
},
|
|
12403
12928
|
"auto-reload-below": {
|
|
12404
12929
|
type: "string",
|
|
@@ -12759,7 +13284,7 @@ var root = defineCommand({
|
|
|
12759
13284
|
models,
|
|
12760
13285
|
benchmarks: benchmarks2,
|
|
12761
13286
|
status: status2,
|
|
12762
|
-
account:
|
|
13287
|
+
account: account3,
|
|
12763
13288
|
keys,
|
|
12764
13289
|
usage: usage3,
|
|
12765
13290
|
chat: chat2,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scaledthought",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "OpenAI-compatible inference for open-weight models, set up by your coding agent. Prepaid, pay per token, no subscription. US live; Canada coming soon.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|