@bike4mind/cli 4.10.0 → 5.0.1

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.
Files changed (38) hide show
  1. package/dist/{AgentHistoryStore-CjGVgxLR.mjs → AgentHistoryStore-DW6BBbVj.mjs} +624 -114
  2. package/dist/{ApiClient-SVXSI3HI.mjs → ApiClient-D4bDuWXg.mjs} +3 -3
  3. package/dist/{BubblewrapRuntime-CTc_KPnd.mjs → BubblewrapRuntime-D3EO5Y0C.mjs} +2 -2
  4. package/dist/{ConfigStore-B2Dy-PT9.mjs → ConfigStore-BuLA_-uZ.mjs} +17 -1
  5. package/dist/ConfigStore-DdqxfmDr.mjs +2 -0
  6. package/dist/{Logger-7MmrU5w6.mjs → Logger-CjaYx85U.mjs} +1560 -805
  7. package/dist/{RemoteSkillSource-D_F99yBR.mjs → RemoteSkillSource-HqoLRV56.mjs} +2 -6
  8. package/dist/{SandboxOrchestrator-CeDwd6Fj.mjs → SandboxOrchestrator-yORi2eFV.mjs} +1 -1
  9. package/dist/{SandboxRuntimeAdapter-CFEIywKt.mjs → SandboxRuntimeAdapter-BjJwJNfg.mjs} +1 -1
  10. package/dist/{SandboxRuntimeAdapter-CjNDzYSf.mjs → SandboxRuntimeAdapter-BmkaFzqU.mjs} +2 -2
  11. package/dist/{SeatbeltRuntime-CQItj-F1.mjs → SeatbeltRuntime-CyZNmFwD.mjs} +2 -2
  12. package/dist/{WorkItemsClient-C9_pjHCo.mjs → WorkItemsClient-xmo0DrCm.mjs} +1 -1
  13. package/dist/{buildToolSearch-8xyBwXRx.mjs → buildToolSearch-CXxEtVKc.mjs} +2 -2
  14. package/dist/commands/acpCommand.mjs +6 -6
  15. package/dist/commands/apiCommand.mjs +1 -1
  16. package/dist/commands/doctorCommand.mjs +2 -2
  17. package/dist/commands/envCommand.mjs +1 -1
  18. package/dist/commands/headlessCommand.mjs +7 -7
  19. package/dist/commands/mcpCommand.mjs +3 -3
  20. package/dist/commands/mirrorCommand.mjs +2 -2
  21. package/dist/commands/modelsCommand.mjs +4 -4
  22. package/dist/commands/pluginCommand.mjs +1 -1
  23. package/dist/commands/skillsCommand.mjs +4 -4
  24. package/dist/commands/updateCommand.mjs +2 -2
  25. package/dist/{createFile-B8bur5Rb-CVzCarEA.mjs → createFile-CPKmd6Uf-Bk-3V2T3.mjs} +3 -3
  26. package/dist/{deleteFile-9B3gW_Nb-DG2sovIl.mjs → deleteFile-CD_xQ7Y6-C1X4Ievb.mjs} +17 -4
  27. package/dist/{dist-DHgMhdzV.mjs → dist-DsMzCRLX.mjs} +96 -34
  28. package/dist/{fit-D8Quui6j.mjs → fit-C9eLTDcR.mjs} +3 -3
  29. package/dist/{globFiles-CwJ8qmYo-BR5b2KvO.mjs → globFiles-CoapsO8G-CpvQo-R2.mjs} +9 -5
  30. package/dist/{grepSearch-CLtEqT4j-BnKPtNWr.mjs → grepSearch-DeH7M2e7-BIvo-yNy.mjs} +2 -2
  31. package/dist/index.mjs +12 -417
  32. package/dist/{modelServers-JsKBm7Wn.mjs → modelServers-DeOGFwLi.mjs} +1 -1
  33. package/dist/{package-r_xumsGY.mjs → package-CvffLo0I.mjs} +1 -1
  34. package/dist/{pathValidation-BRqf4HFX-CHwtwp3O.mjs → pathValidation-C4ADzpUR-BPIpINwZ.mjs} +36 -12
  35. package/dist/{serve-BM9PKMLH.mjs → serve-tmC__JNj.mjs} +6 -6
  36. package/dist/{updateChecker-BOqaLeZU.mjs → updateChecker-U4AfrPKj.mjs} +1 -1
  37. package/package.json +10 -11
  38. package/dist/ConfigStore-zlY0PikB.mjs +0 -2
@@ -29,7 +29,7 @@ const SIGNUP_RISK_REVIEW_STATES = [
29
29
  "banned"
30
30
  ];
31
31
  //#endregion
32
- //#region ../../b4m-core/common/dist/skillMdSource-CNWRf6Lw.mjs
32
+ //#region ../../b4m-core/common/dist/skillMdSource-Bt2JzY-l.mjs
33
33
  /**
34
34
  * The marker an exported SKILL.md carries so Bike4Mind can recognize its own exports. The B4M
35
35
  * CLI/desktop loader (packages/cli CustomCommandStore) skips stamped files, and a future CLI sync
@@ -65,7 +65,7 @@ function readSkillMdSourceUrl(frontmatter) {
65
65
  }
66
66
  /**
67
67
  * True when the file's frontmatter carries the source stamp. Reads the raw fence text because the
68
- * stamp is a YAML comment, which every YAML parser (gray-matter included) discards.
68
+ * stamp is a YAML comment, which every YAML parser discards.
69
69
  */
