@ganju/utils 0.0.6 → 0.0.8
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/attachment.d.ts.map +1 -1
- package/dist/chunking.d.ts.map +1 -1
- package/dist/chunking.js +9 -3
- package/dist/coerce.d.ts.map +1 -1
- package/dist/coerce.js +4 -1
- package/dist/constants.d.ts +24 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +129 -12
- package/dist/containmentToken.d.ts +25 -0
- package/dist/containmentToken.d.ts.map +1 -0
- package/dist/containmentToken.js +81 -0
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +4 -1
- package/dist/getEnv.d.ts.map +1 -1
- package/dist/index.d.ts +26 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/oauth.d.ts.map +1 -1
- package/dist/parseHttpError.d.ts.map +1 -1
- package/dist/sources.d.ts.map +1 -1
- package/dist/vendorError.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/attachment.ts +2 -1
- package/src/chunking.ts +9 -3
- package/src/coerce.ts +4 -1
- package/src/constants.ts +146 -12
- package/src/containmentToken.ts +146 -0
- package/src/crypto.ts +6 -2
- package/src/getEnv.ts +1 -4
- package/src/index.ts +8 -0
- package/src/oauth.ts +1 -3
- package/src/parseHttpError.ts +3 -1
- package/src/slackSend.ts +10 -10
- package/src/sources.ts +7 -2
- package/src/vendorError.ts +4 -1
package/dist/attachment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC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":3,"file":"chunking.d.ts","sourceRoot":"","sources":["../src/chunking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AASpE,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,EACZ,QAAQ,MAAM,EACd,aAAY,SAAS,SAAS,EAA+B,KAC5D,MAAM,
|
|
1
|
+
{"version":3,"file":"chunking.d.ts","sourceRoot":"","sources":["../src/chunking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AASpE,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,EACZ,QAAQ,MAAM,EACd,aAAY,SAAS,SAAS,EAA+B,KAC5D,MAAM,EA8BR,CAAC;AAEF,eAAO,MAAM,SAAS,GACpB,MAAM,MAAM,EACZ,UAAU;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,KACxD,MAAM,EAeR,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,KAAG,MASW,CAAC;AAEhB,MAAM,WAAW,aAAc,SAAQ,yBAAyB;IAC9D,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,aAAa,GACxB,QAAQ,MAAM,EACd,WAAW,iBAAiB,EAAE,GAAG,IAAI,EACrC,iBAAiB,MAAM,GAAG,IAAI,EAC9B,UAAU;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,KACxD,aAAa,EAgCf,CAAC"}
|
package/dist/chunking.js
CHANGED
|
@@ -29,7 +29,9 @@ const splitRecursive = (text, target, separators = constants_1.constants.CHUNK_S
|
|
|
29
29
|
}
|
|
30
30
|
if (current)
|
|
31
31
|
chunks.push(current);
|
|
32
|
-
return chunks.flatMap(chunk => chunk.length > target
|
|
32
|
+
return chunks.flatMap(chunk => chunk.length > target
|
|
33
|
+
? (0, exports.splitRecursive)(chunk, target, separators)
|
|
34
|
+
: [chunk]);
|
|
33
35
|
}
|
|
34
36
|
const chunks = [];
|
|
35
37
|
for (let i = 0; i < text.length; i += target) {
|
|
@@ -69,7 +71,9 @@ const prepareChunks = (header, documents, fallbackContent, options) => {
|
|
|
69
71
|
if (documents && documents.length > 0) {
|
|
70
72
|
const out = [];
|
|
71
73
|
documents.forEach((doc, docIndex) => {
|
|
72
|
-
const body = (doc.pageContent || '')
|
|
74
|
+
const body = (doc.pageContent || '')
|
|
75
|
+
.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, '')
|
|
76
|
+
.trim();
|
|
73
77
|
if (!body)
|
|
74
78
|
return;
|
|
75
79
|
const text = docIndex === 0 && header ? `${header}\n\n${body}` : body;
|
|
@@ -87,7 +91,9 @@ const prepareChunks = (header, documents, fallbackContent, options) => {
|
|
|
87
91
|
});
|
|
88
92
|
return out;
|
|
89
93
|
}
|
|
90
|
-
const body = (fallbackContent || '')
|
|
94
|
+
const body = (fallbackContent || '')
|
|
95
|
+
.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, '')
|
|
96
|
+
.trim();
|
|
91
97
|
const fullText = [header, body].filter(Boolean).join('\n\n');
|
|
92
98
|
return (0, exports.chunkText)(fullText, options).map(content => ({
|
|
93
99
|
content,
|
package/dist/coerce.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce.d.ts","sourceRoot":"","sources":["../src/coerce.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"coerce.d.ts","sourceRoot":"","sources":["../src/coerce.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,MAAM,EAWpD,CAAC"}
|
package/dist/coerce.js
CHANGED
|
@@ -6,7 +6,10 @@ const toStringArray = (input) => {
|
|
|
6
6
|
return input.map(s => String(s).trim()).filter(Boolean);
|
|
7
7
|
}
|
|
8
8
|
if (typeof input === 'string' && input.trim()) {
|
|
9
|
-
return input
|
|
9
|
+
return input
|
|
10
|
+
.split(',')
|
|
11
|
+
.map(s => s.trim())
|
|
12
|
+
.filter(Boolean);
|
|
10
13
|
}
|
|
11
14
|
return [];
|
|
12
15
|
};
|
package/dist/constants.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ interface PlanLimits {
|
|
|
55
55
|
canUseCustomLlm: boolean;
|
|
56
56
|
canUseCustomCode: boolean;
|
|
57
57
|
maxHttpEndpointsPerArtifact: number | null;
|
|
58
|
+
includedToolCalls: number;
|
|
59
|
+
toolCallHardCap: number | null;
|
|
58
60
|
includedMessages: number;
|
|
59
61
|
includedEmbeddedBytes: number;
|
|
60
62
|
}
|
|
@@ -85,6 +87,9 @@ export declare const constants: {
|
|
|
85
87
|
PRICING_INCLUDED_EMBEDDED_GB: number;
|
|
86
88
|
PRICING_MESSAGE_PER_1K_USD: number;
|
|
87
89
|
PRICING_EMBEDDED_PER_GB_USD: number;
|
|
90
|
+
PRICING_INCLUDED_TOOL_CALLS: number;
|
|
91
|
+
PRICING_TOOL_CALL_PER_M_USD: number;
|
|
92
|
+
PRICING_TOOL_CALL_HARD_CAP: number;
|
|
88
93
|
PRICING_CUSTOM_DOMAIN_USD: number;
|
|
89
94
|
PLAN_FEATURE_ORGANIZATION: "organization";
|
|
90
95
|
PLAN_FEATURE_PROJECT: "project";
|
|
@@ -98,10 +103,17 @@ export declare const constants: {
|
|
|
98
103
|
PLAN_FEATURE_RAW_STORAGE: "rawStorage";
|
|
99
104
|
PLAN_FEATURE_EMBEDDED_STORAGE: "embeddedStorage";
|
|
100
105
|
PLAN_FEATURE_MESSAGE: "message";
|
|
106
|
+
PLAN_FEATURE_TOOL_CALL: "toolCall";
|
|
101
107
|
PLAN_LIMIT_ERROR_CODE: string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
BILLING_METER_MESSAGES: string;
|
|
109
|
+
BILLING_METER_SHARED_MESSAGES: string;
|
|
110
|
+
BILLING_METER_EMBEDDED: string;
|
|
111
|
+
BILLING_METER_TOOL_CALLS: string;
|
|
112
|
+
BILLING_METER_UNITS_KEY: string;
|
|
113
|
+
POLAR_API_BASE: string;
|
|
114
|
+
POLAR_SANDBOX_API_BASE: string;
|
|
115
|
+
POLAR_SERVER_SANDBOX: "sandbox";
|
|
116
|
+
POLAR_SERVER_PRODUCTION: "production";
|
|
105
117
|
CONSENT_DOCUMENT_TERMS: "terms";
|
|
106
118
|
CONSENT_DOCUMENT_PRIVACY: "privacy";
|
|
107
119
|
CONSENT_DOCUMENTS: ("terms" | "privacy")[];
|
|
@@ -120,6 +132,15 @@ export declare const constants: {
|
|
|
120
132
|
CRON_HOURLY: string;
|
|
121
133
|
CRON_ERROR_ALERTS: string;
|
|
122
134
|
ALERT_STATE_KEY_ERROR_LOG: string;
|
|
135
|
+
ALERT_STATE_KEY_TOOL_CALLS: string;
|
|
136
|
+
ALERT_TOOL_CALL_SURGE: number;
|
|
137
|
+
ALERT_TOOL_CALL_CAP_FRACTION: number;
|
|
138
|
+
ALERT_TOOL_CALL_COOLDOWN_HOURS: number;
|
|
139
|
+
ALERT_TOOL_CALL_MAX_ROWS: number;
|
|
140
|
+
CONTAINMENT_TOKEN_VERSION: string;
|
|
141
|
+
CONTAINMENT_PURPOSE_DISABLE_CUSTOM_CODE: string;
|
|
142
|
+
CONTAINMENT_TOKEN_TTL_MS: number;
|
|
143
|
+
CONTAINMENT_PATH: string;
|
|
123
144
|
ALERT_MIN_STATUS: number;
|
|
124
145
|
ALERT_MAX_ROWS: number;
|
|
125
146
|
ALERT_MAX_GROUPS: number;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AA6JA,QAAA,MAAM,yBAAyB,EAAiB,UAAU,CAAC;AAC3D,QAAA,MAAM,+BAA+B,EAAuB,gBAAgB,CAAC;AAC7E,QAAA,MAAM,8BAA8B,EAAsB,eAAe,CAAC;AAC1E,QAAA,MAAM,wBAAwB,EAAgB,SAAS,CAAC;AAuCxD,QAAA,MAAM,sBAAsB,EAAiB,UAAU,CAAC;AACxD,QAAA,MAAM,4BAA4B,EAAuB,gBAAgB,CAAC;AAC1E,QAAA,MAAM,oBAAoB,EAAe,QAAQ,CAAC;AAClD,QAAA,MAAM,oBAAoB,EAAe,QAAQ,CAAC;AAmYlD,QAAA,MAAM,sBAAsB,EAAkB,WAAW,CAAC;AAC1D,QAAA,MAAM,mBAAmB,EAAe,QAAQ,CAAC;AAGjD,QAAA,MAAM,mBAAmB,EAAe,QAAQ,CAAC;AAkTjD,MAAM,MAAM,mBAAmB,GAC3B;IACE,GAAG,EAAE,MAAM,CAAC;I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AAM;eACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA6NwB,MAAM,GAAG,MAAM;cAAQ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAy6DnE,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1540,7 +1540,8 @@ const PLAN_FREE = 'FREE';
|
|
|
1540
1540
|
const PLAN_PRO = 'PRO';
|
|
1541
1541
|
const PLAN_ENTERPRISE = 'ENTERPRISE';
|
|
1542
1542
|
const PLANS = [PLAN_FREE, PLAN_PRO, PLAN_ENTERPRISE];
|
|
1543
|
-
//
|
|
1543
|
+
// The provider's subscription statuses, mirrored so the webhook can store them
|
|
1544
|
+
// verbatim.
|
|
1544
1545
|
const SUBSCRIPTION_STATUS_ACTIVE = 'active';
|
|
1545
1546
|
const SUBSCRIPTION_STATUS_TRIALING = 'trialing';
|
|
1546
1547
|
const SUBSCRIPTION_STATUS_PAST_DUE = 'past_due';
|
|
@@ -1617,6 +1618,30 @@ const PRICING_SHARED_KEY_HARD_CAP = 100_000;
|
|
|
1617
1618
|
// so $2 is now roughly break-even. Raising CHUNK_TARGET_CHARS would tip it
|
|
1618
1619
|
// positive without touching this number.
|
|
1619
1620
|
const PRICING_EMBEDDED_PER_GB_USD = 2;
|
|
1621
|
+
// Custom-tool invocations included per month, and the rate beyond them.
|
|
1622
|
+
//
|
|
1623
|
+
// "Tool call" here means one dispatch into a user's own script on Workers for
|
|
1624
|
+
// Platforms — NOT a call to a shipped integration or a proxied server. Those
|
|
1625
|
+
// cost us one screened fetch from a Worker we already pay for, which is why they
|
|
1626
|
+
// stay bundled; this one runs the customer's code on our infrastructure, and is
|
|
1627
|
+
// the first cost axis a user can turn against us rather than merely consume.
|
|
1628
|
+
//
|
|
1629
|
+
// Cloudflare bills the whole chain (dispatcher → user script → outbound worker)
|
|
1630
|
+
// as ONE request and counts CPU across all three, so a call costs ~$2.30 per
|
|
1631
|
+
// million at the per-script CPU ceiling. $5/M is ~2x that, and 1,000,000 is far
|
|
1632
|
+
// past any real month: the heaviest worked customer in the cost model makes
|
|
1633
|
+
// 800,000, and a single artifact pinned at its rate limit for a full month
|
|
1634
|
+
// manages ~2.6 million.
|
|
1635
|
+
const PRICING_INCLUDED_TOOL_CALLS = 1_000_000;
|
|
1636
|
+
const PRICING_TOOL_CALL_PER_M_USD = 5;
|
|
1637
|
+
// Abuse backstop on custom-tool invocations — the compute analogue of
|
|
1638
|
+
// PRICING_SHARED_KEY_HARD_CAP, and needed for the same reason: past a point,
|
|
1639
|
+
// usage stops looking like a customer and starts looking like a runaway loop or
|
|
1640
|
+
// a stolen credential. 20x the included allowance is ~$46 of compute against
|
|
1641
|
+
// ~$95 billed, and takes eight artifacts held at their rate limit for a month to
|
|
1642
|
+
// reach. Enterprise is null — the cost model's own enterprise example makes 20
|
|
1643
|
+
// million calls a month, so a fixed ceiling there would fight a real customer.
|
|
1644
|
+
const PRICING_TOOL_CALL_HARD_CAP = 20_000_000;
|
|
1620
1645
|
const PRICING_CUSTOM_DOMAIN_USD = 15;
|
|
1621
1646
|
const PLAN_LIMITS = {
|
|
1622
1647
|
FREE: {
|
|
@@ -1642,6 +1667,15 @@ const PLAN_LIMITS = {
|
|
|
1642
1667
|
canUseCustomLlm: false,
|
|
1643
1668
|
canUseCustomCode: false,
|
|
1644
1669
|
maxHttpEndpointsPerArtifact: 3,
|
|
1670
|
+
// Free can't deploy custom code, so the only way to have a running script on
|
|
1671
|
+
// this plan is to have DOWNGRADED with one already published — a paid org
|
|
1672
|
+
// keeps its versions and their bundles. Those tools go on serving, because
|
|
1673
|
+
// killing a customer's live integrations the moment a card fails is a worse
|
|
1674
|
+
// failure than serving a bounded number of calls while they fix it. This is
|
|
1675
|
+
// that bound: real breathing room, ~$0.02 of compute, and no overage path
|
|
1676
|
+
// off Free to turn it into a bill.
|
|
1677
|
+
includedToolCalls: 0,
|
|
1678
|
+
toolCallHardCap: 10_000,
|
|
1645
1679
|
includedMessages: 100,
|
|
1646
1680
|
includedEmbeddedBytes: 5 * MB
|
|
1647
1681
|
},
|
|
@@ -1663,6 +1697,8 @@ const PLAN_LIMITS = {
|
|
|
1663
1697
|
canUseCustomLlm: true,
|
|
1664
1698
|
canUseCustomCode: true,
|
|
1665
1699
|
maxHttpEndpointsPerArtifact: null,
|
|
1700
|
+
includedToolCalls: PRICING_INCLUDED_TOOL_CALLS,
|
|
1701
|
+
toolCallHardCap: PRICING_TOOL_CALL_HARD_CAP,
|
|
1666
1702
|
includedMessages: PRICING_INCLUDED_MESSAGES,
|
|
1667
1703
|
includedEmbeddedBytes: PRICING_INCLUDED_EMBEDDED_GB * GB
|
|
1668
1704
|
},
|
|
@@ -1680,6 +1716,12 @@ const PLAN_LIMITS = {
|
|
|
1680
1716
|
canUseCustomLlm: true,
|
|
1681
1717
|
canUseCustomCode: true,
|
|
1682
1718
|
maxHttpEndpointsPerArtifact: null,
|
|
1719
|
+
includedToolCalls: PRICING_INCLUDED_TOOL_CALLS,
|
|
1720
|
+
// No backstop: an Enterprise contract is negotiated against real volume, and
|
|
1721
|
+
// the reference deal in the cost model runs 20 million calls a month — the
|
|
1722
|
+
// exact number a Pro-shaped ceiling would refuse. Raise the ceiling by
|
|
1723
|
+
// contract; don't make one plan's abuse limit another plan's product limit.
|
|
1724
|
+
toolCallHardCap: null,
|
|
1683
1725
|
includedMessages: PRICING_INCLUDED_MESSAGES,
|
|
1684
1726
|
includedEmbeddedBytes: PRICING_INCLUDED_EMBEDDED_GB * GB
|
|
1685
1727
|
}
|
|
@@ -1698,19 +1740,42 @@ const PLAN_FEATURE_HTTP_ENDPOINT = 'httpEndpoint';
|
|
|
1698
1740
|
const PLAN_FEATURE_RAW_STORAGE = 'rawStorage';
|
|
1699
1741
|
const PLAN_FEATURE_EMBEDDED_STORAGE = 'embeddedStorage';
|
|
1700
1742
|
const PLAN_FEATURE_MESSAGE = 'message';
|
|
1743
|
+
const PLAN_FEATURE_TOOL_CALL = 'toolCall';
|
|
1701
1744
|
// Stable code returned on a quota block so clients can branch on it (402).
|
|
1702
1745
|
const PLAN_LIMIT_ERROR_CODE = 'PLAN_LIMIT_EXCEEDED';
|
|
1703
|
-
//
|
|
1704
|
-
//
|
|
1705
|
-
//
|
|
1706
|
-
//
|
|
1746
|
+
// Billing meter event names. The metering cron reports per-period OVERAGE
|
|
1747
|
+
// (usage above the plan's included allowance) to these meters; the meters'
|
|
1748
|
+
// prices on the subscribed product turn that into charges. Embedded storage is
|
|
1749
|
+
// reported in whole MB, messages as a raw count.
|
|
1750
|
+
//
|
|
1751
|
+
// Each name must match the filter on its meter exactly. A mismatch is not an
|
|
1752
|
+
// error at either end — the event is accepted, matches no meter, and the usage
|
|
1753
|
+
// is silently unbilled.
|
|
1707
1754
|
//
|
|
1708
1755
|
// Messages report to two separate meters because the two kinds of turn bill at
|
|
1709
1756
|
// different rates — a turn on the org's own key is a platform fee, a turn on our
|
|
1710
1757
|
// model is inference we bought. One meter can't price both.
|
|
1711
|
-
const
|
|
1712
|
-
const
|
|
1713
|
-
const
|
|
1758
|
+
const BILLING_METER_MESSAGES = 'ganju_channel_messages';
|
|
1759
|
+
const BILLING_METER_SHARED_MESSAGES = 'ganju_shared_messages';
|
|
1760
|
+
const BILLING_METER_EMBEDDED = 'ganju_embedded_storage';
|
|
1761
|
+
// Custom-tool invocations, reported as a raw count of the calls above the
|
|
1762
|
+
// included allowance and priced per call at $5/1,000,000. Metered prices are
|
|
1763
|
+
// per single unit, so a partial block is billed as the fraction it is — a
|
|
1764
|
+
// customer 2.5 million past the allowance owes $12.50, which is what every page
|
|
1765
|
+
// of ours quotes.
|
|
1766
|
+
const BILLING_METER_TOOL_CALLS = 'ganju_custom_tool_calls';
|
|
1767
|
+
// The metadata property every meter aggregates (`sum` over it). Ingested events
|
|
1768
|
+
// carry the increment under this key, so it has to agree with the aggregation
|
|
1769
|
+
// configured on all four meters — which is why it lives beside their names
|
|
1770
|
+
// rather than at the call site.
|
|
1771
|
+
const BILLING_METER_UNITS_KEY = 'units';
|
|
1772
|
+
// Polar API hosts. Sandbox is a separate host rather than a mode flag, so the
|
|
1773
|
+
// account, products, meters and webhook secret there are all distinct from
|
|
1774
|
+
// production's — which is what `POLAR_SERVER` selects between.
|
|
1775
|
+
const POLAR_API_BASE = 'https://api.polar.sh';
|
|
1776
|
+
const POLAR_SANDBOX_API_BASE = 'https://sandbox-api.polar.sh';
|
|
1777
|
+
const POLAR_SERVER_SANDBOX = 'sandbox';
|
|
1778
|
+
const POLAR_SERVER_PRODUCTION = 'production';
|
|
1714
1779
|
// Legal documents a user accepts, and the version they're on. Bump the version
|
|
1715
1780
|
// when the document changes materially — existing users are then re-prompted,
|
|
1716
1781
|
// and the old acceptance stays on record. Keep in sync with the "Last updated"
|
|
@@ -1718,7 +1783,7 @@ const STRIPE_METER_EMBEDDED = 'ganju_embedded_storage';
|
|
|
1718
1783
|
const CONSENT_DOCUMENT_TERMS = 'terms';
|
|
1719
1784
|
const CONSENT_DOCUMENT_PRIVACY = 'privacy';
|
|
1720
1785
|
const CONSENT_DOCUMENTS = [CONSENT_DOCUMENT_TERMS, CONSENT_DOCUMENT_PRIVACY];
|
|
1721
|
-
const CONSENT_CURRENT_VERSION = '2026-08-
|
|
1786
|
+
const CONSENT_CURRENT_VERSION = '2026-08-31';
|
|
1722
1787
|
const CONSENT_SOURCE_SIGNUP = 'signup';
|
|
1723
1788
|
const CONSENT_SOURCE_REACCEPT = 'reaccept';
|
|
1724
1789
|
const CONSENT_SOURCES = [CONSENT_SOURCE_SIGNUP, CONSENT_SOURCE_REACCEPT];
|
|
@@ -1753,6 +1818,39 @@ const RETENTION_EXPIRED_SESSION_DAYS = 30;
|
|
|
1753
1818
|
const CRON_HOURLY = '0 * * * *';
|
|
1754
1819
|
const CRON_ERROR_ALERTS = '*/15 * * * *';
|
|
1755
1820
|
const ALERT_STATE_KEY_ERROR_LOG = 'error_log';
|
|
1821
|
+
// Custom-tool usage alerting, keyed per organization as `tool_calls:<id>`. The
|
|
1822
|
+
// monthly hard cap bounds what abuse can spend; these thresholds are what say
|
|
1823
|
+
// something is happening NOW, while there is still a month left to spend.
|
|
1824
|
+
const ALERT_STATE_KEY_TOOL_CALLS = 'tool_calls';
|
|
1825
|
+
// Calls in a single hour. The per-tool rate limit allows 3,600/hour, and a month
|
|
1826
|
+
// of the included million sustained is ~1,370/hour — so five figures in one hour
|
|
1827
|
+
// is either many artifacts at full tilt or something that should be looked at.
|
|
1828
|
+
const ALERT_TOOL_CALL_SURGE = 10_000;
|
|
1829
|
+
// The share of the abuse backstop at which the wall is close enough to warn
|
|
1830
|
+
// about. Half a month's ceiling reached is worth an email even if the rate is
|
|
1831
|
+
// unremarkable, because the alternative is a customer meeting it silently.
|
|
1832
|
+
const ALERT_TOOL_CALL_CAP_FRACTION = 0.5;
|
|
1833
|
+
// How long to stay quiet about one organization after alerting on it. Without
|
|
1834
|
+
// this a busy month is an hourly email, and an hourly email is a muted one.
|
|
1835
|
+
const ALERT_TOOL_CALL_COOLDOWN_HOURS = 6;
|
|
1836
|
+
// Organizations itemised in one digest.
|
|
1837
|
+
const ALERT_TOOL_CALL_MAX_ROWS = 25;
|
|
1838
|
+
// The "stop these tools" link the usage digest carries.
|
|
1839
|
+
//
|
|
1840
|
+
// It exists because the alert travels and the response did not: every other
|
|
1841
|
+
// containment step needs a shell holding the production database URL, so an
|
|
1842
|
+
// abuse notice arriving away from a desk was one nobody could act on for hours.
|
|
1843
|
+
//
|
|
1844
|
+
// Narrow on purpose. It disables the organization's custom-code installs — the
|
|
1845
|
+
// tools stop registering at boot, the code, versions and settings all survive,
|
|
1846
|
+
// and any owner can switch them back on. It cannot delete a script, touch a
|
|
1847
|
+
// credential, or reach anything else.
|
|
1848
|
+
const CONTAINMENT_TOKEN_VERSION = '1';
|
|
1849
|
+
const CONTAINMENT_PURPOSE_DISABLE_CUSTOM_CODE = 'disable-custom-code';
|
|
1850
|
+
// Long enough to still work when the mail is read a few hours late, short enough
|
|
1851
|
+
// that a forwarded thread or an archived inbox is not a way in.
|
|
1852
|
+
const CONTAINMENT_TOKEN_TTL_MS = 12 * 60 * 60 * 1000;
|
|
1853
|
+
const CONTAINMENT_PATH = '/containment';
|
|
1756
1854
|
// Only alert on genuine server failures. 4xx rows are expected client errors
|
|
1757
1855
|
// (validation, not-found, quota) and would drown the signal.
|
|
1758
1856
|
const ALERT_MIN_STATUS = 500;
|
|
@@ -1793,6 +1891,9 @@ exports.constants = {
|
|
|
1793
1891
|
PRICING_INCLUDED_EMBEDDED_GB,
|
|
1794
1892
|
PRICING_MESSAGE_PER_1K_USD,
|
|
1795
1893
|
PRICING_EMBEDDED_PER_GB_USD,
|
|
1894
|
+
PRICING_INCLUDED_TOOL_CALLS,
|
|
1895
|
+
PRICING_TOOL_CALL_PER_M_USD,
|
|
1896
|
+
PRICING_TOOL_CALL_HARD_CAP,
|
|
1796
1897
|
PRICING_CUSTOM_DOMAIN_USD,
|
|
1797
1898
|
PLAN_FEATURE_ORGANIZATION,
|
|
1798
1899
|
PLAN_FEATURE_PROJECT,
|
|
@@ -1806,10 +1907,17 @@ exports.constants = {
|
|
|
1806
1907
|
PLAN_FEATURE_RAW_STORAGE,
|
|
1807
1908
|
PLAN_FEATURE_EMBEDDED_STORAGE,
|
|
1808
1909
|
PLAN_FEATURE_MESSAGE,
|
|
1910
|
+
PLAN_FEATURE_TOOL_CALL,
|
|
1809
1911
|
PLAN_LIMIT_ERROR_CODE,
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1912
|
+
BILLING_METER_MESSAGES,
|
|
1913
|
+
BILLING_METER_SHARED_MESSAGES,
|
|
1914
|
+
BILLING_METER_EMBEDDED,
|
|
1915
|
+
BILLING_METER_TOOL_CALLS,
|
|
1916
|
+
BILLING_METER_UNITS_KEY,
|
|
1917
|
+
POLAR_API_BASE,
|
|
1918
|
+
POLAR_SANDBOX_API_BASE,
|
|
1919
|
+
POLAR_SERVER_SANDBOX,
|
|
1920
|
+
POLAR_SERVER_PRODUCTION,
|
|
1813
1921
|
CONSENT_DOCUMENT_TERMS,
|
|
1814
1922
|
CONSENT_DOCUMENT_PRIVACY,
|
|
1815
1923
|
CONSENT_DOCUMENTS,
|
|
@@ -1823,6 +1931,15 @@ exports.constants = {
|
|
|
1823
1931
|
CRON_HOURLY,
|
|
1824
1932
|
CRON_ERROR_ALERTS,
|
|
1825
1933
|
ALERT_STATE_KEY_ERROR_LOG,
|
|
1934
|
+
ALERT_STATE_KEY_TOOL_CALLS,
|
|
1935
|
+
ALERT_TOOL_CALL_SURGE,
|
|
1936
|
+
ALERT_TOOL_CALL_CAP_FRACTION,
|
|
1937
|
+
ALERT_TOOL_CALL_COOLDOWN_HOURS,
|
|
1938
|
+
ALERT_TOOL_CALL_MAX_ROWS,
|
|
1939
|
+
CONTAINMENT_TOKEN_VERSION,
|
|
1940
|
+
CONTAINMENT_PURPOSE_DISABLE_CUSTOM_CODE,
|
|
1941
|
+
CONTAINMENT_TOKEN_TTL_MS,
|
|
1942
|
+
CONTAINMENT_PATH,
|
|
1826
1943
|
ALERT_MIN_STATUS,
|
|
1827
1944
|
ALERT_MAX_ROWS,
|
|
1828
1945
|
ALERT_MAX_GROUPS,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ContainmentTokenPayload {
|
|
2
|
+
v: string;
|
|
3
|
+
p: string;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
iat: number;
|
|
6
|
+
exp: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Mint a containment link token for one organization.
|
|
10
|
+
*
|
|
11
|
+
* The lifetime is deliberately short. This is not a login: it is a thing you act
|
|
12
|
+
* on while reading the mail that carried it, and an expiry measured in hours
|
|
13
|
+
* means a forwarded thread or an archived inbox stops being a way in.
|
|
14
|
+
*/
|
|
15
|
+
export declare const mintContainmentToken: (organizationId: string, secret: string, issuedAt?: number, ttlMs?: number) => Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Verify a containment token and return its payload, or null when it is
|
|
18
|
+
* malformed, expired, of an unknown format version, minted for another purpose,
|
|
19
|
+
* or not signed by this deployment's secret.
|
|
20
|
+
*
|
|
21
|
+
* Null rather than a reason, so the page can answer every rejection identically:
|
|
22
|
+
* a link that says *why* it failed tells whoever found it what to change.
|
|
23
|
+
*/
|
|
24
|
+
export declare const verifyContainmentToken: (token: string, secret: string, now?: number) => Promise<ContainmentTokenPayload | null>;
|
|
25
|
+
//# sourceMappingURL=containmentToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containmentToken.d.ts","sourceRoot":"","sources":["../src/containmentToken.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,uBAAuB;IAGtC,CAAC,EAAE,MAAM,CAAC;IAEV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAaD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,gBAAgB,MAAM,EACtB,QAAQ,MAAM,EACd,WAAU,MAAmB,EAC7B,QAAO,MAA2C,KACjD,OAAO,CAAC,MAAM,CAoBhB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,MAAK,MAAmB,KACvB,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAiDxC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyContainmentToken = exports.mintContainmentToken = void 0;
|
|
4
|
+
const base64_1 = require("./base64");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const encoder = new TextEncoder();
|
|
7
|
+
const importKey = (secret) => crypto.subtle.importKey('raw', encoder.encode(secret), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign', 'verify']);
|
|
8
|
+
/**
|
|
9
|
+
* Mint a containment link token for one organization.
|
|
10
|
+
*
|
|
11
|
+
* The lifetime is deliberately short. This is not a login: it is a thing you act
|
|
12
|
+
* on while reading the mail that carried it, and an expiry measured in hours
|
|
13
|
+
* means a forwarded thread or an archived inbox stops being a way in.
|
|
14
|
+
*/
|
|
15
|
+
const mintContainmentToken = async (organizationId, secret, issuedAt = Date.now(), ttlMs = constants_1.constants.CONTAINMENT_TOKEN_TTL_MS) => {
|
|
16
|
+
const body = {
|
|
17
|
+
v: constants_1.constants.CONTAINMENT_TOKEN_VERSION,
|
|
18
|
+
p: constants_1.constants.CONTAINMENT_PURPOSE_DISABLE_CUSTOM_CODE,
|
|
19
|
+
organizationId,
|
|
20
|
+
iat: Math.floor(issuedAt / 1000),
|
|
21
|
+
// Rounded up so a stated lifetime is a floor rather than up to a second
|
|
22
|
+
// short of one.
|
|
23
|
+
exp: Math.ceil((issuedAt + ttlMs) / 1000)
|
|
24
|
+
};
|
|
25
|
+
const encodedPayload = (0, base64_1.toBase64Url)((0, base64_1.bytesToBase64)(encoder.encode(JSON.stringify(body))));
|
|
26
|
+
const key = await importKey(secret);
|
|
27
|
+
const signature = await crypto.subtle.sign('HMAC', key, encoder.encode(encodedPayload));
|
|
28
|
+
return `${encodedPayload}.${(0, base64_1.toBase64Url)((0, base64_1.bytesToBase64)(new Uint8Array(signature)))}`;
|
|
29
|
+
};
|
|
30
|
+
exports.mintContainmentToken = mintContainmentToken;
|
|
31
|
+
/**
|
|
32
|
+
* Verify a containment token and return its payload, or null when it is
|
|
33
|
+
* malformed, expired, of an unknown format version, minted for another purpose,
|
|
34
|
+
* or not signed by this deployment's secret.
|
|
35
|
+
*
|
|
36
|
+
* Null rather than a reason, so the page can answer every rejection identically:
|
|
37
|
+
* a link that says *why* it failed tells whoever found it what to change.
|
|
38
|
+
*/
|
|
39
|
+
const verifyContainmentToken = async (token, secret, now = Date.now()) => {
|
|
40
|
+
const separator = token.lastIndexOf('.');
|
|
41
|
+
if (separator <= 0)
|
|
42
|
+
return null;
|
|
43
|
+
const encodedPayload = token.slice(0, separator);
|
|
44
|
+
const signature = token.slice(separator + 1);
|
|
45
|
+
const key = await importKey(secret);
|
|
46
|
+
let valid;
|
|
47
|
+
try {
|
|
48
|
+
const signatureBytes = new Uint8Array((0, base64_1.base64ToBytes)((0, base64_1.fromBase64Url)(signature)));
|
|
49
|
+
valid = await crypto.subtle.verify('HMAC', key, signatureBytes, encoder.encode(encodedPayload));
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
if (!valid)
|
|
55
|
+
return null;
|
|
56
|
+
let parsed;
|
|
57
|
+
try {
|
|
58
|
+
parsed = JSON.parse(new TextDecoder().decode((0, base64_1.base64ToBytes)((0, base64_1.fromBase64Url)(encodedPayload))));
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
if (!parsed || typeof parsed !== 'object')
|
|
64
|
+
return null;
|
|
65
|
+
const candidate = parsed;
|
|
66
|
+
if (candidate.v !== constants_1.constants.CONTAINMENT_TOKEN_VERSION)
|
|
67
|
+
return null;
|
|
68
|
+
if (candidate.p !== constants_1.constants.CONTAINMENT_PURPOSE_DISABLE_CUSTOM_CODE) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
if (typeof candidate.organizationId !== 'string' ||
|
|
72
|
+
!candidate.organizationId) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
if (typeof candidate.exp !== 'number')
|
|
76
|
+
return null;
|
|
77
|
+
if (candidate.exp * 1000 <= now)
|
|
78
|
+
return null;
|
|
79
|
+
return candidate;
|
|
80
|
+
};
|
|
81
|
+
exports.verifyContainmentToken = verifyContainmentToken;
|
package/dist/crypto.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAU/B,eAAO,MAAM,0BAA0B,GAAI,GAAG,OAAO,WAMpD,CAAC;AAYF,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,EAAE,QAAQ,MAAM,WAS9D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,WAS1D,CAAC;AAEF,eAAO,MAAM,SAAS,GAAU,OAAO,MAAM,oBAW5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAU,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAU/B,eAAO,MAAM,0BAA0B,GAAI,GAAG,OAAO,WAMpD,CAAC;AAYF,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,EAAE,QAAQ,MAAM,WAS9D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,WAS1D,CAAC;AAEF,eAAO,MAAM,SAAS,GAAU,OAAO,MAAM,oBAW5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAU,OAAO,MAAM,oBAalD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAU,KAAK,MAAM,EAAE,SAAS,MAAM,oBAmB/D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,YAOnD,CAAC"}
|
package/dist/crypto.js
CHANGED
|
@@ -67,7 +67,10 @@ const sha256Base64Url = async (input) => {
|
|
|
67
67
|
let binary = '';
|
|
68
68
|
for (let i = 0; i < bytes.length; i++)
|
|
69
69
|
binary += String.fromCharCode(bytes[i]);
|
|
70
|
-
return btoa(binary)
|
|
70
|
+
return btoa(binary)
|
|
71
|
+
.replace(/\+/g, '-')
|
|
72
|
+
.replace(/\//g, '_')
|
|
73
|
+
.replace(/=+$/, '');
|
|
71
74
|
};
|
|
72
75
|
exports.sha256Base64Url = sha256Base64Url;
|
|
73
76
|
const hmacSha256Hex = async (key, message) => {
|
package/dist/getEnv.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEnv.d.ts","sourceRoot":"","sources":["../src/getEnv.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CACzC;AAED,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"getEnv.d.ts","sourceRoot":"","sources":["../src/getEnv.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CACzC;AAED,eAAO,MAAM,MAAM,GAAI,QAAQ,SAAS,EAAE,KAAK,MAAM,KAAG,MAAM,GAAG,SAKhE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type { WhatsappSendRequest, WhatsappSendResponse, WhatsappSendRemoteResou
|
|
|
11
11
|
import { JsonSchema } from './jsonSchemaToZodShape';
|
|
12
12
|
import type { SchemaViolation } from './jsonSchemaToZodShape';
|
|
13
13
|
import type { CustomCodeTokenPayload } from './customCodeToken';
|
|
14
|
+
import type { ContainmentTokenPayload } from './containmentToken';
|
|
14
15
|
import type { OAuthProviderConfig } from './oauthProviders';
|
|
15
16
|
import type { ExposableResource } from './exposedResource';
|
|
16
17
|
import type { CustomCodeProject, ProjectPathIssue } from './customCodeProject';
|
|
@@ -1795,6 +1796,9 @@ export declare const utils: {
|
|
|
1795
1796
|
PRICING_INCLUDED_EMBEDDED_GB: number;
|
|
1796
1797
|
PRICING_MESSAGE_PER_1K_USD: number;
|
|
1797
1798
|
PRICING_EMBEDDED_PER_GB_USD: number;
|
|
1799
|
+
PRICING_INCLUDED_TOOL_CALLS: number;
|
|
1800
|
+
PRICING_TOOL_CALL_PER_M_USD: number;
|
|
1801
|
+
PRICING_TOOL_CALL_HARD_CAP: number;
|
|
1798
1802
|
PRICING_CUSTOM_DOMAIN_USD: number;
|
|
1799
1803
|
PLAN_FEATURE_ORGANIZATION: "organization";
|
|
1800
1804
|
PLAN_FEATURE_PROJECT: "project";
|
|
@@ -1808,10 +1812,17 @@ export declare const utils: {
|
|
|
1808
1812
|
PLAN_FEATURE_RAW_STORAGE: "rawStorage";
|
|
1809
1813
|
PLAN_FEATURE_EMBEDDED_STORAGE: "embeddedStorage";
|
|
1810
1814
|
PLAN_FEATURE_MESSAGE: "message";
|
|
1815
|
+
PLAN_FEATURE_TOOL_CALL: "toolCall";
|
|
1811
1816
|
PLAN_LIMIT_ERROR_CODE: string;
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1817
|
+
BILLING_METER_MESSAGES: string;
|
|
1818
|
+
BILLING_METER_SHARED_MESSAGES: string;
|
|
1819
|
+
BILLING_METER_EMBEDDED: string;
|
|
1820
|
+
BILLING_METER_TOOL_CALLS: string;
|
|
1821
|
+
BILLING_METER_UNITS_KEY: string;
|
|
1822
|
+
POLAR_API_BASE: string;
|
|
1823
|
+
POLAR_SANDBOX_API_BASE: string;
|
|
1824
|
+
POLAR_SERVER_SANDBOX: "sandbox";
|
|
1825
|
+
POLAR_SERVER_PRODUCTION: "production";
|
|
1815
1826
|
CONSENT_DOCUMENT_TERMS: "terms";
|
|
1816
1827
|
CONSENT_DOCUMENT_PRIVACY: "privacy";
|
|
1817
1828
|
CONSENT_DOCUMENTS: ("terms" | "privacy")[];
|
|
@@ -1830,6 +1841,15 @@ export declare const utils: {
|
|
|
1830
1841
|
CRON_HOURLY: string;
|
|
1831
1842
|
CRON_ERROR_ALERTS: string;
|
|
1832
1843
|
ALERT_STATE_KEY_ERROR_LOG: string;
|
|
1844
|
+
ALERT_STATE_KEY_TOOL_CALLS: string;
|
|
1845
|
+
ALERT_TOOL_CALL_SURGE: number;
|
|
1846
|
+
ALERT_TOOL_CALL_CAP_FRACTION: number;
|
|
1847
|
+
ALERT_TOOL_CALL_COOLDOWN_HOURS: number;
|
|
1848
|
+
ALERT_TOOL_CALL_MAX_ROWS: number;
|
|
1849
|
+
CONTAINMENT_TOKEN_VERSION: string;
|
|
1850
|
+
CONTAINMENT_PURPOSE_DISABLE_CUSTOM_CODE: string;
|
|
1851
|
+
CONTAINMENT_TOKEN_TTL_MS: number;
|
|
1852
|
+
CONTAINMENT_PATH: string;
|
|
1833
1853
|
ALERT_MIN_STATUS: number;
|
|
1834
1854
|
ALERT_MAX_ROWS: number;
|
|
1835
1855
|
ALERT_MAX_GROUPS: number;
|
|
@@ -2392,6 +2412,8 @@ export declare const utils: {
|
|
|
2392
2412
|
customCodePreviewScriptName: (artifactId: string) => string;
|
|
2393
2413
|
customCodeUploadName: (artifactId: string) => string;
|
|
2394
2414
|
customCodePreviewUploadName: (artifactId: string) => string;
|
|
2415
|
+
mintContainmentToken: (organizationId: string, secret: string, issuedAt?: number, ttlMs?: number) => Promise<string>;
|
|
2416
|
+
verifyContainmentToken: (token: string, secret: string, now?: number) => Promise<ContainmentTokenPayload | null>;
|
|
2395
2417
|
oauthProviders: Record<string, OAuthProviderConfig>;
|
|
2396
2418
|
resolveAttachment: (resource: AttachmentResource, readObject: (key: string) => Promise<ArrayBuffer | null>, verb?: "attach" | "upload") => Promise<ResolveAttachmentResult>;
|
|
2397
2419
|
isExposedResource: (resource: ExposableResource) => boolean;
|
|
@@ -2888,5 +2910,5 @@ export declare const utils: {
|
|
|
2888
2910
|
PlanLimitError: typeof PlanLimitError;
|
|
2889
2911
|
isPlanLimitError: (error: unknown) => error is PlanLimitError;
|
|
2890
2912
|
};
|
|
2891
|
-
export type { MintedAccessToken, CustomCodeProject, ProjectPathIssue, CatalogGroup, CatalogTool, CatalogToolDescriptor, ToolGroupKey, ToolKey, CalendarConfigField, JsonSchema, SchemaViolation, MimeAttachment, MimeMessageInput, GmailOperation, GmailSendRequest, GmailSendResponse, OutlookOperation, OutlookSendRequest, OutlookSendResponse, SlackOperation, SlackSendRequest, SlackSendResponse, SlackSendRemoteResourceRequest, TelegramSendRequest, TelegramSendResponse, TelegramSendRemoteResourceRequest, DiscordSendRequest, DiscordSendResponse, DiscordSendRemoteResourceRequest, WhatsappSendRequest, WhatsappSendResponse, WhatsappSendRemoteResourceRequest, EnvSource, Separator, ChunkMetadata, PreparedChunk, ExtractedDocument, ExtractedDocumentMetadata, ExtractedDocumentSource, RateLimitRetryOptions, QueueBatchLike, QueueMessageLike, ProcessQueueBatchHandlers, ChannelNotifier, ToolStatusEvent, BufferedChannelMessage, ChannelBufferEnvelope, ChannelBufferFlush, Source, ResourceUrlContext, SourceButton, RefreshOAuthTokenInput, RefreshedOAuthToken, HttpEndpointToolConfig, McpProxyToolConfig, McpProxyDiscoveredTool, McpProxyDiscoveredResource, McpProxyDiscoveredPrompt, McpProxyDiscovery, CustomCodeToolConfig, CustomCodeToolManifest, CustomCodeManifest, CustomCodeSendFile, CustomCodeCreateResource, CustomCodeTokenPayload, OAuthProviderConfig, AttachmentResource, ResolvedAttachment, ResolveAttachmentResult, ExposableResource, PlanLimitDetails, PlanLimits };
|
|
2913
|
+
export type { MintedAccessToken, CustomCodeProject, ProjectPathIssue, CatalogGroup, CatalogTool, CatalogToolDescriptor, ToolGroupKey, ToolKey, CalendarConfigField, JsonSchema, SchemaViolation, MimeAttachment, MimeMessageInput, GmailOperation, GmailSendRequest, GmailSendResponse, OutlookOperation, OutlookSendRequest, OutlookSendResponse, SlackOperation, SlackSendRequest, SlackSendResponse, SlackSendRemoteResourceRequest, TelegramSendRequest, TelegramSendResponse, TelegramSendRemoteResourceRequest, DiscordSendRequest, DiscordSendResponse, DiscordSendRemoteResourceRequest, WhatsappSendRequest, WhatsappSendResponse, WhatsappSendRemoteResourceRequest, EnvSource, Separator, ChunkMetadata, PreparedChunk, ExtractedDocument, ExtractedDocumentMetadata, ExtractedDocumentSource, RateLimitRetryOptions, QueueBatchLike, QueueMessageLike, ProcessQueueBatchHandlers, ChannelNotifier, ToolStatusEvent, BufferedChannelMessage, ChannelBufferEnvelope, ChannelBufferFlush, Source, ResourceUrlContext, SourceButton, RefreshOAuthTokenInput, RefreshedOAuthToken, HttpEndpointToolConfig, McpProxyToolConfig, McpProxyDiscoveredTool, McpProxyDiscoveredResource, McpProxyDiscoveredPrompt, McpProxyDiscovery, CustomCodeToolConfig, CustomCodeToolManifest, CustomCodeManifest, CustomCodeSendFile, CustomCodeCreateResource, CustomCodeTokenPayload, ContainmentTokenPayload, OAuthProviderConfig, AttachmentResource, ResolvedAttachment, ResolveAttachmentResult, ExposableResource, PlanLimitDetails, PlanLimits };
|
|
2892
2914
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAyCvD,OAAO,KA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jB,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,EACN,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACX,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ const validateMessageVariables_1 = require("./validateMessageVariables");
|
|
|
18
18
|
const jsonSchemaToZodShape_1 = require("./jsonSchemaToZodShape");
|
|
19
19
|
const mcpProxy_1 = require("./mcpProxy");
|
|
20
20
|
const customCodeToken_1 = require("./customCodeToken");
|
|
21
|
+
const containmentToken_1 = require("./containmentToken");
|
|
21
22
|
const oauthProviders_1 = require("./oauthProviders");
|
|
22
23
|
const attachment_1 = require("./attachment");
|
|
23
24
|
const exposedResource_1 = require("./exposedResource");
|
|
@@ -93,6 +94,8 @@ exports.utils = {
|
|
|
93
94
|
customCodePreviewScriptName: customCodeToken_1.customCodePreviewScriptName,
|
|
94
95
|
customCodeUploadName: customCodeToken_1.customCodeUploadName,
|
|
95
96
|
customCodePreviewUploadName: customCodeToken_1.customCodePreviewUploadName,
|
|
97
|
+
mintContainmentToken: containmentToken_1.mintContainmentToken,
|
|
98
|
+
verifyContainmentToken: containmentToken_1.verifyContainmentToken,
|
|
96
99
|
oauthProviders: oauthProviders_1.oauthProviders,
|
|
97
100
|
resolveAttachment: attachment_1.resolveAttachment,
|
|
98
101
|
isExposedResource: exposedResource_1.isExposedResource,
|
package/dist/oauth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM;CAKzB;AAUD,eAAO,MAAM,iBAAiB,GAC5B,OAAO,sBAAsB,KAC5B,OAAO,CAAC,mBAAmB,CAsC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACxC,QAAQ,MAAM,KACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAKvB,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,KACvC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAO5B,CAAC;AAEF,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM;CAKzB;AAUD,eAAO,MAAM,iBAAiB,GAC5B,OAAO,sBAAsB,KAC5B,OAAO,CAAC,mBAAmB,CAsC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACxC,QAAQ,MAAM,KACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAKvB,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,KACvC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAO5B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,UAAU,OAAO,KAAG,OAG7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseHttpError.d.ts","sourceRoot":"","sources":["../src/parseHttpError.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"parseHttpError.d.ts","sourceRoot":"","sources":["../src/parseHttpError.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,GAChC,UAAU,QAAQ,KACjB,OAAO,CAAC,MAAM,CAehB,CAAC"}
|