@desplega.ai/agent-swarm 1.152.2 → 1.153.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{acp-adapter-pfeje2v5.js → acp-adapter-ahmjxhek.js} +4 -4
- package/dist/{actions-0sttc7f5.js → actions-jzrfpkmn.js} +30 -26
- package/dist/{anthropic-messages-2y8nktar.js → anthropic-messages-9vqsbznt.js} +112 -84
- package/dist/{app-p8teva95.js → app-03na2vwb.js} +9 -6
- package/dist/{assistant-r45jnsrt.js → assistant-hfkxvhgt.js} +31 -27
- package/dist/{azure-openai-responses-f38x2avq.js → azure-openai-responses-04qwdwfq.js} +27 -13
- package/dist/{boot-reembed-je26h5y7.js → boot-reembed-c98xrad3.js} +8 -6
- package/dist/{boot-reembed-1qmybsd4.js → boot-reembed-zt3qm9xn.js} +9 -7
- package/dist/{boot-scrub-logs-gte3h1mm.js → boot-scrub-logs-jcqd8ksj.js} +6 -4
- package/dist/{claude-adapter-csc1mzka.js → claude-adapter-mgryg8g3.js} +17 -15
- package/dist/{claude-managed-adapter-dsmkcrjy.js → claude-managed-adapter-ea2aga6w.js} +3 -3
- package/dist/{claude-sdk-session-fcd6f078.js → claude-sdk-session-jjf4zss1.js} +17 -15
- package/dist/{cli-r2fpe7cx.js → cli-00w2c66p.js} +61 -55
- package/dist/{cli-fm4ytsdk.js → cli-0d9nbqxf.js} +1 -1
- package/dist/cli-0x5qzvkg.js +4279 -0
- package/dist/{cli-d3p82erb.js → cli-18amys3y.js} +9 -9
- package/dist/{cli-wbyk465z.js → cli-1hwnb4hc.js} +1 -1
- package/dist/{cli-xw7vak96.js → cli-3bcmp015.js} +5 -5
- package/dist/cli-3er6gcsn.js +1849 -0
- package/dist/{cli-c4eeb5q2.js → cli-5b6b62tz.js} +1 -1
- package/dist/{cli-4ahpr4sw.js → cli-5mbmvxnn.js} +5 -5
- package/dist/{cli-xy1cchaf.js → cli-5taqtpze.js} +235 -8
- package/dist/{cli-fmy65jdn.js → cli-6ks9xf1n.js} +7 -5
- package/dist/cli-7g9s78jf.js +2827 -0
- package/dist/{cli-jew3jda5.js → cli-7pnz2v6s.js} +2 -2
- package/dist/{cli-r84ctdxn.js → cli-83wkg402.js} +2 -2
- package/dist/{cli-jvy9qgjs.js → cli-a9scg8sv.js} +4 -4
- package/dist/{cli-4yc5d8fk.js → cli-avkd6mqv.js} +50 -0
- package/dist/{cli-ht5rs63n.js → cli-b2g6mzjc.js} +15 -6
- package/dist/{cli-jbmc0r7r.js → cli-bw0dfwkr.js} +1 -1
- package/dist/{cli-8wrympd7.js → cli-bzr0ftht.js} +26 -7
- package/dist/{cli-wpv5rgg2.js → cli-cdq08v3r.js} +2 -2
- package/dist/cli-cgj4hc12.js +18902 -0
- package/dist/cli-d6hk10xx.js +14075 -0
- package/dist/{cli-zvgj5zg8.js → cli-djvxhnc4.js} +31 -3324
- package/dist/{cli-s25avqg9.js → cli-e781c6f9.js} +1 -0
- package/dist/{cli-3bpzj8me.js → cli-eazstkad.js} +2 -2
- package/dist/{cli-s2qjdd6z.js → cli-eetrvv91.js} +1 -1
- package/dist/cli-h38x0qhg.js +6912 -0
- package/dist/{cli-9xvdm3bx.js → cli-h60qfasa.js} +742 -278
- package/dist/{pi-mono-adapter-jcqt71cg.js → cli-ja7mrygn.js} +67343 -101083
- package/dist/{cli-j8dggbcr.js → cli-k0g1sjzm.js} +23 -31
- package/dist/{cli-gphgnvpf.js → cli-m04pt18h.js} +2 -2
- package/dist/{cli-rgvp6r2x.js → cli-mcnhgnn1.js} +193 -4
- package/dist/{cli-j4nv2wqy.js → cli-mzgyhxbe.js} +10 -4
- package/dist/{cli-qn042eh7.js → cli-n0q9b7j4.js} +46 -1870
- package/dist/cli-n7h1kqpf.js +29 -0
- package/dist/{cli-ckz5t2hb.js → cli-nq0kgyxe.js} +5 -5
- package/dist/{cli-z3wkng35.js → cli-qrqhc31j.js} +151 -125
- package/dist/{cli-56h18ng2.js → cli-r8tdds6s.js} +1 -1
- package/dist/{cli-ch38q5z4.js → cli-rj7de4b2.js} +6788 -2541
- package/dist/{cli-qd65dvr6.js → cli-s5s1f2yn.js} +56 -40
- package/dist/{cli-kj76p1ez.js → cli-scwq51gn.js} +13 -7
- package/dist/{cli-2nnd56zt.js → cli-tdh4hjr2.js} +3 -2
- package/dist/{cli-c2mk1kgf.js → cli-v4en75c5.js} +8 -1
- package/dist/{cli-b9dd0h3k.js → cli-vw03hg5t.js} +3 -2
- package/dist/{cli-zvkq5csn.js → cli-ybpp1srm.js} +6 -6
- package/dist/cli-yn0a417a.js +4069 -0
- package/dist/{cli-gpqcs935.js → cli-ysc1kbet.js} +2 -2
- package/dist/{cli-zfzznn7c.js → cli-ytxs7mn1.js} +26 -2
- package/dist/cli-zcsyfw2z.js +3335 -0
- package/dist/{cli-4j8k1m4w.js → cli-zt1227k1.js} +1162 -192
- package/dist/cli-zy5w9gpt.js +230 -0
- package/dist/cli.js +26 -34
- package/dist/{codex-adapter-fxmpsabw.js → codex-adapter-8548daap.js} +12 -11
- package/dist/{codex-session-runner-rr1e47ea.js → codex-session-runner-2dad8p4x.js} +12 -11
- package/dist/{commands-0f5rxz51.js → commands-355dbpa8.js} +6 -4
- package/dist/{db-r3jxf3wy.js → db-4jjvwz1s.js} +6 -4
- package/dist/{dispatcher-06vph6q4.js → dispatcher-ca590nkz.js} +29 -25
- package/dist/dsh-adapter-rgvj6ykp.js +19 -0
- package/dist/{e2b-413b8t4v.js → e2b-93x1k0j5.js} +6 -7
- package/dist/{google-generative-ai-ndjmj5fa.js → google-generative-ai-xtw7tggr.js} +33 -73
- package/dist/{google-vertex-fr665tqs.js → google-vertex-zdqpms6n.js} +38 -68
- package/dist/{handlers-0hgtc910.js → handlers-2y6dqpvf.js} +32 -28
- package/dist/{hook-9kvrv1er.js → hook-0s8knepr.js} +11 -9
- package/dist/{hook-fbfhkat3.js → hook-k0gec254.js} +12 -10
- package/dist/{http-xbyx8k5j.js → http-jp2nb4zw.js} +300 -237
- package/dist/{index-tfsdxyv6.js → index-0wzg3sp3.js} +39 -24
- package/dist/{index-rnyahfn5.js → index-3mq6ce93.js} +29 -25
- package/dist/{index-jsw3aynb.js → index-42s7eezq.js} +29 -25
- package/dist/{cli-pdz9qde4.js → index-9ch1n761.js} +10 -11
- package/dist/{index-gpfn1741.js → index-b56xkbc7.js} +8 -6
- package/dist/{index-66xz5e9j.js → index-h5gs261z.js} +521 -9
- package/dist/{index-2sp0384z.js → index-kkeftv5h.js} +738 -21
- package/dist/{index-sgk50mbg.js → index-s37dbevy.js} +30 -26
- package/dist/index-w097eg0x.js +5 -0
- package/dist/jiti-loader-b4837mtm.js +34 -0
- package/dist/jiti-static-loader-q2g5ds0y.js +31267 -0
- package/dist/{keepalive-s3xpr7sw.js → keepalive-9pfw7t02.js} +8 -6
- package/dist/{lead-rq4n5r16.js → lead-7vcmcdq4.js} +44 -39
- package/dist/{maintenance-f0atj1ab.js → maintenance-x277jbpd.js} +9 -7
- package/dist/{mistral-conversations-qhr84ph3.js → mistral-conversations-zx0kn554.js} +24 -18
- package/dist/{node-x1g4v0pq.js → node-5qtycf6a.js} +16 -11
- package/dist/{oauth-refresh-sweep-q0t3bxre.js → oauth-refresh-sweep-5fwa7th2.js} +7 -5
- package/dist/{onboard-br5j1kch.js → onboard-17sv0f51.js} +103 -35
- package/dist/{openai-codex-responses-wy6a43wd.js → openai-codex-responses-4vjqzvjp.js} +33 -27
- package/dist/{openai-completions-32rdwmze.js → openai-completions-pxsmym7g.js} +52 -64
- package/dist/{openai-responses-6xwf7bzg.js → openai-responses-tmn0rqp0.js} +23 -24
- package/dist/{opencode-adapter-28axqa09.js → opencode-adapter-qbmv4tpy.js} +6 -6
- package/dist/{otel-impl-vdqge2nt.js → otel-impl-srjy4be4.js} +4 -4
- package/dist/{pi-messages-b1mbr6gp.js → pi-messages-txpjj39q.js} +3 -3
- package/dist/pi-mono-adapter-946a0sdd.js +1316 -0
- package/dist/{pricing-refresh-hb3691fd.js → pricing-refresh-vetcm563.js} +8 -6
- package/dist/{rbac-roles-jh280k9g.js → rbac-roles-cfzgr6r1.js} +8 -6
- package/dist/{rbac-roles-t78xt39b.js → rbac-roles-cmxaddmy.js} +7 -5
- package/dist/{render-v2-7p8r2ymg.js → render-v2-f9hzff72.js} +9 -6
- package/dist/{seed-pricing-hf889enh.js → seed-pricing-jggk6rsy.js} +7 -5
- package/dist/{setup-w6mb03jv.js → setup-8mfceb9t.js} +4 -5
- package/dist/virtual-modules-ax661xp0.js +54 -0
- package/dist/{work-objects-nt8gy1kj.js → work-objects-vdsdcczj.js} +32 -28
- package/dist/{worker-dwy617t0.js → worker-cd0nhyv1.js} +44 -39
- package/openapi.json +36 -14
- package/package.json +6 -6
- package/src/be/automation-preflight.ts +6 -4
- package/src/be/extensions/db.ts +35 -4
- package/src/be/models-catalog.ts +2 -0
- package/src/be/modelsdev-cache.json +213 -0
- package/src/be/rbac-audit.ts +2 -0
- package/src/be/seed-pricing.ts +3 -1
- package/src/be/swarm-config-guard.ts +1 -0
- package/src/commands/onboard/compose-generator.ts +6 -1
- package/src/commands/onboard/env-generator.ts +6 -1
- package/src/commands/onboard/manifest.ts +1 -0
- package/src/commands/onboard/steps/integration-slack.tsx +56 -16
- package/src/commands/onboard/steps/review.tsx +5 -0
- package/src/commands/onboard/types.ts +6 -0
- package/src/commands/onboard.tsx +5 -1
- package/src/commands/provider-credentials.ts +14 -2
- package/src/extensions/lifecycle.ts +15 -21
- package/src/http/agents.ts +2 -2
- package/src/http/config.ts +1 -1
- package/src/http/core.ts +5 -3
- package/src/http/extensions.ts +108 -34
- package/src/http/status.ts +22 -10
- package/src/prompts/base-prompt.ts +15 -7
- package/src/providers/claude-managed-models.ts +8 -0
- package/src/providers/codex-models.ts +15 -1
- package/src/providers/dsh-adapter.ts +248 -0
- package/src/providers/index.ts +5 -1
- package/src/providers/modelsdev-reasoning.json +50 -0
- package/src/rbac/legacy-policy.ts +15 -1
- package/src/rbac/types.ts +2 -0
- package/src/server.ts +7 -1
- package/src/slack/app.ts +32 -10
- package/src/slack/config.ts +29 -0
- package/src/telemetry.ts +2 -3
- package/src/tests/agents-harness-provider.test.ts +19 -0
- package/src/tests/agents-list-model-display.test.ts +60 -1
- package/src/tests/base-prompt.test.ts +25 -0
- package/src/tests/claude-managed-adapter.test.ts +6 -0
- package/src/tests/codex-gpt6-release.test.ts +97 -0
- package/src/tests/config-api-only-keys.test.ts +9 -0
- package/src/tests/context-window.test.ts +1 -0
- package/src/tests/dsh-adapter.test.ts +276 -0
- package/src/tests/e2e-nightly-report.test.ts +3 -3
- package/src/tests/e2e-redact.test.ts +2 -0
- package/src/tests/env-flag.test.ts +6 -0
- package/src/tests/extensions-db.test.ts +41 -0
- package/src/tests/extensions-http.test.ts +148 -4
- package/src/tests/extensions-lifecycle.test.ts +18 -0
- package/src/tests/extensions-mcp-tools.test.ts +9 -5
- package/src/tests/internal-ai/complete-structured.test.ts +32 -9
- package/src/tests/internal-ai/credentials.test.ts +4 -4
- package/src/tests/internal-ai/models.test.ts +20 -0
- package/src/tests/migration-046-budgets.test.ts +2 -0
- package/src/tests/model-control.test.ts +2 -2
- package/src/tests/onboard-compose.test.ts +14 -0
- package/src/tests/onboard-env.test.ts +17 -0
- package/src/tests/onboard-manifest.test.ts +12 -0
- package/src/tests/opus-5-5-registry.test.ts +48 -0
- package/src/tests/pricing-refresh.test.ts +1 -1
- package/src/tests/pricing-routes.test.ts +15 -3
- package/src/tests/provider-registration.test.ts +5 -2
- package/src/tests/rbac-admission-e2e.test.ts +54 -0
- package/src/tests/rbac-e2e-helpers.ts +2 -0
- package/src/tests/rbac-engine.test.ts +32 -0
- package/src/tests/rbac-wire-e2e.test.ts +33 -0
- package/src/tests/reasoning-effort.test.ts +8 -0
- package/src/tests/reload-config.test.ts +33 -0
- package/src/tests/session-costs-model-key-normalize.test.ts +1 -0
- package/src/tests/slack-config.test.ts +136 -0
- package/src/tests/slack-mode-lifecycle.test.ts +69 -0
- package/src/tests/status.test.ts +22 -2
- package/src/tests/task-tool-preload-mcp.test.ts +3 -1
- package/src/tests/telemetry-init.test.ts +18 -0
- package/src/tests/workflow-llm.test.ts +3 -3
- package/src/tools/extension-common.ts +4 -0
- package/src/tools/extension-install.ts +1 -1
- package/src/tools/extension-list.ts +4 -3
- package/src/types.ts +17 -8
- package/src/utils/context-window.ts +1 -0
- package/src/utils/credentials.ts +8 -0
- package/src/utils/internal-ai/complete-structured.ts +8 -0
- package/src/utils/internal-ai/models.ts +5 -5
- package/templates/schedules/daily-status-report/content.md +25 -12
- package/templates/schedules/daily-workflow-health-audit/content.md +1 -1
- package/templates/skills/swarm-extensions/content.md +9 -5
- package/dist/cli-4wppfkcm.js +0 -16384
- package/dist/cli-55qrx3q8.js +0 -6041
- package/dist/cli-cg4vnyh4.js +0 -305
- package/dist/cli-jyetr64j.js +0 -52
- package/dist/cli-pp9ax9pa.js +0 -520
- package/dist/cli-qa66qaf0.js +0 -6076
- package/dist/cli-qghpvca2.js +0 -590
- package/dist/cli-rembwgt8.js +0 -861
- package/dist/cli-tcvj7j2r.js +0 -1971
- package/dist/cli-vfcth11k.js +0 -36
- package/dist/cli-w1d1bgkk.js +0 -1422
- package/dist/cli-y6x0gqtg.js +0 -5977
- package/dist/es5-tj3tn4jj.js +0 -844
- package/dist/index-1kq5hw2p.js +0 -467
- package/dist/index-1p8wdstt.js +0 -7
- package/dist/index-8fdjzb2f.js +0 -100
- package/dist/index-bxmwzbgw.js +0 -365
- package/dist/index-nzerxd5z.js +0 -7
- package/dist/index-pyymnzat.js +0 -1168
- package/dist/index-qv6atbab.js +0 -619
- package/dist/index-rja32qa7.js +0 -801
- package/dist/index-tzg5srfp.js +0 -211
- package/dist/index-vhncw983.js +0 -90
- package/dist/index-xk036zsk.js +0 -859
- package/dist/index-zyazbzcb.js +0 -6
- package/dist/{claude-managed-setup-48dwg9bv.js → claude-managed-setup-f5pmsyrp.js} +3 -3
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentAvatarSchema,
|
|
3
|
+
CreateTaskOptionsSchema,
|
|
4
|
+
FollowUpConfigSchema,
|
|
5
|
+
PROVIDER_STEER_CAPABILITIES,
|
|
6
|
+
ProviderNameSchema,
|
|
7
|
+
ReasoningEffortSchema,
|
|
8
|
+
RoutingAffinitySchema,
|
|
9
|
+
SERVER_GENERATED_ATTACHMENT_CAPABILITY,
|
|
10
|
+
SessionCostModelBreakdownSchema,
|
|
11
|
+
VersionableFieldSchema,
|
|
12
|
+
defaultAssetKey,
|
|
13
|
+
init_key,
|
|
14
|
+
init_types,
|
|
15
|
+
isCanonicalAssetKey,
|
|
16
|
+
isTerminalTaskStatus,
|
|
17
|
+
normalizeAssetKey,
|
|
18
|
+
parseAssetKey,
|
|
19
|
+
parseModelTier
|
|
20
|
+
} from "./cli-zcsyfw2z.js";
|
|
1
21
|
import {
|
|
2
22
|
IdentityFieldBudgetError,
|
|
3
23
|
checkIdentityFieldBudget,
|
|
@@ -10,7 +30,7 @@ import {
|
|
|
10
30
|
init_templates,
|
|
11
31
|
matchesDefaultClaudeMd,
|
|
12
32
|
matchesDefaultIdentityMd
|
|
13
|
-
} from "./cli-
|
|
33
|
+
} from "./cli-b2g6mzjc.js";
|
|
14
34
|
import {
|
|
15
35
|
configureDbResolver,
|
|
16
36
|
getAllTemplateDefinitions,
|
|
@@ -21,20 +41,19 @@ import {
|
|
|
21
41
|
isSteeringEnabled,
|
|
22
42
|
registerTemplate
|
|
23
43
|
} from "./cli-z61ykvam.js";
|
|
24
|
-
import {
|
|
25
|
-
MAX_PROFILE_FILE_LENGTH,
|
|
26
|
-
init_constants
|
|
27
|
-
} from "./cli-dv6cdjs2.js";
|
|
28
44
|
import {
|
|
29
45
|
deriveProviderFromKeyType,
|
|
30
46
|
init_credentials
|
|
31
|
-
} from "./cli-
|
|
47
|
+
} from "./cli-v4en75c5.js";
|
|
48
|
+
import {
|
|
49
|
+
init_config,
|
|
50
|
+
isSlackConfigured
|
|
51
|
+
} from "./cli-n7h1kqpf.js";
|
|
32
52
|
import {
|
|
33
53
|
init_env_flag,
|
|
34
54
|
isEnvFlagEnabled
|
|
35
55
|
} from "./cli-ej6gbxfb.js";
|
|
36
56
|
import {
|
|
37
|
-
exports_zod,
|
|
38
57
|
init_zod
|
|
39
58
|
} from "./cli-sd0mxa3c.js";
|
|
40
59
|
import {
|
|
@@ -49,7 +68,7 @@ import {
|
|
|
49
68
|
import {
|
|
50
69
|
init_package,
|
|
51
70
|
package_default
|
|
52
|
-
} from "./cli-
|
|
71
|
+
} from "./cli-ybpp1srm.js";
|
|
53
72
|
import {
|
|
54
73
|
init_secret_scrubber,
|
|
55
74
|
registerVolatileSecret,
|
|
@@ -67,81 +86,6 @@ import {
|
|
|
67
86
|
__toCommonJS
|
|
68
87
|
} from "./cli-bc05qbss.js";
|
|
69
88
|
|
|
70
|
-
// src/assets/key.ts
|
|
71
|
-
function normalizeAssetKey(input) {
|
|
72
|
-
if (typeof input !== "string")
|
|
73
|
-
throw new AssetKeyError("Asset key must be a string");
|
|
74
|
-
if (input.includes("\x00"))
|
|
75
|
-
throw new AssetKeyError("Asset key cannot contain NUL bytes");
|
|
76
|
-
if (input.includes("\\"))
|
|
77
|
-
throw new AssetKeyError("Asset key must use forward slashes");
|
|
78
|
-
const normalized = input.trim().normalize("NFKC").toLowerCase();
|
|
79
|
-
if (!normalized)
|
|
80
|
-
throw new AssetKeyError("Asset key cannot be empty");
|
|
81
|
-
if (normalized.startsWith("/"))
|
|
82
|
-
throw new AssetKeyError("Asset key must be relative");
|
|
83
|
-
const withTrailingSlash = normalized.endsWith("/") ? normalized : `${normalized}/`;
|
|
84
|
-
if (withTrailingSlash.length > ASSET_KEY_MAX_LENGTH) {
|
|
85
|
-
throw new AssetKeyError(`Asset key cannot exceed ${ASSET_KEY_MAX_LENGTH} characters`);
|
|
86
|
-
}
|
|
87
|
-
const segments = withTrailingSlash.slice(0, -1).split("/");
|
|
88
|
-
if (segments.some((segment) => segment === "" || segment === "." || segment === "..")) {
|
|
89
|
-
throw new AssetKeyError("Asset key contains an empty or traversal segment");
|
|
90
|
-
}
|
|
91
|
-
const root = segments[0];
|
|
92
|
-
if (root !== "shared" && root !== "personal") {
|
|
93
|
-
throw new AssetKeyError("Asset key root must be shared or personal");
|
|
94
|
-
}
|
|
95
|
-
if (root === "personal" && !segments[1]) {
|
|
96
|
-
throw new AssetKeyError("Personal asset keys require a canonical user ID");
|
|
97
|
-
}
|
|
98
|
-
return withTrailingSlash;
|
|
99
|
-
}
|
|
100
|
-
function defaultAssetKey(resource, id) {
|
|
101
|
-
if (!id.trim())
|
|
102
|
-
throw new AssetKeyError("Asset key resource ID cannot be empty");
|
|
103
|
-
return normalizeAssetKey(`shared/${resource}:${id}/`);
|
|
104
|
-
}
|
|
105
|
-
function parseAssetKey(input) {
|
|
106
|
-
const key = normalizeAssetKey(input);
|
|
107
|
-
const segments = key.slice(0, -1).split("/");
|
|
108
|
-
if (segments[0] === "personal") {
|
|
109
|
-
return {
|
|
110
|
-
root: "personal",
|
|
111
|
-
key,
|
|
112
|
-
segments,
|
|
113
|
-
userId: segments[1],
|
|
114
|
-
relativeSegments: segments.slice(2)
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
root: "shared",
|
|
119
|
-
key,
|
|
120
|
-
segments,
|
|
121
|
-
relativeSegments: segments.slice(1)
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function isCanonicalAssetKey(input) {
|
|
125
|
-
try {
|
|
126
|
-
return normalizeAssetKey(input) === input;
|
|
127
|
-
} catch {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function canWriteAssetKey(input, trustedUserId) {
|
|
132
|
-
const parsed = parseAssetKey(input);
|
|
133
|
-
return parsed.root === "shared" || !!trustedUserId && parsed.userId === trustedUserId;
|
|
134
|
-
}
|
|
135
|
-
var ASSET_KEY_MAX_LENGTH = 255, AssetKeyError;
|
|
136
|
-
var init_key = __esm(() => {
|
|
137
|
-
AssetKeyError = class AssetKeyError extends Error {
|
|
138
|
-
constructor(message) {
|
|
139
|
-
super(message);
|
|
140
|
-
this.name = "AssetKeyError";
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
|
|
145
89
|
// src/tasks/context-key.ts
|
|
146
90
|
function assertSafePart(value, label) {
|
|
147
91
|
if (value === null || value === undefined) {
|
|
@@ -467,7 +411,7 @@ function _hasEmbeddingKey(env = process.env) {
|
|
|
467
411
|
return !!(env.EMBEDDING_API_KEY || env.OPENAI_API_KEY);
|
|
468
412
|
}
|
|
469
413
|
function _hasSlackChannel(env = process.env) {
|
|
470
|
-
return
|
|
414
|
+
return isSlackConfigured(env);
|
|
471
415
|
}
|
|
472
416
|
function _hasEmailChannel(env = process.env) {
|
|
473
417
|
return !!env.AGENTMAIL_WEBHOOK_SECRET && !isEnvFlagEnabled("AGENTMAIL_DISABLE", false, env);
|
|
@@ -590,6 +534,7 @@ function emitIntegrationConnected(type, providerSlug, firstOfType) {
|
|
|
590
534
|
var TELEMETRY_ENDPOINT = "https://proxy.desplega.sh/v1/events", PRODUCT = "agent-swarm", TIMEOUT_MS = 5000, installationId = null, installedAt = null, source = "unknown", cachedIsCloud = false, cachedIsE2b = false, cachedHasEmbedding = false, cachedHasSlackChannel = false, cachedHasEmailChannel = false, cachedInstallMethod = "manual", cachedInstallPreset, CLOUD_HOST_EXACT, CLOUD_HOST_SUFFIXES, KNOWN_INSTALL_METHODS, KNOWN_INSTALL_PRESETS, KNOWN_INTEGRATION_TYPES, INTEGRATION_PROVIDERS, telemetry;
|
|
591
535
|
var init_telemetry = __esm(() => {
|
|
592
536
|
init_package();
|
|
537
|
+
init_config();
|
|
593
538
|
init_env_flag();
|
|
594
539
|
CLOUD_HOST_EXACT = new Set([
|
|
595
540
|
"agent-swarm-mcp.desplega.sh",
|
|
@@ -687,3245 +632,6 @@ var init_telemetry = __esm(() => {
|
|
|
687
632
|
};
|
|
688
633
|
});
|
|
689
634
|
|
|
690
|
-
// src/extensions/bundle-path.ts
|
|
691
|
-
function isSafeBundlePath(path) {
|
|
692
|
-
return path.length > 0 && path.length <= 256 && !path.startsWith("/") && !path.includes("\\") && !path.includes("\x00") && path.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
693
|
-
}
|
|
694
|
-
var init_bundle_path = () => {};
|
|
695
|
-
|
|
696
|
-
// node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs
|
|
697
|
-
function __rest(s, e) {
|
|
698
|
-
var t = {};
|
|
699
|
-
for (var p in s)
|
|
700
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
701
|
-
t[p] = s[p];
|
|
702
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
703
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s);i < p.length; i++) {
|
|
704
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
705
|
-
t[p[i]] = s[p[i]];
|
|
706
|
-
}
|
|
707
|
-
return t;
|
|
708
|
-
}
|
|
709
|
-
function isZodType(schema, typeNames) {
|
|
710
|
-
const typeNamesArray = Array.isArray(typeNames) ? typeNames : [typeNames];
|
|
711
|
-
return typeNamesArray.some((typeName) => {
|
|
712
|
-
var _a;
|
|
713
|
-
const typeNameMatch = ((_a = schema === null || schema === undefined ? undefined : schema.def) === null || _a === undefined ? undefined : _a.type) === ZodTypeKeys[typeName];
|
|
714
|
-
if (typeName === "ZodDiscriminatedUnion") {
|
|
715
|
-
return typeNameMatch && "discriminator" in schema.def;
|
|
716
|
-
}
|
|
717
|
-
return typeNameMatch;
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
function isAnyZodType(schema) {
|
|
721
|
-
return schema && "def" in schema;
|
|
722
|
-
}
|
|
723
|
-
function isNullableSchema(schema) {
|
|
724
|
-
return schema.safeParse(null).success;
|
|
725
|
-
}
|
|
726
|
-
function isOptionalSchema(schema) {
|
|
727
|
-
return schema.safeParse(undefined).success;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
class $ZodRegistry {
|
|
731
|
-
constructor() {
|
|
732
|
-
this._map = new Map;
|
|
733
|
-
this._idmap = new Map;
|
|
734
|
-
}
|
|
735
|
-
add(schema, ..._meta) {
|
|
736
|
-
const meta = _meta[0];
|
|
737
|
-
this._map.set(schema, meta);
|
|
738
|
-
if (meta && typeof meta === "object" && "id" in meta) {
|
|
739
|
-
if (this._idmap.has(meta.id)) {
|
|
740
|
-
throw new Error(`ID ${meta.id} already exists in the registry`);
|
|
741
|
-
}
|
|
742
|
-
this._idmap.set(meta.id, schema);
|
|
743
|
-
}
|
|
744
|
-
return this;
|
|
745
|
-
}
|
|
746
|
-
clear() {
|
|
747
|
-
this._map = new Map;
|
|
748
|
-
this._idmap = new Map;
|
|
749
|
-
return this;
|
|
750
|
-
}
|
|
751
|
-
remove(schema) {
|
|
752
|
-
const meta = this._map.get(schema);
|
|
753
|
-
if (meta && typeof meta === "object" && "id" in meta) {
|
|
754
|
-
this._idmap.delete(meta.id);
|
|
755
|
-
}
|
|
756
|
-
this._map.delete(schema);
|
|
757
|
-
return this;
|
|
758
|
-
}
|
|
759
|
-
get(schema) {
|
|
760
|
-
const p = schema._zod.parent;
|
|
761
|
-
if (p) {
|
|
762
|
-
const pm = { ...this.get(p) ?? {} };
|
|
763
|
-
delete pm.id;
|
|
764
|
-
return { ...pm, ...this._map.get(schema) };
|
|
765
|
-
}
|
|
766
|
-
return this._map.get(schema);
|
|
767
|
-
}
|
|
768
|
-
has(schema) {
|
|
769
|
-
return this._map.has(schema);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
function registry() {
|
|
773
|
-
return new $ZodRegistry;
|
|
774
|
-
}
|
|
775
|
-
function isEqual(x, y) {
|
|
776
|
-
if (x === null || x === undefined || y === null || y === undefined) {
|
|
777
|
-
return x === y;
|
|
778
|
-
}
|
|
779
|
-
if (x === y || x.valueOf() === y.valueOf()) {
|
|
780
|
-
return true;
|
|
781
|
-
}
|
|
782
|
-
if (Array.isArray(x)) {
|
|
783
|
-
if (!Array.isArray(y)) {
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
if (x.length !== y.length) {
|
|
787
|
-
return false;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
if (!(x instanceof Object) || !(y instanceof Object)) {
|
|
791
|
-
return false;
|
|
792
|
-
}
|
|
793
|
-
const keysX = Object.keys(x);
|
|
794
|
-
return Object.keys(y).every((keyY) => keysX.indexOf(keyY) !== -1) && keysX.every((key) => isEqual(x[key], y[key]));
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
class ObjectSet {
|
|
798
|
-
constructor() {
|
|
799
|
-
this.buckets = new Map;
|
|
800
|
-
}
|
|
801
|
-
put(value) {
|
|
802
|
-
const hashCode = this.hashCodeOf(value);
|
|
803
|
-
const itemsByCode = this.buckets.get(hashCode);
|
|
804
|
-
if (!itemsByCode) {
|
|
805
|
-
this.buckets.set(hashCode, [value]);
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
const alreadyHasItem = itemsByCode.some((_) => isEqual(_, value));
|
|
809
|
-
if (!alreadyHasItem) {
|
|
810
|
-
itemsByCode.push(value);
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
contains(value) {
|
|
814
|
-
const hashCode = this.hashCodeOf(value);
|
|
815
|
-
const itemsByCode = this.buckets.get(hashCode);
|
|
816
|
-
if (!itemsByCode) {
|
|
817
|
-
return false;
|
|
818
|
-
}
|
|
819
|
-
return itemsByCode.some((_) => isEqual(_, value));
|
|
820
|
-
}
|
|
821
|
-
values() {
|
|
822
|
-
return [...this.buckets.values()].flat();
|
|
823
|
-
}
|
|
824
|
-
stats() {
|
|
825
|
-
let totalBuckets = 0;
|
|
826
|
-
let totalValues = 0;
|
|
827
|
-
let collisions = 0;
|
|
828
|
-
for (const bucket of this.buckets.values()) {
|
|
829
|
-
totalBuckets += 1;
|
|
830
|
-
totalValues += bucket.length;
|
|
831
|
-
if (bucket.length > 1) {
|
|
832
|
-
collisions += 1;
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
const hashEffectiveness = totalBuckets / totalValues;
|
|
836
|
-
return { totalBuckets, collisions, totalValues, hashEffectiveness };
|
|
837
|
-
}
|
|
838
|
-
hashCodeOf(object2) {
|
|
839
|
-
let hashCode = 0;
|
|
840
|
-
if (Array.isArray(object2)) {
|
|
841
|
-
for (let i = 0;i < object2.length; i++) {
|
|
842
|
-
hashCode ^= this.hashCodeOf(object2[i]) * i;
|
|
843
|
-
}
|
|
844
|
-
return hashCode;
|
|
845
|
-
}
|
|
846
|
-
if (typeof object2 === "string") {
|
|
847
|
-
for (let i = 0;i < object2.length; i++) {
|
|
848
|
-
hashCode ^= object2.charCodeAt(i) * i;
|
|
849
|
-
}
|
|
850
|
-
return hashCode;
|
|
851
|
-
}
|
|
852
|
-
if (typeof object2 === "number") {
|
|
853
|
-
return object2;
|
|
854
|
-
}
|
|
855
|
-
if (typeof object2 === "object") {
|
|
856
|
-
for (const [key, value] of Object.entries(object2)) {
|
|
857
|
-
hashCode ^= this.hashCodeOf(key) + this.hashCodeOf(value !== null && value !== undefined ? value : "");
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
return hashCode;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
function isUndefined(value) {
|
|
864
|
-
return value === undefined;
|
|
865
|
-
}
|
|
866
|
-
function mapValues(object2, mapper) {
|
|
867
|
-
const result = {};
|
|
868
|
-
Object.entries(object2).forEach(([key, value]) => {
|
|
869
|
-
result[key] = mapper(value);
|
|
870
|
-
});
|
|
871
|
-
return result;
|
|
872
|
-
}
|
|
873
|
-
function omit(object2, keys) {
|
|
874
|
-
const result = {};
|
|
875
|
-
Object.entries(object2).forEach(([key, value]) => {
|
|
876
|
-
if (!keys.some((keyToOmit) => keyToOmit === key)) {
|
|
877
|
-
result[key] = value;
|
|
878
|
-
}
|
|
879
|
-
});
|
|
880
|
-
return result;
|
|
881
|
-
}
|
|
882
|
-
function omitBy(object2, predicate) {
|
|
883
|
-
const result = {};
|
|
884
|
-
Object.entries(object2).forEach(([key, value]) => {
|
|
885
|
-
if (!predicate(value, key)) {
|
|
886
|
-
result[key] = value;
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
return result;
|
|
890
|
-
}
|
|
891
|
-
function compact(arr) {
|
|
892
|
-
return arr.filter((elem) => !isUndefined(elem));
|
|
893
|
-
}
|
|
894
|
-
function uniq(values) {
|
|
895
|
-
const set = new ObjectSet;
|
|
896
|
-
values.forEach((value) => set.put(value));
|
|
897
|
-
return [...set.values()];
|
|
898
|
-
}
|
|
899
|
-
function isString(val) {
|
|
900
|
-
return typeof val === "string";
|
|
901
|
-
}
|
|
902
|
-
function sortObjectByKeys(obj) {
|
|
903
|
-
return Object.fromEntries(Object.entries(obj).sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey)));
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
class Metadata {
|
|
907
|
-
static collectMetadata(schema, metadata) {
|
|
908
|
-
const currentMetadata = this.getMetadataFromRegistry(schema);
|
|
909
|
-
const _internal = Object.assign(Object.assign({}, currentMetadata === null || currentMetadata === undefined ? undefined : currentMetadata._internal), metadata === null || metadata === undefined ? undefined : metadata._internal);
|
|
910
|
-
const param = Object.assign(Object.assign({}, currentMetadata === null || currentMetadata === undefined ? undefined : currentMetadata.param), metadata === null || metadata === undefined ? undefined : metadata.param);
|
|
911
|
-
const totalMetadata = Object.assign(Object.assign(Object.assign(Object.assign({}, Object.keys(_internal).length > 0 ? { _internal } : {}), currentMetadata), metadata), Object.keys(param).length > 0 ? { param } : {});
|
|
912
|
-
if (isZodType(schema, [
|
|
913
|
-
"ZodOptional",
|
|
914
|
-
"ZodNullable",
|
|
915
|
-
"ZodDefault",
|
|
916
|
-
"ZodPrefault",
|
|
917
|
-
"ZodReadonly",
|
|
918
|
-
"ZodNonOptional"
|
|
919
|
-
]) && isAnyZodType(schema._zod.def.innerType)) {
|
|
920
|
-
return this.collectMetadata(schema._zod.def.innerType, totalMetadata);
|
|
921
|
-
}
|
|
922
|
-
if (isZodType(schema, "ZodPipe")) {
|
|
923
|
-
const inSchema = schema._zod.def.in;
|
|
924
|
-
const outSchema = schema._zod.def.out;
|
|
925
|
-
if (isZodType(inSchema, "ZodTransform") && isAnyZodType(outSchema)) {
|
|
926
|
-
return this.collectMetadata(outSchema, totalMetadata);
|
|
927
|
-
}
|
|
928
|
-
if (isAnyZodType(inSchema)) {
|
|
929
|
-
return this.collectMetadata(inSchema, totalMetadata);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
return totalMetadata;
|
|
933
|
-
}
|
|
934
|
-
static getMetadata(zodSchema) {
|
|
935
|
-
return this.collectMetadata(zodSchema);
|
|
936
|
-
}
|
|
937
|
-
static getOpenApiMetadata(zodSchema) {
|
|
938
|
-
const metadata = this.collectMetadata(zodSchema);
|
|
939
|
-
const _a = metadata !== null && metadata !== undefined ? metadata : {}, { _internal } = _a, rest = __rest(_a, ["_internal"]);
|
|
940
|
-
return rest;
|
|
941
|
-
}
|
|
942
|
-
static getInternalMetadata(zodSchema) {
|
|
943
|
-
var _a;
|
|
944
|
-
return (_a = this.collectMetadata(zodSchema)) === null || _a === undefined ? undefined : _a._internal;
|
|
945
|
-
}
|
|
946
|
-
static getParamMetadata(zodSchema) {
|
|
947
|
-
const metadata = this.collectMetadata(zodSchema);
|
|
948
|
-
return Object.assign(Object.assign({}, metadata), {
|
|
949
|
-
param: Object.assign(Object.assign({}, (metadata === null || metadata === undefined ? undefined : metadata.description) ? { description: metadata.description } : {}), metadata === null || metadata === undefined ? undefined : metadata.param)
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
static buildSchemaMetadata(metadata) {
|
|
953
|
-
return omitBy(omit(metadata, ["param", "_internal"]), isUndefined);
|
|
954
|
-
}
|
|
955
|
-
static buildParameterMetadata(metadata) {
|
|
956
|
-
return omitBy(metadata, isUndefined);
|
|
957
|
-
}
|
|
958
|
-
static applySchemaMetadata(initialData, metadata) {
|
|
959
|
-
return omitBy(Object.assign(Object.assign({}, initialData), this.buildSchemaMetadata(metadata)), isUndefined);
|
|
960
|
-
}
|
|
961
|
-
static getRefId(zodSchema) {
|
|
962
|
-
var _a;
|
|
963
|
-
return (_a = this.getInternalMetadata(zodSchema)) === null || _a === undefined ? undefined : _a.refId;
|
|
964
|
-
}
|
|
965
|
-
static unwrapChained(schema) {
|
|
966
|
-
return this.unwrapUntil(schema);
|
|
967
|
-
}
|
|
968
|
-
static getDefaultValue(zodSchema) {
|
|
969
|
-
var _a;
|
|
970
|
-
const unwrapped = (_a = this.unwrapUntil(zodSchema, "ZodDefault")) !== null && _a !== undefined ? _a : this.unwrapUntil(zodSchema, "ZodPrefault");
|
|
971
|
-
return unwrapped === null || unwrapped === undefined ? undefined : unwrapped._zod.def.defaultValue;
|
|
972
|
-
}
|
|
973
|
-
static unwrapUntil(schema, typeName) {
|
|
974
|
-
if (typeName && isZodType(schema, typeName)) {
|
|
975
|
-
return schema;
|
|
976
|
-
}
|
|
977
|
-
if (isZodType(schema, [
|
|
978
|
-
"ZodOptional",
|
|
979
|
-
"ZodNullable",
|
|
980
|
-
"ZodDefault",
|
|
981
|
-
"ZodPrefault",
|
|
982
|
-
"ZodReadonly",
|
|
983
|
-
"ZodNonOptional"
|
|
984
|
-
]) && isAnyZodType(schema._zod.def.innerType)) {
|
|
985
|
-
return this.unwrapUntil(schema._zod.def.innerType, typeName);
|
|
986
|
-
}
|
|
987
|
-
if (isZodType(schema, "ZodPipe")) {
|
|
988
|
-
const inSchema = schema._zod.def.in;
|
|
989
|
-
const outSchema = schema._zod.def.out;
|
|
990
|
-
if (isZodType(inSchema, "ZodTransform") && isAnyZodType(outSchema)) {
|
|
991
|
-
return this.unwrapUntil(outSchema, typeName);
|
|
992
|
-
}
|
|
993
|
-
if (isAnyZodType(inSchema)) {
|
|
994
|
-
return this.unwrapUntil(inSchema, typeName);
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
return typeName ? undefined : schema;
|
|
998
|
-
}
|
|
999
|
-
static getMetadataFromInternalRegistry(zodSchema) {
|
|
1000
|
-
return zodToOpenAPIRegistry.get(zodSchema);
|
|
1001
|
-
}
|
|
1002
|
-
static getMetadataFromRegistry(zodSchema) {
|
|
1003
|
-
const internal = this.getMetadataFromInternalRegistry(zodSchema);
|
|
1004
|
-
const general = zodSchema.meta();
|
|
1005
|
-
if (!internal) {
|
|
1006
|
-
return general;
|
|
1007
|
-
}
|
|
1008
|
-
const { _internal } = internal, rest = __rest(internal, ["_internal"]);
|
|
1009
|
-
const _a = general !== null && general !== undefined ? general : {}, { id, title } = _a, restGeneral = __rest(_a, ["id", "title"]);
|
|
1010
|
-
return Object.assign(Object.assign(Object.assign({ _internal: Object.assign(Object.assign({}, id ? { refId: id } : {}), _internal) }, rest), title ? { description: title } : {}), restGeneral);
|
|
1011
|
-
}
|
|
1012
|
-
static setMetadataInRegistry(zodSchema, metadata) {
|
|
1013
|
-
zodToOpenAPIRegistry.add(zodSchema, metadata);
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
function preserveMetadataFromModifier(zodSchema, modifier) {
|
|
1017
|
-
const zodModifier = zodSchema[modifier];
|
|
1018
|
-
if (typeof zodModifier !== "function") {
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
zodSchema[modifier] = function(...args) {
|
|
1022
|
-
const result = zodModifier.apply(this, args);
|
|
1023
|
-
const meta = Metadata.getMetadataFromRegistry(this);
|
|
1024
|
-
if (meta) {
|
|
1025
|
-
Metadata.setMetadataInRegistry(result, meta);
|
|
1026
|
-
}
|
|
1027
|
-
return result;
|
|
1028
|
-
};
|
|
1029
|
-
}
|
|
1030
|
-
function extendZodWithOpenApi(zod) {
|
|
1031
|
-
if (typeof zod.ZodType.prototype.openapi !== "undefined") {
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
zod.ZodType.prototype.openapi = function(...args) {
|
|
1035
|
-
const { refId, metadata, options } = getOpenApiConfiguration(...args);
|
|
1036
|
-
const _a = metadata !== null && metadata !== undefined ? metadata : {}, { param } = _a, restOfOpenApi = __rest(_a, ["param"]);
|
|
1037
|
-
const allMetadata = Metadata.getMetadataFromRegistry(this);
|
|
1038
|
-
const _b = allMetadata !== null && allMetadata !== undefined ? allMetadata : {}, { _internal: internalMetadata } = _b, currentMetadata = __rest(_b, ["_internal"]);
|
|
1039
|
-
const _internal = Object.assign(Object.assign(Object.assign({}, internalMetadata), options), refId ? { refId } : undefined);
|
|
1040
|
-
const resultMetadata = Object.assign(Object.assign(Object.assign({}, currentMetadata), restOfOpenApi), (currentMetadata === null || currentMetadata === undefined ? undefined : currentMetadata.param) || param ? {
|
|
1041
|
-
param: Object.assign(Object.assign({}, currentMetadata === null || currentMetadata === undefined ? undefined : currentMetadata.param), param)
|
|
1042
|
-
} : undefined);
|
|
1043
|
-
const result = new this.constructor(this._def);
|
|
1044
|
-
function setMetadata(schema) {
|
|
1045
|
-
Metadata.setMetadataInRegistry(schema, Object.assign(Object.assign({}, Object.keys(_internal).length > 0 ? { _internal } : undefined), resultMetadata));
|
|
1046
|
-
}
|
|
1047
|
-
setMetadata(result);
|
|
1048
|
-
if (isZodType(result, "ZodLazy")) {
|
|
1049
|
-
setMetadata(this);
|
|
1050
|
-
}
|
|
1051
|
-
if (isZodType(result, "ZodObject")) {
|
|
1052
|
-
const currentMetadata2 = Metadata.getMetadataFromRegistry(result);
|
|
1053
|
-
const originalExtend = result.extend;
|
|
1054
|
-
result.extend = function(...args2) {
|
|
1055
|
-
const extendedResult = originalExtend.apply(result, args2);
|
|
1056
|
-
const _a2 = currentMetadata2 !== null && currentMetadata2 !== undefined ? currentMetadata2 : {}, { _internal: _internal2 } = _a2, rest = __rest(_a2, ["_internal"]);
|
|
1057
|
-
Metadata.setMetadataInRegistry(extendedResult, {
|
|
1058
|
-
_internal: {
|
|
1059
|
-
extendedFrom: (_internal2 === null || _internal2 === undefined ? undefined : _internal2.refId) ? { refId: _internal2.refId, schema: result } : _internal2 === null || _internal2 === undefined ? undefined : _internal2.extendedFrom
|
|
1060
|
-
}
|
|
1061
|
-
});
|
|
1062
|
-
return extendedResult.openapi(rest);
|
|
1063
|
-
};
|
|
1064
|
-
preserveMetadataFromModifier(result, "catchall");
|
|
1065
|
-
}
|
|
1066
|
-
preserveMetadataFromModifier(result, "optional");
|
|
1067
|
-
preserveMetadataFromModifier(result, "nullable");
|
|
1068
|
-
preserveMetadataFromModifier(result, "default");
|
|
1069
|
-
preserveMetadataFromModifier(result, "transform");
|
|
1070
|
-
preserveMetadataFromModifier(result, "refine");
|
|
1071
|
-
preserveMetadataFromModifier(result, "length");
|
|
1072
|
-
preserveMetadataFromModifier(result, "min");
|
|
1073
|
-
preserveMetadataFromModifier(result, "max");
|
|
1074
|
-
const originalMeta = result.meta;
|
|
1075
|
-
result.meta = function(...args2) {
|
|
1076
|
-
const result2 = originalMeta.apply(this, args2);
|
|
1077
|
-
if (args2[0]) {
|
|
1078
|
-
const meta = Metadata.getMetadataFromInternalRegistry(this);
|
|
1079
|
-
if (meta) {
|
|
1080
|
-
Metadata.setMetadataInRegistry(result2, Object.assign(Object.assign({}, meta), args2[0]));
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
return result2;
|
|
1084
|
-
};
|
|
1085
|
-
return result;
|
|
1086
|
-
};
|
|
1087
|
-
}
|
|
1088
|
-
function getOpenApiConfiguration(refOrOpenapi, metadataOrOptions, options) {
|
|
1089
|
-
if (typeof refOrOpenapi === "string") {
|
|
1090
|
-
return {
|
|
1091
|
-
refId: refOrOpenapi,
|
|
1092
|
-
metadata: metadataOrOptions,
|
|
1093
|
-
options
|
|
1094
|
-
};
|
|
1095
|
-
}
|
|
1096
|
-
return {
|
|
1097
|
-
refId: undefined,
|
|
1098
|
-
metadata: refOrOpenapi,
|
|
1099
|
-
options: metadataOrOptions
|
|
1100
|
-
};
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
class OpenAPIRegistry {
|
|
1104
|
-
constructor(parents) {
|
|
1105
|
-
this.parents = parents;
|
|
1106
|
-
this._definitions = [];
|
|
1107
|
-
}
|
|
1108
|
-
get definitions() {
|
|
1109
|
-
var _a, _b;
|
|
1110
|
-
const parentDefinitions = (_b = (_a = this.parents) === null || _a === undefined ? undefined : _a.flatMap((par) => par._definitions)) !== null && _b !== undefined ? _b : [];
|
|
1111
|
-
return [...parentDefinitions, ...this._definitions];
|
|
1112
|
-
}
|
|
1113
|
-
register(refId, zodSchema) {
|
|
1114
|
-
const schemaWithRefId = this.schemaWithRefId(refId, zodSchema);
|
|
1115
|
-
this._definitions.push({ type: "schema", schema: schemaWithRefId });
|
|
1116
|
-
return schemaWithRefId;
|
|
1117
|
-
}
|
|
1118
|
-
registerParameter(refId, zodSchema) {
|
|
1119
|
-
var _a, _b, _c;
|
|
1120
|
-
const schemaWithRefId = this.schemaWithRefId(refId, zodSchema);
|
|
1121
|
-
const currentMetadata = (_a = Metadata.getOpenApiMetadata(schemaWithRefId)) !== null && _a !== undefined ? _a : {};
|
|
1122
|
-
const schemaWithMetadata = schemaWithRefId.openapi(Object.assign(Object.assign({}, currentMetadata), { param: Object.assign(Object.assign({}, currentMetadata === null || currentMetadata === undefined ? undefined : currentMetadata.param), { name: (_c = (_b = currentMetadata === null || currentMetadata === undefined ? undefined : currentMetadata.param) === null || _b === undefined ? undefined : _b.name) !== null && _c !== undefined ? _c : refId }) }));
|
|
1123
|
-
this._definitions.push({
|
|
1124
|
-
type: "parameter",
|
|
1125
|
-
schema: schemaWithMetadata
|
|
1126
|
-
});
|
|
1127
|
-
return schemaWithMetadata;
|
|
1128
|
-
}
|
|
1129
|
-
registerPath(route) {
|
|
1130
|
-
this._definitions.push({
|
|
1131
|
-
type: "route",
|
|
1132
|
-
route
|
|
1133
|
-
});
|
|
1134
|
-
}
|
|
1135
|
-
registerWebhook(webhook) {
|
|
1136
|
-
this._definitions.push({
|
|
1137
|
-
type: "webhook",
|
|
1138
|
-
webhook
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
registerComponent(type, name, component) {
|
|
1142
|
-
this._definitions.push({
|
|
1143
|
-
type: "component",
|
|
1144
|
-
componentType: type,
|
|
1145
|
-
name,
|
|
1146
|
-
component
|
|
1147
|
-
});
|
|
1148
|
-
return {
|
|
1149
|
-
name,
|
|
1150
|
-
ref: { $ref: `#/components/${type}/${name}` }
|
|
1151
|
-
};
|
|
1152
|
-
}
|
|
1153
|
-
schemaWithRefId(refId, zodSchema) {
|
|
1154
|
-
return zodSchema.openapi(refId);
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
class ZodToOpenAPIError {
|
|
1159
|
-
constructor(message) {
|
|
1160
|
-
this.message = message;
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
function enhanceMissingParametersError(action, paramsToAdd) {
|
|
1164
|
-
try {
|
|
1165
|
-
return action();
|
|
1166
|
-
} catch (error) {
|
|
1167
|
-
if (error instanceof MissingParameterDataError) {
|
|
1168
|
-
throw new MissingParameterDataError(Object.assign(Object.assign({}, error.data), paramsToAdd));
|
|
1169
|
-
}
|
|
1170
|
-
throw error;
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
class ArrayTransformer {
|
|
1175
|
-
transform(zodSchema, mapNullableType, mapItems) {
|
|
1176
|
-
var _a, _b, _c, _d;
|
|
1177
|
-
const itemType = zodSchema.def.element;
|
|
1178
|
-
const minItems = (_b = (_a = zodSchema.def.checks) === null || _a === undefined ? undefined : _a.find((check) => check._zod.def.check === "min_length")) === null || _b === undefined ? undefined : _b._zod.def.minimum;
|
|
1179
|
-
const maxItems = (_d = (_c = zodSchema.def.checks) === null || _c === undefined ? undefined : _c.find((check) => check._zod.def.check === "max_length")) === null || _d === undefined ? undefined : _d._zod.def.maximum;
|
|
1180
|
-
return Object.assign(Object.assign({}, mapNullableType("array")), {
|
|
1181
|
-
items: isAnyZodType(itemType) ? mapItems(itemType) : {},
|
|
1182
|
-
minItems,
|
|
1183
|
-
maxItems
|
|
1184
|
-
});
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
class BigIntTransformer {
|
|
1189
|
-
transform(mapNullableType) {
|
|
1190
|
-
return Object.assign(Object.assign({}, mapNullableType("string")), { pattern: `^d+$` });
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
class DiscriminatedUnionTransformer {
|
|
1195
|
-
transform(zodSchema, isNullable, mapNullableOfArray, mapItem, generateSchemaRef) {
|
|
1196
|
-
const options = [...zodSchema.def.options];
|
|
1197
|
-
const optionSchema = options.map(mapItem);
|
|
1198
|
-
if (isNullable) {
|
|
1199
|
-
return {
|
|
1200
|
-
oneOf: mapNullableOfArray(optionSchema, isNullable)
|
|
1201
|
-
};
|
|
1202
|
-
}
|
|
1203
|
-
const discriminator = zodSchema._zod.def.discriminator;
|
|
1204
|
-
if (!discriminator) {
|
|
1205
|
-
console.error("No discriminator found for discriminated union", zodSchema);
|
|
1206
|
-
return {
|
|
1207
|
-
oneOf: optionSchema
|
|
1208
|
-
};
|
|
1209
|
-
}
|
|
1210
|
-
return {
|
|
1211
|
-
oneOf: optionSchema,
|
|
1212
|
-
discriminator: this.mapDiscriminator(options, discriminator, generateSchemaRef)
|
|
1213
|
-
};
|
|
1214
|
-
}
|
|
1215
|
-
mapDiscriminator(zodObjects, discriminator, generateSchemaRef) {
|
|
1216
|
-
if (zodObjects.some((obj) => Metadata.getRefId(obj) === undefined)) {
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
|
-
const mapping = {};
|
|
1220
|
-
zodObjects.forEach((obj) => {
|
|
1221
|
-
var _a;
|
|
1222
|
-
const refId = Metadata.getRefId(obj);
|
|
1223
|
-
const value = (_a = obj.def.shape) === null || _a === undefined ? undefined : _a[discriminator];
|
|
1224
|
-
if (isZodType(value, "ZodEnum")) {
|
|
1225
|
-
const keys = Object.values(value._zod.def.entries).filter(isString);
|
|
1226
|
-
keys.forEach((enumValue) => {
|
|
1227
|
-
mapping[enumValue] = generateSchemaRef(refId);
|
|
1228
|
-
});
|
|
1229
|
-
return;
|
|
1230
|
-
}
|
|
1231
|
-
const literalValue = value === null || value === undefined ? undefined : value.def.values[0];
|
|
1232
|
-
if (typeof literalValue !== "string") {
|
|
1233
|
-
throw new Error(`Discriminator ${discriminator} could not be found in one of the values of a discriminated union`);
|
|
1234
|
-
}
|
|
1235
|
-
mapping[literalValue] = generateSchemaRef(refId);
|
|
1236
|
-
});
|
|
1237
|
-
return {
|
|
1238
|
-
propertyName: discriminator,
|
|
1239
|
-
mapping
|
|
1240
|
-
};
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
function enumInfo(enumObject) {
|
|
1244
|
-
const keysExceptReverseMappings = Object.keys(enumObject).filter((key) => typeof enumObject[enumObject[key]] !== "number");
|
|
1245
|
-
const values = keysExceptReverseMappings.map((key) => enumObject[key]);
|
|
1246
|
-
const numericCount = values.filter((_) => typeof _ === "number").length;
|
|
1247
|
-
const type = numericCount === 0 ? "string" : numericCount === values.length ? "numeric" : "mixed";
|
|
1248
|
-
return { values, type };
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
class EnumTransformer {
|
|
1252
|
-
transform(zodSchema, isNullable, mapNullableType) {
|
|
1253
|
-
const { type, values } = enumInfo(zodSchema._zod.def.entries);
|
|
1254
|
-
if (type === "mixed") {
|
|
1255
|
-
throw new ZodToOpenAPIError("Enum has mixed string and number values, please specify the OpenAPI type manually");
|
|
1256
|
-
}
|
|
1257
|
-
return Object.assign(Object.assign({}, mapNullableType(type === "numeric" ? "integer" : "string")), { enum: isNullable ? [...values, null] : values });
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
class IntersectionTransformer {
|
|
1262
|
-
transform(zodSchema, isNullable, mapNullableOfArray, mapItem) {
|
|
1263
|
-
const subtypes = this.flattenIntersectionTypes(zodSchema);
|
|
1264
|
-
const allOfSchema = {
|
|
1265
|
-
allOf: subtypes.map(mapItem)
|
|
1266
|
-
};
|
|
1267
|
-
if (isNullable) {
|
|
1268
|
-
return {
|
|
1269
|
-
anyOf: mapNullableOfArray([allOfSchema], isNullable)
|
|
1270
|
-
};
|
|
1271
|
-
}
|
|
1272
|
-
return allOfSchema;
|
|
1273
|
-
}
|
|
1274
|
-
flattenIntersectionTypes(schema) {
|
|
1275
|
-
if (!isZodType(schema, "ZodIntersection")) {
|
|
1276
|
-
return [schema];
|
|
1277
|
-
}
|
|
1278
|
-
const leftSubTypes = isAnyZodType(schema._zod.def.left) ? this.flattenIntersectionTypes(schema._zod.def.left) : [];
|
|
1279
|
-
const rightSubTypes = isAnyZodType(schema._zod.def.right) ? this.flattenIntersectionTypes(schema._zod.def.right) : [];
|
|
1280
|
-
return [...leftSubTypes, ...rightSubTypes];
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
class LiteralTransformer {
|
|
1285
|
-
constructor() {
|
|
1286
|
-
this.bigIntTransformer = new BigIntTransformer;
|
|
1287
|
-
}
|
|
1288
|
-
transform(zodSchema, mapNullableType) {
|
|
1289
|
-
const type = typeof zodSchema.def.values[0];
|
|
1290
|
-
if (type === "boolean" || type === "number" || type === "string" || type === "object") {
|
|
1291
|
-
return Object.assign(Object.assign({}, mapNullableType(type)), { enum: [zodSchema.def.values[0]] });
|
|
1292
|
-
}
|
|
1293
|
-
if (type === "bigint") {
|
|
1294
|
-
return this.bigIntTransformer.transform(mapNullableType);
|
|
1295
|
-
}
|
|
1296
|
-
return mapNullableType("null");
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
class NumberTransformer {
|
|
1301
|
-
transform(zodSchema, mapNullableType, getNumberChecks) {
|
|
1302
|
-
var _a;
|
|
1303
|
-
return Object.assign(Object.assign(Object.assign({}, mapNullableType("number")), mapNullableType(zodSchema.format === "safeint" ? "integer" : "number")), getNumberChecks((_a = zodSchema.def.checks) !== null && _a !== undefined ? _a : []));
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
class ObjectTransformer {
|
|
1308
|
-
transform(zodSchema, defaultValue, mapNullableType, mapItem) {
|
|
1309
|
-
var _a;
|
|
1310
|
-
const extendedFrom = (_a = Metadata.getInternalMetadata(zodSchema)) === null || _a === undefined ? undefined : _a.extendedFrom;
|
|
1311
|
-
const required = this.requiredKeysOf(zodSchema);
|
|
1312
|
-
const properties = mapValues(zodSchema.def.shape, mapItem);
|
|
1313
|
-
if (!extendedFrom) {
|
|
1314
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, mapNullableType("object")), { properties, default: defaultValue }), required.length > 0 ? { required } : {}), this.generateAdditionalProperties(zodSchema, mapItem));
|
|
1315
|
-
}
|
|
1316
|
-
const parent = extendedFrom.schema;
|
|
1317
|
-
mapItem(parent);
|
|
1318
|
-
const keysRequiredByParent = this.requiredKeysOf(parent);
|
|
1319
|
-
const propsOfParent = mapValues(parent === null || parent === undefined ? undefined : parent.def.shape, mapItem);
|
|
1320
|
-
const propertiesToAdd = Object.fromEntries(Object.entries(properties).filter(([key, type]) => {
|
|
1321
|
-
return !objectEquals(propsOfParent[key], type);
|
|
1322
|
-
}));
|
|
1323
|
-
const additionallyRequired = required.filter((prop) => !keysRequiredByParent.includes(prop));
|
|
1324
|
-
const objectData = Object.assign(Object.assign(Object.assign(Object.assign({}, mapNullableType("object")), { default: defaultValue, properties: propertiesToAdd }), additionallyRequired.length > 0 ? { required: additionallyRequired } : {}), this.generateAdditionalProperties(zodSchema, mapItem));
|
|
1325
|
-
return {
|
|
1326
|
-
allOf: [
|
|
1327
|
-
{ $ref: `#/components/schemas/${extendedFrom.refId}` },
|
|
1328
|
-
objectData
|
|
1329
|
-
]
|
|
1330
|
-
};
|
|
1331
|
-
}
|
|
1332
|
-
generateAdditionalProperties(zodSchema, mapItem) {
|
|
1333
|
-
const catchallSchema = zodSchema.def.catchall;
|
|
1334
|
-
if (!catchallSchema) {
|
|
1335
|
-
return {};
|
|
1336
|
-
}
|
|
1337
|
-
if (isZodType(catchallSchema, "ZodNever")) {
|
|
1338
|
-
return { additionalProperties: false };
|
|
1339
|
-
}
|
|
1340
|
-
if (isAnyZodType(catchallSchema)) {
|
|
1341
|
-
return { additionalProperties: mapItem(catchallSchema) };
|
|
1342
|
-
}
|
|
1343
|
-
return {};
|
|
1344
|
-
}
|
|
1345
|
-
requiredKeysOf(objectSchema) {
|
|
1346
|
-
return Object.entries(objectSchema.def.shape).filter(([_key, type]) => !isOptionalSchema(type)).map(([key, _type]) => key);
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
class RecordTransformer {
|
|
1351
|
-
transform(zodSchema, mapNullableType, mapItem) {
|
|
1352
|
-
const propertiesType = zodSchema.valueType;
|
|
1353
|
-
const keyType = zodSchema.keyType;
|
|
1354
|
-
const propertiesSchema = isAnyZodType(propertiesType) ? mapItem(propertiesType) : {};
|
|
1355
|
-
if (isZodType(keyType, "ZodEnum")) {
|
|
1356
|
-
const keys = Object.values(keyType._zod.def.entries).filter(isString);
|
|
1357
|
-
const properties = keys.reduce((acc, curr) => Object.assign(Object.assign({}, acc), { [curr]: propertiesSchema }), {});
|
|
1358
|
-
return Object.assign(Object.assign({}, mapNullableType("object")), { properties });
|
|
1359
|
-
}
|
|
1360
|
-
return Object.assign(Object.assign({}, mapNullableType("object")), { additionalProperties: propertiesSchema });
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
function isZodCheckLengthEquals(check) {
|
|
1364
|
-
return check._zod.def.check === "length_equals";
|
|
1365
|
-
}
|
|
1366
|
-
function isZodCheckRegex(check) {
|
|
1367
|
-
return check._zod.def.check === "string_format" && check._zod.def.format === "regex";
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
class StringTransformer {
|
|
1371
|
-
transform(zodSchema, mapNullableType) {
|
|
1372
|
-
var _a, _b, _c, _d;
|
|
1373
|
-
const regexCheck = (_a = zodSchema.def.checks) === null || _a === undefined ? undefined : _a.find(isZodCheckRegex);
|
|
1374
|
-
const pattern = regexCheck === null || regexCheck === undefined ? undefined : regexCheck._zod.def.pattern.toString().replace(/^\/|\/$/g, "");
|
|
1375
|
-
const check = (_b = zodSchema.def.checks) === null || _b === undefined ? undefined : _b.find(isZodCheckLengthEquals);
|
|
1376
|
-
const length = check === null || check === undefined ? undefined : check._zod.def.length;
|
|
1377
|
-
const maxLength = Number.isFinite(zodSchema.minLength) ? (_c = zodSchema.minLength) !== null && _c !== undefined ? _c : undefined : undefined;
|
|
1378
|
-
const minLength = Number.isFinite(zodSchema.maxLength) ? (_d = zodSchema.maxLength) !== null && _d !== undefined ? _d : undefined : undefined;
|
|
1379
|
-
return Object.assign(Object.assign({}, mapNullableType("string")), {
|
|
1380
|
-
minLength: length !== null && length !== undefined ? length : maxLength,
|
|
1381
|
-
maxLength: length !== null && length !== undefined ? length : minLength,
|
|
1382
|
-
format: this.mapStringFormat(zodSchema),
|
|
1383
|
-
pattern
|
|
1384
|
-
});
|
|
1385
|
-
}
|
|
1386
|
-
mapStringFormat(zodString) {
|
|
1387
|
-
if (zodString.format === "uuid")
|
|
1388
|
-
return "uuid";
|
|
1389
|
-
if (zodString.format === "email")
|
|
1390
|
-
return "email";
|
|
1391
|
-
if (zodString.format === "url")
|
|
1392
|
-
return "uri";
|
|
1393
|
-
if (zodString.format === "date")
|
|
1394
|
-
return "date";
|
|
1395
|
-
if (zodString.format === "datetime")
|
|
1396
|
-
return "date-time";
|
|
1397
|
-
if (zodString.format === "cuid")
|
|
1398
|
-
return "cuid";
|
|
1399
|
-
if (zodString.format === "cuid2")
|
|
1400
|
-
return "cuid2";
|
|
1401
|
-
if (zodString.format === "ulid")
|
|
1402
|
-
return "ulid";
|
|
1403
|
-
if (zodString.format === "ipv4")
|
|
1404
|
-
return "ip";
|
|
1405
|
-
if (zodString.format === "ipv6")
|
|
1406
|
-
return "ip";
|
|
1407
|
-
if (zodString.format === "emoji")
|
|
1408
|
-
return "emoji";
|
|
1409
|
-
return;
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
|
-
class TupleTransformer {
|
|
1414
|
-
constructor(versionSpecifics) {
|
|
1415
|
-
this.versionSpecifics = versionSpecifics;
|
|
1416
|
-
}
|
|
1417
|
-
transform(zodSchema, mapNullableType, mapItem) {
|
|
1418
|
-
const items = zodSchema._zod.def.items;
|
|
1419
|
-
const schemas = items.map((item) => isAnyZodType(item) ? mapItem(item) : {});
|
|
1420
|
-
return Object.assign(Object.assign({}, mapNullableType("array")), this.versionSpecifics.mapTupleItems(schemas));
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
class UnionTransformer {
|
|
1425
|
-
constructor(options) {
|
|
1426
|
-
this.options = options;
|
|
1427
|
-
}
|
|
1428
|
-
transform(zodSchema, mapNullableOfArray, mapItem) {
|
|
1429
|
-
var _a, _b, _c;
|
|
1430
|
-
const internalMetadata = Metadata.getInternalMetadata(zodSchema);
|
|
1431
|
-
const preferredType = (_c = (_a = internalMetadata === null || internalMetadata === undefined ? undefined : internalMetadata.unionPreferredType) !== null && _a !== undefined ? _a : (_b = this.options) === null || _b === undefined ? undefined : _b.unionPreferredType) !== null && _c !== undefined ? _c : "anyOf";
|
|
1432
|
-
const options = this.flattenUnionTypes(zodSchema);
|
|
1433
|
-
const schemas = options.map((schema) => {
|
|
1434
|
-
const optionToGenerate = this.unwrapNullable(schema);
|
|
1435
|
-
return mapItem(optionToGenerate);
|
|
1436
|
-
});
|
|
1437
|
-
return {
|
|
1438
|
-
[preferredType]: mapNullableOfArray(schemas)
|
|
1439
|
-
};
|
|
1440
|
-
}
|
|
1441
|
-
flattenUnionTypes(schema) {
|
|
1442
|
-
if (!isZodType(schema, "ZodUnion")) {
|
|
1443
|
-
return [schema];
|
|
1444
|
-
}
|
|
1445
|
-
const options = schema.def.options;
|
|
1446
|
-
return options.flatMap((option) => isAnyZodType(option) ? this.flattenUnionTypes(option) : []);
|
|
1447
|
-
}
|
|
1448
|
-
unwrapNullable(schema) {
|
|
1449
|
-
if (isZodType(schema, "ZodNullable")) {
|
|
1450
|
-
const unwrapped = schema.unwrap();
|
|
1451
|
-
if (isAnyZodType(unwrapped)) {
|
|
1452
|
-
return this.unwrapNullable(unwrapped);
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
return schema;
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
class DateTransformer {
|
|
1460
|
-
transform(mapNullableType) {
|
|
1461
|
-
return Object.assign(Object.assign({}, mapNullableType("string")), { format: "date-time" });
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
class LazyTransformer {
|
|
1466
|
-
transform(zodSchema, mapItem, mapNullableType, mapNullableRef) {
|
|
1467
|
-
const result = mapItem(zodSchema._zod.def.getter());
|
|
1468
|
-
return LazyTransformer.mapRecursive(result, mapNullableType, mapNullableRef);
|
|
1469
|
-
}
|
|
1470
|
-
static mapRecursive(schema, mapNullableType, mapNullableRef) {
|
|
1471
|
-
if ("$ref" in schema) {
|
|
1472
|
-
return mapNullableRef(schema);
|
|
1473
|
-
}
|
|
1474
|
-
if (schema.type) {
|
|
1475
|
-
return Object.assign(Object.assign({}, schema), mapNullableType(schema.type));
|
|
1476
|
-
}
|
|
1477
|
-
return schema;
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
class TemplateLiteralTransformer {
|
|
1482
|
-
transform(zodSchema, mapNullableType) {
|
|
1483
|
-
const parts = zodSchema.def.parts;
|
|
1484
|
-
const contentPattern = parts.map((part) => this.generatePattern(part)).join("");
|
|
1485
|
-
return Object.assign(Object.assign({}, mapNullableType("string")), { pattern: `^${contentPattern}$` });
|
|
1486
|
-
}
|
|
1487
|
-
generatePattern(part) {
|
|
1488
|
-
if (typeof part === "string" || typeof part === "number" || typeof part === "boolean" || typeof part === "bigint" || part === null || part === undefined) {
|
|
1489
|
-
return this.escapeRegex(String(part));
|
|
1490
|
-
}
|
|
1491
|
-
if (isZodType(part, "ZodLiteral")) {
|
|
1492
|
-
const value = part.def.values[0];
|
|
1493
|
-
return this.escapeRegex(String(value));
|
|
1494
|
-
}
|
|
1495
|
-
if (isZodType(part, "ZodNumber")) {
|
|
1496
|
-
return "[+-]?\\d+(\\.\\d+)?";
|
|
1497
|
-
}
|
|
1498
|
-
if (isZodType(part, "ZodBoolean")) {
|
|
1499
|
-
return "(true|false)";
|
|
1500
|
-
}
|
|
1501
|
-
if (isZodType(part, "ZodEnum")) {
|
|
1502
|
-
const { values } = enumInfo(part.def.entries);
|
|
1503
|
-
return `(${values.map((v) => this.escapeRegex(String(v))).join("|")})`;
|
|
1504
|
-
}
|
|
1505
|
-
return ".*";
|
|
1506
|
-
}
|
|
1507
|
-
escapeRegex(str) {
|
|
1508
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
class OpenApiTransformer {
|
|
1513
|
-
constructor(versionSpecifics, options) {
|
|
1514
|
-
this.versionSpecifics = versionSpecifics;
|
|
1515
|
-
this.objectTransformer = new ObjectTransformer;
|
|
1516
|
-
this.stringTransformer = new StringTransformer;
|
|
1517
|
-
this.numberTransformer = new NumberTransformer;
|
|
1518
|
-
this.bigIntTransformer = new BigIntTransformer;
|
|
1519
|
-
this.dateTransformer = new DateTransformer;
|
|
1520
|
-
this.lazyTransformer = new LazyTransformer;
|
|
1521
|
-
this.literalTransformer = new LiteralTransformer;
|
|
1522
|
-
this.templateLiteralTransformer = new TemplateLiteralTransformer;
|
|
1523
|
-
this.enumTransformer = new EnumTransformer;
|
|
1524
|
-
this.arrayTransformer = new ArrayTransformer;
|
|
1525
|
-
this.discriminatedUnionTransformer = new DiscriminatedUnionTransformer;
|
|
1526
|
-
this.intersectionTransformer = new IntersectionTransformer;
|
|
1527
|
-
this.recordTransformer = new RecordTransformer;
|
|
1528
|
-
this.tupleTransformer = new TupleTransformer(versionSpecifics);
|
|
1529
|
-
this.unionTransformer = new UnionTransformer(options);
|
|
1530
|
-
}
|
|
1531
|
-
transform(zodSchema, isNullable, mapItem, generateSchemaRef, defaultValue) {
|
|
1532
|
-
if (isZodType(zodSchema, "ZodNull")) {
|
|
1533
|
-
return this.versionSpecifics.nullType;
|
|
1534
|
-
}
|
|
1535
|
-
if (isZodType(zodSchema, "ZodUnknown") || isZodType(zodSchema, "ZodAny")) {
|
|
1536
|
-
return this.versionSpecifics.mapNullableType(undefined, isNullable);
|
|
1537
|
-
}
|
|
1538
|
-
if (isZodType(zodSchema, "ZodObject")) {
|
|
1539
|
-
return this.objectTransformer.transform(zodSchema, defaultValue, (_) => this.versionSpecifics.mapNullableType(_, isNullable), mapItem);
|
|
1540
|
-
}
|
|
1541
|
-
const schema = this.transformSchemaWithoutDefault(zodSchema, isNullable, mapItem, generateSchemaRef);
|
|
1542
|
-
return Object.assign(Object.assign({}, schema), { default: defaultValue });
|
|
1543
|
-
}
|
|
1544
|
-
transformSchemaWithoutDefault(zodSchema, isNullable, mapItem, generateSchemaRef) {
|
|
1545
|
-
if (isZodType(zodSchema, "ZodUnknown") || isZodType(zodSchema, "ZodAny")) {
|
|
1546
|
-
return this.versionSpecifics.mapNullableType(undefined, isNullable);
|
|
1547
|
-
}
|
|
1548
|
-
if (isZodType(zodSchema, "ZodString")) {
|
|
1549
|
-
return this.stringTransformer.transform(zodSchema, (schema) => this.versionSpecifics.mapNullableType(schema, isNullable));
|
|
1550
|
-
}
|
|
1551
|
-
if (isZodType(zodSchema, "ZodNumber")) {
|
|
1552
|
-
return this.numberTransformer.transform(zodSchema, (schema) => this.versionSpecifics.mapNullableType(schema, isNullable), (_) => this.versionSpecifics.getNumberChecks(_));
|
|
1553
|
-
}
|
|
1554
|
-
if (isZodType(zodSchema, "ZodBigInt")) {
|
|
1555
|
-
return this.bigIntTransformer.transform((schema) => this.versionSpecifics.mapNullableType(schema, isNullable));
|
|
1556
|
-
}
|
|
1557
|
-
if (isZodType(zodSchema, "ZodBoolean")) {
|
|
1558
|
-
return this.versionSpecifics.mapNullableType("boolean", isNullable);
|
|
1559
|
-
}
|
|
1560
|
-
if (isZodType(zodSchema, "ZodLazy")) {
|
|
1561
|
-
return this.lazyTransformer.transform(zodSchema, mapItem, (schema) => this.versionSpecifics.mapNullableType(schema, isNullable), (schema) => this.versionSpecifics.mapNullableOfRef(schema, isNullable));
|
|
1562
|
-
}
|
|
1563
|
-
if (isZodType(zodSchema, "ZodLiteral")) {
|
|
1564
|
-
return this.literalTransformer.transform(zodSchema, (schema) => this.versionSpecifics.mapNullableType(schema, isNullable));
|
|
1565
|
-
}
|
|
1566
|
-
if (isZodType(zodSchema, "ZodTemplateLiteral")) {
|
|
1567
|
-
return this.templateLiteralTransformer.transform(zodSchema, (schema) => this.versionSpecifics.mapNullableType(schema, isNullable));
|
|
1568
|
-
}
|
|
1569
|
-
if (isZodType(zodSchema, "ZodEnum")) {
|
|
1570
|
-
return this.enumTransformer.transform(zodSchema, isNullable, (schema) => this.versionSpecifics.mapNullableType(schema, isNullable));
|
|
1571
|
-
}
|
|
1572
|
-
if (isZodType(zodSchema, "ZodArray")) {
|
|
1573
|
-
return this.arrayTransformer.transform(zodSchema, (_) => this.versionSpecifics.mapNullableType(_, isNullable), mapItem);
|
|
1574
|
-
}
|
|
1575
|
-
if (isZodType(zodSchema, "ZodTuple")) {
|
|
1576
|
-
return this.tupleTransformer.transform(zodSchema, (_) => this.versionSpecifics.mapNullableType(_, isNullable), mapItem);
|
|
1577
|
-
}
|
|
1578
|
-
if (isZodType(zodSchema, "ZodDiscriminatedUnion")) {
|
|
1579
|
-
return this.discriminatedUnionTransformer.transform(zodSchema, isNullable, (_) => this.versionSpecifics.mapNullableOfArray(_, isNullable), mapItem, generateSchemaRef);
|
|
1580
|
-
}
|
|
1581
|
-
if (isZodType(zodSchema, "ZodUnion")) {
|
|
1582
|
-
return this.unionTransformer.transform(zodSchema, (_) => this.versionSpecifics.mapNullableOfArray(_, isNullable), mapItem);
|
|
1583
|
-
}
|
|
1584
|
-
if (isZodType(zodSchema, "ZodIntersection")) {
|
|
1585
|
-
return this.intersectionTransformer.transform(zodSchema, isNullable, (_) => this.versionSpecifics.mapNullableOfArray(_, isNullable), mapItem);
|
|
1586
|
-
}
|
|
1587
|
-
if (isZodType(zodSchema, "ZodRecord")) {
|
|
1588
|
-
return this.recordTransformer.transform(zodSchema, (_) => this.versionSpecifics.mapNullableType(_, isNullable), mapItem);
|
|
1589
|
-
}
|
|
1590
|
-
if (isZodType(zodSchema, "ZodDate")) {
|
|
1591
|
-
return this.dateTransformer.transform((_) => this.versionSpecifics.mapNullableType(_, isNullable));
|
|
1592
|
-
}
|
|
1593
|
-
const refId = Metadata.getRefId(zodSchema);
|
|
1594
|
-
throw new UnknownZodTypeError({
|
|
1595
|
-
currentSchema: zodSchema.def,
|
|
1596
|
-
schemaName: refId
|
|
1597
|
-
});
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
class OpenAPIGenerator {
|
|
1602
|
-
constructor(definitions, versionSpecifics, options) {
|
|
1603
|
-
this.definitions = definitions;
|
|
1604
|
-
this.versionSpecifics = versionSpecifics;
|
|
1605
|
-
this.options = options;
|
|
1606
|
-
this.schemaRefs = {};
|
|
1607
|
-
this.paramRefs = {};
|
|
1608
|
-
this.pathRefs = {};
|
|
1609
|
-
this.rawComponents = [];
|
|
1610
|
-
this.openApiTransformer = new OpenApiTransformer(versionSpecifics, options);
|
|
1611
|
-
this.sortDefinitions();
|
|
1612
|
-
}
|
|
1613
|
-
generateDocumentData() {
|
|
1614
|
-
this.definitions.forEach((definition) => this.generateSingle(definition));
|
|
1615
|
-
return {
|
|
1616
|
-
components: this.buildComponents(),
|
|
1617
|
-
paths: this.pathRefs
|
|
1618
|
-
};
|
|
1619
|
-
}
|
|
1620
|
-
generateComponents() {
|
|
1621
|
-
this.definitions.forEach((definition) => this.generateSingle(definition));
|
|
1622
|
-
return {
|
|
1623
|
-
components: this.buildComponents()
|
|
1624
|
-
};
|
|
1625
|
-
}
|
|
1626
|
-
buildComponents() {
|
|
1627
|
-
var _a, _b, _c, _d;
|
|
1628
|
-
const rawComponents = {};
|
|
1629
|
-
this.rawComponents.forEach(({ componentType, name, component }) => {
|
|
1630
|
-
var _a2;
|
|
1631
|
-
(_a2 = rawComponents[componentType]) !== null && _a2 !== undefined || (rawComponents[componentType] = {});
|
|
1632
|
-
rawComponents[componentType][name] = component;
|
|
1633
|
-
});
|
|
1634
|
-
const allSchemas = Object.assign(Object.assign({}, (_a = rawComponents.schemas) !== null && _a !== undefined ? _a : {}), this.filteredSchemaRefs);
|
|
1635
|
-
const schemas = ((_b = this.options) === null || _b === undefined ? undefined : _b.sortComponents) === "alphabetically" ? sortObjectByKeys(allSchemas) : allSchemas;
|
|
1636
|
-
const allParameters = Object.assign(Object.assign({}, (_c = rawComponents.parameters) !== null && _c !== undefined ? _c : {}), this.paramRefs);
|
|
1637
|
-
const parameters = ((_d = this.options) === null || _d === undefined ? undefined : _d.sortComponents) === "alphabetically" ? sortObjectByKeys(allParameters) : allParameters;
|
|
1638
|
-
return Object.assign(Object.assign({}, rawComponents), { schemas, parameters });
|
|
1639
|
-
}
|
|
1640
|
-
isNotPendingRefEntry(entry) {
|
|
1641
|
-
return entry[1] !== "pending";
|
|
1642
|
-
}
|
|
1643
|
-
get filteredSchemaRefs() {
|
|
1644
|
-
const filtered = Object.entries(this.schemaRefs).filter(this.isNotPendingRefEntry);
|
|
1645
|
-
return Object.fromEntries(filtered);
|
|
1646
|
-
}
|
|
1647
|
-
sortDefinitions() {
|
|
1648
|
-
const generationOrder = [
|
|
1649
|
-
"schema",
|
|
1650
|
-
"parameter",
|
|
1651
|
-
"component",
|
|
1652
|
-
"route"
|
|
1653
|
-
];
|
|
1654
|
-
this.definitions.sort((left, right) => {
|
|
1655
|
-
if (!("type" in left)) {
|
|
1656
|
-
if (!("type" in right)) {
|
|
1657
|
-
return 0;
|
|
1658
|
-
}
|
|
1659
|
-
return -1;
|
|
1660
|
-
}
|
|
1661
|
-
if (!("type" in right)) {
|
|
1662
|
-
return 1;
|
|
1663
|
-
}
|
|
1664
|
-
const leftIndex = generationOrder.findIndex((type) => type === left.type);
|
|
1665
|
-
const rightIndex = generationOrder.findIndex((type) => type === right.type);
|
|
1666
|
-
return leftIndex - rightIndex;
|
|
1667
|
-
});
|
|
1668
|
-
}
|
|
1669
|
-
generateSingle(definition) {
|
|
1670
|
-
if (!("type" in definition)) {
|
|
1671
|
-
this.generateSchemaWithRef(definition);
|
|
1672
|
-
return;
|
|
1673
|
-
}
|
|
1674
|
-
switch (definition.type) {
|
|
1675
|
-
case "parameter":
|
|
1676
|
-
this.generateParameterDefinition(definition.schema);
|
|
1677
|
-
return;
|
|
1678
|
-
case "schema":
|
|
1679
|
-
this.generateSchemaWithRef(definition.schema);
|
|
1680
|
-
return;
|
|
1681
|
-
case "route":
|
|
1682
|
-
this.generateSingleRoute(definition.route);
|
|
1683
|
-
return;
|
|
1684
|
-
case "component":
|
|
1685
|
-
this.rawComponents.push(definition);
|
|
1686
|
-
return;
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
generateParameterDefinition(zodSchema) {
|
|
1690
|
-
const refId = Metadata.getRefId(zodSchema);
|
|
1691
|
-
const result = this.generateParameter(zodSchema);
|
|
1692
|
-
if (refId) {
|
|
1693
|
-
this.paramRefs[refId] = result;
|
|
1694
|
-
}
|
|
1695
|
-
return result;
|
|
1696
|
-
}
|
|
1697
|
-
getParameterRef(schema, external) {
|
|
1698
|
-
const metadata = Metadata.getOpenApiMetadata(schema);
|
|
1699
|
-
const internalMetadata = Metadata.getInternalMetadata(schema);
|
|
1700
|
-
const parameterMetadata = metadata === null || metadata === undefined ? undefined : metadata.param;
|
|
1701
|
-
const existingRef = (internalMetadata === null || internalMetadata === undefined ? undefined : internalMetadata.refId) ? this.paramRefs[internalMetadata.refId] : undefined;
|
|
1702
|
-
if (!(internalMetadata === null || internalMetadata === undefined ? undefined : internalMetadata.refId) || !existingRef) {
|
|
1703
|
-
return;
|
|
1704
|
-
}
|
|
1705
|
-
if (parameterMetadata && existingRef.in !== parameterMetadata.in || (external === null || external === undefined ? undefined : external.in) && existingRef.in !== external.in) {
|
|
1706
|
-
throw new ConflictError(`Conflicting location for parameter ${existingRef.name}`, {
|
|
1707
|
-
key: "in",
|
|
1708
|
-
values: compact([
|
|
1709
|
-
existingRef.in,
|
|
1710
|
-
external === null || external === undefined ? undefined : external.in,
|
|
1711
|
-
parameterMetadata === null || parameterMetadata === undefined ? undefined : parameterMetadata.in
|
|
1712
|
-
])
|
|
1713
|
-
});
|
|
1714
|
-
}
|
|
1715
|
-
if (parameterMetadata && existingRef.name !== parameterMetadata.name || (external === null || external === undefined ? undefined : external.name) && existingRef.name !== (external === null || external === undefined ? undefined : external.name)) {
|
|
1716
|
-
throw new ConflictError(`Conflicting names for parameter`, {
|
|
1717
|
-
key: "name",
|
|
1718
|
-
values: compact([
|
|
1719
|
-
existingRef.name,
|
|
1720
|
-
external === null || external === undefined ? undefined : external.name,
|
|
1721
|
-
parameterMetadata === null || parameterMetadata === undefined ? undefined : parameterMetadata.name
|
|
1722
|
-
])
|
|
1723
|
-
});
|
|
1724
|
-
}
|
|
1725
|
-
return {
|
|
1726
|
-
$ref: `#/components/parameters/${internalMetadata.refId}`
|
|
1727
|
-
};
|
|
1728
|
-
}
|
|
1729
|
-
generateInlineParameters(zodSchema, location) {
|
|
1730
|
-
const metadata = Metadata.getOpenApiMetadata(zodSchema);
|
|
1731
|
-
const parameterMetadata = metadata === null || metadata === undefined ? undefined : metadata.param;
|
|
1732
|
-
const referencedSchema = this.getParameterRef(zodSchema, { in: location });
|
|
1733
|
-
if (referencedSchema) {
|
|
1734
|
-
return [referencedSchema];
|
|
1735
|
-
}
|
|
1736
|
-
if (isZodType(zodSchema, "ZodObject")) {
|
|
1737
|
-
const propTypes = zodSchema.def.shape;
|
|
1738
|
-
const parameters = Object.entries(propTypes).map(([key, schema]) => {
|
|
1739
|
-
var _a;
|
|
1740
|
-
const innerMetadata = Metadata.getOpenApiMetadata(schema);
|
|
1741
|
-
const referencedSchema2 = this.getParameterRef(schema, {
|
|
1742
|
-
in: location,
|
|
1743
|
-
name: key
|
|
1744
|
-
});
|
|
1745
|
-
if (referencedSchema2) {
|
|
1746
|
-
return referencedSchema2;
|
|
1747
|
-
}
|
|
1748
|
-
const innerParameterMetadata = innerMetadata === null || innerMetadata === undefined ? undefined : innerMetadata.param;
|
|
1749
|
-
if ((innerParameterMetadata === null || innerParameterMetadata === undefined ? undefined : innerParameterMetadata.name) && innerParameterMetadata.name !== key) {
|
|
1750
|
-
throw new ConflictError(`Conflicting names for parameter`, {
|
|
1751
|
-
key: "name",
|
|
1752
|
-
values: [key, innerParameterMetadata.name]
|
|
1753
|
-
});
|
|
1754
|
-
}
|
|
1755
|
-
if ((innerParameterMetadata === null || innerParameterMetadata === undefined ? undefined : innerParameterMetadata.in) && innerParameterMetadata.in !== location) {
|
|
1756
|
-
throw new ConflictError(`Conflicting location for parameter ${(_a = innerParameterMetadata.name) !== null && _a !== undefined ? _a : key}`, {
|
|
1757
|
-
key: "in",
|
|
1758
|
-
values: [location, innerParameterMetadata.in]
|
|
1759
|
-
});
|
|
1760
|
-
}
|
|
1761
|
-
return this.generateParameter(schema, { name: key, in: location });
|
|
1762
|
-
});
|
|
1763
|
-
return parameters;
|
|
1764
|
-
}
|
|
1765
|
-
if ((parameterMetadata === null || parameterMetadata === undefined ? undefined : parameterMetadata.in) && parameterMetadata.in !== location) {
|
|
1766
|
-
throw new ConflictError(`Conflicting location for parameter ${parameterMetadata.name}`, {
|
|
1767
|
-
key: "in",
|
|
1768
|
-
values: [location, parameterMetadata.in]
|
|
1769
|
-
});
|
|
1770
|
-
}
|
|
1771
|
-
return [this.generateParameter(zodSchema, { in: location })];
|
|
1772
|
-
}
|
|
1773
|
-
generateSimpleParameter(zodSchema, externalParamMetadata) {
|
|
1774
|
-
const metadata = Metadata.getParamMetadata(zodSchema);
|
|
1775
|
-
const paramMetadata = metadata === null || metadata === undefined ? undefined : metadata.param;
|
|
1776
|
-
const mergedParamMetadata = Object.assign(Object.assign({}, paramMetadata), externalParamMetadata);
|
|
1777
|
-
const required = !isOptionalSchema(zodSchema) && !isNullableSchema(zodSchema);
|
|
1778
|
-
const schema = this.generateSchemaWithRef(zodSchema);
|
|
1779
|
-
return Object.assign({
|
|
1780
|
-
schema,
|
|
1781
|
-
required
|
|
1782
|
-
}, Object.keys(mergedParamMetadata).length > 0 ? Metadata.buildParameterMetadata(mergedParamMetadata) : {});
|
|
1783
|
-
}
|
|
1784
|
-
generateParameter(zodSchema, externalParamMetadata) {
|
|
1785
|
-
var _a, _b;
|
|
1786
|
-
const metadata = Metadata.getOpenApiMetadata(zodSchema);
|
|
1787
|
-
const paramMetadata = metadata === null || metadata === undefined ? undefined : metadata.param;
|
|
1788
|
-
const paramName = (_a = externalParamMetadata === null || externalParamMetadata === undefined ? undefined : externalParamMetadata.name) !== null && _a !== undefined ? _a : paramMetadata === null || paramMetadata === undefined ? undefined : paramMetadata.name;
|
|
1789
|
-
const paramLocation = (_b = externalParamMetadata === null || externalParamMetadata === undefined ? undefined : externalParamMetadata.in) !== null && _b !== undefined ? _b : paramMetadata === null || paramMetadata === undefined ? undefined : paramMetadata.in;
|
|
1790
|
-
if (!paramName) {
|
|
1791
|
-
throw new MissingParameterDataError({ missingField: "name" });
|
|
1792
|
-
}
|
|
1793
|
-
if (!paramLocation) {
|
|
1794
|
-
throw new MissingParameterDataError({
|
|
1795
|
-
missingField: "in",
|
|
1796
|
-
paramName
|
|
1797
|
-
});
|
|
1798
|
-
}
|
|
1799
|
-
const baseParameter = this.generateSimpleParameter(zodSchema, externalParamMetadata);
|
|
1800
|
-
return Object.assign(Object.assign({}, baseParameter), { in: paramLocation, name: paramName });
|
|
1801
|
-
}
|
|
1802
|
-
generateSchemaWithMetadata(zodSchema) {
|
|
1803
|
-
const innerSchema = Metadata.unwrapChained(zodSchema);
|
|
1804
|
-
const metadata = Metadata.getOpenApiMetadata(zodSchema);
|
|
1805
|
-
const defaultValue = Metadata.getDefaultValue(zodSchema);
|
|
1806
|
-
const refId = Metadata.getRefId(zodSchema);
|
|
1807
|
-
if (refId && typeof this.schemaRefs[refId] === "object") {
|
|
1808
|
-
return this.schemaRefs[refId];
|
|
1809
|
-
}
|
|
1810
|
-
if (refId && this.schemaRefs[refId] === "pending") {
|
|
1811
|
-
const refSchema = { $ref: this.generateSchemaRef(refId) };
|
|
1812
|
-
return this.versionSpecifics.mapNullableOfRef(refSchema, isNullableSchema(zodSchema));
|
|
1813
|
-
}
|
|
1814
|
-
if (refId && !this.schemaRefs[refId]) {
|
|
1815
|
-
this.schemaRefs[refId] = "pending";
|
|
1816
|
-
}
|
|
1817
|
-
const result = (metadata === null || metadata === undefined ? undefined : metadata.type) ? { type: metadata.type } : this.toOpenAPISchema(innerSchema, isNullableSchema(zodSchema), defaultValue);
|
|
1818
|
-
return metadata ? Metadata.applySchemaMetadata(result, metadata) : omitBy(result, isUndefined);
|
|
1819
|
-
}
|
|
1820
|
-
constructReferencedOpenAPISchema(zodSchema) {
|
|
1821
|
-
const metadata = Metadata.getOpenApiMetadata(zodSchema);
|
|
1822
|
-
const innerSchema = Metadata.unwrapChained(zodSchema);
|
|
1823
|
-
const defaultValue = Metadata.getDefaultValue(zodSchema);
|
|
1824
|
-
const isNullable = isNullableSchema(zodSchema);
|
|
1825
|
-
if (metadata === null || metadata === undefined ? undefined : metadata.type) {
|
|
1826
|
-
return this.versionSpecifics.mapNullableType(metadata.type, isNullable);
|
|
1827
|
-
}
|
|
1828
|
-
const refId = Metadata.getRefId(zodSchema);
|
|
1829
|
-
if (refId && typeof this.schemaRefs[refId] === "object") {
|
|
1830
|
-
return LazyTransformer.mapRecursive(this.schemaRefs[refId], (schema) => this.versionSpecifics.mapNullableType(schema, isNullable), (schema) => this.versionSpecifics.mapNullableOfRef(schema, isNullable));
|
|
1831
|
-
}
|
|
1832
|
-
if (refId && this.schemaRefs[refId] === "pending") {
|
|
1833
|
-
const refSchema = { $ref: this.generateSchemaRef(refId) };
|
|
1834
|
-
return this.versionSpecifics.mapNullableOfRef(refSchema, isNullable);
|
|
1835
|
-
}
|
|
1836
|
-
if (refId && !this.schemaRefs[refId]) {
|
|
1837
|
-
this.schemaRefs[refId] = "pending";
|
|
1838
|
-
}
|
|
1839
|
-
return this.toOpenAPISchema(innerSchema, isNullable, defaultValue);
|
|
1840
|
-
}
|
|
1841
|
-
generateSimpleSchema(zodSchema) {
|
|
1842
|
-
const metadata = Metadata.getOpenApiMetadata(zodSchema);
|
|
1843
|
-
const refId = Metadata.getRefId(zodSchema);
|
|
1844
|
-
if (!refId || !this.schemaRefs[refId]) {
|
|
1845
|
-
return this.generateSchemaWithMetadata(zodSchema);
|
|
1846
|
-
}
|
|
1847
|
-
const schemaRef = this.schemaRefs[refId];
|
|
1848
|
-
const referenceObject = {
|
|
1849
|
-
$ref: this.generateSchemaRef(refId)
|
|
1850
|
-
};
|
|
1851
|
-
if (this.schemaRefs[refId] === "pending") {
|
|
1852
|
-
return this.versionSpecifics.mapNullableOfRef(referenceObject, isNullableSchema(zodSchema));
|
|
1853
|
-
}
|
|
1854
|
-
const newMetadata = omitBy(Metadata.buildSchemaMetadata(metadata !== null && metadata !== undefined ? metadata : {}), (value, key) => value === undefined || objectEquals(value, schemaRef[key]));
|
|
1855
|
-
if (newMetadata.type) {
|
|
1856
|
-
return {
|
|
1857
|
-
allOf: [referenceObject, newMetadata]
|
|
1858
|
-
};
|
|
1859
|
-
}
|
|
1860
|
-
const newSchemaMetadata = omitBy(this.constructReferencedOpenAPISchema(zodSchema), (value, key) => value === undefined || objectEquals(value, schemaRef[key]));
|
|
1861
|
-
const appliedMetadata = Metadata.applySchemaMetadata(newSchemaMetadata, newMetadata);
|
|
1862
|
-
if (Object.keys(appliedMetadata).length > 0) {
|
|
1863
|
-
return {
|
|
1864
|
-
allOf: [referenceObject, appliedMetadata]
|
|
1865
|
-
};
|
|
1866
|
-
}
|
|
1867
|
-
return referenceObject;
|
|
1868
|
-
}
|
|
1869
|
-
generateSchemaWithRef(zodSchema) {
|
|
1870
|
-
const refId = Metadata.getRefId(zodSchema);
|
|
1871
|
-
if (refId && !this.schemaRefs[refId]) {
|
|
1872
|
-
this.schemaRefs[refId] = this.generateSimpleSchema(zodSchema);
|
|
1873
|
-
return { $ref: this.generateSchemaRef(refId) };
|
|
1874
|
-
}
|
|
1875
|
-
return this.generateSimpleSchema(zodSchema);
|
|
1876
|
-
}
|
|
1877
|
-
generateSchemaRef(refId) {
|
|
1878
|
-
return `#/components/schemas/${refId}`;
|
|
1879
|
-
}
|
|
1880
|
-
getRequestBody(requestBody) {
|
|
1881
|
-
if (!requestBody) {
|
|
1882
|
-
return;
|
|
1883
|
-
}
|
|
1884
|
-
const { content } = requestBody, rest = __rest(requestBody, ["content"]);
|
|
1885
|
-
const requestBodyContent = this.getBodyContent(content);
|
|
1886
|
-
return Object.assign(Object.assign({}, rest), { content: requestBodyContent });
|
|
1887
|
-
}
|
|
1888
|
-
getParameters(request) {
|
|
1889
|
-
if (!request) {
|
|
1890
|
-
return [];
|
|
1891
|
-
}
|
|
1892
|
-
const { headers } = request;
|
|
1893
|
-
const query = this.cleanParameter(request.query);
|
|
1894
|
-
const params = this.cleanParameter(request.params);
|
|
1895
|
-
const cookies = this.cleanParameter(request.cookies);
|
|
1896
|
-
const queryParameters = enhanceMissingParametersError(() => query ? this.generateInlineParameters(query, "query") : [], { location: "query" });
|
|
1897
|
-
const pathParameters = enhanceMissingParametersError(() => params ? this.generateInlineParameters(params, "path") : [], { location: "path" });
|
|
1898
|
-
const cookieParameters = enhanceMissingParametersError(() => cookies ? this.generateInlineParameters(cookies, "cookie") : [], { location: "cookie" });
|
|
1899
|
-
const headerParameters = enhanceMissingParametersError(() => {
|
|
1900
|
-
if (Array.isArray(headers)) {
|
|
1901
|
-
return headers.flatMap((header) => this.generateInlineParameters(header, "header"));
|
|
1902
|
-
}
|
|
1903
|
-
const cleanHeaders = this.cleanParameter(headers);
|
|
1904
|
-
return cleanHeaders ? this.generateInlineParameters(cleanHeaders, "header") : [];
|
|
1905
|
-
}, { location: "header" });
|
|
1906
|
-
return [
|
|
1907
|
-
...pathParameters,
|
|
1908
|
-
...queryParameters,
|
|
1909
|
-
...headerParameters,
|
|
1910
|
-
...cookieParameters
|
|
1911
|
-
];
|
|
1912
|
-
}
|
|
1913
|
-
cleanParameter(schema) {
|
|
1914
|
-
if (!schema) {
|
|
1915
|
-
return;
|
|
1916
|
-
}
|
|
1917
|
-
if (isZodType(schema, "ZodPipe")) {
|
|
1918
|
-
const inSchema = schema._zod.def.in;
|
|
1919
|
-
const outSchema = schema._zod.def.out;
|
|
1920
|
-
if (isZodType(inSchema, "ZodObject")) {
|
|
1921
|
-
return this.cleanParameter(inSchema);
|
|
1922
|
-
}
|
|
1923
|
-
if (isZodType(outSchema, "ZodObject")) {
|
|
1924
|
-
return this.cleanParameter(outSchema);
|
|
1925
|
-
}
|
|
1926
|
-
return;
|
|
1927
|
-
}
|
|
1928
|
-
return schema;
|
|
1929
|
-
}
|
|
1930
|
-
generatePath(route) {
|
|
1931
|
-
const { method, path, request, responses } = route, pathItemConfig = __rest(route, ["method", "path", "request", "responses"]);
|
|
1932
|
-
const generatedResponses = mapValues(responses, (response) => {
|
|
1933
|
-
return this.getResponse(response);
|
|
1934
|
-
});
|
|
1935
|
-
const parameters = enhanceMissingParametersError(() => this.getParameters(request), { route: `${method} ${path}` });
|
|
1936
|
-
const requestBody = this.getRequestBody(request === null || request === undefined ? undefined : request.body);
|
|
1937
|
-
const routeDoc = {
|
|
1938
|
-
[method]: Object.assign(Object.assign(Object.assign(Object.assign({}, pathItemConfig), parameters.length > 0 ? {
|
|
1939
|
-
parameters: [...pathItemConfig.parameters || [], ...parameters]
|
|
1940
|
-
} : {}), requestBody ? { requestBody } : {}), { responses: generatedResponses })
|
|
1941
|
-
};
|
|
1942
|
-
return routeDoc;
|
|
1943
|
-
}
|
|
1944
|
-
generateSingleRoute(route) {
|
|
1945
|
-
const routeDoc = this.generatePath(route);
|
|
1946
|
-
this.pathRefs[route.path] = Object.assign(Object.assign({}, this.pathRefs[route.path]), routeDoc);
|
|
1947
|
-
return routeDoc;
|
|
1948
|
-
}
|
|
1949
|
-
getResponse(response) {
|
|
1950
|
-
if (this.isReferenceObject(response)) {
|
|
1951
|
-
return response;
|
|
1952
|
-
}
|
|
1953
|
-
const { content, headers } = response, rest = __rest(response, ["content", "headers"]);
|
|
1954
|
-
const responseContent = content ? { content: this.getBodyContent(content) } : {};
|
|
1955
|
-
if (!headers) {
|
|
1956
|
-
return Object.assign(Object.assign({}, rest), responseContent);
|
|
1957
|
-
}
|
|
1958
|
-
const responseHeaders = isZodType(headers, "ZodObject") ? this.getResponseHeaders(headers) : headers;
|
|
1959
|
-
return Object.assign(Object.assign(Object.assign({}, rest), { headers: responseHeaders }), responseContent);
|
|
1960
|
-
}
|
|
1961
|
-
isReferenceObject(schema) {
|
|
1962
|
-
return "$ref" in schema;
|
|
1963
|
-
}
|
|
1964
|
-
getResponseHeaders(headers) {
|
|
1965
|
-
const schemaShape = headers.def.shape;
|
|
1966
|
-
const responseHeaders = mapValues(schemaShape, (_) => this.generateSimpleParameter(_));
|
|
1967
|
-
return responseHeaders;
|
|
1968
|
-
}
|
|
1969
|
-
getBodyContent(content) {
|
|
1970
|
-
return mapValues(content, (config) => {
|
|
1971
|
-
if (!config || !isAnyZodType(config.schema)) {
|
|
1972
|
-
return config;
|
|
1973
|
-
}
|
|
1974
|
-
const { schema: configSchema } = config, rest = __rest(config, ["schema"]);
|
|
1975
|
-
const schema = this.generateSchemaWithRef(configSchema);
|
|
1976
|
-
return Object.assign({ schema }, rest);
|
|
1977
|
-
});
|
|
1978
|
-
}
|
|
1979
|
-
toOpenAPISchema(zodSchema, isNullable, defaultValue) {
|
|
1980
|
-
const result = this.openApiTransformer.transform(zodSchema, isNullable, (_) => this.generateSchemaWithRef(_), (_) => this.generateSchemaRef(_), defaultValue);
|
|
1981
|
-
return result;
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
class OpenApiGeneratorV31Specifics {
|
|
1986
|
-
get nullType() {
|
|
1987
|
-
return { type: "null" };
|
|
1988
|
-
}
|
|
1989
|
-
mapNullableOfArray(objects, isNullable) {
|
|
1990
|
-
if (isNullable && !objects.some((object2) => objectEquals(object2, this.nullType))) {
|
|
1991
|
-
return [...objects, this.nullType];
|
|
1992
|
-
}
|
|
1993
|
-
return objects;
|
|
1994
|
-
}
|
|
1995
|
-
mapNullableType(type, isNullable) {
|
|
1996
|
-
if (!type) {
|
|
1997
|
-
return {};
|
|
1998
|
-
}
|
|
1999
|
-
if (isNullable) {
|
|
2000
|
-
const typeArray = Array.isArray(type) ? type : [type];
|
|
2001
|
-
const nullableType = uniq([...typeArray, "null"]);
|
|
2002
|
-
return { type: nullableType };
|
|
2003
|
-
}
|
|
2004
|
-
return { type };
|
|
2005
|
-
}
|
|
2006
|
-
mapNullableOfRef(ref, isNullable) {
|
|
2007
|
-
if (isNullable) {
|
|
2008
|
-
return {
|
|
2009
|
-
oneOf: [ref, this.nullType]
|
|
2010
|
-
};
|
|
2011
|
-
}
|
|
2012
|
-
return ref;
|
|
2013
|
-
}
|
|
2014
|
-
mapTupleItems(schemas) {
|
|
2015
|
-
return {
|
|
2016
|
-
prefixItems: schemas
|
|
2017
|
-
};
|
|
2018
|
-
}
|
|
2019
|
-
getNumberChecks(checks) {
|
|
2020
|
-
return Object.assign({}, ...checks.map((check) => {
|
|
2021
|
-
switch (check._zod.def.check) {
|
|
2022
|
-
case "greater_than": {
|
|
2023
|
-
const greaterThanCheck = check;
|
|
2024
|
-
return greaterThanCheck._zod.def.inclusive ? { minimum: Number(greaterThanCheck._zod.def.value) } : { exclusiveMinimum: Number(greaterThanCheck._zod.def.value) };
|
|
2025
|
-
}
|
|
2026
|
-
case "less_than": {
|
|
2027
|
-
const lessThanCheck = check;
|
|
2028
|
-
return lessThanCheck._zod.def.inclusive ? { maximum: Number(lessThanCheck._zod.def.value) } : { exclusiveMaximum: Number(lessThanCheck._zod.def.value) };
|
|
2029
|
-
}
|
|
2030
|
-
default:
|
|
2031
|
-
return {};
|
|
2032
|
-
}
|
|
2033
|
-
}));
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
function isWebhookDefinition(definition) {
|
|
2037
|
-
return "type" in definition && definition.type === "webhook";
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
class OpenApiGeneratorV31 {
|
|
2041
|
-
constructor(definitions, options) {
|
|
2042
|
-
this.definitions = definitions;
|
|
2043
|
-
this.webhookRefs = {};
|
|
2044
|
-
const specifics = new OpenApiGeneratorV31Specifics;
|
|
2045
|
-
this.generator = new OpenAPIGenerator(this.definitions, specifics, options);
|
|
2046
|
-
}
|
|
2047
|
-
generateDocument(config) {
|
|
2048
|
-
const baseDocument = this.generator.generateDocumentData();
|
|
2049
|
-
this.definitions.filter(isWebhookDefinition).forEach((definition) => this.generateSingleWebhook(definition.webhook));
|
|
2050
|
-
return Object.assign(Object.assign(Object.assign({}, config), baseDocument), { webhooks: this.webhookRefs });
|
|
2051
|
-
}
|
|
2052
|
-
generateComponents() {
|
|
2053
|
-
return this.generator.generateComponents();
|
|
2054
|
-
}
|
|
2055
|
-
generateSingleWebhook(route) {
|
|
2056
|
-
const routeDoc = this.generator.generatePath(route);
|
|
2057
|
-
this.webhookRefs[route.path] = Object.assign(Object.assign({}, this.webhookRefs[route.path]), routeDoc);
|
|
2058
|
-
return routeDoc;
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
var ZodTypeKeys, objectEquals, zodToOpenAPIRegistry, ConflictError, MissingParameterDataError, UnknownZodTypeError, $OpenAPIRegistry, $OpenApiGeneratorV31, $extendZodWithOpenApi;
|
|
2062
|
-
var init_dist = __esm(() => {
|
|
2063
|
-
ZodTypeKeys = {
|
|
2064
|
-
ZodAny: "any",
|
|
2065
|
-
ZodArray: "array",
|
|
2066
|
-
ZodBigInt: "bigint",
|
|
2067
|
-
ZodBoolean: "boolean",
|
|
2068
|
-
ZodDefault: "default",
|
|
2069
|
-
ZodPrefault: "prefault",
|
|
2070
|
-
ZodTransform: "transform",
|
|
2071
|
-
ZodEnum: "enum",
|
|
2072
|
-
ZodIntersection: "intersection",
|
|
2073
|
-
ZodLazy: "lazy",
|
|
2074
|
-
ZodLiteral: "literal",
|
|
2075
|
-
ZodNever: "never",
|
|
2076
|
-
ZodNull: "null",
|
|
2077
|
-
ZodNullable: "nullable",
|
|
2078
|
-
ZodNumber: "number",
|
|
2079
|
-
ZodNonOptional: "nonoptional",
|
|
2080
|
-
ZodObject: "object",
|
|
2081
|
-
ZodOptional: "optional",
|
|
2082
|
-
ZodPipe: "pipe",
|
|
2083
|
-
ZodReadonly: "readonly",
|
|
2084
|
-
ZodRecord: "record",
|
|
2085
|
-
ZodString: "string",
|
|
2086
|
-
ZodTuple: "tuple",
|
|
2087
|
-
ZodType: "type",
|
|
2088
|
-
ZodUnion: "union",
|
|
2089
|
-
ZodDiscriminatedUnion: "union",
|
|
2090
|
-
ZodUnknown: "unknown",
|
|
2091
|
-
ZodVoid: "void",
|
|
2092
|
-
ZodDate: "date",
|
|
2093
|
-
ZodTemplateLiteral: "template_literal"
|
|
2094
|
-
};
|
|
2095
|
-
objectEquals = isEqual;
|
|
2096
|
-
zodToOpenAPIRegistry = registry();
|
|
2097
|
-
ConflictError = class ConflictError extends ZodToOpenAPIError {
|
|
2098
|
-
constructor(message, data) {
|
|
2099
|
-
super(message);
|
|
2100
|
-
this.data = data;
|
|
2101
|
-
}
|
|
2102
|
-
};
|
|
2103
|
-
MissingParameterDataError = class MissingParameterDataError extends ZodToOpenAPIError {
|
|
2104
|
-
constructor(data) {
|
|
2105
|
-
super(`Missing parameter data, please specify \`${data.missingField}\` and other OpenAPI parameter props using the \`param\` field of \`schema.openapi\``);
|
|
2106
|
-
this.data = data;
|
|
2107
|
-
}
|
|
2108
|
-
};
|
|
2109
|
-
UnknownZodTypeError = class UnknownZodTypeError extends ZodToOpenAPIError {
|
|
2110
|
-
constructor(data) {
|
|
2111
|
-
super(`Unknown zod object type, please specify \`type\` and other OpenAPI props using \`schema.openapi\`.`);
|
|
2112
|
-
this.data = data;
|
|
2113
|
-
}
|
|
2114
|
-
};
|
|
2115
|
-
$OpenAPIRegistry = OpenAPIRegistry;
|
|
2116
|
-
$OpenApiGeneratorV31 = OpenApiGeneratorV31;
|
|
2117
|
-
$extendZodWithOpenApi = extendZodWithOpenApi;
|
|
2118
|
-
});
|
|
2119
|
-
|
|
2120
|
-
// src/utils/zod-openapi.ts
|
|
2121
|
-
var init_zod_openapi = __esm(() => {
|
|
2122
|
-
init_dist();
|
|
2123
|
-
init_zod();
|
|
2124
|
-
$extendZodWithOpenApi(exports_zod);
|
|
2125
|
-
});
|
|
2126
|
-
|
|
2127
|
-
// src/types.ts
|
|
2128
|
-
function parseModelTier(value) {
|
|
2129
|
-
if (!value)
|
|
2130
|
-
return;
|
|
2131
|
-
const normalized = value.trim().toLowerCase();
|
|
2132
|
-
return ModelTierSchema.safeParse(normalized).success ? normalized : LEGACY_MODEL_TO_TIER[normalized];
|
|
2133
|
-
}
|
|
2134
|
-
function splitLegacyModelAlias(input) {
|
|
2135
|
-
const explicitTier = parseModelTier(input.modelTier);
|
|
2136
|
-
const model = input.model?.trim();
|
|
2137
|
-
if (!model)
|
|
2138
|
-
return { modelTier: explicitTier };
|
|
2139
|
-
const legacyTier = parseModelTier(model);
|
|
2140
|
-
if (legacyTier && !explicitTier) {
|
|
2141
|
-
return { modelTier: legacyTier };
|
|
2142
|
-
}
|
|
2143
|
-
return {
|
|
2144
|
-
model,
|
|
2145
|
-
modelTier: explicitTier
|
|
2146
|
-
};
|
|
2147
|
-
}
|
|
2148
|
-
function parseTierMapJson(value) {
|
|
2149
|
-
if (!value)
|
|
2150
|
-
return {};
|
|
2151
|
-
try {
|
|
2152
|
-
const parsed = JSON.parse(value);
|
|
2153
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
2154
|
-
return {};
|
|
2155
|
-
const result = {};
|
|
2156
|
-
for (const tier of MODEL_TIERS) {
|
|
2157
|
-
const model = parsed[tier];
|
|
2158
|
-
if (typeof model === "string" && model.trim())
|
|
2159
|
-
result[tier] = model.trim();
|
|
2160
|
-
}
|
|
2161
|
-
return result;
|
|
2162
|
-
} catch {
|
|
2163
|
-
return {};
|
|
2164
|
-
}
|
|
2165
|
-
}
|
|
2166
|
-
function resolveModelTier(opts) {
|
|
2167
|
-
const tier = parseModelTier(opts.tier);
|
|
2168
|
-
if (!tier)
|
|
2169
|
-
return;
|
|
2170
|
-
const env = opts.env ?? {};
|
|
2171
|
-
const jsonOverrides = parseTierMapJson(env.MODEL_TIER_MAP);
|
|
2172
|
-
const envKey = `MODEL_TIER_${tier.toUpperCase()}`;
|
|
2173
|
-
const directOverride = env[envKey]?.trim();
|
|
2174
|
-
if (directOverride)
|
|
2175
|
-
return directOverride;
|
|
2176
|
-
if (jsonOverrides[tier])
|
|
2177
|
-
return jsonOverrides[tier];
|
|
2178
|
-
return DEFAULT_MODEL_TIER_MAP[opts.harnessProvider]?.[tier];
|
|
2179
|
-
}
|
|
2180
|
-
function resolveTaskModelSelection(opts) {
|
|
2181
|
-
const model = opts.model?.trim();
|
|
2182
|
-
if (model)
|
|
2183
|
-
return { model, source: "model" };
|
|
2184
|
-
const tierModel = resolveModelTier({
|
|
2185
|
-
tier: opts.modelTier,
|
|
2186
|
-
harnessProvider: opts.harnessProvider,
|
|
2187
|
-
env: opts.env
|
|
2188
|
-
});
|
|
2189
|
-
if (tierModel)
|
|
2190
|
-
return { model: tierModel, source: "modelTier" };
|
|
2191
|
-
return { source: "none" };
|
|
2192
|
-
}
|
|
2193
|
-
function isTerminalTaskStatus(status) {
|
|
2194
|
-
return TERMINAL_TASK_STATUSES.includes(status);
|
|
2195
|
-
}
|
|
2196
|
-
var AssetKeySchema, AssetEntityTypeSchema, AssetProviderRefSchema, AssetKeyMappingSchema, AssetSummarySchema, ModelTierSchema, MODEL_TIERS, ReasoningEffortSchema, LEGACY_MODEL_TO_TIER, DEFAULT_MODEL_TIER_MAP, AgentTaskStatusSchema, TERMINAL_TASK_STATUSES, InboxMessageStatusSchema, InboxMessageSchema, AgentTaskSourceSchema, RoutingReasonSchema, RoutingSourceSchema, ProviderNameSchema, SteerModeSchema, SteeringStatusSchema, SteeringSourceSchema, SteeringMessageSchema, SteerOutcomeSchema, OnUnsupportedSchema, SteerResultSchema, PROVIDER_STEER_CAPABILITIES, FollowUpConfigSchema, RoutingAffinitySchema, AgentTaskSchema, CreateTaskOptionsSchema, TaskAttachmentKindSchema, SERVER_GENERATED_ATTACHMENT_CAPABILITY = "_agentSwarmGeneratedBy", attachmentCapabilitiesSchema, attachmentCommonFields, AttachmentInputSchema, TaskAttachmentSchema, UserSchema, UserCommsPrefsSchema, IdentityEventTypeSchema, InboxItemTypeSchema, InboxItemStatusSchema, InboxItemStateSchema, FavoriteItemTypeSchema, UserFavoriteSchema, TaskTemplateKindSchema, TaskTemplateSchema, AgentStatusSchema, AgentAvatarSchema, AgentSchema, AgentCredStatusLiveTestSchema, AgentLatestModelSchema, AgentBedrockStatusSchema, AcpSessionConfigSelectValueSchema, AcpSessionConfigSelectGroupSchema, AcpSessionConfigOptionSchema, AgentAcpStatusSchema, AgentCredStatusSchema, AgentWithTasksSchema, ChangeSourceSchema, VersionableFieldSchema, ContextVersionSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, AgentLogEventTypeSchema, ResumeReasonSchema, AgentLogSchema, SessionLogSchema, SessionCostSourceSchema, SessionCostModelBreakdownSchema, SessionCostSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmEventSchema, AutomationIntegrationIdSchema, ScheduledTaskTargetTypeSchema, ScheduledTaskSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, REPO_GUIDELINES_MAX_ENTRIES = 50, RepoGuidelinesInputSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, ActiveSessionSchema, RuntimeInstanceStatusSchema, RuntimeInstanceSchema, RetryPolicySchema, ExecutorMetaSchema, ValidationResultSchema, StepValidationConfigSchema, SwarmScriptNodeConfigSchema, WorkflowNodeSchema, WorkflowEdgeSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, WebhookVerificationSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, WorkflowTemplateSchema, WorkflowSnapshotSchema, WorkflowSchema, WorkflowVersionSchema, PageContentTypeSchema, PageAuthModeSchema, PageSnapshotSchema, PageSchema, PageVersionSchema, MetricParamSchema, MetricVariableTypeSchema, MetricFormatSchema, MetricVisualizationSchema, MetricQuerySchema, MetricVariableSchema, MetricVizConfigSchema, MetricWidgetSchema, MetricDefinitionSchema, MetricSnapshotSchema, MetricSchema, MetricVersionSchema, WorkflowRunStatusSchema, WorkflowRunSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, ScriptRunKindSchema, ScriptRunSchema, ScriptRunListItemSchema, ScriptRunJournalEntrySchema, WorkflowRunStepStatusSchema, WorkflowRunStepSchema, WaitModeSchema, WaitStateStatusSchema, WaitStateRowSchema, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptRecordSchema, ScriptVersionRecordSchema, ExtensionNameSchema, SemverSchema, ExtensionManifestSchema, ExtensionStatusSchema, ExtensionSchema, ExtensionFileSchema, ExtensionVersionSchema, ExtensionRunSchema, ExtensionInstallBodySchema, ScriptApiAuthModeSchema, ScriptApiRecordSchema, SkillTypeSchema, SkillScopeSchema, SkillSchema, AgentSkillSchema, SkillWithInstallInfoSchema, SkillFileSchema, McpServerTransportSchema, McpServerScopeSchema, McpAuthMethodSchema, McpServerSchema, AgentMcpServerSchema, McpServerWithInstallInfoSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, ContextSnapshotSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, BudgetRefusedTriggerSchema, KvValueTypeSchema, KV_NAME_REGEX, KvNamespaceSchema, KvKeySchema, KvEntrySchema;
|
|
2197
|
-
var init_types = __esm(() => {
|
|
2198
|
-
init_key();
|
|
2199
|
-
init_bundle_path();
|
|
2200
|
-
init_constants();
|
|
2201
|
-
init_zod_openapi();
|
|
2202
|
-
AssetKeySchema = exports_zod.string().min(1).max(255).superRefine((value, ctx) => {
|
|
2203
|
-
try {
|
|
2204
|
-
normalizeAssetKey(value);
|
|
2205
|
-
} catch (error) {
|
|
2206
|
-
ctx.addIssue({
|
|
2207
|
-
code: "custom",
|
|
2208
|
-
message: error instanceof Error ? error.message : "Invalid asset namespace key"
|
|
2209
|
-
});
|
|
2210
|
-
}
|
|
2211
|
-
}).describe("Non-unique asset directory namespace (for example shared/ or personal/<user-id>/drafts/). Runtime write boundaries normalize and validate the canonical form.");
|
|
2212
|
-
AssetEntityTypeSchema = exports_zod.enum([
|
|
2213
|
-
"task",
|
|
2214
|
-
"workflow",
|
|
2215
|
-
"schedule",
|
|
2216
|
-
"page",
|
|
2217
|
-
"app",
|
|
2218
|
-
"script",
|
|
2219
|
-
"file"
|
|
2220
|
-
]);
|
|
2221
|
-
AssetProviderRefSchema = exports_zod.object({
|
|
2222
|
-
providerId: exports_zod.string(),
|
|
2223
|
-
orgId: exports_zod.string().optional(),
|
|
2224
|
-
driveId: exports_zod.string().optional(),
|
|
2225
|
-
providerKey: exports_zod.string()
|
|
2226
|
-
}).openapi("AssetProviderRef");
|
|
2227
|
-
AssetKeyMappingSchema = exports_zod.object({
|
|
2228
|
-
id: exports_zod.string(),
|
|
2229
|
-
providerId: exports_zod.string(),
|
|
2230
|
-
providerOrgId: exports_zod.string().optional(),
|
|
2231
|
-
providerDriveId: exports_zod.string().optional(),
|
|
2232
|
-
providerKey: exports_zod.string(),
|
|
2233
|
-
key: AssetKeySchema,
|
|
2234
|
-
sourceEntityType: exports_zod.enum(["task-attachment", "external"]).optional(),
|
|
2235
|
-
sourceEntityId: exports_zod.string().optional(),
|
|
2236
|
-
createdAt: exports_zod.iso.datetime(),
|
|
2237
|
-
updatedAt: exports_zod.iso.datetime(),
|
|
2238
|
-
createdBy: exports_zod.string().optional(),
|
|
2239
|
-
updatedBy: exports_zod.string().optional()
|
|
2240
|
-
}).openapi("AssetKeyMapping");
|
|
2241
|
-
AssetSummarySchema = exports_zod.object({
|
|
2242
|
-
entityType: AssetEntityTypeSchema,
|
|
2243
|
-
id: exports_zod.string(),
|
|
2244
|
-
key: AssetKeySchema,
|
|
2245
|
-
label: exports_zod.string(),
|
|
2246
|
-
updatedAt: exports_zod.string(),
|
|
2247
|
-
providerRef: AssetProviderRefSchema.optional()
|
|
2248
|
-
}).openapi("AssetSummary");
|
|
2249
|
-
ModelTierSchema = exports_zod.enum(["smol", "regular", "smart", "ultra"]);
|
|
2250
|
-
MODEL_TIERS = ModelTierSchema.options;
|
|
2251
|
-
ReasoningEffortSchema = exports_zod.enum(["off", "low", "medium", "high", "xhigh", "max"]);
|
|
2252
|
-
LEGACY_MODEL_TO_TIER = {
|
|
2253
|
-
haiku: "smol",
|
|
2254
|
-
sonnet: "regular",
|
|
2255
|
-
opus: "smart",
|
|
2256
|
-
fable: "ultra"
|
|
2257
|
-
};
|
|
2258
|
-
DEFAULT_MODEL_TIER_MAP = {
|
|
2259
|
-
claude: {
|
|
2260
|
-
smol: "haiku",
|
|
2261
|
-
regular: "sonnet",
|
|
2262
|
-
smart: "opus",
|
|
2263
|
-
ultra: "fable"
|
|
2264
|
-
},
|
|
2265
|
-
"claude-managed": {
|
|
2266
|
-
smol: "claude-haiku-4-5",
|
|
2267
|
-
regular: "claude-sonnet-5",
|
|
2268
|
-
smart: "claude-opus-4-8",
|
|
2269
|
-
ultra: "claude-fable-5"
|
|
2270
|
-
},
|
|
2271
|
-
codex: {
|
|
2272
|
-
smol: "gpt-5.6-luna",
|
|
2273
|
-
regular: "gpt-5.6-terra",
|
|
2274
|
-
smart: "gpt-5.6-sol",
|
|
2275
|
-
ultra: "gpt-5.6-sol"
|
|
2276
|
-
},
|
|
2277
|
-
pi: {
|
|
2278
|
-
smol: "openrouter/deepseek/deepseek-v4-flash",
|
|
2279
|
-
regular: "openrouter/deepseek/deepseek-v4-flash",
|
|
2280
|
-
smart: "openrouter/deepseek/deepseek-v4-pro",
|
|
2281
|
-
ultra: "openrouter/anthropic/claude-opus-4.8"
|
|
2282
|
-
},
|
|
2283
|
-
opencode: {
|
|
2284
|
-
smol: "openrouter/deepseek/deepseek-v4-flash",
|
|
2285
|
-
regular: "openrouter/deepseek/deepseek-v4-flash",
|
|
2286
|
-
smart: "openrouter/deepseek/deepseek-v4-pro",
|
|
2287
|
-
ultra: "openrouter/anthropic/claude-opus-4.8"
|
|
2288
|
-
},
|
|
2289
|
-
devin: {
|
|
2290
|
-
smol: "devin",
|
|
2291
|
-
regular: "devin",
|
|
2292
|
-
smart: "devin",
|
|
2293
|
-
ultra: "devin"
|
|
2294
|
-
},
|
|
2295
|
-
acp: {
|
|
2296
|
-
smol: "",
|
|
2297
|
-
regular: "",
|
|
2298
|
-
smart: "",
|
|
2299
|
-
ultra: ""
|
|
2300
|
-
}
|
|
2301
|
-
};
|
|
2302
|
-
AgentTaskStatusSchema = exports_zod.enum([
|
|
2303
|
-
"draft",
|
|
2304
|
-
"backlog",
|
|
2305
|
-
"unassigned",
|
|
2306
|
-
"offered",
|
|
2307
|
-
"reviewing",
|
|
2308
|
-
"pending",
|
|
2309
|
-
"in_progress",
|
|
2310
|
-
"paused",
|
|
2311
|
-
"completed",
|
|
2312
|
-
"failed",
|
|
2313
|
-
"cancelled",
|
|
2314
|
-
"superseded"
|
|
2315
|
-
]);
|
|
2316
|
-
TERMINAL_TASK_STATUSES = ["completed", "failed", "cancelled", "superseded"];
|
|
2317
|
-
InboxMessageStatusSchema = exports_zod.enum([
|
|
2318
|
-
"unread",
|
|
2319
|
-
"processing",
|
|
2320
|
-
"read",
|
|
2321
|
-
"responded",
|
|
2322
|
-
"delegated"
|
|
2323
|
-
]);
|
|
2324
|
-
InboxMessageSchema = exports_zod.object({
|
|
2325
|
-
id: exports_zod.uuid(),
|
|
2326
|
-
agentId: exports_zod.string(),
|
|
2327
|
-
content: exports_zod.string().min(1),
|
|
2328
|
-
source: exports_zod.enum(["slack", "agentmail"]).default("slack"),
|
|
2329
|
-
status: InboxMessageStatusSchema.default("unread"),
|
|
2330
|
-
slackChannelId: exports_zod.string().optional(),
|
|
2331
|
-
slackThreadTs: exports_zod.string().optional(),
|
|
2332
|
-
slackUserId: exports_zod.string().optional(),
|
|
2333
|
-
matchedText: exports_zod.string().optional(),
|
|
2334
|
-
delegatedToTaskId: exports_zod.uuid().optional(),
|
|
2335
|
-
responseText: exports_zod.string().optional(),
|
|
2336
|
-
createdAt: exports_zod.iso.datetime(),
|
|
2337
|
-
lastUpdatedAt: exports_zod.iso.datetime()
|
|
2338
|
-
}).openapi("InboxMessage");
|
|
2339
|
-
AgentTaskSourceSchema = exports_zod.enum([
|
|
2340
|
-
"mcp",
|
|
2341
|
-
"slack",
|
|
2342
|
-
"api",
|
|
2343
|
-
"ui",
|
|
2344
|
-
"github",
|
|
2345
|
-
"gitlab",
|
|
2346
|
-
"agentmail",
|
|
2347
|
-
"system",
|
|
2348
|
-
"schedule",
|
|
2349
|
-
"workflow",
|
|
2350
|
-
"linear",
|
|
2351
|
-
"jira"
|
|
2352
|
-
]);
|
|
2353
|
-
RoutingReasonSchema = exports_zod.enum([
|
|
2354
|
-
"skill",
|
|
2355
|
-
"continuity",
|
|
2356
|
-
"overflow",
|
|
2357
|
-
"human_pinned",
|
|
2358
|
-
"reroute_fault"
|
|
2359
|
-
]);
|
|
2360
|
-
RoutingSourceSchema = exports_zod.enum(["declared", "engine_default"]);
|
|
2361
|
-
ProviderNameSchema = exports_zod.enum([
|
|
2362
|
-
"claude",
|
|
2363
|
-
"codex",
|
|
2364
|
-
"pi",
|
|
2365
|
-
"devin",
|
|
2366
|
-
"claude-managed",
|
|
2367
|
-
"opencode",
|
|
2368
|
-
"acp"
|
|
2369
|
-
]);
|
|
2370
|
-
SteerModeSchema = exports_zod.enum(["steer", "queue"]);
|
|
2371
|
-
SteeringStatusSchema = exports_zod.enum([
|
|
2372
|
-
"pending",
|
|
2373
|
-
"delivered",
|
|
2374
|
-
"handled",
|
|
2375
|
-
"promoted",
|
|
2376
|
-
"cancelled"
|
|
2377
|
-
]);
|
|
2378
|
-
SteeringSourceSchema = exports_zod.enum(["ui", "mcp", "script", "slack", "api"]);
|
|
2379
|
-
SteeringMessageSchema = exports_zod.object({
|
|
2380
|
-
id: exports_zod.uuid(),
|
|
2381
|
-
taskId: exports_zod.uuid(),
|
|
2382
|
-
body: exports_zod.string().min(1),
|
|
2383
|
-
mode: SteerModeSchema,
|
|
2384
|
-
status: SteeringStatusSchema,
|
|
2385
|
-
deliveredMode: SteerModeSchema.optional(),
|
|
2386
|
-
source: SteeringSourceSchema,
|
|
2387
|
-
createdByKind: exports_zod.enum(["user", "agent", "system"]),
|
|
2388
|
-
createdByUserId: exports_zod.string().optional(),
|
|
2389
|
-
createdByAgentId: exports_zod.string().optional(),
|
|
2390
|
-
promotedTaskId: exports_zod.uuid().optional(),
|
|
2391
|
-
createdAt: exports_zod.iso.datetime(),
|
|
2392
|
-
deliveredAt: exports_zod.iso.datetime().optional(),
|
|
2393
|
-
handledAt: exports_zod.iso.datetime().optional(),
|
|
2394
|
-
handledNote: exports_zod.string().optional()
|
|
2395
|
-
}).openapi("SteeringMessage");
|
|
2396
|
-
SteerOutcomeSchema = exports_zod.enum(["steered", "queued", "promoted"]);
|
|
2397
|
-
OnUnsupportedSchema = exports_zod.enum(["degrade", "fail"]).default("degrade");
|
|
2398
|
-
SteerResultSchema = exports_zod.object({
|
|
2399
|
-
outcome: SteerOutcomeSchema,
|
|
2400
|
-
steeringMessageId: exports_zod.uuid().optional(),
|
|
2401
|
-
promotedTaskId: exports_zod.uuid().optional(),
|
|
2402
|
-
effectiveMode: SteerModeSchema,
|
|
2403
|
-
degradedFrom: SteerModeSchema.optional()
|
|
2404
|
-
}).openapi("SteerResult");
|
|
2405
|
-
PROVIDER_STEER_CAPABILITIES = {
|
|
2406
|
-
pi: ["steer", "queue"],
|
|
2407
|
-
"claude-managed": ["steer", "queue"],
|
|
2408
|
-
devin: ["queue"],
|
|
2409
|
-
opencode: ["queue"],
|
|
2410
|
-
claude: ["queue"],
|
|
2411
|
-
codex: ["steer", "queue"],
|
|
2412
|
-
acp: []
|
|
2413
|
-
};
|
|
2414
|
-
FollowUpConfigSchema = exports_zod.object({
|
|
2415
|
-
disabled: exports_zod.boolean().optional(),
|
|
2416
|
-
onCompleted: exports_zod.string().max(4000).optional(),
|
|
2417
|
-
onFailed: exports_zod.string().max(4000).optional()
|
|
2418
|
-
}).openapi("FollowUpConfig");
|
|
2419
|
-
RoutingAffinitySchema = exports_zod.object({
|
|
2420
|
-
sourceAgentId: exports_zod.string().optional(),
|
|
2421
|
-
role: exports_zod.string().max(100).optional(),
|
|
2422
|
-
harnessProvider: ProviderNameSchema.optional(),
|
|
2423
|
-
capabilities: exports_zod.array(exports_zod.string()).default([]),
|
|
2424
|
-
leadOnly: exports_zod.boolean().optional()
|
|
2425
|
-
}).openapi("RoutingAffinity");
|
|
2426
|
-
AgentTaskSchema = exports_zod.object({
|
|
2427
|
-
id: exports_zod.uuid(),
|
|
2428
|
-
key: AssetKeySchema,
|
|
2429
|
-
agentId: exports_zod.string().nullable(),
|
|
2430
|
-
creatorAgentId: exports_zod.string().optional(),
|
|
2431
|
-
task: exports_zod.string().min(1),
|
|
2432
|
-
title: exports_zod.string().optional(),
|
|
2433
|
-
status: AgentTaskStatusSchema,
|
|
2434
|
-
source: AgentTaskSourceSchema.default("mcp"),
|
|
2435
|
-
routingReason: RoutingReasonSchema.optional(),
|
|
2436
|
-
routingSource: RoutingSourceSchema.optional().describe("Origin of the routing reason: declared by the caller or chosen by the engine. Absent for unknown historical provenance or no reason."),
|
|
2437
|
-
routingNote: exports_zod.string().max(200).optional(),
|
|
2438
|
-
taskType: exports_zod.string().max(50).optional(),
|
|
2439
|
-
tags: exports_zod.array(exports_zod.string()).default([]),
|
|
2440
|
-
priority: exports_zod.number().int().min(0).max(100).default(50),
|
|
2441
|
-
dependsOn: exports_zod.array(exports_zod.string()).default([]),
|
|
2442
|
-
offeredTo: exports_zod.string().optional(),
|
|
2443
|
-
offeredAt: exports_zod.iso.datetime().optional(),
|
|
2444
|
-
acceptedAt: exports_zod.iso.datetime().optional(),
|
|
2445
|
-
rejectionReason: exports_zod.string().optional(),
|
|
2446
|
-
createdAt: exports_zod.iso.datetime(),
|
|
2447
|
-
lastUpdatedAt: exports_zod.iso.datetime(),
|
|
2448
|
-
finishedAt: exports_zod.iso.datetime().optional(),
|
|
2449
|
-
notifiedAt: exports_zod.iso.datetime().optional(),
|
|
2450
|
-
failureReason: exports_zod.string().optional(),
|
|
2451
|
-
output: exports_zod.string().optional(),
|
|
2452
|
-
progress: exports_zod.string().optional(),
|
|
2453
|
-
slackChannelId: exports_zod.string().optional(),
|
|
2454
|
-
slackThreadTs: exports_zod.string().optional(),
|
|
2455
|
-
slackTriggerMessageTs: exports_zod.string().optional(),
|
|
2456
|
-
slackUserId: exports_zod.string().optional(),
|
|
2457
|
-
slackReplySent: exports_zod.boolean().default(false),
|
|
2458
|
-
slackProgressMessageTs: exports_zod.string().optional(),
|
|
2459
|
-
slackTreeRootMessageTs: exports_zod.string().optional(),
|
|
2460
|
-
vcsProvider: exports_zod.enum(["github", "gitlab"]).optional(),
|
|
2461
|
-
vcsRepo: exports_zod.string().optional(),
|
|
2462
|
-
vcsEventType: exports_zod.string().optional(),
|
|
2463
|
-
vcsNumber: exports_zod.number().int().optional(),
|
|
2464
|
-
vcsCommentId: exports_zod.number().int().optional(),
|
|
2465
|
-
vcsAuthor: exports_zod.string().optional(),
|
|
2466
|
-
vcsUrl: exports_zod.string().optional(),
|
|
2467
|
-
vcsInstallationId: exports_zod.number().int().optional(),
|
|
2468
|
-
vcsNodeId: exports_zod.string().optional(),
|
|
2469
|
-
agentmailInboxId: exports_zod.string().optional(),
|
|
2470
|
-
agentmailMessageId: exports_zod.string().optional(),
|
|
2471
|
-
agentmailThreadId: exports_zod.string().optional(),
|
|
2472
|
-
mentionMessageId: exports_zod.string().optional(),
|
|
2473
|
-
mentionChannelId: exports_zod.string().optional(),
|
|
2474
|
-
dir: exports_zod.string().min(1).optional(),
|
|
2475
|
-
parentTaskId: exports_zod.string().optional(),
|
|
2476
|
-
claudeSessionId: exports_zod.string().optional(),
|
|
2477
|
-
model: exports_zod.string().optional(),
|
|
2478
|
-
modelTier: ModelTierSchema.optional(),
|
|
2479
|
-
effort: ReasoningEffortSchema.optional(),
|
|
2480
|
-
scheduleId: exports_zod.string().optional(),
|
|
2481
|
-
workflowRunId: exports_zod.string().uuid().nullable().optional(),
|
|
2482
|
-
workflowRunStepId: exports_zod.string().uuid().nullable().optional(),
|
|
2483
|
-
contextKey: exports_zod.string().optional(),
|
|
2484
|
-
outputSchema: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
2485
|
-
followUpConfig: FollowUpConfigSchema.optional(),
|
|
2486
|
-
wasPaused: exports_zod.boolean().default(false),
|
|
2487
|
-
compactionCount: exports_zod.number().int().min(0).optional(),
|
|
2488
|
-
peakContextPercent: exports_zod.number().min(0).max(100).optional(),
|
|
2489
|
-
peakContextTokens: exports_zod.number().int().min(0).optional(),
|
|
2490
|
-
contextWindowSize: exports_zod.number().int().min(0).optional(),
|
|
2491
|
-
credentialKeySuffix: exports_zod.string().optional(),
|
|
2492
|
-
credentialKeyType: exports_zod.string().optional(),
|
|
2493
|
-
requestedByUserId: exports_zod.string().optional(),
|
|
2494
|
-
swarmVersion: exports_zod.string().optional(),
|
|
2495
|
-
provider: ProviderNameSchema.optional(),
|
|
2496
|
-
providerMeta: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
2497
|
-
harnessVariant: exports_zod.string().optional(),
|
|
2498
|
-
harnessVariantMeta: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
2499
|
-
totalCostUsd: exports_zod.number().min(0).optional(),
|
|
2500
|
-
routingAffinity: RoutingAffinitySchema.optional(),
|
|
2501
|
-
routingAffinityInvalid: exports_zod.boolean().optional()
|
|
2502
|
-
}).openapi("AgentTask");
|
|
2503
|
-
CreateTaskOptionsSchema = exports_zod.object({
|
|
2504
|
-
key: exports_zod.string().min(1).optional(),
|
|
2505
|
-
agentId: exports_zod.string().nullable().optional(),
|
|
2506
|
-
creatorAgentId: exports_zod.string().optional(),
|
|
2507
|
-
source: AgentTaskSourceSchema.optional(),
|
|
2508
|
-
routingReason: RoutingReasonSchema.optional(),
|
|
2509
|
-
routingSource: RoutingSourceSchema.optional(),
|
|
2510
|
-
routingNote: exports_zod.string().max(200).optional(),
|
|
2511
|
-
taskType: exports_zod.string().max(50).optional(),
|
|
2512
|
-
tags: exports_zod.array(exports_zod.string()).optional(),
|
|
2513
|
-
priority: exports_zod.number().int().min(0).max(100).optional(),
|
|
2514
|
-
dependsOn: exports_zod.array(exports_zod.string()).optional(),
|
|
2515
|
-
offeredTo: exports_zod.string().optional(),
|
|
2516
|
-
status: exports_zod.enum(["draft", "backlog", "unassigned"]).optional(),
|
|
2517
|
-
slackChannelId: exports_zod.string().optional(),
|
|
2518
|
-
slackThreadTs: exports_zod.string().optional(),
|
|
2519
|
-
slackTriggerMessageTs: exports_zod.string().optional(),
|
|
2520
|
-
slackUserId: exports_zod.string().optional(),
|
|
2521
|
-
overrideSlackContext: exports_zod.boolean().optional(),
|
|
2522
|
-
vcsProvider: exports_zod.enum(["github", "gitlab"]).optional(),
|
|
2523
|
-
vcsRepo: exports_zod.string().optional(),
|
|
2524
|
-
vcsEventType: exports_zod.string().optional(),
|
|
2525
|
-
vcsNumber: exports_zod.number().int().optional(),
|
|
2526
|
-
vcsCommentId: exports_zod.number().int().optional(),
|
|
2527
|
-
vcsAuthor: exports_zod.string().optional(),
|
|
2528
|
-
vcsUrl: exports_zod.string().optional(),
|
|
2529
|
-
vcsInstallationId: exports_zod.number().int().optional(),
|
|
2530
|
-
vcsNodeId: exports_zod.string().optional(),
|
|
2531
|
-
agentmailInboxId: exports_zod.string().optional(),
|
|
2532
|
-
agentmailMessageId: exports_zod.string().optional(),
|
|
2533
|
-
agentmailThreadId: exports_zod.string().optional(),
|
|
2534
|
-
mentionMessageId: exports_zod.string().optional(),
|
|
2535
|
-
mentionChannelId: exports_zod.string().optional(),
|
|
2536
|
-
dir: exports_zod.string().optional(),
|
|
2537
|
-
parentTaskId: exports_zod.string().optional(),
|
|
2538
|
-
model: exports_zod.string().optional(),
|
|
2539
|
-
modelTier: ModelTierSchema.optional(),
|
|
2540
|
-
effort: ReasoningEffortSchema.optional(),
|
|
2541
|
-
scheduleId: exports_zod.string().optional(),
|
|
2542
|
-
workflowRunId: exports_zod.string().optional(),
|
|
2543
|
-
workflowRunStepId: exports_zod.string().optional(),
|
|
2544
|
-
sourceTaskId: exports_zod.string().optional(),
|
|
2545
|
-
outputSchema: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
2546
|
-
inheritParentOutputSchema: exports_zod.boolean().optional(),
|
|
2547
|
-
inheritParentRoutingAffinity: exports_zod.boolean().optional(),
|
|
2548
|
-
followUpConfig: FollowUpConfigSchema.optional(),
|
|
2549
|
-
requestedByUserId: exports_zod.string().optional(),
|
|
2550
|
-
contextKey: exports_zod.string().optional(),
|
|
2551
|
-
bypassTrackerContextDedup: exports_zod.boolean().optional(),
|
|
2552
|
-
routingAffinity: RoutingAffinitySchema.optional()
|
|
2553
|
-
});
|
|
2554
|
-
TaskAttachmentKindSchema = exports_zod.enum(["agent-fs", "url", "shared-fs", "page"]);
|
|
2555
|
-
attachmentCapabilitiesSchema = exports_zod.record(exports_zod.string(), exports_zod.unknown()).refine((capabilities) => !(SERVER_GENERATED_ATTACHMENT_CAPABILITY in capabilities), {
|
|
2556
|
-
message: `${SERVER_GENERATED_ATTACHMENT_CAPABILITY} is reserved for server-generated attachments`
|
|
2557
|
-
});
|
|
2558
|
-
attachmentCommonFields = {
|
|
2559
|
-
name: exports_zod.string().min(1).describe("Display name for the attachment."),
|
|
2560
|
-
providerId: exports_zod.string().min(1).optional(),
|
|
2561
|
-
providerKey: exports_zod.string().min(1).optional(),
|
|
2562
|
-
capabilities: attachmentCapabilitiesSchema.optional(),
|
|
2563
|
-
mimeType: exports_zod.string().optional(),
|
|
2564
|
-
sizeBytes: exports_zod.number().int().min(0).optional(),
|
|
2565
|
-
sha256: exports_zod.string().optional(),
|
|
2566
|
-
intent: exports_zod.string().optional().describe("WHY this attachment exists — the purpose it serves for this task."),
|
|
2567
|
-
description: exports_zod.string().optional().describe("Optional: what the attachment is."),
|
|
2568
|
-
isPrimary: exports_zod.boolean().optional()
|
|
2569
|
-
};
|
|
2570
|
-
AttachmentInputSchema = exports_zod.discriminatedUnion("kind", [
|
|
2571
|
-
exports_zod.object({
|
|
2572
|
-
kind: exports_zod.literal("agent-fs"),
|
|
2573
|
-
path: exports_zod.string().min(1).describe("agent-fs path the attachment points at."),
|
|
2574
|
-
orgId: exports_zod.string().min(1).optional().describe("agent-fs org id — paired with `driveId` lets the renderer build a public live-host URL."),
|
|
2575
|
-
driveId: exports_zod.string().min(1).optional().describe("agent-fs drive id — paired with `orgId` lets the renderer build a public live-host URL."),
|
|
2576
|
-
...attachmentCommonFields
|
|
2577
|
-
}),
|
|
2578
|
-
exports_zod.object({
|
|
2579
|
-
kind: exports_zod.literal("url"),
|
|
2580
|
-
url: exports_zod.string().min(1).describe("External URL the attachment points at."),
|
|
2581
|
-
...attachmentCommonFields
|
|
2582
|
-
}),
|
|
2583
|
-
exports_zod.object({
|
|
2584
|
-
kind: exports_zod.literal("shared-fs"),
|
|
2585
|
-
path: exports_zod.string().min(1).describe("Shared-filesystem path the attachment points at."),
|
|
2586
|
-
...attachmentCommonFields
|
|
2587
|
-
}),
|
|
2588
|
-
exports_zod.object({
|
|
2589
|
-
kind: exports_zod.literal("page"),
|
|
2590
|
-
pageId: exports_zod.string().min(1).describe("Swarm Page id the attachment points at."),
|
|
2591
|
-
...attachmentCommonFields
|
|
2592
|
-
})
|
|
2593
|
-
]);
|
|
2594
|
-
TaskAttachmentSchema = exports_zod.object({
|
|
2595
|
-
id: exports_zod.uuid(),
|
|
2596
|
-
taskId: exports_zod.uuid(),
|
|
2597
|
-
agentId: exports_zod.string().nullable(),
|
|
2598
|
-
name: exports_zod.string(),
|
|
2599
|
-
kind: TaskAttachmentKindSchema,
|
|
2600
|
-
url: exports_zod.string().optional(),
|
|
2601
|
-
path: exports_zod.string().optional(),
|
|
2602
|
-
pageId: exports_zod.string().optional(),
|
|
2603
|
-
providerId: exports_zod.string().optional(),
|
|
2604
|
-
providerKey: exports_zod.string().optional(),
|
|
2605
|
-
capabilities: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
2606
|
-
orgId: exports_zod.string().optional(),
|
|
2607
|
-
driveId: exports_zod.string().optional(),
|
|
2608
|
-
mimeType: exports_zod.string().optional(),
|
|
2609
|
-
sizeBytes: exports_zod.number().int().min(0).optional(),
|
|
2610
|
-
sha256: exports_zod.string().optional(),
|
|
2611
|
-
intent: exports_zod.string().optional(),
|
|
2612
|
-
description: exports_zod.string().optional(),
|
|
2613
|
-
isPrimary: exports_zod.boolean().default(false),
|
|
2614
|
-
createdAt: exports_zod.iso.datetime(),
|
|
2615
|
-
createdBy: exports_zod.string().optional(),
|
|
2616
|
-
updatedBy: exports_zod.string().optional()
|
|
2617
|
-
}).openapi("TaskAttachment");
|
|
2618
|
-
UserSchema = exports_zod.object({
|
|
2619
|
-
id: exports_zod.string(),
|
|
2620
|
-
name: exports_zod.string().min(1),
|
|
2621
|
-
email: exports_zod.string().optional(),
|
|
2622
|
-
role: exports_zod.string().optional(),
|
|
2623
|
-
notes: exports_zod.string().optional(),
|
|
2624
|
-
emailAliases: exports_zod.array(exports_zod.string()).default([]),
|
|
2625
|
-
preferredChannel: exports_zod.string().default("slack"),
|
|
2626
|
-
timezone: exports_zod.string().optional(),
|
|
2627
|
-
metadata: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
2628
|
-
dailyBudgetUsd: exports_zod.number().nullable().optional(),
|
|
2629
|
-
status: exports_zod.enum(["invited", "active", "suspended"]).default("active"),
|
|
2630
|
-
createdAt: exports_zod.iso.datetime(),
|
|
2631
|
-
lastUpdatedAt: exports_zod.iso.datetime()
|
|
2632
|
-
}).openapi("User");
|
|
2633
|
-
UserCommsPrefsSchema = exports_zod.object({
|
|
2634
|
-
tone: exports_zod.string().optional(),
|
|
2635
|
-
language: exports_zod.string().optional(),
|
|
2636
|
-
verbosity: exports_zod.string().optional()
|
|
2637
|
-
}).openapi("UserCommsPrefs");
|
|
2638
|
-
IdentityEventTypeSchema = exports_zod.enum([
|
|
2639
|
-
"auto_merge",
|
|
2640
|
-
"manual_merge",
|
|
2641
|
-
"identity_added",
|
|
2642
|
-
"identity_removed",
|
|
2643
|
-
"email_added",
|
|
2644
|
-
"email_removed",
|
|
2645
|
-
"token_minted",
|
|
2646
|
-
"token_revoked",
|
|
2647
|
-
"budget_changed",
|
|
2648
|
-
"status_changed",
|
|
2649
|
-
"profile_changed"
|
|
2650
|
-
]);
|
|
2651
|
-
InboxItemTypeSchema = exports_zod.enum([
|
|
2652
|
-
"approval",
|
|
2653
|
-
"credential_missing",
|
|
2654
|
-
"broken_task",
|
|
2655
|
-
"to_read",
|
|
2656
|
-
"to_start_template",
|
|
2657
|
-
"notification"
|
|
2658
|
-
]);
|
|
2659
|
-
InboxItemStatusSchema = exports_zod.enum(["open", "snoozed", "dismissed", "done"]);
|
|
2660
|
-
InboxItemStateSchema = exports_zod.object({
|
|
2661
|
-
id: exports_zod.string(),
|
|
2662
|
-
userId: exports_zod.string(),
|
|
2663
|
-
itemType: InboxItemTypeSchema,
|
|
2664
|
-
itemId: exports_zod.string(),
|
|
2665
|
-
status: InboxItemStatusSchema,
|
|
2666
|
-
snoozeUntil: exports_zod.string().optional(),
|
|
2667
|
-
dismissedAt: exports_zod.string().optional(),
|
|
2668
|
-
doneAt: exports_zod.string().optional(),
|
|
2669
|
-
readAt: exports_zod.string().optional(),
|
|
2670
|
-
createdAt: exports_zod.string(),
|
|
2671
|
-
lastUpdatedAt: exports_zod.string()
|
|
2672
|
-
}).openapi("InboxItemState");
|
|
2673
|
-
FavoriteItemTypeSchema = exports_zod.enum(["page", "workflow", "schedule"]);
|
|
2674
|
-
UserFavoriteSchema = exports_zod.object({
|
|
2675
|
-
id: exports_zod.string(),
|
|
2676
|
-
userId: exports_zod.string().optional(),
|
|
2677
|
-
itemType: FavoriteItemTypeSchema,
|
|
2678
|
-
itemId: exports_zod.string(),
|
|
2679
|
-
createdAt: exports_zod.string(),
|
|
2680
|
-
lastUpdatedAt: exports_zod.string(),
|
|
2681
|
-
createdBy: exports_zod.string().optional(),
|
|
2682
|
-
updatedBy: exports_zod.string().optional()
|
|
2683
|
-
}).openapi("UserFavorite");
|
|
2684
|
-
TaskTemplateKindSchema = exports_zod.enum(["task", "workflow", "schedule"]);
|
|
2685
|
-
TaskTemplateSchema = exports_zod.object({
|
|
2686
|
-
id: exports_zod.string(),
|
|
2687
|
-
title: exports_zod.string().min(1),
|
|
2688
|
-
description: exports_zod.string(),
|
|
2689
|
-
prompt: exports_zod.string(),
|
|
2690
|
-
kind: TaskTemplateKindSchema.default("task"),
|
|
2691
|
-
payload: exports_zod.record(exports_zod.string(), exports_zod.unknown()).default({}),
|
|
2692
|
-
category: exports_zod.string().optional(),
|
|
2693
|
-
tags: exports_zod.array(exports_zod.string()).default([]),
|
|
2694
|
-
createdAt: exports_zod.string()
|
|
2695
|
-
}).openapi("TaskTemplate");
|
|
2696
|
-
AgentStatusSchema = exports_zod.enum(["idle", "busy", "offline", "waiting_for_credentials"]);
|
|
2697
|
-
AgentAvatarSchema = exports_zod.discriminatedUnion("type", [
|
|
2698
|
-
exports_zod.object({
|
|
2699
|
-
type: exports_zod.literal("lucide"),
|
|
2700
|
-
icon: exports_zod.string().regex(/^[a-z0-9-]+$/).max(64),
|
|
2701
|
-
color: exports_zod.string().regex(/^#[0-9a-fA-F]{6}$/).optional()
|
|
2702
|
-
})
|
|
2703
|
-
]);
|
|
2704
|
-
AgentSchema = exports_zod.object({
|
|
2705
|
-
id: exports_zod.string(),
|
|
2706
|
-
name: exports_zod.string().min(1),
|
|
2707
|
-
isLead: exports_zod.boolean().default(false),
|
|
2708
|
-
status: AgentStatusSchema,
|
|
2709
|
-
description: exports_zod.string().optional(),
|
|
2710
|
-
role: exports_zod.string().max(100).optional(),
|
|
2711
|
-
capabilities: exports_zod.array(exports_zod.string()).default([]),
|
|
2712
|
-
claudeMd: exports_zod.string().max(MAX_PROFILE_FILE_LENGTH).optional(),
|
|
2713
|
-
soulMd: exports_zod.string().max(MAX_PROFILE_FILE_LENGTH).optional(),
|
|
2714
|
-
identityMd: exports_zod.string().max(MAX_PROFILE_FILE_LENGTH).optional(),
|
|
2715
|
-
setupScript: exports_zod.string().max(MAX_PROFILE_FILE_LENGTH).optional(),
|
|
2716
|
-
toolsMd: exports_zod.string().max(MAX_PROFILE_FILE_LENGTH).optional(),
|
|
2717
|
-
heartbeatMd: exports_zod.string().max(MAX_PROFILE_FILE_LENGTH).optional(),
|
|
2718
|
-
maxTasks: exports_zod.number().int().min(1).max(100).optional(),
|
|
2719
|
-
emptyPollCount: exports_zod.number().int().min(0).optional(),
|
|
2720
|
-
lastActivityAt: exports_zod.iso.datetime().optional(),
|
|
2721
|
-
provider: ProviderNameSchema.optional(),
|
|
2722
|
-
harnessProvider: ProviderNameSchema.nullable().optional(),
|
|
2723
|
-
credentialMissing: exports_zod.array(exports_zod.string()).nullable().optional(),
|
|
2724
|
-
credStatus: exports_zod.lazy(() => AgentCredStatusSchema).nullable().optional(),
|
|
2725
|
-
avatar: exports_zod.lazy(() => AgentAvatarSchema).nullable().optional(),
|
|
2726
|
-
createdAt: exports_zod.iso.datetime(),
|
|
2727
|
-
lastUpdatedAt: exports_zod.iso.datetime()
|
|
2728
|
-
}).openapi("Agent");
|
|
2729
|
-
AgentCredStatusLiveTestSchema = exports_zod.object({
|
|
2730
|
-
ok: exports_zod.boolean(),
|
|
2731
|
-
error: exports_zod.string().nullable().default(null),
|
|
2732
|
-
latency_ms: exports_zod.number(),
|
|
2733
|
-
testedAt: exports_zod.number()
|
|
2734
|
-
}).openapi("AgentCredStatusLiveTest");
|
|
2735
|
-
AgentLatestModelSchema = exports_zod.object({
|
|
2736
|
-
model: exports_zod.string().min(1),
|
|
2737
|
-
source: exports_zod.enum(["task", "agent_config", "adapter_default", "custom"]),
|
|
2738
|
-
taskId: exports_zod.string().nullable().default(null),
|
|
2739
|
-
harnessProvider: ProviderNameSchema.nullable().default(null),
|
|
2740
|
-
reportedAt: exports_zod.number(),
|
|
2741
|
-
reasoningEffort: ReasoningEffortSchema.optional()
|
|
2742
|
-
}).openapi("AgentLatestModel");
|
|
2743
|
-
AgentBedrockStatusSchema = exports_zod.object({
|
|
2744
|
-
region: exports_zod.string(),
|
|
2745
|
-
probedAt: exports_zod.number(),
|
|
2746
|
-
ready: exports_zod.boolean(),
|
|
2747
|
-
models: exports_zod.array(exports_zod.object({ id: exports_zod.string(), name: exports_zod.string() })).default([]),
|
|
2748
|
-
error: exports_zod.string().optional()
|
|
2749
|
-
}).openapi("AgentBedrockStatus");
|
|
2750
|
-
AcpSessionConfigSelectValueSchema = exports_zod.object({
|
|
2751
|
-
value: exports_zod.string(),
|
|
2752
|
-
name: exports_zod.string(),
|
|
2753
|
-
description: exports_zod.string().nullable().optional()
|
|
2754
|
-
});
|
|
2755
|
-
AcpSessionConfigSelectGroupSchema = exports_zod.object({
|
|
2756
|
-
group: exports_zod.string(),
|
|
2757
|
-
name: exports_zod.string(),
|
|
2758
|
-
options: exports_zod.array(AcpSessionConfigSelectValueSchema)
|
|
2759
|
-
});
|
|
2760
|
-
AcpSessionConfigOptionSchema = exports_zod.discriminatedUnion("type", [
|
|
2761
|
-
exports_zod.object({
|
|
2762
|
-
type: exports_zod.literal("select"),
|
|
2763
|
-
id: exports_zod.string(),
|
|
2764
|
-
name: exports_zod.string(),
|
|
2765
|
-
description: exports_zod.string().nullable().optional(),
|
|
2766
|
-
category: exports_zod.string().nullable().optional(),
|
|
2767
|
-
currentValue: exports_zod.string(),
|
|
2768
|
-
options: exports_zod.array(exports_zod.union([AcpSessionConfigSelectValueSchema, AcpSessionConfigSelectGroupSchema]))
|
|
2769
|
-
}),
|
|
2770
|
-
exports_zod.object({
|
|
2771
|
-
type: exports_zod.literal("boolean"),
|
|
2772
|
-
id: exports_zod.string(),
|
|
2773
|
-
name: exports_zod.string(),
|
|
2774
|
-
description: exports_zod.string().nullable().optional(),
|
|
2775
|
-
category: exports_zod.string().nullable().optional(),
|
|
2776
|
-
currentValue: exports_zod.boolean()
|
|
2777
|
-
})
|
|
2778
|
-
]);
|
|
2779
|
-
AgentAcpStatusSchema = exports_zod.object({
|
|
2780
|
-
target: exports_zod.enum(["opencode", "custom"]),
|
|
2781
|
-
configOptions: exports_zod.array(AcpSessionConfigOptionSchema),
|
|
2782
|
-
reportedAt: exports_zod.number()
|
|
2783
|
-
}).openapi("AgentAcpStatus");
|
|
2784
|
-
AgentCredStatusSchema = exports_zod.object({
|
|
2785
|
-
ready: exports_zod.boolean(),
|
|
2786
|
-
missing: exports_zod.array(exports_zod.string()).default([]),
|
|
2787
|
-
satisfiedBy: exports_zod.enum(["env", "file", "side-effect-pending", "sdk-delegated"]).nullable().default(null),
|
|
2788
|
-
hint: exports_zod.string().nullable().default(null),
|
|
2789
|
-
liveTest: AgentCredStatusLiveTestSchema.nullable().default(null),
|
|
2790
|
-
latestModel: AgentLatestModelSchema.nullable().default(null),
|
|
2791
|
-
reportedAt: exports_zod.number(),
|
|
2792
|
-
reportKind: exports_zod.enum(["boot", "post_task"]).default("boot"),
|
|
2793
|
-
bedrock: AgentBedrockStatusSchema.nullable().default(null),
|
|
2794
|
-
acp: AgentAcpStatusSchema.nullable().default(null)
|
|
2795
|
-
}).openapi("AgentCredStatus");
|
|
2796
|
-
AgentWithTasksSchema = AgentSchema.extend({
|
|
2797
|
-
tasks: exports_zod.array(AgentTaskSchema).default([])
|
|
2798
|
-
});
|
|
2799
|
-
ChangeSourceSchema = exports_zod.enum([
|
|
2800
|
-
"self_edit",
|
|
2801
|
-
"lead_coaching",
|
|
2802
|
-
"api",
|
|
2803
|
-
"system",
|
|
2804
|
-
"session_sync"
|
|
2805
|
-
]);
|
|
2806
|
-
VersionableFieldSchema = exports_zod.enum([
|
|
2807
|
-
"soulMd",
|
|
2808
|
-
"identityMd",
|
|
2809
|
-
"toolsMd",
|
|
2810
|
-
"claudeMd",
|
|
2811
|
-
"setupScript",
|
|
2812
|
-
"heartbeatMd"
|
|
2813
|
-
]);
|
|
2814
|
-
ContextVersionSchema = exports_zod.object({
|
|
2815
|
-
id: exports_zod.uuid(),
|
|
2816
|
-
agentId: exports_zod.string(),
|
|
2817
|
-
field: VersionableFieldSchema,
|
|
2818
|
-
content: exports_zod.string(),
|
|
2819
|
-
version: exports_zod.number().int().min(1),
|
|
2820
|
-
changeSource: ChangeSourceSchema,
|
|
2821
|
-
changedByAgentId: exports_zod.string().nullable(),
|
|
2822
|
-
changeReason: exports_zod.string().nullable(),
|
|
2823
|
-
contentHash: exports_zod.string(),
|
|
2824
|
-
previousVersionId: exports_zod.uuid().nullable(),
|
|
2825
|
-
createdAt: exports_zod.iso.datetime()
|
|
2826
|
-
}).openapi("ContextVersion");
|
|
2827
|
-
ChannelTypeSchema = exports_zod.enum(["public", "dm"]);
|
|
2828
|
-
ChannelSchema = exports_zod.object({
|
|
2829
|
-
id: exports_zod.uuid(),
|
|
2830
|
-
name: exports_zod.string().min(1).max(100),
|
|
2831
|
-
description: exports_zod.string().max(500).optional(),
|
|
2832
|
-
type: ChannelTypeSchema.default("public"),
|
|
2833
|
-
createdBy: exports_zod.string().optional(),
|
|
2834
|
-
participants: exports_zod.array(exports_zod.string()).default([]),
|
|
2835
|
-
createdAt: exports_zod.iso.datetime()
|
|
2836
|
-
}).openapi("Channel");
|
|
2837
|
-
ChannelMessageSchema = exports_zod.object({
|
|
2838
|
-
id: exports_zod.uuid(),
|
|
2839
|
-
channelId: exports_zod.uuid(),
|
|
2840
|
-
agentId: exports_zod.string().nullable(),
|
|
2841
|
-
agentName: exports_zod.string().optional(),
|
|
2842
|
-
content: exports_zod.string().min(1).max(4000),
|
|
2843
|
-
replyToId: exports_zod.uuid().optional(),
|
|
2844
|
-
mentions: exports_zod.array(exports_zod.string()).default([]),
|
|
2845
|
-
createdAt: exports_zod.iso.datetime()
|
|
2846
|
-
}).openapi("ChannelMessage");
|
|
2847
|
-
ServiceStatusSchema = exports_zod.enum(["starting", "healthy", "unhealthy", "stopped"]);
|
|
2848
|
-
ServiceSchema = exports_zod.object({
|
|
2849
|
-
id: exports_zod.uuid(),
|
|
2850
|
-
agentId: exports_zod.string(),
|
|
2851
|
-
name: exports_zod.string().min(1).max(50),
|
|
2852
|
-
port: exports_zod.number().int().min(1).max(65535).default(3000),
|
|
2853
|
-
description: exports_zod.string().optional(),
|
|
2854
|
-
url: exports_zod.string().url().optional(),
|
|
2855
|
-
healthCheckPath: exports_zod.string().default("/health"),
|
|
2856
|
-
status: ServiceStatusSchema.default("starting"),
|
|
2857
|
-
script: exports_zod.string().min(1),
|
|
2858
|
-
cwd: exports_zod.string().optional(),
|
|
2859
|
-
interpreter: exports_zod.string().optional(),
|
|
2860
|
-
args: exports_zod.array(exports_zod.string()).optional(),
|
|
2861
|
-
env: exports_zod.record(exports_zod.string(), exports_zod.string()).optional(),
|
|
2862
|
-
metadata: exports_zod.record(exports_zod.string(), exports_zod.unknown()).default({}),
|
|
2863
|
-
createdAt: exports_zod.iso.datetime(),
|
|
2864
|
-
lastUpdatedAt: exports_zod.iso.datetime()
|
|
2865
|
-
}).openapi("Service");
|
|
2866
|
-
AgentLogEventTypeSchema = exports_zod.enum([
|
|
2867
|
-
"agent_joined",
|
|
2868
|
-
"agent_status_change",
|
|
2869
|
-
"agent_left",
|
|
2870
|
-
"task_created",
|
|
2871
|
-
"task_status_change",
|
|
2872
|
-
"task_progress",
|
|
2873
|
-
"task_steering",
|
|
2874
|
-
"task_offered",
|
|
2875
|
-
"task_accepted",
|
|
2876
|
-
"task_rejected",
|
|
2877
|
-
"task_claimed",
|
|
2878
|
-
"task_claim_rejected_affinity",
|
|
2879
|
-
"task_dispatch_rejected_affinity",
|
|
2880
|
-
"task_authorization_rejected",
|
|
2881
|
-
"task_recovery_authorization",
|
|
2882
|
-
"task_released",
|
|
2883
|
-
"channel_message",
|
|
2884
|
-
"service_registered",
|
|
2885
|
-
"service_unregistered",
|
|
2886
|
-
"service_status_change",
|
|
2887
|
-
"budget.upserted",
|
|
2888
|
-
"budget.deleted",
|
|
2889
|
-
"pricing.inserted",
|
|
2890
|
-
"pricing.deleted",
|
|
2891
|
-
"pricing.refresh",
|
|
2892
|
-
"pricing.refresh.failed",
|
|
2893
|
-
"task_superseded",
|
|
2894
|
-
"slack_delivery"
|
|
2895
|
-
]);
|
|
2896
|
-
ResumeReasonSchema = exports_zod.enum([
|
|
2897
|
-
"graceful_shutdown",
|
|
2898
|
-
"context_limits",
|
|
2899
|
-
"manual_supersede",
|
|
2900
|
-
"crash_recovery"
|
|
2901
|
-
]);
|
|
2902
|
-
AgentLogSchema = exports_zod.object({
|
|
2903
|
-
id: exports_zod.uuid(),
|
|
2904
|
-
eventType: AgentLogEventTypeSchema,
|
|
2905
|
-
agentId: exports_zod.string().optional(),
|
|
2906
|
-
taskId: exports_zod.string().optional(),
|
|
2907
|
-
oldValue: exports_zod.string().optional(),
|
|
2908
|
-
newValue: exports_zod.string().optional(),
|
|
2909
|
-
metadata: exports_zod.string().optional(),
|
|
2910
|
-
createdAt: exports_zod.iso.datetime()
|
|
2911
|
-
}).openapi("AgentLog");
|
|
2912
|
-
SessionLogSchema = exports_zod.object({
|
|
2913
|
-
id: exports_zod.uuid(),
|
|
2914
|
-
taskId: exports_zod.uuid().optional(),
|
|
2915
|
-
sessionId: exports_zod.string(),
|
|
2916
|
-
iteration: exports_zod.number().int().min(1),
|
|
2917
|
-
cli: exports_zod.string().default("claude"),
|
|
2918
|
-
content: exports_zod.string(),
|
|
2919
|
-
lineNumber: exports_zod.number().int().min(0),
|
|
2920
|
-
createdAt: exports_zod.iso.datetime()
|
|
2921
|
-
}).openapi("SessionLog");
|
|
2922
|
-
SessionCostSourceSchema = exports_zod.enum(["harness", "pricing-table", "unpriced"]);
|
|
2923
|
-
SessionCostModelBreakdownSchema = exports_zod.object({
|
|
2924
|
-
model: exports_zod.string(),
|
|
2925
|
-
inputTokens: exports_zod.number().int().nonnegative(),
|
|
2926
|
-
outputTokens: exports_zod.number().int().nonnegative(),
|
|
2927
|
-
cacheReadTokens: exports_zod.number().int().nonnegative(),
|
|
2928
|
-
cacheWriteTokens: exports_zod.number().int().nonnegative(),
|
|
2929
|
-
webSearchRequests: exports_zod.number().int().nonnegative().nullable().optional(),
|
|
2930
|
-
costUsd: exports_zod.number().nullable().optional(),
|
|
2931
|
-
harnessCostUsd: exports_zod.number().nullable().optional()
|
|
2932
|
-
}).openapi("SessionCostModelBreakdown");
|
|
2933
|
-
SessionCostSchema = exports_zod.object({
|
|
2934
|
-
id: exports_zod.uuid(),
|
|
2935
|
-
sessionId: exports_zod.string(),
|
|
2936
|
-
taskId: exports_zod.uuid().optional(),
|
|
2937
|
-
agentId: exports_zod.string(),
|
|
2938
|
-
totalCostUsd: exports_zod.number().min(0),
|
|
2939
|
-
inputTokens: exports_zod.number().int().min(0).default(0),
|
|
2940
|
-
outputTokens: exports_zod.number().int().min(0).default(0),
|
|
2941
|
-
cacheReadTokens: exports_zod.number().int().min(0).default(0),
|
|
2942
|
-
cacheWriteTokens: exports_zod.number().int().min(0).default(0),
|
|
2943
|
-
reasoningOutputTokens: exports_zod.number().int().min(0).default(0),
|
|
2944
|
-
thinkingTokens: exports_zod.number().int().min(0).default(0),
|
|
2945
|
-
durationMs: exports_zod.number().int().min(0),
|
|
2946
|
-
numTurns: exports_zod.number().int().min(1).nullable(),
|
|
2947
|
-
model: exports_zod.string(),
|
|
2948
|
-
isError: exports_zod.boolean().default(false),
|
|
2949
|
-
costSource: SessionCostSourceSchema.default("harness"),
|
|
2950
|
-
harnessCostUsd: exports_zod.number().nullable().optional(),
|
|
2951
|
-
cacheWrite5mTokens: exports_zod.number().int().nullable().optional(),
|
|
2952
|
-
cacheWrite1hTokens: exports_zod.number().int().nullable().optional(),
|
|
2953
|
-
modelBreakdown: exports_zod.array(SessionCostModelBreakdownSchema).nullable().optional(),
|
|
2954
|
-
createdAt: exports_zod.iso.datetime()
|
|
2955
|
-
}).openapi("SessionCost");
|
|
2956
|
-
EventCategorySchema = exports_zod.enum([
|
|
2957
|
-
"tool",
|
|
2958
|
-
"skill",
|
|
2959
|
-
"session",
|
|
2960
|
-
"api",
|
|
2961
|
-
"task",
|
|
2962
|
-
"workflow",
|
|
2963
|
-
"system"
|
|
2964
|
-
]);
|
|
2965
|
-
EventStatusSchema = exports_zod.enum(["ok", "error", "timeout", "skipped"]);
|
|
2966
|
-
EventSourceSchema = exports_zod.enum(["worker", "api", "hook", "scheduler", "cli"]);
|
|
2967
|
-
EventNameSchema = exports_zod.enum([
|
|
2968
|
-
"tool.start",
|
|
2969
|
-
"tool.end",
|
|
2970
|
-
"skill.invoke",
|
|
2971
|
-
"skill.complete",
|
|
2972
|
-
"session.start",
|
|
2973
|
-
"session.end",
|
|
2974
|
-
"session.resume",
|
|
2975
|
-
"session.cost",
|
|
2976
|
-
"api.request",
|
|
2977
|
-
"api.error",
|
|
2978
|
-
"task.poll",
|
|
2979
|
-
"task.assign",
|
|
2980
|
-
"task.timeout",
|
|
2981
|
-
"workflow.step.start",
|
|
2982
|
-
"workflow.step.end",
|
|
2983
|
-
"workflow.run.start",
|
|
2984
|
-
"workflow.run.end",
|
|
2985
|
-
"system.boot",
|
|
2986
|
-
"system.migration",
|
|
2987
|
-
"system.error",
|
|
2988
|
-
"system.profile_sync_rejected",
|
|
2989
|
-
"system.profile_sync_reconciled",
|
|
2990
|
-
"system.profile_sync_conflict",
|
|
2991
|
-
"script.global_upsert",
|
|
2992
|
-
"schedule.deleted"
|
|
2993
|
-
]);
|
|
2994
|
-
SwarmEventSchema = exports_zod.object({
|
|
2995
|
-
id: exports_zod.uuid(),
|
|
2996
|
-
category: EventCategorySchema,
|
|
2997
|
-
event: EventNameSchema,
|
|
2998
|
-
status: EventStatusSchema,
|
|
2999
|
-
source: EventSourceSchema,
|
|
3000
|
-
agentId: exports_zod.string().optional(),
|
|
3001
|
-
taskId: exports_zod.string().optional(),
|
|
3002
|
-
sessionId: exports_zod.string().optional(),
|
|
3003
|
-
parentEventId: exports_zod.string().optional(),
|
|
3004
|
-
numericValue: exports_zod.number().optional(),
|
|
3005
|
-
durationMs: exports_zod.number().int().optional(),
|
|
3006
|
-
data: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
3007
|
-
createdAt: exports_zod.iso.datetime()
|
|
3008
|
-
}).openapi("SwarmEvent");
|
|
3009
|
-
AutomationIntegrationIdSchema = exports_zod.enum([
|
|
3010
|
-
"slack",
|
|
3011
|
-
"github",
|
|
3012
|
-
"linear",
|
|
3013
|
-
"jira",
|
|
3014
|
-
"gsc",
|
|
3015
|
-
"agentmail",
|
|
3016
|
-
"agentfs"
|
|
3017
|
-
]);
|
|
3018
|
-
ScheduledTaskTargetTypeSchema = exports_zod.enum(["agent-task", "workflow", "script"]);
|
|
3019
|
-
ScheduledTaskSchema = exports_zod.object({
|
|
3020
|
-
id: exports_zod.uuid(),
|
|
3021
|
-
key: AssetKeySchema,
|
|
3022
|
-
name: exports_zod.string().min(1).max(100),
|
|
3023
|
-
description: exports_zod.string().optional(),
|
|
3024
|
-
cronExpression: exports_zod.string().optional(),
|
|
3025
|
-
intervalMs: exports_zod.number().int().positive().optional(),
|
|
3026
|
-
taskTemplate: exports_zod.string().optional(),
|
|
3027
|
-
taskType: exports_zod.string().max(50).optional(),
|
|
3028
|
-
tags: exports_zod.array(exports_zod.string()).default([]),
|
|
3029
|
-
priority: exports_zod.number().int().min(0).max(100).default(50),
|
|
3030
|
-
targetAgentId: exports_zod.string().optional(),
|
|
3031
|
-
enabled: exports_zod.boolean().default(true),
|
|
3032
|
-
lastRunAt: exports_zod.iso.datetime().optional(),
|
|
3033
|
-
nextRunAt: exports_zod.iso.datetime().optional(),
|
|
3034
|
-
createdByAgentId: exports_zod.string().optional(),
|
|
3035
|
-
parentTaskId: exports_zod.string().optional(),
|
|
3036
|
-
timezone: exports_zod.string().default("UTC"),
|
|
3037
|
-
consecutiveErrors: exports_zod.number().int().min(0).default(0),
|
|
3038
|
-
lastErrorAt: exports_zod.iso.datetime().optional(),
|
|
3039
|
-
lastErrorMessage: exports_zod.string().optional(),
|
|
3040
|
-
model: exports_zod.string().optional(),
|
|
3041
|
-
modelTier: ModelTierSchema.optional(),
|
|
3042
|
-
scheduleType: exports_zod.enum(["recurring", "one_time"]).default("recurring"),
|
|
3043
|
-
targetType: ScheduledTaskTargetTypeSchema.default("agent-task"),
|
|
3044
|
-
workflowId: exports_zod.uuid().optional(),
|
|
3045
|
-
scriptName: exports_zod.string().optional(),
|
|
3046
|
-
scriptArgs: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
3047
|
-
params: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
3048
|
-
requiredParams: exports_zod.array(exports_zod.string()).optional(),
|
|
3049
|
-
requires: exports_zod.array(AutomationIntegrationIdSchema).optional(),
|
|
3050
|
-
createdAt: exports_zod.iso.datetime(),
|
|
3051
|
-
lastUpdatedAt: exports_zod.iso.datetime(),
|
|
3052
|
-
createdBy: exports_zod.string().optional(),
|
|
3053
|
-
updatedBy: exports_zod.string().optional(),
|
|
3054
|
-
favorite: exports_zod.boolean().optional()
|
|
3055
|
-
}).refine((data) => {
|
|
3056
|
-
if (data.scheduleType === "one_time")
|
|
3057
|
-
return true;
|
|
3058
|
-
return data.cronExpression || data.intervalMs;
|
|
3059
|
-
}, {
|
|
3060
|
-
message: "Either cronExpression or intervalMs must be provided for recurring schedules"
|
|
3061
|
-
}).refine((data) => {
|
|
3062
|
-
switch (data.targetType) {
|
|
3063
|
-
case "agent-task":
|
|
3064
|
-
return !!data.taskTemplate;
|
|
3065
|
-
case "workflow":
|
|
3066
|
-
return !!data.workflowId;
|
|
3067
|
-
case "script":
|
|
3068
|
-
return !!data.scriptName;
|
|
3069
|
-
default:
|
|
3070
|
-
return true;
|
|
3071
|
-
}
|
|
3072
|
-
}, {
|
|
3073
|
-
message: "Target-type specific field is required (taskTemplate, workflowId, or scriptName)"
|
|
3074
|
-
});
|
|
3075
|
-
SwarmConfigScopeSchema = exports_zod.enum(["global", "agent", "repo"]);
|
|
3076
|
-
SwarmConfigSchema = exports_zod.object({
|
|
3077
|
-
id: exports_zod.string().uuid(),
|
|
3078
|
-
scope: SwarmConfigScopeSchema,
|
|
3079
|
-
scopeId: exports_zod.string().nullable(),
|
|
3080
|
-
key: exports_zod.string().min(1).max(255),
|
|
3081
|
-
value: exports_zod.string(),
|
|
3082
|
-
isSecret: exports_zod.boolean(),
|
|
3083
|
-
envPath: exports_zod.string().nullable(),
|
|
3084
|
-
description: exports_zod.string().nullable(),
|
|
3085
|
-
createdAt: exports_zod.string(),
|
|
3086
|
-
lastUpdatedAt: exports_zod.string(),
|
|
3087
|
-
encrypted: exports_zod.boolean()
|
|
3088
|
-
}).openapi("SwarmConfig");
|
|
3089
|
-
RepoGuidelinesSchema = exports_zod.object({
|
|
3090
|
-
prChecks: exports_zod.array(exports_zod.string()),
|
|
3091
|
-
mergeChecks: exports_zod.array(exports_zod.string()),
|
|
3092
|
-
allowMerge: exports_zod.boolean().optional().default(false),
|
|
3093
|
-
review: exports_zod.array(exports_zod.string())
|
|
3094
|
-
}).openapi("RepoGuidelines");
|
|
3095
|
-
RepoGuidelinesInputSchema = exports_zod.object({
|
|
3096
|
-
prChecks: exports_zod.array(exports_zod.string()).max(REPO_GUIDELINES_MAX_ENTRIES),
|
|
3097
|
-
mergeChecks: exports_zod.array(exports_zod.string()).max(REPO_GUIDELINES_MAX_ENTRIES),
|
|
3098
|
-
allowMerge: exports_zod.boolean().optional().default(false),
|
|
3099
|
-
review: exports_zod.array(exports_zod.string()).max(REPO_GUIDELINES_MAX_ENTRIES)
|
|
3100
|
-
}).openapi("RepoGuidelinesInput");
|
|
3101
|
-
RepoHooksSchema = exports_zod.object({
|
|
3102
|
-
enabled: exports_zod.boolean().default(false)
|
|
3103
|
-
}).openapi("RepoHooks");
|
|
3104
|
-
SwarmRepoSchema = exports_zod.object({
|
|
3105
|
-
id: exports_zod.string().uuid(),
|
|
3106
|
-
url: exports_zod.string().min(1),
|
|
3107
|
-
name: exports_zod.string().min(1).max(100),
|
|
3108
|
-
clonePath: exports_zod.string().min(1),
|
|
3109
|
-
defaultBranch: exports_zod.string().default("main"),
|
|
3110
|
-
autoClone: exports_zod.boolean().default(true),
|
|
3111
|
-
hooks: RepoHooksSchema.optional().default({ enabled: false }),
|
|
3112
|
-
guidelines: RepoGuidelinesSchema.nullable().optional(),
|
|
3113
|
-
createdAt: exports_zod.string(),
|
|
3114
|
-
lastUpdatedAt: exports_zod.string()
|
|
3115
|
-
}).openapi("SwarmRepo");
|
|
3116
|
-
AgentMemoryScopeSchema = exports_zod.enum(["agent", "swarm"]);
|
|
3117
|
-
AgentMemorySourceSchema = exports_zod.enum([
|
|
3118
|
-
"manual",
|
|
3119
|
-
"file_index",
|
|
3120
|
-
"session_summary",
|
|
3121
|
-
"task_completion"
|
|
3122
|
-
]);
|
|
3123
|
-
AgentMemorySchema = exports_zod.object({
|
|
3124
|
-
id: exports_zod.string().uuid(),
|
|
3125
|
-
agentId: exports_zod.string().nullable(),
|
|
3126
|
-
scope: AgentMemoryScopeSchema,
|
|
3127
|
-
key: exports_zod.string().nullable().optional(),
|
|
3128
|
-
name: exports_zod.string().min(1).max(500),
|
|
3129
|
-
content: exports_zod.string(),
|
|
3130
|
-
summary: exports_zod.string().nullable(),
|
|
3131
|
-
source: AgentMemorySourceSchema,
|
|
3132
|
-
sourceTaskId: exports_zod.string().uuid().nullable(),
|
|
3133
|
-
sourcePath: exports_zod.string().nullable(),
|
|
3134
|
-
chunkIndex: exports_zod.number().int().min(0).default(0),
|
|
3135
|
-
totalChunks: exports_zod.number().int().min(1).default(1),
|
|
3136
|
-
tags: exports_zod.array(exports_zod.string()),
|
|
3137
|
-
createdAt: exports_zod.string(),
|
|
3138
|
-
updatedAt: exports_zod.string().nullable().optional(),
|
|
3139
|
-
accessedAt: exports_zod.string(),
|
|
3140
|
-
expiresAt: exports_zod.string().nullable().optional(),
|
|
3141
|
-
accessCount: exports_zod.number().int().min(0).default(0).optional(),
|
|
3142
|
-
embeddingModel: exports_zod.string().nullable().optional(),
|
|
3143
|
-
contentHash: exports_zod.string().nullable().optional(),
|
|
3144
|
-
version: exports_zod.number().int().min(1).default(1).optional()
|
|
3145
|
-
}).openapi("AgentMemory");
|
|
3146
|
-
ActiveSessionSchema = exports_zod.object({
|
|
3147
|
-
id: exports_zod.uuid(),
|
|
3148
|
-
agentId: exports_zod.string(),
|
|
3149
|
-
taskId: exports_zod.string().nullable(),
|
|
3150
|
-
triggerType: exports_zod.string(),
|
|
3151
|
-
inboxMessageId: exports_zod.string().nullable(),
|
|
3152
|
-
taskDescription: exports_zod.string().nullable(),
|
|
3153
|
-
runnerSessionId: exports_zod.string().nullable(),
|
|
3154
|
-
providerSessionId: exports_zod.string().nullable(),
|
|
3155
|
-
runtimeInstanceId: exports_zod.string().nullable().optional(),
|
|
3156
|
-
startedAt: exports_zod.iso.datetime(),
|
|
3157
|
-
lastHeartbeatAt: exports_zod.iso.datetime()
|
|
3158
|
-
}).openapi("ActiveSession");
|
|
3159
|
-
RuntimeInstanceStatusSchema = exports_zod.enum(["active", "offline"]);
|
|
3160
|
-
RuntimeInstanceSchema = exports_zod.object({
|
|
3161
|
-
id: exports_zod.string(),
|
|
3162
|
-
agentId: exports_zod.string(),
|
|
3163
|
-
status: RuntimeInstanceStatusSchema,
|
|
3164
|
-
reportedSlots: exports_zod.number().int(),
|
|
3165
|
-
credentialReady: exports_zod.boolean().nullable().optional(),
|
|
3166
|
-
metadata: exports_zod.record(exports_zod.string(), exports_zod.unknown()).nullable(),
|
|
3167
|
-
lastSeenAt: exports_zod.iso.datetime(),
|
|
3168
|
-
createdAt: exports_zod.iso.datetime(),
|
|
3169
|
-
updatedAt: exports_zod.iso.datetime()
|
|
3170
|
-
}).openapi("RuntimeInstance");
|
|
3171
|
-
RetryPolicySchema = exports_zod.object({
|
|
3172
|
-
maxRetries: exports_zod.number().int().min(0).default(3),
|
|
3173
|
-
strategy: exports_zod.enum(["exponential", "static", "linear"]).default("exponential"),
|
|
3174
|
-
baseDelayMs: exports_zod.number().int().min(0).default(1000),
|
|
3175
|
-
maxDelayMs: exports_zod.number().int().min(0).default(60000)
|
|
3176
|
-
}).openapi("RetryPolicy");
|
|
3177
|
-
ExecutorMetaSchema = exports_zod.object({
|
|
3178
|
-
runId: exports_zod.string().uuid(),
|
|
3179
|
-
stepId: exports_zod.string().uuid(),
|
|
3180
|
-
nodeId: exports_zod.string(),
|
|
3181
|
-
workflowId: exports_zod.string().uuid(),
|
|
3182
|
-
dryRun: exports_zod.boolean().default(false),
|
|
3183
|
-
requestedByUserId: exports_zod.string().optional(),
|
|
3184
|
-
inputCtx: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional()
|
|
3185
|
-
}).openapi("ExecutorMeta");
|
|
3186
|
-
ValidationResultSchema = exports_zod.object({
|
|
3187
|
-
pass: exports_zod.boolean(),
|
|
3188
|
-
reasoning: exports_zod.string(),
|
|
3189
|
-
confidence: exports_zod.number().min(0).max(1)
|
|
3190
|
-
}).openapi("ValidationResult");
|
|
3191
|
-
StepValidationConfigSchema = exports_zod.object({
|
|
3192
|
-
executor: exports_zod.string().default("validate"),
|
|
3193
|
-
config: exports_zod.record(exports_zod.string(), exports_zod.unknown()),
|
|
3194
|
-
mustPass: exports_zod.boolean().default(false),
|
|
3195
|
-
retry: RetryPolicySchema.optional()
|
|
3196
|
-
}).openapi("StepValidationConfig");
|
|
3197
|
-
SwarmScriptNodeConfigSchema = exports_zod.object({
|
|
3198
|
-
scriptName: exports_zod.string().min(1),
|
|
3199
|
-
scope: exports_zod.enum(["global", "agent"]).optional(),
|
|
3200
|
-
pinHash: exports_zod.string().min(1).optional(),
|
|
3201
|
-
args: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
3202
|
-
fsMode: exports_zod.enum(["none", "workspace-rw"]).optional(),
|
|
3203
|
-
timeoutMs: exports_zod.number().int().min(1000).max(300000).optional()
|
|
3204
|
-
}).openapi("SwarmScriptNodeConfig");
|
|
3205
|
-
WorkflowNodeSchema = exports_zod.object({
|
|
3206
|
-
id: exports_zod.string().describe("Unique node identifier, used in 'next' and 'inputs' mappings"),
|
|
3207
|
-
type: exports_zod.string().describe("Executor type: 'agent-task', 'script', 'swarm-script', 'raw-llm', 'validate', 'property-match'"),
|
|
3208
|
-
label: exports_zod.string().optional().describe("Human-readable label for UI display"),
|
|
3209
|
-
config: exports_zod.record(exports_zod.string(), exports_zod.unknown()).describe("Executor-specific config. For agent-task: { template, outputSchema?, agentId?, routingReason?, routingNote?, tags?, priority?, dir?, vcsRepo?, model? }; configured agentId defaults routingReason to human_pinned. " + "For script: { runtime, script, args?, timeout? }. " + "For swarm-script: { scriptName, scope?, pinHash?, args?, fsMode?, timeoutMs? (1000-300000) }. " + "Agent-task templates and ordinary config values support {{interpolation}} from the node's inputs context, including trigger and declared upstream aliases. " + "SECURITY: executable source for script/swarm-script nodes does not interpolate trigger.* or upstream node outputs; only input/workflow/swarm/run values are allowed in inline script source, and named swarm-script source is not workflow-interpolated. " + "Pass dynamic values through config.args instead (inline script receives them as argv; swarm-script receives its args object). " + "NOTE: config.outputSchema on agent-task nodes validates the AGENT's raw JSON output, " + "while node-level outputSchema validates the EXECUTOR's return value ({taskId, taskOutput})."),
|
|
3210
|
-
next: exports_zod.union([exports_zod.string(), exports_zod.array(exports_zod.string()), exports_zod.record(exports_zod.string(), exports_zod.string())]).optional().describe("Next node(s): string for simple chaining, string[] for fan-out to parallel nodes, or record for port-based routing ({pass: 'a', fail: 'b'})"),
|
|
3211
|
-
validation: StepValidationConfigSchema.optional(),
|
|
3212
|
-
retry: RetryPolicySchema.optional(),
|
|
3213
|
-
inputs: exports_zod.record(exports_zod.string(), exports_zod.string()).optional().describe("REQUIRED for cross-node data access. Maps local names to context paths. " + "Without this, upstream step outputs are NOT available for interpolation; built-in trigger/input/workflow/swarm/run context remains available. " + 'Example: { "cityData": "generate-city" } → use {{cityData.taskOutput.field}} in config templates. ' + 'For trigger data: { "pr": "trigger.pullRequest" }. ' + "This mapping works in agent-task templates and ordinary config, but executable script/swarm-script source excludes trigger and upstream-output aliases. " + "Route those dynamic values through config.args (argv for inline scripts) instead."),
|
|
3214
|
-
inputSchema: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional().describe("JSON Schema to validate resolved inputs before execution"),
|
|
3215
|
-
outputSchema: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional().describe("JSON Schema to validate the executor's output (e.g. {taskId, taskOutput} for agent-task). " + "Different from config.outputSchema which validates the agent's raw output.")
|
|
3216
|
-
}).openapi("WorkflowNode");
|
|
3217
|
-
WorkflowEdgeSchema = exports_zod.object({
|
|
3218
|
-
id: exports_zod.string(),
|
|
3219
|
-
source: exports_zod.string(),
|
|
3220
|
-
sourcePort: exports_zod.string(),
|
|
3221
|
-
target: exports_zod.string()
|
|
3222
|
-
}).openapi("WorkflowEdge");
|
|
3223
|
-
WorkflowDefinitionSchema = exports_zod.object({
|
|
3224
|
-
nodes: exports_zod.array(WorkflowNodeSchema).min(1),
|
|
3225
|
-
onNodeFailure: exports_zod.enum(["fail", "continue"]).default("fail").describe("Behavior when a node's task fails or is cancelled. " + "'fail' (default): mark the entire run as failed. " + "'continue': treat the failed node as completed with error output and proceed — " + "downstream convergence nodes receive '[FAILED: reason]' and can handle partial results.")
|
|
3226
|
-
}).openapi("WorkflowDefinition");
|
|
3227
|
-
WorkflowNodePatchSchema = WorkflowNodeSchema.partial().omit({ id: true });
|
|
3228
|
-
WorkflowPatchSchema = exports_zod.object({
|
|
3229
|
-
update: exports_zod.array(exports_zod.object({
|
|
3230
|
-
nodeId: exports_zod.string().describe("ID of the node to update"),
|
|
3231
|
-
node: WorkflowNodePatchSchema.describe("Partial node data to merge")
|
|
3232
|
-
})).optional().describe("Nodes to update (partial merge)"),
|
|
3233
|
-
delete: exports_zod.array(exports_zod.string()).optional().describe("Node IDs to delete"),
|
|
3234
|
-
create: exports_zod.array(WorkflowNodeSchema).optional().describe("New nodes to add"),
|
|
3235
|
-
onNodeFailure: exports_zod.enum(["fail", "continue"]).optional().describe("Update the definition-level onNodeFailure behavior"),
|
|
3236
|
-
triggerSchema: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional().nullable().describe("Optional JSON-Schema describing the expected trigger payload shape. " + "Pass an object to set/replace; pass null to clear; omit to leave unchanged. " + "Validator subset: type, required, properties, enum, const, items. " + "Other JSON-Schema keywords are silently ignored."),
|
|
3237
|
-
params: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
3238
|
-
requiredParams: exports_zod.array(exports_zod.string()).optional(),
|
|
3239
|
-
requires: exports_zod.array(AutomationIntegrationIdSchema).optional()
|
|
3240
|
-
}).openapi("WorkflowPatch");
|
|
3241
|
-
WebhookVerificationSchema = exports_zod.discriminatedUnion("format", [
|
|
3242
|
-
exports_zod.object({
|
|
3243
|
-
format: exports_zod.literal("hmac-sha256"),
|
|
3244
|
-
header: exports_zod.string().default("X-Hub-Signature-256").describe("Header containing HMAC-SHA256 over the raw request body. Accepts sha256=<hex> or bare hex.")
|
|
3245
|
-
}),
|
|
3246
|
-
exports_zod.object({
|
|
3247
|
-
format: exports_zod.literal("timestamped-hmac-sha256"),
|
|
3248
|
-
header: exports_zod.string().min(1).describe("Header containing comma-separated timestamp/signature pairs such as t=<timestamp>,v1=<hex>."),
|
|
3249
|
-
timestampKey: exports_zod.string().default("t").describe("Timestamp field key in the signature header"),
|
|
3250
|
-
signatureKey: exports_zod.string().default("v1").describe("Signature field key in the signature header; multiple entries are allowed"),
|
|
3251
|
-
toleranceSeconds: exports_zod.number().int().positive().default(300).describe("Maximum allowed clock skew, in seconds, for replay protection")
|
|
3252
|
-
}),
|
|
3253
|
-
exports_zod.object({
|
|
3254
|
-
format: exports_zod.literal("token-equality"),
|
|
3255
|
-
header: exports_zod.string().min(1).describe("Header containing the shared token to compare")
|
|
3256
|
-
})
|
|
3257
|
-
]);
|
|
3258
|
-
TriggerConfigSchema = exports_zod.discriminatedUnion("type", [
|
|
3259
|
-
exports_zod.object({
|
|
3260
|
-
type: exports_zod.literal("webhook"),
|
|
3261
|
-
hmacSecret: exports_zod.string().optional(),
|
|
3262
|
-
hmacHeader: exports_zod.string().default("X-Hub-Signature-256").describe("Legacy HMAC header for webhook verification. Prefer verification.header for new workflows."),
|
|
3263
|
-
verification: WebhookVerificationSchema.optional().describe("Optional webhook verification format. Omit to keep legacy HMAC-SHA256 behavior with fallback header scanning.")
|
|
3264
|
-
}),
|
|
3265
|
-
exports_zod.object({
|
|
3266
|
-
type: exports_zod.literal("schedule"),
|
|
3267
|
-
scheduleId: exports_zod.string().uuid()
|
|
3268
|
-
}),
|
|
3269
|
-
exports_zod.object({
|
|
3270
|
-
type: exports_zod.literal("event"),
|
|
3271
|
-
eventName: exports_zod.literal("slack.message")
|
|
3272
|
-
})
|
|
3273
|
-
]).superRefine((trigger, ctx) => {
|
|
3274
|
-
if (trigger.type === "webhook" && trigger.verification && !trigger.hmacSecret) {
|
|
3275
|
-
ctx.addIssue({
|
|
3276
|
-
code: exports_zod.ZodIssueCode.custom,
|
|
3277
|
-
message: "hmacSecret is required when verification is configured",
|
|
3278
|
-
path: ["hmacSecret"]
|
|
3279
|
-
});
|
|
3280
|
-
}
|
|
3281
|
-
});
|
|
3282
|
-
CooldownConfigSchema = exports_zod.object({
|
|
3283
|
-
hours: exports_zod.number().min(0).optional(),
|
|
3284
|
-
minutes: exports_zod.number().min(0).optional(),
|
|
3285
|
-
seconds: exports_zod.number().min(0).optional()
|
|
3286
|
-
}).refine((v) => v.hours !== undefined || v.minutes !== undefined || v.seconds !== undefined, {
|
|
3287
|
-
message: "At least one of hours, minutes, or seconds is required"
|
|
3288
|
-
});
|
|
3289
|
-
InputValueSchema = exports_zod.union([
|
|
3290
|
-
exports_zod.string().regex(/^\$\{.+\}$/),
|
|
3291
|
-
exports_zod.string().regex(/^secret\..+$/),
|
|
3292
|
-
exports_zod.string()
|
|
3293
|
-
]);
|
|
3294
|
-
WorkflowTemplateSchema = exports_zod.object({
|
|
3295
|
-
id: exports_zod.string().uuid(),
|
|
3296
|
-
name: exports_zod.string(),
|
|
3297
|
-
description: exports_zod.string(),
|
|
3298
|
-
category: exports_zod.string(),
|
|
3299
|
-
variables: exports_zod.array(exports_zod.object({
|
|
3300
|
-
name: exports_zod.string(),
|
|
3301
|
-
description: exports_zod.string(),
|
|
3302
|
-
type: exports_zod.enum(["string", "number", "boolean"]),
|
|
3303
|
-
default: exports_zod.unknown().optional(),
|
|
3304
|
-
required: exports_zod.boolean().default(true)
|
|
3305
|
-
})),
|
|
3306
|
-
definition: WorkflowDefinitionSchema
|
|
3307
|
-
}).openapi("WorkflowTemplate");
|
|
3308
|
-
WorkflowSnapshotSchema = exports_zod.object({
|
|
3309
|
-
name: exports_zod.string(),
|
|
3310
|
-
description: exports_zod.string().optional(),
|
|
3311
|
-
definition: WorkflowDefinitionSchema,
|
|
3312
|
-
triggers: exports_zod.array(TriggerConfigSchema),
|
|
3313
|
-
cooldown: CooldownConfigSchema.optional(),
|
|
3314
|
-
input: exports_zod.record(exports_zod.string(), InputValueSchema).optional(),
|
|
3315
|
-
triggerSchema: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
3316
|
-
params: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
3317
|
-
requiredParams: exports_zod.array(exports_zod.string()).optional(),
|
|
3318
|
-
requires: exports_zod.array(AutomationIntegrationIdSchema).optional(),
|
|
3319
|
-
dir: exports_zod.string().min(1).startsWith("/").optional(),
|
|
3320
|
-
vcsRepo: exports_zod.string().min(1).optional(),
|
|
3321
|
-
enabled: exports_zod.boolean()
|
|
3322
|
-
}).openapi("WorkflowSnapshot");
|
|
3323
|
-
WorkflowSchema = exports_zod.object({
|
|
3324
|
-
id: exports_zod.string().uuid(),
|
|
3325
|
-
key: AssetKeySchema,
|
|
3326
|
-
name: exports_zod.string(),
|
|
3327
|
-
description: exports_zod.string().optional(),
|
|
3328
|
-
enabled: exports_zod.boolean(),
|
|
3329
|
-
definition: WorkflowDefinitionSchema,
|
|
3330
|
-
triggers: exports_zod.array(TriggerConfigSchema).default([]),
|
|
3331
|
-
cooldown: CooldownConfigSchema.optional(),
|
|
3332
|
-
input: exports_zod.record(exports_zod.string(), InputValueSchema).optional(),
|
|
3333
|
-
triggerSchema: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
3334
|
-
params: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
3335
|
-
requiredParams: exports_zod.array(exports_zod.string()).optional(),
|
|
3336
|
-
requires: exports_zod.array(AutomationIntegrationIdSchema).optional(),
|
|
3337
|
-
dir: exports_zod.string().min(1).startsWith("/").optional(),
|
|
3338
|
-
vcsRepo: exports_zod.string().min(1).optional(),
|
|
3339
|
-
createdByAgentId: exports_zod.string().optional(),
|
|
3340
|
-
createdAt: exports_zod.string(),
|
|
3341
|
-
lastUpdatedAt: exports_zod.string(),
|
|
3342
|
-
createdBy: exports_zod.string().optional(),
|
|
3343
|
-
updatedBy: exports_zod.string().optional(),
|
|
3344
|
-
favorite: exports_zod.boolean().optional()
|
|
3345
|
-
}).openapi("Workflow");
|
|
3346
|
-
WorkflowVersionSchema = exports_zod.object({
|
|
3347
|
-
id: exports_zod.string().uuid(),
|
|
3348
|
-
workflowId: exports_zod.string().uuid(),
|
|
3349
|
-
version: exports_zod.number().int().min(1),
|
|
3350
|
-
snapshot: WorkflowSnapshotSchema,
|
|
3351
|
-
changedByAgentId: exports_zod.string().optional(),
|
|
3352
|
-
createdAt: exports_zod.string()
|
|
3353
|
-
}).openapi("WorkflowVersion");
|
|
3354
|
-
PageContentTypeSchema = exports_zod.enum(["text/html", "application/json", "image/svg+xml"]);
|
|
3355
|
-
PageAuthModeSchema = exports_zod.enum(["public", "authed", "password"]);
|
|
3356
|
-
PageSnapshotSchema = exports_zod.object({
|
|
3357
|
-
title: exports_zod.string(),
|
|
3358
|
-
description: exports_zod.string().optional(),
|
|
3359
|
-
contentType: PageContentTypeSchema,
|
|
3360
|
-
authMode: PageAuthModeSchema,
|
|
3361
|
-
passwordHash: exports_zod.string().optional(),
|
|
3362
|
-
body: exports_zod.string(),
|
|
3363
|
-
needsCredentials: exports_zod.array(exports_zod.string()).optional()
|
|
3364
|
-
}).openapi("PageSnapshot");
|
|
3365
|
-
PageSchema = exports_zod.object({
|
|
3366
|
-
id: exports_zod.string(),
|
|
3367
|
-
key: AssetKeySchema,
|
|
3368
|
-
agentId: exports_zod.string(),
|
|
3369
|
-
slug: exports_zod.string(),
|
|
3370
|
-
title: exports_zod.string(),
|
|
3371
|
-
description: exports_zod.string().optional(),
|
|
3372
|
-
contentType: PageContentTypeSchema,
|
|
3373
|
-
authMode: PageAuthModeSchema,
|
|
3374
|
-
passwordHash: exports_zod.string().optional(),
|
|
3375
|
-
body: exports_zod.string(),
|
|
3376
|
-
needsCredentials: exports_zod.array(exports_zod.string()).optional(),
|
|
3377
|
-
viewCount: exports_zod.number().int().min(0).default(0),
|
|
3378
|
-
createdAt: exports_zod.string(),
|
|
3379
|
-
updatedAt: exports_zod.string(),
|
|
3380
|
-
favorite: exports_zod.boolean().optional()
|
|
3381
|
-
}).openapi("Page");
|
|
3382
|
-
PageVersionSchema = exports_zod.object({
|
|
3383
|
-
id: exports_zod.string(),
|
|
3384
|
-
pageId: exports_zod.string(),
|
|
3385
|
-
version: exports_zod.number().int().min(1),
|
|
3386
|
-
snapshot: PageSnapshotSchema,
|
|
3387
|
-
changedByAgentId: exports_zod.string().optional(),
|
|
3388
|
-
createdAt: exports_zod.string()
|
|
3389
|
-
}).openapi("PageVersion");
|
|
3390
|
-
MetricParamSchema = exports_zod.union([exports_zod.string(), exports_zod.number(), exports_zod.boolean(), exports_zod.null()]);
|
|
3391
|
-
MetricVariableTypeSchema = exports_zod.enum(["text", "number", "select"]);
|
|
3392
|
-
MetricFormatSchema = exports_zod.enum(["number", "integer", "currency", "percent", "duration"]);
|
|
3393
|
-
MetricVisualizationSchema = exports_zod.enum([
|
|
3394
|
-
"stat",
|
|
3395
|
-
"table",
|
|
3396
|
-
"bar",
|
|
3397
|
-
"line",
|
|
3398
|
-
"multi-bar",
|
|
3399
|
-
"multi-line"
|
|
3400
|
-
]);
|
|
3401
|
-
MetricQuerySchema = exports_zod.object({
|
|
3402
|
-
sql: exports_zod.string().min(1).max(1e4),
|
|
3403
|
-
params: exports_zod.array(MetricParamSchema).optional(),
|
|
3404
|
-
maxRows: exports_zod.number().int().min(1).max(500).optional()
|
|
3405
|
-
});
|
|
3406
|
-
MetricVariableSchema = exports_zod.object({
|
|
3407
|
-
key: exports_zod.string().min(1).regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
|
|
3408
|
-
label: exports_zod.string().min(1).optional(),
|
|
3409
|
-
type: MetricVariableTypeSchema.default("text"),
|
|
3410
|
-
defaultValue: MetricParamSchema.optional(),
|
|
3411
|
-
options: exports_zod.array(exports_zod.object({
|
|
3412
|
-
label: exports_zod.string().min(1),
|
|
3413
|
-
value: MetricParamSchema
|
|
3414
|
-
})).optional(),
|
|
3415
|
-
optionsQuery: exports_zod.object({
|
|
3416
|
-
sql: exports_zod.string().min(1).max(1e4),
|
|
3417
|
-
valueKey: exports_zod.string().min(1),
|
|
3418
|
-
labelKey: exports_zod.string().min(1).optional()
|
|
3419
|
-
}).optional()
|
|
3420
|
-
}).openapi("MetricVariable");
|
|
3421
|
-
MetricVizConfigSchema = exports_zod.object({
|
|
3422
|
-
type: MetricVisualizationSchema,
|
|
3423
|
-
x: exports_zod.string().optional(),
|
|
3424
|
-
y: exports_zod.string().optional(),
|
|
3425
|
-
series: exports_zod.array(exports_zod.string()).optional(),
|
|
3426
|
-
label: exports_zod.string().optional(),
|
|
3427
|
-
value: exports_zod.string().optional(),
|
|
3428
|
-
columns: exports_zod.array(exports_zod.object({
|
|
3429
|
-
key: exports_zod.string(),
|
|
3430
|
-
label: exports_zod.string().optional(),
|
|
3431
|
-
format: MetricFormatSchema.optional()
|
|
3432
|
-
})).optional(),
|
|
3433
|
-
format: MetricFormatSchema.optional()
|
|
3434
|
-
}).openapi("MetricVizConfig");
|
|
3435
|
-
MetricWidgetSchema = exports_zod.object({
|
|
3436
|
-
id: exports_zod.string().min(1),
|
|
3437
|
-
title: exports_zod.string().min(1),
|
|
3438
|
-
description: exports_zod.string().optional(),
|
|
3439
|
-
query: MetricQuerySchema,
|
|
3440
|
-
viz: MetricVizConfigSchema,
|
|
3441
|
-
colSpan: exports_zod.number().int().min(1).max(4).optional(),
|
|
3442
|
-
rowSpan: exports_zod.number().int().min(1).max(4).optional()
|
|
3443
|
-
}).openapi("MetricWidget");
|
|
3444
|
-
MetricDefinitionSchema = exports_zod.object({
|
|
3445
|
-
version: exports_zod.literal(1),
|
|
3446
|
-
widgets: exports_zod.array(MetricWidgetSchema).min(1).max(24),
|
|
3447
|
-
variables: exports_zod.array(MetricVariableSchema).max(12).optional(),
|
|
3448
|
-
layout: exports_zod.object({
|
|
3449
|
-
columns: exports_zod.number().int().min(1).max(4).optional()
|
|
3450
|
-
}).optional(),
|
|
3451
|
-
refreshSeconds: exports_zod.number().int().min(5).max(3600).optional()
|
|
3452
|
-
}).openapi("MetricDefinition");
|
|
3453
|
-
MetricSnapshotSchema = exports_zod.object({
|
|
3454
|
-
title: exports_zod.string(),
|
|
3455
|
-
description: exports_zod.string().optional(),
|
|
3456
|
-
definition: MetricDefinitionSchema
|
|
3457
|
-
}).openapi("MetricSnapshot");
|
|
3458
|
-
MetricSchema = exports_zod.object({
|
|
3459
|
-
id: exports_zod.string(),
|
|
3460
|
-
agentId: exports_zod.string(),
|
|
3461
|
-
slug: exports_zod.string(),
|
|
3462
|
-
title: exports_zod.string(),
|
|
3463
|
-
description: exports_zod.string().optional(),
|
|
3464
|
-
definition: MetricDefinitionSchema,
|
|
3465
|
-
createdAt: exports_zod.string(),
|
|
3466
|
-
updatedAt: exports_zod.string()
|
|
3467
|
-
}).openapi("Metric");
|
|
3468
|
-
MetricVersionSchema = exports_zod.object({
|
|
3469
|
-
id: exports_zod.string(),
|
|
3470
|
-
metricId: exports_zod.string(),
|
|
3471
|
-
version: exports_zod.number().int().min(1),
|
|
3472
|
-
snapshot: MetricSnapshotSchema,
|
|
3473
|
-
changedByAgentId: exports_zod.string().optional(),
|
|
3474
|
-
createdAt: exports_zod.string()
|
|
3475
|
-
}).openapi("MetricVersion");
|
|
3476
|
-
WorkflowRunStatusSchema = exports_zod.enum([
|
|
3477
|
-
"running",
|
|
3478
|
-
"waiting",
|
|
3479
|
-
"completed",
|
|
3480
|
-
"failed",
|
|
3481
|
-
"skipped",
|
|
3482
|
-
"cancelled"
|
|
3483
|
-
]);
|
|
3484
|
-
WorkflowRunSchema = exports_zod.object({
|
|
3485
|
-
id: exports_zod.string().uuid(),
|
|
3486
|
-
workflowId: exports_zod.string().uuid(),
|
|
3487
|
-
status: WorkflowRunStatusSchema,
|
|
3488
|
-
triggerData: exports_zod.unknown().optional(),
|
|
3489
|
-
context: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional(),
|
|
3490
|
-
error: exports_zod.string().optional(),
|
|
3491
|
-
createdBy: exports_zod.string().optional(),
|
|
3492
|
-
startedAt: exports_zod.string(),
|
|
3493
|
-
lastUpdatedAt: exports_zod.string(),
|
|
3494
|
-
finishedAt: exports_zod.string().optional()
|
|
3495
|
-
}).openapi("WorkflowRun");
|
|
3496
|
-
ScriptRunStatusSchema = exports_zod.enum([
|
|
3497
|
-
"running",
|
|
3498
|
-
"paused",
|
|
3499
|
-
"completed",
|
|
3500
|
-
"failed",
|
|
3501
|
-
"cancelled",
|
|
3502
|
-
"aborted_limit"
|
|
3503
|
-
]);
|
|
3504
|
-
TERMINAL_SCRIPT_RUN_STATUSES = [
|
|
3505
|
-
"completed",
|
|
3506
|
-
"failed",
|
|
3507
|
-
"cancelled",
|
|
3508
|
-
"aborted_limit"
|
|
3509
|
-
];
|
|
3510
|
-
ScriptRunKindSchema = exports_zod.enum(["workflow", "inline"]);
|
|
3511
|
-
ScriptRunSchema = exports_zod.object({
|
|
3512
|
-
id: exports_zod.string().uuid(),
|
|
3513
|
-
agentId: exports_zod.string(),
|
|
3514
|
-
scriptName: exports_zod.string().optional(),
|
|
3515
|
-
source: exports_zod.string(),
|
|
3516
|
-
args: exports_zod.unknown(),
|
|
3517
|
-
kind: ScriptRunKindSchema,
|
|
3518
|
-
status: ScriptRunStatusSchema,
|
|
3519
|
-
pid: exports_zod.number().int().optional(),
|
|
3520
|
-
startedAt: exports_zod.string(),
|
|
3521
|
-
finishedAt: exports_zod.string().optional(),
|
|
3522
|
-
output: exports_zod.unknown().optional(),
|
|
3523
|
-
error: exports_zod.string().optional(),
|
|
3524
|
-
lastHeartbeatAt: exports_zod.string().optional(),
|
|
3525
|
-
idempotencyKey: exports_zod.string().optional(),
|
|
3526
|
-
requestedByUserId: exports_zod.string().optional()
|
|
3527
|
-
}).openapi("ScriptRun");
|
|
3528
|
-
ScriptRunListItemSchema = ScriptRunSchema.omit({
|
|
3529
|
-
source: true,
|
|
3530
|
-
args: true,
|
|
3531
|
-
output: true
|
|
3532
|
-
});
|
|
3533
|
-
ScriptRunJournalEntrySchema = exports_zod.object({
|
|
3534
|
-
id: exports_zod.string().uuid(),
|
|
3535
|
-
runId: exports_zod.string().uuid(),
|
|
3536
|
-
stepKey: exports_zod.string(),
|
|
3537
|
-
stepType: exports_zod.string(),
|
|
3538
|
-
config: exports_zod.record(exports_zod.string(), exports_zod.unknown()),
|
|
3539
|
-
status: exports_zod.enum(["completed", "failed"]),
|
|
3540
|
-
result: exports_zod.unknown().optional(),
|
|
3541
|
-
error: exports_zod.string().optional(),
|
|
3542
|
-
startedAt: exports_zod.string(),
|
|
3543
|
-
completedAt: exports_zod.string().optional(),
|
|
3544
|
-
durationMs: exports_zod.number().optional()
|
|
3545
|
-
}).openapi("ScriptRunJournalEntry");
|
|
3546
|
-
WorkflowRunStepStatusSchema = exports_zod.enum([
|
|
3547
|
-
"pending",
|
|
3548
|
-
"running",
|
|
3549
|
-
"waiting",
|
|
3550
|
-
"completed",
|
|
3551
|
-
"failed",
|
|
3552
|
-
"skipped",
|
|
3553
|
-
"cancelled"
|
|
3554
|
-
]);
|
|
3555
|
-
WorkflowRunStepSchema = exports_zod.object({
|
|
3556
|
-
id: exports_zod.string().uuid(),
|
|
3557
|
-
runId: exports_zod.string().uuid(),
|
|
3558
|
-
nodeId: exports_zod.string(),
|
|
3559
|
-
nodeType: exports_zod.string(),
|
|
3560
|
-
status: WorkflowRunStepStatusSchema,
|
|
3561
|
-
input: exports_zod.unknown().optional(),
|
|
3562
|
-
output: exports_zod.unknown().optional(),
|
|
3563
|
-
error: exports_zod.string().optional(),
|
|
3564
|
-
startedAt: exports_zod.string(),
|
|
3565
|
-
finishedAt: exports_zod.string().optional(),
|
|
3566
|
-
retryCount: exports_zod.number().int().min(0).default(0),
|
|
3567
|
-
maxRetries: exports_zod.number().int().min(0).default(3),
|
|
3568
|
-
nextRetryAt: exports_zod.string().optional(),
|
|
3569
|
-
idempotencyKey: exports_zod.string().optional(),
|
|
3570
|
-
diagnostics: exports_zod.string().optional(),
|
|
3571
|
-
nextPort: exports_zod.string().optional()
|
|
3572
|
-
}).openapi("WorkflowRunStep");
|
|
3573
|
-
WaitModeSchema = exports_zod.enum(["time", "event"]);
|
|
3574
|
-
WaitStateStatusSchema = exports_zod.enum(["pending", "fired", "timeout"]);
|
|
3575
|
-
WaitStateRowSchema = exports_zod.object({
|
|
3576
|
-
id: exports_zod.string(),
|
|
3577
|
-
workflowRunId: exports_zod.string(),
|
|
3578
|
-
workflowRunStepId: exports_zod.string(),
|
|
3579
|
-
mode: WaitModeSchema,
|
|
3580
|
-
wakeUpAt: exports_zod.string().nullable(),
|
|
3581
|
-
eventName: exports_zod.string().nullable(),
|
|
3582
|
-
eventFilter: exports_zod.union([exports_zod.record(exports_zod.string(), exports_zod.unknown()), exports_zod.string()]).nullable(),
|
|
3583
|
-
expiresAt: exports_zod.string().nullable(),
|
|
3584
|
-
status: WaitStateStatusSchema,
|
|
3585
|
-
firedPayload: exports_zod.unknown().nullable(),
|
|
3586
|
-
resolvedAt: exports_zod.string().nullable(),
|
|
3587
|
-
createdAt: exports_zod.string(),
|
|
3588
|
-
updatedAt: exports_zod.string(),
|
|
3589
|
-
eventScope: exports_zod.enum(["run", "global"])
|
|
3590
|
-
}).openapi("WaitStateRow");
|
|
3591
|
-
PromptTemplateScopeSchema = exports_zod.enum(["global", "agent", "repo"]);
|
|
3592
|
-
PromptTemplateStateSchema = exports_zod.enum([
|
|
3593
|
-
"enabled",
|
|
3594
|
-
"default_prompt_fallback",
|
|
3595
|
-
"skip_event"
|
|
3596
|
-
]);
|
|
3597
|
-
PromptTemplateSchema = exports_zod.object({
|
|
3598
|
-
id: exports_zod.string(),
|
|
3599
|
-
eventType: exports_zod.string(),
|
|
3600
|
-
scope: PromptTemplateScopeSchema,
|
|
3601
|
-
scopeId: exports_zod.string().nullable(),
|
|
3602
|
-
state: PromptTemplateStateSchema,
|
|
3603
|
-
body: exports_zod.string(),
|
|
3604
|
-
isDefault: exports_zod.boolean(),
|
|
3605
|
-
version: exports_zod.number(),
|
|
3606
|
-
createdBy: exports_zod.string().nullable(),
|
|
3607
|
-
createdAt: exports_zod.string(),
|
|
3608
|
-
updatedAt: exports_zod.string()
|
|
3609
|
-
}).openapi("PromptTemplate");
|
|
3610
|
-
PromptTemplateHistorySchema = exports_zod.object({
|
|
3611
|
-
id: exports_zod.string(),
|
|
3612
|
-
templateId: exports_zod.string(),
|
|
3613
|
-
version: exports_zod.number(),
|
|
3614
|
-
body: exports_zod.string(),
|
|
3615
|
-
state: exports_zod.string(),
|
|
3616
|
-
changedBy: exports_zod.string().nullable(),
|
|
3617
|
-
changedAt: exports_zod.string(),
|
|
3618
|
-
changeReason: exports_zod.string().nullable()
|
|
3619
|
-
}).openapi("PromptTemplateHistory");
|
|
3620
|
-
ScriptScopeSchema = exports_zod.enum(["global", "agent"]);
|
|
3621
|
-
ScriptFsModeSchema = exports_zod.enum(["none", "workspace-rw"]);
|
|
3622
|
-
ScriptRecordSchema = exports_zod.object({
|
|
3623
|
-
id: exports_zod.string(),
|
|
3624
|
-
name: exports_zod.string(),
|
|
3625
|
-
scope: ScriptScopeSchema,
|
|
3626
|
-
scopeId: exports_zod.string().nullable(),
|
|
3627
|
-
source: exports_zod.string(),
|
|
3628
|
-
description: exports_zod.string(),
|
|
3629
|
-
intent: exports_zod.string(),
|
|
3630
|
-
signatureJson: exports_zod.string(),
|
|
3631
|
-
argsJsonSchema: exports_zod.string().nullable(),
|
|
3632
|
-
contentHash: exports_zod.string(),
|
|
3633
|
-
version: exports_zod.number(),
|
|
3634
|
-
isScratch: exports_zod.boolean(),
|
|
3635
|
-
typeChecked: exports_zod.boolean(),
|
|
3636
|
-
fsMode: ScriptFsModeSchema,
|
|
3637
|
-
createdByAgentId: exports_zod.string().nullable(),
|
|
3638
|
-
createdAt: exports_zod.string(),
|
|
3639
|
-
updatedAt: exports_zod.string()
|
|
3640
|
-
}).openapi("ScriptRecord");
|
|
3641
|
-
ScriptVersionRecordSchema = exports_zod.object({
|
|
3642
|
-
id: exports_zod.string(),
|
|
3643
|
-
scriptId: exports_zod.string(),
|
|
3644
|
-
version: exports_zod.number(),
|
|
3645
|
-
source: exports_zod.string(),
|
|
3646
|
-
description: exports_zod.string(),
|
|
3647
|
-
intent: exports_zod.string(),
|
|
3648
|
-
signatureJson: exports_zod.string(),
|
|
3649
|
-
contentHash: exports_zod.string(),
|
|
3650
|
-
changedByAgentId: exports_zod.string().nullable(),
|
|
3651
|
-
changedAt: exports_zod.string(),
|
|
3652
|
-
changeReason: exports_zod.string().nullable()
|
|
3653
|
-
}).openapi("ScriptVersionRecord");
|
|
3654
|
-
ExtensionNameSchema = exports_zod.string().min(1).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "must be a lowercase slug");
|
|
3655
|
-
SemverSchema = exports_zod.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/, "must be a semantic version");
|
|
3656
|
-
ExtensionManifestSchema = exports_zod.object({
|
|
3657
|
-
name: ExtensionNameSchema,
|
|
3658
|
-
description: exports_zod.string(),
|
|
3659
|
-
version: SemverSchema,
|
|
3660
|
-
runtime: exports_zod.enum(["api", "worker"]),
|
|
3661
|
-
assets: exports_zod.object({
|
|
3662
|
-
hooks: exports_zod.string().min(1).refine(isSafeBundlePath, "Must be a relative POSIX file path without empty, dot, or parent segments, at most 256 characters"),
|
|
3663
|
-
skills: exports_zod.array(exports_zod.string()).optional(),
|
|
3664
|
-
workflows: exports_zod.array(exports_zod.string()).optional(),
|
|
3665
|
-
schedules: exports_zod.array(exports_zod.string()).optional()
|
|
3666
|
-
}).strict(),
|
|
3667
|
-
homepage: exports_zod.string().url().optional(),
|
|
3668
|
-
author: exports_zod.string().min(1).optional()
|
|
3669
|
-
}).strict().openapi("ExtensionManifest");
|
|
3670
|
-
ExtensionStatusSchema = exports_zod.enum(["disabled", "enabled", "error", "auto-disabled"]);
|
|
3671
|
-
ExtensionSchema = exports_zod.object({
|
|
3672
|
-
id: exports_zod.string(),
|
|
3673
|
-
name: ExtensionNameSchema,
|
|
3674
|
-
description: exports_zod.string(),
|
|
3675
|
-
runtime: exports_zod.enum(["api", "worker"]),
|
|
3676
|
-
manifestJson: exports_zod.string(),
|
|
3677
|
-
contentHash: exports_zod.string(),
|
|
3678
|
-
version: exports_zod.number().int().min(1),
|
|
3679
|
-
activeVersion: exports_zod.number().int().min(1),
|
|
3680
|
-
enabled: exports_zod.boolean(),
|
|
3681
|
-
priority: exports_zod.number().int(),
|
|
3682
|
-
configJson: exports_zod.string(),
|
|
3683
|
-
status: ExtensionStatusSchema,
|
|
3684
|
-
consecutiveFailures: exports_zod.number().int().min(0),
|
|
3685
|
-
lastError: exports_zod.string().nullable(),
|
|
3686
|
-
agentId: exports_zod.string().nullable(),
|
|
3687
|
-
createdByAgentId: exports_zod.string().nullable(),
|
|
3688
|
-
createdAt: exports_zod.string(),
|
|
3689
|
-
updatedAt: exports_zod.string()
|
|
3690
|
-
}).openapi("Extension");
|
|
3691
|
-
ExtensionFileSchema = exports_zod.object({
|
|
3692
|
-
id: exports_zod.string(),
|
|
3693
|
-
extensionId: exports_zod.string(),
|
|
3694
|
-
path: exports_zod.string(),
|
|
3695
|
-
content: exports_zod.string(),
|
|
3696
|
-
contentHash: exports_zod.string()
|
|
3697
|
-
}).openapi("ExtensionFile");
|
|
3698
|
-
ExtensionVersionSchema = exports_zod.object({
|
|
3699
|
-
id: exports_zod.string(),
|
|
3700
|
-
extensionId: exports_zod.string(),
|
|
3701
|
-
version: exports_zod.number().int().min(1),
|
|
3702
|
-
manifestJson: exports_zod.string(),
|
|
3703
|
-
filesJson: exports_zod.string(),
|
|
3704
|
-
contentHash: exports_zod.string(),
|
|
3705
|
-
changedByAgentId: exports_zod.string().nullable(),
|
|
3706
|
-
changedAt: exports_zod.string(),
|
|
3707
|
-
changeReason: exports_zod.string().nullable()
|
|
3708
|
-
}).openapi("ExtensionVersion");
|
|
3709
|
-
ExtensionRunSchema = exports_zod.object({
|
|
3710
|
-
id: exports_zod.string(),
|
|
3711
|
-
extensionId: exports_zod.string(),
|
|
3712
|
-
version: exports_zod.number().int().min(1),
|
|
3713
|
-
event: exports_zod.string(),
|
|
3714
|
-
action: exports_zod.enum(["continue", "modify", "block", "error", "timeout", "load-error"]),
|
|
3715
|
-
durationMs: exports_zod.number().int().nullable(),
|
|
3716
|
-
message: exports_zod.string().nullable(),
|
|
3717
|
-
agentId: exports_zod.string().nullable(),
|
|
3718
|
-
subject: exports_zod.string().nullable(),
|
|
3719
|
-
createdAt: exports_zod.string()
|
|
3720
|
-
}).openapi("ExtensionRun");
|
|
3721
|
-
ExtensionInstallBodySchema = exports_zod.object({
|
|
3722
|
-
manifest: ExtensionManifestSchema,
|
|
3723
|
-
files: exports_zod.record(exports_zod.string(), exports_zod.string()),
|
|
3724
|
-
priority: exports_zod.number().int().optional(),
|
|
3725
|
-
config: exports_zod.record(exports_zod.string(), exports_zod.unknown()).optional()
|
|
3726
|
-
}).strict().openapi("ExtensionInstallBody");
|
|
3727
|
-
ScriptApiAuthModeSchema = exports_zod.enum(["none", "bearer"]);
|
|
3728
|
-
ScriptApiRecordSchema = exports_zod.object({
|
|
3729
|
-
id: exports_zod.string(),
|
|
3730
|
-
scriptId: exports_zod.string(),
|
|
3731
|
-
agentId: exports_zod.string(),
|
|
3732
|
-
authMode: ScriptApiAuthModeSchema,
|
|
3733
|
-
enabled: exports_zod.boolean(),
|
|
3734
|
-
label: exports_zod.string().nullable(),
|
|
3735
|
-
callCount: exports_zod.number(),
|
|
3736
|
-
lastUsedAt: exports_zod.string().nullable(),
|
|
3737
|
-
createdAt: exports_zod.string()
|
|
3738
|
-
}).openapi("ScriptApiRecord");
|
|
3739
|
-
SkillTypeSchema = exports_zod.enum(["remote", "personal"]);
|
|
3740
|
-
SkillScopeSchema = exports_zod.enum(["global", "swarm", "agent"]);
|
|
3741
|
-
SkillSchema = exports_zod.object({
|
|
3742
|
-
id: exports_zod.string(),
|
|
3743
|
-
name: exports_zod.string(),
|
|
3744
|
-
description: exports_zod.string(),
|
|
3745
|
-
content: exports_zod.string(),
|
|
3746
|
-
type: SkillTypeSchema,
|
|
3747
|
-
scope: SkillScopeSchema,
|
|
3748
|
-
ownerAgentId: exports_zod.string().nullable(),
|
|
3749
|
-
sourceUrl: exports_zod.string().nullable(),
|
|
3750
|
-
sourceRepo: exports_zod.string().nullable(),
|
|
3751
|
-
sourcePath: exports_zod.string().nullable(),
|
|
3752
|
-
sourceBranch: exports_zod.string(),
|
|
3753
|
-
sourceHash: exports_zod.string().nullable(),
|
|
3754
|
-
isComplex: exports_zod.boolean(),
|
|
3755
|
-
allowedTools: exports_zod.string().nullable(),
|
|
3756
|
-
model: exports_zod.string().nullable(),
|
|
3757
|
-
effort: exports_zod.string().nullable(),
|
|
3758
|
-
context: exports_zod.string().nullable(),
|
|
3759
|
-
agent: exports_zod.string().nullable(),
|
|
3760
|
-
disableModelInvocation: exports_zod.boolean(),
|
|
3761
|
-
userInvocable: exports_zod.boolean(),
|
|
3762
|
-
version: exports_zod.number(),
|
|
3763
|
-
isEnabled: exports_zod.boolean(),
|
|
3764
|
-
systemDefault: exports_zod.boolean(),
|
|
3765
|
-
createdAt: exports_zod.string(),
|
|
3766
|
-
lastUpdatedAt: exports_zod.string(),
|
|
3767
|
-
lastFetchedAt: exports_zod.string().nullable()
|
|
3768
|
-
}).openapi("Skill");
|
|
3769
|
-
AgentSkillSchema = exports_zod.object({
|
|
3770
|
-
id: exports_zod.string(),
|
|
3771
|
-
agentId: exports_zod.string(),
|
|
3772
|
-
skillId: exports_zod.string(),
|
|
3773
|
-
isActive: exports_zod.boolean(),
|
|
3774
|
-
installedAt: exports_zod.string()
|
|
3775
|
-
}).openapi("AgentSkill");
|
|
3776
|
-
SkillWithInstallInfoSchema = SkillSchema.extend({
|
|
3777
|
-
isActive: exports_zod.boolean(),
|
|
3778
|
-
installedAt: exports_zod.string()
|
|
3779
|
-
});
|
|
3780
|
-
SkillFileSchema = exports_zod.object({
|
|
3781
|
-
id: exports_zod.string(),
|
|
3782
|
-
skillId: exports_zod.string(),
|
|
3783
|
-
path: exports_zod.string(),
|
|
3784
|
-
content: exports_zod.string(),
|
|
3785
|
-
mimeType: exports_zod.string(),
|
|
3786
|
-
isBinary: exports_zod.boolean(),
|
|
3787
|
-
size: exports_zod.number().nullable(),
|
|
3788
|
-
createdAt: exports_zod.string(),
|
|
3789
|
-
lastUpdatedAt: exports_zod.string()
|
|
3790
|
-
}).openapi("SkillFile");
|
|
3791
|
-
McpServerTransportSchema = exports_zod.enum(["stdio", "http", "sse"]);
|
|
3792
|
-
McpServerScopeSchema = exports_zod.enum(["global", "swarm", "agent"]);
|
|
3793
|
-
McpAuthMethodSchema = exports_zod.enum(["static", "oauth", "auto"]);
|
|
3794
|
-
McpServerSchema = exports_zod.object({
|
|
3795
|
-
id: exports_zod.string(),
|
|
3796
|
-
name: exports_zod.string(),
|
|
3797
|
-
description: exports_zod.string().nullable(),
|
|
3798
|
-
scope: McpServerScopeSchema,
|
|
3799
|
-
ownerAgentId: exports_zod.string().nullable(),
|
|
3800
|
-
transport: McpServerTransportSchema,
|
|
3801
|
-
command: exports_zod.string().nullable(),
|
|
3802
|
-
args: exports_zod.string().nullable(),
|
|
3803
|
-
url: exports_zod.string().nullable(),
|
|
3804
|
-
headers: exports_zod.string().nullable(),
|
|
3805
|
-
envConfigKeys: exports_zod.string().nullable(),
|
|
3806
|
-
headerConfigKeys: exports_zod.string().nullable(),
|
|
3807
|
-
extraAuthorizeParams: exports_zod.string().nullable(),
|
|
3808
|
-
authMethod: McpAuthMethodSchema.default("static"),
|
|
3809
|
-
isEnabled: exports_zod.boolean(),
|
|
3810
|
-
version: exports_zod.number(),
|
|
3811
|
-
createdAt: exports_zod.string(),
|
|
3812
|
-
lastUpdatedAt: exports_zod.string()
|
|
3813
|
-
}).openapi("McpServer");
|
|
3814
|
-
AgentMcpServerSchema = exports_zod.object({
|
|
3815
|
-
id: exports_zod.string(),
|
|
3816
|
-
agentId: exports_zod.string(),
|
|
3817
|
-
mcpServerId: exports_zod.string(),
|
|
3818
|
-
isActive: exports_zod.boolean(),
|
|
3819
|
-
installedAt: exports_zod.string()
|
|
3820
|
-
}).openapi("AgentMcpServer");
|
|
3821
|
-
McpServerWithInstallInfoSchema = McpServerSchema.extend({
|
|
3822
|
-
isActive: exports_zod.boolean(),
|
|
3823
|
-
installedAt: exports_zod.string()
|
|
3824
|
-
});
|
|
3825
|
-
ContextSnapshotEventTypeSchema = exports_zod.enum(["progress", "compaction", "completion"]);
|
|
3826
|
-
ContextFormulaSchema = exports_zod.enum([
|
|
3827
|
-
"input-cache-output",
|
|
3828
|
-
"input-cache-no-output",
|
|
3829
|
-
"input-output-no-cache",
|
|
3830
|
-
"peak-proxy",
|
|
3831
|
-
"pi-delegated",
|
|
3832
|
-
"harness-reported",
|
|
3833
|
-
"unknown"
|
|
3834
|
-
]);
|
|
3835
|
-
ContextSnapshotSchema = exports_zod.object({
|
|
3836
|
-
id: exports_zod.uuid(),
|
|
3837
|
-
taskId: exports_zod.uuid(),
|
|
3838
|
-
agentId: exports_zod.string(),
|
|
3839
|
-
sessionId: exports_zod.string(),
|
|
3840
|
-
contextUsedTokens: exports_zod.number().int().min(0).optional(),
|
|
3841
|
-
contextTotalTokens: exports_zod.number().int().min(0).optional(),
|
|
3842
|
-
contextPercent: exports_zod.number().min(0).max(100).optional(),
|
|
3843
|
-
eventType: ContextSnapshotEventTypeSchema,
|
|
3844
|
-
compactTrigger: exports_zod.enum(["auto", "manual", "auto-inferred"]).optional(),
|
|
3845
|
-
preCompactTokens: exports_zod.number().int().min(0).optional(),
|
|
3846
|
-
cumulativeInputTokens: exports_zod.number().int().min(0).default(0),
|
|
3847
|
-
cumulativeOutputTokens: exports_zod.number().int().min(0).default(0),
|
|
3848
|
-
contextFormula: ContextFormulaSchema.optional(),
|
|
3849
|
-
createdAt: exports_zod.iso.datetime()
|
|
3850
|
-
}).openapi("ContextSnapshot");
|
|
3851
|
-
BudgetScopeSchema = exports_zod.enum(["global", "agent", "user"]);
|
|
3852
|
-
BudgetSchema = exports_zod.object({
|
|
3853
|
-
scope: BudgetScopeSchema,
|
|
3854
|
-
scopeId: exports_zod.string(),
|
|
3855
|
-
dailyBudgetUsd: exports_zod.number().nonnegative(),
|
|
3856
|
-
createdAt: exports_zod.number(),
|
|
3857
|
-
lastUpdatedAt: exports_zod.number()
|
|
3858
|
-
}).openapi("Budget");
|
|
3859
|
-
PricingProviderSchema = exports_zod.enum([
|
|
3860
|
-
"claude",
|
|
3861
|
-
"claude-managed",
|
|
3862
|
-
"codex",
|
|
3863
|
-
"pi",
|
|
3864
|
-
"opencode",
|
|
3865
|
-
"devin",
|
|
3866
|
-
"gemini",
|
|
3867
|
-
"acp"
|
|
3868
|
-
]);
|
|
3869
|
-
PricingTokenClassSchema = exports_zod.enum([
|
|
3870
|
-
"input",
|
|
3871
|
-
"cached_input",
|
|
3872
|
-
"output",
|
|
3873
|
-
"cache_write",
|
|
3874
|
-
"cache_write_1h",
|
|
3875
|
-
"web_search",
|
|
3876
|
-
"runtime_hour",
|
|
3877
|
-
"acu"
|
|
3878
|
-
]);
|
|
3879
|
-
PricingRowSchema = exports_zod.object({
|
|
3880
|
-
provider: PricingProviderSchema,
|
|
3881
|
-
model: exports_zod.string(),
|
|
3882
|
-
tokenClass: PricingTokenClassSchema,
|
|
3883
|
-
effectiveFrom: exports_zod.number().nonnegative(),
|
|
3884
|
-
pricePerMillionUsd: exports_zod.number().nonnegative(),
|
|
3885
|
-
createdAt: exports_zod.number(),
|
|
3886
|
-
lastUpdatedAt: exports_zod.number()
|
|
3887
|
-
}).openapi("PricingRow");
|
|
3888
|
-
BudgetRefusalCauseSchema = exports_zod.enum(["agent", "global", "user"]);
|
|
3889
|
-
BudgetRefusalNotificationSchema = exports_zod.object({
|
|
3890
|
-
taskId: exports_zod.string(),
|
|
3891
|
-
date: exports_zod.string(),
|
|
3892
|
-
agentId: exports_zod.string(),
|
|
3893
|
-
cause: BudgetRefusalCauseSchema,
|
|
3894
|
-
agentSpendUsd: exports_zod.number().nullable().optional(),
|
|
3895
|
-
agentBudgetUsd: exports_zod.number().nullable().optional(),
|
|
3896
|
-
globalSpendUsd: exports_zod.number().nullable().optional(),
|
|
3897
|
-
globalBudgetUsd: exports_zod.number().nullable().optional(),
|
|
3898
|
-
userSpendUsd: exports_zod.number().nullable().optional(),
|
|
3899
|
-
userBudgetUsd: exports_zod.number().nullable().optional(),
|
|
3900
|
-
followUpTaskId: exports_zod.string().nullable().optional(),
|
|
3901
|
-
createdAt: exports_zod.number()
|
|
3902
|
-
}).openapi("BudgetRefusalNotification");
|
|
3903
|
-
BudgetRefusedTriggerSchema = exports_zod.object({
|
|
3904
|
-
type: exports_zod.literal("budget_refused"),
|
|
3905
|
-
cause: BudgetRefusalCauseSchema,
|
|
3906
|
-
agentSpend: exports_zod.number().optional(),
|
|
3907
|
-
agentBudget: exports_zod.number().optional(),
|
|
3908
|
-
globalSpend: exports_zod.number().optional(),
|
|
3909
|
-
globalBudget: exports_zod.number().optional(),
|
|
3910
|
-
userSpend: exports_zod.number().optional(),
|
|
3911
|
-
userBudget: exports_zod.number().optional(),
|
|
3912
|
-
resetAt: exports_zod.string()
|
|
3913
|
-
}).openapi("BudgetRefusedTrigger");
|
|
3914
|
-
KvValueTypeSchema = exports_zod.enum(["json", "string", "integer"]);
|
|
3915
|
-
KV_NAME_REGEX = /^[a-zA-Z0-9._:/%-]{1,512}$/;
|
|
3916
|
-
KvNamespaceSchema = exports_zod.string().min(1).max(512).regex(KV_NAME_REGEX, "namespace must match [a-zA-Z0-9._:/%-]{1,512}");
|
|
3917
|
-
KvKeySchema = exports_zod.string().min(1).max(512).regex(KV_NAME_REGEX, "key must match [a-zA-Z0-9._:/%-]{1,512}");
|
|
3918
|
-
KvEntrySchema = exports_zod.object({
|
|
3919
|
-
namespace: exports_zod.string(),
|
|
3920
|
-
key: exports_zod.string(),
|
|
3921
|
-
value: exports_zod.unknown(),
|
|
3922
|
-
valueType: KvValueTypeSchema,
|
|
3923
|
-
expiresAt: exports_zod.number().int().nullable(),
|
|
3924
|
-
createdAt: exports_zod.number().int(),
|
|
3925
|
-
updatedAt: exports_zod.number().int()
|
|
3926
|
-
}).openapi("KvEntry");
|
|
3927
|
-
});
|
|
3928
|
-
|
|
3929
635
|
// src/utils/github-pull-request.ts
|
|
3930
636
|
function parseGitHubPullRequestToken(token) {
|
|
3931
637
|
const candidate = token.replace(TRAILING_PROSE_PUNCTUATION_RE, "");
|
|
@@ -7782,6 +4488,7 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
7782
4488
|
"DB_QUERY_BOUNDED_ENABLED",
|
|
7783
4489
|
"DB_RETENTION_DRY_RUN"
|
|
7784
4490
|
]),
|
|
4491
|
+
...enumValidator("SLACK_MODE", ["socket", "http"]),
|
|
7785
4492
|
...enumValidator("SLACK_THREAD_STEERING", ["off", "lead", "all"]),
|
|
7786
4493
|
...enumValidator("SLACK_THREAD_STEERING_MODE", ["steer", "queue"]),
|
|
7787
4494
|
...shortcodeValidators([
|
|
@@ -15574,4 +12281,4 @@ var init_db = __esm(() => {
|
|
|
15574
12281
|
};
|
|
15575
12282
|
});
|
|
15576
12283
|
|
|
15577
|
-
export { normalizeAssetKey, defaultAssetKey, parseAssetKey, canWriteAssetKey, init_key, slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, telemetry, emitIntegrationConnected, init_telemetry, isSafeBundlePath, init_bundle_path, $OpenAPIRegistry, $OpenApiGeneratorV31, init_dist, init_zod_openapi, AssetKeySchema, AssetEntityTypeSchema, AssetKeyMappingSchema, AssetSummarySchema, ModelTierSchema, ReasoningEffortSchema, splitLegacyModelAlias, resolveTaskModelSelection, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, RoutingReasonSchema, ProviderNameSchema, SteerModeSchema, SteeringSourceSchema, SteeringMessageSchema, SteerOutcomeSchema, OnUnsupportedSchema, SteerResultSchema, FollowUpConfigSchema, AgentTaskSchema, CreateTaskOptionsSchema, AttachmentInputSchema, TaskAttachmentSchema, UserSchema, UserCommsPrefsSchema, InboxItemTypeSchema, InboxItemStatusSchema, InboxItemStateSchema, FavoriteItemTypeSchema, UserFavoriteSchema, TaskTemplateKindSchema, TaskTemplateSchema, AgentStatusSchema, AgentAvatarSchema, AgentSchema, AgentLatestModelSchema, AgentAcpStatusSchema, AgentCredStatusSchema, AgentWithTasksSchema, VersionableFieldSchema, ChannelTypeSchema, ServiceStatusSchema, ServiceSchema, ResumeReasonSchema, AgentLogSchema, SessionLogSchema, SessionCostModelBreakdownSchema, SessionCostSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmEventSchema, AutomationIntegrationIdSchema, ScheduledTaskTargetTypeSchema, ScheduledTaskSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesInputSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, ActiveSessionSchema, RuntimeInstanceSchema, WorkflowEdgeSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, WorkflowSchema, WorkflowVersionSchema, PageContentTypeSchema, PageAuthModeSchema, PageSchema, PageVersionSchema, MetricWidgetSchema, MetricDefinitionSchema, MetricSchema, MetricVersionSchema, WorkflowRunStatusSchema, WorkflowRunSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, ScriptRunSchema, ScriptRunListItemSchema, ScriptRunJournalEntrySchema, WorkflowRunStepSchema, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptRecordSchema, ScriptVersionRecordSchema, ExtensionManifestSchema, ExtensionSchema, ExtensionVersionSchema, ExtensionRunSchema, ExtensionInstallBodySchema, ScriptApiAuthModeSchema, ScriptApiRecordSchema, SkillSchema, AgentSkillSchema, SkillWithInstallInfoSchema, SkillFileSchema, McpAuthMethodSchema, McpServerSchema, AgentMcpServerSchema, McpServerWithInstallInfoSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, ContextSnapshotSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, BudgetRefusedTriggerSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, KvEntrySchema, init_types, HeartbeatExpiryError, init_heartbeat_expiry, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, init_request_auth_context, auditAssetKeys, init_asset_key_audit, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDate, normalizeDateRequired, init_date_utils, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, isInTransaction, init_db_client, getPromptTemplateDefaultDrift, init_default_drift, init_templates2 as init_templates, isSqliteVecAvailable, resolveSqliteVecExtensionPath, __resetSqliteVecExtensionPathCacheForTests, initDb, getDb, closeDb, getDbClient, updateAgentCredentialState, updateAgentCredentialMissing, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, getTaskById, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getPendingSlackRelayTasks, markSlackRelayAttempted, markSlackRelayDelivered, markFinalizedSlackRelaysDelivered, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getSlackTasksMissingTree, getInProgressTasksByContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getLatestScriptRunStepTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, onTaskStarted, init_task_lifecycle_events, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, updateTaskClaudeSessionId, updateTaskTitle, completeTask, failTask, overwriteTerminalTaskResultText, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled, getTaskSteeringFields, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, init_reaction_shortcode, parseTaskToolManifest, selectTaskTools, init_task_tool_manifest, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateConfigValue, init_swarm_config_guard, getSlackRenderV2ActivatedAt, ensureSlackRenderV2Activation, getSlackDelegationActivatedAt, ensureSlackDelegationActivation, isPendingSlackMessage, recordSlackMessage, reserveSlackMessage, bindSlackMessageTimestamp, updateSlackMessageRecord, markSlackTreeRendered, deleteSlackMessageRecord, getSlackTreeMessage, getSlackTreeMessageByThread, getSlackOutcomeMessage, getSlackTreeMessages, getSlackMessageByChannelTs, getSlackTasksInThread, markTaskSlackReplySent, setSlackMessageTracking, updateTaskVcs, insertTaskAttachment, recordTaskPullRequestAttachments, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, promoteDraftTask, refreshDraftTaskLease, promoteAbandonedDraftTasks, releaseStaleReviewingTasks, releaseStaleOfferedTasksForOfflineAgents, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, UNATTRIBUTED_USER_ID, getSessionCostSummary, getAttributionByPerson, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, emitBuiltInIntegrationConnectedOnce, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, detachTaskFromWorkflowRunStep, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createAppVersion, getAppVersions, getAppVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, cancelPendingApprovalRequestsForRun, listCancelledApprovalRequestsForRun, listCancelledApprovalRequestsForStep, claimApprovalCancellationNotification, completeApprovalCancellationNotificationClaim, releaseApprovalCancellationNotificationClaim, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, emitMcpServerConnectedTelemetry, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, sweepExpiredKv, sweepExpiredKvPrefix, upsertKv, claimKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, updateScriptRunIfNotTerminal, updateScriptRunIfRunning, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
|
|
12284
|
+
export { slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, telemetry, emitIntegrationConnected, init_telemetry, HeartbeatExpiryError, init_heartbeat_expiry, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, init_request_auth_context, auditAssetKeys, init_asset_key_audit, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDate, normalizeDateRequired, init_date_utils, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, isInTransaction, init_db_client, getPromptTemplateDefaultDrift, init_default_drift, init_templates2 as init_templates, isSqliteVecAvailable, resolveSqliteVecExtensionPath, __resetSqliteVecExtensionPathCacheForTests, initDb, getDb, closeDb, getDbClient, updateAgentCredentialState, updateAgentCredentialMissing, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, getTaskById, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getPendingSlackRelayTasks, markSlackRelayAttempted, markSlackRelayDelivered, markFinalizedSlackRelaysDelivered, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getSlackTasksMissingTree, getInProgressTasksByContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getLatestScriptRunStepTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, onTaskStarted, init_task_lifecycle_events, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, updateTaskClaudeSessionId, updateTaskTitle, completeTask, failTask, overwriteTerminalTaskResultText, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled, getTaskSteeringFields, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, init_reaction_shortcode, parseTaskToolManifest, selectTaskTools, init_task_tool_manifest, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateConfigValue, init_swarm_config_guard, getSlackRenderV2ActivatedAt, ensureSlackRenderV2Activation, getSlackDelegationActivatedAt, ensureSlackDelegationActivation, isPendingSlackMessage, recordSlackMessage, reserveSlackMessage, bindSlackMessageTimestamp, updateSlackMessageRecord, markSlackTreeRendered, deleteSlackMessageRecord, getSlackTreeMessage, getSlackTreeMessageByThread, getSlackOutcomeMessage, getSlackTreeMessages, getSlackMessageByChannelTs, getSlackTasksInThread, markTaskSlackReplySent, setSlackMessageTracking, updateTaskVcs, insertTaskAttachment, recordTaskPullRequestAttachments, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, promoteDraftTask, refreshDraftTaskLease, promoteAbandonedDraftTasks, releaseStaleReviewingTasks, releaseStaleOfferedTasksForOfflineAgents, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, UNATTRIBUTED_USER_ID, getSessionCostSummary, getAttributionByPerson, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, emitBuiltInIntegrationConnectedOnce, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, detachTaskFromWorkflowRunStep, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createAppVersion, getAppVersions, getAppVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, cancelPendingApprovalRequestsForRun, listCancelledApprovalRequestsForRun, listCancelledApprovalRequestsForStep, claimApprovalCancellationNotification, completeApprovalCancellationNotificationClaim, releaseApprovalCancellationNotificationClaim, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, emitMcpServerConnectedTelemetry, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, sweepExpiredKv, sweepExpiredKvPrefix, upsertKv, claimKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, updateScriptRunIfNotTerminal, updateScriptRunIfRunning, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
|