70
70
  function frontmatterHasSourceStamp(text) {
71
71
  const split = splitSkillMdFrontmatter(text);
@@ -246,7 +246,6 @@ const delegationPayloadSchema = z$1.looseObject({
246
246
  const INSTRUCTION_LIMIT_REACHED_ERROR_CODE = "instruction_limit_reached";
247
247
  const UNKNOWN_MODEL_ERROR_CODE = "unknown_model";
248
248
  const MODEL_REQUIRES_SUBSCRIPTION_ERROR_CODE = "model_requires_subscription";
249
- const FREE_QUEST_LIMIT_REACHED_ERROR_CODE = "free_quest_limit_reached";
250
249
  const BILLING_ORGANIZATION_MISMATCH_ERROR_CODE = "billing_organization_mismatch";
251
250
  const REQUEST_TIMEOUT_ERROR_CODE = "request_timeout";
252
251
  const OUTPUT_BUDGET_EXHAUSTED_ERROR_CODE = "output_budget_exhausted";
@@ -4448,6 +4447,504 @@ z$1.enum([
4448
4447
  "external",
4449
4448
  "internal"
4450
4449
  ]);
4450
+ /**
4451
+ * Official B4M LLM tools.
4452
+ */
4453
+ const b4mLLMTools = z$1.enum([
4454
+ "dice_roll",
4455
+ "image_generation",
4456
+ "edit_image",
4457
+ "music_generation",
4458
+ "audio_generation",
4459
+ "video_generation",
4460
+ "production_storyboard",
4461
+ "production_generate_shot",
4462
+ "production_add_audio",
4463
+ "production_assemble",
4464
+ "weather_info",
4465
+ "web_search",
4466
+ "web_fetch",
4467
+ "wolfram_alpha",
4468
+ "math_evaluate",
4469
+ "mermaid_chart",
4470
+ "current_datetime",
4471
+ "current_model_details",
4472
+ "deep_research",
4473
+ "prompt_enhancement",
4474
+ "recharts",
4475
+ "edit_file",
4476
+ "blog_publish",
4477
+ "blog_edit",
4478
+ "blog_draft",
4479
+ "wikipedia_on_this_day",
4480
+ "moon_phase",
4481
+ "sunrise_sunset",
4482
+ "iss_tracker",
4483
+ "planet_visibility",
4484
+ "search_knowledge_base",
4485
+ "chess_engine",
4486
+ "retrieve_knowledge_content",
4487
+ "count_knowledge_base",
4488
+ "describe_knowledge_base",
4489
+ "decide",
4490
+ "list_my_data_lakes",
4491
+ "create_data_lake",
4492
+ "save_content_to_data_lake",
4493
+ "delegate_to_agent",
4494
+ "optihashi_schedule",
4495
+ "optihashi_formulate",
4496
+ "optihashi_edit_problem",
4497
+ "navigate_view",
4498
+ "generate_jupyter_notebook",
4499
+ "excel_generation",
4500
+ "fmp_financial_data",
4501
+ "bob_panel_read",
4502
+ "skill"
4503
+ ]);
4504
+ /**
4505
+ * The data-lake tools that write (make a lake, persist a file into one). A route withholds these
4506
+ * from an API key without datalake:write (dataLakeToolsDeniedFor in the client's
4507
+ * dataLakeScopes.ts).
4508
+ */
4509
+ const DATA_LAKE_WRITE_TOOL_NAMES = ["create_data_lake", "save_content_to_data_lake"];
4510
+ /** Every data-lake tool - offered, trimmed and paired together (see resolveEnabledTools in services). */
4511
+ const DATA_LAKE_TOOL_NAMES = [...["list_my_data_lakes"], ...DATA_LAKE_WRITE_TOOL_NAMES];
4512
+ b4mLLMTools.options.map((tool) => tool);
4513
+ /**
4514
+ * Recharts chart types.
4515
+ */
4516
+ const RechartsChartTypeSchema = z$1.enum([
4517
+ "LineChart",
4518
+ "AreaChart",
4519
+ "BarChart",
4520
+ "PieChart",
4521
+ "ScatterChart",
4522
+ "RadialBarChart",
4523
+ "ComposedChart",
4524
+ "Treemap",
4525
+ "FunnelChart",
4526
+ "RadarChart"
4527
+ ]);
4528
+ RechartsChartTypeSchema.enum;
4529
+ /**
4530
+ * Schema for LLM model fallback information
4531
+ */
4532
+ const FallbackInfoSchema = z$1.object({
4533
+ sessionId: z$1.string(),
4534
+ primaryModel: z$1.string(),
4535
+ primaryModelName: z$1.string(),
4536
+ fallbackModel: z$1.string(),
4537
+ fallbackModelName: z$1.string(),
4538
+ /**
4539
+ * Backend of each side, so the badge can name the provider path without
4540
+ * inferring it from the id - a bare `deepseek-*` slug is the direct API on a
4541
+ * hosted deployment and an Ollama pull on a self-hosted one. Optional and
4542
+ * loosely typed: these payloads are persisted in browser storage, so a record
4543
+ * written by an older build has neither field and an unknown backend name from
4544
+ * a newer one must not fail the parse.
4545
+ */
4546
+ primaryModelBackend: z$1.string().optional(),
4547
+ fallbackModelBackend: z$1.string().optional(),
4548
+ /** The error that forced the first hop, PII-scrubbed and length-capped by sanitizeTelemetryError. */
4549
+ reason: z$1.string().optional(),
4550
+ timestamp: z$1.number()
4551
+ });
4552
+ const ArtifactMetadataSchema = z$1.object({
4553
+ language: z$1.string().optional(),
4554
+ dependencies: z$1.array(z$1.string()).optional(),
4555
+ settings: z$1.record(z$1.string(), z$1.unknown()).optional()
4556
+ });
4557
+ const ArtifactTypeSchema = z$1.enum([
4558
+ "mermaid",
4559
+ "recharts",
4560
+ "chess",
4561
+ "python",
4562
+ "react",
4563
+ "html",
4564
+ "svg",
4565
+ "code",
4566
+ "quest",
4567
+ "file",
4568
+ "questmaster",
4569
+ "lattice",
4570
+ "blog-draft"
4571
+ ]);
4572
+ [...new Set(Object.values({
4573
+ mermaid: {
4574
+ name: "Mermaid Diagram",
4575
+ description: "Flowcharts, sequence diagrams, and other visual diagrams using Mermaid syntax",
4576
+ category: "visualization",
4577
+ mimeType: "text/plain"
4578
+ },
4579
+ recharts: {
4580
+ name: "Chart/Graph",
4581
+ description: "Interactive charts and graphs using Recharts library",
4582
+ category: "visualization",
4583
+ mimeType: "application/json"
4584
+ },
4585
+ python: {
4586
+ name: "Python Script",
4587
+ description: "Python code for data processing, analysis, and automation",
4588
+ category: "code",
4589
+ mimeType: "text/x-python"
4590
+ },
4591
+ react: {
4592
+ name: "React Component",
4593
+ description: "Interactive React components with JSX and hooks",
4594
+ category: "interactive",
4595
+ mimeType: "text/javascript"
4596
+ },
4597
+ html: {
4598
+ name: "HTML Document",
4599
+ description: "Static HTML pages with CSS styling",
4600
+ category: "web",
4601
+ mimeType: "text/html"
4602
+ },
4603
+ svg: {
4604
+ name: "SVG Graphics",
4605
+ description: "Scalable Vector Graphics for illustrations and icons",
4606
+ category: "graphics",
4607
+ mimeType: "image/svg+xml"
4608
+ },
4609
+ code: {
4610
+ name: "Generic Code",
4611
+ description: "General purpose code in various programming languages",
4612
+ category: "code",
4613
+ mimeType: "text/plain"
4614
+ },
4615
+ quest: {
4616
+ name: "Quest/Tutorial",
4617
+ description: "Learning quests and interactive tutorials",
4618
+ category: "education",
4619
+ mimeType: "application/json"
4620
+ },
4621
+ file: {
4622
+ name: "File Artifact",
4623
+ description: "Generic file artifacts for documents and media",
4624
+ category: "document",
4625
+ mimeType: "application/octet-stream"
4626
+ },
4627
+ questmaster: {
4628
+ name: "QuestMaster Plan",
4629
+ description: "Complex multi-step learning plans with dependencies",
4630
+ category: "education",
4631
+ mimeType: "application/json"
4632
+ },
4633
+ lattice: {
4634
+ name: "Financial Model",
4635
+ description: "Financial pro-forma models and projections",
4636
+ category: "finance",
4637
+ mimeType: "application/json"
4638
+ },
4639
+ chess: {
4640
+ name: "Chess Game",
4641
+ description: "Interactive chess board with move validation and AI opponent",
4642
+ category: "interactive",
4643
+ mimeType: "application/json"
4644
+ },
4645
+ "blog-draft": {
4646
+ name: "Blog Draft",
4647
+ description: "Drafted blog/social content ready for review and publishing",
4648
+ category: "document",
4649
+ mimeType: "application/json"
4650
+ }
4651
+ }).map((info) => info.category))];
4652
+ const ArtifactSchema = z$1.object({
4653
+ id: z$1.string(),
4654
+ type: ArtifactTypeSchema,
4655
+ title: z$1.string(),
4656
+ content: z$1.string(),
4657
+ preview: z$1.string().optional(),
4658
+ metadata: ArtifactMetadataSchema.optional(),
4659
+ version: z$1.int().positive().prefault(1).optional(),
4660
+ createdAt: z$1.date(),
4661
+ updatedAt: z$1.date()
4662
+ });
4663
+ ArtifactSchema.extend({
4664
+ type: z$1.literal("quest"),
4665
+ metadata: ArtifactMetadataSchema.extend({
4666
+ complexity: z$1.string(),
4667
+ status: z$1.string(),
4668
+ subQuests: z$1.array(z$1.object({
4669
+ id: z$1.string(),
4670
+ title: z$1.string(),
4671
+ status: z$1.string()
4672
+ }))
4673
+ })
4674
+ });
4675
+ ArtifactSchema.extend({
4676
+ type: z$1.literal("react"),
4677
+ metadata: ArtifactMetadataSchema.extend({
4678
+ dependencies: z$1.array(z$1.string()).prefault([]),
4679
+ props: z$1.record(z$1.string(), z$1.unknown()).optional(),
4680
+ hasDefaultExport: z$1.boolean().prefault(true),
4681
+ errorBoundary: z$1.boolean().prefault(true)
4682
+ })
4683
+ });
4684
+ ArtifactSchema.extend({
4685
+ type: z$1.literal("html"),
4686
+ metadata: ArtifactMetadataSchema.extend({
4687
+ allowedScripts: z$1.array(z$1.string()).prefault([]),
4688
+ cspPolicy: z$1.string().optional(),
4689
+ sanitized: z$1.boolean().prefault(true)
4690
+ })
4691
+ });
4692
+ ArtifactSchema.extend({
4693
+ type: z$1.literal("svg"),
4694
+ metadata: ArtifactMetadataSchema.extend({
4695
+ viewBox: z$1.string().optional(),
4696
+ width: z$1.number().optional(),
4697
+ height: z$1.number().optional(),
4698
+ sanitized: z$1.boolean().prefault(true)
4699
+ })
4700
+ });
4701
+ ArtifactSchema.extend({
4702
+ type: z$1.literal("mermaid"),
4703
+ metadata: ArtifactMetadataSchema.extend({
4704
+ chartType: z$1.enum([
4705
+ "flowchart",
4706
+ "sequenceDiagram",
4707
+ "classDiagram",
4708
+ "stateDiagram",
4709
+ "entityRelationshipDiagram",
4710
+ "gantt",
4711
+ "pie",
4712
+ "mindmap"
4713
+ ]).optional(),
4714
+ description: z$1.string().optional()
4715
+ })
4716
+ });
4717
+ ArtifactSchema.extend({
4718
+ type: z$1.literal("recharts"),
4719
+ metadata: ArtifactMetadataSchema.extend({
4720
+ chartType: RechartsChartTypeSchema.optional(),
4721
+ description: z$1.string().optional(),
4722
+ dataPoints: z$1.number().optional(),
4723
+ width: z$1.number().optional(),
4724
+ height: z$1.number().optional(),
4725
+ xAxis: z$1.string().optional(),
4726
+ yAxis: z$1.string().optional(),
4727
+ colors: z$1.array(z$1.string()).optional()
4728
+ })
4729
+ });
4730
+ ArtifactSchema.extend({
4731
+ type: z$1.literal("chess"),
4732
+ metadata: ArtifactMetadataSchema.extend({
4733
+ fen: z$1.string().optional(),
4734
+ turn: z$1.enum(["w", "b"]).optional(),
4735
+ lastMove: z$1.object({
4736
+ from: z$1.string(),
4737
+ to: z$1.string(),
4738
+ san: z$1.string().optional()
4739
+ }).optional(),
4740
+ isCheck: z$1.boolean().optional(),
4741
+ isCheckmate: z$1.boolean().optional(),
4742
+ isDraw: z$1.boolean().optional(),
4743
+ isGameOver: z$1.boolean().optional(),
4744
+ moveNumber: z$1.number().optional()
4745
+ })
4746
+ });
4747
+ ArtifactSchema.extend({
4748
+ type: z$1.literal("lattice"),
4749
+ metadata: ArtifactMetadataSchema.extend({
4750
+ modelType: z$1.enum([
4751
+ "income_statement",
4752
+ "balance_sheet",
4753
+ "cashflow",
4754
+ "saas_metrics",
4755
+ "custom"
4756
+ ]).optional(),
4757
+ periodGrain: z$1.enum([
4758
+ "month",
4759
+ "quarter",
4760
+ "year"
4761
+ ]).optional(),
4762
+ currency: z$1.string().prefault("USD"),
4763
+ entityCount: z$1.int().nonnegative().optional(),
4764
+ ruleCount: z$1.int().nonnegative().optional(),
4765
+ lastComputedAt: z$1.date().optional()
4766
+ })
4767
+ });
4768
+ ArtifactSchema.extend({
4769
+ type: z$1.literal("python"),
4770
+ metadata: ArtifactMetadataSchema.extend({
4771
+ packages: z$1.array(z$1.string()).default([]),
4772
+ hasOutput: z$1.boolean().default(false),
4773
+ executionState: z$1.enum([
4774
+ "idle",
4775
+ "running",
4776
+ "completed",
4777
+ "error"
4778
+ ]).optional(),
4779
+ lastExecutionTime: z$1.number().optional()
4780
+ })
4781
+ });
4782
+ z$1.object({
4783
+ chartType: z$1.enum([
4784
+ "flowchart",
4785
+ "sequenceDiagram",
4786
+ "classDiagram",
4787
+ "stateDiagram",
4788
+ "entityRelationshipDiagram",
4789
+ "gantt",
4790
+ "pie",
4791
+ "mindmap"
4792
+ ]).optional(),
4793
+ description: z$1.string().optional()
4794
+ });
4795
+ z$1.object({ artifacts: z$1.array(ArtifactSchema).optional() });
4796
+ const ArtifactOperationSchema = z$1.enum([
4797
+ "create",
4798
+ "update",
4799
+ "rewrite"
4800
+ ]);
4801
+ z$1.object({
4802
+ operation: ArtifactOperationSchema,
4803
+ artifactId: z$1.string().optional(),
4804
+ type: ArtifactTypeSchema,
4805
+ title: z$1.string(),
4806
+ content: z$1.string(),
4807
+ metadata: ArtifactMetadataSchema.optional()
4808
+ });
4809
+ String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
4810
+ const ClaudeArtifactMimeTypes = {
4811
+ REACT: "application/vnd.ant.react",
4812
+ HTML: "text/html",
4813
+ SVG: "image/svg+xml",
4814
+ MERMAID: "application/vnd.ant.mermaid",
4815
+ RECHARTS: "application/vnd.ant.recharts",
4816
+ CHESS: "application/vnd.ant.chess",
4817
+ CODE: "application/vnd.ant.code",
4818
+ MARKDOWN: "text/markdown",
4819
+ LATTICE: "application/vnd.b4m.lattice",
4820
+ PYTHON: "application/vnd.ant.python",
4821
+ BLOG_DRAFT: "application/vnd.b4m.blog-draft"
4822
+ };
4823
+ const ArtifactStatusSchema = z$1.enum([
4824
+ "draft",
4825
+ "review",
4826
+ "published",
4827
+ "archived",
4828
+ "deleted"
4829
+ ]);
4830
+ const VisibilitySchema = z$1.enum([
4831
+ "private",
4832
+ "project",
4833
+ "organization",
4834
+ "public"
4835
+ ]);
4836
+ const ArtifactPermissionsSchema = z$1.object({
4837
+ canRead: z$1.array(z$1.string()),
4838
+ canWrite: z$1.array(z$1.string()),
4839
+ canDelete: z$1.array(z$1.string()),
4840
+ isPublic: z$1.boolean().prefault(false),
4841
+ inheritFromProject: z$1.boolean().prefault(true)
4842
+ });
4843
+ const BaseArtifactSchema = z$1.object({
4844
+ id: z$1.uuid(),
4845
+ type: ArtifactTypeSchema,
4846
+ title: z$1.string().min(1).max(255),
4847
+ description: z$1.string().max(1e3).optional(),
4848
+ version: z$1.int().positive().prefault(1),
4849
+ versionTag: z$1.string().max(100).optional(),
4850
+ currentVersionId: z$1.uuid().optional(),
4851
+ parentVersionId: z$1.uuid().optional(),
4852
+ createdAt: z$1.date(),
4853
+ updatedAt: z$1.date(),
4854
+ publishedAt: z$1.date().optional(),
4855
+ deletedAt: z$1.date().optional(),
4856
+ userId: z$1.string(),
4857
+ projectId: z$1.string().optional(),
4858
+ organizationId: z$1.string().optional(),
4859
+ visibility: VisibilitySchema.prefault("private"),
4860
+ permissions: ArtifactPermissionsSchema,
4861
+ sourceQuestId: z$1.string().optional(),
4862
+ sessionId: z$1.string().optional(),
4863
+ parentArtifactId: z$1.uuid().optional(),
4864
+ identifier: z$1.string().optional(),
4865
+ status: ArtifactStatusSchema.prefault("draft"),
4866
+ tags: z$1.array(z$1.string().max(50)).max(20).prefault([]),
4867
+ contentHash: z$1.string(),
4868
+ contentSize: z$1.int().nonnegative(),
4869
+ metadata: z$1.record(z$1.string(), z$1.unknown()).optional()
4870
+ });
4871
+ const EnhancedArtifactMetadataSchema = z$1.object({
4872
+ language: z$1.string().optional(),
4873
+ dependencies: z$1.array(z$1.string()).optional(),
4874
+ settings: z$1.record(z$1.string(), z$1.unknown()).optional()
4875
+ });
4876
+ BaseArtifactSchema.extend({
4877
+ type: z$1.literal("react"),
4878
+ content: z$1.string(),
4879
+ metadata: EnhancedArtifactMetadataSchema.extend({
4880
+ dependencies: z$1.array(z$1.string()),
4881
+ props: z$1.record(z$1.string(), z$1.unknown()).optional(),
4882
+ hasDefaultExport: z$1.boolean(),
4883
+ errorBoundary: z$1.boolean().prefault(true)
4884
+ })
4885
+ });
4886
+ BaseArtifactSchema.extend({
4887
+ type: z$1.literal("html"),
4888
+ content: z$1.string(),
4889
+ metadata: EnhancedArtifactMetadataSchema.extend({
4890
+ allowedScripts: z$1.array(z$1.string()).prefault([]),
4891
+ cspPolicy: z$1.string().optional(),
4892
+ sanitized: z$1.boolean().prefault(false)
4893
+ })
4894
+ });
4895
+ BaseArtifactSchema.extend({
4896
+ type: z$1.literal("svg"),
4897
+ content: z$1.string(),
4898
+ metadata: EnhancedArtifactMetadataSchema.extend({
4899
+ viewBox: z$1.string().optional(),
4900
+ width: z$1.number().positive().optional(),
4901
+ height: z$1.number().positive().optional(),
4902
+ sanitized: z$1.boolean().prefault(false)
4903
+ })
4904
+ });
4905
+ BaseArtifactSchema.extend({
4906
+ type: z$1.literal("mermaid"),
4907
+ content: z$1.string(),
4908
+ metadata: EnhancedArtifactMetadataSchema.extend({
4909
+ chartType: z$1.enum([
4910
+ "flowchart",
4911
+ "sequenceDiagram",
4912
+ "classDiagram",
4913
+ "stateDiagram",
4914
+ "entityRelationshipDiagram",
4915
+ "gantt",
4916
+ "pie",
4917
+ "mindmap"
4918
+ ]).optional(),
4919
+ description: z$1.string().optional()
4920
+ })
4921
+ });
4922
+ BaseArtifactSchema.extend({
4923
+ type: z$1.literal("python"),
4924
+ content: z$1.string(),
4925
+ metadata: EnhancedArtifactMetadataSchema.extend({
4926
+ packages: z$1.array(z$1.string()).default([]),
4927
+ hasOutput: z$1.boolean().default(false),
4928
+ executionState: z$1.enum([
4929
+ "idle",
4930
+ "running",
4931
+ "completed",
4932
+ "error"
4933
+ ]).optional(),
4934
+ lastExecutionTime: z$1.number().optional()
4935
+ })
4936
+ });
4937
+ /** `verified` when at least one cited worked example passed on the server at promotion; otherwise `unverified`. */
4938
+ const CALLABLE_FUNCTION_TRUST_LABELS = ["verified", "unverified"];
4939
+ VisibilitySchema.exclude(["public"]);
4940
+ const CALLABLE_FUNCTION_DATA_LIMITS = {
4941
+ maxPins: 10,
4942
+ /** Defaults of the `CallableFunctionDataFileMaxMb` and `CallableFunctionDataTotalMaxMb` settings. */
4943
+ defaultFileMb: 100,
4944
+ defaultTotalMb: 1024,
4945
+ /** The runtime's data cache, and so the most `CallableFunctionDataTotalMaxMb` can allow. */
4946
+ cacheMb: 9216
4947
+ };
4451
4948
  /** An `owner/name` GitHub repository; also used by the worker's repository check. */
4452
4949
  const SECOPS_TRIAGE_REPO_PATTERN = /^[\w.-]+\/[\w.-]+$/;
4453
4950
  const MAX_ISSUES_MESSAGE = "Max issues per scan must be between 1 and 100";
@@ -5107,9 +5604,9 @@ z$1.enum([
5107
5604
  "UseFormatPrompt",
5108
5605
  "EnableDeferredToolLoading",
5109
5606
  "DeferredToolStartSetMaxTokens",
5110
- "EnableQuestMaster",
5607
+ "evaluationUserIds",
5608
+ "evaluationModelIds",
5111
5609
  "QuestMasterLegacyShutdownDate",
5112
- "EnableQuestMasterDefault",
5113
5610
  "EnableHearth",
5114
5611
  "EnableHearthDefault",
5115
5612
  "EnableMementos",
@@ -5121,6 +5618,8 @@ z$1.enum([
5121
5618
  "EnableCallableFunctionsMcp",
5122
5619
  "CallableFunctionTimeLimitSeconds",
5123
5620
  "CallableFunctionPendingCallLimit",
5621
+ "CallableFunctionDataFileMaxMb",
5622
+ "CallableFunctionDataTotalMaxMb",
5124
5623
  "EnableAgents",
5125
5624
  "EnableAgentsDefault",
5126
5625
  "EnableAgentMode",
@@ -5203,6 +5702,7 @@ z$1.enum([
5203
5702
  "EnableUserDeletionEmailNotification",
5204
5703
  "EnableUserDeletionSlackNotification",
5205
5704
  "AdminEmail",
5705
+ "mailFrom",
5206
5706
  "MaxFileSize",
5207
5707
  "AiEditVersionRetention",
5208
5708
  "DefaultContext",
@@ -5364,6 +5864,8 @@ z$1.enum([
5364
5864
  "spendMonitorAutoPauseTrustedMinCredits",
5365
5865
  "youngAccountSpendPageUsdPerHour",
5366
5866
  "youngAccountSpendWarnUsdPerHour",
5867
+ "providerSpendOpenaiUsdPerHour",
5868
+ "providerSpendAnthropicUsdPerHour",
5367
5869
  "freeTierDailySystemCostCapUsd",
5368
5870
  "signupGrantSignupPoolDaily",
5369
5871
  "signupGrantTricklePoolDaily",
@@ -6245,7 +6747,10 @@ const SIGNUP_RISK_SIGNALS = [
6245
6747
  "fastSpend",
6246
6748
  "generatedLocalPart",
6247
6749
  "wafAnonIp",
6248
- "wafBotSignal"
6750
+ "wafBotSignal",
6751
+ "emailSubdomainBurst",
6752
+ "bannedEmailSubdomainSibling",
6753
+ "instantApiKey"
6249
6754
  ];
6250
6755
  const signupRiskWeight = (defaultValue) => z$1.number().min(0).max(100).prefault(defaultValue);
6251
6756
  /**
@@ -6262,10 +6767,22 @@ const SignupRiskScoringSchema = z$1.object({
6262
6767
  fastSpend: signupRiskWeight(20),
6263
6768
  generatedLocalPart: signupRiskWeight(10),
6264
6769
  wafAnonIp: signupRiskWeight(0),
6265
- wafBotSignal: signupRiskWeight(0)
6770
+ wafBotSignal: signupRiskWeight(0),
6771
+ emailSubdomainBurst: signupRiskWeight(30),
6772
+ bannedEmailSubdomainSibling: signupRiskWeight(30),
6773
+ instantApiKey: signupRiskWeight(20)
6266
6774
  }).strict().prefault({}),
6267
6775
  /** A first API key minted within this many minutes of signup counts as quick. */
6268
6776
  quickApiKeyMinutes: z$1.number().int().min(1).max(10080).prefault(60),
6777
+ /** A first API key minted within this many seconds of signup counts as instant; it also counts as quick. */
6778
+ instantApiKeySeconds: z$1.number().int().min(1).max(3600).prefault(120),
6779
+ /**
6780
+ * Accounts (this one included) on the same email subdomain within `emailSubdomainWindowHours` either
6781
+ * side of signup at which emailSubdomainBurst applies. Only a subdomain host counts, never a bare
6782
+ * registrable domain, so a shared mail provider cannot trip it.
6783
+ */
6784
+ emailSubdomainBurstAccounts: z$1.number().int().min(2).max(1e3).prefault(3),
6785
+ emailSubdomainWindowHours: z$1.number().int().min(1).max(720).prefault(24),
6269
6786
  /** Credits spent in the first 24h at which fastSpend reaches its full weight; less scales linearly. */
6270
6787
  fastSpendCredits: z$1.number().positive().prefault(1e3),
6271
6788
  /** A score at or above this needs review. */
@@ -7095,6 +7612,14 @@ const API_SERVICE_GROUPS = {
7095
7612
  key: "CallableFunctionPendingCallLimit",
7096
7613
  order: 24.6
7097
7614
  },
7615
+ {
7616
+ key: "CallableFunctionDataFileMaxMb",
7617
+ order: 24.7
7618
+ },
7619
+ {
7620
+ key: "CallableFunctionDataTotalMaxMb",
7621
+ order: 24.8
7622
+ },
7098
7623
  {
7099
7624
  key: "EnableBriefcase",
7100
7625
  order: 25
@@ -7207,14 +7732,6 @@ const API_SERVICE_GROUPS = {
7207
7732
  key: "SimulatorComputeCreditsPerRound",
7208
7733
  order: 91.5
7209
7734
  },
7210
- {
7211
- key: "EnableQuestMaster",
7212
- order: 92
7213
- },
7214
- {
7215
- key: "EnableQuestMasterDefault",
7216
- order: 93
7217
- },
7218
7735
  {
7219
7736
  key: "QuestMasterLegacyShutdownDate",
7220
7737
  order: 93.5
@@ -7521,6 +8038,14 @@ const API_SERVICE_GROUPS = {
7521
8038
  key: "youngAccountSpendWarnUsdPerHour",
7522
8039
  order: 19.496
7523
8040
  },
8041
+ {
8042
+ key: "providerSpendOpenaiUsdPerHour",
8043
+ order: 19.497
8044
+ },
8045
+ {
8046
+ key: "providerSpendAnthropicUsdPerHour",
8047
+ order: 19.498
8048
+ },
7524
8049
  {
7525
8050
  key: "freeTierDailySystemCostCapUsd",
7526
8051
  order: 19.5
@@ -7789,13 +8314,20 @@ const API_SERVICE_GROUPS = {
7789
8314
  name: "Server Administration",
7790
8315
  description: "Server status and administrative settings",
7791
8316
  icon: "AdminPanelSettings",
7792
- settings: [{
7793
- key: "serverStatus",
7794
- order: 1
7795
- }, {
7796
- key: "AdminEmail",
7797
- order: 2
7798
- }]
8317
+ settings: [
8318
+ {
8319
+ key: "serverStatus",
8320
+ order: 1
8321
+ },
8322
+ {
8323
+ key: "AdminEmail",
8324
+ order: 2
8325
+ },
8326
+ {
8327
+ key: "mailFrom",
8328
+ order: 3
8329
+ }
8330
+ ]
7799
8331
  },
7800
8332
  REGISTRATION: {
7801
8333
  id: "registrationService",
@@ -8602,25 +9134,6 @@ const settingsMap = {
8602
9134
  group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
8603
9135
  order: 89
8604
9136
  }),
8605
- EnableQuestMaster: makeBooleanSetting({
8606
- key: "EnableQuestMaster",
8607
- name: "Enable Quest Master",
8608
- defaultValue: true,
8609
- description: "Whether to enable the Quest Master feature.",
8610
- category: "Experimental",
8611
- group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
8612
- order: 90
8613
- }),
8614
- EnableQuestMasterDefault: makeBooleanSetting({
8615
- key: "EnableQuestMasterDefault",
8616
- name: "Quest Master: On by default for users",
8617
- defaultValue: false,
8618
- description: "When enabled, Quest Master is active for users who have never explicitly toggled it.",
8619
- category: "Experimental",
8620
- group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
8621
- order: 91,
8622
- dependsOn: "EnableQuestMaster"
8623
- }),
8624
9137
  QuestMasterLegacyShutdownDate: {
8625
9138
  ...makeStringSetting({
8626
9139
  key: "QuestMasterLegacyShutdownDate",
@@ -8763,6 +9276,34 @@ const settingsMap = {
8763
9276
  dependsOn: "EnableCallableFunctions",
8764
9277
  scope: { settableAt: ["organization"] }
8765
9278
  }),
9279
+ CallableFunctionDataFileMaxMb: makeNumberSetting({
9280
+ key: "CallableFunctionDataFileMaxMb",
9281
+ name: "Callable Functions: Largest Data File (MB)",
9282
+ defaultValue: 100,
9283
+ min: 1,
9284
+ max: 512,
9285
+ int: true,
9286
+ description: "The largest file a person can pin to a saved function as data, in MB (at most 512). Checked when the file is pinned. Can be overridden per organization; a member of several organizations gets the lowest.",
9287
+ category: "Experimental",
9288
+ group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
9289
+ order: 24.7,
9290
+ dependsOn: "EnableCallableFunctions",
9291
+ scope: { settableAt: ["organization"] }
9292
+ }),
9293
+ CallableFunctionDataTotalMaxMb: makeNumberSetting({
9294
+ key: "CallableFunctionDataTotalMaxMb",
9295
+ name: "Callable Functions: Data Per Function (MB)",
9296
+ defaultValue: CALLABLE_FUNCTION_DATA_LIMITS.defaultTotalMb,
9297
+ min: 1,
9298
+ max: CALLABLE_FUNCTION_DATA_LIMITS.cacheMb,
9299
+ int: true,
9300
+ description: `The most data, in MB, all the files pinned to one saved function can add up to (at most ${CALLABLE_FUNCTION_DATA_LIMITS.cacheMb}, the runtime's data cache). Checked when a file is pinned. Can be overridden per organization; a member of several organizations gets the lowest.`,
9301
+ category: "Experimental",
9302
+ group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
9303
+ order: 24.8,
9304
+ dependsOn: "EnableCallableFunctions",
9305
+ scope: { settableAt: ["organization"] }
9306
+ }),
8766
9307
  EnableAgents: makeBooleanSetting({
8767
9308
  key: "EnableAgents",
8768
9309
  name: "Enable Agents",
@@ -9105,6 +9646,22 @@ const settingsMap = {
9105
9646
  dependsOn: "EnableDeferredToolLoading",
9106
9647
  userReadable: true
9107
9648
  }),
9649
+ evaluationUserIds: makeStringSetting({
9650
+ key: "evaluationUserIds",
9651
+ name: "Controlled Evaluation: Allowed User IDs",
9652
+ defaultValue: "",
9653
+ description: "Comma-separated user IDs allowed to create evaluation completion runs and send evaluation requests (the Desktop controlled cost evaluation). Evaluation mode disables provider retries and fallback, bounds output and returns per-request provider usage receipts. Empty (default) refuses every evaluation request. Changes apply to the next request.",
9654
+ category: "AI",
9655
+ order: 16
9656
+ }),
9657
+ evaluationModelIds: makeStringSetting({
9658
+ key: "evaluationModelIds",
9659
+ name: "Controlled Evaluation: Allowed Model IDs",
9660
+ defaultValue: "",
9661
+ description: "Comma-separated exact catalog model IDs an evaluation request may dispatch to. Aliases are not matched, so confirm each ID resolves to the intended provider model before adding it. Empty (default) refuses every evaluation dispatch. Changes apply to the next request.",
9662
+ category: "AI",
9663
+ order: 17
9664
+ }),
9108
9665
  UseFormatPrompt: makeBooleanSetting({
9109
9666
  key: "UseFormatPrompt",
9110
9667
  name: "Use Format Prompt",
@@ -9939,6 +10496,18 @@ const settingsMap = {
9939
10496
  group: API_SERVICE_GROUPS.ADMIN.id,
9940
10497
  order: 2
9941
10498
  }),
10499
+ mailFrom: {
10500
+ ...makeStringSetting({
10501
+ key: "mailFrom",
10502
+ name: "System Email Sender",
10503
+ defaultValue: "",
10504
+ description: "The sender of every system email: an address such as noreply@example.com, or a name and address such as Example <noreply@example.com>. Empty (default) uses the MAIL_FROM secret. On Amazon SES the address must be on the domain the stage sends from, the same domain as the MAIL_FROM secret. Changes apply to the next email.",
10505
+ category: "Admin",
10506
+ group: API_SERVICE_GROUPS.ADMIN.id,
10507
+ order: 3
10508
+ }),
10509
+ schema: z$1.string().refine((value) => value.trim() === "" || value.length <= 320 && !/[\r\n]/.test(value), { message: `Use one line of at most 320 characters, or leave it empty.` })
10510
+ },
9942
10511
  MaxFileSize: makeNumberSetting({
9943
10512
  key: "MaxFileSize",
9944
10513
  userReadable: true,
@@ -11024,6 +11593,24 @@ const settingsMap = {
11024
11593
  group: API_SERVICE_GROUPS.CREDITS.id,
11025
11594
  category: "SecOps"
11026
11595
  }),
11596
+ providerSpendOpenaiUsdPerHour: makeNumberSetting({
11597
+ key: "providerSpendOpenaiUsdPerHour",
11598
+ name: "Provider Spend Alarm: OpenAI Hourly Ceiling (USD)",
11599
+ defaultValue: 0,
11600
+ min: 0,
11601
+ description: "OpenAI organization-wide spend per hour, from its own usage report priced with our model rates, at which the provider spend alarm pages. 0 or empty (default) keeps the deployed default and leaves the current threshold unchanged, including any previous override, until a deploy restores the default. A positive change is applied to the CloudWatch alarm by the hourly young-account spend job, so it takes up to an hour.",
11602
+ group: API_SERVICE_GROUPS.CREDITS.id,
11603
+ category: "SecOps"
11604
+ }),
11605
+ providerSpendAnthropicUsdPerHour: makeNumberSetting({
11606
+ key: "providerSpendAnthropicUsdPerHour",
11607
+ name: "Provider Spend Alarm: Anthropic Hourly Ceiling (USD)",
11608
+ defaultValue: 0,
11609
+ min: 0,
11610
+ description: "Anthropic organization-wide spend per hour, from its own usage report priced with our model rates, at which the provider spend alarm pages. 0 or empty (default) keeps the deployed default and leaves the current threshold unchanged, including any previous override, until a deploy restores the default. A positive change is applied to the CloudWatch alarm by the hourly young-account spend job, so it takes up to an hour.",
11611
+ group: API_SERVICE_GROUPS.CREDITS.id,
11612
+ category: "SecOps"
11613
+ }),
11027
11614
  freeTierDailySystemCostCapUsd: makeNumberSetting({
11028
11615
  key: "freeTierDailySystemCostCapUsd",
11029
11616
  name: "Free Tier Daily System Cost Cap (USD)",
@@ -13437,550 +14024,6 @@ let ApiKeyType = /* @__PURE__ */ function(ApiKeyType) {
13437
14024
  ApiKeyType["typesafe"] = "typesafe";
13438
14025
  return ApiKeyType;
13439
14026
  }({});
13440
- /**
13441
- * Official B4M LLM tools.
13442
- */
13443
- const b4mLLMTools = z$1.enum([
13444
- "dice_roll",
13445
- "image_generation",
13446
- "edit_image",
13447
- "music_generation",
13448
- "audio_generation",
13449
- "video_generation",
13450
- "production_storyboard",
13451
- "production_generate_shot",
13452
- "production_add_audio",
13453
- "production_assemble",
13454
- "weather_info",
13455
- "web_search",
13456
- "web_fetch",
13457
- "wolfram_alpha",
13458
- "math_evaluate",
13459
- "mermaid_chart",
13460
- "current_datetime",
13461
- "current_model_details",
13462
- "deep_research",
13463
- "prompt_enhancement",
13464
- "recharts",
13465
- "edit_file",
13466
- "blog_publish",
13467
- "blog_edit",
13468
- "blog_draft",
13469
- "wikipedia_on_this_day",
13470
- "moon_phase",
13471
- "sunrise_sunset",
13472
- "iss_tracker",
13473
- "planet_visibility",
13474
- "search_knowledge_base",
13475
- "chess_engine",
13476
- "retrieve_knowledge_content",
13477
- "count_knowledge_base",
13478
- "describe_knowledge_base",
13479
- "decide",
13480
- "list_my_data_lakes",
13481
- "create_data_lake",
13482
- "save_content_to_data_lake",
13483
- "delegate_to_agent",
13484
- "optihashi_schedule",
13485
- "optihashi_formulate",
13486
- "optihashi_edit_problem",
13487
- "navigate_view",
13488
- "generate_jupyter_notebook",
13489
- "excel_generation",
13490
- "fmp_financial_data",
13491
- "bob_panel_read",
13492
- "skill"
13493
- ]);
13494
- /**
13495
- * The data-lake tools that write (make a lake, persist a file into one). A route withholds these
13496
- * from an API key without datalake:write (dataLakeToolsDeniedFor in the client's
13497
- * dataLakeScopes.ts).
13498
- */
13499
- const DATA_LAKE_WRITE_TOOL_NAMES = ["create_data_lake", "save_content_to_data_lake"];
13500
- /** Every data-lake tool - offered, trimmed and paired together (see resolveEnabledTools in services). */
13501
- const DATA_LAKE_TOOL_NAMES = [...["list_my_data_lakes"], ...DATA_LAKE_WRITE_TOOL_NAMES];
13502
- b4mLLMTools.options.map((tool) => tool);
13503
- /**
13504
- * Recharts chart types.
13505
- */
13506
- const RechartsChartTypeSchema = z$1.enum([
13507
- "LineChart",
13508
- "AreaChart",
13509
- "BarChart",
13510
- "PieChart",
13511
- "ScatterChart",
13512
- "RadialBarChart",
13513
- "ComposedChart",
13514
- "Treemap",
13515
- "FunnelChart",
13516
- "RadarChart"
13517
- ]);
13518
- RechartsChartTypeSchema.enum;
13519
- /**
13520
- * Schema for LLM model fallback information
13521
- */
13522
- const FallbackInfoSchema = z$1.object({
13523
- sessionId: z$1.string(),
13524
- primaryModel: z$1.string(),
13525
- primaryModelName: z$1.string(),
13526
- fallbackModel: z$1.string(),
13527
- fallbackModelName: z$1.string(),
13528
- /**
13529
- * Backend of each side, so the badge can name the provider path without
13530
- * inferring it from the id - a bare `deepseek-*` slug is the direct API on a
13531
- * hosted deployment and an Ollama pull on a self-hosted one. Optional and
13532
- * loosely typed: these payloads are persisted in browser storage, so a record
13533
- * written by an older build has neither field and an unknown backend name from
13534
- * a newer one must not fail the parse.
13535
- */
13536
- primaryModelBackend: z$1.string().optional(),
13537
- fallbackModelBackend: z$1.string().optional(),
13538
- /** The error that forced the first hop, PII-scrubbed and length-capped by sanitizeTelemetryError. */
13539
- reason: z$1.string().optional(),
13540
- timestamp: z$1.number()
13541
- });
13542
- const ArtifactMetadataSchema = z$1.object({
13543
- language: z$1.string().optional(),
13544
- dependencies: z$1.array(z$1.string()).optional(),
13545
- settings: z$1.record(z$1.string(), z$1.unknown()).optional()
13546
- });
13547
- const ArtifactTypeSchema = z$1.enum([
13548
- "mermaid",
13549
- "recharts",
13550
- "chess",
13551
- "python",
13552
- "react",
13553
- "html",
13554
- "svg",
13555
- "code",
13556
- "quest",
13557
- "file",
13558
- "questmaster",
13559
- "lattice",
13560
- "blog-draft"
13561
- ]);
13562
- [...new Set(Object.values({
13563
- mermaid: {
13564
- name: "Mermaid Diagram",
13565
- description: "Flowcharts, sequence diagrams, and other visual diagrams using Mermaid syntax",
13566
- category: "visualization",
13567
- mimeType: "text/plain"
13568
- },
13569
- recharts: {
13570
- name: "Chart/Graph",
13571
- description: "Interactive charts and graphs using Recharts library",
13572
- category: "visualization",
13573
- mimeType: "application/json"
13574
- },
13575
- python: {
13576
- name: "Python Script",
13577
- description: "Python code for data processing, analysis, and automation",
13578
- category: "code",
13579
- mimeType: "text/x-python"
13580
- },
13581
- react: {
13582
- name: "React Component",
13583
- description: "Interactive React components with JSX and hooks",
13584
- category: "interactive",
13585
- mimeType: "text/javascript"
13586
- },
13587
- html: {
13588
- name: "HTML Document",
13589
- description: "Static HTML pages with CSS styling",
13590
- category: "web",
13591
- mimeType: "text/html"
13592
- },
13593
- svg: {
13594
- name: "SVG Graphics",
13595
- description: "Scalable Vector Graphics for illustrations and icons",
13596
- category: "graphics",
13597
- mimeType: "image/svg+xml"
13598
- },
13599
- code: {
13600
- name: "Generic Code",
13601
- description: "General purpose code in various programming languages",
13602
- category: "code",
13603
- mimeType: "text/plain"
13604
- },
13605
- quest: {
13606
- name: "Quest/Tutorial",
13607
- description: "Learning quests and interactive tutorials",
13608
- category: "education",
13609
- mimeType: "application/json"
13610
- },
13611
- file: {
13612
- name: "File Artifact",
13613
- description: "Generic file artifacts for documents and media",
13614
- category: "document",
13615
- mimeType: "application/octet-stream"
13616
- },
13617
- questmaster: {
13618
- name: "QuestMaster Plan",
13619
- description: "Complex multi-step learning plans with dependencies",
13620
- category: "education",
13621
- mimeType: "application/json"
13622
- },
13623
- lattice: {
13624
- name: "Financial Model",
13625
- description: "Financial pro-forma models and projections",
13626
- category: "finance",
13627
- mimeType: "application/json"
13628
- },
13629
- chess: {
13630
- name: "Chess Game",
13631
- description: "Interactive chess board with move validation and AI opponent",
13632
- category: "interactive",
13633
- mimeType: "application/json"
13634
- },
13635
- "blog-draft": {
13636
- name: "Blog Draft",
13637
- description: "Drafted blog/social content ready for review and publishing",
13638
- category: "document",
13639
- mimeType: "application/json"
13640
- }
13641
- }).map((info) => info.category))];
13642
- const ArtifactSchema = z$1.object({
13643
- id: z$1.string(),
13644
- type: ArtifactTypeSchema,
13645
- title: z$1.string(),
13646
- content: z$1.string(),
13647
- preview: z$1.string().optional(),
13648
- metadata: ArtifactMetadataSchema.optional(),
13649
- version: z$1.int().positive().prefault(1).optional(),
13650
- createdAt: z$1.date(),
13651
- updatedAt: z$1.date()
13652
- });
13653
- ArtifactSchema.extend({
13654
- type: z$1.literal("quest"),
13655
- metadata: ArtifactMetadataSchema.extend({
13656
- complexity: z$1.string(),
13657
- status: z$1.string(),
13658
- subQuests: z$1.array(z$1.object({
13659
- id: z$1.string(),
13660
- title: z$1.string(),
13661
- status: z$1.string()
13662
- }))
13663
- })
13664
- });
13665
- ArtifactSchema.extend({
13666
- type: z$1.literal("react"),
13667
- metadata: ArtifactMetadataSchema.extend({
13668
- dependencies: z$1.array(z$1.string()).prefault([]),
13669
- props: z$1.record(z$1.string(), z$1.unknown()).optional(),
13670
- hasDefaultExport: z$1.boolean().prefault(true),
13671
- errorBoundary: z$1.boolean().prefault(true)
13672
- })
13673
- });
13674
- ArtifactSchema.extend({
13675
- type: z$1.literal("html"),
13676
- metadata: ArtifactMetadataSchema.extend({
13677
- allowedScripts: z$1.array(z$1.string()).prefault([]),
13678
- cspPolicy: z$1.string().optional(),
13679
- sanitized: z$1.boolean().prefault(true)
13680
- })
13681
- });
13682
- ArtifactSchema.extend({
13683
- type: z$1.literal("svg"),
13684
- metadata: ArtifactMetadataSchema.extend({
13685
- viewBox: z$1.string().optional(),
13686
- width: z$1.number().optional(),
13687
- height: z$1.number().optional(),
13688
- sanitized: z$1.boolean().prefault(true)
13689
- })
13690
- });
13691
- ArtifactSchema.extend({
13692
- type: z$1.literal("mermaid"),
13693
- metadata: ArtifactMetadataSchema.extend({
13694
- chartType: z$1.enum([
13695
- "flowchart",
13696
- "sequenceDiagram",
13697
- "classDiagram",
13698
- "stateDiagram",
13699
- "entityRelationshipDiagram",
13700
- "gantt",
13701
- "pie",
13702
- "mindmap"
13703
- ]).optional(),
13704
- description: z$1.string().optional()
13705
- })
13706
- });
13707
- ArtifactSchema.extend({
13708
- type: z$1.literal("recharts"),
13709
- metadata: ArtifactMetadataSchema.extend({
13710
- chartType: RechartsChartTypeSchema.optional(),
13711
- description: z$1.string().optional(),
13712
- dataPoints: z$1.number().optional(),
13713
- width: z$1.number().optional(),
13714
- height: z$1.number().optional(),
13715
- xAxis: z$1.string().optional(),
13716
- yAxis: z$1.string().optional(),
13717
- colors: z$1.array(z$1.string()).optional()
13718
- })
13719
- });
13720
- ArtifactSchema.extend({
13721
- type: z$1.literal("chess"),
13722
- metadata: ArtifactMetadataSchema.extend({
13723
- fen: z$1.string().optional(),
13724
- turn: z$1.enum(["w", "b"]).optional(),
13725
- lastMove: z$1.object({
13726
- from: z$1.string(),
13727
- to: z$1.string(),
13728
- san: z$1.string().optional()
13729
- }).optional(),
13730
- isCheck: z$1.boolean().optional(),
13731
- isCheckmate: z$1.boolean().optional(),
13732
- isDraw: z$1.boolean().optional(),
13733
- isGameOver: z$1.boolean().optional(),
13734
- moveNumber: z$1.number().optional()
13735
- })
13736
- });
13737
- ArtifactSchema.extend({
13738
- type: z$1.literal("lattice"),
13739
- metadata: ArtifactMetadataSchema.extend({
13740
- modelType: z$1.enum([
13741
- "income_statement",
13742
- "balance_sheet",
13743
- "cashflow",
13744
- "saas_metrics",
13745
- "custom"
13746
- ]).optional(),
13747
- periodGrain: z$1.enum([
13748
- "month",
13749
- "quarter",
13750
- "year"
13751
- ]).optional(),
13752
- currency: z$1.string().prefault("USD"),
13753
- entityCount: z$1.int().nonnegative().optional(),
13754
- ruleCount: z$1.int().nonnegative().optional(),
13755
- lastComputedAt: z$1.date().optional()
13756
- })
13757
- });
13758
- ArtifactSchema.extend({
13759
- type: z$1.literal("python"),
13760
- metadata: ArtifactMetadataSchema.extend({
13761
- packages: z$1.array(z$1.string()).default([]),
13762
- hasOutput: z$1.boolean().default(false),
13763
- executionState: z$1.enum([
13764
- "idle",
13765
- "running",
13766
- "completed",
13767
- "error"
13768
- ]).optional(),
13769
- lastExecutionTime: z$1.number().optional()
13770
- })
13771
- });
13772
- z$1.object({
13773
- chartType: z$1.enum([
13774
- "flowchart",
13775
- "sequenceDiagram",
13776
- "classDiagram",
13777
- "stateDiagram",
13778
- "entityRelationshipDiagram",
13779
- "gantt",
13780
- "pie",
13781
- "mindmap"
13782
- ]).optional(),
13783
- description: z$1.string().optional()
13784
- });
13785
- z$1.object({ artifacts: z$1.array(ArtifactSchema).optional() });
13786
- const ArtifactOperationSchema = z$1.enum([
13787
- "create",
13788
- "update",
13789
- "rewrite"
13790
- ]);
13791
- z$1.object({
13792
- operation: ArtifactOperationSchema,
13793
- artifactId: z$1.string().optional(),
13794
- type: ArtifactTypeSchema,
13795
- title: z$1.string(),
13796
- content: z$1.string(),
13797
- metadata: ArtifactMetadataSchema.optional()
13798
- });
13799
- String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
13800
- const ClaudeArtifactMimeTypes = {
13801
- REACT: "application/vnd.ant.react",
13802
- HTML: "text/html",
13803
- SVG: "image/svg+xml",
13804
- MERMAID: "application/vnd.ant.mermaid",
13805
- RECHARTS: "application/vnd.ant.recharts",
13806
- CHESS: "application/vnd.ant.chess",
13807
- CODE: "application/vnd.ant.code",
13808
- MARKDOWN: "text/markdown",
13809
- LATTICE: "application/vnd.b4m.lattice",
13810
- PYTHON: "application/vnd.ant.python",
13811
- BLOG_DRAFT: "application/vnd.b4m.blog-draft"
13812
- };
13813
- const FAB_FILE_TYPE_FILTERS = [
13814
- "text",
13815
- "pdf",
13816
- "url",
13817
- "image",
13818
- "excel",
13819
- "word",
13820
- "json",
13821
- "csv",
13822
- "markdown",
13823
- "code",
13824
- "audio",
13825
- "video"
13826
- ];
13827
- let KnowledgeType = /* @__PURE__ */ function(KnowledgeType) {
13828
- /**
13829
- * A knowledge that is from a URL.
13830
- */
13831
- KnowledgeType["URL"] = "URL";
13832
- /**
13833
- * A knowledge that is a file uploaded by the user.
13834
- */
13835
- KnowledgeType["FILE"] = "FILE";
13836
- /**
13837
- * This is a user-created knowledge through the Bike4Mind knowledge editor.
13838
- */
13839
- KnowledgeType["TEXT"] = "TEXT";
13840
- /**
13841
- * Generated audio (TTS / sound effects). Storable and browsable, but never
13842
- * ingestable: no model accepts audio as input, so audio is deliberately
13843
- * excluded from every LLM-attachment and vectorization path.
13844
- */
13845
- KnowledgeType["AUDIO"] = "AUDIO";
13846
- /** Generated video. Media-only like AUDIO: storable and browsable, never ingested. */
13847
- KnowledgeType["VIDEO"] = "VIDEO";
13848
- return KnowledgeType;
13849
- }({});
13850
- let FabFileSourceType = /* @__PURE__ */ function(FabFileSourceType) {
13851
- FabFileSourceType["MANUAL_UPLOAD"] = "manual_upload";
13852
- FabFileSourceType["SALESFORCE"] = "salesforce";
13853
- FabFileSourceType["GOOGLE_DRIVE"] = "google_drive";
13854
- FabFileSourceType["SLACK"] = "slack";
13855
- /** Admitted from an acquisition proposal, by a person approving it or by a trusted-site rule. */
13856
- FabFileSourceType["PROPOSAL_APPROVAL"] = "proposal_approval";
13857
- FabFileSourceType["GITHUB"] = "github";
13858
- /**
13859
- * Produced by a generator: an in-chat tool, a generation route or a generation job. Media saved
13860
- * through saveGeneratedAsset carries `sourceMetadata.generation` (GeneratedAssetMetadata).
13861
- * `sourceMetadata.sessionId`, when set, links it to the notebook it was made in - see
13862
- * persistGeneratedFileAsFabFile for why that link is not the top-level `sessionId`.
13863
- * `sourceMetadata.generatedCopyKey` names a second, generated-bucket copy that deletes also
13864
- * remove (see generatedCopyKeyOf). `sourceMetadata.generatedOutputKey` names the chat image the
13865
- * file holds, with no delete cascade, so copy-generated-image can find the generation behind it.
13866
- */
13867
- FabFileSourceType["TOOL_GENERATED"] = "tool_generated";
13868
- /**
13869
- * A markdown file converted from a legacy QuestMaster plan or graph. `sourceMetadata` is
13870
- * `{ sourceKind: 'quest-plan' | 'quest-graph', sourceId, sourceUpdatedAt }`; (userId, sourceId)
13871
- * keys the conversion's idempotency. Rows carry `storageExempt`.
13872
- */
13873
- FabFileSourceType["QUESTMASTER_ARCHIVE"] = "questmaster_archive";
13874
- return FabFileSourceType;
13875
- }({});
13876
- let Permission = /* @__PURE__ */ function(Permission) {
13877
- Permission["read"] = "read";
13878
- Permission["create"] = "create";
13879
- Permission["update"] = "update";
13880
- Permission["delete"] = "delete";
13881
- Permission["share"] = "share";
13882
- return Permission;
13883
- }({});
13884
- const groupShareSchema = z$1.object({
13885
- groupId: z$1.string(),
13886
- permissions: z$1.array(z$1.enum(Permission))
13887
- });
13888
- const userShareSchema = z$1.object({
13889
- userId: z$1.string(),
13890
- permissions: z$1.array(z$1.enum(Permission)),
13891
- /** The project ID if the user is shared from a project */
13892
- projectId: z$1.string().optional(),
13893
- extraData: z$1.object({
13894
- /** The last time the user exported data */
13895
- lastExportDate: z$1.date().optional() }).optional(),
13896
- /**
13897
- * TODO: To be replaced with proper user zod schema
13898
- */
13899
- user: z$1.any().optional()
13900
- });
13901
- const shareableDocumentSchema = z$1.object({
13902
- isGlobalRead: z$1.boolean(),
13903
- isGlobalWrite: z$1.boolean(),
13904
- users: z$1.array(userShareSchema),
13905
- groups: z$1.array(groupShareSchema)
13906
- });
13907
- const MAX_RETENTION_DAYS = 36500;
13908
- z$1.object({
13909
- chats: z$1.number().int().min(1).max(MAX_RETENTION_DAYS).nullable(),
13910
- files: z$1.number().int().min(1).max(MAX_RETENTION_DAYS).nullable(),
13911
- media: z$1.number().int().min(1).max(MAX_RETENTION_DAYS).nullable()
13912
- }).strict();
13913
- /**
13914
- * Machine-readable error classifiers for `type: 'error'` quests. Set server-side
13915
- * so the client can branch to a targeted error UI (see `IChatHistoryItem.errorCode`).
13916
- * These are the billing classifiers a thrown error resolves to; the published
13917
- * quest schemas derive from QUEST_OUTCOME_ERROR_CODES below, which adds the one
13918
- * non-billing code.
13919
- *
13920
- * SSE-frame scoped, and a NARROWING of the platform-wide `API_ERROR_CODES`: a
13921
- * thrown quest error is classified for billing reasons, never for the
13922
- * provider-configuration reasons the HTTP surface reports. The `satisfies` is what keeps it a narrowing rather
13923
- * than a second vocabulary - a code added here that is not in `API_ERROR_CODES`
13924
- * fails the build. `run_budget_exhausted` lands on an image generation quest whose `run` budget
13925
- * could not cover the render's credit hold (ImageGeneration.process).
13926
- */
13927
- const QUEST_ERROR_CODES = [
13928
- "insufficient_credits",
13929
- "spend_cap_exceeded",
13930
- "spend_frozen",
13931
- "free_quest_limit_reached",
13932
- "run_budget_exhausted"
13933
- ];
13934
- /**
13935
- * Every classifier a stored quest's `errorCode` can hold: the billing codes above plus
13936
- * `content_blocked`, set when prompt moderation refuses the turn. A separate tuple because
13937
- * getQuestErrorCode and resolveQuestErrorCode read QUEST_ERROR_CODES off thrown errors to pick
13938
- * the billing branches, which a moderation refusal must never take.
13939
- */
13940
- const QUEST_OUTCOME_ERROR_CODES = [...QUEST_ERROR_CODES, "content_blocked"];
13941
- /**
13942
- * Single source of truth for `IChatHistoryItem.type` / quest `type`. Restated by hand in
13943
- * `schemas/actions.ts`, `schemas/chat.ts`, and `notebookExportService/types.ts` before this
13944
- * const existed, which is exactly how `voice_transcript` went missing from the export contract
13945
- * once already - derive from this tuple instead of retyping the union.
13946
- */
13947
- const CHAT_HISTORY_ITEM_TYPES = [
13948
- "message",
13949
- "oob",
13950
- "error",
13951
- "system",
13952
- "voice_transcript"
13953
- ];
13954
- /**
13955
- * Why a turn's LLM call was retried. Timeouts we raise ourselves are classified ahead of
13956
- * overload so they never read as a provider fault (older backends worded them "may be
13957
- * overloaded"). Must stay in sync with classifyTurnRetryReason in @bike4mind/services.
13958
- */
13959
- const TURN_RETRY_REASONS = [
13960
- "stream_idle_timeout",
13961
- "stream_truncated",
13962
- "request_timeout",
13963
- "rate_limit",
13964
- "overloaded",
13965
- "server_error",
13966
- "transport",
13967
- "tool_pairing",
13968
- "other"
13969
- ];
13970
- /** Where a session was created. Absent on sessions that predate the field; render those as 'web'. */
13971
- const SESSION_ORIGIN_CHANNELS = [
13972
- "web",
13973
- "api",
13974
- "slack",
13975
- "cli",
13976
- "desktop",
13977
- "agent"
13978
- ];
13979
- z$1.union([
13980
- z$1.literal("string"),
13981
- z$1.literal("number"),
13982
- z$1.literal("boolean")
13983
- ]);
13984
14027
  let ApiKeyScope = /* @__PURE__ */ function(ApiKeyScope) {
13985
14028
  ApiKeyScope["READ_NOTEBOOKS"] = "notebooks:read";
13986
14029
  ApiKeyScope["WRITE_NOTEBOOKS"] = "notebooks:write";
@@ -14267,6 +14310,177 @@ Object.freeze({
14267
14310
  requestsPerMinute: 60,
14268
14311
  requestsPerDay: 1e3
14269
14312
  });
14313
+ const FAB_FILE_TYPE_FILTERS = [
14314
+ "text",
14315
+ "pdf",
14316
+ "url",
14317
+ "image",
14318
+ "excel",
14319
+ "word",
14320
+ "json",
14321
+ "csv",
14322
+ "markdown",
14323
+ "code",
14324
+ "audio",
14325
+ "video"
14326
+ ];
14327
+ let KnowledgeType = /* @__PURE__ */ function(KnowledgeType) {
14328
+ /**
14329
+ * A knowledge that is from a URL.
14330
+ */
14331
+ KnowledgeType["URL"] = "URL";
14332
+ /**
14333
+ * A knowledge that is a file uploaded by the user.
14334
+ */
14335
+ KnowledgeType["FILE"] = "FILE";
14336
+ /**
14337
+ * This is a user-created knowledge through the Bike4Mind knowledge editor.
14338
+ */
14339
+ KnowledgeType["TEXT"] = "TEXT";
14340
+ /**
14341
+ * Generated audio (TTS / sound effects). Storable and browsable, but never
14342
+ * ingestable: no model accepts audio as input, so audio is deliberately
14343
+ * excluded from every LLM-attachment and vectorization path.
14344
+ */
14345
+ KnowledgeType["AUDIO"] = "AUDIO";
14346
+ /** Generated video. Media-only like AUDIO: storable and browsable, never ingested. */
14347
+ KnowledgeType["VIDEO"] = "VIDEO";
14348
+ return KnowledgeType;
14349
+ }({});
14350
+ let FabFileSourceType = /* @__PURE__ */ function(FabFileSourceType) {
14351
+ FabFileSourceType["MANUAL_UPLOAD"] = "manual_upload";
14352
+ FabFileSourceType["SALESFORCE"] = "salesforce";
14353
+ FabFileSourceType["GOOGLE_DRIVE"] = "google_drive";
14354
+ FabFileSourceType["SLACK"] = "slack";
14355
+ /** Admitted from an acquisition proposal, by a person approving it or by a trusted-site rule. */
14356
+ FabFileSourceType["PROPOSAL_APPROVAL"] = "proposal_approval";
14357
+ FabFileSourceType["GITHUB"] = "github";
14358
+ /**
14359
+ * Produced by a generator: an in-chat tool, a generation route or a generation job. Media saved
14360
+ * through saveGeneratedAsset carries `sourceMetadata.generation` (GeneratedAssetMetadata).
14361
+ * `sourceMetadata.sessionId`, when set, links it to the notebook it was made in - see
14362
+ * persistGeneratedFileAsFabFile for why that link is not the top-level `sessionId`.
14363
+ * `sourceMetadata.generatedCopyKey` names a second, generated-bucket copy that deletes also
14364
+ * remove (see generatedCopyKeyOf). `sourceMetadata.generatedOutputKey` names the chat image the
14365
+ * file holds, with no delete cascade, so copy-generated-image can find the generation behind it.
14366
+ */
14367
+ FabFileSourceType["TOOL_GENERATED"] = "tool_generated";
14368
+ /**
14369
+ * A markdown file converted from a legacy QuestMaster plan or graph. `sourceMetadata` is
14370
+ * `{ sourceKind: 'quest-plan' | 'quest-graph', sourceId, sourceUpdatedAt }`; (userId, sourceId)
14371
+ * keys the conversion's idempotency. Rows carry `storageExempt`.
14372
+ */
14373
+ FabFileSourceType["QUESTMASTER_ARCHIVE"] = "questmaster_archive";
14374
+ return FabFileSourceType;
14375
+ }({});
14376
+ let Permission = /* @__PURE__ */ function(Permission) {
14377
+ Permission["read"] = "read";
14378
+ Permission["create"] = "create";
14379
+ Permission["update"] = "update";
14380
+ Permission["delete"] = "delete";
14381
+ Permission["share"] = "share";
14382
+ return Permission;
14383
+ }({});
14384
+ const groupShareSchema = z$1.object({
14385
+ groupId: z$1.string(),
14386
+ permissions: z$1.array(z$1.enum(Permission))
14387
+ });
14388
+ const userShareSchema = z$1.object({
14389
+ userId: z$1.string(),
14390
+ permissions: z$1.array(z$1.enum(Permission)),
14391
+ /** The project ID if the user is shared from a project */
14392
+ projectId: z$1.string().optional(),
14393
+ extraData: z$1.object({
14394
+ /** The last time the user exported data */
14395
+ lastExportDate: z$1.date().optional() }).optional(),
14396
+ /**
14397
+ * TODO: To be replaced with proper user zod schema
14398
+ */
14399
+ user: z$1.any().optional()
14400
+ });
14401
+ const shareableDocumentSchema = z$1.object({
14402
+ isGlobalRead: z$1.boolean(),
14403
+ isGlobalWrite: z$1.boolean(),
14404
+ users: z$1.array(userShareSchema),
14405
+ groups: z$1.array(groupShareSchema)
14406
+ });
14407
+ const MAX_RETENTION_DAYS = 36500;
14408
+ z$1.object({
14409
+ chats: z$1.number().int().min(1).max(MAX_RETENTION_DAYS).nullable(),
14410
+ files: z$1.number().int().min(1).max(MAX_RETENTION_DAYS).nullable(),
14411
+ media: z$1.number().int().min(1).max(MAX_RETENTION_DAYS).nullable()
14412
+ }).strict();
14413
+ /**
14414
+ * Machine-readable error classifiers for `type: 'error'` quests. Set server-side
14415
+ * so the client can branch to a targeted error UI (see `IChatHistoryItem.errorCode`).
14416
+ * These are the billing classifiers a thrown error resolves to; the published
14417
+ * quest schemas derive from QUEST_OUTCOME_ERROR_CODES below, which adds the one
14418
+ * non-billing code.
14419
+ *
14420
+ * SSE-frame scoped, and a NARROWING of the platform-wide `API_ERROR_CODES`: a
14421
+ * thrown quest error is classified for billing reasons, never for the
14422
+ * provider-configuration reasons the HTTP surface reports. The `satisfies` is what keeps it a narrowing rather
14423
+ * than a second vocabulary - a code added here that is not in `API_ERROR_CODES`
14424
+ * fails the build. `run_budget_exhausted` lands on an image generation quest whose `run` budget
14425
+ * could not cover the render's credit hold (ImageGeneration.process).
14426
+ */
14427
+ const QUEST_ERROR_CODES = [
14428
+ "insufficient_credits",
14429
+ "spend_cap_exceeded",
14430
+ "spend_frozen",
14431
+ "free_quest_limit_reached",
14432
+ "run_budget_exhausted"
14433
+ ];
14434
+ /**
14435
+ * Every classifier a stored quest's `errorCode` can hold: the billing codes above plus
14436
+ * `content_blocked`, set when prompt moderation refuses the turn. A separate tuple because
14437
+ * getQuestErrorCode and resolveQuestErrorCode read QUEST_ERROR_CODES off thrown errors to pick
14438
+ * the billing branches, which a moderation refusal must never take.
14439
+ */
14440
+ const QUEST_OUTCOME_ERROR_CODES = [...QUEST_ERROR_CODES, "content_blocked"];
14441
+ /**
14442
+ * Single source of truth for `IChatHistoryItem.type` / quest `type`. Restated by hand in
14443
+ * `schemas/actions.ts`, `schemas/chat.ts`, and `notebookExportService/types.ts` before this
14444
+ * const existed, which is exactly how `voice_transcript` went missing from the export contract
14445
+ * once already - derive from this tuple instead of retyping the union.
14446
+ */
14447
+ const CHAT_HISTORY_ITEM_TYPES = [
14448
+ "message",
14449
+ "oob",
14450
+ "error",
14451
+ "system",
14452
+ "voice_transcript"
14453
+ ];
14454
+ /**
14455
+ * Why a turn's LLM call was retried. Timeouts we raise ourselves are classified ahead of
14456
+ * overload so they never read as a provider fault (older backends worded them "may be
14457
+ * overloaded"). Must stay in sync with classifyTurnRetryReason in @bike4mind/services.
14458
+ */
14459
+ const TURN_RETRY_REASONS = [
14460
+ "stream_idle_timeout",
14461
+ "stream_truncated",
14462
+ "request_timeout",
14463
+ "rate_limit",
14464
+ "overloaded",
14465
+ "server_error",
14466
+ "transport",
14467
+ "tool_pairing",
14468
+ "other"
14469
+ ];
14470
+ /** Where a session was created. Absent on sessions that predate the field; render those as 'web'. */
14471
+ const SESSION_ORIGIN_CHANNELS = [
14472
+ "web",
14473
+ "api",
14474
+ "slack",
14475
+ "cli",
14476
+ "desktop",
14477
+ "agent"
14478
+ ];
14479
+ z$1.union([
14480
+ z$1.literal("string"),
14481
+ z$1.literal("number"),
14482
+ z$1.literal("boolean")
14483
+ ]);
14270
14484
  /**
14271
14485
  * Valid status values for sub-quests.
14272
14486
  * Canonical vocabulary - the mongoose schema, zod schemas, and client all
@@ -14280,14 +14494,6 @@ const SUBQUEST_STATUS_VALUES = [
14280
14494
  "deleted"
14281
14495
  ];
14282
14496
  /**
14283
- * Status of a review gate on a sub-quest
14284
- */
14285
- const REVIEW_GATE_STATUS_VALUES = [
14286
- "pending",
14287
- "approved",
14288
- "rejected"
14289
- ];
14290
- /**
14291
14497
  * Valid complexity ratings for quests.
14292
14498
  * Canonical vocabulary - matches what the planner generates and validates
14293
14499
  * (Easy < 1 hour, Medium 1-4 hours, Hard > 4 hours).
@@ -14631,6 +14837,26 @@ const CREDIT_DEDUCT_TRANSACTION_TYPES = [
14631
14837
  const NON_AI_DEDUCT_TRANSACTION_TYPES = ["transfer_credit", "generic_deduct"];
14632
14838
  CREDIT_DEDUCT_TRANSACTION_TYPES.filter((t) => !NON_AI_DEDUCT_TRANSACTION_TYPES.includes(t));
14633
14839
  CREDIT_DEDUCT_TRANSACTION_TYPES.filter((t) => t !== "transfer_credit");
14840
+ const identity$1 = z$1.string().min(1).max(128);
14841
+ const PlatformAttribution = z$1.object({
14842
+ kind: z$1.literal("platform_operation"),
14843
+ operation: z$1.literal("sre_diagnosis"),
14844
+ environment: z$1.enum([
14845
+ "production",
14846
+ "staging",
14847
+ "development",
14848
+ "test"
14849
+ ]),
14850
+ logicalJobId: identity$1,
14851
+ executionId: identity$1
14852
+ }).strict();
14853
+ z$1.object({
14854
+ providerCallId: identity$1,
14855
+ attribution: PlatformAttribution,
14856
+ provider: z$1.string().min(1).max(128),
14857
+ model: z$1.string().min(1).max(256),
14858
+ leaseExpiresAt: z$1.date()
14859
+ }).strict();
14634
14860
  /** Who made a run-attributed request: the session that started the run, or a worker it spawned. */
14635
14861
  const COMPLETION_RUN_ROLES = ["root", "worker"];
14636
14862
  /**
@@ -14730,6 +14956,7 @@ const USAGE_EVENT_OPERATIONS = [
14730
14956
  "memento",
14731
14957
  "assistant_brief",
14732
14958
  "delegated_item",
14959
+ "document_obligation",
14733
14960
  "org_feedback_summary"
14734
14961
  ];
14735
14962
  /**
@@ -14772,7 +14999,17 @@ const UsageEventRun = z$1.object({
14772
14999
  parentSessionId: z$1.string().optional(),
14773
15000
  sessionId: z$1.string().max(128).optional()
14774
15001
  });
14775
- z$1.object({
15002
+ /**
15003
+ * One row per provider API call. Ties true COGS (costUsd, frozen
15004
+ * at write time) to what the user was debited (creditsCharged) so margin per
15005
+ * model/user is queryable. Dual-written at settlement time; never part of the
15006
+ * billing path itself.
15007
+ */
15008
+ const AttributedUsageEvent = z$1.object({
15009
+ attribution: z$1.undefined().optional(),
15010
+ providerCallId: z$1.undefined().optional(),
15011
+ usageOccurredAt: z$1.undefined().optional(),
15012
+ recordedAt: z$1.undefined().optional(),
14776
15013
  id: z$1.string().optional(),
14777
15014
  /** App-level correlation id: questId for chat/image/video, session/run id otherwise. */
14778
15015
  requestId: z$1.string(),
@@ -14874,6 +15111,79 @@ z$1.object({
14874
15111
  createdAt: z$1.date(),
14875
15112
  updatedAt: z$1.date()
14876
15113
  });
15114
+ const PlatformUsageEvent = AttributedUsageEvent.omit({
15115
+ attribution: true,
15116
+ providerCallId: true,
15117
+ usageOccurredAt: true,
15118
+ recordedAt: true
15119
+ }).extend({
15120
+ attribution: PlatformAttribution,
15121
+ providerCallId: z$1.string().min(1).max(128),
15122
+ usageOccurredAt: z$1.date(),
15123
+ recordedAt: z$1.date(),
15124
+ timestampSource: z$1.enum(["provider", "dispatch"]),
15125
+ dispatchedAt: z$1.date(),
15126
+ completedAt: z$1.date(),
15127
+ providerRequestId: z$1.string().max(256).optional(),
15128
+ userId: z$1.never().optional(),
15129
+ ownerId: z$1.never().optional(),
15130
+ ownerType: z$1.never().optional(),
15131
+ sessionId: z$1.never().optional(),
15132
+ projectId: z$1.never().optional(),
15133
+ dataLakeId: z$1.never().optional(),
15134
+ apiKeyId: z$1.never().optional(),
15135
+ fundingBreakdown: z$1.never().optional(),
15136
+ writtenOffCredits: z$1.never().optional(),
15137
+ reservedCredits: z$1.never().optional(),
15138
+ units: z$1.never().optional(),
15139
+ turnUsage: z$1.never().optional(),
15140
+ turnUsageTruncated: z$1.never().optional(),
15141
+ requestMeta: z$1.never().optional(),
15142
+ run: z$1.never().optional(),
15143
+ latencyMs: z$1.number().finite().nonnegative().optional(),
15144
+ feature: z$1.literal("operations"),
15145
+ source: z$1.literal("system"),
15146
+ keySource: z$1.literal("platform"),
15147
+ creditsCharged: z$1.literal(0),
15148
+ costUsd: z$1.number().finite().nonnegative(),
15149
+ provider: z$1.string().min(1).max(128),
15150
+ model: z$1.string().min(1).max(256),
15151
+ providerInputTokens: z$1.number().int().nonnegative(),
15152
+ providerOutputTokens: z$1.number().int().nonnegative(),
15153
+ inputTokens: z$1.literal(0).default(0),
15154
+ outputTokens: z$1.literal(0).default(0),
15155
+ cachedInputTokens: z$1.number().int().nonnegative(),
15156
+ cacheWriteTokens: z$1.number().int().nonnegative(),
15157
+ cacheWrite1hTokens: z$1.number().int().nonnegative().optional(),
15158
+ settledBasis: z$1.literal("provider"),
15159
+ priceSource: z$1.enum(USAGE_PRICE_SOURCES),
15160
+ executedProvider: z$1.never().optional(),
15161
+ executedModel: z$1.never().optional(),
15162
+ rates: UsageEventRates.extend({
15163
+ tierKey: z$1.number().finite().nonnegative(),
15164
+ input: z$1.number().finite().nonnegative(),
15165
+ output: z$1.number().finite().nonnegative(),
15166
+ cacheRead: z$1.number().finite().nonnegative().optional(),
15167
+ cacheWrite: z$1.number().finite().nonnegative().optional(),
15168
+ cacheWrite1h: z$1.number().finite().nonnegative().optional()
15169
+ })
15170
+ }).strict().superRefine((event, ctx) => {
15171
+ const oneHour = event.cacheWrite1hTokens ?? 0;
15172
+ if (oneHour > event.cacheWriteTokens || event.cachedInputTokens > 0 && event.rates.cacheRead === void 0 || event.cacheWriteTokens > oneHour && event.rates.cacheWrite === void 0 || oneHour > 0 && event.rates.cacheWrite1h === void 0 || event.priceSource === "catalog" && !event.priceRowId) ctx.addIssue({
15173
+ code: "custom",
15174
+ message: "Incomplete platform pricing provenance"
15175
+ });
15176
+ const expected = event.providerInputTokens * event.rates.input + event.providerOutputTokens * event.rates.output + event.cachedInputTokens * (event.rates.cacheRead ?? 0) + (event.cacheWriteTokens - oneHour) * (event.rates.cacheWrite ?? 0) + oneHour * (event.rates.cacheWrite1h ?? 0);
15177
+ if (Math.abs(expected - event.costUsd) > Math.max(1e-12, Math.abs(expected) * 1e-9)) ctx.addIssue({
15178
+ code: "custom",
15179
+ message: "Platform cost does not match measured usage and rates"
15180
+ });
15181
+ if (event.requestId !== event.attribution.executionId || event.usageOccurredAt > event.completedAt || event.timestampSource === "dispatch" && event.usageOccurredAt.getTime() !== event.dispatchedAt.getTime() || event.completedAt < event.dispatchedAt || event.recordedAt < event.completedAt) ctx.addIssue({
15182
+ code: "custom",
15183
+ message: "Invalid platform accounting timestamps"
15184
+ });
15185
+ });
15186
+ z$1.union([PlatformUsageEvent, AttributedUsageEvent]);
14877
15187
  z$1.object({
14878
15188
  version: z$1.literal(1),
14879
15189
  generatedAt: z$1.string().datetime(),
@@ -14996,123 +15306,6 @@ const RESERVED_MCP_CONNECTION_SLUGS = /* @__PURE__ */ new Set([
14996
15306
  ...Object.values(McpServerName)
14997
15307
  ]);
14998
15308
  z$1.string().regex(MCP_CONNECTION_SLUG_PATTERN, { message: "Slug must be 2-20 characters: a lowercase letter, then lowercase letters, digits and single underscores, not ending in an underscore" }).refine((slug) => !RESERVED_MCP_CONNECTION_SLUGS.has(slug), { message: "This slug is reserved" });
14999
- const ArtifactStatusSchema = z$1.enum([
15000
- "draft",
15001
- "review",
15002
- "published",
15003
- "archived",
15004
- "deleted"
15005
- ]);
15006
- const VisibilitySchema = z$1.enum([
15007
- "private",
15008
- "project",
15009
- "organization",
15010
- "public"
15011
- ]);
15012
- const ArtifactPermissionsSchema = z$1.object({
15013
- canRead: z$1.array(z$1.string()),
15014
- canWrite: z$1.array(z$1.string()),
15015
- canDelete: z$1.array(z$1.string()),
15016
- isPublic: z$1.boolean().prefault(false),
15017
- inheritFromProject: z$1.boolean().prefault(true)
15018
- });
15019
- const BaseArtifactSchema = z$1.object({
15020
- id: z$1.uuid(),
15021
- type: ArtifactTypeSchema,
15022
- title: z$1.string().min(1).max(255),
15023
- description: z$1.string().max(1e3).optional(),
15024
- version: z$1.int().positive().prefault(1),
15025
- versionTag: z$1.string().max(100).optional(),
15026
- currentVersionId: z$1.uuid().optional(),
15027
- parentVersionId: z$1.uuid().optional(),
15028
- createdAt: z$1.date(),
15029
- updatedAt: z$1.date(),
15030
- publishedAt: z$1.date().optional(),
15031
- deletedAt: z$1.date().optional(),
15032
- userId: z$1.string(),
15033
- projectId: z$1.string().optional(),
15034
- organizationId: z$1.string().optional(),
15035
- visibility: VisibilitySchema.prefault("private"),
15036
- permissions: ArtifactPermissionsSchema,
15037
- sourceQuestId: z$1.string().optional(),
15038
- sessionId: z$1.string().optional(),
15039
- parentArtifactId: z$1.uuid().optional(),
15040
- identifier: z$1.string().optional(),
15041
- status: ArtifactStatusSchema.prefault("draft"),
15042
- tags: z$1.array(z$1.string().max(50)).max(20).prefault([]),
15043
- contentHash: z$1.string(),
15044
- contentSize: z$1.int().nonnegative(),
15045
- metadata: z$1.record(z$1.string(), z$1.unknown()).optional()
15046
- });
15047
- const EnhancedArtifactMetadataSchema = z$1.object({
15048
- language: z$1.string().optional(),
15049
- dependencies: z$1.array(z$1.string()).optional(),
15050
- settings: z$1.record(z$1.string(), z$1.unknown()).optional()
15051
- });
15052
- BaseArtifactSchema.extend({
15053
- type: z$1.literal("react"),
15054
- content: z$1.string(),
15055
- metadata: EnhancedArtifactMetadataSchema.extend({
15056
- dependencies: z$1.array(z$1.string()),
15057
- props: z$1.record(z$1.string(), z$1.unknown()).optional(),
15058
- hasDefaultExport: z$1.boolean(),
15059
- errorBoundary: z$1.boolean().prefault(true)
15060
- })
15061
- });
15062
- BaseArtifactSchema.extend({
15063
- type: z$1.literal("html"),
15064
- content: z$1.string(),
15065
- metadata: EnhancedArtifactMetadataSchema.extend({
15066
- allowedScripts: z$1.array(z$1.string()).prefault([]),
15067
- cspPolicy: z$1.string().optional(),
15068
- sanitized: z$1.boolean().prefault(false)
15069
- })
15070
- });
15071
- BaseArtifactSchema.extend({
15072
- type: z$1.literal("svg"),
15073
- content: z$1.string(),
15074
- metadata: EnhancedArtifactMetadataSchema.extend({
15075
- viewBox: z$1.string().optional(),
15076
- width: z$1.number().positive().optional(),
15077
- height: z$1.number().positive().optional(),
15078
- sanitized: z$1.boolean().prefault(false)
15079
- })
15080
- });
15081
- BaseArtifactSchema.extend({
15082
- type: z$1.literal("mermaid"),
15083
- content: z$1.string(),
15084
- metadata: EnhancedArtifactMetadataSchema.extend({
15085
- chartType: z$1.enum([
15086
- "flowchart",
15087
- "sequenceDiagram",
15088
- "classDiagram",
15089
- "stateDiagram",
15090
- "entityRelationshipDiagram",
15091
- "gantt",
15092
- "pie",
15093
- "mindmap"
15094
- ]).optional(),
15095
- description: z$1.string().optional()
15096
- })
15097
- });
15098
- BaseArtifactSchema.extend({
15099
- type: z$1.literal("python"),
15100
- content: z$1.string(),
15101
- metadata: EnhancedArtifactMetadataSchema.extend({
15102
- packages: z$1.array(z$1.string()).default([]),
15103
- hasOutput: z$1.boolean().default(false),
15104
- executionState: z$1.enum([
15105
- "idle",
15106
- "running",
15107
- "completed",
15108
- "error"
15109
- ]).optional(),
15110
- lastExecutionTime: z$1.number().optional()
15111
- })
15112
- });
15113
- /** `verified` when at least one cited worked example passed on the server at promotion; otherwise `unverified`. */
15114
- const CALLABLE_FUNCTION_TRUST_LABELS = ["verified", "unverified"];
15115
- VisibilitySchema.exclude(["public"]);
15116
15309
  /** Where a function call came from. */
15117
15310
  const CALLABLE_FUNCTION_CALL_SURFACES = [
15118
15311
  "test",
@@ -15130,7 +15323,8 @@ const CALLABLE_FUNCTION_CALL_OUTCOMES = [
15130
15323
  "timeout",
15131
15324
  "memory",
15132
15325
  "output_too_large",
15133
- "refused"
15326
+ "refused",
15327
+ "data_mismatch"
15134
15328
  ];
15135
15329
  /** An asynchronous call's row reads `queued`, then `running`, until it is overwritten with how the call ended. */
15136
15330
  const CALLABLE_FUNCTION_CALL_PENDING_OUTCOMES = ["queued", "running"];
@@ -16480,6 +16674,45 @@ function completionsSupportsToolSearch(model) {
16480
16674
  return servedByClaudeAdapter(model) && supportsToolSearch(model);
16481
16675
  }
16482
16676
  const PROMPT_CACHE_TTLS = ["5m", "1h"];
16677
+ const identity = z$1.string().min(1).max(256);
16678
+ const tokenCount = z$1.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
16679
+ const rate = z$1.number().finite().nonnegative();
16680
+ const capabilitySchema = z$1.object({
16681
+ version: z$1.literal(1),
16682
+ provider: z$1.literal("openai"),
16683
+ endpoint: z$1.literal("https://api.openai.com/v1"),
16684
+ api: z$1.enum(["chat", "responses"]),
16685
+ policy: z$1.literal("explicit-cache-write-v1"),
16686
+ contractId: identity,
16687
+ chatWriteDefault: z$1.enum(["unknown", "documented_zero"])
16688
+ }).strict().refine((value) => value.api === "chat" || value.chatWriteDefault === "unknown", { message: "Only native Chat permits the documented default" });
16689
+ const ratesSchema = z$1.object({
16690
+ input: rate,
16691
+ output: rate,
16692
+ cachedRead: rate,
16693
+ write30m: rate.optional(),
16694
+ write12h: rate.optional()
16695
+ }).strict();
16696
+ const contextTierSchema = z$1.object({
16697
+ maxInputTokens: tokenCount.positive(),
16698
+ rates: ratesSchema
16699
+ }).strict();
16700
+ const serviceTierSchema = z$1.object({
16701
+ serviceTier: identity,
16702
+ contextTiers: z$1.array(contextTierSchema).min(1).max(32)
16703
+ }).strict().refine((value) => value.contextTiers.every((tier, index, tiers) => index === 0 || tiers[index - 1].maxInputTokens < tier.maxInputTokens), { message: "Context thresholds must be strictly increasing" });
16704
+ z$1.object({
16705
+ version: z$1.literal(1),
16706
+ units: z$1.literal("usd_per_token"),
16707
+ capability: capabilitySchema,
16708
+ wireModel: identity,
16709
+ allowedReturnedModels: z$1.array(identity).min(1).max(32),
16710
+ identityContractId: identity,
16711
+ priceSourceId: identity,
16712
+ capturedAt: z$1.iso.datetime(),
16713
+ effectiveAt: z$1.iso.datetime(),
16714
+ serviceTiers: z$1.array(serviceTierSchema).min(1).max(16)
16715
+ }).strict().refine((value) => new Set(value.allowedReturnedModels).size === value.allowedReturnedModels.length, { message: "Returned model identities must be unique" }).refine((value) => new Set(value.serviceTiers.map((tier) => tier.serviceTier)).size === value.serviceTiers.length, { message: "Service tiers must be unique" }).refine((value) => Date.parse(value.effectiveAt) <= Date.parse(value.capturedAt), { message: "Rates must be effective when captured" });
16483
16716
  z.enum([
16484
16717
  "openai",
16485
16718
  "test",
@@ -18696,7 +18929,7 @@ const SimplifiedChatRequestSchema = z$1.object({
18696
18929
  enableTools: z$1.boolean().prefault(false),
18697
18930
  toolMode: ChatToolModeSchema.optional(),
18698
18931
  tools: z$1.array(z$1.string()).optional().describe("Explicit tool ids to offer the model. A non-empty array enables tools on its own; no companion `toolMode` or `enableTools` is required. Merged with the auto-selected set under `toolMode: \"smart\"`, and ignored under `toolMode: \"fast\"`. This list ADDS to what is offered rather than restricting it - the server still offers tools of its own (for example knowledge retrieval when the session has reachable documents). Unrecognized ids are dropped rather than rejecting the request; the response reports the surviving set as `tools.effectiveTools` and the ids that are not tools in this deployment as `tools.unrecognizedTools`, since no endpoint enumerates the valid ids. `unrecognizedTools` is reported under every `toolMode` - it describes the ids, not what the mode did with them - so under `toolMode: \"fast\"` an id can be absent from `effectiveTools` (the mode discarded it) without being unrecognized. Both reported lists are deduplicated, and `unrecognizedTools` names at most the first 10 distinct ids."),
18699
- enableQuestMaster: z$1.boolean().optional(),
18932
+ enableQuestMaster: z$1.boolean().optional().describe("Deprecated and ignored. The in-chat QuestMaster plan this used to start has been retired."),
18700
18933
  enableMementos: z$1.boolean().optional(),
18701
18934
  enableAgents: z$1.boolean().optional(),
18702
18935
  promptMode: z$1.enum([
@@ -18981,7 +19214,6 @@ const ModelPolicyForbiddenErrorSchema = MeteredForbiddenErrorSchema.extend({ err
18981
19214
  const ChatForbiddenErrorSchema = MeteredForbiddenErrorSchema.extend({ errorCode: z$1.enum([
18982
19215
  ACCOUNT_SUSPENDED_ERROR_CODE,
18983
19216
  MODEL_REQUIRES_SUBSCRIPTION_ERROR_CODE,
18984
- FREE_QUEST_LIMIT_REACHED_ERROR_CODE,
18985
19217
  ORG_MODEL_NOT_ALLOWED_ERROR_CODE,
18986
19218
  ORG_TOOL_NOT_ALLOWED_ERROR_CODE,
18987
19219
  SPEND_FROZEN_ERROR_CODE
@@ -19549,11 +19781,6 @@ const DashboardParamsSchema = z$1.object({
19549
19781
  })),
19550
19782
  promptName: z$1.string().optional()
19551
19783
  });
19552
- const QuestMasterParamsSchema = z$1.object({
19553
- questMasterPlanId: z$1.string(),
19554
- questId: z$1.string(),
19555
- subQuestId: z$1.string()
19556
- });
19557
19784
  const ResearchModeConfigurationSchema = z$1.object({
19558
19785
  id: z$1.string(),
19559
19786
  enabled: z$1.boolean(),
@@ -19787,8 +20014,6 @@ z$1.object({
19787
20014
  dashboardParams: DashboardParamsSchema.optional(),
19788
20015
  /** LLM params */
19789
20016
  params: ChatCompletionCreateInputSchema,
19790
- /** Whether Quest Master is enabled */
19791
- enableQuestMaster: z$1.boolean().optional(),
19792
20017
  /**
19793
20018
  * How much of the system stack to put in front of the model, for callers that need a completion
19794
20019
  * they can compare against the bare provider model. Unset keeps the full stack - what every
@@ -19883,8 +20108,6 @@ z$1.object({
19883
20108
  organizationId: z$1.string().nullable().optional(),
19884
20109
  /** Tool prompt ID to use for the LLM */
19885
20110
  toolPromptId: z$1.string().optional(),
19886
- /** Quest Master related params */
19887
- questMaster: QuestMasterParamsSchema.optional(),
19888
20111
  /** Research Mode related params */
19889
20112
  researchMode: ResearchModeParamsSchema.optional(),
19890
20113
  /** Fallback model ID to try if primary model fails */
@@ -20761,6 +20984,7 @@ const SELF_VIEW_PASSTHROUGH_FIELDS = {
20761
20984
  referredViaLinkAt: true,
20762
20985
  referralCode: true,
20763
20986
  signupInvite: true,
20987
+ signupClientId: true,
20764
20988
  organizationId: true,
20765
20989
  lastActiveAt: true,
20766
20990
  isOnline: true,
@@ -20769,6 +20993,7 @@ const SELF_VIEW_PASSTHROUGH_FIELDS = {
20769
20993
  showCreditsUsed: true,
20770
20994
  platformEmailAddress: true,
20771
20995
  authorizedEmailAddresses: true,
20996
+ releasedPlatformEmailAddresses: true,
20772
20997
  preferredVoice: true,
20773
20998
  voiceOverrideId: true,
20774
20999
  voiceSystemPromptOverride: true,
@@ -20793,6 +21018,10 @@ const SELF_VIEW_PASSTHROUGH_FIELDS = {
20793
21018
  deletion: true,
20794
21019
  nextBriefAt: true,
20795
21020
  lastBriefStartedAt: true,
21021
+ busyBlocks: true,
21022
+ busyBlocksSyncedAt: true,
21023
+ nextBlockBriefAt: true,
21024
+ lastBlockBriefEnd: true,
20796
21025
  suspensionReasonCategory: true
20797
21026
  };
20798
21027
  /** A redacted integration object: only the named non-secret subfields survive. */
@@ -21614,6 +21843,8 @@ const STUDIO_COMPOSITION_LIMITS = {
21614
21843
  briefFieldMaxLength: 500,
21615
21844
  brandColorsMax: 8,
21616
21845
  brandProductFilesMax: 20,
21846
+ brandCharactersMax: 8,
21847
+ characterNameMaxLength: 100,
21617
21848
  shotsMax: 100,
21618
21849
  shotTitleMaxLength: 200,
21619
21850
  shotDescriptionMaxLength: 4e3,
@@ -21632,12 +21863,20 @@ const StudioCompositionBriefSchema = z$1.object({
21632
21863
  tone: z$1.string().trim().max(limits.briefFieldMaxLength).optional(),
21633
21864
  productFileId: StudioFileIdSchema.optional()
21634
21865
  });
21866
+ const StudioItemIdSchema = z$1.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/, "Ids may contain only letters, digits, \"_\" and \"-\"");
21867
+ /** A recurring person or mascot: a Library image passed as a reference on the shots that feature it. */
21868
+ const StudioCharacterSchema = z$1.object({
21869
+ id: StudioItemIdSchema,
21870
+ name: z$1.string().trim().min(1).max(limits.characterNameMaxLength),
21871
+ fileId: StudioFileIdSchema
21872
+ });
21635
21873
  /** A deliberately small first cut of a brand kit; it grows as templates need more. */
21636
21874
  const StudioBrandKitSchema = z$1.object({
21637
21875
  logoFileId: StudioFileIdSchema.optional(),
21638
21876
  colors: z$1.array(z$1.string().regex(/^#[0-9a-fA-F]{6}$/, "Colors are #RRGGBB")).max(limits.brandColorsMax).default([]),
21639
21877
  fontFamily: z$1.string().trim().min(1).max(100).optional(),
21640
- productFileIds: z$1.array(StudioFileIdSchema).max(limits.brandProductFilesMax).default([])
21878
+ productFileIds: z$1.array(StudioFileIdSchema).max(limits.brandProductFilesMax).default([]),
21879
+ characters: z$1.array(StudioCharacterSchema).max(limits.brandCharactersMax).default([])
21641
21880
  });
21642
21881
  /**
21643
21882
  * One planned shot: what it should show and the takes generated for it. `fileIds` lists every take, the chosen one
@@ -21645,7 +21884,7 @@ const StudioBrandKitSchema = z$1.object({
21645
21884
  * fields need no Mongoose change.
21646
21885
  */
21647
21886
  const StudioShotSchema = z$1.object({
21648
- id: z$1.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/, "Ids may contain only letters, digits, \"_\" and \"-\""),
21887
+ id: StudioItemIdSchema,
21649
21888
  title: z$1.string().trim().min(1).max(limits.shotTitleMaxLength),
21650
21889
  description: z$1.string().trim().max(limits.shotDescriptionMaxLength).optional(),
21651
21890
  durationMs: z$1.number().int().positive().optional(),
@@ -21654,7 +21893,8 @@ const StudioShotSchema = z$1.object({
21654
21893
  intent: z$1.string().trim().max(limits.shotIntentMaxLength).optional(),
21655
21894
  chosenFileId: StudioFileIdSchema.optional(),
21656
21895
  clipFileId: StudioFileIdSchema.optional(),
21657
- voiceLine: z$1.string().trim().max(limits.shotVoiceLineMaxLength).optional()
21896
+ voiceLine: z$1.string().trim().max(limits.shotVoiceLineMaxLength).optional(),
21897
+ characterIds: z$1.array(StudioItemIdSchema).max(limits.brandCharactersMax).optional()
21658
21898
  });
21659
21899
  const StudioShotListSchema = z$1.array(StudioShotSchema).max(limits.shotsMax);
21660
21900
  /** The client-writable content of a composition. Ownership fields are server-set and live on the entity below. */
@@ -23650,6 +23890,46 @@ const AgentExecutionStepSchema = z$1.object({
23650
23890
  tool_name: z$1.string().optional()
23651
23891
  });
23652
23892
  /**
23893
+ * Statuses a published poll response can report.
23894
+ *
23895
+ * Deliberately a separate literal from `AGENT_EXECUTION_STATUSES`. That tuple is the
23896
+ * DATABASE's value space, shared with `AgentExecutionModel` and
23897
+ * `useAgentExecutionStore`, and it grows whenever the executor gains an internal state
23898
+ * (it already gained `awaiting_dag_children`). Publishing it directly would put the
23899
+ * next such state into `openapi.json` and every generated client without anyone
23900
+ * deciding it should be public. Unlike `PUBLIC_AGENT_STEP_TYPES` above, the internal
23901
+ * tuple here IS importable - the copy buys decoupling, not import reachability.
23902
+ *
23903
+ * Equal to the internal tuple today - the current set is all reasonable to publish -
23904
+ * and `agentExecution.statuses.test.ts` pins the two in lockstep, so a new internal
23905
+ * status fails the build here and forces the publish-or-not call to be made explicitly.
23906
+ */
23907
+ const PUBLIC_AGENT_EXECUTION_STATUSES = [
23908
+ "pending",
23909
+ "running",
23910
+ "continuing",
23911
+ "awaiting_permission",
23912
+ "awaiting_subagent",
23913
+ "awaiting_dag_children",
23914
+ "paused",
23915
+ "completed",
23916
+ "failed",
23917
+ "aborted"
23918
+ ];
23919
+ /**
23920
+ * How far a run is through a known number of steps. Published as `step_progress`, which is null
23921
+ * whenever the executor cannot predict a total: a plain ReAct loop decides its next step from the
23922
+ * last observation, so it has none, and `max_iterations` is a ceiling, not a total. Only a run
23923
+ * working through a captured plan reports one today (`planStepProgress` in agentPlanProgress.ts).
23924
+ *
23925
+ * `completed` counts the same steps as `total`, NOT ReAct iterations: a step can take several
23926
+ * iterations, so `total_iterations` must never be shown as "N of `total`".
23927
+ */
23928
+ const AgentExecutionStepProgressSchema = z$1.object({
23929
+ completed: z$1.number().int().nonnegative(),
23930
+ total: z$1.number().int().positive()
23931
+ }).describe("Progress through a known number of steps, for a determinate progress display. `completed` and `total` count the same steps, which are not ReAct iterations, so do not pair `total` with `total_iterations`. The whole object is null when the executor cannot predict a total for this run, which is the common case: show indeterminate progress then. A run that has finished its last step can still be `running` while it writes its answer, so treat `status` as the source of truth for whether it is done.");
23932
+ /**
23653
23933
  * Poll response for `GET /api/v1/agent-executions/{id}`.
23654
23934
  *
23655
23935
  * `steps` is the live trace: it grows while the run is in flight (read from the
@@ -23659,18 +23939,7 @@ const AgentExecutionStepSchema = z$1.object({
23659
23939
  */
23660
23940
  const AgentExecutionStatusResponseSchema = z$1.object({
23661
23941
  id: z$1.string(),
23662
- status: z$1.enum([
23663
- "pending",
23664
- "running",
23665
- "continuing",
23666
- "awaiting_permission",
23667
- "awaiting_subagent",
23668
- "awaiting_dag_children",
23669
- "paused",
23670
- "completed",
23671
- "failed",
23672
- "aborted"
23673
- ]),
23942
+ status: z$1.enum(PUBLIC_AGENT_EXECUTION_STATUSES),
23674
23943
  session_id: z$1.string().nullable(),
23675
23944
  answer: z$1.string().nullable(),
23676
23945
  /**
@@ -23686,6 +23955,7 @@ const AgentExecutionStatusResponseSchema = z$1.object({
23686
23955
  error: z$1.string().nullable(),
23687
23956
  steps: z$1.array(AgentExecutionStepSchema),
23688
23957
  total_iterations: z$1.number().nullable(),
23958
+ step_progress: AgentExecutionStepProgressSchema.nullable(),
23689
23959
  created_at: z$1.string(),
23690
23960
  updated_at: z$1.string()
23691
23961
  });
@@ -24882,7 +25152,9 @@ const SessionResponseSchema = z$1.object({
24882
25152
  promptCacheTtl: z$1.enum(["5m", "1h"]).optional().describe("The chat's prompt-cache lifetime. Absent when never set, which follows your default."),
24883
25153
  lastUsedModel: z$1.string().nullish(),
24884
25154
  firstCreated: z$1.date(),
24885
- lastUpdated: z$1.date()
25155
+ lastUpdated: z$1.date(),
25156
+ updatedAt: z$1.date().optional().describe("When anything on the session last changed, including a rename or a delete. `lastUpdated` moves only with chat activity. Absent only on sessions older than this field."),
25157
+ deletedAt: z$1.date().optional().describe("Set only on a deleted session, which only `GET /api/v1/sessions` with `updated_since` returns.")
24886
25158
  });
24887
25159
  /** Request body for POST /api/v1/sessions/{id}/clone. */
24888
25160
  const SessionCloneRequestSchema = z$1.preprocess((body) => body === "" ? void 0 : body, z$1.object({ targetSurface: z$1.string().nullable().optional() }).default({}));
@@ -24890,7 +25162,8 @@ const SessionCloneRequestSchema = z$1.preprocess((body) => body === "" ? void 0
24890
25162
  const ListSessionsQuerySchema = PaginationQuerySchema.extend({
24891
25163
  search: z$1.string().min(1).max(200).optional().describe("Case-insensitive substring match on the session name, its summary, or a tag name."),
24892
25164
  surface: z$1.string().min(1).optional().describe("Lists only sessions of this product surface. When omitted, only sessions with no surface are listed."),
24893
- origin: z$1.enum(SESSION_ORIGIN_CHANNELS).optional().describe("Lists only sessions created through this channel. `web` also matches sessions with no recorded origin.")
25165
+ origin: z$1.enum(SESSION_ORIGIN_CHANNELS).optional().describe("Lists only sessions created through this channel. `web` also matches sessions with no recorded origin."),
25166
+ updated_since: z$1.iso.datetime({ offset: true }).optional().describe("Lists only sessions changed at or after this time, oldest change first, including deleted sessions (with `deletedAt` set) so a sync can drop its copy. Pass the latest `updatedAt` you have read, ideally minus a few minutes to absorb clock skew between servers; rows you already have come back and can be skipped.")
24894
25167
  });
24895
25168
  const ListSessionsResponseSchema = paginatedResponseSchema(SessionResponseSchema);
24896
25169
  /** Response for DELETE /api/sessions/{id}. */
@@ -25694,32 +25967,6 @@ z$2.object({
25694
25967
  totalCount: z$2.number()
25695
25968
  })
25696
25969
  });
25697
- const questMasterPlanResponseSchema = z$2.object(passthroughShape({
25698
- id: true,
25699
- createdAt: true,
25700
- updatedAt: true,
25701
- notebookId: true,
25702
- goal: true,
25703
- quests: true,
25704
- userId: true,
25705
- visibility: true,
25706
- state: true,
25707
- lastAccessedAt: true,
25708
- sessionHistory: true,
25709
- metrics: true,
25710
- tags: true,
25711
- priority: true,
25712
- parentPlanId: true,
25713
- sharedWith: true,
25714
- handoff: true,
25715
- blockers: true,
25716
- decisions: true
25717
- }));
25718
- z$2.array(questMasterPlanResponseSchema);
25719
- z$2.object({
25720
- success: z$2.literal(true),
25721
- plan: questMasterPlanResponseSchema
25722
- }).extend({ metrics: passthroughField });
25723
25970
  const userShareResponseSchema = z$2.object(passthroughShape({
25724
25971
  userId: true,
25725
25972
  permissions: true,
@@ -26452,7 +26699,7 @@ const ClientConfigFeaturesSchema = z$1.object({
26452
26699
  mcp_server: z$1.boolean(),
26453
26700
  custom_mcp_connectors: z$1.boolean(),
26454
26701
  mementos: z$1.boolean(),
26455
- quest_master: z$1.boolean(),
26702
+ quest_master: z$1.boolean().describe("Deprecated: the in-chat QuestMaster plan feature was removed. Always false."),
26456
26703
  rapid_reply: z$1.boolean(),
26457
26704
  research_engine: z$1.boolean(),
26458
26705
  team_plan: z$1.boolean(),
@@ -26627,15 +26874,23 @@ const BRIEF_LIMITS = {
26627
26874
  itemsPerSection: 12,
26628
26875
  draftTo: 320,
26629
26876
  draftSubject: 200,
26630
- draftBody: 4e3
26877
+ draftBody: 4e3,
26878
+ followUpTranscript: 6e3
26631
26879
  };
26632
- const BriefSourceRefSchema = z$1.discriminatedUnion("kind", [z$1.object({
26633
- kind: z$1.literal("email"),
26634
- emailId: z$1.string().min(1).describe("The ingested email the item was triaged from.")
26635
- }), z$1.object({
26636
- kind: z$1.literal("delegation"),
26637
- delegationId: z$1.string().min(1).describe("The item you delegated; read it with `GET /api/v1/delegations/{id}`.")
26638
- })]);
26880
+ const BriefSourceRefSchema = z$1.discriminatedUnion("kind", [
26881
+ z$1.object({
26882
+ kind: z$1.literal("email"),
26883
+ emailId: z$1.string().min(1).describe("The ingested email the item was triaged from.")
26884
+ }),
26885
+ z$1.object({
26886
+ kind: z$1.literal("delegation"),
26887
+ delegationId: z$1.string().min(1).describe("The item you delegated; read it with `GET /api/v1/delegations/{id}`.")
26888
+ }),
26889
+ z$1.object({
26890
+ kind: z$1.literal("obligation"),
26891
+ obligationId: z$1.string().min(1).describe("A confirmed obligation; read it with `GET /api/v1/obligations/{id}`.")
26892
+ })
26893
+ ]);
26639
26894
  const BriefItemSchema = z$1.object({
26640
26895
  id: z$1.string().min(1).describe("Stable within the brief."),
26641
26896
  text: z$1.string().min(1).max(BRIEF_LIMITS.itemText),
@@ -26650,7 +26905,7 @@ const BriefApprovalStateSchema = z$1.enum([
26650
26905
  "resolved"
26651
26906
  ]);
26652
26907
  const BriefDraftReplySchema = z$1.object({
26653
- to: z$1.string().min(1).max(BRIEF_LIMITS.draftTo).describe("The source email's sender as received, unverified."),
26908
+ to: z$1.string().min(1).max(BRIEF_LIMITS.draftTo).describe("The source email's sender as received, unverified. On a follow-up email it is the recipient the user dictated, which may be a name rather than an address until the user edits it."),
26654
26909
  subject: z$1.string().min(1).max(BRIEF_LIMITS.draftSubject),
26655
26910
  body: z$1.string().min(1).max(BRIEF_LIMITS.draftBody)
26656
26911
  }).describe("Proposed reply for the user to review; nothing sends it. Model-written from third-party email content, so treat every field as untrusted text.");
@@ -26674,9 +26929,25 @@ const BriefQuestionRefSchema = z$1.object({
26674
26929
  options: z$1.array(z$1.string()).max(4).describe("Suggested answers, in order; `choiceIndex` on a reply refers to this list."),
26675
26930
  state: BriefQuestionStateSchema.describe("Live state of the question at fetch time. Only `open` can be replied to; a client should treat an unknown value as not actionable.")
26676
26931
  });
26932
+ const BriefFollowUpKindSchema = z$1.enum([
26933
+ "actionItem",
26934
+ "followUpEmail",
26935
+ "reminder"
26936
+ ]);
26937
+ const BriefFollowUpStateSchema = z$1.enum([
26938
+ "pending",
26939
+ "approved",
26940
+ "dismissed"
26941
+ ]);
26942
+ const BriefFollowUpRefSchema = z$1.object({
26943
+ kind: BriefFollowUpKindSchema.describe("What the follow-up proposes. A `followUpEmail` carries its draft in the decision `draftReply`. A client should treat an unknown value as not actionable."),
26944
+ state: BriefFollowUpStateSchema.describe("Only `pending` can be edited, approved or dismissed; a client should treat an unknown value as not actionable."),
26945
+ remindAt: z$1.string().nullable().describe("ISO 8601 instant a `reminder` is due; null when none was understood, and always null on other kinds.")
26946
+ });
26677
26947
  const BriefDecisionSchema = BriefItemSchema.extend({
26678
26948
  approval: BriefApprovalRefSchema.optional().describe("Present when the decision is an agent approval. `state` reflects the approval at fetch time; the pending-actions endpoints stay authoritative for a decision racing this read."),
26679
- question: BriefQuestionRefSchema.optional().describe("Present when the decision is a question an agent asked. A decision carries `approval` or `question`, never both."),
26949
+ question: BriefQuestionRefSchema.optional().describe("Present when the decision is a question an agent asked. A decision carries at most one of `approval`, `question` and `followUp`."),
26950
+ followUp: BriefFollowUpRefSchema.optional().describe("Present when the decision is a follow-up proposed from a dictated memo; act on it through `/api/v1/briefs/{id}/decisions/{decisionId}`."),
26680
26951
  draftReply: BriefDraftReplySchema.optional()
26681
26952
  });
26682
26953
  const BriefSchema = z$1.object({
@@ -26700,6 +26971,20 @@ const BriefReplyRequestSchema = z$1.object({
26700
26971
  text: z$1.string().min(1).max(BRIEF_REPLY_MAX_LENGTH).regex(/\S/, "Reply must not be blank").describe("The reply, sent to the agent as your next message."),
26701
26972
  choiceIndex: z$1.number().int().min(0).max(3).optional().describe("Index into the question `options` when the reply picks one of them; recorded on the question.")
26702
26973
  });
26974
+ const BriefFollowUpRequestSchema = z$1.object({
26975
+ transcript: z$1.string().min(1).max(BRIEF_LIMITS.followUpTranscript).regex(/\S/, "Transcript must not be blank").describe("The dictated memo, as transcribed on the device."),
26976
+ timeZone: z$1.string().min(1).max(64).refine(isValidIanaTimeZone, "Unknown IANA time zone").optional().describe("IANA zone used to read times like \"tomorrow at 9\" in the memo; defaults to the brief schedule zone.")
26977
+ });
26978
+ const BriefDecisionEditSchema = z$1.object({
26979
+ text: z$1.string().min(1).max(BRIEF_LIMITS.itemText).regex(/\S/, "Text must not be blank").optional(),
26980
+ draftReply: z$1.object({
26981
+ to: z$1.string().trim().min(1).max(BRIEF_LIMITS.draftTo),
26982
+ subject: z$1.string().min(1).max(BRIEF_LIMITS.draftSubject),
26983
+ body: z$1.string().min(1).max(BRIEF_LIMITS.draftBody)
26984
+ }).partial().optional().describe("Fields of a `followUpEmail` draft to replace."),
26985
+ remindAt: z$1.string().datetime({ offset: true }).optional().describe("New ISO 8601 due instant of a `reminder`.")
26986
+ }).refine((edit) => edit.text !== void 0 || edit.remindAt !== void 0 || edit.draftReply !== void 0 && Object.keys(edit.draftReply).length > 0, "Send at least one field to change");
26987
+ const BriefDecisionResolveSchema = z$1.object({ outcome: z$1.enum(["approve", "dismiss"]) });
26703
26988
  const BriefReplyResponseSchema = z$1.object({
26704
26989
  executionId: z$1.string().describe("The agent run continuing the conversation with your reply."),
26705
26990
  sessionId: z$1.string().describe("The notebook the run belongs to.")
@@ -26715,12 +27000,92 @@ const BriefScheduleResponseSchema = z$1.object({
26715
27000
  schedule: BriefScheduleSchema.nullable().describe("Null until a schedule has been saved."),
26716
27001
  nextBriefAt: z$1.string().nullable().describe("ISO 8601 instant of the next scheduled brief; null when the schedule is off or unset.")
26717
27002
  });
27003
+ /** Bounds on a synced busy-block list. `retryWindowMs` is also the reconciler's retry window (apps/workers/src/cron/briefScheduleReconcile.ts). */
27004
+ const BUSY_BLOCK_LIMITS = {
27005
+ maxBlocks: 48,
27006
+ maxDurationMs: 432e5,
27007
+ horizonMs: 2592e5,
27008
+ retryWindowMs: 36e5,
27009
+ /** Pushes are held only while the last sync is at most this old, so a client that stopped syncing cannot mute them. */
27010
+ syncFreshMs: 864e5
27011
+ };
27012
+ const BusyBlockSchema = z$1.object({
27013
+ start: z$1.iso.datetime({ offset: true }).describe("ISO 8601 instant the busy interval starts."),
27014
+ end: z$1.iso.datetime({ offset: true }).describe("ISO 8601 instant the busy interval ends; after `start`.")
27015
+ }).refine((block) => Date.parse(block.end) > Date.parse(block.start), "end must be after start").refine((block) => Date.parse(block.end) - Date.parse(block.start) <= BUSY_BLOCK_LIMITS.maxDurationMs, "A busy block can be at most 12 hours");
27016
+ const PutBusyBlocksSchema = z$1.object({
27017
+ enabled: z$1.boolean().describe("Whether a brief is composed when a busy block ends. Disabling clears the stored blocks."),
27018
+ blocks: z$1.array(BusyBlockSchema).max(BUSY_BLOCK_LIMITS.maxBlocks).describe("Busy intervals from the device calendar, times only; replaces the stored list. Empty is valid.")
27019
+ });
27020
+ const BusyBlocksResponseSchema = z$1.object({
27021
+ enabled: z$1.boolean(),
27022
+ blocks: z$1.array(BusyBlockSchema).describe("Stored blocks after merging overlaps and dropping ones already briefed."),
27023
+ nextBlockBriefAt: z$1.string().nullable().describe("ISO 8601 instant the next block ends and its brief is due; null when off or none is pending.")
27024
+ });
26718
27025
  const PendingDecisionCountSchema = z$1.object({
26719
27026
  count: z$1.number().int().nonnegative().describe("Decisions waiting on you: `approvals` plus `briefDecisions`. Nothing is counted twice."),
26720
27027
  approvals: z$1.number().int().nonnegative().describe("Agent approvals still open in your notebooks: raised within the last 15 minutes and not yet answered."),
26721
- briefDecisions: z$1.number().int().nonnegative().describe("Decisions in your latest ready brief that are not agent approvals. An approval decision in the brief is counted under `approvals` while it is open, and not at all once it was answered or lapsed."),
26722
- briefId: z$1.string().nullable().describe("The latest ready brief `briefDecisions` comes from; null when there is none.")
27028
+ briefDecisions: z$1.number().int().nonnegative().describe("Unanswered decisions that are not agent approvals, in your latest regular ready brief and the busy-block briefs readied since it. An approval decision in a brief is counted under `approvals` while it is open, and not at all once it was answered or lapsed."),
27029
+ briefId: z$1.string().nullable().describe("The latest ready brief, the one a client shows by default; null when there is none.")
26723
27030
  });
27031
+ const ObligationStatusSchema = z$1.enum([
27032
+ "pending",
27033
+ "confirmed",
27034
+ "dismissed"
27035
+ ]);
27036
+ const ObligationDocumentKindSchema = z$1.enum([
27037
+ "invoice",
27038
+ "receipt",
27039
+ "letter",
27040
+ "other"
27041
+ ]);
27042
+ /** Bounds shared by the route, the stored record and the extractor. */
27043
+ const OBLIGATION_LIMITS = {
27044
+ payee: 200,
27045
+ summary: 400,
27046
+ text: 2e4
27047
+ };
27048
+ const ObligationDueDateSchema = z$1.string().refine(isCalendarDate, "due_date must be a real calendar date as YYYY-MM-DD").describe("Calendar date the payment is due, `YYYY-MM-DD`, with no time zone.");
27049
+ const ObligationAmountSchema = z$1.object({
27050
+ value: z$1.number().finite().nonnegative().describe("Amount in major units, e.g. 120.5 for $120.50."),
27051
+ currency: z$1.string().regex(/^[A-Z]{3}$/, "currency must be an ISO 4217 code such as USD").describe("ISO 4217 currency code.")
27052
+ });
27053
+ const ObligationDestinationSchema = z$1.object({
27054
+ lake_id: z$1.string().min(1),
27055
+ name: z$1.string()
27056
+ });
27057
+ const ObligationSchema = z$1.object({
27058
+ id: z$1.string().min(1),
27059
+ status: ObligationStatusSchema.describe("`pending` until you confirm or dismiss it; `confirmed` once you accepted the fields; `dismissed` if you discarded it."),
27060
+ document_kind: ObligationDocumentKindSchema,
27061
+ file_id: z$1.string().min(1).describe("The uploaded scan."),
27062
+ amount: ObligationAmountSchema.nullable(),
27063
+ payee: z$1.string().max(OBLIGATION_LIMITS.payee).nullable(),
27064
+ due_date: ObligationDueDateSchema.nullable(),
27065
+ destination: ObligationDestinationSchema.nullable().describe("The data lake the document is filed in on confirm. Suggested by the assistant from your own lakes."),
27066
+ summary: z$1.string().max(OBLIGATION_LIMITS.summary).describe("Model-written from the document, so treat it as untrusted text."),
27067
+ created_at: z$1.string(),
27068
+ confirmed_at: z$1.string().nullable()
27069
+ });
27070
+ const ObligationHandoffRequestSchema = z$1.object({
27071
+ file_id: z$1.string().min(1).describe("A file you uploaded with `POST /api/v1/files`. It must be yours."),
27072
+ text: z$1.string().max(OBLIGATION_LIMITS.text).optional().describe("Text recognized on the device. When absent or blank, the file's indexed text is read instead.")
27073
+ });
27074
+ /** Every field is optional; the route rejects a body that sets none of them. */
27075
+ const ObligationUpdateRequestSchema = z$1.object({
27076
+ amount: ObligationAmountSchema.nullable().optional(),
27077
+ payee: z$1.string().min(1).max(OBLIGATION_LIMITS.payee).nullable().optional(),
27078
+ due_date: ObligationDueDateSchema.nullable().optional(),
27079
+ destination_lake_id: z$1.string().min(1).nullable().optional().describe("A data lake you can manage, or null to file nowhere."),
27080
+ status: z$1.enum(["confirmed", "dismissed"]).optional()
27081
+ });
27082
+ const ObligationIdParamSchema = z$1.object({ id: z$1.string().min(1).describe("The obligation id returned by `POST /api/v1/obligations`.") });
27083
+ const ListObligationsQuerySchema = z$1.object({
27084
+ status: ObligationStatusSchema.optional().describe("Only obligations in this status."),
27085
+ limit: z$1.coerce.number().int().min(1).max(50).default(25),
27086
+ cursor: z$1.string().min(1).optional()
27087
+ });
27088
+ const ListObligationsResponseSchema = paginatedResponseSchema(ObligationSchema);
26724
27089
  /**
26725
27090
  * Wire schemas for standing assistant instructions (`/api/v1/assistant/instructions`): short notes a
26726
27091
  * user keeps about what their briefs should highlight and how to word them. The brief composer
@@ -26816,7 +27181,12 @@ z$1.object({
26816
27181
  * `brief_ready` only, set when the brief holds exactly one decision: its kind, so the push selects a
26817
27182
  * notification category with approve/deny or reply actions. The client re-fetches the brief before acting.
26818
27183
  */
26819
- briefAction: z$1.enum(["approval", "question"]).optional()
27184
+ briefAction: z$1.enum(["approval", "question"]).optional(),
27185
+ /**
27186
+ * `agent_completed` only: the one summary sent for runs finished during a busy block whose block brief did
27187
+ * not land (notifyHeldBlockRuns in packages/server-utils/src/briefs). Never held itself.
27188
+ */
27189
+ busyBlockDigest: z$1.literal(true).optional()
26820
27190
  });
26821
27191
  z$1.object({
26822
27192
  agent_completed: z$1.boolean().optional(),
@@ -29909,7 +30279,7 @@ defineEndpoint({
29909
30279
  path: "/api/chat",
29910
30280
  operationId: "sendChatMessage",
29911
30281
  summary: "Send a chat message",
29912
- description: "Sends a message to the AI and creates a quest to process it. By default (async) the call returns immediately with a quest id; poll `GET /api/v1/quests/{id}` for the reply. Send `wait: true` to block until the reply is ready and receive it inline. A `wait: true` turn is bounded at about 45 seconds: one that runs longer is ended (unused credits refunded) and answered with a 504 naming the quest in `quest_id`; one whose reasoning model spends its whole output budget thinking is answered with a 422 or 502 (see those responses). Send long or tool-heavy turns (large attachments, tool calls) in the default async mode and poll instead. A tool that produced machine-readable state reports it under `toolPayloads` - an array of `{ type, payload }` entries in emission order, alongside (never instead of) the prose reply - on the `wait: true` body and on the polled quest. A turn can FAIL after the ACK - reported on the polled quest as `type: \"error\"`, since the ACK was already sent. A terminal `status: \"stopped\"` (a missing session, a user-cancelled turn) is ALSO a failure even without `type: \"error\"` - it carries an explanatory string in `reply`/`replies` rather than an answer. `type` is the failure signal for the classified failure classes (an abort, a provider timeout, credit exhaustion); `errorCode` is an optional refinement present only when the failure has a classified reason. A recovered stuck quest is NOT in that list: one that still has renderable content resolves as a success by design. `QUEST_ERROR_CODES` has five members: `insufficient_credits`, `spend_cap_exceeded`, `spend_frozen`, `free_quest_limit_reached`, and `run_budget_exhausted`. `insufficient_credits` and `spend_frozen` are raised as quest errorCodes on this endpoint: a spending pause in force when the request arrives is refused synchronously with a 403, and one that lands after the ACK reaches the quest. A new exhausted QuestMaster start is refused synchronously with 403 before a quest exists; an older queued start can instead settle as an error quest with `free_quest_limit_reached`. `spend_cap_exceeded` is thrown only by the embed chat route's pre-flight, which fires outside the process try/catch that would classify it onto a quest, and `run_budget_exhausted` only by image generation. A turn that prompt moderation refuses settles as `type: \"error\"` with `errorCode: \"content_blocked\"` and the refusal text in `reply`, on the 200 `wait: true` body and on the polled quest alike; do not resend it unchanged. A caller must treat `type: \"error\"` OR a terminal `status: \"stopped\"` as failure even when `errorCode` is absent, and must not read `reply` as an answer without checking those first. Organization-policy preflight refusals use 403 with `errorCode: \"org_model_not_allowed\"` or `\"org_tool_not_allowed\"`. An explicit-model JWT request can instead be accepted and refused during quest execution: that refusal appears on the 200 `wait: true` body or polled quest as `type: \"error\"`, without a policy `errorCode`. Check the quest outcome as described above. Authenticate with an API key (`b4m_live_`) or a JWT. Session resolution: pass `sessionId` to continue an existing notebook. An API-key caller that omits it gets a BRAND-NEW notebook rather than the notebook the human last had open, and `newConversation: true` forces a new notebook for any auth mode; both return the new id as `sessionId`, so the caller can continue the conversation by passing it back. A first-party JWT caller that omits `sessionId` keeps the last-opened-notebook fallback. Sending `sessionId` and `newConversation` together is a 422.",
30282
+ description: "Sends a message to the AI and creates a quest to process it. By default (async) the call returns immediately with a quest id; poll `GET /api/v1/quests/{id}` for the reply. Send `wait: true` to block until the reply is ready and receive it inline. A `wait: true` turn is bounded at about 45 seconds: one that runs longer is ended (unused credits refunded) and answered with a 504 naming the quest in `quest_id`; one whose reasoning model spends its whole output budget thinking is answered with a 422 or 502 (see those responses). Send long or tool-heavy turns (large attachments, tool calls) in the default async mode and poll instead. A tool that produced machine-readable state reports it under `toolPayloads` - an array of `{ type, payload }` entries in emission order, alongside (never instead of) the prose reply - on the `wait: true` body and on the polled quest. A turn can FAIL after the ACK - reported on the polled quest as `type: \"error\"`, since the ACK was already sent. A terminal `status: \"stopped\"` (a missing session, a user-cancelled turn) is ALSO a failure even without `type: \"error\"` - it carries an explanatory string in `reply`/`replies` rather than an answer. `type` is the failure signal for the classified failure classes (an abort, a provider timeout, credit exhaustion); `errorCode` is an optional refinement present only when the failure has a classified reason. A recovered stuck quest is NOT in that list: one that still has renderable content resolves as a success by design. `QUEST_ERROR_CODES` has five members: `insufficient_credits`, `spend_cap_exceeded`, `spend_frozen`, `free_quest_limit_reached`, and `run_budget_exhausted`. `insufficient_credits` and `spend_frozen` are raised as quest errorCodes on this endpoint: a spending pause in force when the request arrives is refused synchronously with a 403, and one that lands after the ACK reaches the quest. `free_quest_limit_reached` is no longer raised: it survives only on quests that settled with it before the in-chat QuestMaster plan was retired. `spend_cap_exceeded` is thrown only by the embed chat route's pre-flight, which fires outside the process try/catch that would classify it onto a quest, and `run_budget_exhausted` only by image generation. A turn that prompt moderation refuses settles as `type: \"error\"` with `errorCode: \"content_blocked\"` and the refusal text in `reply`, on the 200 `wait: true` body and on the polled quest alike; do not resend it unchanged. A caller must treat `type: \"error\"` OR a terminal `status: \"stopped\"` as failure even when `errorCode` is absent, and must not read `reply` as an answer without checking those first. Organization-policy preflight refusals use 403 with `errorCode: \"org_model_not_allowed\"` or `\"org_tool_not_allowed\"`. An explicit-model JWT request can instead be accepted and refused during quest execution: that refusal appears on the 200 `wait: true` body or polled quest as `type: \"error\"`, without a policy `errorCode`. Check the quest outcome as described above. Authenticate with an API key (`b4m_live_`) or a JWT. Session resolution: pass `sessionId` to continue an existing notebook. An API-key caller that omits it gets a BRAND-NEW notebook rather than the notebook the human last had open, and `newConversation: true` forces a new notebook for any auth mode; both return the new id as `sessionId`, so the caller can continue the conversation by passing it back. A first-party JWT caller that omits `sessionId` keeps the last-opened-notebook fallback. Sending `sessionId` and `newConversation` together is a 422.",
29913
30283
  tags: ["AI"],
29914
30284
  auth: "apiKeyOrJwt",
29915
30285
  scopes: ["ai:chat", "ai:generate"],
@@ -29921,11 +30291,11 @@ defineEndpoint({
29921
30291
  emitsRateLimitHeaders: true,
29922
30292
  responses: {
29923
30293
  200: {
29924
- description: "Message accepted - NOT a completed turn. The default (async) path returns this queued ACK; the outcome arrives on `GET /api/v1/quests/{id}` (see the `sendChatMessage200PollResult` schema). With `wait: true` the body is instead the completed turn: the ACK fields plus the reply (`response`/`responses`), `toolPayloads`, `createdAt`, `performance` timings and, when requested, `promptDetails`/`promptText`. A turn that FAILS still resolves with `200`, never a 4xx, on both that `wait: true` body and the polled quest (`GET /api/v1/quests/{id}`) - the prose explaining why lands in `reply`/`response` like any other answer, so the reply text alone cannot tell a failure from an answer. `type` is the field that can: both surfaces carry it unconditionally, so match on `type: \"error\"` first - it covers credit exhaustion, a provider timeout or overload, and an in-process aborted turn; a real answer carries the turn's actual completion type instead (`\"message\"` for an ordinary reply). Two related states do NOT set `type: \"error\"`: a user-cancelled turn resolves as `status: \"stopped\"` with `type` left at `\"message\"`, and a recovered stuck quest that still has renderable content resolves as a success (`status: \"done\"`, no error) by design, to avoid destroying content to report a failure. The one exception is output-budget exhaustion: a `wait: true` request answers it with the 422 or 502 error envelope (plus `quest_id`) instead of this body. `errorCode` names a classified failure: `insufficient_credits`, `spend_frozen` (a spending pause that landed after the ACK), or `free_quest_limit_reached` when an older queued QuestMaster start is refused during processing. A new exhausted start is refused synchronously with 403 before a quest exists. Other `type: \"error\"` turns may have no classifier, so never use its absence to infer success. On a real answer `errorCode` is absent from the `wait: true` body. The body also carries `sessionId`, the notebook the turn was recorded in - for an API-key caller that sent none (or any caller sending `newConversation: true`), that is the freshly created notebook's id; pass it back as the request's `sessionId` to continue. Contrast the tts/music/soundEffects contracts, which reject synchronously with a 422 carrying the same `errorCode` vocabulary.",
30294
+ description: "Message accepted - NOT a completed turn. The default (async) path returns this queued ACK; the outcome arrives on `GET /api/v1/quests/{id}` (see the `sendChatMessage200PollResult` schema). With `wait: true` the body is instead the completed turn: the ACK fields plus the reply (`response`/`responses`), `toolPayloads`, `createdAt`, `performance` timings and, when requested, `promptDetails`/`promptText`. A turn that FAILS still resolves with `200`, never a 4xx, on both that `wait: true` body and the polled quest (`GET /api/v1/quests/{id}`) - the prose explaining why lands in `reply`/`response` like any other answer, so the reply text alone cannot tell a failure from an answer. `type` is the field that can: both surfaces carry it unconditionally, so match on `type: \"error\"` first - it covers credit exhaustion, a provider timeout or overload, and an in-process aborted turn; a real answer carries the turn's actual completion type instead (`\"message\"` for an ordinary reply). Two related states do NOT set `type: \"error\"`: a user-cancelled turn resolves as `status: \"stopped\"` with `type` left at `\"message\"`, and a recovered stuck quest that still has renderable content resolves as a success (`status: \"done\"`, no error) by design, to avoid destroying content to report a failure. The one exception is output-budget exhaustion: a `wait: true` request answers it with the 422 or 502 error envelope (plus `quest_id`) instead of this body. `errorCode` names a classified failure: `insufficient_credits` or `spend_frozen` (a spending pause that landed after the ACK). Other `type: \"error\"` turns may have no classifier, so never use its absence to infer success. On a real answer `errorCode` is absent from the `wait: true` body. The body also carries `sessionId`, the notebook the turn was recorded in - for an API-key caller that sent none (or any caller sending `newConversation: true`), that is the freshly created notebook's id; pass it back as the request's `sessionId` to continue. Contrast the tts/music/soundEffects contracts, which reject synchronously with a 422 carrying the same `errorCode` vocabulary.",
29925
30295
  schema: z$1.union([ChatWaitResponseSchema, ChatAckSchema]),
29926
30296
  pollResult: {
29927
30297
  schema: ChatQuestPollResultSchema,
29928
- description: "Outcome fields of the quest polled at `GET /api/v1/quests/{id}` after this ACK. A finished turn that failed is `status: \"done\"` with `type: \"error\"` and the failure text in `reply`, so a caller reading `reply` alone cannot tell a failure from an answer - check `type` first, and also treat a terminal `status: \"stopped\"` (a missing session, a user-cancelled turn) as failure even though it never sets `type`. `errorCode` is an optional refinement of `type: \"error\"`, present only for a classified failure; credit exhaustion arrives here as `insufficient_credits`, the same vocabulary the synchronous 422s on `/api/ai/music`, `/api/ai/sound-effects` and `/api/ai/tts` use, and a spending pause that lands after the ACK arrives as `spend_frozen`. An older queued QuestMaster start can instead settle with `free_quest_limit_reached`; new exhausted starts are refused synchronously with 403 before a quest exists. `QUEST_ERROR_CODES` also publishes `spend_cap_exceeded`, but no current throw site on this endpoint raises it as a quest errorCode: its only one, the embed chat route's pre-flight 422, fires outside the process try/catch that would classify it onto the quest; `run_budget_exhausted` is raised only by image generation. A turn that prompt moderation refuses arrives as `content_blocked`; do not resend it unchanged. Most `type: \"error\"` turns - an abort, a provider timeout or overload - have NO `errorCode`; its absence does not mean success, only that the failure is unclassified. A recovered stuck quest that still has renderable content is not a failure at all: it keeps `type: \"message\"` even though it did not finish, so a caller gets the content rather than an error. `fallbackInfo` is present only when the requested model failed and another model produced the reply: `fallbackModel` answered, `primaryModel` is what was asked for, and `reason` is the error from the first failed attempt on the requested model. The poll body carries further fields not modelled here, including `images`, `files`, `toolPayloads`, `promptMeta`, and the attachment report (`attachmentNotices`/`attachmentDelivery`) - only the outcome subset is modelled here.",
30298
+ description: "Outcome fields of the quest polled at `GET /api/v1/quests/{id}` after this ACK. A finished turn that failed is `status: \"done\"` with `type: \"error\"` and the failure text in `reply`, so a caller reading `reply` alone cannot tell a failure from an answer - check `type` first, and also treat a terminal `status: \"stopped\"` (a missing session, a user-cancelled turn) as failure even though it never sets `type`. `errorCode` is an optional refinement of `type: \"error\"`, present only for a classified failure; credit exhaustion arrives here as `insufficient_credits`, the same vocabulary the synchronous 422s on `/api/ai/music`, `/api/ai/sound-effects` and `/api/ai/tts` use, and a spending pause that lands after the ACK arrives as `spend_frozen`. A quest that settled before the in-chat QuestMaster plan was retired can still carry `free_quest_limit_reached`; no current turn raises it. `QUEST_ERROR_CODES` also publishes `spend_cap_exceeded`, but no current throw site on this endpoint raises it as a quest errorCode: its only one, the embed chat route's pre-flight 422, fires outside the process try/catch that would classify it onto the quest; `run_budget_exhausted` is raised only by image generation. A turn that prompt moderation refuses arrives as `content_blocked`; do not resend it unchanged. Most `type: \"error\"` turns - an abort, a provider timeout or overload - have NO `errorCode`; its absence does not mean success, only that the failure is unclassified. A recovered stuck quest that still has renderable content is not a failure at all: it keeps `type: \"message\"` even though it did not finish, so a caller gets the content rather than an error. `fallbackInfo` is present only when the requested model failed and another model produced the reply: `fallbackModel` answered, `primaryModel` is what was asked for, and `reason` is the error from the first failed attempt on the requested model. The poll body carries further fields not modelled here, including `images`, `files`, `toolPayloads`, `promptMeta`, and the attachment report (`attachmentNotices`/`attachmentDelivery`) - only the outcome subset is modelled here.",
29929
30299
  example: {
29930
30300
  id: EXAMPLE_RESOURCE_ID,
29931
30301
  status: "done",
@@ -29940,7 +30310,7 @@ defineEndpoint({
29940
30310
  schema: ApiErrorSchema
29941
30311
  },
29942
30312
  403: {
29943
- description: `The API key does not hold any of the required scopes, the account is suspended (\`errorCode: "account_suspended"\`), a free-tier account named a model outside the free-tier allowlist (\`errorCode: "model_requires_subscription"\`), a free account already started its QuestMaster quest (\`errorCode: "free_quest_limit_reached"\`), organization-policy preflight refuses the model (\`errorCode: "org_model_not_allowed"\`), or an API-key caller named a built-in tool the organization does not allow (\`errorCode: "org_tool_not_allowed"\`). ${SPEND_FROZEN_FORBIDDEN_NOTE}`,
30313
+ description: `The API key does not hold any of the required scopes, the account is suspended (\`errorCode: "account_suspended"\`), a free-tier account named a model outside the free-tier allowlist (\`errorCode: "model_requires_subscription"\`), organization-policy preflight refuses the model (\`errorCode: "org_model_not_allowed"\`), or an API-key caller named a built-in tool the organization does not allow (\`errorCode: "org_tool_not_allowed"\`). ${SPEND_FROZEN_FORBIDDEN_NOTE}`,
29944
30314
  schema: ChatForbiddenErrorSchema
29945
30315
  },
29946
30316
  404: {
@@ -29998,7 +30368,7 @@ defineEndpoint({
29998
30368
  schema: ApiErrorSchema
29999
30369
  },
30000
30370
  403: {
30001
- description: `The API key holds neither the \`ai:chat\` nor the \`ai:generate\` scope, or an organization-billed API key names any organization but its own (\`errorCode: ${BILLING_ORGANIZATION_MISMATCH_ERROR_CODE}\`), or a non-admin caller sent \`confidence_overrides\`, or an API-key caller named built-in \`tools\` the billed organization does not allow (\`errorCode: ${ORG_TOOL_NOT_ALLOWED_ERROR_CODE}\`).`,
30371
+ description: `The API key holds neither the \`ai:chat\` nor the \`ai:generate\` scope, or it sent \`file_ids\` or \`session_file_ids\` without the \`files:read\` scope, or an organization-billed API key names any organization but its own (\`errorCode: ${BILLING_ORGANIZATION_MISMATCH_ERROR_CODE}\`), or a non-admin caller sent \`confidence_overrides\`, or an API-key caller named built-in \`tools\` the billed organization does not allow (\`errorCode: ${ORG_TOOL_NOT_ALLOWED_ERROR_CODE}\`).`,
30002
30372
  schema: BillingOrganizationForbiddenErrorSchema
30003
30373
  },
30004
30374
  404: {
@@ -30280,7 +30650,7 @@ defineEndpoint({
30280
30650
  * gate and one hourly budget (toolRoutesRateLimit), so they cannot drift apart. The JWT-only
30281
30651
  * POST /api/ai/v1/tools (tools.contract.ts) is a separate surface serving the CLI.
30282
30652
  */
30283
- const SCOPES$2 = ["ai:chat", "ai:generate"];
30653
+ const SCOPES$3 = ["ai:chat", "ai:generate"];
30284
30654
  const AUTH = "Authenticate with an API key (`b4m_live_`) carrying `ai:chat` or `ai:generate`, or a JWT. Every call counts against one hourly budget of 600 calls per user, shared by the three `/api/v1/tools/*` endpoints and the three `/api/tools/*` routes.";
30285
30655
  const BILLED = "Billed per call from the caller's credits (or their organization's) when the deployment's provider charges for it, and refused with a 422 `insufficient_credits` before the provider is called when the payer cannot cover it.";
30286
30656
  const FORBIDDEN$3 = {
@@ -30292,7 +30662,7 @@ const BILLED_FORBIDDEN = {
30292
30662
  description: `${FORBIDDEN$3.description} ${SPEND_FROZEN_FORBIDDEN_NOTE}`,
30293
30663
  schema: MeteredForbiddenErrorSchema
30294
30664
  };
30295
- const RATE_LIMITED$5 = {
30665
+ const RATE_LIMITED$6 = {
30296
30666
  description: "Rate limit exceeded: the per-key limit, or the hourly budget shared by the tool endpoints.",
30297
30667
  schema: ApiErrorSchema
30298
30668
  };
@@ -30316,7 +30686,7 @@ defineEndpoint({
30316
30686
  description: "Runs one web search on the provider this deployment is configured with and returns the hits as one formatted text block (title, link and snippet per result), ready to hand to a model. When no search provider is configured, `result` says so instead of listing hits. " + BILLED + " " + AUTH,
30317
30687
  tags: ["Tools"],
30318
30688
  auth: "apiKeyOrJwt",
30319
- scopes: SCOPES$2,
30689
+ scopes: SCOPES$3,
30320
30690
  request: WebSearchToolRequestSchema,
30321
30691
  requestExample: SEARCH_EXAMPLE,
30322
30692
  responses: {
@@ -30332,7 +30702,7 @@ defineEndpoint({
30332
30702
  },
30333
30703
  403: BILLED_FORBIDDEN,
30334
30704
  422: INSUFFICIENT_CREDITS,
30335
- 429: RATE_LIMITED$5,
30705
+ 429: RATE_LIMITED$6,
30336
30706
  500: {
30337
30707
  description: "The search provider failed, or an unexpected server error.",
30338
30708
  schema: ApiErrorSchema
@@ -30354,7 +30724,7 @@ defineEndpoint({
30354
30724
  description: "Fetches one public http or https page and returns its readable content as Markdown, headed by the page title when it has one. A long page is truncated, and the end of `result` says which `offset` to pass to read the next part. Private, loopback and cloud-metadata addresses are refused. " + BILLED + " " + AUTH,
30355
30725
  tags: ["Tools"],
30356
30726
  auth: "apiKeyOrJwt",
30357
- scopes: SCOPES$2,
30727
+ scopes: SCOPES$3,
30358
30728
  request: WebFetchToolRequestSchema,
30359
30729
  requestExample: FETCH_EXAMPLE,
30360
30730
  responses: {
@@ -30376,7 +30746,7 @@ defineEndpoint({
30376
30746
  description: "Request body failed validation, the page cannot be read (unreachable, or a content type that is not a readable page), or the caller cannot afford the call (`errorCode: \"insufficient_credits\"`).",
30377
30747
  schema: InsufficientCreditsErrorSchema
30378
30748
  },
30379
- 429: RATE_LIMITED$5,
30749
+ 429: RATE_LIMITED$6,
30380
30750
  500: {
30381
30751
  description: "The fetch failed, or an unexpected server error.",
30382
30752
  schema: ApiErrorSchema
@@ -30402,7 +30772,7 @@ defineEndpoint({
30402
30772
  description: "Returns the current temperature and conditions at a coordinate as one sentence. Not billed. " + AUTH,
30403
30773
  tags: ["Tools"],
30404
30774
  auth: "apiKeyOrJwt",
30405
- scopes: SCOPES$2,
30775
+ scopes: SCOPES$3,
30406
30776
  request: WeatherToolRequestSchema,
30407
30777
  requestExample: WEATHER_EXAMPLE,
30408
30778
  responses: {
@@ -30416,7 +30786,7 @@ defineEndpoint({
30416
30786
  schema: ApiErrorSchema
30417
30787
  },
30418
30788
  403: FORBIDDEN$3,
30419
- 429: RATE_LIMITED$5,
30789
+ 429: RATE_LIMITED$6,
30420
30790
  500: {
30421
30791
  description: "The weather provider is not configured or failed, or an unexpected server error.",
30422
30792
  schema: ApiErrorSchema
@@ -31173,7 +31543,7 @@ defineEndpoint({
31173
31543
  mcp_server: false,
31174
31544
  custom_mcp_connectors: false,
31175
31545
  mementos: false,
31176
- quest_master: true,
31546
+ quest_master: false,
31177
31547
  rapid_reply: true,
31178
31548
  research_engine: true,
31179
31549
  team_plan: false,
@@ -31389,12 +31759,48 @@ defineEndpoint({
31389
31759
  streaming: false
31390
31760
  }
31391
31761
  });
31762
+ defineEndpoint({
31763
+ method: "post",
31764
+ path: "/api/v1/briefs/follow-ups",
31765
+ operationId: "composeFollowUpBrief",
31766
+ summary: "Compose follow-ups from a dictated memo",
31767
+ description: "Turns a dictated memo (the transcript of a voice note after a meeting or call) into a brief whose decisions propose follow-ups: action items, a follow-up email draft and reminders, each carrying `followUp` in `pending` state. Nothing is sent or scheduled until you approve a decision. Composition is asynchronous like `POST /api/v1/briefs`: the response is the brief in `composing` status, then a `brief_ready` push (or polling `GET /api/v1/briefs/{id}`) signals `ready` or `failed`. Every call starts a new brief, and a follow-up brief does not change the window the next activity brief covers. " + JWT_ONLY_NOTE$2,
31768
+ tags: ["AI"],
31769
+ auth: "jwtOnly",
31770
+ request: BriefFollowUpRequestSchema,
31771
+ responses: {
31772
+ 202: {
31773
+ description: "The follow-ups are being composed.",
31774
+ schema: BriefSchema
31775
+ },
31776
+ 400: {
31777
+ description: "The transcript is empty, blank or too long, or the time zone is unknown.",
31778
+ schema: ApiErrorSchema
31779
+ },
31780
+ 401: {
31781
+ description: "Missing or invalid JWT.",
31782
+ schema: ApiErrorSchema
31783
+ },
31784
+ 429: {
31785
+ description: "Per-user rate limit exceeded.",
31786
+ schema: ApiErrorSchema
31787
+ }
31788
+ },
31789
+ codeSample: {
31790
+ authToken: "<access_token>",
31791
+ streaming: false,
31792
+ body: {
31793
+ transcript: "Email Sam the notes from today and remind me to call the vendor tomorrow at 9.",
31794
+ timeZone: "America/New_York"
31795
+ }
31796
+ }
31797
+ });
31392
31798
  defineEndpoint({
31393
31799
  method: "get",
31394
31800
  path: "/api/v1/briefs",
31395
31801
  operationId: "listBriefs",
31396
31802
  summary: "List briefs",
31397
- description: "Lists your most recent briefs (up to 20), newest first. " + JWT_ONLY_NOTE$2,
31803
+ description: "Lists your most recent briefs (up to 20), newest first. A brief composed from a dictated memo is not listed; read it by id. " + JWT_ONLY_NOTE$2,
31398
31804
  tags: ["AI"],
31399
31805
  auth: "jwtOnly",
31400
31806
  responses: {
@@ -31522,6 +31928,75 @@ defineEndpoint({
31522
31928
  streaming: false
31523
31929
  }
31524
31930
  });
31931
+ const BUSY_BLOCKS_NOTE = "Authenticate with a JWT access token of the signed-in user. The busy blocks are the caller's own; only start and end times are accepted, never event titles or attendees. A brief is composed after a block ends only when something arrived during it.";
31932
+ const BUSY_BLOCKS_EXAMPLE = {
31933
+ enabled: true,
31934
+ blocks: [{
31935
+ start: "2026-11-20T15:00:00.000Z",
31936
+ end: "2026-11-20T16:00:00.000Z"
31937
+ }]
31938
+ };
31939
+ defineEndpoint({
31940
+ method: "get",
31941
+ path: "/api/v1/briefs/busy-blocks",
31942
+ operationId: "getBusyBlocks",
31943
+ summary: "Get your busy blocks",
31944
+ description: "Reads the synced busy blocks and when the next block brief is due. " + BUSY_BLOCKS_NOTE,
31945
+ tags: ["AI"],
31946
+ auth: "jwtOnly",
31947
+ responses: {
31948
+ 200: {
31949
+ description: "Your busy blocks.",
31950
+ schema: BusyBlocksResponseSchema
31951
+ },
31952
+ 401: {
31953
+ description: "Missing or invalid JWT.",
31954
+ schema: ApiErrorSchema
31955
+ },
31956
+ 429: {
31957
+ description: "Per-user rate limit exceeded.",
31958
+ schema: ApiErrorSchema
31959
+ }
31960
+ },
31961
+ codeSample: {
31962
+ authToken: "<access_token>",
31963
+ streaming: false
31964
+ }
31965
+ });
31966
+ defineEndpoint({
31967
+ method: "put",
31968
+ path: "/api/v1/briefs/busy-blocks",
31969
+ operationId: "putBusyBlocks",
31970
+ summary: "Sync your busy blocks",
31971
+ description: "Replaces the stored busy blocks with the device calendar's next busy intervals and returns them merged, with the next due time. Blocks more than 72 hours out and blocks already briefed are dropped. " + BUSY_BLOCKS_NOTE,
31972
+ tags: ["AI"],
31973
+ auth: "jwtOnly",
31974
+ request: PutBusyBlocksSchema,
31975
+ requestExample: BUSY_BLOCKS_EXAMPLE,
31976
+ responses: {
31977
+ 200: {
31978
+ description: "The stored busy blocks.",
31979
+ schema: BusyBlocksResponseSchema
31980
+ },
31981
+ 400: {
31982
+ description: "Malformed JSON request body.",
31983
+ schema: ApiErrorSchema
31984
+ },
31985
+ 401: {
31986
+ description: "Missing or invalid JWT.",
31987
+ schema: ApiErrorSchema
31988
+ },
31989
+ 429: {
31990
+ description: "Per-user rate limit exceeded.",
31991
+ schema: ApiErrorSchema
31992
+ }
31993
+ },
31994
+ codeSample: {
31995
+ authToken: "<access_token>",
31996
+ body: BUSY_BLOCKS_EXAMPLE,
31997
+ streaming: false
31998
+ }
31999
+ });
31525
32000
  defineEndpoint({
31526
32001
  method: "post",
31527
32002
  path: "/api/v1/briefs/{id}/decisions/{decisionId}/reply",
@@ -31575,6 +32050,78 @@ defineEndpoint({
31575
32050
  }
31576
32051
  }
31577
32052
  });
32053
+ const FOLLOW_UP_DECISION_ERRORS = {
32054
+ 401: {
32055
+ description: "Missing or invalid JWT.",
32056
+ schema: ApiErrorSchema
32057
+ },
32058
+ 404: {
32059
+ description: "No such brief or decision, it is not yours, or the decision is not a follow-up.",
32060
+ schema: ApiErrorSchema
32061
+ },
32062
+ 409: {
32063
+ description: "The follow-up was already approved or dismissed (`errorCode: \"decision_closed\"`).",
32064
+ schema: ApiErrorSchema
32065
+ },
32066
+ 429: {
32067
+ description: "Per-user rate limit exceeded.",
32068
+ schema: ApiErrorSchema
32069
+ }
32070
+ };
32071
+ defineEndpoint({
32072
+ method: "patch",
32073
+ path: "/api/v1/briefs/{id}/decisions/{decisionId}",
32074
+ operationId: "editBriefDecision",
32075
+ summary: "Edit a proposed follow-up",
32076
+ description: "Changes a follow-up decision (one carrying `followUp`) while it is still `pending`: `text` on any kind, `draftReply` fields only on a `followUpEmail`, `remindAt` only on a `reminder`. The response is the updated decision. Once the follow-up is approved or dismissed it cannot change; that is `409` with `errorCode: \"decision_closed\"`. " + JWT_ONLY_NOTE$2,
32077
+ tags: ["AI"],
32078
+ auth: "jwtOnly",
32079
+ pathParams: BriefDecisionParamsSchema,
32080
+ request: BriefDecisionEditSchema,
32081
+ responses: {
32082
+ 200: {
32083
+ description: "The updated decision.",
32084
+ schema: BriefDecisionSchema
32085
+ },
32086
+ 400: {
32087
+ description: "No field to change, or a field that does not apply to this kind of follow-up.",
32088
+ schema: ApiErrorSchema
32089
+ },
32090
+ ...FOLLOW_UP_DECISION_ERRORS
32091
+ },
32092
+ codeSample: {
32093
+ authToken: "<access_token>",
32094
+ streaming: false,
32095
+ body: { draftReply: { to: "sam@example.com" } }
32096
+ }
32097
+ });
32098
+ defineEndpoint({
32099
+ method: "post",
32100
+ path: "/api/v1/briefs/{id}/decisions/{decisionId}/resolve",
32101
+ operationId: "resolveBriefDecision",
32102
+ summary: "Approve or dismiss a proposed follow-up",
32103
+ description: "Approves or dismisses a `pending` follow-up decision, once; the response is the updated decision. Approving records your approval and nothing more: the server never sends a `followUpEmail` (hand the approved `draftReply` to the device mail app) and needs `draftReply.to` to be an email address first. An approved `reminder` needs a `remindAt` and is listed in the first brief composed at or after it; with a brief schedule on, the next scheduled brief is moved earlier to that time. A second approve or dismiss is `409` with `errorCode: \"decision_closed\"`. " + JWT_ONLY_NOTE$2,
32104
+ tags: ["AI"],
32105
+ auth: "jwtOnly",
32106
+ pathParams: BriefDecisionParamsSchema,
32107
+ request: BriefDecisionResolveSchema,
32108
+ responses: {
32109
+ 200: {
32110
+ description: "The updated decision.",
32111
+ schema: BriefDecisionSchema
32112
+ },
32113
+ 400: {
32114
+ description: "Approving an email whose recipient is not an email address, or a reminder with no time.",
32115
+ schema: ApiErrorSchema
32116
+ },
32117
+ ...FOLLOW_UP_DECISION_ERRORS
32118
+ },
32119
+ codeSample: {
32120
+ authToken: "<access_token>",
32121
+ streaming: false,
32122
+ body: { outcome: "approve" }
32123
+ }
32124
+ });
31578
32125
  defineEndpoint({
31579
32126
  method: "get",
31580
32127
  path: "/api/v1/pending-decisions",
@@ -31673,6 +32220,199 @@ defineEndpoint({
31673
32220
  body: {}
31674
32221
  }
31675
32222
  });
32223
+ /**
32224
+ * Obligations: a scanned bill, receipt or letter handed to the assistant. Served by
32225
+ * apps/client/pages/api/v1/obligations/index.ts (hand-off, list) and [id].ts (read, correct + confirm);
32226
+ * the extraction lives in apps/client/server/obligations/handOffDocument.ts and confirmed ones reach
32227
+ * the brief through apps/workers/src/events/briefCompose.ts.
32228
+ */
32229
+ const SCOPES$2 = ["ai:chat", "ai:generate"];
32230
+ const RATE_LIMITED$5 = {
32231
+ description: "Per-user rate limit exceeded.",
32232
+ schema: ApiErrorSchema
32233
+ };
32234
+ const CONNECTED_APP = {
32235
+ description: "The key was minted for a connected app, which cannot use obligations.",
32236
+ schema: ApiErrorSchema
32237
+ };
32238
+ const NOT_FOUND$1 = {
32239
+ description: "No such obligation, or it is not yours.",
32240
+ schema: ApiErrorSchema
32241
+ };
32242
+ defineEndpoint({
32243
+ method: "post",
32244
+ path: "/api/v1/obligations",
32245
+ operationId: "handOffObligation",
32246
+ summary: "Hand a scanned document to the assistant",
32247
+ description: "Reads a document you uploaded (a bill, receipt or letter) and extracts the amount, payee and due date, suggesting one of your data lakes to file it in. The result is `pending`: nothing is filed or briefed until you confirm it with `PATCH /api/v1/obligations/{id}`. Pass `text` when the device already recognized the page; otherwise the file's indexed text is read. Handing off the same file again returns the existing obligation with `200` and is not charged again. An API key without `datalake:write` gets no destination suggestion, and one without a data-lake read scope reads `destination` as `null` on every obligation route.",
32248
+ tags: ["AI"],
32249
+ auth: "apiKeyOrJwt",
32250
+ emitsRateLimitHeaders: true,
32251
+ scopes: SCOPES$2,
32252
+ request: ObligationHandoffRequestSchema,
32253
+ requestExample: { file_id: "file_example" },
32254
+ responses: {
32255
+ 201: {
32256
+ description: "The extracted obligation, `pending`.",
32257
+ schema: ObligationSchema,
32258
+ example: {
32259
+ id: "obligation_example",
32260
+ status: "pending",
32261
+ document_kind: "invoice",
32262
+ file_id: "file_example",
32263
+ amount: {
32264
+ value: 120.5,
32265
+ currency: "USD"
32266
+ },
32267
+ payee: "Example Utilities",
32268
+ due_date: "2026-12-15",
32269
+ destination: {
32270
+ lake_id: "lake_example",
32271
+ name: "Household bills"
32272
+ },
32273
+ summary: "Electricity bill for November.",
32274
+ created_at: "2026-11-25T10:00:00.000Z",
32275
+ confirmed_at: null
32276
+ }
32277
+ },
32278
+ 200: {
32279
+ description: "This file was already handed off; the existing obligation.",
32280
+ schema: ObligationSchema
32281
+ },
32282
+ 403: {
32283
+ description: `${CONNECTED_APP.description} Also returned (\`spend_frozen\`) when your account or organization spend is frozen.`,
32284
+ schema: ApiErrorSchema
32285
+ },
32286
+ 404: {
32287
+ description: "`file_id` names no file of yours. Another user's file reads the same.",
32288
+ schema: ApiErrorSchema
32289
+ },
32290
+ 409: {
32291
+ description: "The file is still being checked after upload; retry shortly.",
32292
+ schema: ApiErrorSchema
32293
+ },
32294
+ 422: {
32295
+ description: "The file cannot be processed, has no readable text, or (`insufficient_credits`) you are out of credits.",
32296
+ schema: ApiErrorSchema
32297
+ },
32298
+ 429: {
32299
+ description: `${RATE_LIMITED$5.description} Also returned when the free tier's daily usage cap is reached.`,
32300
+ schema: ApiErrorSchema
32301
+ },
32302
+ 502: {
32303
+ description: "The assistant could not read the document. Nothing was saved, but the reading is charged.",
32304
+ schema: ApiErrorSchema
32305
+ }
32306
+ },
32307
+ codeSample: {
32308
+ authToken: "b4m_live_<key>",
32309
+ streaming: false,
32310
+ body: { file_id: "file_example" }
32311
+ }
32312
+ });
32313
+ defineEndpoint({
32314
+ method: "get",
32315
+ path: "/api/v1/obligations",
32316
+ operationId: "listObligations",
32317
+ summary: "List obligations",
32318
+ description: "Lists your obligations, newest first, optionally only those in one `status`. Cursor-paginated: pass `next_cursor` back as `cursor` until it is `null`.",
32319
+ tags: ["AI"],
32320
+ auth: "apiKeyOrJwt",
32321
+ emitsRateLimitHeaders: true,
32322
+ scopes: SCOPES$2,
32323
+ queryParams: ListObligationsQuerySchema,
32324
+ responses: {
32325
+ 200: {
32326
+ description: "One page of obligations.",
32327
+ schema: ListObligationsResponseSchema
32328
+ },
32329
+ 403: CONNECTED_APP,
32330
+ 422: {
32331
+ description: "Invalid query parameter or cursor.",
32332
+ schema: ApiErrorSchema
32333
+ },
32334
+ 429: RATE_LIMITED$5
32335
+ },
32336
+ codeSample: {
32337
+ authToken: "b4m_live_<key>",
32338
+ streaming: false,
32339
+ body: {}
32340
+ }
32341
+ });
32342
+ defineEndpoint({
32343
+ method: "get",
32344
+ path: "/api/v1/obligations/{id}",
32345
+ operationId: "getObligation",
32346
+ summary: "Get an obligation",
32347
+ description: "Reads one obligation. Only its owner can read it; anyone else gets `404`, exactly like a missing one.",
32348
+ tags: ["AI"],
32349
+ auth: "apiKeyOrJwt",
32350
+ emitsRateLimitHeaders: true,
32351
+ scopes: SCOPES$2,
32352
+ pathParams: ObligationIdParamSchema,
32353
+ responses: {
32354
+ 200: {
32355
+ description: "The obligation.",
32356
+ schema: ObligationSchema
32357
+ },
32358
+ 403: CONNECTED_APP,
32359
+ 404: NOT_FOUND$1,
32360
+ 429: RATE_LIMITED$5
32361
+ },
32362
+ codeSample: {
32363
+ authToken: "b4m_live_<key>",
32364
+ streaming: false,
32365
+ body: {}
32366
+ }
32367
+ });
32368
+ defineEndpoint({
32369
+ method: "patch",
32370
+ path: "/api/v1/obligations/{id}",
32371
+ operationId: "updateObligation",
32372
+ summary: "Correct or confirm an obligation",
32373
+ description: "Corrects the extracted fields and, with `status: \"confirmed\"`, accepts them: the document is filed into the destination data lake and, when it has a due date, the obligation appears in your briefs ahead of it. A confirmed obligation stays editable; changing its destination files the document into the new lake and leaves it in the old one. `status: \"dismissed\"` discards it, after which it cannot be changed. Send at least one field.",
32374
+ tags: ["AI"],
32375
+ auth: "apiKeyOrJwt",
32376
+ emitsRateLimitHeaders: true,
32377
+ scopes: SCOPES$2,
32378
+ pathParams: ObligationIdParamSchema,
32379
+ request: ObligationUpdateRequestSchema,
32380
+ requestExample: {
32381
+ amount: {
32382
+ value: 120.5,
32383
+ currency: "USD"
32384
+ },
32385
+ status: "confirmed"
32386
+ },
32387
+ responses: {
32388
+ 200: {
32389
+ description: "The updated obligation.",
32390
+ schema: ObligationSchema
32391
+ },
32392
+ 403: {
32393
+ description: "The destination is a data lake you can read but not manage or a built-in one, the request sets or files into a destination with an API key lacking `datalake:write`, or the key was minted for a connected app.",
32394
+ schema: ApiErrorSchema
32395
+ },
32396
+ 404: {
32397
+ description: "No such obligation or destination data lake, or it is not yours.",
32398
+ schema: ApiErrorSchema
32399
+ },
32400
+ 409: {
32401
+ description: "The obligation was dismissed and can no longer change.",
32402
+ schema: ApiErrorSchema
32403
+ },
32404
+ 422: {
32405
+ description: "The body is invalid or sets no field.",
32406
+ schema: ApiErrorSchema
32407
+ },
32408
+ 429: RATE_LIMITED$5
32409
+ },
32410
+ codeSample: {
32411
+ authToken: "b4m_live_<key>",
32412
+ streaming: false,
32413
+ body: { status: "confirmed" }
32414
+ }
32415
+ });
31676
32416
  const JWT_ONLY_NOTE$1 = "Authenticate with a JWT access token only: the token is bound to the signed-in session that registers it, and API keys have no session. ";
31677
32417
  defineEndpoint({
31678
32418
  method: "post",
@@ -32232,7 +32972,7 @@ defineEndpoint({
32232
32972
  schema: ImageJobErrorResponseSchema
32233
32973
  },
32234
32974
  422: {
32235
- description: "The request cannot run: a malformed body (`invalid_request`), something the model does not honour (`errorCode` names the first, e.g. `unsupported_size` or `missing_input`; `message` lists them all), an unknown or unavailable model (`model_unavailable`), an input file that is not yours or not found (`input_image_not_found`) or not a usable image (`unsupported_input_image`), too few credits (`insufficient_credits`), a `run` budget with too little left for every job (`run_budget_exhausted`), or an Idempotency-Key problem (`invalid_idempotency_key`, `idempotency_key_reused`).",
32975
+ description: "The request cannot run: a malformed body (`invalid_request`), something the model does not honour (`errorCode` names the first, e.g. `unsupported_size` or `missing_input`; `message` lists them all), an unknown or unavailable model (`model_unavailable`), an input file that is not yours or not found (`input_image_not_found`) or not a usable image (`unsupported_input_image`), too few credits (`insufficient_credits`), a `run` budget with too little left for every job (`run_budget_exhausted`), or an Idempotency-Key problem (`invalid_idempotency_key`, `idempotency_key_reused`). An API key without `files:read` may only name generated images and images staged by an `ai:generate` key without `files:write`; any other file is `input_image_not_found`.",
32236
32976
  schema: ImageJobErrorResponseSchema
32237
32977
  },
32238
32978
  429: rateLimited$4
@@ -34043,7 +34783,7 @@ defineEndpoint({
34043
34783
  path: "/api/v1/sessions",
34044
34784
  operationId: "listSessions",
34045
34785
  summary: "List sessions",
34046
- description: "Lists the sessions you own (called \"notebooks\" in the product UI), newest first. Sessions shared with you are not included; read one of those by id with `GET /api/sessions/{id}`. Each item has the same shape `GET /api/sessions/{id}` returns. Cursor-paginated (see the pagination convention): pass `next_cursor` back as `cursor` until it is `null`. Changing `search`, `surface` or `origin` starts a new listing, so drop the cursor when you do. An API key needs `notebooks:read` or `notebooks:write`.",
34786
+ description: "Lists the sessions you own (called \"notebooks\" in the product UI), newest first. Sessions shared with you are not included; read one of those by id with `GET /api/sessions/{id}`. Each item has the same shape `GET /api/sessions/{id}` returns. Cursor-paginated (see the pagination convention): pass `next_cursor` back as `cursor` until it is `null`. Changing `search`, `surface` or `origin` starts a new listing, so drop the cursor when you do. With `updated_since` it becomes a change feed for keeping a copy in sync: only sessions changed since then, oldest change first, deleted ones included with `deletedAt` set. An API key needs `notebooks:read` or `notebooks:write`.",
34047
34787
  tags: ["Sessions"],
34048
34788
  auth: "apiKeyOrJwt",
34049
34789
  scopes: ["notebooks:read", "notebooks:write"],
@@ -34051,7 +34791,7 @@ defineEndpoint({
34051
34791
  emitsRateLimitHeaders: true,
34052
34792
  responses: {
34053
34793
  200: {
34054
- description: "One page of sessions, newest first by `id`.",
34794
+ description: "One page of sessions, newest first by `id`; with `updated_since`, oldest change first by `updatedAt`.",
34055
34795
  schema: ListSessionsResponseSchema
34056
34796
  },
34057
34797
  403: {
@@ -34059,7 +34799,7 @@ defineEndpoint({
34059
34799
  schema: ScopeForbiddenErrorSchema
34060
34800
  },
34061
34801
  422: {
34062
- description: "`limit` is out of range, a filter is malformed, or `cursor` is malformed or was issued by a different endpoint. A cursor is opaque: pass back exactly the `next_cursor` you were given.",
34802
+ description: "`limit` is out of range, a filter is malformed, or `cursor` is malformed or was issued by a different endpoint or listing order. A cursor is opaque: pass back exactly the `next_cursor` you were given.",
34063
34803
  schema: ApiErrorSchema
34064
34804
  },
34065
34805
  429: {
@@ -35296,7 +36036,7 @@ defineEndpoint({
35296
36036
  schema: ApiErrorSchema
35297
36037
  },
35298
36038
  404: {
35299
- description: "An `inputs` file (or `input_image_file_id`) does not name an image you own (`errorCode: input_image_not_found`), or the `run` does not exist or another user or billing owner minted it (`errorCode: run_not_found`). A nonexistent `organization_id` is `404` only for an admin caller; for anyone else it is `403`.",
36039
+ description: "An `inputs` file (or `input_image_file_id`) does not name an image you own (`errorCode: input_image_not_found`), or the `run` does not exist or another user or billing owner minted it (`errorCode: run_not_found`). A nonexistent `organization_id` is `404` only for an admin caller; for anyone else it is `403`. An API key without `files:read` may only name generated images and images staged by an `ai:generate` key without `files:write`; any other file is `input_image_not_found`.",
35300
36040
  schema: VideoGenerationErrorResponseSchema
35301
36041
  },
35302
36042
  422: {
@@ -35653,7 +36393,7 @@ defineEndpoint({
35653
36393
  },
35654
36394
  403: scopeForbidden,
35655
36395
  404: {
35656
- description: "An input file id is not one of your files, is deleted, or is still being scanned (`errorCode: input_file_not_found`).",
36396
+ description: "An input file id is not one of your files, is deleted, or is still being scanned (`errorCode: input_file_not_found`). An API key without `files:read` may only name generated files and images staged by an `ai:generate` key without `files:write`; any other file is reported the same way.",
35657
36397
  schema: SceneCompositionErrorResponseSchema
35658
36398
  },
35659
36399
  422: {
@@ -38175,6 +38915,8 @@ z$1.object({
38175
38915
  direction: z$1.enum(["asc", "desc"])
38176
38916
  }).optional()
38177
38917
  }).extend({
38918
+ /** Opaque keyset cursor (a previous page's `nextCursor`); when set, `pagination.page` is ignored. */
38919
+ cursor: z$1.string().min(1).max(512).optional(),
38178
38920
  origin: z$1.enum(SESSION_ORIGIN_CHANNELS).optional(),
38179
38921
  excludeOrigin: z$1.enum(SESSION_ORIGIN_CHANNELS).optional(),
38180
38922
  hasImages: z$1.union([z$1.boolean(), z$1.enum(["true", "false"]).transform((value) => value === "true")]).optional()
@@ -39419,7 +40161,8 @@ const shadowDetectionItemSchema = z$1.object({
39419
40161
  /**
39420
40162
  * Verdict counts for one detector and policy version. Precision is derived on the client. Verdict
39421
40163
  * counts cover only records that would have acted; `noAction` counts the `wouldAction: 'none'`
39422
- * records, which are listed and gradable but never counted in precision.
40164
+ * records, which are listed and gradable but never counted in precision. A review-only detector
40165
+ * (isReviewOnlyCompletionDetector) never acts, so its verdicts are counted and `noAction` stays 0.
39423
40166
  */
39424
40167
  const shadowDetectionSummaryRowSchema = z$1.object({
39425
40168
  detector: z$1.enum(SHADOW_DETECTORS),
@@ -43230,6 +43973,10 @@ const SESSION_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
43230
43973
  function isValidSessionId(value) {
43231
43974
  return SESSION_ID_PATTERN.test(value);
43232
43975
  }
43976
+ //#endregion
43977
+ //#region src/utils/Logger.ts
43978
+ const DEBUG_DIR_MODE = 448;
43979
+ const DEBUG_FILE_MODE = 384;
43233
43980
  const logger = class Logger {
43234
43981
  static {
43235
43982
  this.instance = null;
@@ -43251,9 +43998,14 @@ const logger = class Logger {
43251
43998
  if (!isValidSessionId(sessionId)) throw new Error(`Invalid session id "${sessionId}": must match ${SESSION_ID_PATTERN.source}`);
43252
43999
  this.sessionId = sessionId;
43253
44000
  const debugDir = path.join(os.homedir(), ".bike4mind", "debug");
43254
- await fs.mkdir(debugDir, { recursive: true });
44001
+ await fs.mkdir(debugDir, {
44002
+ recursive: true,
44003
+ mode: DEBUG_DIR_MODE
44004
+ });
44005
+ await fs.chmod(debugDir, DEBUG_DIR_MODE).catch(() => {});
43255
44006
  this.logFilePath = path.join(debugDir, `${sessionId}.txt`);
43256
44007
  await this.writeToFile("INFO", "=== CLI SESSION START ===");
44008
+ await fs.chmod(this.logFilePath, DEBUG_FILE_MODE).catch(() => {});
43257
44009
  }
43258
44010
  /**
43259
44011
  * Set whether verbose console logging is enabled
@@ -43307,7 +44059,10 @@ const logger = class Logger {
43307
44059
  if (!this.fileLoggingEnabled || !this.logFilePath) return;
43308
44060
  try {
43309
44061
  const logEntry = `[${(/* @__PURE__ */ new Date()).toISOString().replace("T", " ").substring(0, 19)}] [${level}] ${message}\n`;
43310
- await fs.appendFile(this.logFilePath, logEntry, "utf-8");
44062
+ await fs.appendFile(this.logFilePath, logEntry, {
44063
+ encoding: "utf-8",
44064
+ mode: DEBUG_FILE_MODE
44065
+ });
43311
44066
  } catch (error) {
43312
44067
  console.error("File logging failed:", error);
43313
44068
  }
@@ -43437,4 +44192,4 @@ const logger = class Logger {
43437
44192
  }.getInstance();
43438
44193
  logger.setVerbose(process.env.B4M_VERBOSE === "1");
43439
44194
  //#endregion
43440
- export { RESEARCH_ITEM_RULE_ACTIONS as $, tokenEstimateMultiplier as $t, DEFAULT_TTS_PROVIDER as A, isExpectedToolError as At, LOW_CONFIDENCE_COMPLETION_MODES as B, planLeaves as Bt, CREDIT_DEDUCT_TRANSACTION_TYPES as C, getEmbeddingModelCapabilities as Ct, CreateArtifactRequestSchema as D, hasDeliverablePinnedArtifact as Dt, CompletionReasoningEffortSchema as E, googleMapsSearchUrl as Et, EMBEDDING_MODEL_IDS as F, isSupportedFabFileMimeType as Ft, NotFoundError as G, resolveSettingDefinition as Gt, MODEL_INFO_FIELD_GROUP_OF as H, questReplyText as Ht, ExpectedToolError as I, isUserInitiatedAbort as It, PROMPT_TEXT_MAX as J, signImageUrl as Jt, OllamaEmbeddingModel as K, secureParameters as Kt, ImageJobSchema as L, joinReplySlots as Lt, DecisionTextPartSchema as M, isProviderRefusalStopReason as Mt, DecisionsRequestSchema as N, isRetryableError as Nt, CreateImageJobResponseSchema as O, isEarlyStop as Ot, EMBEDDING_MODEL_CATALOG as P, isSupportedEmbeddingModel as Pt, RESEARCH_FEED_URL_MAX_CHARS as Q, supportedVoiceGenerationVendor as Qt, ImageModels as R, normalizeDomainEntry as Rt, CONTEXT_WINDOW_SAFETY_BUFFER_TOKENS as S, generatedAudioResponseSchema as St, ChatModels as T, getQuestErrorCode as Tt, McpServerName as U, reasoningChannelOf as Ut, MODEL_DECLINED_MESSAGE as V, planProgress as Vt, ModelBackend as W, replacePromptVariables as Wt, RESEARCH_COST_CEILING_MICRO_USD_LIMIT as X, stripDeliveredArtifactBlocks as Xt, PermissionDeniedError as Y, splitEquals as Yt, RESEARCH_DROP_REASONS as Z, stripToolArtifactMarkup as Zt, AudioMimeType as _, WEBSITE_URL as _n, createReasoningWithholder as _t, htmlFirstH1 as a, withholdsReasoning as an, SEARCH_RESULT_CARDS_LANGUAGE as at, BriefcasePromptIdSchema as b, filterToolArtifactMarkup as bt, AGENT_QUEST_MANIFEST as c, actorColorIndex as cn, SupportedFabFileMimeTypes as ct, ARTIFACT_REMOVED_PLACEHOLDER as d, delegationPayloadSchema as dn, VoyageAIEmbeddingModel as dt, ttsBase64ResponseSchema as en, RESEARCH_MIN_RELEVANCE_DEFAULT as et, AdminAiStoredConfigSchema as f, selfClaimedActorKindSchema as fn, WORK_ITEM_STATUSES as ft, ArtifactTypeSchema as g, APP_NAME as gn, createMutex as gt, ApiKeyType as h, splitSkillMdFrontmatter as hn, completionsSupportsToolSearch as ht, htmlErrorTitle as i, withRetry as in, REVIEW_GATE_STATUS_VALUES as it, DEGENERATE_FINISH_REASON as j, isPlaceholderImageSigningSecret as jt, DATA_LAKE_PROPOSAL_STATUSES as k, isEnforceCreditsLocked as kt, AGENT_QUEST_MCP_URI as l, actorKindMarker as ln, UnprocessableEntityError as lt, ApiKeyScope as m, readSkillMdSourceUrl as mn, buildPromptContext as mt, SESSION_ID_PATTERN as n, ttsResponseTooLargeSchema as nn, RESEARCH_SOURCES as nt, escapeArtifactBodyJson as o, ACTOR_COLOR_SLOTS as on, SLUG_OWNED_BY_OTHER as ot, AiAccessRefusedError as p, frontmatterHasSourceStamp as pn, assertAuthOriginMatchesApiKey as pt, OpenAIEmbeddingModel as q, servableEmbeddingDimensions as qt, isValidSessionId as r, visibleReplyText as rn, RESEARCH_UNLISTED_SOURCES as rt, AGENT_QUEST_ID as s, DELEGATION_PAYLOAD_SCHEMA_NAME as sn, SUBQUEST_STATUS_VALUES as st, logger as t, ttsRequestSchema as tn, RESEARCH_SCHEDULE_CADENCES as tt, ARTIFACT_DELIVERED_PLACEHOLDER as u, actorKindSchema as un, VisibilitySchema as ut, BRIEFCASE_CATALOG_QUERIES as v, createThinkMarkerEscaper as vt, CUSTOM_MCP_DATA_NOTICE as w, getMcpProviderMetadata as wt, CONFIDENCE_GATE_MODES as x, fromCliTodos as xt, BedrockEmbeddingModel as y, escapeThinkMarkers as yt, LOCATION_MAP_LANGUAGE as z, obfuscateApiKey as zt };
44195
+ export { RESEARCH_ITEM_RULE_ACTIONS as $, ttsRequestSchema as $t, DEFAULT_TTS_PROVIDER as A, isProviderRefusalStopReason as At, LOW_CONFIDENCE_COMPLETION_MODES as B, questReplyText as Bt, CREDIT_DEDUCT_TRANSACTION_TYPES as C, getQuestErrorCode as Ct, CreateArtifactRequestSchema as D, isEnforceCreditsLocked as Dt, CompletionReasoningEffortSchema as E, isEarlyStop as Et, EMBEDDING_MODEL_IDS as F, joinReplySlots as Ft, NotFoundError as G, servableEmbeddingDimensions as Gt, MODEL_INFO_FIELD_GROUP_OF as H, replacePromptVariables as Ht, ExpectedToolError as I, normalizeDomainEntry as It, PROMPT_TEXT_MAX as J, stripDeliveredArtifactBlocks as Jt, OllamaEmbeddingModel as K, signImageUrl as Kt, ImageJobSchema as L, obfuscateApiKey as Lt, DecisionTextPartSchema as M, isSupportedEmbeddingModel as Mt, DecisionsRequestSchema as N, isSupportedFabFileMimeType as Nt, CreateImageJobResponseSchema as O, isExpectedToolError as Ot, EMBEDDING_MODEL_CATALOG as P, isUserInitiatedAbort as Pt, RESEARCH_FEED_URL_MAX_CHARS as Q, ttsBase64ResponseSchema as Qt, ImageModels as R, planLeaves as Rt, CONTEXT_WINDOW_SAFETY_BUFFER_TOKENS as S, getMcpProviderMetadata as St, ChatModels as T, hasDeliverablePinnedArtifact as Tt, McpServerName as U, resolveSettingDefinition as Ut, MODEL_DECLINED_MESSAGE as V, reasoningChannelOf as Vt, ModelBackend as W, secureParameters as Wt, RESEARCH_COST_CEILING_MICRO_USD_LIMIT as X, supportedVoiceGenerationVendor as Xt, PermissionDeniedError as Y, stripToolArtifactMarkup as Yt, RESEARCH_DROP_REASONS as Z, tokenEstimateMultiplier as Zt, AudioMimeType as _, escapeThinkMarkers as _t, htmlFirstH1 as a, DELEGATION_PAYLOAD_SCHEMA_NAME as an, SLUG_OWNED_BY_OTHER as at, BriefcasePromptIdSchema as b, generatedAudioResponseSchema as bt, AGENT_QUEST_MANIFEST as c, actorKindSchema as cn, VisibilitySchema as ct, ARTIFACT_REMOVED_PLACEHOLDER as d, frontmatterHasSourceStamp as dn, assertAuthOriginMatchesApiKey as dt, ttsResponseTooLargeSchema as en, RESEARCH_MIN_RELEVANCE_DEFAULT as et, AdminAiStoredConfigSchema as f, readSkillMdSourceUrl as fn, buildPromptContext as ft, ArtifactTypeSchema as g, createThinkMarkerEscaper as gt, ApiKeyType as h, WEBSITE_URL as hn, createReasoningWithholder as ht, htmlErrorTitle as i, ACTOR_COLOR_SLOTS as in, SEARCH_RESULT_CARDS_LANGUAGE as it, DEGENERATE_FINISH_REASON as j, isRetryableError as jt, DATA_LAKE_PROPOSAL_STATUSES as k, isPlaceholderImageSigningSecret as kt, AGENT_QUEST_MCP_URI as l, delegationPayloadSchema as ln, VoyageAIEmbeddingModel as lt, ApiKeyScope as m, APP_NAME as mn, createMutex as mt, SESSION_ID_PATTERN as n, withRetry as nn, RESEARCH_SOURCES as nt, escapeArtifactBodyJson as o, actorColorIndex as on, SupportedFabFileMimeTypes as ot, AiAccessRefusedError as p, splitSkillMdFrontmatter as pn, completionsSupportsToolSearch as pt, OpenAIEmbeddingModel as q, splitEquals as qt, isValidSessionId as r, withholdsReasoning as rn, RESEARCH_UNLISTED_SOURCES as rt, AGENT_QUEST_ID as s, actorKindMarker as sn, UnprocessableEntityError as st, logger as t, visibleReplyText as tn, RESEARCH_SCHEDULE_CADENCES as tt, ARTIFACT_DELIVERED_PLACEHOLDER as u, selfClaimedActorKindSchema as un, WORK_ITEM_STATUSES as ut, BRIEFCASE_CATALOG_QUERIES as v, filterToolArtifactMarkup as vt, CUSTOM_MCP_DATA_NOTICE as w, googleMapsSearchUrl as wt, CONFIDENCE_GATE_MODES as x, getEmbeddingModelCapabilities as xt, BedrockEmbeddingModel as y, fromCliTodos as yt, LOCATION_MAP_LANGUAGE as z, planProgress as zt };