@integrity-labs/agt-cli 0.28.890 → 0.28.892
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/agt.js +5 -5
- package/dist/{chunk-FHJLOWU2.js → chunk-FZ6KIIYX.js} +86 -22
- package/dist/chunk-FZ6KIIYX.js.map +1 -0
- package/dist/{chunk-WGMIKXTX.js → chunk-SUVQ2KSP.js} +4 -4
- package/dist/{chunk-AQM4A5JF.js → chunk-WMJBXN6N.js} +2 -2
- package/dist/{claude-pair-runtime-XSOXRHGZ.js → claude-pair-runtime-RTD7ZCVS.js} +2 -2
- package/dist/lib/manager-worker.js +14 -39
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +85 -21
- package/dist/mcp/index.js +1316 -1237
- package/dist/mcp/origami.js +85 -21
- package/dist/mcp/slack-channel.js +85 -21
- package/dist/mcp/telegram-channel.js +85 -21
- package/dist/{persistent-session-DVG5WKZZ.js → persistent-session-ARKZDYMX.js} +3 -3
- package/dist/{responsiveness-probe-PPI3AFQG.js → responsiveness-probe-X2WXPIUI.js} +3 -3
- package/dist/{session-auth-dead-L7TAICNC.js → session-auth-dead-BLEV4AUJ.js} +2 -2
- package/package.json +2 -2
- package/dist/assets/review/SKILL.md +0 -223
- package/dist/assets/review/SWEEP.md +0 -169
- package/dist/chunk-FHJLOWU2.js.map +0 -1
- /package/dist/{chunk-WGMIKXTX.js.map → chunk-SUVQ2KSP.js.map} +0 -0
- /package/dist/{chunk-AQM4A5JF.js.map → chunk-WMJBXN6N.js.map} +0 -0
- /package/dist/{claude-pair-runtime-XSOXRHGZ.js.map → claude-pair-runtime-RTD7ZCVS.js.map} +0 -0
- /package/dist/{persistent-session-DVG5WKZZ.js.map → persistent-session-ARKZDYMX.js.map} +0 -0
- /package/dist/{responsiveness-probe-PPI3AFQG.js.map → responsiveness-probe-X2WXPIUI.js.map} +0 -0
- /package/dist/{session-auth-dead-L7TAICNC.js.map → session-auth-dead-BLEV4AUJ.js.map} +0 -0
package/dist/mcp/index.js
CHANGED
|
@@ -27363,6 +27363,12 @@ var CURSOR_SHORTFALL_REASONS = [
|
|
|
27363
27363
|
var NON_SHORTFALL_KEYS = new Set(CURSOR_ADVANCE_NON_SHORTFALL_KEYS);
|
|
27364
27364
|
var KNOWN_REASONS = new Set(CURSOR_SHORTFALL_REASONS.filter((k) => !NON_SHORTFALL_KEYS.has(k)));
|
|
27365
27365
|
|
|
27366
|
+
// ../core/dist/direct-chat/agent-history-notices.js
|
|
27367
|
+
var AGENT_HISTORY_TURNS_ONLY_OR_FILTER = [
|
|
27368
|
+
"payload->>kind.is.null",
|
|
27369
|
+
`payload->>kind.in.("",${[...USER_FACING_NOTICE_KINDS].sort().join(",")})`
|
|
27370
|
+
].join(",");
|
|
27371
|
+
|
|
27366
27372
|
// ../core/dist/onboarding/state-machine.js
|
|
27367
27373
|
var AREA_ORDER = [
|
|
27368
27374
|
"framing",
|
|
@@ -29779,14 +29785,38 @@ var FLAG_REGISTRY = [
|
|
|
29779
29785
|
},
|
|
29780
29786
|
{
|
|
29781
29787
|
key: "agent-unified-screen",
|
|
29782
|
-
description: 'Unified agent screen redesign (ENG-8478 epic / ENG-8480). When ON, the webapp renders the new single-screen "viewing is editing" agent surface (stripped-back hero, working agent switcher, inline-editable profile, embedded operational panels + a live direct-chat drawer) in place of the separate agent view/edit pages; when OFF, the current view/edit pages are unchanged. Additive UI gate \u2014 no data-model change: each panel reads the same existing endpoints the current pages use. Composes independently with app-top-nav-shell (the two flags are reconciled in ENG-8488).
|
|
29788
|
+
description: 'Unified agent screen redesign (ENG-8478 epic / ENG-8480). When ON, the webapp renders the new single-screen "viewing is editing" agent surface (stripped-back hero, working agent switcher, inline-editable profile, embedded operational panels + a live direct-chat drawer) in place of the separate agent view/edit pages; when OFF, the current view/edit pages are unchanged. Additive UI gate \u2014 no data-model change: each panel reads the same existing endpoints the current pages use. Composes independently with app-top-nav-shell (the two flags are reconciled in ENG-8488). NO LONGER DARK: ENG-9832 cutover step 1 flipped the default to true, so an org with no override now gets the unified screen. The key survives only until cutover step 2 deletes it \u2014 which is blocked on ENG-8547 and ENG-8559, because the flag-off branch is still the only home for the /edit tabs.',
|
|
29783
29789
|
flagType: "boolean",
|
|
29784
|
-
//
|
|
29785
|
-
//
|
|
29786
|
-
|
|
29787
|
-
//
|
|
29788
|
-
// so
|
|
29789
|
-
//
|
|
29790
|
+
// ENG-9832 (cutover step 1): flipped `false` -> `true`. The comment this
|
|
29791
|
+
// replaces called `false` the safe direction — "the current view/edit
|
|
29792
|
+
// pages", never "a half-built redesign". That was true while the redesign
|
|
29793
|
+
// was half built. It has been the shipped surface for the pilot orgs since
|
|
29794
|
+
// ENG-8481, so `false` now points at the pages being retired, not at safety.
|
|
29795
|
+
// The old rationale is recorded rather than deleted because it was correct
|
|
29796
|
+
// under a premise that has since expired.
|
|
29797
|
+
//
|
|
29798
|
+
// MIND THE SPLIT. This value is consulted by the API evaluator when it
|
|
29799
|
+
// builds the `GET /flags` map for an org with NO override. It is NOT the
|
|
29800
|
+
// fallback the webapp uses when that fetch fails: `getPublicBooleanFlagServer`
|
|
29801
|
+
// and `usePublicBooleanFlag` both return the argument passed at the CALL
|
|
29802
|
+
// SITE and never consult this registry. Three call sites carry `true` to
|
|
29803
|
+
// match — agents/[agentId]/page.tsx, agents/[agentId]/edit/page.tsx and
|
|
29804
|
+
// `useAgentUnifiedScreenEnabled` in lib/redesign-flags.ts. Flipping the
|
|
29805
|
+
// registry alone leaves the cutover half-applied with no error anywhere;
|
|
29806
|
+
// eng-9832-unified-fallback-parity.test.ts fails if any of the three drifts.
|
|
29807
|
+
defaultValue: true,
|
|
29808
|
+
// Read BOTH server-side (agents/[agentId]/page.tsx and its /edit sibling, via
|
|
29809
|
+
// getPublicBooleanFlagServer) and client-side (dashboard-sherlock-shell.tsx,
|
|
29810
|
+
// via usePublicBooleanFlag), so the key must be in the browser-exposed public
|
|
29811
|
+
// map. Additive viewer gate, resolved within the active-org cookie's scope
|
|
29812
|
+
// — not sensitive.
|
|
29813
|
+
//
|
|
29814
|
+
// `public` MUST STAY until step 2 deletes the key, and the reason reads
|
|
29815
|
+
// backwards: the server helper resolves against the very SAME public-filtered
|
|
29816
|
+
// `GET /flags` the browser uses (routes/flags.ts filters to
|
|
29817
|
+
// listPublicFlagKeys()). Drop `public` and the key is simply absent from the
|
|
29818
|
+
// map, so both server readers fall through to their call-site argument
|
|
29819
|
+
// forever — silently, with no error raised anywhere.
|
|
29790
29820
|
public: true
|
|
29791
29821
|
},
|
|
29792
29822
|
{
|
|
@@ -29803,16 +29833,36 @@ var FLAG_REGISTRY = [
|
|
|
29803
29833
|
},
|
|
29804
29834
|
{
|
|
29805
29835
|
key: "ninjafy-brand",
|
|
29806
|
-
description: 'Present the product under the Ninjafy brand instead of Augmented Team (ENG-8250). This is the UMBRELLA brand gate, not a one-off nav toggle: every subsequent rebrand surface (page titles, email templates, marketing-facing copy) reads THIS key rather than adding its own flag, so the whole rebrand keeps a single kill switch. First surface is the left-hand nav wordmark \u2014 ON replaces the human+robot mark and the "augmented.team" text with italic lowercase "ninjafy"; OFF renders exactly what shipped before. Scope is the USER-FACING BRAND PRESENTATION \u2014 text AND VISUAL THEME. ENG-8858 widened this from text alone: the Ninjafy palette is gated here too, because a colour theme is not text. It stays ONE key rather than gaining a `ninjafy-theme` sibling, so a half-branded state \u2014 ninjafy wordmark over Augmented green \u2014 is unreachable and the rebrand keeps a single kill switch. It must never gate a code identifier, package name, env var or CLI name. EXISTING identifiers stay `Augmented`/`agt` per the CLAUDE.md naming contract, which protects them from premature renaming \u2014 the deep rename is workstream C of docs/runbooks/rebrand-ninjafy-migration.md and is out of scope here. That contract does NOT require NEW code to carry the old brand: artefacts created specifically for the rebrand take Ninjafy naming (ENG-8078 decision 9; see the CLAUDE.md rebrand carve-out). Either way it is a naming rule, not a flag concern \u2014 this key gates presentation, never an identifier. Set the stage-wide default to flip a whole environment, or add a feature_flag_overrides row to pilot a subset while everyone else still sees Augmented. Overrides resolve at FOUR grains, most specific first \u2014 agent, team, host, then org-wide (evaluate.ts:79-81); organization_id is always required, so there is no global override. Org and team are the useful pilot grains for THIS flag: there is now exactly ONE consumer \u2014 (dashboard)/layout.tsx via getPublicBooleanFlagServer \u2014 evaluating in the active-org cookie scope, so a host- or agent-scoped row is accepted by the table but never reached by the console. It resolves the key ONCE per request and passes the boolean down to sidebar.tsx and top-nav.tsx as a required prop. Resolution is SERVER-side deliberately: the client hook starts at its default and updates after an async GET /flags, so anything gated on it paints Augmented and then repaints. ENG-8858 moved the PALETTE for that reason (a full-page colour flash); ENG-9227 moved the WORDMARK, which had been the last surface still swapping after hydration. A consequence worth knowing: /login and the marketing routes stay on the Augmented palette whatever an org sets, because
|
|
29836
|
+
description: 'Present the product under the Ninjafy brand instead of Augmented Team (ENG-8250). This is the UMBRELLA brand gate, not a one-off nav toggle: every subsequent rebrand surface (page titles, email templates, marketing-facing copy) reads THIS key rather than adding its own flag, so the whole rebrand keeps a single kill switch. First surface is the left-hand nav wordmark \u2014 ON replaces the human+robot mark and the "augmented.team" text with italic lowercase "ninjafy"; OFF renders exactly what shipped before. Scope is the USER-FACING BRAND PRESENTATION \u2014 text AND VISUAL THEME. ENG-8858 widened this from text alone: the Ninjafy palette is gated here too, because a colour theme is not text. It stays ONE key rather than gaining a `ninjafy-theme` sibling, so a half-branded state \u2014 ninjafy wordmark over Augmented green \u2014 is unreachable and the rebrand keeps a single kill switch. It must never gate a code identifier, package name, env var or CLI name. EXISTING identifiers stay `Augmented`/`agt` per the CLAUDE.md naming contract, which protects them from premature renaming \u2014 the deep rename is workstream C of docs/runbooks/rebrand-ninjafy-migration.md and is out of scope here. That contract does NOT require NEW code to carry the old brand: artefacts created specifically for the rebrand take Ninjafy naming (ENG-8078 decision 9; see the CLAUDE.md rebrand carve-out). Either way it is a naming rule, not a flag concern \u2014 this key gates presentation, never an identifier. Set the stage-wide default to flip a whole environment, or add a feature_flag_overrides row to pilot a subset while everyone else still sees Augmented. Overrides resolve at FOUR grains, most specific first \u2014 agent, team, host, then org-wide (evaluate.ts:79-81); organization_id is always required, so there is no global override. Org and team are the useful pilot grains for THIS flag: there is now exactly ONE consumer \u2014 (dashboard)/layout.tsx via getPublicBooleanFlagServer \u2014 evaluating in the active-org cookie scope, so a host- or agent-scoped row is accepted by the table but never reached by the console. It resolves the key ONCE per request and passes the boolean down to sidebar.tsx and top-nav.tsx as a required prop. Resolution is SERVER-side deliberately: the client hook starts at its default and updates after an async GET /flags, so anything gated on it paints Augmented and then repaints. ENG-8858 moved the PALETTE for that reason (a full-page colour flash); ENG-9227 moved the WORDMARK, which had been the last surface still swapping after hydration. A consequence worth knowing: /login and the marketing routes stay on the Augmented palette whatever an org sets, because fetchPublicFlags returns null without a verified session and a pre-auth page has neither a session nor an active org \u2014 a PER-ORG flag structurally cannot brand one. ENG-9830 CORRECTS what used to be written here ("those surfaces follow only when the stage-wide default flips"): they do not follow it at all. Two reasons. The value returned on a null fetch is the CALL SITE\u2019s passed argument, not this registry default; and six such pages (/login, /reset-password, /auth/confirm, the pre-redeem member-signin gate and the two public Slack-install terminal pages) do not mount <BrandStamp/> AT ALL \u2014 deliberately, enumerated with per-page reasons in eng-9266-brand-stamp-coverage.test.ts. They become branded when the flag is REMOVED at cutover step 2 and the palette moves into bare :root, with no read left to gate it. NO LONGER DARK: ENG-9830 cutover step 1 flipped the default to true, so an org with no override now sees Ninjafy. The key survives only until cutover step 2 deletes it.',
|
|
29807
29837
|
flagType: "boolean",
|
|
29808
|
-
//
|
|
29809
|
-
//
|
|
29810
|
-
//
|
|
29811
|
-
// rebrand
|
|
29812
|
-
|
|
29838
|
+
// ENG-9830 (cutover step 1): flipped `false` -> `true`. The comment this
|
|
29839
|
+
// replaces argued `false` was the fail-closed direction — "never leak an
|
|
29840
|
+
// UNANNOUNCED rebrand to every customer at once". That was correct for as
|
|
29841
|
+
// long as the rebrand was unannounced. It is not any more: Ninjafy is the
|
|
29842
|
+
// live, announced brand (ENG-9613 reconciled the console onto the master
|
|
29843
|
+
// assets while the flag was already ON in production), so `false` now points
|
|
29844
|
+
// at the brand we no longer ship. A flags outage that reverted a customer to
|
|
29845
|
+
// Augmented would be the incident, not the safe harbour.
|
|
29846
|
+
//
|
|
29847
|
+
// The old rationale is recorded rather than deleted because it is a correct
|
|
29848
|
+
// argument whose PREMISE expired — reading the change without it looks like
|
|
29849
|
+
// someone overriding a deliberate fail-closed default.
|
|
29850
|
+
//
|
|
29851
|
+
// NOTE this value is only consulted by the API evaluator when building the
|
|
29852
|
+
// `GET /flags` map for an org with no override. It is NOT the fallback the
|
|
29853
|
+
// webapp uses on an outage: `getPublicBooleanFlagServer(key, defaultValue)`
|
|
29854
|
+
// returns its own PASSED argument when the fetch fails, so the call sites in
|
|
29855
|
+
// (dashboard)/layout.tsx and components/brand-stamp.tsx carry `true` too.
|
|
29856
|
+
// Flipping only one of the two leaves the cutover half-applied.
|
|
29857
|
+
defaultValue: true,
|
|
29813
29858
|
// ENG-9227: there are NO client readers of this key left. (dashboard)/
|
|
29814
29859
|
// layout.tsx resolves it ONCE server-side via getPublicBooleanFlagServer and
|
|
29815
29860
|
// passes the boolean down to sidebar.tsx and top-nav.tsx as a required prop.
|
|
29861
|
+
// "ONCE" is about the chrome, not the key: components/brand-stamp.tsx is a
|
|
29862
|
+
// SECOND, independent server read of `ninjafy-brand` (CodeRabbit, #5385).
|
|
29863
|
+
// Both are listed in the note above because both carry an outage fallback
|
|
29864
|
+
// that has to move together — reading this paragraph alone would leave you
|
|
29865
|
+
// updating one of the two.
|
|
29816
29866
|
// ENG-8858 did that for the THEME; ENG-9227 finished the job for the
|
|
29817
29867
|
// WORDMARK, which had kept usePublicBooleanFlag and so kept swapping
|
|
29818
29868
|
// "augmented.team" to "ninjafy" after hydration.
|
|
@@ -29834,24 +29884,38 @@ var FLAG_REGISTRY = [
|
|
|
29834
29884
|
},
|
|
29835
29885
|
{
|
|
29836
29886
|
key: "ninjafy-logo",
|
|
29837
|
-
description: "Which Ninjafy logo TREATMENT the console chrome renders (ENG-9365). This is a SUB-SELECTION under ninjafy-brand, not a second brand gate: it is consulted only once ninjafy-brand has already resolved ON, so with the brand off the value is inert and the half-branded state that flag's description calls unreachable stays unreachable. ninjafy-brand remains the single kill switch for the rebrand. It
|
|
29887
|
+
description: "Which Ninjafy logo TREATMENT the console chrome renders (ENG-9365). This is a SUB-SELECTION under ninjafy-brand, not a second brand gate: it is consulted only once ninjafy-brand has already resolved ON, so with the brand off the value is inert and the half-branded state that flag's description calls unreachable stays unreachable. ninjafy-brand remains the single kill switch for the rebrand. It existed so candidate logo treatments could be put in front of a human and compared in the running console, rather than judged from a static export. That comparison has happened: ENG-9830 cutover step 1 chose TWO-TONE, so that is now the default and an unset flag renders it. NOTE this reverses the property this description used to claim \u2014 an unset flag was a no-op while the default was lockup (what ENG-9298 shipped), and that is deliberately given up at cutover: the default MOVING is the change. The key survives only until cutover step 2 hardcodes the chosen treatment and deletes it. lockup = mark and wordmark together, both in the brand blue \u2014 what ENG-9298 shipped. two-tone = the mark in brand blue with the wordmark in the neutral text colour (the treatment of the blue-icon/black-wordmark artwork); the chosen one. wordmark = the word alone, no mark. Every treatment is composed from the ENG-9298 geometry \u2014 ENG-9312 pins that the lockup's blue path IS the mark subpath followed by the wordmark subpaths, byte for byte \u2014 so a new treatment is a composition, never a fresh trace, and the three drawings cannot drift apart. Surfaces are the dashboard sidebar and the top nav. The top nav shows the WORDMARK portion at every width whatever the treatment, because ENG-9342 decided that deliberately (a full lockup at the header's icon height crowds the team switcher on a phone) \u2014 so a treatment changes the word's colour there, never whether a mark appears. The admin sidebar (ENG-9323) is NOT wired to this key and always renders the mark; widening it is a separate decision. Resolved SERVER-SIDE in (dashboard)/layout.tsx via getPublicEnumFlagServer, beside ninjafy-brand and in the same single GET /flags round trip, then passed down as a required prop. That is not a style preference: the client hook starts at its default and updates after an async fetch, so a client read would paint one logo and swap it after hydration \u2014 the exact flash ENG-9227 removed from the wordmark and ENG-8858 removed from the palette. Org and team are the useful pilot grains, as for ninjafy-brand: the single consumer evaluates in the active-org cookie scope, so a host- or agent-scoped override row is accepted by the table but never reached by the console.",
|
|
29838
29888
|
flagType: "enum",
|
|
29839
29889
|
allowedValues: ["lockup", "two-tone", "wordmark"],
|
|
29840
|
-
//
|
|
29841
|
-
//
|
|
29842
|
-
//
|
|
29890
|
+
// ENG-9830 (cutover step 1): `lockup` -> `two-tone`. The treatments existed
|
|
29891
|
+
// so they could be compared in the running console rather than judged from a
|
|
29892
|
+
// static export (ENG-9365); that comparison has now happened and `two-tone`
|
|
29893
|
+
// — the mark in brand blue with the wordmark in the neutral text colour — is
|
|
29894
|
+
// the chosen treatment. It becomes the hardcoded one when this key is
|
|
29895
|
+
// removed at cutover step 2.
|
|
29896
|
+
//
|
|
29897
|
+
// The rule this value obeys is unchanged: this flag has no "off" direction,
|
|
29898
|
+
// so fail-safe means "the treatment currently in production", not the
|
|
29843
29899
|
// narrowest one. A flag-DB read error, an archived row, or a stored value
|
|
29844
29900
|
// outside allowedValues all resolve here (evaluate.ts normalizeFlagValue),
|
|
29845
|
-
// which is what makes an experimental value impossible to strand.
|
|
29846
|
-
|
|
29901
|
+
// which is what makes an experimental value impossible to strand. Only which
|
|
29902
|
+
// treatment holds that position has moved.
|
|
29903
|
+
//
|
|
29904
|
+
// Same split as ninjafy-brand above: this governs the API evaluation path
|
|
29905
|
+
// only. The webapp's outage fallback is the argument passed at the
|
|
29906
|
+
// (dashboard)/layout.tsx call site, which carries 'two-tone' to match.
|
|
29907
|
+
defaultValue: "two-tone",
|
|
29847
29908
|
// Same trap as ninjafy-brand, and it bites harder here because there are no
|
|
29848
29909
|
// client readers of this key AT ALL — it is server-resolved by construction.
|
|
29849
29910
|
// `public` does NOT mean "read by a browser"; it means "readable through the
|
|
29850
29911
|
// public map". getPublicEnumFlagServer resolves against the same GET /flags
|
|
29851
29912
|
// endpoint the browser uses, and that route filters to listPublicFlagKeys()
|
|
29852
29913
|
// (routes/flags.ts). Drop `public` and the key is simply absent from the map,
|
|
29853
|
-
// so the helper falls through to
|
|
29854
|
-
// the dropdown appearing to do nothing, with no error
|
|
29914
|
+
// so the helper falls through to the fallback passed at that call site and
|
|
29915
|
+
// returns it FOREVER — the dropdown appearing to do nothing, with no error
|
|
29916
|
+
// raised anywhere. Named as the call site rather than as a literal on
|
|
29917
|
+
// purpose: this comment said `lockup` for exactly as long as `lockup` was
|
|
29918
|
+
// the answer, and ENG-9830 flipping the winner is what made it a lie.
|
|
29855
29919
|
public: true
|
|
29856
29920
|
},
|
|
29857
29921
|
{
|
|
@@ -30141,527 +30205,163 @@ var MIN_PROVISIONING_MAX_FOR_QUARANTINE_ORDERING = BIND_FAILURE_QUARANTINE_THRES
|
|
|
30141
30205
|
var FORCED_UPDATE_RELAX_AFTER_MS = 7 * 6e4;
|
|
30142
30206
|
var FORCED_UPDATE_HARD_DEADLINE_MS = 15 * 6e4;
|
|
30143
30207
|
|
|
30144
|
-
//
|
|
30145
|
-
var
|
|
30146
|
-
|
|
30147
|
-
|
|
30148
|
-
|
|
30149
|
-
|
|
30150
|
-
|
|
30151
|
-
|
|
30152
|
-
|
|
30153
|
-
|
|
30154
|
-
|
|
30155
|
-
|
|
30156
|
-
|
|
30157
|
-
|
|
30158
|
-
|
|
30159
|
-
|
|
30160
|
-
|
|
30161
|
-
|
|
30162
|
-
|
|
30163
|
-
|
|
30164
|
-
|
|
30165
|
-
|
|
30166
|
-
|
|
30208
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
30209
|
+
var external_exports = {};
|
|
30210
|
+
__export(external_exports, {
|
|
30211
|
+
BRAND: () => BRAND,
|
|
30212
|
+
DIRTY: () => DIRTY,
|
|
30213
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
30214
|
+
INVALID: () => INVALID,
|
|
30215
|
+
NEVER: () => NEVER,
|
|
30216
|
+
OK: () => OK,
|
|
30217
|
+
ParseStatus: () => ParseStatus,
|
|
30218
|
+
Schema: () => ZodType,
|
|
30219
|
+
ZodAny: () => ZodAny,
|
|
30220
|
+
ZodArray: () => ZodArray,
|
|
30221
|
+
ZodBigInt: () => ZodBigInt,
|
|
30222
|
+
ZodBoolean: () => ZodBoolean,
|
|
30223
|
+
ZodBranded: () => ZodBranded,
|
|
30224
|
+
ZodCatch: () => ZodCatch,
|
|
30225
|
+
ZodDate: () => ZodDate,
|
|
30226
|
+
ZodDefault: () => ZodDefault,
|
|
30227
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
30228
|
+
ZodEffects: () => ZodEffects,
|
|
30229
|
+
ZodEnum: () => ZodEnum,
|
|
30230
|
+
ZodError: () => ZodError,
|
|
30231
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
30232
|
+
ZodFunction: () => ZodFunction,
|
|
30233
|
+
ZodIntersection: () => ZodIntersection,
|
|
30234
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
30235
|
+
ZodLazy: () => ZodLazy,
|
|
30236
|
+
ZodLiteral: () => ZodLiteral,
|
|
30237
|
+
ZodMap: () => ZodMap,
|
|
30238
|
+
ZodNaN: () => ZodNaN,
|
|
30239
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
30240
|
+
ZodNever: () => ZodNever,
|
|
30241
|
+
ZodNull: () => ZodNull,
|
|
30242
|
+
ZodNullable: () => ZodNullable,
|
|
30243
|
+
ZodNumber: () => ZodNumber,
|
|
30244
|
+
ZodObject: () => ZodObject,
|
|
30245
|
+
ZodOptional: () => ZodOptional,
|
|
30246
|
+
ZodParsedType: () => ZodParsedType,
|
|
30247
|
+
ZodPipeline: () => ZodPipeline,
|
|
30248
|
+
ZodPromise: () => ZodPromise,
|
|
30249
|
+
ZodReadonly: () => ZodReadonly,
|
|
30250
|
+
ZodRecord: () => ZodRecord,
|
|
30251
|
+
ZodSchema: () => ZodType,
|
|
30252
|
+
ZodSet: () => ZodSet,
|
|
30253
|
+
ZodString: () => ZodString,
|
|
30254
|
+
ZodSymbol: () => ZodSymbol,
|
|
30255
|
+
ZodTransformer: () => ZodEffects,
|
|
30256
|
+
ZodTuple: () => ZodTuple,
|
|
30257
|
+
ZodType: () => ZodType,
|
|
30258
|
+
ZodUndefined: () => ZodUndefined,
|
|
30259
|
+
ZodUnion: () => ZodUnion,
|
|
30260
|
+
ZodUnknown: () => ZodUnknown,
|
|
30261
|
+
ZodVoid: () => ZodVoid,
|
|
30262
|
+
addIssueToContext: () => addIssueToContext,
|
|
30263
|
+
any: () => anyType,
|
|
30264
|
+
array: () => arrayType,
|
|
30265
|
+
bigint: () => bigIntType,
|
|
30266
|
+
boolean: () => booleanType,
|
|
30267
|
+
coerce: () => coerce,
|
|
30268
|
+
custom: () => custom,
|
|
30269
|
+
date: () => dateType,
|
|
30270
|
+
datetimeRegex: () => datetimeRegex,
|
|
30271
|
+
defaultErrorMap: () => en_default,
|
|
30272
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
30273
|
+
effect: () => effectsType,
|
|
30274
|
+
enum: () => enumType,
|
|
30275
|
+
function: () => functionType,
|
|
30276
|
+
getErrorMap: () => getErrorMap,
|
|
30277
|
+
getParsedType: () => getParsedType,
|
|
30278
|
+
instanceof: () => instanceOfType,
|
|
30279
|
+
intersection: () => intersectionType,
|
|
30280
|
+
isAborted: () => isAborted,
|
|
30281
|
+
isAsync: () => isAsync,
|
|
30282
|
+
isDirty: () => isDirty,
|
|
30283
|
+
isValid: () => isValid,
|
|
30284
|
+
late: () => late,
|
|
30285
|
+
lazy: () => lazyType,
|
|
30286
|
+
literal: () => literalType,
|
|
30287
|
+
makeIssue: () => makeIssue,
|
|
30288
|
+
map: () => mapType,
|
|
30289
|
+
nan: () => nanType,
|
|
30290
|
+
nativeEnum: () => nativeEnumType,
|
|
30291
|
+
never: () => neverType,
|
|
30292
|
+
null: () => nullType,
|
|
30293
|
+
nullable: () => nullableType,
|
|
30294
|
+
number: () => numberType,
|
|
30295
|
+
object: () => objectType,
|
|
30296
|
+
objectUtil: () => objectUtil,
|
|
30297
|
+
oboolean: () => oboolean,
|
|
30298
|
+
onumber: () => onumber,
|
|
30299
|
+
optional: () => optionalType,
|
|
30300
|
+
ostring: () => ostring,
|
|
30301
|
+
pipeline: () => pipelineType,
|
|
30302
|
+
preprocess: () => preprocessType,
|
|
30303
|
+
promise: () => promiseType,
|
|
30304
|
+
quotelessJson: () => quotelessJson,
|
|
30305
|
+
record: () => recordType,
|
|
30306
|
+
set: () => setType,
|
|
30307
|
+
setErrorMap: () => setErrorMap,
|
|
30308
|
+
strictObject: () => strictObjectType,
|
|
30309
|
+
string: () => stringType,
|
|
30310
|
+
symbol: () => symbolType,
|
|
30311
|
+
transformer: () => effectsType,
|
|
30312
|
+
tuple: () => tupleType,
|
|
30313
|
+
undefined: () => undefinedType,
|
|
30314
|
+
union: () => unionType,
|
|
30315
|
+
unknown: () => unknownType,
|
|
30316
|
+
util: () => util,
|
|
30317
|
+
void: () => voidType
|
|
30318
|
+
});
|
|
30319
|
+
|
|
30320
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
30321
|
+
var util;
|
|
30322
|
+
(function(util2) {
|
|
30323
|
+
util2.assertEqual = (_) => {
|
|
30324
|
+
};
|
|
30325
|
+
function assertIs2(_arg) {
|
|
30326
|
+
}
|
|
30327
|
+
util2.assertIs = assertIs2;
|
|
30328
|
+
function assertNever2(_x) {
|
|
30329
|
+
throw new Error();
|
|
30330
|
+
}
|
|
30331
|
+
util2.assertNever = assertNever2;
|
|
30332
|
+
util2.arrayToEnum = (items) => {
|
|
30333
|
+
const obj = {};
|
|
30334
|
+
for (const item of items) {
|
|
30335
|
+
obj[item] = item;
|
|
30167
30336
|
}
|
|
30337
|
+
return obj;
|
|
30168
30338
|
};
|
|
30169
|
-
|
|
30170
|
-
|
|
30171
|
-
|
|
30172
|
-
|
|
30173
|
-
|
|
30174
|
-
|
|
30175
|
-
|
|
30176
|
-
|
|
30177
|
-
|
|
30178
|
-
|
|
30179
|
-
|
|
30180
|
-
|
|
30181
|
-
|
|
30182
|
-
|
|
30183
|
-
|
|
30184
|
-
|
|
30185
|
-
|
|
30186
|
-
|
|
30187
|
-
label: { type: "string", maxLength: L.label },
|
|
30188
|
-
sub: { type: "string", maxLength: L.label },
|
|
30189
|
-
cells: {
|
|
30190
|
-
type: "array",
|
|
30191
|
-
maxItems: L.columns,
|
|
30192
|
-
items: {
|
|
30193
|
-
type: "object",
|
|
30194
|
-
additionalProperties: false,
|
|
30195
|
-
properties: {
|
|
30196
|
-
value: { type: ["string", "number"], maxLength: L.cellText },
|
|
30197
|
-
sub: { type: "string", maxLength: L.cellText },
|
|
30198
|
-
state: { enum: [...TABLE_CELL_STATES] }
|
|
30199
|
-
}
|
|
30200
|
-
}
|
|
30201
|
-
}
|
|
30202
|
-
}
|
|
30203
|
-
}
|
|
30204
|
-
},
|
|
30205
|
-
legend: {
|
|
30206
|
-
type: "array",
|
|
30207
|
-
maxItems: TABLE_CELL_STATES.length,
|
|
30208
|
-
items: {
|
|
30209
|
-
type: "object",
|
|
30210
|
-
required: ["state", "label"],
|
|
30211
|
-
additionalProperties: false,
|
|
30212
|
-
properties: {
|
|
30213
|
-
state: { enum: [...TABLE_CELL_STATES] },
|
|
30214
|
-
label: { type: "string", maxLength: L.label }
|
|
30215
|
-
}
|
|
30216
|
-
}
|
|
30339
|
+
util2.getValidEnumValues = (obj) => {
|
|
30340
|
+
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
30341
|
+
const filtered = {};
|
|
30342
|
+
for (const k of validKeys) {
|
|
30343
|
+
filtered[k] = obj[k];
|
|
30344
|
+
}
|
|
30345
|
+
return util2.objectValues(filtered);
|
|
30346
|
+
};
|
|
30347
|
+
util2.objectValues = (obj) => {
|
|
30348
|
+
return util2.objectKeys(obj).map(function(e) {
|
|
30349
|
+
return obj[e];
|
|
30350
|
+
});
|
|
30351
|
+
};
|
|
30352
|
+
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object3) => {
|
|
30353
|
+
const keys = [];
|
|
30354
|
+
for (const key in object3) {
|
|
30355
|
+
if (Object.prototype.hasOwnProperty.call(object3, key)) {
|
|
30356
|
+
keys.push(key);
|
|
30217
30357
|
}
|
|
30218
30358
|
}
|
|
30359
|
+
return keys;
|
|
30219
30360
|
};
|
|
30220
|
-
|
|
30221
|
-
|
|
30222
|
-
|
|
30223
|
-
|
|
30224
|
-
required: ["value"],
|
|
30225
|
-
additionalProperties: false,
|
|
30226
|
-
properties: {
|
|
30227
|
-
label: { type: "string" },
|
|
30228
|
-
value: { type: ["string", "number"] },
|
|
30229
|
-
delta: { type: "string" },
|
|
30230
|
-
deltaTone: { enum: ["positive", "negative", "neutral"] },
|
|
30231
|
-
values: { type: "array", items: { type: "number" } },
|
|
30232
|
-
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$" }
|
|
30233
|
-
}
|
|
30234
|
-
},
|
|
30235
|
-
area: categoriesSeriesSchema(),
|
|
30236
|
-
line: categoriesSeriesSchema(),
|
|
30237
|
-
bar: categoriesSeriesSchema(),
|
|
30238
|
-
donut: {
|
|
30239
|
-
type: "object",
|
|
30240
|
-
required: ["labels", "series"],
|
|
30241
|
-
additionalProperties: false,
|
|
30242
|
-
properties: {
|
|
30243
|
-
labels: { type: "array", items: { type: "string" } },
|
|
30244
|
-
series: { type: "array", items: { type: "number" } }
|
|
30245
|
-
}
|
|
30246
|
-
},
|
|
30247
|
-
table: tableSchema()
|
|
30248
|
-
};
|
|
30249
|
-
|
|
30250
|
-
// src/kanban-get-error.ts
|
|
30251
|
-
function kanbanGetErrorMessage(status, id, fallbackMessage) {
|
|
30252
|
-
if (status === 400) return "A card id is required.";
|
|
30253
|
-
if (status === 404) return `No card with id "${id}" on your board.`;
|
|
30254
|
-
return `Could not read the card: ${fallbackMessage}`;
|
|
30255
|
-
}
|
|
30256
|
-
|
|
30257
|
-
// src/knowledge-body-render.ts
|
|
30258
|
-
function renderKnowledgeBody(content) {
|
|
30259
|
-
if (content === void 0 || content === null) {
|
|
30260
|
-
return "(!) CONTRACT FAILURE: the API returned no `content` field for this entry. This is NOT an empty entry \u2014 the body was not delivered. Do not treat this as the entry text, and do not knowledge_update from it: an update replaces the whole body and would erase the real one. Report this as a bug.";
|
|
30261
|
-
}
|
|
30262
|
-
if (content.length === 0) {
|
|
30263
|
-
return "(empty \u2014 this entry genuinely has no body text)";
|
|
30264
|
-
}
|
|
30265
|
-
return content;
|
|
30266
|
-
}
|
|
30267
|
-
|
|
30268
|
-
// src/index.ts
|
|
30269
|
-
import { homedir as homedir3 } from "os";
|
|
30270
|
-
import { basename, isAbsolute as isAbsolute2, join as join6, resolve as pathResolve, sep as sep2 } from "path";
|
|
30271
|
-
|
|
30272
|
-
// src/host-file-path.ts
|
|
30273
|
-
var SKILL_BODY_PATH_MAX_BYTES = 512 * 1024;
|
|
30274
|
-
var AGT_LIVE_CONTENT_PATH_MAX_BYTES = 2 * 1024 * 1024;
|
|
30275
|
-
var HOST_FILE_PATH_TOOLS = /* @__PURE__ */ new Map([
|
|
30276
|
-
[
|
|
30277
|
-
"skill_create",
|
|
30278
|
-
{ pathArg: "body_path", targetArg: "body", maxBytes: SKILL_BODY_PATH_MAX_BYTES, label: "a skill body" }
|
|
30279
|
-
],
|
|
30280
|
-
[
|
|
30281
|
-
"skill_update",
|
|
30282
|
-
{ pathArg: "body_path", targetArg: "body", maxBytes: SKILL_BODY_PATH_MAX_BYTES, label: "a skill body" }
|
|
30283
|
-
],
|
|
30284
|
-
[
|
|
30285
|
-
"agt_live_publish",
|
|
30286
|
-
{
|
|
30287
|
-
pathArg: "content_path",
|
|
30288
|
-
targetArg: "content",
|
|
30289
|
-
maxBytes: AGT_LIVE_CONTENT_PATH_MAX_BYTES,
|
|
30290
|
-
label: "a published page"
|
|
30291
|
-
}
|
|
30292
|
-
]
|
|
30293
|
-
]);
|
|
30294
|
-
function hostFilePathArg(toolName) {
|
|
30295
|
-
return HOST_FILE_PATH_TOOLS.get(toolName)?.pathArg;
|
|
30296
|
-
}
|
|
30297
|
-
function allowedHostFileRoots(agentDir, path) {
|
|
30298
|
-
return [path.join(agentDir, "project"), path.join(agentDir, "scratch")];
|
|
30299
|
-
}
|
|
30300
|
-
function openContained(target, roots, opts) {
|
|
30301
|
-
const { path, fs, procFdBase } = opts;
|
|
30302
|
-
if (!procFdBase) {
|
|
30303
|
-
return {
|
|
30304
|
-
ok: false,
|
|
30305
|
-
error: "reading a host path needs descriptor-relative traversal (procfs), which this platform does not provide. Pass the content inline instead."
|
|
30306
|
-
};
|
|
30307
|
-
}
|
|
30308
|
-
const root = roots.find((r) => isContained(target, r, path.sep));
|
|
30309
|
-
if (!root) return { ok: false, error: "resolved outside the allowed roots" };
|
|
30310
|
-
const segments = target.slice(root.length).split(path.sep).filter(Boolean);
|
|
30311
|
-
const fileName = segments[segments.length - 1];
|
|
30312
|
-
if (fileName === void 0) {
|
|
30313
|
-
return { ok: false, error: `'${target}' is a directory, not a file` };
|
|
30314
|
-
}
|
|
30315
|
-
for (const segment of segments) {
|
|
30316
|
-
if (segment === "." || segment === "..") {
|
|
30317
|
-
return { ok: false, error: `'${target}' contains a '${segment}' component` };
|
|
30318
|
-
}
|
|
30319
|
-
}
|
|
30320
|
-
const dirNames = segments.slice(0, -1);
|
|
30321
|
-
let dirFd;
|
|
30322
|
-
try {
|
|
30323
|
-
dirFd = fs.openSync(root, opts.dirOpenFlags);
|
|
30324
|
-
} catch (err) {
|
|
30325
|
-
return { ok: false, error: `the allowed root '${root}' could not be opened \u2014 ${err.message}` };
|
|
30326
|
-
}
|
|
30327
|
-
try {
|
|
30328
|
-
for (const name of dirNames) {
|
|
30329
|
-
let nextFd;
|
|
30330
|
-
try {
|
|
30331
|
-
nextFd = fs.openSync(path.join(procFdBase, String(dirFd), name), opts.dirOpenFlags);
|
|
30332
|
-
} catch (err) {
|
|
30333
|
-
return {
|
|
30334
|
-
ok: false,
|
|
30335
|
-
error: `'${name}' could not be entered \u2014 it is a symlink, is not a directory, or was replaced mid-traversal (${err.message})`
|
|
30336
|
-
};
|
|
30337
|
-
}
|
|
30338
|
-
try {
|
|
30339
|
-
fs.closeSync(dirFd);
|
|
30340
|
-
} catch {
|
|
30341
|
-
}
|
|
30342
|
-
dirFd = nextFd;
|
|
30343
|
-
}
|
|
30344
|
-
let fd;
|
|
30345
|
-
try {
|
|
30346
|
-
fd = fs.openSync(path.join(procFdBase, String(dirFd), fileName), opts.openFlags);
|
|
30347
|
-
} catch (err) {
|
|
30348
|
-
return {
|
|
30349
|
-
ok: false,
|
|
30350
|
-
error: `'${fileName}' could not be opened (a symlink, or replaced mid-check) \u2014 ${err.message}`
|
|
30351
|
-
};
|
|
30352
|
-
}
|
|
30353
|
-
return { ok: true, fd };
|
|
30354
|
-
} finally {
|
|
30355
|
-
try {
|
|
30356
|
-
fs.closeSync(dirFd);
|
|
30357
|
-
} catch {
|
|
30358
|
-
}
|
|
30359
|
-
}
|
|
30360
|
-
}
|
|
30361
|
-
function isContained(candidate, root, sep3) {
|
|
30362
|
-
if (candidate === root) return true;
|
|
30363
|
-
const rootWithSep = root.endsWith(sep3) ? root : root + sep3;
|
|
30364
|
-
return candidate.startsWith(rootWithSep);
|
|
30365
|
-
}
|
|
30366
|
-
function resolveHostFilePath(toolName, args, opts) {
|
|
30367
|
-
const spec = HOST_FILE_PATH_TOOLS.get(toolName);
|
|
30368
|
-
if (!spec) return { ok: true, args };
|
|
30369
|
-
const raw = args[spec.pathArg];
|
|
30370
|
-
if (raw === void 0 || raw === null) return { ok: true, args };
|
|
30371
|
-
if (typeof raw !== "string" || raw.trim() === "") {
|
|
30372
|
-
return { ok: false, error: `${spec.pathArg} must be a non-empty string.` };
|
|
30373
|
-
}
|
|
30374
|
-
if (typeof args[spec.targetArg] === "string") {
|
|
30375
|
-
return {
|
|
30376
|
-
ok: false,
|
|
30377
|
-
error: `Pass either ${spec.targetArg} or ${spec.pathArg}, not both \u2014 they are two ways to say the same thing and I will not guess which one you meant.`
|
|
30378
|
-
};
|
|
30379
|
-
}
|
|
30380
|
-
const { agentDir, path, fs } = opts;
|
|
30381
|
-
const maxBytes = opts.maxBytes ?? spec.maxBytes;
|
|
30382
|
-
const roots = allowedHostFileRoots(agentDir, path);
|
|
30383
|
-
const absolute = path.isAbsolute(raw) ? path.resolve(raw) : path.resolve(path.join(agentDir, "project"), raw);
|
|
30384
|
-
if (!roots.some((r) => isContained(absolute, r, path.sep))) {
|
|
30385
|
-
return {
|
|
30386
|
-
ok: false,
|
|
30387
|
-
error: `${spec.pathArg} must be inside your own project or scratch directory. Got '${raw}'. Allowed: ${roots.join(", ")}`
|
|
30388
|
-
};
|
|
30389
|
-
}
|
|
30390
|
-
let real;
|
|
30391
|
-
try {
|
|
30392
|
-
real = fs.realpathSync(absolute);
|
|
30393
|
-
} catch {
|
|
30394
|
-
return { ok: false, error: `${spec.pathArg} does not exist or is unreadable: '${raw}'` };
|
|
30395
|
-
}
|
|
30396
|
-
if (!roots.some((r) => isContained(real, r, path.sep))) {
|
|
30397
|
-
return {
|
|
30398
|
-
ok: false,
|
|
30399
|
-
error: `${spec.pathArg} resolves outside your own directories (symlink?). '${raw}' \u2192 '${real}'. Allowed: ${roots.join(", ")}`
|
|
30400
|
-
};
|
|
30401
|
-
}
|
|
30402
|
-
const opened = openContained(real, roots, opts);
|
|
30403
|
-
if (!opened.ok) return { ok: false, error: `${spec.pathArg}: ${opened.error} ('${raw}')` };
|
|
30404
|
-
const fd = opened.fd;
|
|
30405
|
-
try {
|
|
30406
|
-
let stat;
|
|
30407
|
-
try {
|
|
30408
|
-
stat = fs.fstatSync(fd);
|
|
30409
|
-
} catch {
|
|
30410
|
-
return { ok: false, error: `${spec.pathArg} could not be inspected: '${raw}'` };
|
|
30411
|
-
}
|
|
30412
|
-
if (!stat.isFile()) {
|
|
30413
|
-
return { ok: false, error: `${spec.pathArg} is not a regular file: '${raw}'` };
|
|
30414
|
-
}
|
|
30415
|
-
if (stat.size > maxBytes) {
|
|
30416
|
-
return {
|
|
30417
|
-
ok: false,
|
|
30418
|
-
error: `${spec.pathArg} is ${stat.size} bytes, over the ${maxBytes}-byte limit for ${spec.label}.`
|
|
30419
|
-
};
|
|
30420
|
-
}
|
|
30421
|
-
let bytes;
|
|
30422
|
-
try {
|
|
30423
|
-
bytes = fs.readFdSync(fd, maxBytes);
|
|
30424
|
-
} catch (err) {
|
|
30425
|
-
return { ok: false, error: `${spec.pathArg} could not be read: ${err.message}` };
|
|
30426
|
-
}
|
|
30427
|
-
if (bytes.byteLength > maxBytes) {
|
|
30428
|
-
return { ok: false, error: `${spec.pathArg} grew past the ${maxBytes}-byte limit while being read.` };
|
|
30429
|
-
}
|
|
30430
|
-
const value = fs.decodeUtf8(bytes);
|
|
30431
|
-
const next = { ...args, [spec.targetArg]: value };
|
|
30432
|
-
delete next[spec.pathArg];
|
|
30433
|
-
return { ok: true, args: next };
|
|
30434
|
-
} finally {
|
|
30435
|
-
try {
|
|
30436
|
-
fs.closeSync(fd);
|
|
30437
|
-
} catch {
|
|
30438
|
-
}
|
|
30439
|
-
}
|
|
30440
|
-
}
|
|
30441
|
-
|
|
30442
|
-
// src/artefact-work-dir.ts
|
|
30443
|
-
import { mkdir, mkdtemp } from "fs/promises";
|
|
30444
|
-
import { existsSync } from "fs";
|
|
30445
|
-
import { dirname, join as join2 } from "path";
|
|
30446
|
-
|
|
30447
|
-
// ../core/dist/provisioning/frameworks/claudecode/agent-dir-alias.js
|
|
30448
|
-
import { isAbsolute, join, relative, sep } from "path";
|
|
30449
|
-
var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
30450
|
-
var VALID_AGENT_ID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
30451
|
-
var INITIATOR_BASENAME = ".current-turn-initiator.json";
|
|
30452
|
-
function isSafeAgentSegment(segment) {
|
|
30453
|
-
return VALID_CODE_NAME.test(segment) || VALID_AGENT_ID.test(segment);
|
|
30454
|
-
}
|
|
30455
|
-
function initiatorDirSegment(initiatorFile, homeDir) {
|
|
30456
|
-
const rel = relative(join(homeDir, ".augmented"), initiatorFile);
|
|
30457
|
-
if (!rel || isAbsolute(rel))
|
|
30458
|
-
return null;
|
|
30459
|
-
const parts = rel.split(sep);
|
|
30460
|
-
if (parts.length !== 2 || parts[1] !== INITIATOR_BASENAME)
|
|
30461
|
-
return null;
|
|
30462
|
-
const segment = parts[0];
|
|
30463
|
-
if (segment === void 0)
|
|
30464
|
-
return null;
|
|
30465
|
-
return isSafeAgentSegment(segment) ? segment : null;
|
|
30466
|
-
}
|
|
30467
|
-
function resolveAgentDirAlias(input) {
|
|
30468
|
-
const { codeName, turnInitiatorFile, agentId, homeDir } = input;
|
|
30469
|
-
const codeNameTrimmed = typeof codeName === "string" ? codeName.trim() : "";
|
|
30470
|
-
if (codeNameTrimmed && VALID_CODE_NAME.test(codeNameTrimmed)) {
|
|
30471
|
-
return join(homeDir, ".augmented", codeNameTrimmed);
|
|
30472
|
-
}
|
|
30473
|
-
const initiator = typeof turnInitiatorFile === "string" ? turnInitiatorFile.trim() : "";
|
|
30474
|
-
if (initiator) {
|
|
30475
|
-
const segment = initiatorDirSegment(initiator, homeDir);
|
|
30476
|
-
if (segment)
|
|
30477
|
-
return join(homeDir, ".augmented", segment);
|
|
30478
|
-
}
|
|
30479
|
-
const agentIdTrimmed = typeof agentId === "string" ? agentId.trim() : "";
|
|
30480
|
-
if (agentIdTrimmed && VALID_AGENT_ID.test(agentIdTrimmed)) {
|
|
30481
|
-
return join(homeDir, ".augmented", agentIdTrimmed);
|
|
30482
|
-
}
|
|
30483
|
-
return null;
|
|
30484
|
-
}
|
|
30485
|
-
function resolveAgentScratchDir(input) {
|
|
30486
|
-
const alias = resolveAgentDirAlias(input);
|
|
30487
|
-
return alias === null ? null : join(alias, "scratch");
|
|
30488
|
-
}
|
|
30489
|
-
|
|
30490
|
-
// src/artefact-work-dir.ts
|
|
30491
|
-
async function makeArtefactWorkDir(prefix, env2) {
|
|
30492
|
-
const scratch = resolveAgentScratchDir(env2);
|
|
30493
|
-
if (scratch === null) {
|
|
30494
|
-
throw new Error(
|
|
30495
|
-
"Cannot save the artefact: none of AGT_AGENT_CODE_NAME, AGT_TURN_INITIATOR_FILE or AGT_AGENT_ID is set, so this server cannot tell which agent directory the file belongs in."
|
|
30496
|
-
);
|
|
30497
|
-
}
|
|
30498
|
-
const agentDir = dirname(scratch);
|
|
30499
|
-
if (!existsSync(agentDir)) {
|
|
30500
|
-
throw new Error(
|
|
30501
|
-
`Cannot save the artefact: the agent directory ${agentDir} does not exist on this host.`
|
|
30502
|
-
);
|
|
30503
|
-
}
|
|
30504
|
-
await mkdir(scratch, { recursive: true });
|
|
30505
|
-
return mkdtemp(join2(scratch, prefix));
|
|
30506
|
-
}
|
|
30507
|
-
|
|
30508
|
-
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
30509
|
-
var external_exports = {};
|
|
30510
|
-
__export(external_exports, {
|
|
30511
|
-
BRAND: () => BRAND,
|
|
30512
|
-
DIRTY: () => DIRTY,
|
|
30513
|
-
EMPTY_PATH: () => EMPTY_PATH,
|
|
30514
|
-
INVALID: () => INVALID,
|
|
30515
|
-
NEVER: () => NEVER,
|
|
30516
|
-
OK: () => OK,
|
|
30517
|
-
ParseStatus: () => ParseStatus,
|
|
30518
|
-
Schema: () => ZodType,
|
|
30519
|
-
ZodAny: () => ZodAny,
|
|
30520
|
-
ZodArray: () => ZodArray,
|
|
30521
|
-
ZodBigInt: () => ZodBigInt,
|
|
30522
|
-
ZodBoolean: () => ZodBoolean,
|
|
30523
|
-
ZodBranded: () => ZodBranded,
|
|
30524
|
-
ZodCatch: () => ZodCatch,
|
|
30525
|
-
ZodDate: () => ZodDate,
|
|
30526
|
-
ZodDefault: () => ZodDefault,
|
|
30527
|
-
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
30528
|
-
ZodEffects: () => ZodEffects,
|
|
30529
|
-
ZodEnum: () => ZodEnum,
|
|
30530
|
-
ZodError: () => ZodError,
|
|
30531
|
-
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
30532
|
-
ZodFunction: () => ZodFunction,
|
|
30533
|
-
ZodIntersection: () => ZodIntersection,
|
|
30534
|
-
ZodIssueCode: () => ZodIssueCode,
|
|
30535
|
-
ZodLazy: () => ZodLazy,
|
|
30536
|
-
ZodLiteral: () => ZodLiteral,
|
|
30537
|
-
ZodMap: () => ZodMap,
|
|
30538
|
-
ZodNaN: () => ZodNaN,
|
|
30539
|
-
ZodNativeEnum: () => ZodNativeEnum,
|
|
30540
|
-
ZodNever: () => ZodNever,
|
|
30541
|
-
ZodNull: () => ZodNull,
|
|
30542
|
-
ZodNullable: () => ZodNullable,
|
|
30543
|
-
ZodNumber: () => ZodNumber,
|
|
30544
|
-
ZodObject: () => ZodObject,
|
|
30545
|
-
ZodOptional: () => ZodOptional,
|
|
30546
|
-
ZodParsedType: () => ZodParsedType,
|
|
30547
|
-
ZodPipeline: () => ZodPipeline,
|
|
30548
|
-
ZodPromise: () => ZodPromise,
|
|
30549
|
-
ZodReadonly: () => ZodReadonly,
|
|
30550
|
-
ZodRecord: () => ZodRecord,
|
|
30551
|
-
ZodSchema: () => ZodType,
|
|
30552
|
-
ZodSet: () => ZodSet,
|
|
30553
|
-
ZodString: () => ZodString,
|
|
30554
|
-
ZodSymbol: () => ZodSymbol,
|
|
30555
|
-
ZodTransformer: () => ZodEffects,
|
|
30556
|
-
ZodTuple: () => ZodTuple,
|
|
30557
|
-
ZodType: () => ZodType,
|
|
30558
|
-
ZodUndefined: () => ZodUndefined,
|
|
30559
|
-
ZodUnion: () => ZodUnion,
|
|
30560
|
-
ZodUnknown: () => ZodUnknown,
|
|
30561
|
-
ZodVoid: () => ZodVoid,
|
|
30562
|
-
addIssueToContext: () => addIssueToContext,
|
|
30563
|
-
any: () => anyType,
|
|
30564
|
-
array: () => arrayType,
|
|
30565
|
-
bigint: () => bigIntType,
|
|
30566
|
-
boolean: () => booleanType,
|
|
30567
|
-
coerce: () => coerce,
|
|
30568
|
-
custom: () => custom,
|
|
30569
|
-
date: () => dateType,
|
|
30570
|
-
datetimeRegex: () => datetimeRegex,
|
|
30571
|
-
defaultErrorMap: () => en_default,
|
|
30572
|
-
discriminatedUnion: () => discriminatedUnionType,
|
|
30573
|
-
effect: () => effectsType,
|
|
30574
|
-
enum: () => enumType,
|
|
30575
|
-
function: () => functionType,
|
|
30576
|
-
getErrorMap: () => getErrorMap,
|
|
30577
|
-
getParsedType: () => getParsedType,
|
|
30578
|
-
instanceof: () => instanceOfType,
|
|
30579
|
-
intersection: () => intersectionType,
|
|
30580
|
-
isAborted: () => isAborted,
|
|
30581
|
-
isAsync: () => isAsync,
|
|
30582
|
-
isDirty: () => isDirty,
|
|
30583
|
-
isValid: () => isValid,
|
|
30584
|
-
late: () => late,
|
|
30585
|
-
lazy: () => lazyType,
|
|
30586
|
-
literal: () => literalType,
|
|
30587
|
-
makeIssue: () => makeIssue,
|
|
30588
|
-
map: () => mapType,
|
|
30589
|
-
nan: () => nanType,
|
|
30590
|
-
nativeEnum: () => nativeEnumType,
|
|
30591
|
-
never: () => neverType,
|
|
30592
|
-
null: () => nullType,
|
|
30593
|
-
nullable: () => nullableType,
|
|
30594
|
-
number: () => numberType,
|
|
30595
|
-
object: () => objectType,
|
|
30596
|
-
objectUtil: () => objectUtil,
|
|
30597
|
-
oboolean: () => oboolean,
|
|
30598
|
-
onumber: () => onumber,
|
|
30599
|
-
optional: () => optionalType,
|
|
30600
|
-
ostring: () => ostring,
|
|
30601
|
-
pipeline: () => pipelineType,
|
|
30602
|
-
preprocess: () => preprocessType,
|
|
30603
|
-
promise: () => promiseType,
|
|
30604
|
-
quotelessJson: () => quotelessJson,
|
|
30605
|
-
record: () => recordType,
|
|
30606
|
-
set: () => setType,
|
|
30607
|
-
setErrorMap: () => setErrorMap,
|
|
30608
|
-
strictObject: () => strictObjectType,
|
|
30609
|
-
string: () => stringType,
|
|
30610
|
-
symbol: () => symbolType,
|
|
30611
|
-
transformer: () => effectsType,
|
|
30612
|
-
tuple: () => tupleType,
|
|
30613
|
-
undefined: () => undefinedType,
|
|
30614
|
-
union: () => unionType,
|
|
30615
|
-
unknown: () => unknownType,
|
|
30616
|
-
util: () => util,
|
|
30617
|
-
void: () => voidType
|
|
30618
|
-
});
|
|
30619
|
-
|
|
30620
|
-
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
30621
|
-
var util;
|
|
30622
|
-
(function(util2) {
|
|
30623
|
-
util2.assertEqual = (_) => {
|
|
30624
|
-
};
|
|
30625
|
-
function assertIs2(_arg) {
|
|
30626
|
-
}
|
|
30627
|
-
util2.assertIs = assertIs2;
|
|
30628
|
-
function assertNever2(_x) {
|
|
30629
|
-
throw new Error();
|
|
30630
|
-
}
|
|
30631
|
-
util2.assertNever = assertNever2;
|
|
30632
|
-
util2.arrayToEnum = (items) => {
|
|
30633
|
-
const obj = {};
|
|
30634
|
-
for (const item of items) {
|
|
30635
|
-
obj[item] = item;
|
|
30636
|
-
}
|
|
30637
|
-
return obj;
|
|
30638
|
-
};
|
|
30639
|
-
util2.getValidEnumValues = (obj) => {
|
|
30640
|
-
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
30641
|
-
const filtered = {};
|
|
30642
|
-
for (const k of validKeys) {
|
|
30643
|
-
filtered[k] = obj[k];
|
|
30644
|
-
}
|
|
30645
|
-
return util2.objectValues(filtered);
|
|
30646
|
-
};
|
|
30647
|
-
util2.objectValues = (obj) => {
|
|
30648
|
-
return util2.objectKeys(obj).map(function(e) {
|
|
30649
|
-
return obj[e];
|
|
30650
|
-
});
|
|
30651
|
-
};
|
|
30652
|
-
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object3) => {
|
|
30653
|
-
const keys = [];
|
|
30654
|
-
for (const key in object3) {
|
|
30655
|
-
if (Object.prototype.hasOwnProperty.call(object3, key)) {
|
|
30656
|
-
keys.push(key);
|
|
30657
|
-
}
|
|
30658
|
-
}
|
|
30659
|
-
return keys;
|
|
30660
|
-
};
|
|
30661
|
-
util2.find = (arr, checker) => {
|
|
30662
|
-
for (const item of arr) {
|
|
30663
|
-
if (checker(item))
|
|
30664
|
-
return item;
|
|
30361
|
+
util2.find = (arr, checker) => {
|
|
30362
|
+
for (const item of arr) {
|
|
30363
|
+
if (checker(item))
|
|
30364
|
+
return item;
|
|
30665
30365
|
}
|
|
30666
30366
|
return void 0;
|
|
30667
30367
|
};
|
|
@@ -33743,808 +33443,1203 @@ var ZodSet = class _ZodSet extends ZodType {
|
|
|
33743
33443
|
return finalizeSet(elements);
|
|
33744
33444
|
}
|
|
33745
33445
|
}
|
|
33746
|
-
min(minSize, message) {
|
|
33747
|
-
return new _ZodSet({
|
|
33446
|
+
min(minSize, message) {
|
|
33447
|
+
return new _ZodSet({
|
|
33448
|
+
...this._def,
|
|
33449
|
+
minSize: { value: minSize, message: errorUtil.toString(message) }
|
|
33450
|
+
});
|
|
33451
|
+
}
|
|
33452
|
+
max(maxSize, message) {
|
|
33453
|
+
return new _ZodSet({
|
|
33454
|
+
...this._def,
|
|
33455
|
+
maxSize: { value: maxSize, message: errorUtil.toString(message) }
|
|
33456
|
+
});
|
|
33457
|
+
}
|
|
33458
|
+
size(size, message) {
|
|
33459
|
+
return this.min(size, message).max(size, message);
|
|
33460
|
+
}
|
|
33461
|
+
nonempty(message) {
|
|
33462
|
+
return this.min(1, message);
|
|
33463
|
+
}
|
|
33464
|
+
};
|
|
33465
|
+
ZodSet.create = (valueType, params) => {
|
|
33466
|
+
return new ZodSet({
|
|
33467
|
+
valueType,
|
|
33468
|
+
minSize: null,
|
|
33469
|
+
maxSize: null,
|
|
33470
|
+
typeName: ZodFirstPartyTypeKind.ZodSet,
|
|
33471
|
+
...processCreateParams(params)
|
|
33472
|
+
});
|
|
33473
|
+
};
|
|
33474
|
+
var ZodFunction = class _ZodFunction extends ZodType {
|
|
33475
|
+
constructor() {
|
|
33476
|
+
super(...arguments);
|
|
33477
|
+
this.validate = this.implement;
|
|
33478
|
+
}
|
|
33479
|
+
_parse(input) {
|
|
33480
|
+
const { ctx } = this._processInputParams(input);
|
|
33481
|
+
if (ctx.parsedType !== ZodParsedType.function) {
|
|
33482
|
+
addIssueToContext(ctx, {
|
|
33483
|
+
code: ZodIssueCode.invalid_type,
|
|
33484
|
+
expected: ZodParsedType.function,
|
|
33485
|
+
received: ctx.parsedType
|
|
33486
|
+
});
|
|
33487
|
+
return INVALID;
|
|
33488
|
+
}
|
|
33489
|
+
function makeArgsIssue(args, error2) {
|
|
33490
|
+
return makeIssue({
|
|
33491
|
+
data: args,
|
|
33492
|
+
path: ctx.path,
|
|
33493
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
33494
|
+
issueData: {
|
|
33495
|
+
code: ZodIssueCode.invalid_arguments,
|
|
33496
|
+
argumentsError: error2
|
|
33497
|
+
}
|
|
33498
|
+
});
|
|
33499
|
+
}
|
|
33500
|
+
function makeReturnsIssue(returns, error2) {
|
|
33501
|
+
return makeIssue({
|
|
33502
|
+
data: returns,
|
|
33503
|
+
path: ctx.path,
|
|
33504
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
33505
|
+
issueData: {
|
|
33506
|
+
code: ZodIssueCode.invalid_return_type,
|
|
33507
|
+
returnTypeError: error2
|
|
33508
|
+
}
|
|
33509
|
+
});
|
|
33510
|
+
}
|
|
33511
|
+
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
33512
|
+
const fn = ctx.data;
|
|
33513
|
+
if (this._def.returns instanceof ZodPromise) {
|
|
33514
|
+
const me = this;
|
|
33515
|
+
return OK(async function(...args) {
|
|
33516
|
+
const error2 = new ZodError([]);
|
|
33517
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
33518
|
+
error2.addIssue(makeArgsIssue(args, e));
|
|
33519
|
+
throw error2;
|
|
33520
|
+
});
|
|
33521
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
33522
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
33523
|
+
error2.addIssue(makeReturnsIssue(result, e));
|
|
33524
|
+
throw error2;
|
|
33525
|
+
});
|
|
33526
|
+
return parsedReturns;
|
|
33527
|
+
});
|
|
33528
|
+
} else {
|
|
33529
|
+
const me = this;
|
|
33530
|
+
return OK(function(...args) {
|
|
33531
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
|
33532
|
+
if (!parsedArgs.success) {
|
|
33533
|
+
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
33534
|
+
}
|
|
33535
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
33536
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
33537
|
+
if (!parsedReturns.success) {
|
|
33538
|
+
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
33539
|
+
}
|
|
33540
|
+
return parsedReturns.data;
|
|
33541
|
+
});
|
|
33542
|
+
}
|
|
33543
|
+
}
|
|
33544
|
+
parameters() {
|
|
33545
|
+
return this._def.args;
|
|
33546
|
+
}
|
|
33547
|
+
returnType() {
|
|
33548
|
+
return this._def.returns;
|
|
33549
|
+
}
|
|
33550
|
+
args(...items) {
|
|
33551
|
+
return new _ZodFunction({
|
|
33552
|
+
...this._def,
|
|
33553
|
+
args: ZodTuple.create(items).rest(ZodUnknown.create())
|
|
33554
|
+
});
|
|
33555
|
+
}
|
|
33556
|
+
returns(returnType) {
|
|
33557
|
+
return new _ZodFunction({
|
|
33558
|
+
...this._def,
|
|
33559
|
+
returns: returnType
|
|
33560
|
+
});
|
|
33561
|
+
}
|
|
33562
|
+
implement(func) {
|
|
33563
|
+
const validatedFunc = this.parse(func);
|
|
33564
|
+
return validatedFunc;
|
|
33565
|
+
}
|
|
33566
|
+
strictImplement(func) {
|
|
33567
|
+
const validatedFunc = this.parse(func);
|
|
33568
|
+
return validatedFunc;
|
|
33569
|
+
}
|
|
33570
|
+
static create(args, returns, params) {
|
|
33571
|
+
return new _ZodFunction({
|
|
33572
|
+
args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
33573
|
+
returns: returns || ZodUnknown.create(),
|
|
33574
|
+
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
33575
|
+
...processCreateParams(params)
|
|
33576
|
+
});
|
|
33577
|
+
}
|
|
33578
|
+
};
|
|
33579
|
+
var ZodLazy = class extends ZodType {
|
|
33580
|
+
get schema() {
|
|
33581
|
+
return this._def.getter();
|
|
33582
|
+
}
|
|
33583
|
+
_parse(input) {
|
|
33584
|
+
const { ctx } = this._processInputParams(input);
|
|
33585
|
+
const lazySchema = this._def.getter();
|
|
33586
|
+
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
33587
|
+
}
|
|
33588
|
+
};
|
|
33589
|
+
ZodLazy.create = (getter, params) => {
|
|
33590
|
+
return new ZodLazy({
|
|
33591
|
+
getter,
|
|
33592
|
+
typeName: ZodFirstPartyTypeKind.ZodLazy,
|
|
33593
|
+
...processCreateParams(params)
|
|
33594
|
+
});
|
|
33595
|
+
};
|
|
33596
|
+
var ZodLiteral = class extends ZodType {
|
|
33597
|
+
_parse(input) {
|
|
33598
|
+
if (input.data !== this._def.value) {
|
|
33599
|
+
const ctx = this._getOrReturnCtx(input);
|
|
33600
|
+
addIssueToContext(ctx, {
|
|
33601
|
+
received: ctx.data,
|
|
33602
|
+
code: ZodIssueCode.invalid_literal,
|
|
33603
|
+
expected: this._def.value
|
|
33604
|
+
});
|
|
33605
|
+
return INVALID;
|
|
33606
|
+
}
|
|
33607
|
+
return { status: "valid", value: input.data };
|
|
33608
|
+
}
|
|
33609
|
+
get value() {
|
|
33610
|
+
return this._def.value;
|
|
33611
|
+
}
|
|
33612
|
+
};
|
|
33613
|
+
ZodLiteral.create = (value, params) => {
|
|
33614
|
+
return new ZodLiteral({
|
|
33615
|
+
value,
|
|
33616
|
+
typeName: ZodFirstPartyTypeKind.ZodLiteral,
|
|
33617
|
+
...processCreateParams(params)
|
|
33618
|
+
});
|
|
33619
|
+
};
|
|
33620
|
+
function createZodEnum(values, params) {
|
|
33621
|
+
return new ZodEnum({
|
|
33622
|
+
values,
|
|
33623
|
+
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
|
33624
|
+
...processCreateParams(params)
|
|
33625
|
+
});
|
|
33626
|
+
}
|
|
33627
|
+
var ZodEnum = class _ZodEnum extends ZodType {
|
|
33628
|
+
_parse(input) {
|
|
33629
|
+
if (typeof input.data !== "string") {
|
|
33630
|
+
const ctx = this._getOrReturnCtx(input);
|
|
33631
|
+
const expectedValues = this._def.values;
|
|
33632
|
+
addIssueToContext(ctx, {
|
|
33633
|
+
expected: util.joinValues(expectedValues),
|
|
33634
|
+
received: ctx.parsedType,
|
|
33635
|
+
code: ZodIssueCode.invalid_type
|
|
33636
|
+
});
|
|
33637
|
+
return INVALID;
|
|
33638
|
+
}
|
|
33639
|
+
if (!this._cache) {
|
|
33640
|
+
this._cache = new Set(this._def.values);
|
|
33641
|
+
}
|
|
33642
|
+
if (!this._cache.has(input.data)) {
|
|
33643
|
+
const ctx = this._getOrReturnCtx(input);
|
|
33644
|
+
const expectedValues = this._def.values;
|
|
33645
|
+
addIssueToContext(ctx, {
|
|
33646
|
+
received: ctx.data,
|
|
33647
|
+
code: ZodIssueCode.invalid_enum_value,
|
|
33648
|
+
options: expectedValues
|
|
33649
|
+
});
|
|
33650
|
+
return INVALID;
|
|
33651
|
+
}
|
|
33652
|
+
return OK(input.data);
|
|
33653
|
+
}
|
|
33654
|
+
get options() {
|
|
33655
|
+
return this._def.values;
|
|
33656
|
+
}
|
|
33657
|
+
get enum() {
|
|
33658
|
+
const enumValues = {};
|
|
33659
|
+
for (const val of this._def.values) {
|
|
33660
|
+
enumValues[val] = val;
|
|
33661
|
+
}
|
|
33662
|
+
return enumValues;
|
|
33663
|
+
}
|
|
33664
|
+
get Values() {
|
|
33665
|
+
const enumValues = {};
|
|
33666
|
+
for (const val of this._def.values) {
|
|
33667
|
+
enumValues[val] = val;
|
|
33668
|
+
}
|
|
33669
|
+
return enumValues;
|
|
33670
|
+
}
|
|
33671
|
+
get Enum() {
|
|
33672
|
+
const enumValues = {};
|
|
33673
|
+
for (const val of this._def.values) {
|
|
33674
|
+
enumValues[val] = val;
|
|
33675
|
+
}
|
|
33676
|
+
return enumValues;
|
|
33677
|
+
}
|
|
33678
|
+
extract(values, newDef = this._def) {
|
|
33679
|
+
return _ZodEnum.create(values, {
|
|
33748
33680
|
...this._def,
|
|
33749
|
-
|
|
33681
|
+
...newDef
|
|
33750
33682
|
});
|
|
33751
33683
|
}
|
|
33752
|
-
|
|
33753
|
-
return
|
|
33684
|
+
exclude(values, newDef = this._def) {
|
|
33685
|
+
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
33754
33686
|
...this._def,
|
|
33755
|
-
|
|
33687
|
+
...newDef
|
|
33756
33688
|
});
|
|
33757
33689
|
}
|
|
33758
|
-
|
|
33759
|
-
|
|
33690
|
+
};
|
|
33691
|
+
ZodEnum.create = createZodEnum;
|
|
33692
|
+
var ZodNativeEnum = class extends ZodType {
|
|
33693
|
+
_parse(input) {
|
|
33694
|
+
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
33695
|
+
const ctx = this._getOrReturnCtx(input);
|
|
33696
|
+
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
33697
|
+
const expectedValues = util.objectValues(nativeEnumValues);
|
|
33698
|
+
addIssueToContext(ctx, {
|
|
33699
|
+
expected: util.joinValues(expectedValues),
|
|
33700
|
+
received: ctx.parsedType,
|
|
33701
|
+
code: ZodIssueCode.invalid_type
|
|
33702
|
+
});
|
|
33703
|
+
return INVALID;
|
|
33704
|
+
}
|
|
33705
|
+
if (!this._cache) {
|
|
33706
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
33707
|
+
}
|
|
33708
|
+
if (!this._cache.has(input.data)) {
|
|
33709
|
+
const expectedValues = util.objectValues(nativeEnumValues);
|
|
33710
|
+
addIssueToContext(ctx, {
|
|
33711
|
+
received: ctx.data,
|
|
33712
|
+
code: ZodIssueCode.invalid_enum_value,
|
|
33713
|
+
options: expectedValues
|
|
33714
|
+
});
|
|
33715
|
+
return INVALID;
|
|
33716
|
+
}
|
|
33717
|
+
return OK(input.data);
|
|
33760
33718
|
}
|
|
33761
|
-
|
|
33762
|
-
return this.
|
|
33719
|
+
get enum() {
|
|
33720
|
+
return this._def.values;
|
|
33763
33721
|
}
|
|
33764
33722
|
};
|
|
33765
|
-
|
|
33766
|
-
return new
|
|
33767
|
-
|
|
33768
|
-
|
|
33769
|
-
maxSize: null,
|
|
33770
|
-
typeName: ZodFirstPartyTypeKind.ZodSet,
|
|
33723
|
+
ZodNativeEnum.create = (values, params) => {
|
|
33724
|
+
return new ZodNativeEnum({
|
|
33725
|
+
values,
|
|
33726
|
+
typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
|
|
33771
33727
|
...processCreateParams(params)
|
|
33772
33728
|
});
|
|
33773
33729
|
};
|
|
33774
|
-
var
|
|
33775
|
-
|
|
33776
|
-
|
|
33777
|
-
this.validate = this.implement;
|
|
33730
|
+
var ZodPromise = class extends ZodType {
|
|
33731
|
+
unwrap() {
|
|
33732
|
+
return this._def.type;
|
|
33778
33733
|
}
|
|
33779
33734
|
_parse(input) {
|
|
33780
33735
|
const { ctx } = this._processInputParams(input);
|
|
33781
|
-
if (ctx.parsedType !== ZodParsedType.
|
|
33736
|
+
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
33782
33737
|
addIssueToContext(ctx, {
|
|
33783
33738
|
code: ZodIssueCode.invalid_type,
|
|
33784
|
-
expected: ZodParsedType.
|
|
33739
|
+
expected: ZodParsedType.promise,
|
|
33785
33740
|
received: ctx.parsedType
|
|
33786
33741
|
});
|
|
33787
33742
|
return INVALID;
|
|
33788
33743
|
}
|
|
33789
|
-
|
|
33790
|
-
|
|
33791
|
-
|
|
33744
|
+
const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
|
|
33745
|
+
return OK(promisified.then((data) => {
|
|
33746
|
+
return this._def.type.parseAsync(data, {
|
|
33792
33747
|
path: ctx.path,
|
|
33793
|
-
|
|
33794
|
-
issueData: {
|
|
33795
|
-
code: ZodIssueCode.invalid_arguments,
|
|
33796
|
-
argumentsError: error2
|
|
33797
|
-
}
|
|
33748
|
+
errorMap: ctx.common.contextualErrorMap
|
|
33798
33749
|
});
|
|
33799
|
-
}
|
|
33800
|
-
|
|
33801
|
-
|
|
33802
|
-
|
|
33803
|
-
|
|
33804
|
-
|
|
33805
|
-
|
|
33806
|
-
|
|
33807
|
-
|
|
33750
|
+
}));
|
|
33751
|
+
}
|
|
33752
|
+
};
|
|
33753
|
+
ZodPromise.create = (schema, params) => {
|
|
33754
|
+
return new ZodPromise({
|
|
33755
|
+
type: schema,
|
|
33756
|
+
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
33757
|
+
...processCreateParams(params)
|
|
33758
|
+
});
|
|
33759
|
+
};
|
|
33760
|
+
var ZodEffects = class extends ZodType {
|
|
33761
|
+
innerType() {
|
|
33762
|
+
return this._def.schema;
|
|
33763
|
+
}
|
|
33764
|
+
sourceType() {
|
|
33765
|
+
return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
33766
|
+
}
|
|
33767
|
+
_parse(input) {
|
|
33768
|
+
const { status, ctx } = this._processInputParams(input);
|
|
33769
|
+
const effect = this._def.effect || null;
|
|
33770
|
+
const checkCtx = {
|
|
33771
|
+
addIssue: (arg) => {
|
|
33772
|
+
addIssueToContext(ctx, arg);
|
|
33773
|
+
if (arg.fatal) {
|
|
33774
|
+
status.abort();
|
|
33775
|
+
} else {
|
|
33776
|
+
status.dirty();
|
|
33808
33777
|
}
|
|
33809
|
-
}
|
|
33810
|
-
|
|
33811
|
-
|
|
33812
|
-
|
|
33813
|
-
|
|
33814
|
-
|
|
33815
|
-
|
|
33816
|
-
|
|
33817
|
-
|
|
33818
|
-
|
|
33819
|
-
|
|
33778
|
+
},
|
|
33779
|
+
get path() {
|
|
33780
|
+
return ctx.path;
|
|
33781
|
+
}
|
|
33782
|
+
};
|
|
33783
|
+
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
33784
|
+
if (effect.type === "preprocess") {
|
|
33785
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
|
33786
|
+
if (ctx.common.async) {
|
|
33787
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
33788
|
+
if (status.value === "aborted")
|
|
33789
|
+
return INVALID;
|
|
33790
|
+
const result = await this._def.schema._parseAsync({
|
|
33791
|
+
data: processed2,
|
|
33792
|
+
path: ctx.path,
|
|
33793
|
+
parent: ctx
|
|
33794
|
+
});
|
|
33795
|
+
if (result.status === "aborted")
|
|
33796
|
+
return INVALID;
|
|
33797
|
+
if (result.status === "dirty")
|
|
33798
|
+
return DIRTY(result.value);
|
|
33799
|
+
if (status.value === "dirty")
|
|
33800
|
+
return DIRTY(result.value);
|
|
33801
|
+
return result;
|
|
33820
33802
|
});
|
|
33821
|
-
|
|
33822
|
-
|
|
33823
|
-
|
|
33824
|
-
|
|
33803
|
+
} else {
|
|
33804
|
+
if (status.value === "aborted")
|
|
33805
|
+
return INVALID;
|
|
33806
|
+
const result = this._def.schema._parseSync({
|
|
33807
|
+
data: processed,
|
|
33808
|
+
path: ctx.path,
|
|
33809
|
+
parent: ctx
|
|
33825
33810
|
});
|
|
33826
|
-
|
|
33827
|
-
|
|
33828
|
-
|
|
33829
|
-
|
|
33830
|
-
|
|
33831
|
-
|
|
33832
|
-
|
|
33833
|
-
|
|
33811
|
+
if (result.status === "aborted")
|
|
33812
|
+
return INVALID;
|
|
33813
|
+
if (result.status === "dirty")
|
|
33814
|
+
return DIRTY(result.value);
|
|
33815
|
+
if (status.value === "dirty")
|
|
33816
|
+
return DIRTY(result.value);
|
|
33817
|
+
return result;
|
|
33818
|
+
}
|
|
33819
|
+
}
|
|
33820
|
+
if (effect.type === "refinement") {
|
|
33821
|
+
const executeRefinement = (acc) => {
|
|
33822
|
+
const result = effect.refinement(acc, checkCtx);
|
|
33823
|
+
if (ctx.common.async) {
|
|
33824
|
+
return Promise.resolve(result);
|
|
33834
33825
|
}
|
|
33835
|
-
|
|
33836
|
-
|
|
33837
|
-
if (!parsedReturns.success) {
|
|
33838
|
-
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
33826
|
+
if (result instanceof Promise) {
|
|
33827
|
+
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
33839
33828
|
}
|
|
33840
|
-
return
|
|
33841
|
-
}
|
|
33829
|
+
return acc;
|
|
33830
|
+
};
|
|
33831
|
+
if (ctx.common.async === false) {
|
|
33832
|
+
const inner = this._def.schema._parseSync({
|
|
33833
|
+
data: ctx.data,
|
|
33834
|
+
path: ctx.path,
|
|
33835
|
+
parent: ctx
|
|
33836
|
+
});
|
|
33837
|
+
if (inner.status === "aborted")
|
|
33838
|
+
return INVALID;
|
|
33839
|
+
if (inner.status === "dirty")
|
|
33840
|
+
status.dirty();
|
|
33841
|
+
executeRefinement(inner.value);
|
|
33842
|
+
return { status: status.value, value: inner.value };
|
|
33843
|
+
} else {
|
|
33844
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
|
|
33845
|
+
if (inner.status === "aborted")
|
|
33846
|
+
return INVALID;
|
|
33847
|
+
if (inner.status === "dirty")
|
|
33848
|
+
status.dirty();
|
|
33849
|
+
return executeRefinement(inner.value).then(() => {
|
|
33850
|
+
return { status: status.value, value: inner.value };
|
|
33851
|
+
});
|
|
33852
|
+
});
|
|
33853
|
+
}
|
|
33842
33854
|
}
|
|
33843
|
-
|
|
33844
|
-
|
|
33845
|
-
|
|
33846
|
-
|
|
33847
|
-
|
|
33848
|
-
|
|
33849
|
-
|
|
33850
|
-
|
|
33851
|
-
|
|
33852
|
-
|
|
33853
|
-
|
|
33854
|
-
|
|
33855
|
-
|
|
33856
|
-
|
|
33857
|
-
|
|
33858
|
-
|
|
33859
|
-
|
|
33860
|
-
|
|
33861
|
-
|
|
33862
|
-
|
|
33863
|
-
|
|
33864
|
-
|
|
33865
|
-
|
|
33866
|
-
|
|
33867
|
-
|
|
33868
|
-
|
|
33869
|
-
}
|
|
33870
|
-
static create(args, returns, params) {
|
|
33871
|
-
return new _ZodFunction({
|
|
33872
|
-
args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
33873
|
-
returns: returns || ZodUnknown.create(),
|
|
33874
|
-
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
33875
|
-
...processCreateParams(params)
|
|
33876
|
-
});
|
|
33855
|
+
if (effect.type === "transform") {
|
|
33856
|
+
if (ctx.common.async === false) {
|
|
33857
|
+
const base = this._def.schema._parseSync({
|
|
33858
|
+
data: ctx.data,
|
|
33859
|
+
path: ctx.path,
|
|
33860
|
+
parent: ctx
|
|
33861
|
+
});
|
|
33862
|
+
if (!isValid(base))
|
|
33863
|
+
return INVALID;
|
|
33864
|
+
const result = effect.transform(base.value, checkCtx);
|
|
33865
|
+
if (result instanceof Promise) {
|
|
33866
|
+
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
33867
|
+
}
|
|
33868
|
+
return { status: status.value, value: result };
|
|
33869
|
+
} else {
|
|
33870
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
33871
|
+
if (!isValid(base))
|
|
33872
|
+
return INVALID;
|
|
33873
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
33874
|
+
status: status.value,
|
|
33875
|
+
value: result
|
|
33876
|
+
}));
|
|
33877
|
+
});
|
|
33878
|
+
}
|
|
33879
|
+
}
|
|
33880
|
+
util.assertNever(effect);
|
|
33877
33881
|
}
|
|
33878
33882
|
};
|
|
33879
|
-
|
|
33880
|
-
|
|
33881
|
-
|
|
33882
|
-
|
|
33883
|
-
|
|
33884
|
-
|
|
33885
|
-
|
|
33886
|
-
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
33887
|
-
}
|
|
33883
|
+
ZodEffects.create = (schema, effect, params) => {
|
|
33884
|
+
return new ZodEffects({
|
|
33885
|
+
schema,
|
|
33886
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
33887
|
+
effect,
|
|
33888
|
+
...processCreateParams(params)
|
|
33889
|
+
});
|
|
33888
33890
|
};
|
|
33889
|
-
|
|
33890
|
-
return new
|
|
33891
|
-
|
|
33892
|
-
|
|
33891
|
+
ZodEffects.createWithPreprocess = (preprocess2, schema, params) => {
|
|
33892
|
+
return new ZodEffects({
|
|
33893
|
+
schema,
|
|
33894
|
+
effect: { type: "preprocess", transform: preprocess2 },
|
|
33895
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
33893
33896
|
...processCreateParams(params)
|
|
33894
33897
|
});
|
|
33895
33898
|
};
|
|
33896
|
-
var
|
|
33899
|
+
var ZodOptional = class extends ZodType {
|
|
33897
33900
|
_parse(input) {
|
|
33898
|
-
|
|
33899
|
-
|
|
33900
|
-
|
|
33901
|
-
received: ctx.data,
|
|
33902
|
-
code: ZodIssueCode.invalid_literal,
|
|
33903
|
-
expected: this._def.value
|
|
33904
|
-
});
|
|
33905
|
-
return INVALID;
|
|
33901
|
+
const parsedType2 = this._getType(input);
|
|
33902
|
+
if (parsedType2 === ZodParsedType.undefined) {
|
|
33903
|
+
return OK(void 0);
|
|
33906
33904
|
}
|
|
33907
|
-
return
|
|
33905
|
+
return this._def.innerType._parse(input);
|
|
33908
33906
|
}
|
|
33909
|
-
|
|
33910
|
-
return this._def.
|
|
33907
|
+
unwrap() {
|
|
33908
|
+
return this._def.innerType;
|
|
33911
33909
|
}
|
|
33912
33910
|
};
|
|
33913
|
-
|
|
33914
|
-
return new
|
|
33915
|
-
|
|
33916
|
-
typeName: ZodFirstPartyTypeKind.
|
|
33911
|
+
ZodOptional.create = (type, params) => {
|
|
33912
|
+
return new ZodOptional({
|
|
33913
|
+
innerType: type,
|
|
33914
|
+
typeName: ZodFirstPartyTypeKind.ZodOptional,
|
|
33917
33915
|
...processCreateParams(params)
|
|
33918
33916
|
});
|
|
33919
33917
|
};
|
|
33920
|
-
|
|
33921
|
-
return new ZodEnum({
|
|
33922
|
-
values,
|
|
33923
|
-
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
|
33924
|
-
...processCreateParams(params)
|
|
33925
|
-
});
|
|
33926
|
-
}
|
|
33927
|
-
var ZodEnum = class _ZodEnum extends ZodType {
|
|
33918
|
+
var ZodNullable = class extends ZodType {
|
|
33928
33919
|
_parse(input) {
|
|
33929
|
-
|
|
33930
|
-
|
|
33931
|
-
|
|
33932
|
-
addIssueToContext(ctx, {
|
|
33933
|
-
expected: util.joinValues(expectedValues),
|
|
33934
|
-
received: ctx.parsedType,
|
|
33935
|
-
code: ZodIssueCode.invalid_type
|
|
33936
|
-
});
|
|
33937
|
-
return INVALID;
|
|
33938
|
-
}
|
|
33939
|
-
if (!this._cache) {
|
|
33940
|
-
this._cache = new Set(this._def.values);
|
|
33941
|
-
}
|
|
33942
|
-
if (!this._cache.has(input.data)) {
|
|
33943
|
-
const ctx = this._getOrReturnCtx(input);
|
|
33944
|
-
const expectedValues = this._def.values;
|
|
33945
|
-
addIssueToContext(ctx, {
|
|
33946
|
-
received: ctx.data,
|
|
33947
|
-
code: ZodIssueCode.invalid_enum_value,
|
|
33948
|
-
options: expectedValues
|
|
33949
|
-
});
|
|
33950
|
-
return INVALID;
|
|
33951
|
-
}
|
|
33952
|
-
return OK(input.data);
|
|
33953
|
-
}
|
|
33954
|
-
get options() {
|
|
33955
|
-
return this._def.values;
|
|
33956
|
-
}
|
|
33957
|
-
get enum() {
|
|
33958
|
-
const enumValues = {};
|
|
33959
|
-
for (const val of this._def.values) {
|
|
33960
|
-
enumValues[val] = val;
|
|
33920
|
+
const parsedType2 = this._getType(input);
|
|
33921
|
+
if (parsedType2 === ZodParsedType.null) {
|
|
33922
|
+
return OK(null);
|
|
33961
33923
|
}
|
|
33962
|
-
return
|
|
33924
|
+
return this._def.innerType._parse(input);
|
|
33963
33925
|
}
|
|
33964
|
-
|
|
33965
|
-
|
|
33966
|
-
for (const val of this._def.values) {
|
|
33967
|
-
enumValues[val] = val;
|
|
33968
|
-
}
|
|
33969
|
-
return enumValues;
|
|
33926
|
+
unwrap() {
|
|
33927
|
+
return this._def.innerType;
|
|
33970
33928
|
}
|
|
33971
|
-
|
|
33972
|
-
|
|
33973
|
-
|
|
33974
|
-
|
|
33929
|
+
};
|
|
33930
|
+
ZodNullable.create = (type, params) => {
|
|
33931
|
+
return new ZodNullable({
|
|
33932
|
+
innerType: type,
|
|
33933
|
+
typeName: ZodFirstPartyTypeKind.ZodNullable,
|
|
33934
|
+
...processCreateParams(params)
|
|
33935
|
+
});
|
|
33936
|
+
};
|
|
33937
|
+
var ZodDefault = class extends ZodType {
|
|
33938
|
+
_parse(input) {
|
|
33939
|
+
const { ctx } = this._processInputParams(input);
|
|
33940
|
+
let data = ctx.data;
|
|
33941
|
+
if (ctx.parsedType === ZodParsedType.undefined) {
|
|
33942
|
+
data = this._def.defaultValue();
|
|
33975
33943
|
}
|
|
33976
|
-
return
|
|
33977
|
-
|
|
33978
|
-
|
|
33979
|
-
|
|
33980
|
-
...this._def,
|
|
33981
|
-
...newDef
|
|
33944
|
+
return this._def.innerType._parse({
|
|
33945
|
+
data,
|
|
33946
|
+
path: ctx.path,
|
|
33947
|
+
parent: ctx
|
|
33982
33948
|
});
|
|
33983
33949
|
}
|
|
33984
|
-
|
|
33985
|
-
return
|
|
33986
|
-
...this._def,
|
|
33987
|
-
...newDef
|
|
33988
|
-
});
|
|
33950
|
+
removeDefault() {
|
|
33951
|
+
return this._def.innerType;
|
|
33989
33952
|
}
|
|
33990
33953
|
};
|
|
33991
|
-
|
|
33992
|
-
|
|
33954
|
+
ZodDefault.create = (type, params) => {
|
|
33955
|
+
return new ZodDefault({
|
|
33956
|
+
innerType: type,
|
|
33957
|
+
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
33958
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
33959
|
+
...processCreateParams(params)
|
|
33960
|
+
});
|
|
33961
|
+
};
|
|
33962
|
+
var ZodCatch = class extends ZodType {
|
|
33993
33963
|
_parse(input) {
|
|
33994
|
-
const
|
|
33995
|
-
const
|
|
33996
|
-
|
|
33997
|
-
|
|
33998
|
-
|
|
33999
|
-
|
|
34000
|
-
|
|
34001
|
-
|
|
34002
|
-
|
|
34003
|
-
|
|
34004
|
-
|
|
34005
|
-
|
|
34006
|
-
|
|
34007
|
-
|
|
34008
|
-
|
|
34009
|
-
|
|
34010
|
-
|
|
34011
|
-
|
|
34012
|
-
|
|
34013
|
-
|
|
33964
|
+
const { ctx } = this._processInputParams(input);
|
|
33965
|
+
const newCtx = {
|
|
33966
|
+
...ctx,
|
|
33967
|
+
common: {
|
|
33968
|
+
...ctx.common,
|
|
33969
|
+
issues: []
|
|
33970
|
+
}
|
|
33971
|
+
};
|
|
33972
|
+
const result = this._def.innerType._parse({
|
|
33973
|
+
data: newCtx.data,
|
|
33974
|
+
path: newCtx.path,
|
|
33975
|
+
parent: {
|
|
33976
|
+
...newCtx
|
|
33977
|
+
}
|
|
33978
|
+
});
|
|
33979
|
+
if (isAsync(result)) {
|
|
33980
|
+
return result.then((result2) => {
|
|
33981
|
+
return {
|
|
33982
|
+
status: "valid",
|
|
33983
|
+
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
33984
|
+
get error() {
|
|
33985
|
+
return new ZodError(newCtx.common.issues);
|
|
33986
|
+
},
|
|
33987
|
+
input: newCtx.data
|
|
33988
|
+
})
|
|
33989
|
+
};
|
|
34014
33990
|
});
|
|
34015
|
-
|
|
33991
|
+
} else {
|
|
33992
|
+
return {
|
|
33993
|
+
status: "valid",
|
|
33994
|
+
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
33995
|
+
get error() {
|
|
33996
|
+
return new ZodError(newCtx.common.issues);
|
|
33997
|
+
},
|
|
33998
|
+
input: newCtx.data
|
|
33999
|
+
})
|
|
34000
|
+
};
|
|
34016
34001
|
}
|
|
34017
|
-
return OK(input.data);
|
|
34018
34002
|
}
|
|
34019
|
-
|
|
34020
|
-
return this._def.
|
|
34003
|
+
removeCatch() {
|
|
34004
|
+
return this._def.innerType;
|
|
34021
34005
|
}
|
|
34022
34006
|
};
|
|
34023
|
-
|
|
34024
|
-
return new
|
|
34025
|
-
|
|
34026
|
-
typeName: ZodFirstPartyTypeKind.
|
|
34007
|
+
ZodCatch.create = (type, params) => {
|
|
34008
|
+
return new ZodCatch({
|
|
34009
|
+
innerType: type,
|
|
34010
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
34011
|
+
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
34027
34012
|
...processCreateParams(params)
|
|
34028
34013
|
});
|
|
34029
34014
|
};
|
|
34030
|
-
var
|
|
34031
|
-
unwrap() {
|
|
34032
|
-
return this._def.type;
|
|
34033
|
-
}
|
|
34015
|
+
var ZodNaN = class extends ZodType {
|
|
34034
34016
|
_parse(input) {
|
|
34035
|
-
const
|
|
34036
|
-
if (
|
|
34017
|
+
const parsedType2 = this._getType(input);
|
|
34018
|
+
if (parsedType2 !== ZodParsedType.nan) {
|
|
34019
|
+
const ctx = this._getOrReturnCtx(input);
|
|
34037
34020
|
addIssueToContext(ctx, {
|
|
34038
34021
|
code: ZodIssueCode.invalid_type,
|
|
34039
|
-
expected: ZodParsedType.
|
|
34022
|
+
expected: ZodParsedType.nan,
|
|
34040
34023
|
received: ctx.parsedType
|
|
34041
34024
|
});
|
|
34042
34025
|
return INVALID;
|
|
34043
34026
|
}
|
|
34044
|
-
|
|
34045
|
-
return OK(promisified.then((data) => {
|
|
34046
|
-
return this._def.type.parseAsync(data, {
|
|
34047
|
-
path: ctx.path,
|
|
34048
|
-
errorMap: ctx.common.contextualErrorMap
|
|
34049
|
-
});
|
|
34050
|
-
}));
|
|
34027
|
+
return { status: "valid", value: input.data };
|
|
34051
34028
|
}
|
|
34052
34029
|
};
|
|
34053
|
-
|
|
34054
|
-
return new
|
|
34055
|
-
|
|
34056
|
-
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
34030
|
+
ZodNaN.create = (params) => {
|
|
34031
|
+
return new ZodNaN({
|
|
34032
|
+
typeName: ZodFirstPartyTypeKind.ZodNaN,
|
|
34057
34033
|
...processCreateParams(params)
|
|
34058
34034
|
});
|
|
34059
34035
|
};
|
|
34060
|
-
var
|
|
34061
|
-
|
|
34062
|
-
|
|
34036
|
+
var BRAND = /* @__PURE__ */ Symbol("zod_brand");
|
|
34037
|
+
var ZodBranded = class extends ZodType {
|
|
34038
|
+
_parse(input) {
|
|
34039
|
+
const { ctx } = this._processInputParams(input);
|
|
34040
|
+
const data = ctx.data;
|
|
34041
|
+
return this._def.type._parse({
|
|
34042
|
+
data,
|
|
34043
|
+
path: ctx.path,
|
|
34044
|
+
parent: ctx
|
|
34045
|
+
});
|
|
34063
34046
|
}
|
|
34064
|
-
|
|
34065
|
-
return this._def.
|
|
34047
|
+
unwrap() {
|
|
34048
|
+
return this._def.type;
|
|
34066
34049
|
}
|
|
34050
|
+
};
|
|
34051
|
+
var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
34067
34052
|
_parse(input) {
|
|
34068
34053
|
const { status, ctx } = this._processInputParams(input);
|
|
34069
|
-
|
|
34070
|
-
|
|
34071
|
-
|
|
34072
|
-
|
|
34073
|
-
|
|
34074
|
-
|
|
34075
|
-
}
|
|
34054
|
+
if (ctx.common.async) {
|
|
34055
|
+
const handleAsync = async () => {
|
|
34056
|
+
const inResult = await this._def.in._parseAsync({
|
|
34057
|
+
data: ctx.data,
|
|
34058
|
+
path: ctx.path,
|
|
34059
|
+
parent: ctx
|
|
34060
|
+
});
|
|
34061
|
+
if (inResult.status === "aborted")
|
|
34062
|
+
return INVALID;
|
|
34063
|
+
if (inResult.status === "dirty") {
|
|
34076
34064
|
status.dirty();
|
|
34077
|
-
|
|
34078
|
-
|
|
34079
|
-
|
|
34080
|
-
|
|
34081
|
-
}
|
|
34082
|
-
};
|
|
34083
|
-
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
34084
|
-
if (effect.type === "preprocess") {
|
|
34085
|
-
const processed = effect.transform(ctx.data, checkCtx);
|
|
34086
|
-
if (ctx.common.async) {
|
|
34087
|
-
return Promise.resolve(processed).then(async (processed2) => {
|
|
34088
|
-
if (status.value === "aborted")
|
|
34089
|
-
return INVALID;
|
|
34090
|
-
const result = await this._def.schema._parseAsync({
|
|
34091
|
-
data: processed2,
|
|
34065
|
+
return DIRTY(inResult.value);
|
|
34066
|
+
} else {
|
|
34067
|
+
return this._def.out._parseAsync({
|
|
34068
|
+
data: inResult.value,
|
|
34092
34069
|
path: ctx.path,
|
|
34093
34070
|
parent: ctx
|
|
34094
34071
|
});
|
|
34095
|
-
|
|
34096
|
-
|
|
34097
|
-
|
|
34098
|
-
|
|
34099
|
-
|
|
34100
|
-
|
|
34101
|
-
|
|
34102
|
-
|
|
34072
|
+
}
|
|
34073
|
+
};
|
|
34074
|
+
return handleAsync();
|
|
34075
|
+
} else {
|
|
34076
|
+
const inResult = this._def.in._parseSync({
|
|
34077
|
+
data: ctx.data,
|
|
34078
|
+
path: ctx.path,
|
|
34079
|
+
parent: ctx
|
|
34080
|
+
});
|
|
34081
|
+
if (inResult.status === "aborted")
|
|
34082
|
+
return INVALID;
|
|
34083
|
+
if (inResult.status === "dirty") {
|
|
34084
|
+
status.dirty();
|
|
34085
|
+
return {
|
|
34086
|
+
status: "dirty",
|
|
34087
|
+
value: inResult.value
|
|
34088
|
+
};
|
|
34103
34089
|
} else {
|
|
34104
|
-
|
|
34105
|
-
|
|
34106
|
-
const result = this._def.schema._parseSync({
|
|
34107
|
-
data: processed,
|
|
34090
|
+
return this._def.out._parseSync({
|
|
34091
|
+
data: inResult.value,
|
|
34108
34092
|
path: ctx.path,
|
|
34109
34093
|
parent: ctx
|
|
34110
34094
|
});
|
|
34111
|
-
if (result.status === "aborted")
|
|
34112
|
-
return INVALID;
|
|
34113
|
-
if (result.status === "dirty")
|
|
34114
|
-
return DIRTY(result.value);
|
|
34115
|
-
if (status.value === "dirty")
|
|
34116
|
-
return DIRTY(result.value);
|
|
34117
|
-
return result;
|
|
34118
34095
|
}
|
|
34119
34096
|
}
|
|
34120
|
-
|
|
34121
|
-
|
|
34122
|
-
|
|
34123
|
-
|
|
34124
|
-
|
|
34097
|
+
}
|
|
34098
|
+
static create(a, b) {
|
|
34099
|
+
return new _ZodPipeline({
|
|
34100
|
+
in: a,
|
|
34101
|
+
out: b,
|
|
34102
|
+
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
34103
|
+
});
|
|
34104
|
+
}
|
|
34105
|
+
};
|
|
34106
|
+
var ZodReadonly = class extends ZodType {
|
|
34107
|
+
_parse(input) {
|
|
34108
|
+
const result = this._def.innerType._parse(input);
|
|
34109
|
+
const freeze = (data) => {
|
|
34110
|
+
if (isValid(data)) {
|
|
34111
|
+
data.value = Object.freeze(data.value);
|
|
34112
|
+
}
|
|
34113
|
+
return data;
|
|
34114
|
+
};
|
|
34115
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
34116
|
+
}
|
|
34117
|
+
unwrap() {
|
|
34118
|
+
return this._def.innerType;
|
|
34119
|
+
}
|
|
34120
|
+
};
|
|
34121
|
+
ZodReadonly.create = (type, params) => {
|
|
34122
|
+
return new ZodReadonly({
|
|
34123
|
+
innerType: type,
|
|
34124
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
34125
|
+
...processCreateParams(params)
|
|
34126
|
+
});
|
|
34127
|
+
};
|
|
34128
|
+
function cleanParams(params, data) {
|
|
34129
|
+
const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
34130
|
+
const p22 = typeof p2 === "string" ? { message: p2 } : p2;
|
|
34131
|
+
return p22;
|
|
34132
|
+
}
|
|
34133
|
+
function custom(check2, _params = {}, fatal) {
|
|
34134
|
+
if (check2)
|
|
34135
|
+
return ZodAny.create().superRefine((data, ctx) => {
|
|
34136
|
+
const r = check2(data);
|
|
34137
|
+
if (r instanceof Promise) {
|
|
34138
|
+
return r.then((r2) => {
|
|
34139
|
+
if (!r2) {
|
|
34140
|
+
const params = cleanParams(_params, data);
|
|
34141
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
34142
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
34143
|
+
}
|
|
34144
|
+
});
|
|
34145
|
+
}
|
|
34146
|
+
if (!r) {
|
|
34147
|
+
const params = cleanParams(_params, data);
|
|
34148
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
34149
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
34150
|
+
}
|
|
34151
|
+
return;
|
|
34152
|
+
});
|
|
34153
|
+
return ZodAny.create();
|
|
34154
|
+
}
|
|
34155
|
+
var late = {
|
|
34156
|
+
object: ZodObject.lazycreate
|
|
34157
|
+
};
|
|
34158
|
+
var ZodFirstPartyTypeKind;
|
|
34159
|
+
(function(ZodFirstPartyTypeKind2) {
|
|
34160
|
+
ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
|
|
34161
|
+
ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
|
|
34162
|
+
ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
|
|
34163
|
+
ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
|
|
34164
|
+
ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
|
|
34165
|
+
ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
|
|
34166
|
+
ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
|
|
34167
|
+
ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
|
|
34168
|
+
ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
|
|
34169
|
+
ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
|
|
34170
|
+
ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
|
|
34171
|
+
ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
|
|
34172
|
+
ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
|
|
34173
|
+
ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
|
|
34174
|
+
ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
|
|
34175
|
+
ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
|
|
34176
|
+
ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
|
|
34177
|
+
ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
|
|
34178
|
+
ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
|
|
34179
|
+
ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
|
|
34180
|
+
ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
|
|
34181
|
+
ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
|
|
34182
|
+
ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
|
|
34183
|
+
ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
|
|
34184
|
+
ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
|
|
34185
|
+
ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
|
|
34186
|
+
ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
|
|
34187
|
+
ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
|
|
34188
|
+
ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
|
|
34189
|
+
ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
|
|
34190
|
+
ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
|
|
34191
|
+
ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
|
|
34192
|
+
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
34193
|
+
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
34194
|
+
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
34195
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
34196
|
+
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
34197
|
+
var instanceOfType = (cls, params = {
|
|
34198
|
+
message: `Input not instance of ${cls.name}`
|
|
34199
|
+
}) => custom((data) => data instanceof cls, params);
|
|
34200
|
+
var stringType = ZodString.create;
|
|
34201
|
+
var numberType = ZodNumber.create;
|
|
34202
|
+
var nanType = ZodNaN.create;
|
|
34203
|
+
var bigIntType = ZodBigInt.create;
|
|
34204
|
+
var booleanType = ZodBoolean.create;
|
|
34205
|
+
var dateType = ZodDate.create;
|
|
34206
|
+
var symbolType = ZodSymbol.create;
|
|
34207
|
+
var undefinedType = ZodUndefined.create;
|
|
34208
|
+
var nullType = ZodNull.create;
|
|
34209
|
+
var anyType = ZodAny.create;
|
|
34210
|
+
var unknownType = ZodUnknown.create;
|
|
34211
|
+
var neverType = ZodNever.create;
|
|
34212
|
+
var voidType = ZodVoid.create;
|
|
34213
|
+
var arrayType = ZodArray.create;
|
|
34214
|
+
var objectType = ZodObject.create;
|
|
34215
|
+
var strictObjectType = ZodObject.strictCreate;
|
|
34216
|
+
var unionType = ZodUnion.create;
|
|
34217
|
+
var discriminatedUnionType = ZodDiscriminatedUnion.create;
|
|
34218
|
+
var intersectionType = ZodIntersection.create;
|
|
34219
|
+
var tupleType = ZodTuple.create;
|
|
34220
|
+
var recordType = ZodRecord.create;
|
|
34221
|
+
var mapType = ZodMap.create;
|
|
34222
|
+
var setType = ZodSet.create;
|
|
34223
|
+
var functionType = ZodFunction.create;
|
|
34224
|
+
var lazyType = ZodLazy.create;
|
|
34225
|
+
var literalType = ZodLiteral.create;
|
|
34226
|
+
var enumType = ZodEnum.create;
|
|
34227
|
+
var nativeEnumType = ZodNativeEnum.create;
|
|
34228
|
+
var promiseType = ZodPromise.create;
|
|
34229
|
+
var effectsType = ZodEffects.create;
|
|
34230
|
+
var optionalType = ZodOptional.create;
|
|
34231
|
+
var nullableType = ZodNullable.create;
|
|
34232
|
+
var preprocessType = ZodEffects.createWithPreprocess;
|
|
34233
|
+
var pipelineType = ZodPipeline.create;
|
|
34234
|
+
var ostring = () => stringType().optional();
|
|
34235
|
+
var onumber = () => numberType().optional();
|
|
34236
|
+
var oboolean = () => booleanType().optional();
|
|
34237
|
+
var coerce = {
|
|
34238
|
+
string: ((arg) => ZodString.create({ ...arg, coerce: true })),
|
|
34239
|
+
number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
|
|
34240
|
+
boolean: ((arg) => ZodBoolean.create({
|
|
34241
|
+
...arg,
|
|
34242
|
+
coerce: true
|
|
34243
|
+
})),
|
|
34244
|
+
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
34245
|
+
date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
|
|
34246
|
+
};
|
|
34247
|
+
var NEVER = INVALID;
|
|
34248
|
+
|
|
34249
|
+
// ../core/dist/dashboards/widget-kinds.js
|
|
34250
|
+
var DASHBOARD_WIDGET_KINDS = ["kpi", "area", "line", "bar", "donut", "table"];
|
|
34251
|
+
var TABLE_CELL_STATES = ["good", "warning", "critical", "info", "neutral", "empty"];
|
|
34252
|
+
var TABLE_WIDGET_LIMITS = { columns: 60, rows: 500, label: 120, cellText: 64 };
|
|
34253
|
+
function categoriesSeriesSchema() {
|
|
34254
|
+
return {
|
|
34255
|
+
type: "object",
|
|
34256
|
+
required: ["categories", "series"],
|
|
34257
|
+
additionalProperties: false,
|
|
34258
|
+
properties: {
|
|
34259
|
+
categories: { type: "array", items: { type: "string" } },
|
|
34260
|
+
series: {
|
|
34261
|
+
type: "array",
|
|
34262
|
+
items: {
|
|
34263
|
+
type: "object",
|
|
34264
|
+
required: ["name", "data"],
|
|
34265
|
+
additionalProperties: false,
|
|
34266
|
+
properties: {
|
|
34267
|
+
name: { type: "string" },
|
|
34268
|
+
data: { type: "array", items: { type: "number" } }
|
|
34269
|
+
}
|
|
34270
|
+
}
|
|
34271
|
+
}
|
|
34272
|
+
}
|
|
34273
|
+
};
|
|
34274
|
+
}
|
|
34275
|
+
function tableSchema() {
|
|
34276
|
+
const L = TABLE_WIDGET_LIMITS;
|
|
34277
|
+
return {
|
|
34278
|
+
type: "object",
|
|
34279
|
+
required: ["columns", "rows"],
|
|
34280
|
+
additionalProperties: false,
|
|
34281
|
+
properties: {
|
|
34282
|
+
rowHeader: { type: "string", maxLength: L.label },
|
|
34283
|
+
columns: { type: "array", minItems: 1, maxItems: L.columns, items: { type: "string", maxLength: L.label } },
|
|
34284
|
+
rows: {
|
|
34285
|
+
type: "array",
|
|
34286
|
+
maxItems: L.rows,
|
|
34287
|
+
items: {
|
|
34288
|
+
type: "object",
|
|
34289
|
+
required: ["label", "cells"],
|
|
34290
|
+
additionalProperties: false,
|
|
34291
|
+
properties: {
|
|
34292
|
+
label: { type: "string", maxLength: L.label },
|
|
34293
|
+
sub: { type: "string", maxLength: L.label },
|
|
34294
|
+
cells: {
|
|
34295
|
+
type: "array",
|
|
34296
|
+
maxItems: L.columns,
|
|
34297
|
+
items: {
|
|
34298
|
+
type: "object",
|
|
34299
|
+
additionalProperties: false,
|
|
34300
|
+
properties: {
|
|
34301
|
+
value: { type: ["string", "number"], maxLength: L.cellText },
|
|
34302
|
+
sub: { type: "string", maxLength: L.cellText },
|
|
34303
|
+
state: { enum: [...TABLE_CELL_STATES] }
|
|
34304
|
+
}
|
|
34305
|
+
}
|
|
34306
|
+
}
|
|
34307
|
+
}
|
|
34125
34308
|
}
|
|
34126
|
-
|
|
34127
|
-
|
|
34309
|
+
},
|
|
34310
|
+
legend: {
|
|
34311
|
+
type: "array",
|
|
34312
|
+
maxItems: TABLE_CELL_STATES.length,
|
|
34313
|
+
items: {
|
|
34314
|
+
type: "object",
|
|
34315
|
+
required: ["state", "label"],
|
|
34316
|
+
additionalProperties: false,
|
|
34317
|
+
properties: {
|
|
34318
|
+
state: { enum: [...TABLE_CELL_STATES] },
|
|
34319
|
+
label: { type: "string", maxLength: L.label }
|
|
34320
|
+
}
|
|
34128
34321
|
}
|
|
34129
|
-
return acc;
|
|
34130
|
-
};
|
|
34131
|
-
if (ctx.common.async === false) {
|
|
34132
|
-
const inner = this._def.schema._parseSync({
|
|
34133
|
-
data: ctx.data,
|
|
34134
|
-
path: ctx.path,
|
|
34135
|
-
parent: ctx
|
|
34136
|
-
});
|
|
34137
|
-
if (inner.status === "aborted")
|
|
34138
|
-
return INVALID;
|
|
34139
|
-
if (inner.status === "dirty")
|
|
34140
|
-
status.dirty();
|
|
34141
|
-
executeRefinement(inner.value);
|
|
34142
|
-
return { status: status.value, value: inner.value };
|
|
34143
|
-
} else {
|
|
34144
|
-
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
|
|
34145
|
-
if (inner.status === "aborted")
|
|
34146
|
-
return INVALID;
|
|
34147
|
-
if (inner.status === "dirty")
|
|
34148
|
-
status.dirty();
|
|
34149
|
-
return executeRefinement(inner.value).then(() => {
|
|
34150
|
-
return { status: status.value, value: inner.value };
|
|
34151
|
-
});
|
|
34152
|
-
});
|
|
34153
34322
|
}
|
|
34154
34323
|
}
|
|
34155
|
-
|
|
34156
|
-
|
|
34157
|
-
|
|
34158
|
-
|
|
34159
|
-
|
|
34160
|
-
|
|
34161
|
-
|
|
34162
|
-
|
|
34163
|
-
|
|
34164
|
-
|
|
34165
|
-
|
|
34166
|
-
|
|
34167
|
-
|
|
34168
|
-
|
|
34169
|
-
} else {
|
|
34170
|
-
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
34171
|
-
if (!isValid(base))
|
|
34172
|
-
return INVALID;
|
|
34173
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
34174
|
-
status: status.value,
|
|
34175
|
-
value: result
|
|
34176
|
-
}));
|
|
34177
|
-
});
|
|
34178
|
-
}
|
|
34324
|
+
};
|
|
34325
|
+
}
|
|
34326
|
+
var DASHBOARD_WIDGET_SCHEMAS = {
|
|
34327
|
+
kpi: {
|
|
34328
|
+
type: "object",
|
|
34329
|
+
required: ["value"],
|
|
34330
|
+
additionalProperties: false,
|
|
34331
|
+
properties: {
|
|
34332
|
+
label: { type: "string" },
|
|
34333
|
+
value: { type: ["string", "number"] },
|
|
34334
|
+
delta: { type: "string" },
|
|
34335
|
+
deltaTone: { enum: ["positive", "negative", "neutral"] },
|
|
34336
|
+
values: { type: "array", items: { type: "number" } },
|
|
34337
|
+
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$" }
|
|
34179
34338
|
}
|
|
34180
|
-
|
|
34181
|
-
|
|
34182
|
-
|
|
34183
|
-
|
|
34184
|
-
|
|
34185
|
-
|
|
34186
|
-
|
|
34187
|
-
|
|
34188
|
-
|
|
34189
|
-
|
|
34190
|
-
}
|
|
34191
|
-
ZodEffects.createWithPreprocess = (preprocess2, schema, params) => {
|
|
34192
|
-
return new ZodEffects({
|
|
34193
|
-
schema,
|
|
34194
|
-
effect: { type: "preprocess", transform: preprocess2 },
|
|
34195
|
-
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
34196
|
-
...processCreateParams(params)
|
|
34197
|
-
});
|
|
34198
|
-
};
|
|
34199
|
-
var ZodOptional = class extends ZodType {
|
|
34200
|
-
_parse(input) {
|
|
34201
|
-
const parsedType2 = this._getType(input);
|
|
34202
|
-
if (parsedType2 === ZodParsedType.undefined) {
|
|
34203
|
-
return OK(void 0);
|
|
34339
|
+
},
|
|
34340
|
+
area: categoriesSeriesSchema(),
|
|
34341
|
+
line: categoriesSeriesSchema(),
|
|
34342
|
+
bar: categoriesSeriesSchema(),
|
|
34343
|
+
donut: {
|
|
34344
|
+
type: "object",
|
|
34345
|
+
required: ["labels", "series"],
|
|
34346
|
+
additionalProperties: false,
|
|
34347
|
+
properties: {
|
|
34348
|
+
labels: { type: "array", items: { type: "string" } },
|
|
34349
|
+
series: { type: "array", items: { type: "number" } }
|
|
34204
34350
|
}
|
|
34205
|
-
|
|
34351
|
+
},
|
|
34352
|
+
table: tableSchema()
|
|
34353
|
+
};
|
|
34354
|
+
|
|
34355
|
+
// ../core/dist/dashboards/y-axis-hints.js
|
|
34356
|
+
var Y_AXIS_WIDGET_KINDS = ["area", "line", "bar"];
|
|
34357
|
+
var Y_AXIS_MAX_TICKS = 21;
|
|
34358
|
+
|
|
34359
|
+
// src/dashboard-widget-def-schema.ts
|
|
34360
|
+
var WidgetDefSchema = external_exports.object({
|
|
34361
|
+
id: external_exports.string().describe("Stable id within the dashboard, e.g. 'kpi.revenue' or 'chart.cashflow'."),
|
|
34362
|
+
kind: external_exports.enum(DASHBOARD_WIDGET_KINDS).describe(
|
|
34363
|
+
`Widget kind. The kind picks both the renderer AND the data shape your refresh must produce:
|
|
34364
|
+
kpi \u2192 { value, [delta], [deltaTone: positive|negative|neutral], [values: number[]], [color: '#rrggbb'], [label] }
|
|
34365
|
+
area \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
34366
|
+
line \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
34367
|
+
bar \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
34368
|
+
donut \u2192 { labels: string[], series: number[] }
|
|
34369
|
+
table \u2192 { [rowHeader], columns: string[], rows: [{ label, [sub], cells: [{ [value], [sub], [state] }] }], [legend: [{ state, label }]] }
|
|
34370
|
+
Exactly one cell per column in every row. state (${TABLE_CELL_STATES.join("|")}) colours the cell. For a grid coloured by category (e.g. work type), map each category to a state and name it in legend.`
|
|
34371
|
+
),
|
|
34372
|
+
title: external_exports.string().optional().describe("Title shown above the widget."),
|
|
34373
|
+
prompt: external_exports.string().describe("What future-you reads on every refresh. Tight, specific \u2014 e.g. 'Total Xero revenue last 30 days. value as $N,NNN AUD (whole dollars \u2014 no cents on dashboards), delta vs prior 30d, values = daily revenue.'"),
|
|
34374
|
+
refresh_cron: external_exports.string().optional().describe('Optional per-widget cron override (e.g. "0 6 * * *" for 6am daily).'),
|
|
34375
|
+
// CS-1708: without this key z.object strips y_axis, and the hint never reaches the host.
|
|
34376
|
+
y_axis: external_exports.object({
|
|
34377
|
+
min: external_exports.number().optional(),
|
|
34378
|
+
max: external_exports.number().optional(),
|
|
34379
|
+
step: external_exports.number().optional(),
|
|
34380
|
+
integer: external_exports.boolean().optional()
|
|
34381
|
+
}).strict().optional().describe(
|
|
34382
|
+
`Optional, for ${Y_AXIS_WIDGET_KINDS.join(", ")} widgets: fix the y axis when the chart counts whole units or has a hard limit. e.g. { min: 0, max: 7, step: 1, integer: true } for days in a week. step must divide max - min (min defaults to 0), with at most ${Y_AXIS_MAX_TICKS} ticks. integer: true on its own gives whole-number ticks sized to the data. Refused on kpi, donut and table widgets.`
|
|
34383
|
+
)
|
|
34384
|
+
});
|
|
34385
|
+
|
|
34386
|
+
// src/kanban-get-error.ts
|
|
34387
|
+
function kanbanGetErrorMessage(status, id, fallbackMessage) {
|
|
34388
|
+
if (status === 400) return "A card id is required.";
|
|
34389
|
+
if (status === 404) return `No card with id "${id}" on your board.`;
|
|
34390
|
+
return `Could not read the card: ${fallbackMessage}`;
|
|
34391
|
+
}
|
|
34392
|
+
|
|
34393
|
+
// src/knowledge-body-render.ts
|
|
34394
|
+
function renderKnowledgeBody(content) {
|
|
34395
|
+
if (content === void 0 || content === null) {
|
|
34396
|
+
return "(!) CONTRACT FAILURE: the API returned no `content` field for this entry. This is NOT an empty entry \u2014 the body was not delivered. Do not treat this as the entry text, and do not knowledge_update from it: an update replaces the whole body and would erase the real one. Report this as a bug.";
|
|
34206
34397
|
}
|
|
34207
|
-
|
|
34208
|
-
return this
|
|
34398
|
+
if (content.length === 0) {
|
|
34399
|
+
return "(empty \u2014 this entry genuinely has no body text)";
|
|
34209
34400
|
}
|
|
34210
|
-
|
|
34211
|
-
|
|
34212
|
-
|
|
34213
|
-
|
|
34214
|
-
|
|
34215
|
-
|
|
34216
|
-
|
|
34217
|
-
|
|
34218
|
-
var
|
|
34219
|
-
|
|
34220
|
-
|
|
34221
|
-
|
|
34222
|
-
|
|
34401
|
+
return content;
|
|
34402
|
+
}
|
|
34403
|
+
|
|
34404
|
+
// src/index.ts
|
|
34405
|
+
import { homedir as homedir3 } from "os";
|
|
34406
|
+
import { basename, isAbsolute as isAbsolute2, join as join6, resolve as pathResolve, sep as sep2 } from "path";
|
|
34407
|
+
|
|
34408
|
+
// src/host-file-path.ts
|
|
34409
|
+
var SKILL_BODY_PATH_MAX_BYTES = 512 * 1024;
|
|
34410
|
+
var AGT_LIVE_CONTENT_PATH_MAX_BYTES = 2 * 1024 * 1024;
|
|
34411
|
+
var HOST_FILE_PATH_TOOLS = /* @__PURE__ */ new Map([
|
|
34412
|
+
[
|
|
34413
|
+
"skill_create",
|
|
34414
|
+
{ pathArg: "body_path", targetArg: "body", maxBytes: SKILL_BODY_PATH_MAX_BYTES, label: "a skill body" }
|
|
34415
|
+
],
|
|
34416
|
+
[
|
|
34417
|
+
"skill_update",
|
|
34418
|
+
{ pathArg: "body_path", targetArg: "body", maxBytes: SKILL_BODY_PATH_MAX_BYTES, label: "a skill body" }
|
|
34419
|
+
],
|
|
34420
|
+
[
|
|
34421
|
+
"agt_live_publish",
|
|
34422
|
+
{
|
|
34423
|
+
pathArg: "content_path",
|
|
34424
|
+
targetArg: "content",
|
|
34425
|
+
maxBytes: AGT_LIVE_CONTENT_PATH_MAX_BYTES,
|
|
34426
|
+
label: "a published page"
|
|
34223
34427
|
}
|
|
34224
|
-
|
|
34428
|
+
]
|
|
34429
|
+
]);
|
|
34430
|
+
function hostFilePathArg(toolName) {
|
|
34431
|
+
return HOST_FILE_PATH_TOOLS.get(toolName)?.pathArg;
|
|
34432
|
+
}
|
|
34433
|
+
function allowedHostFileRoots(agentDir, path) {
|
|
34434
|
+
return [path.join(agentDir, "project"), path.join(agentDir, "scratch")];
|
|
34435
|
+
}
|
|
34436
|
+
function openContained(target, roots, opts) {
|
|
34437
|
+
const { path, fs, procFdBase } = opts;
|
|
34438
|
+
if (!procFdBase) {
|
|
34439
|
+
return {
|
|
34440
|
+
ok: false,
|
|
34441
|
+
error: "reading a host path needs descriptor-relative traversal (procfs), which this platform does not provide. Pass the content inline instead."
|
|
34442
|
+
};
|
|
34225
34443
|
}
|
|
34226
|
-
|
|
34227
|
-
|
|
34444
|
+
const root = roots.find((r) => isContained(target, r, path.sep));
|
|
34445
|
+
if (!root) return { ok: false, error: "resolved outside the allowed roots" };
|
|
34446
|
+
const segments = target.slice(root.length).split(path.sep).filter(Boolean);
|
|
34447
|
+
const fileName = segments[segments.length - 1];
|
|
34448
|
+
if (fileName === void 0) {
|
|
34449
|
+
return { ok: false, error: `'${target}' is a directory, not a file` };
|
|
34228
34450
|
}
|
|
34229
|
-
|
|
34230
|
-
|
|
34231
|
-
|
|
34232
|
-
innerType: type,
|
|
34233
|
-
typeName: ZodFirstPartyTypeKind.ZodNullable,
|
|
34234
|
-
...processCreateParams(params)
|
|
34235
|
-
});
|
|
34236
|
-
};
|
|
34237
|
-
var ZodDefault = class extends ZodType {
|
|
34238
|
-
_parse(input) {
|
|
34239
|
-
const { ctx } = this._processInputParams(input);
|
|
34240
|
-
let data = ctx.data;
|
|
34241
|
-
if (ctx.parsedType === ZodParsedType.undefined) {
|
|
34242
|
-
data = this._def.defaultValue();
|
|
34451
|
+
for (const segment of segments) {
|
|
34452
|
+
if (segment === "." || segment === "..") {
|
|
34453
|
+
return { ok: false, error: `'${target}' contains a '${segment}' component` };
|
|
34243
34454
|
}
|
|
34244
|
-
return this._def.innerType._parse({
|
|
34245
|
-
data,
|
|
34246
|
-
path: ctx.path,
|
|
34247
|
-
parent: ctx
|
|
34248
|
-
});
|
|
34249
34455
|
}
|
|
34250
|
-
|
|
34251
|
-
|
|
34456
|
+
const dirNames = segments.slice(0, -1);
|
|
34457
|
+
let dirFd;
|
|
34458
|
+
try {
|
|
34459
|
+
dirFd = fs.openSync(root, opts.dirOpenFlags);
|
|
34460
|
+
} catch (err) {
|
|
34461
|
+
return { ok: false, error: `the allowed root '${root}' could not be opened \u2014 ${err.message}` };
|
|
34252
34462
|
}
|
|
34253
|
-
|
|
34254
|
-
|
|
34255
|
-
|
|
34256
|
-
|
|
34257
|
-
|
|
34258
|
-
|
|
34259
|
-
...processCreateParams(params)
|
|
34260
|
-
});
|
|
34261
|
-
};
|
|
34262
|
-
var ZodCatch = class extends ZodType {
|
|
34263
|
-
_parse(input) {
|
|
34264
|
-
const { ctx } = this._processInputParams(input);
|
|
34265
|
-
const newCtx = {
|
|
34266
|
-
...ctx,
|
|
34267
|
-
common: {
|
|
34268
|
-
...ctx.common,
|
|
34269
|
-
issues: []
|
|
34270
|
-
}
|
|
34271
|
-
};
|
|
34272
|
-
const result = this._def.innerType._parse({
|
|
34273
|
-
data: newCtx.data,
|
|
34274
|
-
path: newCtx.path,
|
|
34275
|
-
parent: {
|
|
34276
|
-
...newCtx
|
|
34277
|
-
}
|
|
34278
|
-
});
|
|
34279
|
-
if (isAsync(result)) {
|
|
34280
|
-
return result.then((result2) => {
|
|
34463
|
+
try {
|
|
34464
|
+
for (const name of dirNames) {
|
|
34465
|
+
let nextFd;
|
|
34466
|
+
try {
|
|
34467
|
+
nextFd = fs.openSync(path.join(procFdBase, String(dirFd), name), opts.dirOpenFlags);
|
|
34468
|
+
} catch (err) {
|
|
34281
34469
|
return {
|
|
34282
|
-
|
|
34283
|
-
|
|
34284
|
-
get error() {
|
|
34285
|
-
return new ZodError(newCtx.common.issues);
|
|
34286
|
-
},
|
|
34287
|
-
input: newCtx.data
|
|
34288
|
-
})
|
|
34470
|
+
ok: false,
|
|
34471
|
+
error: `'${name}' could not be entered \u2014 it is a symlink, is not a directory, or was replaced mid-traversal (${err.message})`
|
|
34289
34472
|
};
|
|
34290
|
-
}
|
|
34291
|
-
|
|
34473
|
+
}
|
|
34474
|
+
try {
|
|
34475
|
+
fs.closeSync(dirFd);
|
|
34476
|
+
} catch {
|
|
34477
|
+
}
|
|
34478
|
+
dirFd = nextFd;
|
|
34479
|
+
}
|
|
34480
|
+
let fd;
|
|
34481
|
+
try {
|
|
34482
|
+
fd = fs.openSync(path.join(procFdBase, String(dirFd), fileName), opts.openFlags);
|
|
34483
|
+
} catch (err) {
|
|
34292
34484
|
return {
|
|
34293
|
-
|
|
34294
|
-
|
|
34295
|
-
get error() {
|
|
34296
|
-
return new ZodError(newCtx.common.issues);
|
|
34297
|
-
},
|
|
34298
|
-
input: newCtx.data
|
|
34299
|
-
})
|
|
34485
|
+
ok: false,
|
|
34486
|
+
error: `'${fileName}' could not be opened (a symlink, or replaced mid-check) \u2014 ${err.message}`
|
|
34300
34487
|
};
|
|
34301
34488
|
}
|
|
34489
|
+
return { ok: true, fd };
|
|
34490
|
+
} finally {
|
|
34491
|
+
try {
|
|
34492
|
+
fs.closeSync(dirFd);
|
|
34493
|
+
} catch {
|
|
34494
|
+
}
|
|
34302
34495
|
}
|
|
34303
|
-
|
|
34304
|
-
|
|
34496
|
+
}
|
|
34497
|
+
function isContained(candidate, root, sep3) {
|
|
34498
|
+
if (candidate === root) return true;
|
|
34499
|
+
const rootWithSep = root.endsWith(sep3) ? root : root + sep3;
|
|
34500
|
+
return candidate.startsWith(rootWithSep);
|
|
34501
|
+
}
|
|
34502
|
+
function resolveHostFilePath(toolName, args, opts) {
|
|
34503
|
+
const spec = HOST_FILE_PATH_TOOLS.get(toolName);
|
|
34504
|
+
if (!spec) return { ok: true, args };
|
|
34505
|
+
const raw = args[spec.pathArg];
|
|
34506
|
+
if (raw === void 0 || raw === null) return { ok: true, args };
|
|
34507
|
+
if (typeof raw !== "string" || raw.trim() === "") {
|
|
34508
|
+
return { ok: false, error: `${spec.pathArg} must be a non-empty string.` };
|
|
34305
34509
|
}
|
|
34306
|
-
|
|
34307
|
-
|
|
34308
|
-
|
|
34309
|
-
|
|
34310
|
-
|
|
34311
|
-
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
34312
|
-
...processCreateParams(params)
|
|
34313
|
-
});
|
|
34314
|
-
};
|
|
34315
|
-
var ZodNaN = class extends ZodType {
|
|
34316
|
-
_parse(input) {
|
|
34317
|
-
const parsedType2 = this._getType(input);
|
|
34318
|
-
if (parsedType2 !== ZodParsedType.nan) {
|
|
34319
|
-
const ctx = this._getOrReturnCtx(input);
|
|
34320
|
-
addIssueToContext(ctx, {
|
|
34321
|
-
code: ZodIssueCode.invalid_type,
|
|
34322
|
-
expected: ZodParsedType.nan,
|
|
34323
|
-
received: ctx.parsedType
|
|
34324
|
-
});
|
|
34325
|
-
return INVALID;
|
|
34326
|
-
}
|
|
34327
|
-
return { status: "valid", value: input.data };
|
|
34510
|
+
if (typeof args[spec.targetArg] === "string") {
|
|
34511
|
+
return {
|
|
34512
|
+
ok: false,
|
|
34513
|
+
error: `Pass either ${spec.targetArg} or ${spec.pathArg}, not both \u2014 they are two ways to say the same thing and I will not guess which one you meant.`
|
|
34514
|
+
};
|
|
34328
34515
|
}
|
|
34329
|
-
};
|
|
34330
|
-
|
|
34331
|
-
|
|
34332
|
-
|
|
34333
|
-
|
|
34334
|
-
|
|
34335
|
-
|
|
34336
|
-
|
|
34337
|
-
|
|
34338
|
-
_parse(input) {
|
|
34339
|
-
const { ctx } = this._processInputParams(input);
|
|
34340
|
-
const data = ctx.data;
|
|
34341
|
-
return this._def.type._parse({
|
|
34342
|
-
data,
|
|
34343
|
-
path: ctx.path,
|
|
34344
|
-
parent: ctx
|
|
34345
|
-
});
|
|
34516
|
+
const { agentDir, path, fs } = opts;
|
|
34517
|
+
const maxBytes = opts.maxBytes ?? spec.maxBytes;
|
|
34518
|
+
const roots = allowedHostFileRoots(agentDir, path);
|
|
34519
|
+
const absolute = path.isAbsolute(raw) ? path.resolve(raw) : path.resolve(path.join(agentDir, "project"), raw);
|
|
34520
|
+
if (!roots.some((r) => isContained(absolute, r, path.sep))) {
|
|
34521
|
+
return {
|
|
34522
|
+
ok: false,
|
|
34523
|
+
error: `${spec.pathArg} must be inside your own project or scratch directory. Got '${raw}'. Allowed: ${roots.join(", ")}`
|
|
34524
|
+
};
|
|
34346
34525
|
}
|
|
34347
|
-
|
|
34348
|
-
|
|
34526
|
+
let real;
|
|
34527
|
+
try {
|
|
34528
|
+
real = fs.realpathSync(absolute);
|
|
34529
|
+
} catch {
|
|
34530
|
+
return { ok: false, error: `${spec.pathArg} does not exist or is unreadable: '${raw}'` };
|
|
34349
34531
|
}
|
|
34350
|
-
|
|
34351
|
-
|
|
34352
|
-
|
|
34353
|
-
|
|
34354
|
-
|
|
34355
|
-
|
|
34356
|
-
|
|
34357
|
-
|
|
34358
|
-
|
|
34359
|
-
|
|
34360
|
-
|
|
34361
|
-
|
|
34362
|
-
|
|
34363
|
-
|
|
34364
|
-
|
|
34365
|
-
|
|
34366
|
-
|
|
34367
|
-
|
|
34368
|
-
|
|
34369
|
-
|
|
34370
|
-
|
|
34371
|
-
|
|
34372
|
-
}
|
|
34373
|
-
};
|
|
34374
|
-
|
|
34375
|
-
|
|
34376
|
-
|
|
34377
|
-
|
|
34378
|
-
|
|
34379
|
-
|
|
34380
|
-
|
|
34381
|
-
|
|
34382
|
-
|
|
34383
|
-
|
|
34384
|
-
|
|
34385
|
-
|
|
34386
|
-
|
|
34387
|
-
|
|
34388
|
-
|
|
34389
|
-
|
|
34390
|
-
|
|
34391
|
-
|
|
34392
|
-
path: ctx.path,
|
|
34393
|
-
parent: ctx
|
|
34394
|
-
});
|
|
34395
|
-
}
|
|
34532
|
+
if (!roots.some((r) => isContained(real, r, path.sep))) {
|
|
34533
|
+
return {
|
|
34534
|
+
ok: false,
|
|
34535
|
+
error: `${spec.pathArg} resolves outside your own directories (symlink?). '${raw}' \u2192 '${real}'. Allowed: ${roots.join(", ")}`
|
|
34536
|
+
};
|
|
34537
|
+
}
|
|
34538
|
+
const opened = openContained(real, roots, opts);
|
|
34539
|
+
if (!opened.ok) return { ok: false, error: `${spec.pathArg}: ${opened.error} ('${raw}')` };
|
|
34540
|
+
const fd = opened.fd;
|
|
34541
|
+
try {
|
|
34542
|
+
let stat;
|
|
34543
|
+
try {
|
|
34544
|
+
stat = fs.fstatSync(fd);
|
|
34545
|
+
} catch {
|
|
34546
|
+
return { ok: false, error: `${spec.pathArg} could not be inspected: '${raw}'` };
|
|
34547
|
+
}
|
|
34548
|
+
if (!stat.isFile()) {
|
|
34549
|
+
return { ok: false, error: `${spec.pathArg} is not a regular file: '${raw}'` };
|
|
34550
|
+
}
|
|
34551
|
+
if (stat.size > maxBytes) {
|
|
34552
|
+
return {
|
|
34553
|
+
ok: false,
|
|
34554
|
+
error: `${spec.pathArg} is ${stat.size} bytes, over the ${maxBytes}-byte limit for ${spec.label}.`
|
|
34555
|
+
};
|
|
34556
|
+
}
|
|
34557
|
+
let bytes;
|
|
34558
|
+
try {
|
|
34559
|
+
bytes = fs.readFdSync(fd, maxBytes);
|
|
34560
|
+
} catch (err) {
|
|
34561
|
+
return { ok: false, error: `${spec.pathArg} could not be read: ${err.message}` };
|
|
34562
|
+
}
|
|
34563
|
+
if (bytes.byteLength > maxBytes) {
|
|
34564
|
+
return { ok: false, error: `${spec.pathArg} grew past the ${maxBytes}-byte limit while being read.` };
|
|
34565
|
+
}
|
|
34566
|
+
const value = fs.decodeUtf8(bytes);
|
|
34567
|
+
const next = { ...args, [spec.targetArg]: value };
|
|
34568
|
+
delete next[spec.pathArg];
|
|
34569
|
+
return { ok: true, args: next };
|
|
34570
|
+
} finally {
|
|
34571
|
+
try {
|
|
34572
|
+
fs.closeSync(fd);
|
|
34573
|
+
} catch {
|
|
34396
34574
|
}
|
|
34397
34575
|
}
|
|
34398
|
-
|
|
34399
|
-
|
|
34400
|
-
|
|
34401
|
-
|
|
34402
|
-
|
|
34403
|
-
|
|
34576
|
+
}
|
|
34577
|
+
|
|
34578
|
+
// src/artefact-work-dir.ts
|
|
34579
|
+
import { mkdir, mkdtemp } from "fs/promises";
|
|
34580
|
+
import { existsSync } from "fs";
|
|
34581
|
+
import { dirname, join as join2 } from "path";
|
|
34582
|
+
|
|
34583
|
+
// ../core/dist/provisioning/frameworks/claudecode/agent-dir-alias.js
|
|
34584
|
+
import { isAbsolute, join, relative, sep } from "path";
|
|
34585
|
+
var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
34586
|
+
var VALID_AGENT_ID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
34587
|
+
var INITIATOR_BASENAME = ".current-turn-initiator.json";
|
|
34588
|
+
function isSafeAgentSegment(segment) {
|
|
34589
|
+
return VALID_CODE_NAME.test(segment) || VALID_AGENT_ID.test(segment);
|
|
34590
|
+
}
|
|
34591
|
+
function initiatorDirSegment(initiatorFile, homeDir) {
|
|
34592
|
+
const rel = relative(join(homeDir, ".augmented"), initiatorFile);
|
|
34593
|
+
if (!rel || isAbsolute(rel))
|
|
34594
|
+
return null;
|
|
34595
|
+
const parts = rel.split(sep);
|
|
34596
|
+
if (parts.length !== 2 || parts[1] !== INITIATOR_BASENAME)
|
|
34597
|
+
return null;
|
|
34598
|
+
const segment = parts[0];
|
|
34599
|
+
if (segment === void 0)
|
|
34600
|
+
return null;
|
|
34601
|
+
return isSafeAgentSegment(segment) ? segment : null;
|
|
34602
|
+
}
|
|
34603
|
+
function resolveAgentDirAlias(input) {
|
|
34604
|
+
const { codeName, turnInitiatorFile, agentId, homeDir } = input;
|
|
34605
|
+
const codeNameTrimmed = typeof codeName === "string" ? codeName.trim() : "";
|
|
34606
|
+
if (codeNameTrimmed && VALID_CODE_NAME.test(codeNameTrimmed)) {
|
|
34607
|
+
return join(homeDir, ".augmented", codeNameTrimmed);
|
|
34404
34608
|
}
|
|
34405
|
-
|
|
34406
|
-
|
|
34407
|
-
|
|
34408
|
-
|
|
34409
|
-
|
|
34410
|
-
if (isValid(data)) {
|
|
34411
|
-
data.value = Object.freeze(data.value);
|
|
34412
|
-
}
|
|
34413
|
-
return data;
|
|
34414
|
-
};
|
|
34415
|
-
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
34609
|
+
const initiator = typeof turnInitiatorFile === "string" ? turnInitiatorFile.trim() : "";
|
|
34610
|
+
if (initiator) {
|
|
34611
|
+
const segment = initiatorDirSegment(initiator, homeDir);
|
|
34612
|
+
if (segment)
|
|
34613
|
+
return join(homeDir, ".augmented", segment);
|
|
34416
34614
|
}
|
|
34417
|
-
|
|
34418
|
-
|
|
34615
|
+
const agentIdTrimmed = typeof agentId === "string" ? agentId.trim() : "";
|
|
34616
|
+
if (agentIdTrimmed && VALID_AGENT_ID.test(agentIdTrimmed)) {
|
|
34617
|
+
return join(homeDir, ".augmented", agentIdTrimmed);
|
|
34419
34618
|
}
|
|
34420
|
-
|
|
34421
|
-
ZodReadonly.create = (type, params) => {
|
|
34422
|
-
return new ZodReadonly({
|
|
34423
|
-
innerType: type,
|
|
34424
|
-
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
34425
|
-
...processCreateParams(params)
|
|
34426
|
-
});
|
|
34427
|
-
};
|
|
34428
|
-
function cleanParams(params, data) {
|
|
34429
|
-
const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
34430
|
-
const p22 = typeof p2 === "string" ? { message: p2 } : p2;
|
|
34431
|
-
return p22;
|
|
34619
|
+
return null;
|
|
34432
34620
|
}
|
|
34433
|
-
function
|
|
34434
|
-
|
|
34435
|
-
|
|
34436
|
-
|
|
34437
|
-
|
|
34438
|
-
|
|
34439
|
-
|
|
34440
|
-
|
|
34441
|
-
|
|
34442
|
-
|
|
34443
|
-
|
|
34444
|
-
|
|
34445
|
-
|
|
34446
|
-
|
|
34447
|
-
|
|
34448
|
-
|
|
34449
|
-
|
|
34450
|
-
|
|
34451
|
-
|
|
34452
|
-
|
|
34453
|
-
return
|
|
34621
|
+
function resolveAgentScratchDir(input) {
|
|
34622
|
+
const alias = resolveAgentDirAlias(input);
|
|
34623
|
+
return alias === null ? null : join(alias, "scratch");
|
|
34624
|
+
}
|
|
34625
|
+
|
|
34626
|
+
// src/artefact-work-dir.ts
|
|
34627
|
+
async function makeArtefactWorkDir(prefix, env2) {
|
|
34628
|
+
const scratch = resolveAgentScratchDir(env2);
|
|
34629
|
+
if (scratch === null) {
|
|
34630
|
+
throw new Error(
|
|
34631
|
+
"Cannot save the artefact: none of AGT_AGENT_CODE_NAME, AGT_TURN_INITIATOR_FILE or AGT_AGENT_ID is set, so this server cannot tell which agent directory the file belongs in."
|
|
34632
|
+
);
|
|
34633
|
+
}
|
|
34634
|
+
const agentDir = dirname(scratch);
|
|
34635
|
+
if (!existsSync(agentDir)) {
|
|
34636
|
+
throw new Error(
|
|
34637
|
+
`Cannot save the artefact: the agent directory ${agentDir} does not exist on this host.`
|
|
34638
|
+
);
|
|
34639
|
+
}
|
|
34640
|
+
await mkdir(scratch, { recursive: true });
|
|
34641
|
+
return mkdtemp(join2(scratch, prefix));
|
|
34454
34642
|
}
|
|
34455
|
-
var late = {
|
|
34456
|
-
object: ZodObject.lazycreate
|
|
34457
|
-
};
|
|
34458
|
-
var ZodFirstPartyTypeKind;
|
|
34459
|
-
(function(ZodFirstPartyTypeKind2) {
|
|
34460
|
-
ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
|
|
34461
|
-
ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
|
|
34462
|
-
ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
|
|
34463
|
-
ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
|
|
34464
|
-
ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
|
|
34465
|
-
ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
|
|
34466
|
-
ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
|
|
34467
|
-
ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
|
|
34468
|
-
ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
|
|
34469
|
-
ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
|
|
34470
|
-
ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
|
|
34471
|
-
ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
|
|
34472
|
-
ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
|
|
34473
|
-
ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
|
|
34474
|
-
ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
|
|
34475
|
-
ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
|
|
34476
|
-
ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
|
|
34477
|
-
ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
|
|
34478
|
-
ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
|
|
34479
|
-
ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
|
|
34480
|
-
ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
|
|
34481
|
-
ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
|
|
34482
|
-
ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
|
|
34483
|
-
ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
|
|
34484
|
-
ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
|
|
34485
|
-
ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
|
|
34486
|
-
ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
|
|
34487
|
-
ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
|
|
34488
|
-
ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
|
|
34489
|
-
ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
|
|
34490
|
-
ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
|
|
34491
|
-
ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
|
|
34492
|
-
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
34493
|
-
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
34494
|
-
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
34495
|
-
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
34496
|
-
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
34497
|
-
var instanceOfType = (cls, params = {
|
|
34498
|
-
message: `Input not instance of ${cls.name}`
|
|
34499
|
-
}) => custom((data) => data instanceof cls, params);
|
|
34500
|
-
var stringType = ZodString.create;
|
|
34501
|
-
var numberType = ZodNumber.create;
|
|
34502
|
-
var nanType = ZodNaN.create;
|
|
34503
|
-
var bigIntType = ZodBigInt.create;
|
|
34504
|
-
var booleanType = ZodBoolean.create;
|
|
34505
|
-
var dateType = ZodDate.create;
|
|
34506
|
-
var symbolType = ZodSymbol.create;
|
|
34507
|
-
var undefinedType = ZodUndefined.create;
|
|
34508
|
-
var nullType = ZodNull.create;
|
|
34509
|
-
var anyType = ZodAny.create;
|
|
34510
|
-
var unknownType = ZodUnknown.create;
|
|
34511
|
-
var neverType = ZodNever.create;
|
|
34512
|
-
var voidType = ZodVoid.create;
|
|
34513
|
-
var arrayType = ZodArray.create;
|
|
34514
|
-
var objectType = ZodObject.create;
|
|
34515
|
-
var strictObjectType = ZodObject.strictCreate;
|
|
34516
|
-
var unionType = ZodUnion.create;
|
|
34517
|
-
var discriminatedUnionType = ZodDiscriminatedUnion.create;
|
|
34518
|
-
var intersectionType = ZodIntersection.create;
|
|
34519
|
-
var tupleType = ZodTuple.create;
|
|
34520
|
-
var recordType = ZodRecord.create;
|
|
34521
|
-
var mapType = ZodMap.create;
|
|
34522
|
-
var setType = ZodSet.create;
|
|
34523
|
-
var functionType = ZodFunction.create;
|
|
34524
|
-
var lazyType = ZodLazy.create;
|
|
34525
|
-
var literalType = ZodLiteral.create;
|
|
34526
|
-
var enumType = ZodEnum.create;
|
|
34527
|
-
var nativeEnumType = ZodNativeEnum.create;
|
|
34528
|
-
var promiseType = ZodPromise.create;
|
|
34529
|
-
var effectsType = ZodEffects.create;
|
|
34530
|
-
var optionalType = ZodOptional.create;
|
|
34531
|
-
var nullableType = ZodNullable.create;
|
|
34532
|
-
var preprocessType = ZodEffects.createWithPreprocess;
|
|
34533
|
-
var pipelineType = ZodPipeline.create;
|
|
34534
|
-
var ostring = () => stringType().optional();
|
|
34535
|
-
var onumber = () => numberType().optional();
|
|
34536
|
-
var oboolean = () => booleanType().optional();
|
|
34537
|
-
var coerce = {
|
|
34538
|
-
string: ((arg) => ZodString.create({ ...arg, coerce: true })),
|
|
34539
|
-
number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
|
|
34540
|
-
boolean: ((arg) => ZodBoolean.create({
|
|
34541
|
-
...arg,
|
|
34542
|
-
coerce: true
|
|
34543
|
-
})),
|
|
34544
|
-
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
34545
|
-
date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
|
|
34546
|
-
};
|
|
34547
|
-
var NEVER = INVALID;
|
|
34548
34643
|
|
|
34549
34644
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/core.js
|
|
34550
34645
|
var NEVER2 = Object.freeze({
|
|
@@ -48807,22 +48902,6 @@ server.tool(
|
|
|
48807
48902
|
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
48808
48903
|
}
|
|
48809
48904
|
);
|
|
48810
|
-
var WidgetDefSchema = external_exports.object({
|
|
48811
|
-
id: external_exports.string().describe("Stable id within the dashboard, e.g. 'kpi.revenue' or 'chart.cashflow'."),
|
|
48812
|
-
kind: external_exports.enum(DASHBOARD_WIDGET_KINDS).describe(
|
|
48813
|
-
`Widget kind. The kind picks both the renderer AND the data shape your refresh must produce:
|
|
48814
|
-
kpi \u2192 { value, [delta], [deltaTone: positive|negative|neutral], [values: number[]], [color: '#rrggbb'], [label] }
|
|
48815
|
-
area \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
48816
|
-
line \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
48817
|
-
bar \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
48818
|
-
donut \u2192 { labels: string[], series: number[] }
|
|
48819
|
-
table \u2192 { [rowHeader], columns: string[], rows: [{ label, [sub], cells: [{ [value], [sub], [state] }] }], [legend: [{ state, label }]] }
|
|
48820
|
-
Exactly one cell per column in every row. state (${TABLE_CELL_STATES.join("|")}) colours the cell. For a grid coloured by category (e.g. work type), map each category to a state and name it in legend.`
|
|
48821
|
-
),
|
|
48822
|
-
title: external_exports.string().optional().describe("Title shown above the widget."),
|
|
48823
|
-
prompt: external_exports.string().describe("What future-you reads on every refresh. Tight, specific \u2014 e.g. 'Total Xero revenue last 30 days. value as $N,NNN AUD (whole dollars \u2014 no cents on dashboards), delta vs prior 30d, values = daily revenue.'"),
|
|
48824
|
-
refresh_cron: external_exports.string().optional().describe('Optional per-widget cron override (e.g. "0 6 * * *" for 6am daily).')
|
|
48825
|
-
});
|
|
48826
48905
|
server.tool(
|
|
48827
48906
|
"dashboards_list",
|
|
48828
48907
|
'List dashboards visible to your team. Use to answer "what dashboards exist", "show me the dashboards I built", or before authoring a new one to avoid duplicating an existing slug.',
|