@bike4mind/cli 5.0.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 (37) hide show
  1. package/dist/{AgentHistoryStore-C3hJOgpM.mjs → AgentHistoryStore-DW6BBbVj.mjs} +442 -30
  2. package/dist/{ApiClient-CeuIcSY8.mjs → ApiClient-D4bDuWXg.mjs} +3 -3
  3. package/dist/{BubblewrapRuntime-BF5wXaNS.mjs → BubblewrapRuntime-D3EO5Y0C.mjs} +2 -2
  4. package/dist/{ConfigStore-nr0ebq4v.mjs → ConfigStore-BuLA_-uZ.mjs} +17 -1
  5. package/dist/ConfigStore-DdqxfmDr.mjs +2 -0
  6. package/dist/{Logger-CovZt7LL.mjs → Logger-CjaYx85U.mjs} +1055 -706
  7. package/dist/{SandboxOrchestrator-DTz_5Zub.mjs → SandboxOrchestrator-yORi2eFV.mjs} +1 -1
  8. package/dist/{SandboxRuntimeAdapter-X0HAkbpW.mjs → SandboxRuntimeAdapter-BjJwJNfg.mjs} +1 -1
  9. package/dist/{SandboxRuntimeAdapter-CC5KlbZ8.mjs → SandboxRuntimeAdapter-BmkaFzqU.mjs} +2 -2
  10. package/dist/{SeatbeltRuntime-zdxVqGZ3.mjs → SeatbeltRuntime-CyZNmFwD.mjs} +2 -2
  11. package/dist/{WorkItemsClient-lKJCPP0j.mjs → WorkItemsClient-xmo0DrCm.mjs} +1 -1
  12. package/dist/{buildToolSearch-BlOSK4m3.mjs → buildToolSearch-CXxEtVKc.mjs} +2 -2
  13. package/dist/commands/acpCommand.mjs +5 -5
  14. package/dist/commands/apiCommand.mjs +1 -1
  15. package/dist/commands/doctorCommand.mjs +2 -2
  16. package/dist/commands/envCommand.mjs +1 -1
  17. package/dist/commands/headlessCommand.mjs +6 -6
  18. package/dist/commands/mcpCommand.mjs +3 -3
  19. package/dist/commands/mirrorCommand.mjs +2 -2
  20. package/dist/commands/modelsCommand.mjs +4 -4
  21. package/dist/commands/pluginCommand.mjs +1 -1
  22. package/dist/commands/skillsCommand.mjs +3 -3
  23. package/dist/commands/updateCommand.mjs +2 -2
  24. package/dist/{createFile-B8bur5Rb-CVzCarEA.mjs → createFile-CPKmd6Uf-Bk-3V2T3.mjs} +3 -3
  25. package/dist/{deleteFile-9B3gW_Nb-DG2sovIl.mjs → deleteFile-CD_xQ7Y6-C1X4Ievb.mjs} +17 -4
  26. package/dist/{dist-BrBjZ6Cv.mjs → dist-DsMzCRLX.mjs} +64 -32
  27. package/dist/{fit-vnmP4Dfc.mjs → fit-C9eLTDcR.mjs} +3 -3
  28. package/dist/{globFiles-CwJ8qmYo-BR5b2KvO.mjs → globFiles-CoapsO8G-CpvQo-R2.mjs} +9 -5
  29. package/dist/{grepSearch-CLtEqT4j-BnKPtNWr.mjs → grepSearch-DeH7M2e7-BIvo-yNy.mjs} +2 -2
  30. package/dist/index.mjs +9 -9
  31. package/dist/{modelServers-CjSlPFsg.mjs → modelServers-DeOGFwLi.mjs} +1 -1
  32. package/dist/{package-BTvxFRbB.mjs → package-CvffLo0I.mjs} +1 -1
  33. package/dist/{pathValidation-BRqf4HFX-CHwtwp3O.mjs → pathValidation-C4ADzpUR-BPIpINwZ.mjs} +36 -12
  34. package/dist/{serve-BLBhPkyw.mjs → serve-tmC__JNj.mjs} +6 -6
  35. package/dist/{updateChecker-uDIZuEZg.mjs → updateChecker-U4AfrPKj.mjs} +1 -1
  36. package/package.json +10 -10
  37. package/dist/ConfigStore--dPqdX3O.mjs +0 -2
