lua-cli 3.53.0 → 3.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-exports.d.ts +212 -88
- package/dist/api-exports.js +682 -48
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +2840 -599
- package/dist/index.js.map +1 -1
- package/dist/voice/test/index.d.ts +97 -72
- package/dist/workflow-builder.d.ts +22 -0
- package/dist/workflow-builder.js +584 -7
- package/dist/workflow-builder.js.map +1 -1
- package/docs/API_REFERENCE.md +23 -0
- package/docs/CLI_REFERENCE.md +14 -0
- package/docs/README.md +3 -3
- package/docs/api/Data.md +19 -4
- package/docs/api/LuaTool.md +124 -82
- package/docs/api/LuaWebhook.md +1 -1
- package/package.json +3 -2
- package/template/README.md +2 -0
- package/template/package.json +1 -1
- package/template-web-app/app.ts +5 -0
- package/template-web-app/web/package.json +2 -3
- package/template-web-app/web/src/index.css +0 -2
- package/template-web-app/web/src/main.tsx +1 -9
package/dist/workflow-builder.js
CHANGED
|
@@ -1026,6 +1026,10 @@ import { z as z3 } from "zod";
|
|
|
1026
1026
|
import { z as z4 } from "zod";
|
|
1027
1027
|
import { z as z5 } from "zod";
|
|
1028
1028
|
import { z as z6 } from "zod";
|
|
1029
|
+
import { z as z7 } from "zod";
|
|
1030
|
+
import { z as z8 } from "zod";
|
|
1031
|
+
import { z as z9 } from "zod";
|
|
1032
|
+
import { z as z10 } from "zod";
|
|
1029
1033
|
var __defProp4 = Object.defineProperty;
|
|
1030
1034
|
var __name4 = /* @__PURE__ */ __name((target, value3) => __defProp4(target, "name", { value: value3, configurable: true }), "__name");
|
|
1031
1035
|
var PLUMBING_THREAD_CHANNELS = [
|
|
@@ -1344,6 +1348,7 @@ var INTEGRATION_PASSTHROUGH_READ_METHODS = [
|
|
|
1344
1348
|
"GET",
|
|
1345
1349
|
"HEAD"
|
|
1346
1350
|
];
|
|
1351
|
+
var INTEGRATION_PASSTHROUGH_MAX_BASE64_RESPONSE_BYTES = 25 * 1024 * 1024;
|
|
1347
1352
|
function isIntegrationPassthroughReadMethod(method) {
|
|
1348
1353
|
return typeof method === "string" && INTEGRATION_PASSTHROUGH_READ_METHODS.includes(method.toUpperCase());
|
|
1349
1354
|
}
|
|
@@ -5105,6 +5110,24 @@ function sanitizeProgressUpdateInput(input) {
|
|
|
5105
5110
|
}
|
|
5106
5111
|
__name(sanitizeProgressUpdateInput, "sanitizeProgressUpdateInput");
|
|
5107
5112
|
__name4(sanitizeProgressUpdateInput, "sanitizeProgressUpdateInput");
|
|
5113
|
+
function agentIdentityError(code, message, statusCode) {
|
|
5114
|
+
return Object.assign(new Error(message), {
|
|
5115
|
+
name: "AgentIdentityError",
|
|
5116
|
+
code,
|
|
5117
|
+
...typeof statusCode === "number" ? {
|
|
5118
|
+
statusCode
|
|
5119
|
+
} : {}
|
|
5120
|
+
});
|
|
5121
|
+
}
|
|
5122
|
+
__name(agentIdentityError, "agentIdentityError");
|
|
5123
|
+
__name4(agentIdentityError, "agentIdentityError");
|
|
5124
|
+
function readAgentIdentityAudience(input) {
|
|
5125
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) return null;
|
|
5126
|
+
const audience = input.audience;
|
|
5127
|
+
return typeof audience === "string" && audience.length > 0 && audience.length <= 200 ? audience : null;
|
|
5128
|
+
}
|
|
5129
|
+
__name(readAgentIdentityAudience, "readAgentIdentityAudience");
|
|
5130
|
+
__name4(readAgentIdentityAudience, "readAgentIdentityAudience");
|
|
5108
5131
|
function toEpochMs(value3) {
|
|
5109
5132
|
if (value3 === null || value3 === void 0) return void 0;
|
|
5110
5133
|
const ms = value3 instanceof Date ? value3.getTime() : typeof value3 === "number" ? value3 : Date.parse(value3);
|
|
@@ -6479,6 +6502,12 @@ function removeHiddenBlocks(input) {
|
|
|
6479
6502
|
}
|
|
6480
6503
|
__name(removeHiddenBlocks, "removeHiddenBlocks");
|
|
6481
6504
|
__name4(removeHiddenBlocks, "removeHiddenBlocks");
|
|
6505
|
+
function stripBlocksKeepingEdges(input, names) {
|
|
6506
|
+
const stripped = stripBlocks(input, names);
|
|
6507
|
+
return stripped === input ? input : stripped.trim();
|
|
6508
|
+
}
|
|
6509
|
+
__name(stripBlocksKeepingEdges, "stripBlocksKeepingEdges");
|
|
6510
|
+
__name4(stripBlocksKeepingEdges, "stripBlocksKeepingEdges");
|
|
6482
6511
|
function startsWithHiddenBlock(input) {
|
|
6483
6512
|
const [first] = splitBlocks(input);
|
|
6484
6513
|
return first?.type === "block" && first.name === "hide";
|
|
@@ -6570,8 +6599,10 @@ function transformChatHistoryContentParts(parts) {
|
|
|
6570
6599
|
}
|
|
6571
6600
|
if (part?.type !== "text" && part?.type !== "file") continue;
|
|
6572
6601
|
if (part.type === "text" && typeof part.text === "string") {
|
|
6573
|
-
const rawText =
|
|
6574
|
-
|
|
6602
|
+
const rawText = stripBlocksKeepingEdges(part.text || "", [
|
|
6603
|
+
"hide"
|
|
6604
|
+
]);
|
|
6605
|
+
if (!rawText.trim()) continue;
|
|
6575
6606
|
const audioMatch = rawText.match(/::: audio\s*!\[(.*?)\]\((.*?)\)\s*:::/);
|
|
6576
6607
|
const videoMatch = rawText.match(/::: video\s*!\[(.*?)\]\((.*?)\)\s*:::/);
|
|
6577
6608
|
if (audioMatch) {
|
|
@@ -6588,7 +6619,9 @@ function transformChatHistoryContentParts(parts) {
|
|
|
6588
6619
|
});
|
|
6589
6620
|
} else {
|
|
6590
6621
|
let text2 = rawText.replace(/\\\\\\n/g, "\n");
|
|
6591
|
-
text2 =
|
|
6622
|
+
text2 = stripBlocksKeepingEdges(text2, [
|
|
6623
|
+
"navigate"
|
|
6624
|
+
]);
|
|
6592
6625
|
content.push({
|
|
6593
6626
|
type: "text",
|
|
6594
6627
|
text: text2
|
|
@@ -6669,6 +6702,15 @@ function mergeRichPartMirrorMessages(messages, sameTurnGroup) {
|
|
|
6669
6702
|
break;
|
|
6670
6703
|
}
|
|
6671
6704
|
if (folded) continue;
|
|
6705
|
+
const content = message.content.filter((part) => part.type !== "data-lua-tool-step" && part.type !== "data-lua-reasoning-time" && part.type !== "data-lua-reply-timing");
|
|
6706
|
+
if (content.length === 0) continue;
|
|
6707
|
+
if (content.length !== message.content.length) {
|
|
6708
|
+
merged.push({
|
|
6709
|
+
...message,
|
|
6710
|
+
content
|
|
6711
|
+
});
|
|
6712
|
+
continue;
|
|
6713
|
+
}
|
|
6672
6714
|
}
|
|
6673
6715
|
merged.push(message);
|
|
6674
6716
|
}
|
|
@@ -6722,6 +6764,61 @@ function foldRichPartsIntoMessages(messages, records, makeMessage, sameTurnGroup
|
|
|
6722
6764
|
}
|
|
6723
6765
|
__name(foldRichPartsIntoMessages, "foldRichPartsIntoMessages");
|
|
6724
6766
|
__name4(foldRichPartsIntoMessages, "foldRichPartsIntoMessages");
|
|
6767
|
+
function readStoredReplyVersion(metadata) {
|
|
6768
|
+
const md = metadata && typeof metadata === "object" ? metadata : void 0;
|
|
6769
|
+
const value3 = md?.replyVersion;
|
|
6770
|
+
const stamp = value3 && typeof value3.group === "string" && value3.group && typeof value3.index === "number" && Number.isInteger(value3.index) && value3.index >= 1 ? {
|
|
6771
|
+
group: value3.group,
|
|
6772
|
+
index: value3.index
|
|
6773
|
+
} : null;
|
|
6774
|
+
return {
|
|
6775
|
+
stamp,
|
|
6776
|
+
inactive: md?.inactiveVersion === true
|
|
6777
|
+
};
|
|
6778
|
+
}
|
|
6779
|
+
__name(readStoredReplyVersion, "readStoredReplyVersion");
|
|
6780
|
+
__name4(readStoredReplyVersion, "readStoredReplyVersion");
|
|
6781
|
+
function applyReplyVersions(messages, markOf, includeVersions) {
|
|
6782
|
+
const blocks = [];
|
|
6783
|
+
const indicesByGroup = /* @__PURE__ */ new Map();
|
|
6784
|
+
let current = null;
|
|
6785
|
+
for (const message of messages) {
|
|
6786
|
+
const mark = markOf(message);
|
|
6787
|
+
if (message.role === "user") {
|
|
6788
|
+
current = mark?.stamp ? {
|
|
6789
|
+
...mark.stamp,
|
|
6790
|
+
inactive: mark.inactive
|
|
6791
|
+
} : null;
|
|
6792
|
+
if (current) {
|
|
6793
|
+
const seen = indicesByGroup.get(current.group) ?? /* @__PURE__ */ new Set();
|
|
6794
|
+
seen.add(current.index);
|
|
6795
|
+
indicesByGroup.set(current.group, seen);
|
|
6796
|
+
}
|
|
6797
|
+
}
|
|
6798
|
+
blocks.push(current);
|
|
6799
|
+
}
|
|
6800
|
+
const out = [];
|
|
6801
|
+
messages.forEach((message, i) => {
|
|
6802
|
+
const block = blocks[i];
|
|
6803
|
+
if (!block) {
|
|
6804
|
+
out.push(message);
|
|
6805
|
+
return;
|
|
6806
|
+
}
|
|
6807
|
+
if (block.inactive && !includeVersions) return;
|
|
6808
|
+
out.push({
|
|
6809
|
+
...message,
|
|
6810
|
+
replyVersion: {
|
|
6811
|
+
group: block.group,
|
|
6812
|
+
index: block.index,
|
|
6813
|
+
total: indicesByGroup.get(block.group)?.size ?? 1,
|
|
6814
|
+
active: !block.inactive
|
|
6815
|
+
}
|
|
6816
|
+
});
|
|
6817
|
+
});
|
|
6818
|
+
return out;
|
|
6819
|
+
}
|
|
6820
|
+
__name(applyReplyVersions, "applyReplyVersions");
|
|
6821
|
+
__name4(applyReplyVersions, "applyReplyVersions");
|
|
6725
6822
|
var WORK_ITEMS_KEY = "_luaWorkItems";
|
|
6726
6823
|
var MAX_WORK_ITEMS = 100;
|
|
6727
6824
|
var LIMITS = {
|
|
@@ -11843,7 +11940,44 @@ function composeAgentPaneRuntimeContext(input) {
|
|
|
11843
11940
|
__name(composeAgentPaneRuntimeContext, "composeAgentPaneRuntimeContext");
|
|
11844
11941
|
__name4(composeAgentPaneRuntimeContext, "composeAgentPaneRuntimeContext");
|
|
11845
11942
|
var WEB_APP_ENTRY_HTML_MAX_CHARS = 256 * 1024;
|
|
11943
|
+
var WEB_APP_MAX_ASSETS = 1e3;
|
|
11846
11944
|
var WEB_APP_MAX_ASSET_BYTES = 8 * 1024 * 1024;
|
|
11945
|
+
var WEB_APP_HEALTH_KEY_TTL_SECONDS = 15 * 60;
|
|
11946
|
+
var WEB_APP_HEALTH_MIN_FAILURES = 3;
|
|
11947
|
+
var WEB_APP_HEALTH_MIN_FAILURE_RATIO = 0.5;
|
|
11948
|
+
function webAppHealthMinute(atMs) {
|
|
11949
|
+
return Math.floor(atMs / 6e4);
|
|
11950
|
+
}
|
|
11951
|
+
__name(webAppHealthMinute, "webAppHealthMinute");
|
|
11952
|
+
__name4(webAppHealthMinute, "webAppHealthMinute");
|
|
11953
|
+
function webAppHealthKey(webAppId, minute) {
|
|
11954
|
+
return `webapp:health:${webAppId}:${minute}`;
|
|
11955
|
+
}
|
|
11956
|
+
__name(webAppHealthKey, "webAppHealthKey");
|
|
11957
|
+
__name4(webAppHealthKey, "webAppHealthKey");
|
|
11958
|
+
function webAppHealthVerdict(minutes) {
|
|
11959
|
+
let requests = 0;
|
|
11960
|
+
let failures = 0;
|
|
11961
|
+
let firstFailingMinute;
|
|
11962
|
+
for (const m of minutes) {
|
|
11963
|
+
const r = Math.max(0, m.requests || 0);
|
|
11964
|
+
const f = Math.max(0, Math.min(m.failures || 0, r));
|
|
11965
|
+
requests += r;
|
|
11966
|
+
failures += f;
|
|
11967
|
+
if (f > 0 && (firstFailingMinute === void 0 || m.minute < firstFailingMinute)) firstFailingMinute = m.minute;
|
|
11968
|
+
}
|
|
11969
|
+
if (failures >= WEB_APP_HEALTH_MIN_FAILURES && failures >= requests * WEB_APP_HEALTH_MIN_FAILURE_RATIO) {
|
|
11970
|
+
return {
|
|
11971
|
+
state: "needs_attention",
|
|
11972
|
+
since: new Date(firstFailingMinute * 6e4)
|
|
11973
|
+
};
|
|
11974
|
+
}
|
|
11975
|
+
return {
|
|
11976
|
+
state: "ok"
|
|
11977
|
+
};
|
|
11978
|
+
}
|
|
11979
|
+
__name(webAppHealthVerdict, "webAppHealthVerdict");
|
|
11980
|
+
__name4(webAppHealthVerdict, "webAppHealthVerdict");
|
|
11847
11981
|
var EVIDENCE_SESSION_IDLE_MS = 30 * 6e4;
|
|
11848
11982
|
var EVIDENCE_MIN_CONVERSATIONS = 20;
|
|
11849
11983
|
var EVIDENCE_LOW_CONFIDENCE_N = 5;
|
|
@@ -13005,13 +13139,15 @@ function parseConnectionSendPolicy(value3) {
|
|
|
13005
13139
|
__name(parseConnectionSendPolicy, "parseConnectionSendPolicy");
|
|
13006
13140
|
__name4(parseConnectionSendPolicy, "parseConnectionSendPolicy");
|
|
13007
13141
|
var BILLING_REJECTION_TEXT_CREDITS = "This agent has run out of credits. Please top up to continue chatting.";
|
|
13142
|
+
var BILLING_REJECTION_TEXT_OUT_OF_ACTIONS = "This workspace is out of actions. A workspace owner or billing admin can top up or upgrade the plan to continue.";
|
|
13008
13143
|
var BILLING_REJECTION_TEXT_SEAT = "You don't have access to this agent in this workspace. Ask a workspace admin to add you.";
|
|
13009
13144
|
var BILLING_REJECTION_TEXT_USER_QUOTA = "You've reached your monthly usage limit in this workspace. Ask a workspace admin to raise it.";
|
|
13010
13145
|
function isPaymentRequiredChatErrorEnvelope(data) {
|
|
13011
13146
|
if (!data || typeof data !== "object") return false;
|
|
13012
13147
|
const d = data;
|
|
13013
13148
|
if (d.type !== "error") return false;
|
|
13014
|
-
|
|
13149
|
+
if (d.code === "OUT_OF_ACTIONS") return true;
|
|
13150
|
+
return d.textDelta === BILLING_REJECTION_TEXT_CREDITS || d.textDelta === BILLING_REJECTION_TEXT_OUT_OF_ACTIONS || d.textDelta === BILLING_REJECTION_TEXT_SEAT || d.textDelta === BILLING_REJECTION_TEXT_USER_QUOTA;
|
|
13015
13151
|
}
|
|
13016
13152
|
__name(isPaymentRequiredChatErrorEnvelope, "isPaymentRequiredChatErrorEnvelope");
|
|
13017
13153
|
__name4(isPaymentRequiredChatErrorEnvelope, "isPaymentRequiredChatErrorEnvelope");
|
|
@@ -13599,6 +13735,74 @@ var customMcpMountUpsertBodySchema = z6.object({
|
|
|
13599
13735
|
}).strict().optional(),
|
|
13600
13736
|
timeout: customMcpTimeoutSchema.optional()
|
|
13601
13737
|
}).strict();
|
|
13738
|
+
var opaque = z7.record(z7.unknown());
|
|
13739
|
+
var summaryHash = z7.string().regex(/^[0-9a-f]{64}$/);
|
|
13740
|
+
var defaultWebAppBriefRequestSchema = z7.object({
|
|
13741
|
+
agentId: z7.string().min(1).max(200),
|
|
13742
|
+
orgId: z7.string().min(1).max(200).optional(),
|
|
13743
|
+
/** A rebuild: the brief the app was built from. The new brief keeps its entity, fields and statuses. */
|
|
13744
|
+
previous: z7.object({
|
|
13745
|
+
brief: opaque
|
|
13746
|
+
}).optional(),
|
|
13747
|
+
/**
|
|
13748
|
+
* Another agent's brief (same template id + version) and the `summaryHash` it was made from. Used without a model
|
|
13749
|
+
* call only when the hash equals this agent's, its schema version is current and it is valid here; else ignored.
|
|
13750
|
+
*/
|
|
13751
|
+
reuse: z7.object({
|
|
13752
|
+
brief: opaque,
|
|
13753
|
+
summaryHash
|
|
13754
|
+
}).optional()
|
|
13755
|
+
});
|
|
13756
|
+
var DEFAULT_WEB_APP_BRIEF_SOURCES = [
|
|
13757
|
+
"model",
|
|
13758
|
+
"fallback",
|
|
13759
|
+
"reused",
|
|
13760
|
+
"previous"
|
|
13761
|
+
];
|
|
13762
|
+
var defaultWebAppBriefUsageSchema = z7.object({
|
|
13763
|
+
inputTokens: z7.number().nonnegative(),
|
|
13764
|
+
outputTokens: z7.number().nonnegative(),
|
|
13765
|
+
cacheReadTokens: z7.number().nonnegative(),
|
|
13766
|
+
cacheWriteTokens: z7.number().nonnegative()
|
|
13767
|
+
});
|
|
13768
|
+
var briefResponseBase = z7.object({
|
|
13769
|
+
source: z7.enum(DEFAULT_WEB_APP_BRIEF_SOURCES),
|
|
13770
|
+
brief: opaque,
|
|
13771
|
+
names: opaque,
|
|
13772
|
+
capabilitySignature: z7.string().min(1),
|
|
13773
|
+
model: z7.string().optional(),
|
|
13774
|
+
usage: defaultWebAppBriefUsageSchema,
|
|
13775
|
+
costUsd: z7.number().nonnegative()
|
|
13776
|
+
});
|
|
13777
|
+
var defaultWebAppBriefResponseSchema = z7.discriminatedUnion("reusable", [
|
|
13778
|
+
briefResponseBase.extend({
|
|
13779
|
+
reusable: z7.literal(true),
|
|
13780
|
+
summaryHash
|
|
13781
|
+
}),
|
|
13782
|
+
briefResponseBase.extend({
|
|
13783
|
+
reusable: z7.literal(false)
|
|
13784
|
+
})
|
|
13785
|
+
]);
|
|
13786
|
+
var defaultWebAppBriefKeyRequestSchema = z7.object({
|
|
13787
|
+
agentId: z7.string().min(1).max(200)
|
|
13788
|
+
});
|
|
13789
|
+
var defaultWebAppBriefKeyResponseSchema = z7.object({
|
|
13790
|
+
summaryHash,
|
|
13791
|
+
schemaVersion: z7.number().int().positive()
|
|
13792
|
+
});
|
|
13793
|
+
var DEFAULT_WEB_APP_BRIEF_ERROR_CODES = [
|
|
13794
|
+
"AGENT_NOT_FOUND",
|
|
13795
|
+
"BRIEF_INVALID",
|
|
13796
|
+
"BRIEF_UNAVAILABLE"
|
|
13797
|
+
];
|
|
13798
|
+
var defaultWebAppBriefErrorSchema = z7.object({
|
|
13799
|
+
code: z7.enum(DEFAULT_WEB_APP_BRIEF_ERROR_CODES),
|
|
13800
|
+
message: z7.string().optional(),
|
|
13801
|
+
problems: z7.array(z7.string()).optional(),
|
|
13802
|
+
model: z7.string().optional(),
|
|
13803
|
+
usage: defaultWebAppBriefUsageSchema.optional(),
|
|
13804
|
+
costUsd: z7.number().nonnegative().optional()
|
|
13805
|
+
});
|
|
13602
13806
|
function maskMcpServerHeaders(server) {
|
|
13603
13807
|
const { headers, ...rest } = server;
|
|
13604
13808
|
const headerNames = Object.keys(headers ?? {});
|
|
@@ -13621,10 +13825,383 @@ function isSharedDataOwnerKey(agentId2) {
|
|
|
13621
13825
|
}
|
|
13622
13826
|
__name(isSharedDataOwnerKey, "isSharedDataOwnerKey");
|
|
13623
13827
|
__name4(isSharedDataOwnerKey, "isSharedDataOwnerKey");
|
|
13828
|
+
var PLAN_KEYS = {
|
|
13829
|
+
agents: {
|
|
13830
|
+
kind: "limit",
|
|
13831
|
+
default: null,
|
|
13832
|
+
label: "Agents"
|
|
13833
|
+
},
|
|
13834
|
+
members: {
|
|
13835
|
+
kind: "limit",
|
|
13836
|
+
default: null,
|
|
13837
|
+
label: "Members"
|
|
13838
|
+
},
|
|
13839
|
+
rooms: {
|
|
13840
|
+
kind: "limit",
|
|
13841
|
+
default: null,
|
|
13842
|
+
label: "Rooms"
|
|
13843
|
+
},
|
|
13844
|
+
externalShares: {
|
|
13845
|
+
kind: "limit",
|
|
13846
|
+
default: null,
|
|
13847
|
+
label: "Shares outside the workspace"
|
|
13848
|
+
},
|
|
13849
|
+
viewsPerAgent: {
|
|
13850
|
+
kind: "limit",
|
|
13851
|
+
default: null,
|
|
13852
|
+
label: "Views per agent"
|
|
13853
|
+
},
|
|
13854
|
+
freeWorkspacesPerPerson: {
|
|
13855
|
+
kind: "limit",
|
|
13856
|
+
default: null,
|
|
13857
|
+
label: "Free workspaces per person"
|
|
13858
|
+
},
|
|
13859
|
+
shareOutsideWorkspace: {
|
|
13860
|
+
kind: "feature",
|
|
13861
|
+
default: true,
|
|
13862
|
+
label: "Share outside the workspace"
|
|
13863
|
+
},
|
|
13864
|
+
roomsEnabled: {
|
|
13865
|
+
kind: "feature",
|
|
13866
|
+
default: true,
|
|
13867
|
+
label: "Rooms with agents"
|
|
13868
|
+
},
|
|
13869
|
+
comments: {
|
|
13870
|
+
kind: "feature",
|
|
13871
|
+
default: true,
|
|
13872
|
+
label: "Comments"
|
|
13873
|
+
},
|
|
13874
|
+
snapshots: {
|
|
13875
|
+
kind: "feature",
|
|
13876
|
+
default: true,
|
|
13877
|
+
label: "Snapshots"
|
|
13878
|
+
},
|
|
13879
|
+
topUps: {
|
|
13880
|
+
kind: "feature",
|
|
13881
|
+
default: true,
|
|
13882
|
+
label: "Top-ups"
|
|
13883
|
+
},
|
|
13884
|
+
deployAgents: {
|
|
13885
|
+
kind: "feature",
|
|
13886
|
+
default: true,
|
|
13887
|
+
label: "Deploy agents to production"
|
|
13888
|
+
}
|
|
13889
|
+
};
|
|
13890
|
+
var PLAN_LIMIT_KEYS = Object.keys(PLAN_KEYS).filter((k) => PLAN_KEYS[k].kind === "limit");
|
|
13891
|
+
var PLAN_FEATURE_KEYS = Object.keys(PLAN_KEYS).filter((k) => PLAN_KEYS[k].kind === "feature");
|
|
13892
|
+
var BILLING_ENGINES = [
|
|
13893
|
+
"actions",
|
|
13894
|
+
"credits"
|
|
13895
|
+
];
|
|
13896
|
+
var BILLING_VERSION_KINDS = [
|
|
13897
|
+
"catalog",
|
|
13898
|
+
"custom"
|
|
13899
|
+
];
|
|
13900
|
+
var planKeyString = z8.string().regex(/^[a-z0-9][a-z0-9-]{0,47}$/, "lowercase letters, digits and dashes");
|
|
13901
|
+
var planPriceSchema = z8.object({
|
|
13902
|
+
amountUsd: z8.number().nonnegative(),
|
|
13903
|
+
interval: z8.enum([
|
|
13904
|
+
"month",
|
|
13905
|
+
"year"
|
|
13906
|
+
]),
|
|
13907
|
+
per: z8.enum([
|
|
13908
|
+
"workspace",
|
|
13909
|
+
"seat"
|
|
13910
|
+
])
|
|
13911
|
+
}).strict();
|
|
13912
|
+
var limitsShape = Object.fromEntries(PLAN_LIMIT_KEYS.map((k) => [
|
|
13913
|
+
k,
|
|
13914
|
+
z8.number().int().nonnegative().nullable().optional()
|
|
13915
|
+
]));
|
|
13916
|
+
var featuresShape = Object.fromEntries(PLAN_FEATURE_KEYS.map((k) => [
|
|
13917
|
+
k,
|
|
13918
|
+
z8.boolean().optional()
|
|
13919
|
+
]));
|
|
13920
|
+
var billingPlanSchema = z8.object({
|
|
13921
|
+
key: planKeyString,
|
|
13922
|
+
name: z8.string().min(1).max(80),
|
|
13923
|
+
/** Absent = a workspace plan. An agent-team plan prices a hired team; it sets no limits or features. */
|
|
13924
|
+
kind: z8.enum([
|
|
13925
|
+
"workspace",
|
|
13926
|
+
"agent-team"
|
|
13927
|
+
]).optional(),
|
|
13928
|
+
tagline: z8.string().max(200).optional(),
|
|
13929
|
+
visible: z8.boolean(),
|
|
13930
|
+
order: z8.number().int(),
|
|
13931
|
+
price: planPriceSchema.nullable(),
|
|
13932
|
+
stripeProductId: z8.string().optional(),
|
|
13933
|
+
stripePriceId: z8.string().optional(),
|
|
13934
|
+
actionsPerPeriod: z8.number().int().nonnegative(),
|
|
13935
|
+
trialDays: z8.number().int().nonnegative().optional(),
|
|
13936
|
+
limits: z8.object(limitsShape).strict(),
|
|
13937
|
+
features: z8.object(featuresShape).strict(),
|
|
13938
|
+
invoice: z8.object({
|
|
13939
|
+
collectionMode: z8.enum([
|
|
13940
|
+
"card",
|
|
13941
|
+
"invoice"
|
|
13942
|
+
]),
|
|
13943
|
+
dueDays: z8.number().int().nonnegative(),
|
|
13944
|
+
lines: z8.array(z8.object({
|
|
13945
|
+
description: z8.string().min(1),
|
|
13946
|
+
amountUsd: z8.number().nonnegative()
|
|
13947
|
+
}).strict())
|
|
13948
|
+
}).strict().optional()
|
|
13949
|
+
}).strict();
|
|
13950
|
+
var topUpPackSchema = z8.object({
|
|
13951
|
+
key: planKeyString,
|
|
13952
|
+
name: z8.string().min(1).max(80),
|
|
13953
|
+
priceUsd: z8.number().positive(),
|
|
13954
|
+
actions: z8.number().int().positive(),
|
|
13955
|
+
stripeProductId: z8.string().optional(),
|
|
13956
|
+
stripePriceId: z8.string().optional()
|
|
13957
|
+
}).strict();
|
|
13958
|
+
function resolvePlanEntitlements(plan) {
|
|
13959
|
+
const limits = {};
|
|
13960
|
+
for (const k of PLAN_LIMIT_KEYS) {
|
|
13961
|
+
const v = plan.limits[k];
|
|
13962
|
+
limits[k] = v === void 0 ? PLAN_KEYS[k].default : v;
|
|
13963
|
+
}
|
|
13964
|
+
const features = {};
|
|
13965
|
+
for (const k of PLAN_FEATURE_KEYS) {
|
|
13966
|
+
const v = plan.features[k];
|
|
13967
|
+
features[k] = v === void 0 ? PLAN_KEYS[k].default : v;
|
|
13968
|
+
}
|
|
13969
|
+
return {
|
|
13970
|
+
limits,
|
|
13971
|
+
features
|
|
13972
|
+
};
|
|
13973
|
+
}
|
|
13974
|
+
__name(resolvePlanEntitlements, "resolvePlanEntitlements");
|
|
13975
|
+
__name4(resolvePlanEntitlements, "resolvePlanEntitlements");
|
|
13976
|
+
var PLAN_REFUSAL_CODES = [
|
|
13977
|
+
"PLAN_LIMIT_REACHED",
|
|
13978
|
+
"PLAN_FEATURE_LOCKED",
|
|
13979
|
+
"OUT_OF_ACTIONS"
|
|
13980
|
+
];
|
|
13981
|
+
function isPlanRefusal(body) {
|
|
13982
|
+
if (!body || typeof body !== "object") return false;
|
|
13983
|
+
const code = body.code;
|
|
13984
|
+
return typeof code === "string" && PLAN_REFUSAL_CODES.includes(code);
|
|
13985
|
+
}
|
|
13986
|
+
__name(isPlanRefusal, "isPlanRefusal");
|
|
13987
|
+
__name4(isPlanRefusal, "isPlanRefusal");
|
|
13988
|
+
var billingSignupConfigSchema = z8.object({
|
|
13989
|
+
enabled: z8.boolean(),
|
|
13990
|
+
defaultVersionKey: z8.string().min(1).nullable(),
|
|
13991
|
+
allowlistEmails: z8.array(z8.string().email().toLowerCase()).max(500),
|
|
13992
|
+
friendsPlan: z8.object({
|
|
13993
|
+
versionKey: z8.string().min(1),
|
|
13994
|
+
planKey: planKeyString
|
|
13995
|
+
}).strict().nullable()
|
|
13996
|
+
}).strict();
|
|
13997
|
+
var billingVersionDraftPatchSchema = z8.object({
|
|
13998
|
+
revision: z8.number().int().nonnegative().optional(),
|
|
13999
|
+
name: z8.string().min(1).max(80).optional(),
|
|
14000
|
+
kind: z8.enum(BILLING_VERSION_KINDS).optional(),
|
|
14001
|
+
engine: z8.enum(BILLING_ENGINES).optional(),
|
|
14002
|
+
defaultPlanKey: z8.string().optional(),
|
|
14003
|
+
plans: z8.array(billingPlanSchema).optional(),
|
|
14004
|
+
topUpPacks: z8.array(topUpPackSchema).optional(),
|
|
14005
|
+
forOrgIds: z8.array(z8.string().min(1)).optional(),
|
|
14006
|
+
legacyCheckout: z8.boolean().optional(),
|
|
14007
|
+
voiceAndDelegationAsActions: z8.boolean().optional(),
|
|
14008
|
+
notes: z8.string().max(2e3).optional()
|
|
14009
|
+
}).strict();
|
|
14010
|
+
var billingVersionDraftCreateSchema = billingVersionDraftPatchSchema.extend({
|
|
14011
|
+
key: z8.string().min(2),
|
|
14012
|
+
copyFrom: z8.string().optional()
|
|
14013
|
+
}).strict();
|
|
14014
|
+
var EXISTING_SUBSCRIPTION_POLICIES = [
|
|
14015
|
+
"keep",
|
|
14016
|
+
"next-renewal"
|
|
14017
|
+
];
|
|
14018
|
+
var billingVersionEditSchema = billingVersionDraftPatchSchema.extend({
|
|
14019
|
+
existingSubscriptions: z8.enum(EXISTING_SUBSCRIPTION_POLICIES).optional()
|
|
14020
|
+
}).strict();
|
|
14021
|
+
var assignBillingPlanSchema = z8.object({
|
|
14022
|
+
versionKey: z8.string().min(1),
|
|
14023
|
+
planKey: z8.string().optional()
|
|
14024
|
+
}).strict();
|
|
14025
|
+
function planKeyList() {
|
|
14026
|
+
return Object.keys(PLAN_KEYS).map((key) => ({
|
|
14027
|
+
key,
|
|
14028
|
+
kind: PLAN_KEYS[key].kind,
|
|
14029
|
+
label: PLAN_KEYS[key].label,
|
|
14030
|
+
default: PLAN_KEYS[key].default
|
|
14031
|
+
}));
|
|
14032
|
+
}
|
|
14033
|
+
__name(planKeyList, "planKeyList");
|
|
14034
|
+
__name4(planKeyList, "planKeyList");
|
|
14035
|
+
function parseWith(schema, body) {
|
|
14036
|
+
const r = schema.safeParse(body);
|
|
14037
|
+
return r.success ? {
|
|
14038
|
+
ok: true,
|
|
14039
|
+
data: r.data
|
|
14040
|
+
} : {
|
|
14041
|
+
ok: false,
|
|
14042
|
+
problems: r.error.issues.map((i) => `${i.path.join(".")} ${i.message}`)
|
|
14043
|
+
};
|
|
14044
|
+
}
|
|
14045
|
+
__name(parseWith, "parseWith");
|
|
14046
|
+
__name4(parseWith, "parseWith");
|
|
14047
|
+
var billingActionRatesSchema = z8.object({
|
|
14048
|
+
voiceActionsPerMinute: z8.number().nonnegative()
|
|
14049
|
+
}).strict();
|
|
14050
|
+
var BILLING_MOVE_DEFAULT_NOTICE_DAYS = 90;
|
|
14051
|
+
var BILLING_MOVE_NOTICE_KINDS = [
|
|
14052
|
+
"scheduled",
|
|
14053
|
+
"reminder",
|
|
14054
|
+
"done"
|
|
14055
|
+
];
|
|
14056
|
+
var BILLING_MOVE_WHEN = [
|
|
14057
|
+
"notice",
|
|
14058
|
+
"now"
|
|
14059
|
+
];
|
|
14060
|
+
var keyString = z9.string().regex(/^[a-z0-9][a-z0-9-]{1,63}$/, "lowercase letters, digits and dashes");
|
|
14061
|
+
var emailTextSchema = z9.object({
|
|
14062
|
+
subject: z9.string().trim().min(1).max(200).optional(),
|
|
14063
|
+
title: z9.string().trim().min(1).max(200).optional(),
|
|
14064
|
+
body: z9.string().trim().min(1).max(2e3).optional()
|
|
14065
|
+
}).strict();
|
|
14066
|
+
var billingMoveDraftSchema = z9.object({
|
|
14067
|
+
key: keyString,
|
|
14068
|
+
name: z9.string().min(1).max(120),
|
|
14069
|
+
fromVersionKey: keyString,
|
|
14070
|
+
toVersionKey: keyString,
|
|
14071
|
+
/** Every plan of the source version → a plan of the target version. */
|
|
14072
|
+
planMap: z9.record(z9.string().min(1), z9.string().min(1)),
|
|
14073
|
+
noticeDays: z9.number().int().min(0).max(730).default(BILLING_MOVE_DEFAULT_NOTICE_DAYS),
|
|
14074
|
+
/** Absent ⇒ every org on the source version. */
|
|
14075
|
+
orgIds: z9.array(z9.string().min(1)).max(1e4).optional(),
|
|
14076
|
+
excludeOrgIds: z9.array(z9.string().min(1)).max(1e4).default([]),
|
|
14077
|
+
notes: z9.string().max(2e3).optional(),
|
|
14078
|
+
/** Actions per leftover credit when a credits version moves to an actions version; required then. */
|
|
14079
|
+
creditsToActionsRate: z9.number().positive().max(1e4).optional(),
|
|
14080
|
+
when: z9.enum(BILLING_MOVE_WHEN).default("notice"),
|
|
14081
|
+
/** Which owner emails this move sends; all off sends nothing. */
|
|
14082
|
+
emails: z9.object({
|
|
14083
|
+
scheduled: z9.boolean(),
|
|
14084
|
+
reminder: z9.boolean(),
|
|
14085
|
+
done: z9.boolean()
|
|
14086
|
+
}).strict().default({
|
|
14087
|
+
scheduled: true,
|
|
14088
|
+
reminder: true,
|
|
14089
|
+
done: true
|
|
14090
|
+
}),
|
|
14091
|
+
/** Staff wording per email, replacing ours; the list of what changes is always added. */
|
|
14092
|
+
emailText: z9.object({
|
|
14093
|
+
scheduled: emailTextSchema.optional(),
|
|
14094
|
+
reminder: emailTextSchema.optional(),
|
|
14095
|
+
done: emailTextSchema.optional()
|
|
14096
|
+
}).strict().optional()
|
|
14097
|
+
}).strict().refine((m) => m.fromVersionKey !== m.toVersionKey, {
|
|
14098
|
+
message: "source and target version must differ"
|
|
14099
|
+
});
|
|
14100
|
+
var billingMovePatchSchema = z9.object({
|
|
14101
|
+
name: z9.string().min(1).max(120).optional(),
|
|
14102
|
+
noticeDays: z9.number().int().min(0).max(730).optional(),
|
|
14103
|
+
when: z9.enum(BILLING_MOVE_WHEN).optional(),
|
|
14104
|
+
emails: z9.object({
|
|
14105
|
+
scheduled: z9.boolean(),
|
|
14106
|
+
reminder: z9.boolean(),
|
|
14107
|
+
done: z9.boolean()
|
|
14108
|
+
}).strict().optional(),
|
|
14109
|
+
emailText: z9.object({
|
|
14110
|
+
scheduled: emailTextSchema.optional(),
|
|
14111
|
+
reminder: emailTextSchema.optional(),
|
|
14112
|
+
done: emailTextSchema.optional()
|
|
14113
|
+
}).strict().optional(),
|
|
14114
|
+
notes: z9.string().max(2e3).optional()
|
|
14115
|
+
}).strict();
|
|
14116
|
+
var billingMoveOrgDateSchema = z9.object({
|
|
14117
|
+
effectiveAt: z9.coerce.date()
|
|
14118
|
+
}).strict();
|
|
14119
|
+
var billingMoveEmailPreviewSchema = z9.object({
|
|
14120
|
+
orgId: z9.string().min(1).optional(),
|
|
14121
|
+
kind: z9.enum(BILLING_MOVE_NOTICE_KINDS),
|
|
14122
|
+
/** Unsaved wording to try, so the dialog shows the email before the move is created. */
|
|
14123
|
+
subject: z9.string().max(200).optional(),
|
|
14124
|
+
title: z9.string().max(200).optional(),
|
|
14125
|
+
body: z9.string().max(2e3).optional()
|
|
14126
|
+
}).strict();
|
|
14127
|
+
function parseWith2(schema, body) {
|
|
14128
|
+
const r = schema.safeParse(body);
|
|
14129
|
+
return r.success ? {
|
|
14130
|
+
ok: true,
|
|
14131
|
+
data: r.data
|
|
14132
|
+
} : {
|
|
14133
|
+
ok: false,
|
|
14134
|
+
problems: r.error.issues.map((i) => `${i.path.join(".")} ${i.message}`)
|
|
14135
|
+
};
|
|
14136
|
+
}
|
|
14137
|
+
__name(parseWith2, "parseWith2");
|
|
14138
|
+
__name4(parseWith2, "parseWith");
|
|
14139
|
+
var DWA_BUILD_MAX_BUNDLE_BYTES = 12 * 1024 * 1024;
|
|
14140
|
+
var sha256Hex = z10.string().regex(/^[a-f0-9]{64}$/);
|
|
14141
|
+
var defaultWebAppBundleAssetSchema = z10.object({
|
|
14142
|
+
path: z10.string().min(1).max(512),
|
|
14143
|
+
hash: sha256Hex,
|
|
14144
|
+
size: z10.number().int().nonnegative().max(WEB_APP_MAX_ASSET_BYTES),
|
|
14145
|
+
contentType: z10.string().min(1).max(200),
|
|
14146
|
+
base64: z10.string()
|
|
14147
|
+
});
|
|
14148
|
+
var defaultWebAppBundleToolSchema = z10.object({
|
|
14149
|
+
name: z10.string().min(1).max(64),
|
|
14150
|
+
description: z10.string().max(2e3),
|
|
14151
|
+
inputSchema: z10.unknown().optional(),
|
|
14152
|
+
outputSchema: z10.unknown().optional(),
|
|
14153
|
+
/** gzip + base64, as `lua push skill` sends a tool. */
|
|
14154
|
+
code: z10.string().min(1)
|
|
14155
|
+
});
|
|
14156
|
+
var defaultWebAppBundleSchema = z10.object({
|
|
14157
|
+
format: z10.literal(1),
|
|
14158
|
+
templateVersion: z10.string().regex(/^\d+\.\d+\.\d+$/),
|
|
14159
|
+
webApp: z10.object({
|
|
14160
|
+
name: z10.string().regex(/^[a-z][a-z0-9-]{1,39}$/),
|
|
14161
|
+
title: z10.string().max(200).optional(),
|
|
14162
|
+
description: z10.string().max(1e3).optional(),
|
|
14163
|
+
routes: z10.array(z10.object({
|
|
14164
|
+
key: z10.string(),
|
|
14165
|
+
method: z10.string(),
|
|
14166
|
+
path: z10.string(),
|
|
14167
|
+
description: z10.string().optional()
|
|
14168
|
+
}).passthrough()).min(1),
|
|
14169
|
+
hasFetch: z10.boolean(),
|
|
14170
|
+
nav: z10.array(z10.object({
|
|
14171
|
+
path: z10.string(),
|
|
14172
|
+
label: z10.string(),
|
|
14173
|
+
icon: z10.string().optional()
|
|
14174
|
+
}).passthrough()),
|
|
14175
|
+
csp: z10.record(z10.array(z10.string())).optional(),
|
|
14176
|
+
branding: z10.record(z10.unknown()).optional(),
|
|
14177
|
+
bundlesAgentPane: z10.boolean(),
|
|
14178
|
+
uiVersion: z10.string().max(64).optional(),
|
|
14179
|
+
entryHtml: z10.string().min(1).max(WEB_APP_ENTRY_HTML_MAX_CHARS),
|
|
14180
|
+
/** The route bundle, uncompressed. */
|
|
14181
|
+
code: z10.string().min(1),
|
|
14182
|
+
codeSha256: sha256Hex,
|
|
14183
|
+
assets: z10.array(defaultWebAppBundleAssetSchema).max(WEB_APP_MAX_ASSETS),
|
|
14184
|
+
compiler: z10.object({
|
|
14185
|
+
vite: z10.string().optional()
|
|
14186
|
+
})
|
|
14187
|
+
}),
|
|
14188
|
+
skill: z10.object({
|
|
14189
|
+
name: z10.string().regex(/^dwa-[a-z0-9-]+$/),
|
|
14190
|
+
title: z10.string().max(200).optional(),
|
|
14191
|
+
description: z10.string().min(1).max(2e3),
|
|
14192
|
+
context: z10.unknown(),
|
|
14193
|
+
tools: z10.array(defaultWebAppBundleToolSchema).min(1).max(10)
|
|
14194
|
+
}),
|
|
14195
|
+
/** What the pod's smoke run answered, route by route: every one 2xx or the build failed. */
|
|
14196
|
+
smoke: z10.array(z10.object({
|
|
14197
|
+
route: z10.string(),
|
|
14198
|
+
status: z10.number().int()
|
|
14199
|
+
})).min(1)
|
|
14200
|
+
});
|
|
13624
14201
|
|
|
13625
14202
|
// ../workflow-graph/dist/index.mjs
|
|
13626
14203
|
import { createHash } from "crypto";
|
|
13627
|
-
import { z as
|
|
14204
|
+
import { z as z11 } from "zod";
|
|
13628
14205
|
import { z as z22 } from "zod";
|
|
13629
14206
|
import { createHash as createHash2 } from "crypto";
|
|
13630
14207
|
var __defProp5 = Object.defineProperty;
|
|
@@ -13919,8 +14496,8 @@ var rows = /* @__PURE__ */ __name5((s, path, page) => ({
|
|
|
13919
14496
|
var fromKnowledge = /* @__PURE__ */ __name5((k) => ({
|
|
13920
14497
|
knowledge: k
|
|
13921
14498
|
}), "fromKnowledge");
|
|
13922
|
-
var SideEffectsSchema =
|
|
13923
|
-
var JobResourcesSchema =
|
|
14499
|
+
var SideEffectsSchema = z11.enum(WORKFLOW_SIDE_EFFECTS);
|
|
14500
|
+
var JobResourcesSchema = z11.enum(WORKFLOW_JOB_RESOURCES);
|
|
13924
14501
|
var WORKFLOW_MODEL_TEMPLATE_ROOT = "initData";
|
|
13925
14502
|
var WORKFLOW_MODEL_TEMPLATE_RE = /^\$\{\s*initData\.([A-Za-z0-9_.\-[\]]+)\s*(?:\|([^}]*))?\}$/;
|
|
13926
14503
|
var PATH_SEGMENT_RE = /^[A-Za-z0-9_-]+(?:\[(?:0|[1-9]\d*)\])*$/;
|