@usenaive-sdk/blueprints 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -203,6 +203,10 @@ var AUDIT_ACTIONS_P3 = [
203
203
  "app.db_queried",
204
204
  /** A ticket was minted that lets one browser past an app's own operator gate (§29.7). */
205
205
  "app.entered",
206
+ /** The dashboard password was read — the one audited reveal of an app secret (§29.7, ADR-0656). */
207
+ "app.access_read",
208
+ /** The dashboard password was regenerated (and a lost `DASHBOARD_TOKEN` copy repaired). */
209
+ "app.access_rotated",
206
210
  /** A link was minted that serves one file's bytes to anyone holding it, for seven days (§40). */
207
211
  "file.linked",
208
212
  "blueprint.installed",
@@ -411,6 +415,19 @@ var AuditEntrySchema = z3.object({
411
415
  var BROWSER_MAX_TIMEOUT_MINUTES = 360;
412
416
  var BROWSER_REGIONS = ["us-west", "us-east", "eu-central", "ap-southeast"];
413
417
  var BROWSER_OS = ["windows", "mac", "linux", "mobile", "tablet"];
418
+ var BROWSER_TOOL_ACTIONS = [
419
+ "goto",
420
+ "click",
421
+ "type",
422
+ "extract",
423
+ "act",
424
+ "observe",
425
+ "links",
426
+ "screenshot",
427
+ "login",
428
+ "signup",
429
+ "save_context"
430
+ ];
414
431
  var BrowserOptionsSchema = z4.object({
415
432
  allowed_domains: z4.array(z4.string().min(1)).min(1),
416
433
  timeout_minutes: z4.number().int().min(1).max(BROWSER_MAX_TIMEOUT_MINUTES).default(15),
@@ -426,7 +443,8 @@ var BrowserOptionsSchema = z4.object({
426
443
  context_name: z4.string().min(1).max(64).optional(),
427
444
  persist_context: z4.boolean().default(false),
428
445
  human_login: z4.boolean().default(false),
429
- proxy: z4.boolean().default(false)
446
+ proxy: z4.boolean().default(false),
447
+ ask_actions: z4.array(z4.enum(BROWSER_TOOL_ACTIONS)).default(["signup"])
430
448
  }).refine((options) => !(options.proxy && options.allowed_domains.includes("*")), {
431
449
  error: "a proxied browser needs a bounded allow-list, not *",
432
450
  path: ["proxy"]
@@ -590,6 +608,9 @@ function normaliseMultiagent(value) {
590
608
  if (value === false || value === null) return null;
591
609
  return value;
592
610
  }
611
+ var HandoffsField = z5.union([z5.boolean(), z5.literal("team"), z5.array(z5.string().min(1)).max(50)]);
612
+ var handoffsOf = (config) => config.handoffs ?? true;
613
+ var handoffsEnabled = (handoffs) => handoffs === true || handoffs === "team" || handoffs !== false && handoffs.length > 0;
593
614
  var agentConfigShape = {
594
615
  model: z5.string(),
595
616
  window: WindowSchema,
@@ -598,6 +619,8 @@ var agentConfigShape = {
598
619
  mcp_servers: z5.array(McpServerSchema),
599
620
  skills: z5.array(SkillRefSchema),
600
621
  multiagent: MultiagentField,
622
+ /** Optional on the type so a version minted before §28.15 still parses; read it through `handoffsOf`. */
623
+ handoffs: HandoffsField.optional(),
601
624
  budget: BudgetSchema,
602
625
  output_schema: JsonSchemaDocument.nullable(),
603
626
  structured_output_required: z5.boolean(),
@@ -1238,6 +1261,12 @@ var AppSchema = z13.object({
1238
1261
  error: z13.string().nullable(),
1239
1262
  /** Where the app serves MCP, or `null`. The bearer token for it is a server column. */
1240
1263
  mcp: AppMcpPathSchema.nullable(),
1264
+ /**
1265
+ * Is this a gated blueprint dashboard — one the Studio opens through `/apps/{id}/open` rather
1266
+ * than linking its `url` (`§29.1`)? True when the platform holds the app's `DASHBOARD_TOKEN`
1267
+ * or a secret of that name exists on the app; derived on read, never stored.
1268
+ */
1269
+ dashboard: z13.boolean(),
1241
1270
  created_at: Timestamp
1242
1271
  });
1243
1272
  var AppDeploymentStatusSchema = z13.enum(["queued", "building", "ready", "error"]);
@@ -1269,6 +1298,11 @@ var AppEntrySchema = z13.object({
1269
1298
  url: z13.string(),
1270
1299
  ticket: z13.string()
1271
1300
  });
1301
+ var AppAccessSchema = z13.object({
1302
+ object: z13.literal("app_access"),
1303
+ url: z13.string().nullable(),
1304
+ password: z13.string().nullable()
1305
+ });
1272
1306
  var AppDomainStatusSchema = z13.enum(["pending", "connected", "failed"]);
1273
1307
  var AppDomainSchema = z13.object({
1274
1308
  object: z13.literal("app_domain"),
@@ -1586,37 +1620,58 @@ var SocialCommentSchema = z17.object({
1586
1620
  data: z17.unknown()
1587
1621
  });
1588
1622
 
1589
- // ../core/src/schema/media.ts
1623
+ // ../core/src/schema/handoff.ts
1590
1624
  import { z as z18 } from "zod";
1625
+ var HandoffRequestSchema = z18.object({
1626
+ agent: z18.string().min(1),
1627
+ message: z18.string().min(1),
1628
+ handoff_key: z18.string().min(1).max(128).optional(),
1629
+ budget_micro_usd: z18.number().int().positive().optional()
1630
+ });
1631
+ var HandoffSchema = z18.object({
1632
+ object: z18.literal("handoff"),
1633
+ session_id: idOf("ses"),
1634
+ status: z18.enum(["queued", "already_running"]),
1635
+ handoff_key: z18.string().nullable()
1636
+ });
1637
+ var SessionHandoffSchema = z18.object({
1638
+ from_session: idOf("ses"),
1639
+ from_agent: idOf("agt"),
1640
+ key: z18.string().nullable(),
1641
+ depth: z18.number().int().positive()
1642
+ });
1643
+
1644
+ // ../core/src/schema/media.ts
1645
+ import { z as z19 } from "zod";
1591
1646
  var MEDIA_JOB_KINDS = ["video", "clip", "transcription"];
1592
- var MediaJobKindSchema = z18.enum(MEDIA_JOB_KINDS);
1593
- var MediaJobStatusSchema = z18.enum(["queued", "processing", "completed", "failed"]);
1594
- var PublicUrl = z18.string().url().startsWith("http");
1595
- var Score = z18.number().int().min(0).max(100);
1596
- var Seconds = z18.number().nonnegative();
1597
- var VideoResultSchema = z18.object({
1598
- files: z18.array(
1599
- z18.object({
1647
+ var MediaJobKindSchema = z19.enum(MEDIA_JOB_KINDS);
1648
+ var MediaJobStatusSchema = z19.enum(["queued", "processing", "completed", "failed"]);
1649
+ var PublicUrl = z19.string().url().startsWith("http");
1650
+ var Score = z19.number().int().min(0).max(100);
1651
+ var Seconds = z19.number().nonnegative();
1652
+ var VideoResultSchema = z19.object({
1653
+ files: z19.array(
1654
+ z19.object({
1600
1655
  file_id: idOf("fil"),
1601
- content_type: z18.string(),
1602
- width: z18.number().int().positive().nullable(),
1603
- height: z18.number().int().positive().nullable(),
1656
+ content_type: z19.string(),
1657
+ width: z19.number().int().positive().nullable(),
1658
+ height: z19.number().int().positive().nullable(),
1604
1659
  duration_seconds: Seconds.nullable()
1605
1660
  })
1606
1661
  )
1607
1662
  });
1608
- var ViralityScoreSchema = z18.object({
1663
+ var ViralityScoreSchema = z19.object({
1609
1664
  total: Score,
1610
1665
  shareability: Score,
1611
1666
  hook_strength: Score,
1612
1667
  story_quality: Score,
1613
1668
  emotional_impact: Score
1614
1669
  });
1615
- var ClipResultSchema = z18.object({
1616
- clips: z18.array(
1617
- z18.object({
1670
+ var ClipResultSchema = z19.object({
1671
+ clips: z19.array(
1672
+ z19.object({
1618
1673
  file_id: idOf("fil"),
1619
- title: z18.string(),
1674
+ title: z19.string(),
1620
1675
  start_seconds: Seconds,
1621
1676
  end_seconds: Seconds,
1622
1677
  duration_seconds: Seconds,
@@ -1624,189 +1679,189 @@ var ClipResultSchema = z18.object({
1624
1679
  })
1625
1680
  )
1626
1681
  });
1627
- var TranscriptSchema = z18.object({
1628
- text: z18.string(),
1629
- language: z18.string().nullable(),
1682
+ var TranscriptSchema = z19.object({
1683
+ text: z19.string(),
1684
+ language: z19.string().nullable(),
1630
1685
  duration_seconds: Seconds.nullable(),
1631
- segments: z18.array(z18.object({ start_seconds: Seconds, end_seconds: Seconds, text: z18.string() }))
1686
+ segments: z19.array(z19.object({ start_seconds: Seconds, end_seconds: Seconds, text: z19.string() }))
1632
1687
  });
1633
- var MediaJobResultSchema = z18.union([VideoResultSchema, ClipResultSchema, TranscriptSchema]);
1634
- var MediaJobSchema = z18.object({
1688
+ var MediaJobResultSchema = z19.union([VideoResultSchema, ClipResultSchema, TranscriptSchema]);
1689
+ var MediaJobSchema = z19.object({
1635
1690
  id: idOf("med"),
1636
- object: z18.literal("media_job"),
1691
+ object: z19.literal("media_job"),
1637
1692
  kind: MediaJobKindSchema,
1638
1693
  status: MediaJobStatusSchema,
1639
- model: z18.string().nullable(),
1640
- input: z18.record(z18.string(), z18.unknown()),
1694
+ model: z19.string().nullable(),
1695
+ input: z19.record(z19.string(), z19.unknown()),
1641
1696
  result: MediaJobResultSchema.nullable(),
1642
- error: z18.object({ code: z18.string(), message: z18.string() }).nullable(),
1697
+ error: z19.object({ code: z19.string(), message: z19.string() }).nullable(),
1643
1698
  cost_micro_usd: MicroUsdField.nullable(),
1644
1699
  session_id: idOf("ses").nullable(),
1645
1700
  created_at: Timestamp,
1646
1701
  completed_at: Timestamp.nullable()
1647
1702
  });
1648
- var ImageRequestSchema = z18.object({
1649
- model: z18.string().min(1).optional(),
1650
- prompt: z18.string().min(1),
1651
- image_urls: z18.array(PublicUrl).max(4).optional(),
1652
- aspect_ratio: z18.string().optional(),
1653
- seed: z18.number().int().optional(),
1654
- n: z18.number().int().min(1).max(4).default(1)
1655
- });
1656
- var VideoRequestSchema = z18.object({
1657
- model: z18.string().min(1),
1658
- prompt: z18.string().min(1),
1659
- image_urls: z18.array(PublicUrl).max(1).optional(),
1660
- aspect_ratio: z18.string().optional(),
1661
- seed: z18.number().int().optional(),
1662
- seconds: z18.number().int().min(1).max(60).optional()
1663
- });
1664
- var ImageGenerationSchema = z18.object({
1665
- object: z18.literal("image_generation"),
1666
- model: z18.string(),
1667
- files: z18.array(FileSchema),
1703
+ var ImageRequestSchema = z19.object({
1704
+ model: z19.string().min(1).optional(),
1705
+ prompt: z19.string().min(1),
1706
+ image_urls: z19.array(PublicUrl).max(4).optional(),
1707
+ aspect_ratio: z19.string().optional(),
1708
+ seed: z19.number().int().optional(),
1709
+ n: z19.number().int().min(1).max(4).default(1)
1710
+ });
1711
+ var VideoRequestSchema = z19.object({
1712
+ model: z19.string().min(1),
1713
+ prompt: z19.string().min(1),
1714
+ image_urls: z19.array(PublicUrl).max(1).optional(),
1715
+ aspect_ratio: z19.string().optional(),
1716
+ seed: z19.number().int().optional(),
1717
+ seconds: z19.number().int().min(1).max(60).optional()
1718
+ });
1719
+ var ImageGenerationSchema = z19.object({
1720
+ object: z19.literal("image_generation"),
1721
+ model: z19.string(),
1722
+ files: z19.array(FileSchema),
1668
1723
  cost_micro_usd: MicroUsdField
1669
1724
  });
1670
- var ClipLength = z18.number().int().min(5).max(180);
1671
- var ClipRequestSchema = z18.object({
1725
+ var ClipLength = z19.number().int().min(5).max(180);
1726
+ var ClipRequestSchema = z19.object({
1672
1727
  video_url: PublicUrl,
1673
- aspect_ratio: z18.enum(["9:16", "16:9"]).default("9:16"),
1674
- remove_silence: z18.boolean().default(false),
1675
- caption_preset: z18.enum(["none", "clean", "bold", "karaoke"]).default("none"),
1676
- language: z18.string().min(2).optional(),
1728
+ aspect_ratio: z19.enum(["9:16", "16:9"]).default("9:16"),
1729
+ remove_silence: z19.boolean().default(false),
1730
+ caption_preset: z19.enum(["none", "clean", "bold", "karaoke"]).default("none"),
1731
+ language: z19.string().min(2).optional(),
1677
1732
  min_seconds: ClipLength.default(15),
1678
1733
  max_seconds: ClipLength.default(60),
1679
- title: z18.string().min(1).optional()
1734
+ title: z19.string().min(1).optional()
1680
1735
  });
1681
- var AudioFormatSchema = z18.enum(["mp3", "wav", "ogg"]);
1682
- var TranscriptionRequestSchema = z18.object({
1683
- model: z18.string().min(1).optional(),
1736
+ var AudioFormatSchema = z19.enum(["mp3", "wav", "ogg"]);
1737
+ var TranscriptionRequestSchema = z19.object({
1738
+ model: z19.string().min(1).optional(),
1684
1739
  file_id: idOf("fil").optional(),
1685
1740
  url: PublicUrl.optional(),
1686
- language: z18.string().min(2).optional(),
1687
- timestamps: z18.boolean().default(true)
1741
+ language: z19.string().min(2).optional(),
1742
+ timestamps: z19.boolean().default(true)
1688
1743
  }).refine((request) => request.file_id === void 0 !== (request.url === void 0), {
1689
1744
  error: "exactly one of file_id or url",
1690
1745
  path: ["file_id"]
1691
1746
  });
1692
- var SpeechRequestSchema = z18.object({
1693
- model: z18.string().min(1).optional(),
1694
- text: z18.string().min(1).max(4096),
1695
- voice: z18.string().min(1).optional(),
1747
+ var SpeechRequestSchema = z19.object({
1748
+ model: z19.string().min(1).optional(),
1749
+ text: z19.string().min(1).max(4096),
1750
+ voice: z19.string().min(1).optional(),
1696
1751
  format: AudioFormatSchema.default("mp3"),
1697
- speed: z18.number().min(0.5).max(2).optional()
1752
+ speed: z19.number().min(0.5).max(2).optional()
1698
1753
  });
1699
- var SpeechToSpeechRequestSchema = z18.object({
1700
- model: z18.string().min(1).optional(),
1754
+ var SpeechToSpeechRequestSchema = z19.object({
1755
+ model: z19.string().min(1).optional(),
1701
1756
  file_id: idOf("fil"),
1702
- voice: z18.string().min(1).optional(),
1757
+ voice: z19.string().min(1).optional(),
1703
1758
  format: AudioFormatSchema.default("mp3")
1704
1759
  });
1705
- var SpeechGenerationSchema = z18.object({
1706
- object: z18.literal("speech_generation"),
1707
- model: z18.string(),
1760
+ var SpeechGenerationSchema = z19.object({
1761
+ object: z19.literal("speech_generation"),
1762
+ model: z19.string(),
1708
1763
  file: FileSchema,
1709
1764
  duration_seconds: Seconds.nullable(),
1710
1765
  cost_micro_usd: MicroUsdField
1711
1766
  });
1712
1767
 
1713
1768
  // ../core/src/schema/app-data.ts
1714
- import { z as z19 } from "zod";
1715
- var DbTableSchema = z19.object({
1716
- object: z19.literal("db_table"),
1717
- name: z19.string(),
1718
- schema: z19.string().default("public"),
1719
- rows: z19.number().int().nonnegative().nullable(),
1720
- size_bytes: z19.number().int().nonnegative().nullable()
1721
- });
1722
- var DbMigrationSchema = z19.object({
1769
+ import { z as z20 } from "zod";
1770
+ var DbTableSchema = z20.object({
1771
+ object: z20.literal("db_table"),
1772
+ name: z20.string(),
1773
+ schema: z20.string().default("public"),
1774
+ rows: z20.number().int().nonnegative().nullable(),
1775
+ size_bytes: z20.number().int().nonnegative().nullable()
1776
+ });
1777
+ var DbMigrationSchema = z20.object({
1723
1778
  id: idOf("dbm"),
1724
- object: z19.literal("db_migration"),
1725
- name: z19.string(),
1726
- sha256: z19.string().regex(/^[0-9a-f]{64}$/),
1779
+ object: z20.literal("db_migration"),
1780
+ name: z20.string(),
1781
+ sha256: z20.string().regex(/^[0-9a-f]{64}$/),
1727
1782
  applied_at: Timestamp,
1728
- statements: z19.number().int().nonnegative()
1783
+ statements: z20.number().int().nonnegative()
1729
1784
  });
1730
- var ApplyDbMigrationSchema = z19.object({
1731
- name: z19.string().min(1).max(128).regex(/^[a-z0-9][a-z0-9_-]*$/),
1732
- sql: z19.string().min(1)
1785
+ var ApplyDbMigrationSchema = z20.object({
1786
+ name: z20.string().min(1).max(128).regex(/^[a-z0-9][a-z0-9_-]*$/),
1787
+ sql: z20.string().min(1)
1733
1788
  });
1734
1789
  var DB_REST_METHODS = ["GET", "POST", "PATCH", "PUT", "DELETE", "HEAD"];
1735
- var DbRestMethodSchema = z19.enum(DB_REST_METHODS);
1790
+ var DbRestMethodSchema = z20.enum(DB_REST_METHODS);
1736
1791
  var BUCKET_NAME = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
1737
- var BucketSchema = z19.object({
1738
- object: z19.literal("bucket"),
1739
- name: z19.string().regex(BUCKET_NAME),
1740
- public: z19.boolean(),
1792
+ var BucketSchema = z20.object({
1793
+ object: z20.literal("bucket"),
1794
+ name: z20.string().regex(BUCKET_NAME),
1795
+ public: z20.boolean(),
1741
1796
  created_at: Timestamp
1742
1797
  });
1743
- var CreateBucketSchema = z19.object({
1744
- name: z19.string().regex(BUCKET_NAME, { error: "3\u201363 lowercase letters, digits and hyphens" }),
1745
- public: z19.boolean().default(false)
1746
- });
1747
- var StorageObjectSchema = z19.object({
1748
- object: z19.literal("storage_object"),
1749
- bucket: z19.string(),
1750
- key: z19.string().min(1),
1751
- size_bytes: z19.number().int().nonnegative(),
1752
- content_type: z19.string(),
1753
- etag: z19.string().nullable(),
1798
+ var CreateBucketSchema = z20.object({
1799
+ name: z20.string().regex(BUCKET_NAME, { error: "3\u201363 lowercase letters, digits and hyphens" }),
1800
+ public: z20.boolean().default(false)
1801
+ });
1802
+ var StorageObjectSchema = z20.object({
1803
+ object: z20.literal("storage_object"),
1804
+ bucket: z20.string(),
1805
+ key: z20.string().min(1),
1806
+ size_bytes: z20.number().int().nonnegative(),
1807
+ content_type: z20.string(),
1808
+ etag: z20.string().nullable(),
1754
1809
  updated_at: Timestamp
1755
1810
  });
1756
- var SignedUrlMethodSchema = z19.enum(["PUT", "GET"]);
1757
- var SignedUrlSchema = z19.object({
1758
- object: z19.literal("signed_url"),
1759
- url: z19.string().url(),
1811
+ var SignedUrlMethodSchema = z20.enum(["PUT", "GET"]);
1812
+ var SignedUrlSchema = z20.object({
1813
+ object: z20.literal("signed_url"),
1814
+ url: z20.string().url(),
1760
1815
  method: SignedUrlMethodSchema,
1761
1816
  expires_at: Timestamp
1762
1817
  });
1763
- var CreateUploadUrlSchema = z19.object({
1764
- content_type: z19.string().min(1),
1765
- expires_seconds: z19.number().int().min(60).max(3600).default(900)
1818
+ var CreateUploadUrlSchema = z20.object({
1819
+ content_type: z20.string().min(1),
1820
+ expires_seconds: z20.number().int().min(60).max(3600).default(900)
1766
1821
  });
1767
1822
 
1768
1823
  // ../core/src/schema/stock-photo.ts
1769
- import { z as z20 } from "zod";
1824
+ import { z as z21 } from "zod";
1770
1825
  var STOCK_PHOTO_ORIENTATIONS = ["landscape", "portrait", "square"];
1771
1826
  var STOCK_PHOTO_SIZES = ["small", "medium", "large"];
1772
- var StockPhotoQuerySchema = z20.object({
1773
- query: z20.string().min(1).max(200),
1774
- count: z20.coerce.number().int().min(1).max(30).default(10),
1775
- orientation: z20.enum(STOCK_PHOTO_ORIENTATIONS).optional(),
1776
- color: z20.string().min(1).max(32).optional(),
1777
- size: z20.enum(STOCK_PHOTO_SIZES).optional()
1778
- });
1779
- var StockPhotoSchema = z20.object({
1780
- object: z20.literal("stock_photo"),
1781
- id: z20.string().min(1),
1782
- width: z20.number().int().positive(),
1783
- height: z20.number().int().positive(),
1784
- url: z20.string().url(),
1785
- preview_url: z20.string().url(),
1786
- alt: z20.string().nullable(),
1787
- photographer: z20.string().nullable(),
1788
- attribution_url: z20.string().url().nullable(),
1789
- dominant_color: z20.string().nullable()
1827
+ var StockPhotoQuerySchema = z21.object({
1828
+ query: z21.string().min(1).max(200),
1829
+ count: z21.coerce.number().int().min(1).max(30).default(10),
1830
+ orientation: z21.enum(STOCK_PHOTO_ORIENTATIONS).optional(),
1831
+ color: z21.string().min(1).max(32).optional(),
1832
+ size: z21.enum(STOCK_PHOTO_SIZES).optional()
1833
+ });
1834
+ var StockPhotoSchema = z21.object({
1835
+ object: z21.literal("stock_photo"),
1836
+ id: z21.string().min(1),
1837
+ width: z21.number().int().positive(),
1838
+ height: z21.number().int().positive(),
1839
+ url: z21.string().url(),
1840
+ preview_url: z21.string().url(),
1841
+ alt: z21.string().nullable(),
1842
+ photographer: z21.string().nullable(),
1843
+ attribution_url: z21.string().url().nullable(),
1844
+ dominant_color: z21.string().nullable()
1790
1845
  });
1791
1846
 
1792
1847
  // ../core/src/schema/creator.ts
1793
- import { z as z21 } from "zod";
1794
- var CreatorCodeSchema = z21.string().regex(/^[a-z0-9]{3,24}$/, "3 to 24 lowercase letters or digits");
1795
- var PayoutMethodSchema = z21.enum(["wise", "paypal"]);
1796
- var PayoutDetailsSchema = z21.object({
1848
+ import { z as z22 } from "zod";
1849
+ var CreatorCodeSchema = z22.string().regex(/^[a-z0-9]{3,24}$/, "3 to 24 lowercase letters or digits");
1850
+ var PayoutMethodSchema = z22.enum(["wise", "paypal"]);
1851
+ var PayoutDetailsSchema = z22.object({
1797
1852
  method: PayoutMethodSchema,
1798
- account: z21.string().min(1).max(320)
1853
+ account: z22.string().min(1).max(320)
1799
1854
  });
1800
- var CreatorStatusSchema = z21.enum(["active", "suspended"]);
1801
- var CreatorSchema = z21.object({
1855
+ var CreatorStatusSchema = z22.enum(["active", "suspended"]);
1856
+ var CreatorSchema = z22.object({
1802
1857
  id: idOf("crt"),
1803
- object: z21.literal("creator"),
1804
- email: z21.email(),
1805
- display_name: z21.string().min(1).max(80),
1858
+ object: z22.literal("creator"),
1859
+ email: z22.email(),
1860
+ display_name: z22.string().min(1).max(80),
1806
1861
  code: CreatorCodeSchema,
1807
1862
  status: CreatorStatusSchema,
1808
1863
  payout: PayoutDetailsSchema.nullable(),
1809
- clicks: z21.number().int().nonnegative(),
1864
+ clicks: z22.number().int().nonnegative(),
1810
1865
  created_at: Timestamp,
1811
1866
  updated_at: Timestamp
1812
1867
  });
@@ -1814,28 +1869,28 @@ var IdentityCreatorSchema = CreatorSchema.pick({
1814
1869
  id: true,
1815
1870
  status: true
1816
1871
  });
1817
- var CreatorApplicationStatusSchema = z21.enum([
1872
+ var CreatorApplicationStatusSchema = z22.enum([
1818
1873
  "pending",
1819
1874
  "approved",
1820
1875
  "rejected"
1821
1876
  ]);
1822
- var CreatorApplicationSchema = z21.object({
1877
+ var CreatorApplicationSchema = z22.object({
1823
1878
  id: idOf("cra"),
1824
- object: z21.literal("creator_application"),
1825
- email: z21.email(),
1826
- display_name: z21.string().min(1).max(80),
1827
- pitch: z21.string().min(1).max(2e3),
1828
- links: z21.array(z21.url({ protocol: /^https$/ })).max(5),
1879
+ object: z22.literal("creator_application"),
1880
+ email: z22.email(),
1881
+ display_name: z22.string().min(1).max(80),
1882
+ pitch: z22.string().min(1).max(2e3),
1883
+ links: z22.array(z22.url({ protocol: /^https$/ })).max(5),
1829
1884
  status: CreatorApplicationStatusSchema,
1830
- note: z21.string().nullable(),
1885
+ note: z22.string().nullable(),
1831
1886
  creator_id: idOf("crt").nullable(),
1832
1887
  created_at: Timestamp,
1833
1888
  decided_at: Timestamp.nullable()
1834
1889
  });
1835
- var ReferralStatusSchema = z21.enum(["pending", "active", "expired"]);
1836
- var ReferralSchema = z21.object({
1890
+ var ReferralStatusSchema = z22.enum(["pending", "active", "expired"]);
1891
+ var ReferralSchema = z22.object({
1837
1892
  id: idOf("crf"),
1838
- object: z21.literal("referral"),
1893
+ object: z22.literal("referral"),
1839
1894
  creator_id: idOf("crt"),
1840
1895
  organization_id: idOf("org"),
1841
1896
  status: ReferralStatusSchema,
@@ -1843,16 +1898,16 @@ var ReferralSchema = z21.object({
1843
1898
  first_paid_at: Timestamp.nullable(),
1844
1899
  commission_until: Timestamp.nullable()
1845
1900
  });
1846
- var CommissionKindSchema = z21.enum(["referral", "template"]);
1847
- var CommissionStatusSchema = z21.enum([
1901
+ var CommissionKindSchema = z22.enum(["referral", "template"]);
1902
+ var CommissionStatusSchema = z22.enum([
1848
1903
  "pending",
1849
1904
  "available",
1850
1905
  "claimed",
1851
1906
  "paid"
1852
1907
  ]);
1853
- var CommissionSchema = z21.object({
1908
+ var CommissionSchema = z22.object({
1854
1909
  id: idOf("crc"),
1855
- object: z21.literal("commission"),
1910
+ object: z22.literal("commission"),
1856
1911
  creator_id: idOf("crt"),
1857
1912
  kind: CommissionKindSchema,
1858
1913
  referral_id: idOf("crf").nullable(),
@@ -1865,18 +1920,18 @@ var CommissionSchema = z21.object({
1865
1920
  available_at: Timestamp,
1866
1921
  payout_id: idOf("crp").nullable()
1867
1922
  });
1868
- var PayoutStatusSchema = z21.enum(["requested", "paid", "rejected"]);
1869
- var PayoutSchema = z21.object({
1923
+ var PayoutStatusSchema = z22.enum(["requested", "paid", "rejected"]);
1924
+ var PayoutSchema = z22.object({
1870
1925
  id: idOf("crp"),
1871
- object: z21.literal("payout"),
1926
+ object: z22.literal("payout"),
1872
1927
  creator_id: idOf("crt"),
1873
1928
  amount_micro_usd: MicroUsdField.positive(),
1874
- currency: z21.literal("USD"),
1929
+ currency: z22.literal("USD"),
1875
1930
  method: PayoutMethodSchema,
1876
- account: z21.string().min(1),
1931
+ account: z22.string().min(1),
1877
1932
  status: PayoutStatusSchema,
1878
- reference: z21.string().nullable(),
1879
- note: z21.string().nullable(),
1933
+ reference: z22.string().nullable(),
1934
+ note: z22.string().nullable(),
1880
1935
  requested_at: Timestamp,
1881
1936
  decided_at: Timestamp.nullable()
1882
1937
  });
@@ -1888,100 +1943,100 @@ var CREATOR_PROGRAM = {
1888
1943
  attribution_days: 30,
1889
1944
  minimum_payout_micro_usd: 2e7
1890
1945
  };
1891
- var CreatorTemplateSlugSchema = z21.string().max(32).regex(
1946
+ var CreatorTemplateSlugSchema = z22.string().max(32).regex(
1892
1947
  /^[a-z0-9]+(-[a-z0-9]+)*$/,
1893
1948
  "lowercase letters, digits and single dashes"
1894
1949
  );
1895
- var CreatorSkillSchema = z21.object({
1896
- slug: z21.string().regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes"),
1897
- body: z21.string().min(1).max(64 * 1024)
1950
+ var CreatorSkillSchema = z22.object({
1951
+ slug: z22.string().regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes"),
1952
+ body: z22.string().min(1).max(64 * 1024)
1898
1953
  });
1899
- var CreatorDeclarationSchema = z21.object({
1900
- agents: z21.array(z21.unknown()),
1901
- questions: z21.array(z21.unknown()),
1902
- skills: z21.array(CreatorSkillSchema).max(16)
1954
+ var CreatorDeclarationSchema = z22.object({
1955
+ agents: z22.array(z22.unknown()),
1956
+ questions: z22.array(z22.unknown()),
1957
+ skills: z22.array(CreatorSkillSchema).max(16)
1903
1958
  });
1904
- var CreatorTemplateVersionStatusSchema = z21.enum([
1959
+ var CreatorTemplateVersionStatusSchema = z22.enum([
1905
1960
  "in_review",
1906
1961
  "approved",
1907
1962
  "changes_requested"
1908
1963
  ]);
1909
- var VersionNumber = z21.number().int().positive();
1910
- var CreatorTemplateSchema = z21.object({
1964
+ var VersionNumber = z22.number().int().positive();
1965
+ var CreatorTemplateSchema = z22.object({
1911
1966
  id: idOf("ctp"),
1912
- object: z21.literal("creator_template"),
1967
+ object: z22.literal("creator_template"),
1913
1968
  creator_id: idOf("crt"),
1914
- blueprint: z21.string().min(1),
1915
- base_template: z21.string().min(1),
1969
+ blueprint: z22.string().min(1),
1970
+ base_template: z22.string().min(1),
1916
1971
  slug: CreatorTemplateSlugSchema,
1917
- template: z21.string().min(1).max(64),
1918
- name: z21.string().min(1).max(80),
1919
- description: z21.string().max(2e3),
1972
+ template: z22.string().min(1).max(64),
1973
+ name: z22.string().min(1).max(80),
1974
+ description: z22.string().max(2e3),
1920
1975
  declaration: CreatorDeclarationSchema,
1921
1976
  published_version: VersionNumber.nullable(),
1922
- latest_version: z21.object({
1977
+ latest_version: z22.object({
1923
1978
  version: VersionNumber,
1924
1979
  status: CreatorTemplateVersionStatusSchema
1925
1980
  }).nullable(),
1926
1981
  created_at: Timestamp,
1927
1982
  updated_at: Timestamp
1928
1983
  });
1929
- var CreatorTemplateVersionSchema = z21.object({
1930
- object: z21.literal("creator_template_version"),
1984
+ var CreatorTemplateVersionSchema = z22.object({
1985
+ object: z22.literal("creator_template_version"),
1931
1986
  template_id: idOf("ctp"),
1932
1987
  version: VersionNumber,
1933
1988
  declaration: CreatorDeclarationSchema,
1934
1989
  status: CreatorTemplateVersionStatusSchema,
1935
- note: z21.string().nullable(),
1990
+ note: z22.string().nullable(),
1936
1991
  artifact_id: idOf("bpa").nullable(),
1937
1992
  submitted_at: Timestamp,
1938
1993
  decided_at: Timestamp.nullable()
1939
1994
  });
1940
- var CreatorBalanceSchema = z21.object({
1941
- object: z21.literal("creator_balance"),
1995
+ var CreatorBalanceSchema = z22.object({
1996
+ object: z22.literal("creator_balance"),
1942
1997
  pending_micro_usd: MicroUsdField.nonnegative(),
1943
1998
  available_micro_usd: MicroUsdField.nonnegative(),
1944
1999
  claimed_micro_usd: MicroUsdField.nonnegative(),
1945
2000
  paid_micro_usd: MicroUsdField.nonnegative(),
1946
- minimum_payout_micro_usd: z21.literal(CREATOR_PROGRAM.minimum_payout_micro_usd)
2001
+ minimum_payout_micro_usd: z22.literal(CREATOR_PROGRAM.minimum_payout_micro_usd)
1947
2002
  });
1948
- var ReferralClickSchema = z21.object({
1949
- object: z21.literal("referral_click"),
2003
+ var ReferralClickSchema = z22.object({
2004
+ object: z22.literal("referral_click"),
1950
2005
  code: CreatorCodeSchema,
1951
- creator: z21.object({ display_name: z21.string().min(1) }),
2006
+ creator: z22.object({ display_name: z22.string().min(1) }),
1952
2007
  expires_at: Timestamp
1953
2008
  });
1954
- var Day = z21.iso.date();
1955
- var CreatorAnalyticsSchema = z21.object({
1956
- object: z21.literal("creator_analytics"),
1957
- days: z21.number().int().min(1).max(90),
2009
+ var Day = z22.iso.date();
2010
+ var CreatorAnalyticsSchema = z22.object({
2011
+ object: z22.literal("creator_analytics"),
2012
+ days: z22.number().int().min(1).max(90),
1958
2013
  from: Day,
1959
2014
  to: Day,
1960
- clicks: z21.number().int().nonnegative(),
1961
- referrals: z21.number().int().nonnegative(),
1962
- installs: z21.number().int().nonnegative(),
1963
- active_installs: z21.number().int().nonnegative(),
1964
- usage_by_day: z21.array(
1965
- z21.object({ day: Day, debit_micro_usd: MicroUsdField.nonnegative() })
2015
+ clicks: z22.number().int().nonnegative(),
2016
+ referrals: z22.number().int().nonnegative(),
2017
+ installs: z22.number().int().nonnegative(),
2018
+ active_installs: z22.number().int().nonnegative(),
2019
+ usage_by_day: z22.array(
2020
+ z22.object({ day: Day, debit_micro_usd: MicroUsdField.nonnegative() })
1966
2021
  ),
1967
- commission_micro_usd: z21.object({
2022
+ commission_micro_usd: z22.object({
1968
2023
  pending: MicroUsdField.nonnegative(),
1969
2024
  available: MicroUsdField.nonnegative(),
1970
2025
  claimed: MicroUsdField.nonnegative(),
1971
2026
  paid: MicroUsdField.nonnegative()
1972
2027
  }),
1973
- commissions_by_template: z21.array(
1974
- z21.object({
2028
+ commissions_by_template: z22.array(
2029
+ z22.object({
1975
2030
  creator_template_id: idOf("ctp"),
1976
2031
  amount_micro_usd: MicroUsdField.nonnegative()
1977
2032
  })
1978
2033
  ),
1979
2034
  /** Every install covered, newest first: the day it was created and the day its twelve months end. */
1980
- install_windows: z21.array(z21.object({ install_id: idOf("bpi"), from: Day, until: Day }))
2035
+ install_windows: z22.array(z22.object({ install_id: idOf("bpi"), from: Day, until: Day }))
1981
2036
  });
1982
2037
 
1983
2038
  // ../core/src/schema/legal.ts
1984
- import { z as z22 } from "zod";
2039
+ import { z as z23 } from "zod";
1985
2040
  var LEGAL_MEMBER_STATUSES = [
1986
2041
  "pending",
1987
2042
  "link_ready",
@@ -1991,16 +2046,16 @@ var LEGAL_MEMBER_STATUSES = [
1991
2046
  "verified",
1992
2047
  "failed"
1993
2048
  ];
1994
- var LegalMemberStatusSchema = z22.enum(LEGAL_MEMBER_STATUSES);
2049
+ var LegalMemberStatusSchema = z23.enum(LEGAL_MEMBER_STATUSES);
1995
2050
  var LEGAL_VERIFICATION_STATUSES = ["in_progress", "pending_review", "verified", "failed"];
1996
- var LegalVerificationStatusSchema = z22.enum(LEGAL_VERIFICATION_STATUSES);
2051
+ var LegalVerificationStatusSchema = z23.enum(LEGAL_VERIFICATION_STATUSES);
1997
2052
  var LEGAL_COMPANY_STATUSES = ["awaiting_payment", "paid", "submitted", "formed", "failed"];
1998
- var LegalCompanyStatusSchema = z22.enum(LEGAL_COMPANY_STATUSES);
2053
+ var LegalCompanyStatusSchema = z23.enum(LEGAL_COMPANY_STATUSES);
1999
2054
  var LEGAL_DOCUMENT_KINDS = ["articles", "ein_letter", "operating_agreement", "other"];
2000
- var LegalDocumentKindSchema = z22.enum(LEGAL_DOCUMENT_KINDS);
2001
- var LegalMemberRoleSchema = z22.enum(["primary", "secondary"]);
2002
- var LegalEinStatusSchema = z22.enum(["none", "pending", "issued"]);
2003
- var LegalRequiredActionKindSchema = z22.enum(["signature", "information", "payment", "other"]);
2055
+ var LegalDocumentKindSchema = z23.enum(LEGAL_DOCUMENT_KINDS);
2056
+ var LegalMemberRoleSchema = z23.enum(["primary", "secondary"]);
2057
+ var LegalEinStatusSchema = z23.enum(["none", "pending", "issued"]);
2058
+ var LegalRequiredActionKindSchema = z23.enum(["signature", "information", "payment", "other"]);
2004
2059
  var US_STATES = [
2005
2060
  "AL",
2006
2061
  "AK",
@@ -2054,105 +2109,105 @@ var US_STATES = [
2054
2109
  "WI",
2055
2110
  "WY"
2056
2111
  ];
2057
- var UsStateSchema = z22.enum(US_STATES);
2058
- var LegalMemberInputSchema = z22.object({
2059
- first_name: z22.string().min(1).max(128),
2060
- last_name: z22.string().min(1).max(128),
2061
- email: z22.string().min(1).max(320),
2112
+ var UsStateSchema = z23.enum(US_STATES);
2113
+ var LegalMemberInputSchema = z23.object({
2114
+ first_name: z23.string().min(1).max(128),
2115
+ last_name: z23.string().min(1).max(128),
2116
+ email: z23.string().min(1).max(320),
2062
2117
  role: LegalMemberRoleSchema,
2063
- is_responsible_party: z22.boolean(),
2064
- ownership_percent: z22.number().int()
2118
+ is_responsible_party: z23.boolean(),
2119
+ ownership_percent: z23.number().int()
2065
2120
  });
2066
2121
  var LegalMemberSchema = LegalMemberInputSchema.extend({
2067
2122
  id: idOf("lgm"),
2068
- object: z22.literal("legal_member"),
2123
+ object: z23.literal("legal_member"),
2069
2124
  verification_id: idOf("lgv"),
2070
2125
  status: LegalMemberStatusSchema,
2071
- link_url: z22.url().nullable(),
2126
+ link_url: z23.url().nullable(),
2072
2127
  link_expires_at: Timestamp.nullable(),
2073
2128
  completed_at: Timestamp.nullable()
2074
2129
  });
2075
- var LegalVerificationSchema = z22.object({
2130
+ var LegalVerificationSchema = z23.object({
2076
2131
  id: idOf("lgv"),
2077
- object: z22.literal("legal_verification"),
2132
+ object: z23.literal("legal_verification"),
2078
2133
  identity_id: idOf("idn"),
2079
2134
  status: LegalVerificationStatusSchema,
2080
- members: z22.array(LegalMemberSchema),
2081
- ready_for_formation: z22.boolean(),
2135
+ members: z23.array(LegalMemberSchema),
2136
+ ready_for_formation: z23.boolean(),
2082
2137
  started_at: Timestamp,
2083
2138
  completed_at: Timestamp.nullable(),
2084
2139
  created_at: Timestamp,
2085
2140
  updated_at: Timestamp
2086
2141
  });
2087
- var StartLegalVerificationSchema = z22.object({ members: z22.array(LegalMemberInputSchema) });
2088
- var CompleteLegalMemberSchema = z22.object({ token: z22.string().min(1) });
2089
- var LegalNameOptionSchema = z22.object({ name: z22.string().min(1).max(200), ending: z22.literal("LLC") });
2090
- var LegalMailingAddressSchema = z22.object({
2091
- line1: z22.string().min(1).max(200),
2092
- line2: z22.string().max(200).nullable(),
2093
- city: z22.string().min(1).max(100),
2142
+ var StartLegalVerificationSchema = z23.object({ members: z23.array(LegalMemberInputSchema) });
2143
+ var CompleteLegalMemberSchema = z23.object({ token: z23.string().min(1) });
2144
+ var LegalNameOptionSchema = z23.object({ name: z23.string().min(1).max(200), ending: z23.literal("LLC") });
2145
+ var LegalMailingAddressSchema = z23.object({
2146
+ line1: z23.string().min(1).max(200),
2147
+ line2: z23.string().max(200).nullable(),
2148
+ city: z23.string().min(1).max(100),
2094
2149
  state: UsStateSchema,
2095
- postal_code: z22.string().min(1).max(16),
2096
- country: z22.literal("US")
2150
+ postal_code: z23.string().min(1).max(16),
2151
+ country: z23.literal("US")
2097
2152
  });
2098
- var LegalRequiredActionSchema = z22.object({
2153
+ var LegalRequiredActionSchema = z23.object({
2099
2154
  kind: LegalRequiredActionKindSchema,
2100
- description: z22.string(),
2101
- url: z22.url().nullable()
2155
+ description: z23.string(),
2156
+ url: z23.url().nullable()
2102
2157
  });
2103
2158
  var LEGAL_DESCRIPTION_MAX = 50;
2104
- var CreateLegalCompanySchema = z22.object({
2159
+ var CreateLegalCompanySchema = z23.object({
2105
2160
  verification_id: idOf("lgv"),
2106
2161
  state: UsStateSchema,
2107
- name_options: z22.array(z22.string().min(1).max(200)).min(1).max(3),
2108
- naics_code: z22.string().regex(/^\d{2,6}$/),
2109
- description: z22.string().min(1).max(LEGAL_DESCRIPTION_MAX),
2162
+ name_options: z23.array(z23.string().min(1).max(200)).min(1).max(3),
2163
+ naics_code: z23.string().regex(/^\d{2,6}$/),
2164
+ description: z23.string().min(1).max(LEGAL_DESCRIPTION_MAX),
2110
2165
  mailing_address: LegalMailingAddressSchema
2111
2166
  });
2112
2167
  var LegalCompanySchema = CreateLegalCompanySchema.omit({ name_options: true }).extend({
2113
2168
  id: idOf("lgc"),
2114
- object: z22.literal("legal_company"),
2169
+ object: z23.literal("legal_company"),
2115
2170
  identity_id: idOf("idn"),
2116
2171
  status: LegalCompanyStatusSchema,
2117
- entity_type: z22.literal("llc"),
2118
- name_options: z22.array(LegalNameOptionSchema),
2119
- legal_name: z22.string().nullable(),
2172
+ entity_type: z23.literal("llc"),
2173
+ name_options: z23.array(LegalNameOptionSchema),
2174
+ legal_name: z23.string().nullable(),
2120
2175
  ein_status: LegalEinStatusSchema,
2121
2176
  price_micro_usd: MicroUsdField,
2122
- required_actions: z22.array(LegalRequiredActionSchema),
2123
- failure_reason: z22.string().max(256).nullable(),
2177
+ required_actions: z23.array(LegalRequiredActionSchema),
2178
+ failure_reason: z23.string().max(256).nullable(),
2124
2179
  submitted_at: Timestamp.nullable(),
2125
2180
  formed_at: Timestamp.nullable(),
2126
2181
  created_at: Timestamp,
2127
2182
  updated_at: Timestamp
2128
2183
  });
2129
- var LegalDocumentSchema = z22.object({
2184
+ var LegalDocumentSchema = z23.object({
2130
2185
  id: idOf("lgd"),
2131
- object: z22.literal("legal_document"),
2186
+ object: z23.literal("legal_document"),
2132
2187
  company_id: idOf("lgc"),
2133
2188
  kind: LegalDocumentKindSchema,
2134
- name: z22.string(),
2189
+ name: z23.string(),
2135
2190
  created_at: Timestamp
2136
2191
  });
2137
- var LegalDocumentLinkSchema = z22.object({
2138
- object: z22.literal("legal_document_link"),
2139
- url: z22.url(),
2192
+ var LegalDocumentLinkSchema = z23.object({
2193
+ object: z23.literal("legal_document_link"),
2194
+ url: z23.url(),
2140
2195
  expires_at: Timestamp
2141
2196
  });
2142
- var NaicsCodeSchema = z22.object({
2143
- object: z22.literal("naics_code"),
2144
- code: z22.string().regex(/^\d{2,6}$/),
2145
- title: z22.string()
2197
+ var NaicsCodeSchema = z23.object({
2198
+ object: z23.literal("naics_code"),
2199
+ code: z23.string().regex(/^\d{2,6}$/),
2200
+ title: z23.string()
2146
2201
  });
2147
- var LegalStateSchema = z22.object({
2148
- object: z22.literal("legal_state"),
2202
+ var LegalStateSchema = z23.object({
2203
+ object: z23.literal("legal_state"),
2149
2204
  code: UsStateSchema,
2150
- name: z22.string(),
2205
+ name: z23.string(),
2151
2206
  formation_fee_micro_usd: MicroUsdField
2152
2207
  });
2153
- var LegalWebhookEventSchema = z22.object({
2154
- provider_session_ref: z22.string().min(1),
2155
- status: z22.enum(["verified", "failed", "pending_review"]),
2208
+ var LegalWebhookEventSchema = z23.object({
2209
+ provider_session_ref: z23.string().min(1),
2210
+ status: z23.enum(["verified", "failed", "pending_review"]),
2156
2211
  metadata: Metadata
2157
2212
  });
2158
2213
  var LLC_ENDING = /\s*(?:,\s*)?(?:l\.?l\.?c\.?|limited\s+liability\s+company)\s*$/i;
@@ -2163,178 +2218,178 @@ function canonicalName(raw) {
2163
2218
  }
2164
2219
 
2165
2220
  // ../core/src/schema/wallet.ts
2166
- import { z as z23 } from "zod";
2221
+ import { z as z24 } from "zod";
2167
2222
  var WALLET_NETWORKS = ["eip155:84532", "eip155:8453"];
2168
- var WalletNetworkSchema = z23.enum(WALLET_NETWORKS);
2223
+ var WalletNetworkSchema = z24.enum(WALLET_NETWORKS);
2169
2224
  var DEFAULT_WALLET_NETWORK = "eip155:84532";
2170
- var WalletSelectSchema = z23.object({ network: WalletNetworkSchema.optional() });
2225
+ var WalletSelectSchema = z24.object({ network: WalletNetworkSchema.optional() });
2171
2226
  var WALLET_STATUSES = ["active", "frozen", "swept"];
2172
- var WalletStatusSchema = z23.enum(WALLET_STATUSES);
2227
+ var WalletStatusSchema = z24.enum(WALLET_STATUSES);
2173
2228
  var WALLET_TRANSACTION_KINDS = ["fund", "transfer", "pay", "sweep"];
2174
- var WalletTransactionKindSchema = z23.enum(WALLET_TRANSACTION_KINDS);
2229
+ var WalletTransactionKindSchema = z24.enum(WALLET_TRANSACTION_KINDS);
2175
2230
  var WALLET_TRANSACTION_STATUSES = ["pending", "confirmed", "failed"];
2176
- var WalletTransactionStatusSchema = z23.enum(WALLET_TRANSACTION_STATUSES);
2177
- var WalletDirectionSchema = z23.enum(["in", "out"]);
2178
- var WalletFundSourceSchema = z23.enum(["faucet", "treasury"]);
2179
- var EvmAddressSchema = z23.string().regex(/^0x[0-9a-fA-F]{40}$/, "expected a 0x address");
2180
- var TxHashSchema = z23.string().regex(/^0x[0-9a-fA-F]{64}$/, "expected a 0x transaction hash");
2181
- var WalletPolicySchema = z23.object({
2231
+ var WalletTransactionStatusSchema = z24.enum(WALLET_TRANSACTION_STATUSES);
2232
+ var WalletDirectionSchema = z24.enum(["in", "out"]);
2233
+ var WalletFundSourceSchema = z24.enum(["faucet", "treasury"]);
2234
+ var EvmAddressSchema = z24.string().regex(/^0x[0-9a-fA-F]{40}$/, "expected a 0x address");
2235
+ var TxHashSchema = z24.string().regex(/^0x[0-9a-fA-F]{64}$/, "expected a 0x transaction hash");
2236
+ var WalletPolicySchema = z24.object({
2182
2237
  per_tx_cap_micro_usd: MicroUsdField.nonnegative(),
2183
2238
  daily_cap_micro_usd: MicroUsdField.positive().nullable(),
2184
2239
  low_balance_micro_usd: MicroUsdField.nonnegative().nullable()
2185
2240
  });
2186
- var WalletSchema = z23.object({
2241
+ var WalletSchema = z24.object({
2187
2242
  id: idOf("wlt"),
2188
- object: z23.literal("wallet"),
2243
+ object: z24.literal("wallet"),
2189
2244
  identity_id: idOf("idn"),
2190
2245
  status: WalletStatusSchema,
2191
2246
  network: WalletNetworkSchema,
2192
2247
  address: EvmAddressSchema,
2193
- asset: z23.literal("usdc"),
2248
+ asset: z24.literal("usdc"),
2194
2249
  balance_micro_usd: MicroUsdField,
2195
2250
  policy: WalletPolicySchema,
2196
2251
  spent_today_micro_usd: MicroUsdField,
2197
2252
  created_at: Timestamp,
2198
2253
  updated_at: Timestamp
2199
2254
  });
2200
- var CreateWalletSchema = z23.object({
2255
+ var CreateWalletSchema = z24.object({
2201
2256
  network: WalletNetworkSchema.optional(),
2202
2257
  policy: WalletPolicySchema.partial().optional()
2203
2258
  });
2204
2259
  var UpdateWalletPolicySchema = WalletPolicySchema.partial();
2205
- var FundWalletSchema = z23.object({
2260
+ var FundWalletSchema = z24.object({
2206
2261
  amount_micro_usd: MicroUsdField.positive(),
2207
2262
  source: WalletFundSourceSchema
2208
2263
  });
2209
- var TransferWalletSchema = z23.object({
2210
- to: z23.union([EvmAddressSchema, idOf("idn")]),
2264
+ var TransferWalletSchema = z24.object({
2265
+ to: z24.union([EvmAddressSchema, idOf("idn")]),
2211
2266
  amount_micro_usd: MicroUsdField.positive(),
2212
- purpose: z23.string().min(1).max(256)
2267
+ purpose: z24.string().min(1).max(256)
2213
2268
  });
2214
- var SweepWalletSchema = z23.object({ to: EvmAddressSchema.optional() });
2215
- var WalletTransactionSchema = z23.object({
2269
+ var SweepWalletSchema = z24.object({ to: EvmAddressSchema.optional() });
2270
+ var WalletTransactionSchema = z24.object({
2216
2271
  id: idOf("wtx"),
2217
- object: z23.literal("wallet_transaction"),
2272
+ object: z24.literal("wallet_transaction"),
2218
2273
  wallet_id: idOf("wlt"),
2219
2274
  kind: WalletTransactionKindSchema,
2220
2275
  direction: WalletDirectionSchema,
2221
2276
  amount_micro_usd: MicroUsdField,
2222
- counterparty: z23.string().nullable(),
2223
- origin: z23.string().nullable(),
2224
- purpose: z23.string().nullable(),
2277
+ counterparty: z24.string().nullable(),
2278
+ origin: z24.string().nullable(),
2279
+ purpose: z24.string().nullable(),
2225
2280
  tx_hash: TxHashSchema.nullable(),
2226
2281
  session_id: idOf("ses").nullable(),
2227
2282
  status: WalletTransactionStatusSchema,
2228
2283
  created_at: Timestamp
2229
2284
  });
2230
- var ListWalletTransactionsSchema = z23.object({
2285
+ var ListWalletTransactionsSchema = z24.object({
2231
2286
  kind: WalletTransactionKindSchema.optional(),
2232
2287
  direction: WalletDirectionSchema.optional(),
2233
- origin: z23.string().optional(),
2288
+ origin: z24.string().optional(),
2234
2289
  since: Timestamp.optional()
2235
2290
  });
2236
- var HttpMethodSchema = z23.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]);
2237
- var WalletQuoteRequestSchema = z23.object({ url: z23.url(), method: HttpMethodSchema.optional() });
2238
- var WalletQuoteSchema = z23.object({
2239
- object: z23.literal("wallet_quote"),
2240
- url: z23.url(),
2241
- payable: z23.boolean(),
2291
+ var HttpMethodSchema = z24.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]);
2292
+ var WalletQuoteRequestSchema = z24.object({ url: z24.url(), method: HttpMethodSchema.optional() });
2293
+ var WalletQuoteSchema = z24.object({
2294
+ object: z24.literal("wallet_quote"),
2295
+ url: z24.url(),
2296
+ payable: z24.boolean(),
2242
2297
  network: WalletNetworkSchema.nullable(),
2243
- asset: z23.literal("usdc").nullable(),
2298
+ asset: z24.literal("usdc").nullable(),
2244
2299
  amount_micro_usd: MicroUsdField.nullable(),
2245
2300
  pay_to: EvmAddressSchema.nullable(),
2246
- description: z23.string().nullable(),
2247
- max_timeout_seconds: z23.number().int().nullable()
2301
+ description: z24.string().nullable(),
2302
+ max_timeout_seconds: z24.number().int().nullable()
2248
2303
  });
2249
2304
  var WalletPayRequestSchema = WalletQuoteRequestSchema.extend({
2250
2305
  max_amount_micro_usd: MicroUsdField.positive().optional()
2251
2306
  });
2252
2307
  var WALLET_RESPONSE_BODY_MAX = 64 * 1024;
2253
- var WalletPaymentSchema = z23.object({
2254
- object: z23.literal("wallet_payment"),
2255
- paid: z23.boolean(),
2308
+ var WalletPaymentSchema = z24.object({
2309
+ object: z24.literal("wallet_payment"),
2310
+ paid: z24.boolean(),
2256
2311
  transaction_id: idOf("wtx").nullable(),
2257
2312
  amount_micro_usd: MicroUsdField.nullable(),
2258
- response_status: z23.number().int(),
2259
- response_body: z23.string().max(WALLET_RESPONSE_BODY_MAX)
2313
+ response_status: z24.number().int(),
2314
+ response_body: z24.string().max(WALLET_RESPONSE_BODY_MAX)
2260
2315
  });
2261
2316
 
2262
2317
  // ../core/src/schema/cards.ts
2263
- import { z as z24 } from "zod";
2318
+ import { z as z25 } from "zod";
2264
2319
  var CARD_STATUSES = ["pending_payment", "issuing", "active", "failed", "cancelled", "refunded"];
2265
- var CardStatusSchema = z24.enum(CARD_STATUSES);
2320
+ var CardStatusSchema = z25.enum(CARD_STATUSES);
2266
2321
  var CARD_MIN_LOAD_MICRO_USD = 1e6;
2267
2322
  var CARD_MAX_LOAD_MICRO_USD = 15e7;
2268
2323
  var CARD_LOAD_GRANULARITY_MICRO_USD = 1e4;
2269
- var CardSchema = z24.object({
2324
+ var CardSchema = z25.object({
2270
2325
  id: idOf("vcd"),
2271
- object: z24.literal("card"),
2326
+ object: z25.literal("card"),
2272
2327
  identity_id: idOf("idn"),
2273
- kind: z24.literal("prepaid"),
2328
+ kind: z25.literal("prepaid"),
2274
2329
  status: CardStatusSchema,
2275
- label: z24.string().min(1).max(128),
2276
- brand: z24.string().nullable(),
2277
- last4: z24.string().regex(/^\d{4}$/).nullable(),
2330
+ label: z25.string().min(1).max(128),
2331
+ brand: z25.string().nullable(),
2332
+ last4: z25.string().regex(/^\d{4}$/).nullable(),
2278
2333
  load_micro_usd: MicroUsdField,
2279
2334
  spent_micro_usd: MicroUsdField,
2280
- currency: z24.literal("usd"),
2335
+ currency: z25.literal("usd"),
2281
2336
  expires_at: Timestamp.nullable(),
2282
- failure_reason: z24.string().max(256).nullable(),
2337
+ failure_reason: z25.string().max(256).nullable(),
2283
2338
  created_at: Timestamp,
2284
2339
  updated_at: Timestamp
2285
2340
  });
2286
- var IssueCardSchema = z24.object({
2341
+ var IssueCardSchema = z25.object({
2287
2342
  label: CardSchema.shape.label,
2288
2343
  load_micro_usd: MicroUsdField.min(CARD_MIN_LOAD_MICRO_USD).max(CARD_MAX_LOAD_MICRO_USD).multipleOf(CARD_LOAD_GRANULARITY_MICRO_USD)
2289
2344
  });
2290
2345
  var CardQuoteRequestSchema = IssueCardSchema.pick({ load_micro_usd: true });
2291
- var CardQuoteSchema = z24.object({
2292
- object: z24.literal("card_quote"),
2346
+ var CardQuoteSchema = z25.object({
2347
+ object: z25.literal("card_quote"),
2293
2348
  load_micro_usd: MicroUsdField,
2294
2349
  price_micro_usd: MicroUsdField,
2295
- brand: z24.string().nullable(),
2350
+ brand: z25.string().nullable(),
2296
2351
  min_load_micro_usd: MicroUsdField,
2297
2352
  max_load_micro_usd: MicroUsdField
2298
2353
  });
2299
- var CardCredentialsSchema = z24.object({
2300
- object: z24.literal("card_credentials"),
2354
+ var CardCredentialsSchema = z25.object({
2355
+ object: z25.literal("card_credentials"),
2301
2356
  card_id: idOf("vcd"),
2302
- number: z24.string().min(1),
2303
- pin: z24.string().nullable(),
2304
- cvv: z24.string().nullable(),
2305
- expiry: z24.string().nullable(),
2306
- url: z24.url().nullable(),
2307
- instructions: z24.string().nullable(),
2357
+ number: z25.string().min(1),
2358
+ pin: z25.string().nullable(),
2359
+ cvv: z25.string().nullable(),
2360
+ expiry: z25.string().nullable(),
2361
+ url: z25.url().nullable(),
2362
+ instructions: z25.string().nullable(),
2308
2363
  revealed_at: Timestamp
2309
2364
  });
2310
- var CardTransactionSchema = z24.object({
2365
+ var CardTransactionSchema = z25.object({
2311
2366
  id: idOf("vct"),
2312
- object: z24.literal("card_transaction"),
2367
+ object: z25.literal("card_transaction"),
2313
2368
  card_id: idOf("vcd"),
2314
2369
  amount_micro_usd: MicroUsdField,
2315
- merchant: z24.string().nullable(),
2316
- description: z24.string().nullable(),
2370
+ merchant: z25.string().nullable(),
2371
+ description: z25.string().nullable(),
2317
2372
  session_id: idOf("ses").nullable(),
2318
2373
  metadata: Metadata,
2319
2374
  created_at: Timestamp
2320
2375
  });
2321
- var LogCardTransactionSchema = z24.object({
2376
+ var LogCardTransactionSchema = z25.object({
2322
2377
  amount_micro_usd: MicroUsdField.positive(),
2323
- merchant: z24.string().max(256).optional(),
2324
- description: z24.string().max(1024).optional(),
2378
+ merchant: z25.string().max(256).optional(),
2379
+ description: z25.string().max(1024).optional(),
2325
2380
  metadata: Metadata.optional()
2326
2381
  });
2327
- var ListCardsSchema = z24.object({ status: CardStatusSchema.optional() });
2382
+ var ListCardsSchema = z25.object({ status: CardStatusSchema.optional() });
2328
2383
 
2329
2384
  // src/define.ts
2330
- import { z as z27 } from "zod";
2385
+ import { z as z28 } from "zod";
2331
2386
 
2332
2387
  // src/roster.ts
2333
- import { z as z26 } from "zod";
2388
+ import { z as z27 } from "zod";
2334
2389
 
2335
2390
  // src/report.ts
2336
2391
  import { ApiError, send } from "@usenaive-sdk/vetta";
2337
- import { z as z25 } from "zod";
2392
+ import { z as z26 } from "zod";
2338
2393
  function message(error) {
2339
2394
  return error instanceof Error ? error.message : String(error);
2340
2395
  }
@@ -2374,10 +2429,10 @@ async function absent(work) {
2374
2429
  throw error;
2375
2430
  }
2376
2431
  }
2377
- var PageShape = z25.object({
2378
- data: z25.array(z25.unknown()),
2379
- has_more: z25.boolean(),
2380
- next_cursor: z25.string().nullable()
2432
+ var PageShape = z26.object({
2433
+ data: z26.array(z26.unknown()),
2434
+ has_more: z26.boolean(),
2435
+ next_cursor: z26.string().nullable()
2381
2436
  });
2382
2437
  function rowLabel(row) {
2383
2438
  const { object, id } = row ?? {};
@@ -2409,17 +2464,17 @@ async function tombstone(name, current, remove, dryRun) {
2409
2464
  }
2410
2465
 
2411
2466
  // src/roster.ts
2412
- var NAME = z26.string().min(1);
2413
- var RosterNameSchema = z26.union([
2467
+ var NAME = z27.string().min(1);
2468
+ var RosterNameSchema = z27.union([
2414
2469
  NAME.transform((name) => ({ type: "agent", name })),
2415
- z26.object({ type: z26.literal("agent"), name: NAME, version: z26.number().int().positive().optional() }),
2416
- z26.object({ type: z26.literal("self") }),
2417
- z26.object({ type: z26.literal("advisor"), model: z26.string().min(1) })
2470
+ z27.object({ type: z27.literal("agent"), name: NAME, version: z27.number().int().positive().optional() }),
2471
+ z27.object({ type: z27.literal("self") }),
2472
+ z27.object({ type: z27.literal("advisor"), model: z27.string().min(1) })
2418
2473
  ]);
2419
- var DeclMultiagentField = z26.union([
2420
- z26.boolean(),
2421
- z26.object({ ...MultiagentSchema.shape, agents: z26.array(RosterNameSchema).min(1).max(20) }),
2422
- z26.null()
2474
+ var DeclMultiagentField = z27.union([
2475
+ z27.boolean(),
2476
+ z27.object({ ...MultiagentSchema.shape, agents: z27.array(RosterNameSchema).min(1).max(20) }),
2477
+ z27.null()
2423
2478
  ]);
2424
2479
  var hasRoster = (value) => typeof value === "object" && value !== null;
2425
2480
  var rosterNames = (roster) => roster.agents.flatMap((entry) => entry.type === "agent" ? [entry.name] : []);
@@ -2507,67 +2562,73 @@ function chooseTemplate(blueprint, template) {
2507
2562
  var BlueprintRefusal = class extends Error {
2508
2563
  name = "BlueprintRefusal";
2509
2564
  };
2510
- var EnvValueSchema = z27.union([
2511
- z27.string(),
2512
- z27.object({ from_env: z27.string().min(1) }),
2513
- z27.object({ generate: z27.literal(true) })
2565
+ var EnvValueSchema = z28.union([
2566
+ z28.string(),
2567
+ z28.object({ from_env: z28.string().min(1) }),
2568
+ z28.object({ generate: z28.literal(true) })
2514
2569
  ]);
2515
- var AppDeclSchema = z27.object({
2570
+ var AppDeclSchema = z28.object({
2516
2571
  /** Becomes a hostname, so the grammar is the platform's `APP_NAME` (a DNS label). */
2517
- name: z27.string().regex(APP_NAME, "a lowercase DNS label, 63 characters or fewer"),
2572
+ name: z28.string().regex(APP_NAME, "a lowercase DNS label, 63 characters or fewer"),
2518
2573
  type: AppTypeSchema,
2519
- description: z27.string().optional(),
2574
+ description: z28.string().optional(),
2520
2575
  /** A directory whose files are collected and shipped as the app's file-map deployment. */
2521
- deploy_dir: z27.string().min(1).optional(),
2576
+ deploy_dir: z28.string().min(1).optional(),
2522
2577
  /** The path the app itself serves MCP on (§29.5); `fullstack` only. Absent means none. */
2523
2578
  mcp: AppMcpPathSchema.optional(),
2524
2579
  /** Written as the app's write-only secrets (§29.2) on every apply; names follow the platform's `ENV_NAME`. */
2525
- env: z27.record(z27.string().regex(ENV_NAME), EnvValueSchema, { error: "keyed by environment variable name (A-Z, 0-9, _)" }).optional(),
2580
+ env: z28.record(z28.string().regex(ENV_NAME), EnvValueSchema, { error: "keyed by environment variable name (A-Z, 0-9, _)" }).optional(),
2526
2581
  /** An install may not leave this app out of its `selection` (§31.2). Absent means it may. */
2527
- required: z27.boolean().optional(),
2582
+ required: z28.boolean().optional(),
2528
2583
  // core-gaps: U8-database
2529
2584
  /** SQL files applied in order to the app's database after it is provisioned (§37); `fullstack` only. */
2530
- migrations: z27.array(z27.string().min(1)).optional(),
2585
+ migrations: z28.array(z28.string().min(1)).optional(),
2531
2586
  // core-gaps: storage-stock
2532
2587
  /** Buckets the app's object store must hold (§38.2); `fullstack` only. `public` defaults to false. */
2533
- buckets: z27.array(CreateBucketSchema).optional()
2588
+ buckets: z28.array(CreateBucketSchema).optional()
2534
2589
  });
2535
- var ScheduleDeclSchema = z27.object({
2536
- cron: z27.string().min(1),
2537
- timezone: z27.string().min(1).optional(),
2590
+ var ScheduleDeclSchema = z28.object({
2591
+ cron: z28.string().min(1),
2592
+ timezone: z28.string().min(1).optional(),
2538
2593
  /** The message every fire opens its session with (`input_template` on the wire). */
2539
- input: z27.string().min(1),
2594
+ input: z28.string().min(1),
2540
2595
  budget_micro_usd: MicroUsdField.nonnegative(),
2541
- identity: z27.string().min(1).optional(),
2542
- enabled: z27.boolean().optional()
2596
+ identity: z28.string().min(1).optional(),
2597
+ enabled: z28.boolean().optional()
2543
2598
  });
2544
2599
  var ToolsDeclSchema = ToolsetSchema;
2545
- var AgentDeclSchema = z27.object({
2546
- name: z27.string().min(1),
2547
- model: z27.string().min(1),
2600
+ var AgentDeclSchema = z28.object({
2601
+ name: z28.string().min(1),
2602
+ model: z28.string().min(1),
2548
2603
  budget: BudgetSchema,
2549
- description: z27.string().optional(),
2604
+ description: z28.string().optional(),
2550
2605
  /** Two or three words the studio prints beside the name (§31.5) — "Head of content", not a sentence. */
2551
- role: z27.string().min(1).optional(),
2606
+ role: z28.string().min(1).optional(),
2552
2607
  /** An install may not leave this agent out of its `selection` (§31.2). Absent means it may. */
2553
- required: z27.boolean().optional(),
2554
- system: z27.string().optional(),
2608
+ required: z28.boolean().optional(),
2609
+ system: z28.string().optional(),
2555
2610
  tools: ToolsDeclSchema.optional(),
2556
- skills: z27.array(SkillRefSchema).optional(),
2557
- mcp_servers: z27.array(McpServerSchema).optional(),
2611
+ skills: z28.array(SkillRefSchema).optional(),
2612
+ mcp_servers: z28.array(McpServerSchema).optional(),
2558
2613
  /** The rest of the runtime's agent config (§31.6), each the core schema; absent means the route's default and never drift. */
2559
2614
  window: WindowSchema.optional(),
2560
2615
  /** A roster names crew members by declared *name*; `up` resolves them to `agt_` ids in a second pass (`roster.ts`). */
2561
2616
  multiagent: DeclMultiagentField.optional(),
2562
2617
  output_schema: JsonSchemaDocument.nullable().optional(),
2563
- structured_output_required: z27.boolean().optional(),
2618
+ structured_output_required: z28.boolean().optional(),
2564
2619
  metadata: Metadata.optional(),
2565
2620
  /** Declared app *names*; `up` resolves them to `app_` ids in `tools.configs.apps` (§29.3). */
2566
- allowed_apps: z27.array(z27.string()).optional(),
2621
+ allowed_apps: z28.array(z28.string()).optional(),
2567
2622
  /** A declared identity *name*; `up` attaches it after the agent upsert (§22). */
2568
- identity: z27.string().min(1).optional(),
2623
+ identity: z28.string().min(1).optional(),
2624
+ /**
2625
+ * Who this agent may `send_to_agent` (§31.7, §28.12): `true` (anyone in the organization),
2626
+ * `false` (nobody), `"team"` (its `multiagent` roster), or declared agent *names*, checked
2627
+ * against the roster here. Absent means the route's default, `true`, and is never drift.
2628
+ */
2629
+ handoffs: HandoffsField.optional(),
2569
2630
  /** The agent's deployments as a complete set: declared → owned, and the rest are pruned (ADR-0355). */
2570
- schedules: z27.array(ScheduleDeclSchema).optional(),
2631
+ schedules: z28.array(ScheduleDeclSchema).optional(),
2571
2632
  /**
2572
2633
  * The first thing this agent reads, once, on the apply that **creates** it (`canonical-spec
2573
2634
  * §31.4`). It is what turns a provisioned crew into a crew that has started working.
@@ -2580,58 +2641,58 @@ var AgentDeclSchema = z27.object({
2580
2641
  * repeatedly and unattended while an intake spends once, at an apply a person is watching. Absent
2581
2642
  * means the agent's own `budget` governs.
2582
2643
  */
2583
- intake: z27.object({ message: z27.string().min(1), budget_micro_usd: MicroUsdField.nonnegative().optional() }).optional()
2644
+ intake: z28.object({ message: z28.string().min(1), budget_micro_usd: MicroUsdField.nonnegative().optional() }).optional()
2584
2645
  });
2585
- var CredentialDeclSchema = z27.object({
2646
+ var CredentialDeclSchema = z28.object({
2586
2647
  kind: VaultCredentialKindSchema,
2587
- key: z27.string().min(1).max(128),
2648
+ key: z28.string().min(1).max(128),
2588
2649
  /** The one exact destination host an `env_var` is bound to. */
2589
- host: z27.string().min(1).optional(),
2650
+ host: z28.string().min(1).optional(),
2590
2651
  /** The MCP server URL a `static_bearer` / `mcp_oauth` token is matched to. */
2591
- mcp_server_url: z27.url().optional(),
2592
- value: z27.object({ from_env: z27.string().min(1) })
2652
+ mcp_server_url: z28.url().optional(),
2653
+ value: z28.object({ from_env: z28.string().min(1) })
2593
2654
  });
2594
- var VaultDeclSchema = z27.object({
2655
+ var VaultDeclSchema = z28.object({
2595
2656
  name: VaultSchema.shape.display_name,
2596
- identity: z27.string().min(1).optional(),
2597
- credentials: z27.array(CredentialDeclSchema)
2657
+ identity: z28.string().min(1).optional(),
2658
+ credentials: z28.array(CredentialDeclSchema)
2598
2659
  });
2599
- var SkillDeclSchema = z27.object({
2600
- slug: z27.string().regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes"),
2601
- file: z27.string().min(1)
2660
+ var SkillDeclSchema = z28.object({
2661
+ slug: z28.string().regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes"),
2662
+ file: z28.string().min(1)
2602
2663
  });
2603
2664
  var LegalDeclSchema = CreateLegalCompanySchema.pick({
2604
2665
  state: true,
2605
2666
  name_options: true,
2606
2667
  naics_code: true,
2607
2668
  description: true
2608
- }).extend({ label: z27.string().min(1).max(128) });
2669
+ }).extend({ label: z28.string().min(1).max(128) });
2609
2670
  var WalletDeclSchema = CreateWalletSchema.or(
2610
- z27.array(CreateWalletSchema).refine(
2671
+ z28.array(CreateWalletSchema).refine(
2611
2672
  (list2) => new Set(list2.map((w) => w.network ?? DEFAULT_WALLET_NETWORK)).size === list2.length,
2612
2673
  { message: "one wallet per network" }
2613
2674
  )
2614
2675
  );
2615
2676
  var CardDeclSchema = IssueCardSchema;
2616
2677
  var IdentityDeclSchema = IdentitySchema.pick({ name: true, description: true }).partial({ description: true }).extend({
2617
- legal: z27.array(LegalDeclSchema).optional(),
2678
+ legal: z28.array(LegalDeclSchema).optional(),
2618
2679
  wallet: WalletDeclSchema.optional(),
2619
- cards: z27.array(CardDeclSchema).optional()
2620
- });
2621
- var RemovedSchema = z27.object({
2622
- apps: z27.array(z27.string().min(1)).default([]),
2623
- agents: z27.array(z27.string().min(1)).default([]),
2624
- skills: z27.array(z27.string().min(1)).default([]),
2625
- identities: z27.array(z27.string().min(1)).default([]),
2626
- vaults: z27.array(z27.string().min(1)).default([])
2627
- });
2628
- var KeptSchema = z27.object({ agents: z27.array(z27.string().min(1)).default([]) });
2629
- var ProjectSchema = z27.object({
2630
- name: z27.string().min(1),
2680
+ cards: z28.array(CardDeclSchema).optional()
2681
+ });
2682
+ var RemovedSchema = z28.object({
2683
+ apps: z28.array(z28.string().min(1)).default([]),
2684
+ agents: z28.array(z28.string().min(1)).default([]),
2685
+ skills: z28.array(z28.string().min(1)).default([]),
2686
+ identities: z28.array(z28.string().min(1)).default([]),
2687
+ vaults: z28.array(z28.string().min(1)).default([])
2688
+ });
2689
+ var KeptSchema = z28.object({ agents: z28.array(z28.string().min(1)).default([]) });
2690
+ var ProjectSchema = z28.object({
2691
+ name: z28.string().min(1),
2631
2692
  /** The machine this project runs: its repo, its screens, its `/api/*` (`template.ts`). */
2632
- blueprint: z27.string().min(1).optional(),
2693
+ blueprint: z28.string().min(1).optional(),
2633
2694
  /** Which of that blueprint's templates provides the crew; a blueprint with a default may omit it. */
2634
- template: z27.string().min(1).optional(),
2695
+ template: z28.string().min(1).optional(),
2635
2696
  /**
2636
2697
  * What a person is asked BEFORE the crew is provisioned (`canonical-spec §31.2`).
2637
2698
  *
@@ -2643,19 +2704,19 @@ var ProjectSchema = z27.object({
2643
2704
  *
2644
2705
  * **Configuration only.** A secret is a vault credential or an app secret; neither is an answer.
2645
2706
  */
2646
- questions: z27.array(QuestionFieldSchema).default([]),
2647
- skills: z27.array(SkillDeclSchema).default([]),
2648
- identities: z27.array(IdentityDeclSchema).default([]),
2649
- vaults: z27.array(VaultDeclSchema).default([]),
2650
- apps: z27.array(AppDeclSchema).default([]),
2651
- agents: z27.array(AgentDeclSchema).default([]),
2707
+ questions: z28.array(QuestionFieldSchema).default([]),
2708
+ skills: z28.array(SkillDeclSchema).default([]),
2709
+ identities: z28.array(IdentityDeclSchema).default([]),
2710
+ vaults: z28.array(VaultDeclSchema).default([]),
2711
+ apps: z28.array(AppDeclSchema).default([]),
2712
+ agents: z28.array(AgentDeclSchema).default([]),
2652
2713
  /**
2653
2714
  * The agents this template creates PER CLIENT the operator signs (`canonical-spec §31.1`) —
2654
2715
  * printed on the artifact so a person sees the whole company, never provisioned by an apply,
2655
2716
  * because the apply does not know the clients yet. Names only: a model and a budget are the
2656
2717
  * crew's business at the moment a client is signed, not the declaration's.
2657
2718
  */
2658
- crew_per_client: z27.array(z27.object({ name: z27.string().min(1), role: z27.string().min(1).optional(), description: z27.string().optional() })).optional(),
2719
+ crew_per_client: z28.array(z28.object({ name: z28.string().min(1), role: z28.string().min(1).optional(), description: z28.string().optional() })).optional(),
2659
2720
  removed: RemovedSchema.default({ apps: [], agents: [], skills: [], identities: [], vaults: [] }),
2660
2721
  kept: KeptSchema.default({ agents: [] })
2661
2722
  });
@@ -2754,6 +2815,17 @@ function parseProject(input) {
2754
2815
  if (agent.identity !== void 0 && !identityNames.has(agent.identity)) {
2755
2816
  refuse(`agent "${agent.name}": identity names "${agent.identity}", but no identity with that name is declared in this project`);
2756
2817
  }
2818
+ if (agent.handoffs === "team" && !hasRoster(agent.multiagent)) {
2819
+ refuse(`agent "${agent.name}": handoffs is "team", but the agent declares no multiagent roster \u2014 there is no team to hand to`);
2820
+ }
2821
+ const handoffs = /* @__PURE__ */ new Set();
2822
+ for (const name of Array.isArray(agent.handoffs) ? agent.handoffs : []) {
2823
+ if (name === agent.name) refuse(`agent "${agent.name}": handoffs names itself \u2014 an agent cannot send_to_agent its own seat`);
2824
+ if (config.removed.agents.includes(name)) refuse(`agent "${agent.name}": handoffs names "${name}", which this config removes \u2014 drop it from handoffs or keep the agent`);
2825
+ if (!agentNames.has(name)) refuse(`agent "${agent.name}": handoffs names "${name}", but no agent with that name is declared in this project`);
2826
+ if (handoffs.has(name)) refuse(`agent "${agent.name}": handoffs names "${name}" twice`);
2827
+ handoffs.add(name);
2828
+ }
2757
2829
  const crons = /* @__PURE__ */ new Set();
2758
2830
  for (const schedule of agent.schedules ?? []) {
2759
2831
  if (crons.has(schedule.cron)) {
@@ -2922,14 +2994,17 @@ function desiredSystem(decl, of) {
2922
2994
  ${decl.system}`;
2923
2995
  }
2924
2996
  function desiredTools(decl, current, ids) {
2925
- if (ids === void 0) return decl.tools;
2997
+ const handoff = decl.handoffs !== void 0 && handoffsEnabled(decl.handoffs);
2998
+ if (ids === void 0 && !handoff) return decl.tools;
2926
2999
  const base = decl.tools ?? current?.tools ?? { default_config: { permission: "allow" }, configs: {} };
2927
3000
  const appsTool = base.configs["apps"] ?? { enabled: true, permission: base.default_config.permission };
3001
+ const allowed = { enabled: true, permission: "allow" };
2928
3002
  return {
2929
3003
  default_config: base.default_config,
2930
3004
  configs: {
2931
3005
  ...base.configs,
2932
- apps: { ...appsTool, config: { ...appsTool.config, allowed_apps: ids } }
3006
+ ...ids !== void 0 ? { apps: { ...appsTool, config: { ...appsTool.config, allowed_apps: ids } } } : {},
3007
+ ...handoff ? { send_to_agent: allowed, list_agents: allowed } : {}
2933
3008
  }
2934
3009
  };
2935
3010
  }
@@ -2945,6 +3020,7 @@ async function createAgent(client, decl, tools, team, identityId, system, metada
2945
3020
  ...tools !== void 0 ? { tools } : {},
2946
3021
  ...decl.window !== void 0 ? { window: decl.window } : {},
2947
3022
  ...team !== void 0 ? { multiagent: team } : {},
3023
+ ...decl.handoffs !== void 0 ? { handoffs: decl.handoffs } : {},
2948
3024
  ...decl.output_schema !== void 0 ? { output_schema: decl.output_schema } : {},
2949
3025
  ...decl.structured_output_required !== void 0 ? { structured_output_required: decl.structured_output_required } : {},
2950
3026
  ...metadata !== void 0 ? { metadata } : {}
@@ -2990,6 +3066,7 @@ function drift(decl, current, tools, team, system, metadata) {
2990
3066
  if (changed(tools, current.tools)) patch.tools = tools;
2991
3067
  if (changed(decl.window, current.window)) patch.window = decl.window;
2992
3068
  if (team !== void 0 && changed(normaliseMultiagent(team), normaliseMultiagent(current.multiagent))) patch.multiagent = team;
3069
+ if (changed(decl.handoffs, handoffsOf(current))) patch.handoffs = decl.handoffs;
2993
3070
  if (changed(decl.output_schema, current.output_schema)) patch.output_schema = decl.output_schema;
2994
3071
  if (changed(decl.structured_output_required, current.structured_output_required)) patch.structured_output_required = decl.structured_output_required;
2995
3072
  if (changed(metadata, current.metadata)) patch.metadata = metadata;
@@ -3122,9 +3199,14 @@ var PLATFORM_ENV = {
3122
3199
  identity_id: "NAIVE_IDENTITY_ID",
3123
3200
  /** The install's `project` — the row the app's own context lookup lands on (§31.8). */
3124
3201
  project: "NAIVE_PROJECT",
3202
+ /** The base URL of the Studio that installed the app, so it can send a signed-out visitor back. */
3203
+ studio_url: "NAIVE_STUDIO_URL",
3204
+ /** The app's own `app_…` id — the one known value learnt from the row, not from the apply. */
3205
+ app_id: "NAIVE_APP_ID",
3125
3206
  /** A scoped organization API key minted for the app that asks for it. */
3126
3207
  api_key: "NAIVE_API_KEY"
3127
3208
  };
3209
+ var DASHBOARD_PASSWORD = "DASHBOARD_PASSWORD";
3128
3210
  function planEnv(decl, opts) {
3129
3211
  if (decl.env === void 0) return [];
3130
3212
  const plan = /* @__PURE__ */ new Map();
@@ -3134,7 +3216,7 @@ function planEnv(decl, opts) {
3134
3216
  continue;
3135
3217
  }
3136
3218
  if ("generate" in value) {
3137
- plan.set(name, { name, invent: async () => generated() });
3219
+ plan.set(name, { name, invent: async () => name === DASHBOARD_PASSWORD ? generatedPassword() : generatedSecret() });
3138
3220
  continue;
3139
3221
  }
3140
3222
  const known = opts.platform?.known[value.from_env];
@@ -3170,7 +3252,31 @@ async function invent(one) {
3170
3252
  );
3171
3253
  }
3172
3254
  }
3173
- var generated = () => randomBytes(32).toString("base64url");
3255
+ var generatedSecret = () => randomBytes(32).toString("base64url");
3256
+ var PASSWORD_ALPHABET = "abcdefghjkmnpqrstuvwxyz23456789";
3257
+ var PASSWORD_GROUPS = 4;
3258
+ var PASSWORD_GROUP_LENGTH = 4;
3259
+ function generatedPassword() {
3260
+ const limit = 256 - 256 % PASSWORD_ALPHABET.length;
3261
+ const groups = [];
3262
+ let group = "";
3263
+ while (groups.length < PASSWORD_GROUPS) {
3264
+ for (const byte of randomBytes(PASSWORD_GROUPS * PASSWORD_GROUP_LENGTH * 2)) {
3265
+ if (byte >= limit) continue;
3266
+ group += PASSWORD_ALPHABET[byte % PASSWORD_ALPHABET.length];
3267
+ if (group.length === PASSWORD_GROUP_LENGTH) {
3268
+ groups.push(group);
3269
+ group = "";
3270
+ if (groups.length === PASSWORD_GROUPS) break;
3271
+ }
3272
+ }
3273
+ }
3274
+ return groups.join("-");
3275
+ }
3276
+ function withAppId(env, decl, opts, id) {
3277
+ if (decl.env === void 0 || opts.platform === void 0) return env;
3278
+ return { ...env, [PLATFORM_ENV.app_id]: id };
3279
+ }
3174
3280
  var EMPTY = /* @__PURE__ */ new Set();
3175
3281
  function secretHash(name, value) {
3176
3282
  return createHash2("sha256").update(`${name}\0`).update(value).digest("hex");
@@ -3214,7 +3320,7 @@ async function createApp(client, decl, env, tree, migrations, opts, appIds) {
3214
3320
  ...decl.mcp !== void 0 ? { mcp: decl.mcp } : {}
3215
3321
  });
3216
3322
  appIds.set(decl.name, created.id);
3217
- await writeApp(client, created.id, env, tree);
3323
+ await writeApp(client, created.id, withAppId(env, decl, opts, created.id), tree);
3218
3324
  const notes = [];
3219
3325
  if (migrations.length > 0) notes.push((await applyMigrations(client, created.id, migrations)).note);
3220
3326
  if (decl.buckets !== void 0) notes.push((await applyBuckets(client, created.id, decl.buckets)).note);
@@ -3228,7 +3334,8 @@ async function createApp(client, decl, env, tree, migrations, opts, appIds) {
3228
3334
  }
3229
3335
  async function upsertApp(client, decl, opts, appIds) {
3230
3336
  const declared = planEnv(decl, opts);
3231
- const names = declared.map((one) => one.name);
3337
+ const writesAppId = decl.env !== void 0 && opts.platform !== void 0;
3338
+ const names = [...declared.map((one) => one.name), ...writesAppId ? [PLATFORM_ENV.app_id] : []];
3232
3339
  const note = (notes) => notes.length > 0 ? { reason: notes.join("; ") } : {};
3233
3340
  const mcpPlan = decl.mcp !== void 0 ? [`will set mcp ${decl.mcp}`] : [];
3234
3341
  const migrationPlan = decl.migrations !== void 0 ? [`will apply migrations ${decl.migrations.join(", ")}`] : [];
@@ -3243,8 +3350,8 @@ async function upsertApp(client, decl, opts, appIds) {
3243
3350
  ...note([...willSet, ...mcpPlan, ...decl.deploy_dir ? [`will deploy ${decl.deploy_dir}`] : [], ...migrationPlan, ...bucketPlan])
3244
3351
  };
3245
3352
  }
3246
- const { values } = await materialize(declared, EMPTY, false);
3247
- return createApp(client, decl, values, builtTree(decl, opts), declaredMigrations(decl, opts), opts, appIds);
3353
+ const { values: values2 } = await materialize(declared, EMPTY, false);
3354
+ return createApp(client, decl, values2, builtTree(decl, opts), declaredMigrations(decl, opts), opts, appIds);
3248
3355
  }
3249
3356
  const owned = current.project === opts.project;
3250
3357
  if (!owned && !opts.adopt) {
@@ -3273,7 +3380,8 @@ async function upsertApp(client, decl, opts, appIds) {
3273
3380
  const managed = new Set(names);
3274
3381
  const unmanaged = live.map((secret) => secret.name).filter((name) => !managed.has(name));
3275
3382
  const held = new Map(live.map((secret) => [secret.name, secret.value_hash]));
3276
- const { values: env, unmade } = await materialize(declared, new Set(held.keys()), opts.dryRun);
3383
+ const { values, unmade } = await materialize(declared, new Set(held.keys()), opts.dryRun);
3384
+ const env = withAppId(values, decl, opts, current.id);
3277
3385
  const staleEnv = Object.fromEntries(
3278
3386
  Object.entries(env).filter(([name, value]) => held.get(name) !== secretHash(name, value))
3279
3387
  );
@@ -3742,6 +3850,8 @@ export {
3742
3850
  collectFiles,
3743
3851
  contentHash,
3744
3852
  defineProject,
3853
+ generatedPassword,
3854
+ generatedSecret,
3745
3855
  hasRoster,
3746
3856
  loadConfig,
3747
3857
  migrationFiles,