@@ -4447,6 +4447,504 @@ z$1.enum([
4447
4447
  "external",
4448
4448
  "internal"
4449
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
+ };
4450
4948
  /** An `owner/name` GitHub repository; also used by the worker's repository check. */
4451
4949
  const SECOPS_TRIAGE_REPO_PATTERN = /^[\w.-]+\/[\w.-]+$/;
4452
4950
  const MAX_ISSUES_MESSAGE = "Max issues per scan must be between 1 and 100";
@@ -5120,6 +5618,8 @@ z$1.enum([
5120
5618
  "EnableCallableFunctionsMcp",
5121
5619
  "CallableFunctionTimeLimitSeconds",
5122
5620
  "CallableFunctionPendingCallLimit",
5621
+ "CallableFunctionDataFileMaxMb",
5622
+ "CallableFunctionDataTotalMaxMb",
5123
5623
  "EnableAgents",
5124
5624
  "EnableAgentsDefault",
5125
5625
  "EnableAgentMode",
@@ -5202,6 +5702,7 @@ z$1.enum([
5202
5702
  "EnableUserDeletionEmailNotification",
5203
5703
  "EnableUserDeletionSlackNotification",
5204
5704
  "AdminEmail",
5705
+ "mailFrom",
5205
5706
  "MaxFileSize",
5206
5707
  "AiEditVersionRetention",
5207
5708
  "DefaultContext",
@@ -5363,6 +5864,8 @@ z$1.enum([
5363
5864
  "spendMonitorAutoPauseTrustedMinCredits",
5364
5865
  "youngAccountSpendPageUsdPerHour",
5365
5866
  "youngAccountSpendWarnUsdPerHour",
5867
+ "providerSpendOpenaiUsdPerHour",
5868
+ "providerSpendAnthropicUsdPerHour",
5366
5869
  "freeTierDailySystemCostCapUsd",
5367
5870
  "signupGrantSignupPoolDaily",
5368
5871
  "signupGrantTricklePoolDaily",
@@ -6244,7 +6747,10 @@ const SIGNUP_RISK_SIGNALS = [
6244
6747
  "fastSpend",
6245
6748
  "generatedLocalPart",
6246
6749
  "wafAnonIp",
6247
- "wafBotSignal"
6750
+ "wafBotSignal",
6751
+ "emailSubdomainBurst",
6752
+ "bannedEmailSubdomainSibling",
6753
+ "instantApiKey"
6248
6754
  ];
6249
6755
  const signupRiskWeight = (defaultValue) => z$1.number().min(0).max(100).prefault(defaultValue);
6250
6756
  /**
@@ -6261,10 +6767,22 @@ const SignupRiskScoringSchema = z$1.object({
6261
6767
  fastSpend: signupRiskWeight(20),
6262
6768
  generatedLocalPart: signupRiskWeight(10),
6263
6769
  wafAnonIp: signupRiskWeight(0),
6264
- wafBotSignal: signupRiskWeight(0)
6770
+ wafBotSignal: signupRiskWeight(0),
6771
+ emailSubdomainBurst: signupRiskWeight(30),
6772
+ bannedEmailSubdomainSibling: signupRiskWeight(30),
6773
+ instantApiKey: signupRiskWeight(20)
6265
6774
  }).strict().prefault({}),
6266
6775
  /** A first API key minted within this many minutes of signup counts as quick. */
6267
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),
6268
6786
  /** Credits spent in the first 24h at which fastSpend reaches its full weight; less scales linearly. */
6269
6787
  fastSpendCredits: z$1.number().positive().prefault(1e3),
6270
6788
  /** A score at or above this needs review. */
@@ -7094,6 +7612,14 @@ const API_SERVICE_GROUPS = {
7094
7612
  key: "CallableFunctionPendingCallLimit",
7095
7613
  order: 24.6
7096
7614
  },
7615
+ {
7616
+ key: "CallableFunctionDataFileMaxMb",
7617
+ order: 24.7
7618
+ },
7619
+ {
7620
+ key: "CallableFunctionDataTotalMaxMb",
7621
+ order: 24.8
7622
+ },
7097
7623
  {
7098
7624
  key: "EnableBriefcase",
7099
7625
  order: 25
@@ -7512,6 +8038,14 @@ const API_SERVICE_GROUPS = {
7512
8038
  key: "youngAccountSpendWarnUsdPerHour",
7513
8039
  order: 19.496
7514
8040
  },
8041
+ {
8042
+ key: "providerSpendOpenaiUsdPerHour",
8043
+ order: 19.497
8044
+ },
8045
+ {
8046
+ key: "providerSpendAnthropicUsdPerHour",
8047
+ order: 19.498
8048
+ },
7515
8049
  {
7516
8050
  key: "freeTierDailySystemCostCapUsd",
7517
8051
  order: 19.5
@@ -7780,13 +8314,20 @@ const API_SERVICE_GROUPS = {
7780
8314
  name: "Server Administration",
7781
8315
  description: "Server status and administrative settings",
7782
8316
  icon: "AdminPanelSettings",
7783
- settings: [{
7784
- key: "serverStatus",
7785
- order: 1
7786
- }, {
7787
- key: "AdminEmail",
7788
- order: 2
7789
- }]
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
+ ]
7790
8331
  },
7791
8332
  REGISTRATION: {
7792
8333
  id: "registrationService",
@@ -8735,6 +9276,34 @@ const settingsMap = {
8735
9276
  dependsOn: "EnableCallableFunctions",
8736
9277
  scope: { settableAt: ["organization"] }
8737
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
+ }),
8738
9307
  EnableAgents: makeBooleanSetting({
8739
9308
  key: "EnableAgents",
8740
9309
  name: "Enable Agents",
@@ -9927,6 +10496,18 @@ const settingsMap = {
9927
10496
  group: API_SERVICE_GROUPS.ADMIN.id,
9928
10497
  order: 2
9929
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
+ },
9930
10511
  MaxFileSize: makeNumberSetting({
9931
10512
  key: "MaxFileSize",
9932
10513
  userReadable: true,
@@ -11012,6 +11593,24 @@ const settingsMap = {
11012
11593
  group: API_SERVICE_GROUPS.CREDITS.id,
11013
11594
  category: "SecOps"
11014
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
+ }),
11015
11614
  freeTierDailySystemCostCapUsd: makeNumberSetting({
11016
11615
  key: "freeTierDailySystemCostCapUsd",
11017
11616
  name: "Free Tier Daily System Cost Cap (USD)",
@@ -13425,550 +14024,6 @@ let ApiKeyType = /* @__PURE__ */ function(ApiKeyType) {
13425
14024
  ApiKeyType["typesafe"] = "typesafe";
13426
14025
  return ApiKeyType;
13427
14026
  }({});
13428
- /**
13429
- * Official B4M LLM tools.
13430
- */
13431
- const b4mLLMTools = z$1.enum([
13432
- "dice_roll",
13433
- "image_generation",
13434
- "edit_image",
13435
- "music_generation",
13436
- "audio_generation",
13437
- "video_generation",
13438
- "production_storyboard",
13439
- "production_generate_shot",
13440
- "production_add_audio",
13441
- "production_assemble",
13442
- "weather_info",
13443
- "web_search",
13444
- "web_fetch",
13445
- "wolfram_alpha",
13446
- "math_evaluate",
13447
- "mermaid_chart",
13448
- "current_datetime",
13449
- "current_model_details",
13450
- "deep_research",
13451
- "prompt_enhancement",
13452
- "recharts",
13453
- "edit_file",
13454
- "blog_publish",
13455
- "blog_edit",
13456
- "blog_draft",
13457
- "wikipedia_on_this_day",
13458
- "moon_phase",
13459
- "sunrise_sunset",
13460
- "iss_tracker",
13461
- "planet_visibility",
13462
- "search_knowledge_base",
13463
- "chess_engine",
13464
- "retrieve_knowledge_content",
13465
- "count_knowledge_base",
13466
- "describe_knowledge_base",
13467
- "decide",
13468
- "list_my_data_lakes",
13469
- "create_data_lake",
13470
- "save_content_to_data_lake",
13471
- "delegate_to_agent",
13472
- "optihashi_schedule",
13473
- "optihashi_formulate",
13474
- "optihashi_edit_problem",
13475
- "navigate_view",
13476
- "generate_jupyter_notebook",
13477
- "excel_generation",
13478
- "fmp_financial_data",
13479
- "bob_panel_read",
13480
- "skill"
13481
- ]);
13482
- /**
13483
- * The data-lake tools that write (make a lake, persist a file into one). A route withholds these
13484
- * from an API key without datalake:write (dataLakeToolsDeniedFor in the client's
13485
- * dataLakeScopes.ts).
13486
- */
13487
- const DATA_LAKE_WRITE_TOOL_NAMES = ["create_data_lake", "save_content_to_data_lake"];
13488
- /** Every data-lake tool - offered, trimmed and paired together (see resolveEnabledTools in services). */
13489
- const DATA_LAKE_TOOL_NAMES = [...["list_my_data_lakes"], ...DATA_LAKE_WRITE_TOOL_NAMES];
13490
- b4mLLMTools.options.map((tool) => tool);
13491
- /**
13492
- * Recharts chart types.
13493
- */
13494
- const RechartsChartTypeSchema = z$1.enum([
13495
- "LineChart",
13496
- "AreaChart",
13497
- "BarChart",
13498
- "PieChart",
13499
- "ScatterChart",
13500
- "RadialBarChart",
13501
- "ComposedChart",
13502
- "Treemap",
13503
- "FunnelChart",
13504
- "RadarChart"
13505
- ]);
13506
- RechartsChartTypeSchema.enum;
13507
- /**
13508
- * Schema for LLM model fallback information
13509
- */
13510
- const FallbackInfoSchema = z$1.object({
13511
- sessionId: z$1.string(),
13512
- primaryModel: z$1.string(),
13513
- primaryModelName: z$1.string(),
13514
- fallbackModel: z$1.string(),
13515
- fallbackModelName: z$1.string(),
13516
- /**
13517
- * Backend of each side, so the badge can name the provider path without
13518
- * inferring it from the id - a bare `deepseek-*` slug is the direct API on a
13519
- * hosted deployment and an Ollama pull on a self-hosted one. Optional and
13520
- * loosely typed: these payloads are persisted in browser storage, so a record
13521
- * written by an older build has neither field and an unknown backend name from
13522
- * a newer one must not fail the parse.
13523
- */
13524
- primaryModelBackend: z$1.string().optional(),
13525
- fallbackModelBackend: z$1.string().optional(),
13526
- /** The error that forced the first hop, PII-scrubbed and length-capped by sanitizeTelemetryError. */
13527
- reason: z$1.string().optional(),
13528
- timestamp: z$1.number()
13529
- });
13530
- const ArtifactMetadataSchema = z$1.object({
13531
- language: z$1.string().optional(),
13532
- dependencies: z$1.array(z$1.string()).optional(),
13533
- settings: z$1.record(z$1.string(), z$1.unknown()).optional()
13534
- });
13535
- const ArtifactTypeSchema = z$1.enum([
13536
- "mermaid",
13537
- "recharts",
13538
- "chess",
13539
- "python",
13540
- "react",
13541
- "html",
13542
- "svg",
13543
- "code",
13544
- "quest",
13545
- "file",
13546
- "questmaster",
13547
- "lattice",
13548
- "blog-draft"
13549
- ]);
13550
- [...new Set(Object.values({
13551
- mermaid: {
13552
- name: "Mermaid Diagram",
13553
- description: "Flowcharts, sequence diagrams, and other visual diagrams using Mermaid syntax",
13554
- category: "visualization",
13555
- mimeType: "text/plain"
13556
- },
13557
- recharts: {
13558
- name: "Chart/Graph",
13559
- description: "Interactive charts and graphs using Recharts library",
13560
- category: "visualization",
13561
- mimeType: "application/json"
13562
- },
13563
- python: {
13564
- name: "Python Script",
13565
- description: "Python code for data processing, analysis, and automation",
13566
- category: "code",
13567
- mimeType: "text/x-python"
13568
- },
13569
- react: {
13570
- name: "React Component",
13571
- description: "Interactive React components with JSX and hooks",
13572
- category: "interactive",
13573
- mimeType: "text/javascript"
13574
- },
13575
- html: {
13576
- name: "HTML Document",
13577
- description: "Static HTML pages with CSS styling",
13578
- category: "web",
13579
- mimeType: "text/html"
13580
- },
13581
- svg: {
13582
- name: "SVG Graphics",
13583
- description: "Scalable Vector Graphics for illustrations and icons",
13584
- category: "graphics",
13585
- mimeType: "image/svg+xml"
13586
- },
13587
- code: {
13588
- name: "Generic Code",
13589
- description: "General purpose code in various programming languages",
13590
- category: "code",
13591
- mimeType: "text/plain"
13592
- },
13593
- quest: {
13594
- name: "Quest/Tutorial",
13595
- description: "Learning quests and interactive tutorials",
13596
- category: "education",
13597
- mimeType: "application/json"
13598
- },
13599
- file: {
13600
- name: "File Artifact",
13601
- description: "Generic file artifacts for documents and media",
13602
- category: "document",
13603
- mimeType: "application/octet-stream"
13604
- },
13605
- questmaster: {
13606
- name: "QuestMaster Plan",
13607
- description: "Complex multi-step learning plans with dependencies",
13608
- category: "education",
13609
- mimeType: "application/json"
13610
- },
13611
- lattice: {
13612
- name: "Financial Model",
13613
- description: "Financial pro-forma models and projections",
13614
- category: "finance",
13615
- mimeType: "application/json"
13616
- },
13617
- chess: {
13618
- name: "Chess Game",
13619
- description: "Interactive chess board with move validation and AI opponent",
13620
- category: "interactive",
13621
- mimeType: "application/json"
13622
- },
13623
- "blog-draft": {
13624
- name: "Blog Draft",
13625
- description: "Drafted blog/social content ready for review and publishing",
13626
- category: "document",
13627
- mimeType: "application/json"
13628
- }
13629
- }).map((info) => info.category))];
13630
- const ArtifactSchema = z$1.object({
13631
- id: z$1.string(),
13632
- type: ArtifactTypeSchema,
13633
- title: z$1.string(),
13634
- content: z$1.string(),
13635
- preview: z$1.string().optional(),
13636
- metadata: ArtifactMetadataSchema.optional(),
13637
- version: z$1.int().positive().prefault(1).optional(),
13638
- createdAt: z$1.date(),
13639
- updatedAt: z$1.date()
13640
- });
13641
- ArtifactSchema.extend({
13642
- type: z$1.literal("quest"),
13643
- metadata: ArtifactMetadataSchema.extend({
13644
- complexity: z$1.string(),
13645
- status: z$1.string(),
13646
- subQuests: z$1.array(z$1.object({
13647
- id: z$1.string(),
13648
- title: z$1.string(),
13649
- status: z$1.string()
13650
- }))
13651
- })
13652
- });
13653
- ArtifactSchema.extend({
13654
- type: z$1.literal("react"),
13655
- metadata: ArtifactMetadataSchema.extend({
13656
- dependencies: z$1.array(z$1.string()).prefault([]),
13657
- props: z$1.record(z$1.string(), z$1.unknown()).optional(),
13658
- hasDefaultExport: z$1.boolean().prefault(true),
13659
- errorBoundary: z$1.boolean().prefault(true)
13660
- })
13661
- });
13662
- ArtifactSchema.extend({
13663
- type: z$1.literal("html"),
13664
- metadata: ArtifactMetadataSchema.extend({
13665
- allowedScripts: z$1.array(z$1.string()).prefault([]),
13666
- cspPolicy: z$1.string().optional(),
13667
- sanitized: z$1.boolean().prefault(true)
13668
- })
13669
- });
13670
- ArtifactSchema.extend({
13671
- type: z$1.literal("svg"),
13672
- metadata: ArtifactMetadataSchema.extend({
13673
- viewBox: z$1.string().optional(),
13674
- width: z$1.number().optional(),
13675
- height: z$1.number().optional(),
13676
- sanitized: z$1.boolean().prefault(true)
13677
- })
13678
- });
13679
- ArtifactSchema.extend({
13680
- type: z$1.literal("mermaid"),
13681
- metadata: ArtifactMetadataSchema.extend({
13682
- chartType: z$1.enum([
13683
- "flowchart",
13684
- "sequenceDiagram",
13685
- "classDiagram",
13686
- "stateDiagram",
13687
- "entityRelationshipDiagram",
13688
- "gantt",
13689
- "pie",
13690
- "mindmap"
13691
- ]).optional(),
13692
- description: z$1.string().optional()
13693
- })
13694
- });
13695
- ArtifactSchema.extend({
13696
- type: z$1.literal("recharts"),
13697
- metadata: ArtifactMetadataSchema.extend({
13698
- chartType: RechartsChartTypeSchema.optional(),
13699
- description: z$1.string().optional(),
13700
- dataPoints: z$1.number().optional(),
13701
- width: z$1.number().optional(),
13702
- height: z$1.number().optional(),
13703
- xAxis: z$1.string().optional(),
13704
- yAxis: z$1.string().optional(),
13705
- colors: z$1.array(z$1.string()).optional()
13706
- })
13707
- });
13708
- ArtifactSchema.extend({
13709
- type: z$1.literal("chess"),
13710
- metadata: ArtifactMetadataSchema.extend({
13711
- fen: z$1.string().optional(),
13712
- turn: z$1.enum(["w", "b"]).optional(),
13713
- lastMove: z$1.object({
13714
- from: z$1.string(),
13715
- to: z$1.string(),
13716
- san: z$1.string().optional()
13717
- }).optional(),
13718
- isCheck: z$1.boolean().optional(),
13719
- isCheckmate: z$1.boolean().optional(),
13720
- isDraw: z$1.boolean().optional(),
13721
- isGameOver: z$1.boolean().optional(),
13722
- moveNumber: z$1.number().optional()
13723
- })
13724
- });
13725
- ArtifactSchema.extend({
13726
- type: z$1.literal("lattice"),
13727
- metadata: ArtifactMetadataSchema.extend({
13728
- modelType: z$1.enum([
13729
- "income_statement",
13730
- "balance_sheet",
13731
- "cashflow",
13732
- "saas_metrics",
13733
- "custom"
13734
- ]).optional(),
13735
- periodGrain: z$1.enum([
13736
- "month",
13737
- "quarter",
13738
- "year"
13739
- ]).optional(),
13740
- currency: z$1.string().prefault("USD"),
13741
- entityCount: z$1.int().nonnegative().optional(),
13742
- ruleCount: z$1.int().nonnegative().optional(),
13743
- lastComputedAt: z$1.date().optional()
13744
- })
13745
- });
13746
- ArtifactSchema.extend({
13747
- type: z$1.literal("python"),
13748
- metadata: ArtifactMetadataSchema.extend({
13749
- packages: z$1.array(z$1.string()).default([]),
13750
- hasOutput: z$1.boolean().default(false),
13751
- executionState: z$1.enum([
13752
- "idle",
13753
- "running",
13754
- "completed",
13755
- "error"
13756
- ]).optional(),
13757
- lastExecutionTime: z$1.number().optional()
13758
- })
13759
- });
13760
- z$1.object({
13761
- chartType: z$1.enum([
13762
- "flowchart",
13763
- "sequenceDiagram",
13764
- "classDiagram",
13765
- "stateDiagram",
13766
- "entityRelationshipDiagram",
13767
- "gantt",
13768
- "pie",
13769
- "mindmap"
13770
- ]).optional(),
13771
- description: z$1.string().optional()
13772
- });
13773
- z$1.object({ artifacts: z$1.array(ArtifactSchema).optional() });
13774
- const ArtifactOperationSchema = z$1.enum([
13775
- "create",
13776
- "update",
13777
- "rewrite"
13778
- ]);
13779
- z$1.object({
13780
- operation: ArtifactOperationSchema,
13781
- artifactId: z$1.string().optional(),
13782
- type: ArtifactTypeSchema,
13783
- title: z$1.string(),
13784
- content: z$1.string(),
13785
- metadata: ArtifactMetadataSchema.optional()
13786
- });
13787
- String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
13788
- const ClaudeArtifactMimeTypes = {
13789
- REACT: "application/vnd.ant.react",
13790
- HTML: "text/html",
13791
- SVG: "image/svg+xml",
13792
- MERMAID: "application/vnd.ant.mermaid",
13793
- RECHARTS: "application/vnd.ant.recharts",
13794
- CHESS: "application/vnd.ant.chess",
13795
- CODE: "application/vnd.ant.code",
13796
- MARKDOWN: "text/markdown",
13797
- LATTICE: "application/vnd.b4m.lattice",
13798
- PYTHON: "application/vnd.ant.python",
13799
- BLOG_DRAFT: "application/vnd.b4m.blog-draft"
13800
- };
13801
- const FAB_FILE_TYPE_FILTERS = [
13802
- "text",
13803
- "pdf",
13804
- "url",
13805
- "image",
13806
- "excel",
13807
- "word",
13808
- "json",
13809
- "csv",
13810
- "markdown",
13811
- "code",
13812
- "audio",
13813
- "video"
13814
- ];
13815
- let KnowledgeType = /* @__PURE__ */ function(KnowledgeType) {
13816
- /**
13817
- * A knowledge that is from a URL.
13818
- */
13819
- KnowledgeType["URL"] = "URL";
13820
- /**
13821
- * A knowledge that is a file uploaded by the user.
13822
- */
13823
- KnowledgeType["FILE"] = "FILE";
13824
- /**
13825
- * This is a user-created knowledge through the Bike4Mind knowledge editor.
13826
- */
13827
- KnowledgeType["TEXT"] = "TEXT";
13828
- /**
13829
- * Generated audio (TTS / sound effects). Storable and browsable, but never
13830
- * ingestable: no model accepts audio as input, so audio is deliberately
13831
- * excluded from every LLM-attachment and vectorization path.
13832
- */
13833
- KnowledgeType["AUDIO"] = "AUDIO";
13834
- /** Generated video. Media-only like AUDIO: storable and browsable, never ingested. */
13835
- KnowledgeType["VIDEO"] = "VIDEO";
13836
- return KnowledgeType;
13837
- }({});
13838
- let FabFileSourceType = /* @__PURE__ */ function(FabFileSourceType) {
13839
- FabFileSourceType["MANUAL_UPLOAD"] = "manual_upload";
13840
- FabFileSourceType["SALESFORCE"] = "salesforce";
13841
- FabFileSourceType["GOOGLE_DRIVE"] = "google_drive";
13842
- FabFileSourceType["SLACK"] = "slack";
13843
- /** Admitted from an acquisition proposal, by a person approving it or by a trusted-site rule. */
13844
- FabFileSourceType["PROPOSAL_APPROVAL"] = "proposal_approval";
13845
- FabFileSourceType["GITHUB"] = "github";
13846
- /**
13847
- * Produced by a generator: an in-chat tool, a generation route or a generation job. Media saved
13848
- * through saveGeneratedAsset carries `sourceMetadata.generation` (GeneratedAssetMetadata).
13849
- * `sourceMetadata.sessionId`, when set, links it to the notebook it was made in - see
13850
- * persistGeneratedFileAsFabFile for why that link is not the top-level `sessionId`.
13851
- * `sourceMetadata.generatedCopyKey` names a second, generated-bucket copy that deletes also
13852
- * remove (see generatedCopyKeyOf). `sourceMetadata.generatedOutputKey` names the chat image the
13853
- * file holds, with no delete cascade, so copy-generated-image can find the generation behind it.
13854
- */
13855
- FabFileSourceType["TOOL_GENERATED"] = "tool_generated";
13856
- /**
13857
- * A markdown file converted from a legacy QuestMaster plan or graph. `sourceMetadata` is
13858
- * `{ sourceKind: 'quest-plan' | 'quest-graph', sourceId, sourceUpdatedAt }`; (userId, sourceId)
13859
- * keys the conversion's idempotency. Rows carry `storageExempt`.
13860
- */
13861
- FabFileSourceType["QUESTMASTER_ARCHIVE"] = "questmaster_archive";
13862
- return FabFileSourceType;
13863
- }({});
13864
- let Permission = /* @__PURE__ */ function(Permission) {
13865
- Permission["read"] = "read";
13866
- Permission["create"] = "create";
13867
- Permission["update"] = "update";
13868
- Permission["delete"] = "delete";
13869
- Permission["share"] = "share";
13870
- return Permission;
13871
- }({});
13872
- const groupShareSchema = z$1.object({
13873
- groupId: z$1.string(),
13874
- permissions: z$1.array(z$1.enum(Permission))
13875
- });
13876
- const userShareSchema = z$1.object({
13877
- userId: z$1.string(),
13878
- permissions: z$1.array(z$1.enum(Permission)),
13879
- /** The project ID if the user is shared from a project */
13880
- projectId: z$1.string().optional(),
13881
- extraData: z$1.object({
13882
- /** The last time the user exported data */
13883
- lastExportDate: z$1.date().optional() }).optional(),
13884
- /**
13885
- * TODO: To be replaced with proper user zod schema
13886
- */
13887
- user: z$1.any().optional()
13888
- });
13889
- const shareableDocumentSchema = z$1.object({
13890
- isGlobalRead: z$1.boolean(),
13891
- isGlobalWrite: z$1.boolean(),
13892
- users: z$1.array(userShareSchema),
13893
- groups: z$1.array(groupShareSchema)
13894
- });
13895
- const MAX_RETENTION_DAYS = 36500;
13896
- z$1.object({
13897
- chats: z$1.number().int().min(1).max(MAX_RETENTION_DAYS).nullable(),
13898
- files: z$1.number().int().min(1).max(MAX_RETENTION_DAYS).nullable(),
13899
- media: z$1.number().int().min(1).max(MAX_RETENTION_DAYS).nullable()
13900
- }).strict();
13901
- /**
13902
- * Machine-readable error classifiers for `type: 'error'` quests. Set server-side
13903
- * so the client can branch to a targeted error UI (see `IChatHistoryItem.errorCode`).
13904
- * These are the billing classifiers a thrown error resolves to; the published
13905
- * quest schemas derive from QUEST_OUTCOME_ERROR_CODES below, which adds the one
13906
- * non-billing code.
13907
- *
13908
- * SSE-frame scoped, and a NARROWING of the platform-wide `API_ERROR_CODES`: a
13909
- * thrown quest error is classified for billing reasons, never for the
13910
- * provider-configuration reasons the HTTP surface reports. The `satisfies` is what keeps it a narrowing rather
13911
- * than a second vocabulary - a code added here that is not in `API_ERROR_CODES`
13912
- * fails the build. `run_budget_exhausted` lands on an image generation quest whose `run` budget
13913
- * could not cover the render's credit hold (ImageGeneration.process).
13914
- */
13915
- const QUEST_ERROR_CODES = [
13916
- "insufficient_credits",
13917
- "spend_cap_exceeded",
13918
- "spend_frozen",
13919
- "free_quest_limit_reached",
13920
- "run_budget_exhausted"
13921
- ];
13922
- /**
13923
- * Every classifier a stored quest's `errorCode` can hold: the billing codes above plus
13924
- * `content_blocked`, set when prompt moderation refuses the turn. A separate tuple because
13925
- * getQuestErrorCode and resolveQuestErrorCode read QUEST_ERROR_CODES off thrown errors to pick
13926
- * the billing branches, which a moderation refusal must never take.
13927
- */
13928
- const QUEST_OUTCOME_ERROR_CODES = [...QUEST_ERROR_CODES, "content_blocked"];
13929
- /**
13930
- * Single source of truth for `IChatHistoryItem.type` / quest `type`. Restated by hand in
13931
- * `schemas/actions.ts`, `schemas/chat.ts`, and `notebookExportService/types.ts` before this
13932
- * const existed, which is exactly how `voice_transcript` went missing from the export contract
13933
- * once already - derive from this tuple instead of retyping the union.
13934
- */
13935
- const CHAT_HISTORY_ITEM_TYPES = [
13936
- "message",
13937
- "oob",
13938
- "error",
13939
- "system",
13940
- "voice_transcript"
13941
- ];
13942
- /**
13943
- * Why a turn's LLM call was retried. Timeouts we raise ourselves are classified ahead of
13944
- * overload so they never read as a provider fault (older backends worded them "may be
13945
- * overloaded"). Must stay in sync with classifyTurnRetryReason in @bike4mind/services.
13946
- */
13947
- const TURN_RETRY_REASONS = [
13948
- "stream_idle_timeout",
13949
- "stream_truncated",
13950
- "request_timeout",
13951
- "rate_limit",
13952
- "overloaded",
13953
- "server_error",
13954
- "transport",
13955
- "tool_pairing",
13956
- "other"
13957
- ];
13958
- /** Where a session was created. Absent on sessions that predate the field; render those as 'web'. */
13959
- const SESSION_ORIGIN_CHANNELS = [
13960
- "web",
13961
- "api",
13962
- "slack",
13963
- "cli",
13964
- "desktop",
13965
- "agent"
13966
- ];
13967
- z$1.union([
13968
- z$1.literal("string"),
13969
- z$1.literal("number"),
13970
- z$1.literal("boolean")
13971
- ]);
13972
14027
  let ApiKeyScope = /* @__PURE__ */ function(ApiKeyScope) {
13973
14028
  ApiKeyScope["READ_NOTEBOOKS"] = "notebooks:read";
13974
14029
  ApiKeyScope["WRITE_NOTEBOOKS"] = "notebooks:write";
@@ -14255,6 +14310,177 @@ Object.freeze({
14255
14310
  requestsPerMinute: 60,
14256
14311
  requestsPerDay: 1e3
14257
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
+ ]);
14258
14484
  /**
14259
14485
  * Valid status values for sub-quests.
14260
14486
  * Canonical vocabulary - the mongoose schema, zod schemas, and client all
@@ -14611,7 +14837,7 @@ const CREDIT_DEDUCT_TRANSACTION_TYPES = [
14611
14837
  const NON_AI_DEDUCT_TRANSACTION_TYPES = ["transfer_credit", "generic_deduct"];
14612
14838
  CREDIT_DEDUCT_TRANSACTION_TYPES.filter((t) => !NON_AI_DEDUCT_TRANSACTION_TYPES.includes(t));
14613
14839
  CREDIT_DEDUCT_TRANSACTION_TYPES.filter((t) => t !== "transfer_credit");
14614
- const identity = z$1.string().min(1).max(128);
14840
+ const identity$1 = z$1.string().min(1).max(128);
14615
14841
  const PlatformAttribution = z$1.object({
14616
14842
  kind: z$1.literal("platform_operation"),
14617
14843
  operation: z$1.literal("sre_diagnosis"),
@@ -14621,11 +14847,11 @@ const PlatformAttribution = z$1.object({
14621
14847
  "development",
14622
14848
  "test"
14623
14849
  ]),
14624
- logicalJobId: identity,
14625
- executionId: identity
14850
+ logicalJobId: identity$1,
14851
+ executionId: identity$1
14626
14852
  }).strict();
14627
14853
  z$1.object({
14628
- providerCallId: identity,
14854
+ providerCallId: identity$1,
14629
14855
  attribution: PlatformAttribution,
14630
14856
  provider: z$1.string().min(1).max(128),
14631
14857
  model: z$1.string().min(1).max(256),
@@ -15080,123 +15306,6 @@ const RESERVED_MCP_CONNECTION_SLUGS = /* @__PURE__ */ new Set([
15080
15306
  ...Object.values(McpServerName)
15081
15307
  ]);
15082
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" });
15083
- const ArtifactStatusSchema = z$1.enum([
15084
- "draft",
15085
- "review",
15086
- "published",
15087
- "archived",
15088
- "deleted"
15089
- ]);
15090
- const VisibilitySchema = z$1.enum([
15091
- "private",
15092
- "project",
15093
- "organization",
15094
- "public"
15095
- ]);
15096
- const ArtifactPermissionsSchema = z$1.object({
15097
- canRead: z$1.array(z$1.string()),
15098
- canWrite: z$1.array(z$1.string()),
15099
- canDelete: z$1.array(z$1.string()),
15100
- isPublic: z$1.boolean().prefault(false),
15101
- inheritFromProject: z$1.boolean().prefault(true)
15102
- });
15103
- const BaseArtifactSchema = z$1.object({
15104
- id: z$1.uuid(),
15105
- type: ArtifactTypeSchema,
15106
- title: z$1.string().min(1).max(255),
15107
- description: z$1.string().max(1e3).optional(),
15108
- version: z$1.int().positive().prefault(1),
15109
- versionTag: z$1.string().max(100).optional(),
15110
- currentVersionId: z$1.uuid().optional(),
15111
- parentVersionId: z$1.uuid().optional(),
15112
- createdAt: z$1.date(),
15113
- updatedAt: z$1.date(),
15114
- publishedAt: z$1.date().optional(),
15115
- deletedAt: z$1.date().optional(),
15116
- userId: z$1.string(),
15117
- projectId: z$1.string().optional(),
15118
- organizationId: z$1.string().optional(),
15119
- visibility: VisibilitySchema.prefault("private"),
15120
- permissions: ArtifactPermissionsSchema,
15121
- sourceQuestId: z$1.string().optional(),
15122
- sessionId: z$1.string().optional(),
15123
- parentArtifactId: z$1.uuid().optional(),
15124
- identifier: z$1.string().optional(),
15125
- status: ArtifactStatusSchema.prefault("draft"),
15126
- tags: z$1.array(z$1.string().max(50)).max(20).prefault([]),
15127
- contentHash: z$1.string(),
15128
- contentSize: z$1.int().nonnegative(),
15129
- metadata: z$1.record(z$1.string(), z$1.unknown()).optional()
15130
- });
15131
- const EnhancedArtifactMetadataSchema = z$1.object({
15132
- language: z$1.string().optional(),
15133
- dependencies: z$1.array(z$1.string()).optional(),
15134
- settings: z$1.record(z$1.string(), z$1.unknown()).optional()
15135
- });
15136
- BaseArtifactSchema.extend({
15137
- type: z$1.literal("react"),
15138
- content: z$1.string(),
15139
- metadata: EnhancedArtifactMetadataSchema.extend({
15140
- dependencies: z$1.array(z$1.string()),
15141
- props: z$1.record(z$1.string(), z$1.unknown()).optional(),
15142
- hasDefaultExport: z$1.boolean(),
15143
- errorBoundary: z$1.boolean().prefault(true)
15144
- })
15145
- });
15146
- BaseArtifactSchema.extend({
15147
- type: z$1.literal("html"),
15148
- content: z$1.string(),
15149
- metadata: EnhancedArtifactMetadataSchema.extend({
15150
- allowedScripts: z$1.array(z$1.string()).prefault([]),
15151
- cspPolicy: z$1.string().optional(),
15152
- sanitized: z$1.boolean().prefault(false)
15153
- })
15154
- });
15155
- BaseArtifactSchema.extend({
15156
- type: z$1.literal("svg"),
15157
- content: z$1.string(),
15158
- metadata: EnhancedArtifactMetadataSchema.extend({
15159
- viewBox: z$1.string().optional(),
15160
- width: z$1.number().positive().optional(),
15161
- height: z$1.number().positive().optional(),
15162
- sanitized: z$1.boolean().prefault(false)
15163
- })
15164
- });
15165
- BaseArtifactSchema.extend({
15166
- type: z$1.literal("mermaid"),
15167
- content: z$1.string(),
15168
- metadata: EnhancedArtifactMetadataSchema.extend({
15169
- chartType: z$1.enum([
15170
- "flowchart",
15171
- "sequenceDiagram",
15172
- "classDiagram",
15173
- "stateDiagram",
15174
- "entityRelationshipDiagram",
15175
- "gantt",
15176
- "pie",
15177
- "mindmap"
15178
- ]).optional(),
15179
- description: z$1.string().optional()
15180
- })
15181
- });
15182
- BaseArtifactSchema.extend({
15183
- type: z$1.literal("python"),
15184
- content: z$1.string(),
15185
- metadata: EnhancedArtifactMetadataSchema.extend({
15186
- packages: z$1.array(z$1.string()).default([]),
15187
- hasOutput: z$1.boolean().default(false),
15188
- executionState: z$1.enum([
15189
- "idle",
15190
- "running",
15191
- "completed",
15192
- "error"
15193
- ]).optional(),
15194
- lastExecutionTime: z$1.number().optional()
15195
- })
15196
- });
15197
- /** `verified` when at least one cited worked example passed on the server at promotion; otherwise `unverified`. */
15198
- const CALLABLE_FUNCTION_TRUST_LABELS = ["verified", "unverified"];
15199
- VisibilitySchema.exclude(["public"]);
15200
15309
  /** Where a function call came from. */
15201
15310
  const CALLABLE_FUNCTION_CALL_SURFACES = [
15202
15311
  "test",
@@ -15214,7 +15323,8 @@ const CALLABLE_FUNCTION_CALL_OUTCOMES = [
15214
15323
  "timeout",
15215
15324
  "memory",
15216
15325
  "output_too_large",
15217
- "refused"
15326
+ "refused",
15327
+ "data_mismatch"
15218
15328
  ];
15219
15329
  /** An asynchronous call's row reads `queued`, then `running`, until it is overwritten with how the call ended. */
15220
15330
  const CALLABLE_FUNCTION_CALL_PENDING_OUTCOMES = ["queued", "running"];
@@ -16564,6 +16674,45 @@ function completionsSupportsToolSearch(model) {
16564
16674
  return servedByClaudeAdapter(model) && supportsToolSearch(model);
16565
16675
  }
16566
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" });
16567
16716
  z.enum([
16568
16717
  "openai",
16569
16718
  "test",
@@ -20835,6 +20984,7 @@ const SELF_VIEW_PASSTHROUGH_FIELDS = {
20835
20984
  referredViaLinkAt: true,
20836
20985
  referralCode: true,
20837
20986
  signupInvite: true,
20987
+ signupClientId: true,
20838
20988
  organizationId: true,
20839
20989
  lastActiveAt: true,
20840
20990
  isOnline: true,
@@ -20843,6 +20993,7 @@ const SELF_VIEW_PASSTHROUGH_FIELDS = {
20843
20993
  showCreditsUsed: true,
20844
20994
  platformEmailAddress: true,
20845
20995
  authorizedEmailAddresses: true,
20996
+ releasedPlatformEmailAddresses: true,
20846
20997
  preferredVoice: true,
20847
20998
  voiceOverrideId: true,
20848
20999
  voiceSystemPromptOverride: true,
@@ -21692,6 +21843,8 @@ const STUDIO_COMPOSITION_LIMITS = {
21692
21843
  briefFieldMaxLength: 500,
21693
21844
  brandColorsMax: 8,
21694
21845
  brandProductFilesMax: 20,
21846
+ brandCharactersMax: 8,
21847
+ characterNameMaxLength: 100,
21695
21848
  shotsMax: 100,
21696
21849
  shotTitleMaxLength: 200,
21697
21850
  shotDescriptionMaxLength: 4e3,
@@ -21710,12 +21863,20 @@ const StudioCompositionBriefSchema = z$1.object({
21710
21863
  tone: z$1.string().trim().max(limits.briefFieldMaxLength).optional(),
21711
21864
  productFileId: StudioFileIdSchema.optional()
21712
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
+ });
21713
21873
  /** A deliberately small first cut of a brand kit; it grows as templates need more. */
21714
21874
  const StudioBrandKitSchema = z$1.object({
21715
21875
  logoFileId: StudioFileIdSchema.optional(),
21716
21876
  colors: z$1.array(z$1.string().regex(/^#[0-9a-fA-F]{6}$/, "Colors are #RRGGBB")).max(limits.brandColorsMax).default([]),
21717
21877
  fontFamily: z$1.string().trim().min(1).max(100).optional(),
21718
- 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([])
21719
21880
  });
21720
21881
  /**
21721
21882
  * One planned shot: what it should show and the takes generated for it. `fileIds` lists every take, the chosen one
@@ -21723,7 +21884,7 @@ const StudioBrandKitSchema = z$1.object({
21723
21884
  * fields need no Mongoose change.
21724
21885
  */
21725
21886
  const StudioShotSchema = z$1.object({
21726
- id: z$1.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/, "Ids may contain only letters, digits, \"_\" and \"-\""),
21887
+ id: StudioItemIdSchema,
21727
21888
  title: z$1.string().trim().min(1).max(limits.shotTitleMaxLength),
21728
21889
  description: z$1.string().trim().max(limits.shotDescriptionMaxLength).optional(),
21729
21890
  durationMs: z$1.number().int().positive().optional(),
@@ -21732,7 +21893,8 @@ const StudioShotSchema = z$1.object({
21732
21893
  intent: z$1.string().trim().max(limits.shotIntentMaxLength).optional(),
21733
21894
  chosenFileId: StudioFileIdSchema.optional(),
21734
21895
  clipFileId: StudioFileIdSchema.optional(),
21735
- 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()
21736
21898
  });
21737
21899
  const StudioShotListSchema = z$1.array(StudioShotSchema).max(limits.shotsMax);
21738
21900
  /** The client-writable content of a composition. Ownership fields are server-set and live on the entity below. */
@@ -23728,6 +23890,46 @@ const AgentExecutionStepSchema = z$1.object({
23728
23890
  tool_name: z$1.string().optional()
23729
23891
  });
23730
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
+ /**
23731
23933
  * Poll response for `GET /api/v1/agent-executions/{id}`.
23732
23934
  *
23733
23935
  * `steps` is the live trace: it grows while the run is in flight (read from the
@@ -23737,18 +23939,7 @@ const AgentExecutionStepSchema = z$1.object({
23737
23939
  */
23738
23940
  const AgentExecutionStatusResponseSchema = z$1.object({
23739
23941
  id: z$1.string(),
23740
- status: z$1.enum([
23741
- "pending",
23742
- "running",
23743
- "continuing",
23744
- "awaiting_permission",
23745
- "awaiting_subagent",
23746
- "awaiting_dag_children",
23747
- "paused",
23748
- "completed",
23749
- "failed",
23750
- "aborted"
23751
- ]),
23942
+ status: z$1.enum(PUBLIC_AGENT_EXECUTION_STATUSES),
23752
23943
  session_id: z$1.string().nullable(),
23753
23944
  answer: z$1.string().nullable(),
23754
23945
  /**
@@ -23764,6 +23955,7 @@ const AgentExecutionStatusResponseSchema = z$1.object({
23764
23955
  error: z$1.string().nullable(),
23765
23956
  steps: z$1.array(AgentExecutionStepSchema),
23766
23957
  total_iterations: z$1.number().nullable(),
23958
+ step_progress: AgentExecutionStepProgressSchema.nullable(),
23767
23959
  created_at: z$1.string(),
23768
23960
  updated_at: z$1.string()
23769
23961
  });
@@ -24960,7 +25152,9 @@ const SessionResponseSchema = z$1.object({
24960
25152
  promptCacheTtl: z$1.enum(["5m", "1h"]).optional().describe("The chat's prompt-cache lifetime. Absent when never set, which follows your default."),
24961
25153
  lastUsedModel: z$1.string().nullish(),
24962
25154
  firstCreated: z$1.date(),
24963
- 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.")
24964
25158
  });
24965
25159
  /** Request body for POST /api/v1/sessions/{id}/clone. */
24966
25160
  const SessionCloneRequestSchema = z$1.preprocess((body) => body === "" ? void 0 : body, z$1.object({ targetSurface: z$1.string().nullable().optional() }).default({}));
@@ -24968,7 +25162,8 @@ const SessionCloneRequestSchema = z$1.preprocess((body) => body === "" ? void 0
24968
25162
  const ListSessionsQuerySchema = PaginationQuerySchema.extend({
24969
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."),
24970
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."),
24971
- 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.")
24972
25167
  });
24973
25168
  const ListSessionsResponseSchema = paginatedResponseSchema(SessionResponseSchema);
24974
25169
  /** Response for DELETE /api/sessions/{id}. */
@@ -26679,7 +26874,8 @@ const BRIEF_LIMITS = {
26679
26874
  itemsPerSection: 12,
26680
26875
  draftTo: 320,
26681
26876
  draftSubject: 200,
26682
- draftBody: 4e3
26877
+ draftBody: 4e3,
26878
+ followUpTranscript: 6e3
26683
26879
  };
26684
26880
  const BriefSourceRefSchema = z$1.discriminatedUnion("kind", [
26685
26881
  z$1.object({
@@ -26709,7 +26905,7 @@ const BriefApprovalStateSchema = z$1.enum([
26709
26905
  "resolved"
26710
26906
  ]);
26711
26907
  const BriefDraftReplySchema = z$1.object({
26712
- 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."),
26713
26909
  subject: z$1.string().min(1).max(BRIEF_LIMITS.draftSubject),
26714
26910
  body: z$1.string().min(1).max(BRIEF_LIMITS.draftBody)
26715
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.");
@@ -26733,9 +26929,25 @@ const BriefQuestionRefSchema = z$1.object({
26733
26929
  options: z$1.array(z$1.string()).max(4).describe("Suggested answers, in order; `choiceIndex` on a reply refers to this list."),
26734
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.")
26735
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
+ });
26736
26947
  const BriefDecisionSchema = BriefItemSchema.extend({
26737
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."),
26738
- 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}`."),
26739
26951
  draftReply: BriefDraftReplySchema.optional()
26740
26952
  });
26741
26953
  const BriefSchema = z$1.object({
@@ -26759,6 +26971,20 @@ const BriefReplyRequestSchema = z$1.object({
26759
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."),
26760
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.")
26761
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"]) });
26762
26988
  const BriefReplyResponseSchema = z$1.object({
26763
26989
  executionId: z$1.string().describe("The agent run continuing the conversation with your reply."),
26764
26990
  sessionId: z$1.string().describe("The notebook the run belongs to.")
@@ -30142,7 +30368,7 @@ defineEndpoint({
30142
30368
  schema: ApiErrorSchema
30143
30369
  },
30144
30370
  403: {
30145
- 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}\`).`,
30146
30372
  schema: BillingOrganizationForbiddenErrorSchema
30147
30373
  },
30148
30374
  404: {
@@ -31533,12 +31759,48 @@ defineEndpoint({
31533
31759
  streaming: false
31534
31760
  }
31535
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
+ });
31536
31798
  defineEndpoint({
31537
31799
  method: "get",
31538
31800
  path: "/api/v1/briefs",
31539
31801
  operationId: "listBriefs",
31540
31802
  summary: "List briefs",
31541
- 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,
31542
31804
  tags: ["AI"],
31543
31805
  auth: "jwtOnly",
31544
31806
  responses: {
@@ -31788,6 +32050,78 @@ defineEndpoint({
31788
32050
  }
31789
32051
  }
31790
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
+ });
31791
32125
  defineEndpoint({
31792
32126
  method: "get",
31793
32127
  path: "/api/v1/pending-decisions",
@@ -32638,7 +32972,7 @@ defineEndpoint({
32638
32972
  schema: ImageJobErrorResponseSchema
32639
32973
  },
32640
32974
  422: {
32641
- 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`.",
32642
32976
  schema: ImageJobErrorResponseSchema
32643
32977
  },
32644
32978
  429: rateLimited$4
@@ -34449,7 +34783,7 @@ defineEndpoint({
34449
34783
  path: "/api/v1/sessions",
34450
34784
  operationId: "listSessions",
34451
34785
  summary: "List sessions",
34452
- 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`.",
34453
34787
  tags: ["Sessions"],
34454
34788
  auth: "apiKeyOrJwt",
34455
34789
  scopes: ["notebooks:read", "notebooks:write"],
@@ -34457,7 +34791,7 @@ defineEndpoint({
34457
34791
  emitsRateLimitHeaders: true,
34458
34792
  responses: {
34459
34793
  200: {
34460
- 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`.",
34461
34795
  schema: ListSessionsResponseSchema
34462
34796
  },
34463
34797
  403: {
@@ -34465,7 +34799,7 @@ defineEndpoint({
34465
34799
  schema: ScopeForbiddenErrorSchema
34466
34800
  },
34467
34801
  422: {
34468
- 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.",
34469
34803
  schema: ApiErrorSchema
34470
34804
  },
34471
34805
  429: {
@@ -35702,7 +36036,7 @@ defineEndpoint({
35702
36036
  schema: ApiErrorSchema
35703
36037
  },
35704
36038
  404: {
35705
- 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`.",
35706
36040
  schema: VideoGenerationErrorResponseSchema
35707
36041
  },
35708
36042
  422: {
@@ -36059,7 +36393,7 @@ defineEndpoint({
36059
36393
  },
36060
36394
  403: scopeForbidden,
36061
36395
  404: {
36062
- 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.",
36063
36397
  schema: SceneCompositionErrorResponseSchema
36064
36398
  },
36065
36399
  422: {
@@ -38581,6 +38915,8 @@ z$1.object({
38581
38915
  direction: z$1.enum(["asc", "desc"])
38582
38916
  }).optional()
38583
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(),
38584
38920
  origin: z$1.enum(SESSION_ORIGIN_CHANNELS).optional(),
38585
38921
  excludeOrigin: z$1.enum(SESSION_ORIGIN_CHANNELS).optional(),
38586
38922
  hasImages: z$1.union([z$1.boolean(), z$1.enum(["true", "false"]).transform((value) => value === "true")]).optional()
@@ -39825,7 +40161,8 @@ const shadowDetectionItemSchema = z$1.object({
39825
40161
  /**
39826
40162
  * Verdict counts for one detector and policy version. Precision is derived on the client. Verdict
39827
40163
  * counts cover only records that would have acted; `noAction` counts the `wouldAction: 'none'`
39828
- * 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.
39829
40166
  */
39830
40167
  const shadowDetectionSummaryRowSchema = z$1.object({
39831
40168
  detector: z$1.enum(SHADOW_DETECTORS),
@@ -43636,6 +43973,10 @@ const SESSION_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
43636
43973
  function isValidSessionId(value) {
43637
43974
  return SESSION_ID_PATTERN.test(value);
43638
43975
  }
43976
+ //#endregion
43977
+ //#region src/utils/Logger.ts
43978
+ const DEBUG_DIR_MODE = 448;
43979
+ const DEBUG_FILE_MODE = 384;
43639
43980
  const logger = class Logger {
43640
43981
  static {
43641
43982
  this.instance = null;
@@ -43657,9 +43998,14 @@ const logger = class Logger {
43657
43998
  if (!isValidSessionId(sessionId)) throw new Error(`Invalid session id "${sessionId}": must match ${SESSION_ID_PATTERN.source}`);
43658
43999
  this.sessionId = sessionId;
43659
44000
  const debugDir = path.join(os.homedir(), ".bike4mind", "debug");
43660
- 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(() => {});
43661
44006
  this.logFilePath = path.join(debugDir, `${sessionId}.txt`);
43662
44007
  await this.writeToFile("INFO", "=== CLI SESSION START ===");
44008
+ await fs.chmod(this.logFilePath, DEBUG_FILE_MODE).catch(() => {});
43663
44009
  }
43664
44010
  /**
43665
44011
  * Set whether verbose console logging is enabled
@@ -43713,7 +44059,10 @@ const logger = class Logger {
43713
44059
  if (!this.fileLoggingEnabled || !this.logFilePath) return;
43714
44060
  try {
43715
44061
  const logEntry = `[${(/* @__PURE__ */ new Date()).toISOString().replace("T", " ").substring(0, 19)}] [${level}] ${message}\n`;
43716
- 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
+ });
43717
44066
  } catch (error) {
43718
44067
  console.error("File logging failed:", error);
43719
44068
  }