palbase 0.68.0 → 0.69.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 (65) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai-sdk/index.js +2 -2
  3. package/dist/backend/engine.js +2 -2
  4. package/dist/backend/env.js +1 -1
  5. package/dist/backend/index.js +3 -3
  6. package/dist/backend/stack.js +1 -1
  7. package/dist/backend/test.js +2 -2
  8. package/dist/chunks/{2ZHSNWVZ.js → 37KUGTKN.js} +2 -2
  9. package/dist/chunks/{UJLFALKX.js → BCSBO6QR.js} +2 -2
  10. package/dist/chunks/BZYYDYLF.js +2 -0
  11. package/dist/chunks/{22GRHCVI.js → CD2TYINV.js} +1 -1
  12. package/dist/chunks/{J7WJF7F4.js → CE6XFRSZ.js} +2 -2
  13. package/dist/chunks/{XJLAH42O.js → CPTZEOT3.js} +1 -1
  14. package/dist/chunks/CRK2KWFW.js +18 -0
  15. package/dist/chunks/{D6EUPFUR.js → D6ZVNWQ2.js} +2 -2
  16. package/dist/chunks/{4YV35XDP.js → EZW67SHF.js} +2 -2
  17. package/dist/chunks/{QQUIM4VK.js → F7WQUODK.js} +2 -2
  18. package/dist/chunks/{OWLXCD3D.js → FQEGZTR3.js} +1 -1
  19. package/dist/chunks/{QFZ4GCJH.js → ICNSKNUT.js} +2 -2
  20. package/dist/chunks/{YCDAV3WO.js → JFVOERVR.js} +2 -2
  21. package/dist/chunks/{622BI7EV.js → KOX5W2ID.js} +1 -1
  22. package/dist/chunks/{LUUXXMXH.js → LQF6CVJR.js} +1 -1
  23. package/dist/chunks/{EJAGO6ZV.js → OA2EJLJ2.js} +2 -2
  24. package/dist/chunks/{IZWB7FGX.js → OE772CLE.js} +2 -2
  25. package/dist/chunks/{3OP3YJ63.js → OZM5TI3D.js} +4 -3
  26. package/dist/chunks/{EGWQ3EJE.js → P234HHKR.js} +2 -2
  27. package/dist/chunks/{PP7MW4OT.js → PM3BWYB5.js} +1 -1
  28. package/dist/chunks/TXOMPE5N.js +13 -0
  29. package/dist/chunks/{F4B6ELAN.js → XK7JQGKM.js} +2 -2
  30. package/dist/chunks/{7SGTDHXJ.js → Y4FKEIZV.js} +2 -2
  31. package/dist/chunks/{XU4G5W72.js → YGIYMCYC.js} +1 -1
  32. package/dist/cli.js +227 -227
  33. package/dist/cloud/index.js +2 -2
  34. package/dist/refuse/ai-sdk.js +1 -1
  35. package/dist/refuse/ai.js +1 -1
  36. package/dist/refuse/backend.js +1 -1
  37. package/dist/refuse/cloud.js +1 -1
  38. package/dist/refuse/server.js +1 -1
  39. package/dist/server/index.js +2 -2
  40. package/dist/server/testing.js +2 -2
  41. package/dist/web/index.js +2 -2
  42. package/dist/web/message.js +2 -2
  43. package/dist/web/palbe.js +2 -2
  44. package/dist/web/payments-ui.js +2 -2
  45. package/dist/web/paywall.js +2 -2
  46. package/dist/web/push-sw.js +1 -1
  47. package/dist/web/ssr.js +2 -2
  48. package/dist/web/vite.js +2 -2
  49. package/package.json +2 -2
  50. package/types/ai/src/ai.d.ts +22 -0
  51. package/types/ai/src/chats.d.ts +65 -15
  52. package/types/ai/src/index.d.ts +4 -1
  53. package/types/ai/src/templates.d.ts +76 -0
  54. package/types/ai/src/workflows.d.ts +201 -0
  55. package/types/cloud/src/generated/project.d.ts +2 -2
  56. package/types/internal/src/modules/ai.d.ts +2242 -674
  57. package/types/internal/src/modules/calls.d.ts +297 -0
  58. package/types/internal/src/modules/events.d.ts +2 -2
  59. package/types/web/src/client.d.ts +3 -0
  60. package/types/web/src/index.d.ts +1 -0
  61. package/types/web/src/templates.d.ts +75 -0
  62. package/types/web/src/voice.d.ts +4 -1
  63. package/dist/chunks/5ZXXBM6L.js +0 -18
  64. package/dist/chunks/65QZXK2S.js +0 -2
  65. package/dist/chunks/MVY4K43S.js +0 -13
@@ -133,6 +133,14 @@ export type AgentDefinition = {
133
133
  * Its tools (64 at most, with its MCP servers').
134
134
  */
135
135
  tools?: ToolRef[];
136
+ /**
137
+ * Opt-in flag exposing this published agent on /.well-known/agent.json and POST /ai/a2a.
138
+ */
139
+ expose_a2a?: boolean;
140
+ /**
141
+ * Memory namespace prefixes the agent is permitted to read and write.
142
+ */
143
+ memory_scopes?: string[];
136
144
  };
137
145
  /**
138
146
  * An agent described: what it is for, who it talks to, what it may do.
@@ -824,6 +832,20 @@ export type Endpoint = {
824
832
  * The endpoint — an MCP server or an HTTPS tool — is the project's own, reading or writing a chat's workspace: each call tells it the tree it is made at (an MCP server in its _meta palbase/workspace, an HTTPS tool in its context.workspace: the chat's id and the tree), and the tree its answer names is waited for. False: it is told nothing of the chat's workspace (an HTTPS tool is told the turn's chat_id as ever). The project's backend's tools are told the workspace always.
825
833
  */
826
834
  workspace: boolean;
835
+ /**
836
+ * MCP authentication mode.
837
+ */
838
+ auth_mode?: "project" | "user_oauth" | "user_token";
839
+ /**
840
+ * OAuth 2.1 PKCE metadata when auth_mode is oauth2_pkce.
841
+ */
842
+ oauth_config?: {
843
+ [key: string]: unknown;
844
+ };
845
+ /**
846
+ * MCP tool discovery mode.
847
+ */
848
+ discovery?: "auto" | "eager" | "lazy";
827
849
  };
828
850
  /**
829
851
  * The project's endpoints.
@@ -864,6 +886,24 @@ export type EndpointRequest = {
864
886
  * True for an endpoint of the project's own — an MCP server or an HTTPS tool — that reads or writes a chat's workspace: each call tells it the tree it is made at (an MCP server in its _meta palbase/workspace, an HTTPS tool in its context.workspace: the chat's id, manifest_id and seq), and the tree its answer names (an MCP result's _meta palbase/workspace_tree, an HTTPS answer's workspace_tree) is waited for. False (the default, which every endpoint put before an HTTPS tool took the setting has): any server's address — a third party's API or MCP server — told nothing of the chat's workspace, a tree it answers ignored. The project's backend's tools are told the workspace always.
865
887
  */
866
888
  workspace?: boolean;
889
+ /**
890
+ * MCP authentication mode.
891
+ */
892
+ auth_mode?: "project" | "user_oauth" | "user_token";
893
+ /**
894
+ * OAuth 2.1 PKCE configuration when auth_mode is oauth2_pkce.
895
+ */
896
+ oauth_config?: {
897
+ [key: string]: unknown;
898
+ };
899
+ /**
900
+ * MCP tool discovery mode (auto activates lazy search above 32 tools).
901
+ */
902
+ discovery?: "auto" | "eager" | "lazy";
903
+ /**
904
+ * Static Authorization header value sealed at rest when auth_mode is static_header.
905
+ */
906
+ auth_header?: string;
867
907
  };
868
908
  /**
869
909
  * A host the secret may go to: the owner's Allow.
@@ -2576,6 +2616,14 @@ export type Settings = {
2576
2616
  * Automatically attach a live Realtime pipe (chat:<chat_id>) when creating a new chat (default true).
2577
2617
  */
2578
2618
  auto_pipe_chats?: boolean;
2619
+ /**
2620
+ * Browser origins permitted to invoke direct client AI templates under origin_and_session.
2621
+ */
2622
+ allowed_web_origins?: string[];
2623
+ /**
2624
+ * Whether a development debug attestation secret is stored for this project.
2625
+ */
2626
+ debug_attest_configured?: boolean;
2579
2627
  };
2580
2628
  /**
2581
2629
  * A change of what the project allows its chats; a field left out is left as it is.
@@ -2609,6 +2657,14 @@ export type SettingsRequest = {
2609
2657
  * Default automatic Realtime piping on new chats (default true).
2610
2658
  */
2611
2659
  auto_pipe_chats?: boolean;
2660
+ /**
2661
+ * Browser origins permitted to invoke direct client AI templates.
2662
+ */
2663
+ allowed_web_origins?: string[];
2664
+ /**
2665
+ * Development-only debug attestation secret (never honored in production; empty string clears).
2666
+ */
2667
+ debug_attest_token?: string;
2612
2668
  };
2613
2669
  export type SpeechRequest = {
2614
2670
  model?: string;
@@ -3223,13 +3279,30 @@ export type VoiceCommand = {
3223
3279
  */
3224
3280
  interrupt?: boolean;
3225
3281
  /**
3226
- * What it is given (16 KiB at most).
3282
+ * What it is given (16 KiB at most; required for speak, tell, know and instruct; omitted for activate and deactivate).
3227
3283
  */
3228
- text: string;
3284
+ text?: string;
3229
3285
  /**
3230
- * speak (say this exactly and nothing else, once what the voice is saying ends; speaks in the order they came), tell (say it in your own words), know (keep it in mind) or instruct (behave so).
3286
+ * speak (say this exactly and nothing else, once what the voice is saying ends; speaks in the order they came), tell (say it in your own words), know (keep it in mind), instruct (behave so), activate (open the live voice gate for a call-transport voice), or deactivate (return the call-transport live gate to sleep).
3231
3287
  */
3232
- type: "speak" | "tell" | "know" | "instruct";
3288
+ type: "speak" | "tell" | "know" | "instruct" | "activate" | "deactivate";
3289
+ };
3290
+ /**
3291
+ * Controls when a call-transport voice opens its live model connection.
3292
+ */
3293
+ export type VoiceActivation = {
3294
+ /**
3295
+ * Seconds of silence before returning a manual-mode voice gate to sleep (default 15).
3296
+ */
3297
+ idle_close_seconds?: number;
3298
+ /**
3299
+ * open (always connected to the live voice model) or manual (sleeping at zero live-LLM cost until activated explicitly or woken by wake_phrases).
3300
+ */
3301
+ mode?: "open" | "manual";
3302
+ /**
3303
+ * Case-insensitive phrases that open a manual-mode voice gate when heard in the call's transcript.
3304
+ */
3305
+ wake_phrases?: string[];
3233
3306
  };
3234
3307
  /**
3235
3308
  * What a person asked for out loud of a voice of delegation events: for the project's backend to have done, and answer with the voice's speak, naming the delegation.
@@ -3339,9 +3412,10 @@ export type VoiceRequest = {
3339
3412
  */
3340
3413
  instructions?: string;
3341
3414
  /**
3342
- * The app's WebRTC offer (an SDP).
3415
+ * Live voice model (e.g. openai/gpt-live-1, openai/gpt-realtime, openai/gpt-realtime-mini, google/gemini-live-2.5).
3343
3416
  */
3344
- sdp: string;
3417
+ model?: string;
3418
+ transport: VoiceTransportRequest;
3345
3419
  /**
3346
3420
  * The voice (the provider's default unless said).
3347
3421
  */
@@ -3356,7 +3430,7 @@ export type VoiceSession = {
3356
3430
  */
3357
3431
  chat_id: string;
3358
3432
  /**
3359
- * Why it ended: close_requested, member_removed, chat_deleted, replaced (its member started another), lost (the engine no longer holds it), ai_limit_reached (its project's free AI, monthly AI budget or what its payment account may still owe is spent, and it ran on Palbase's models), or the provider's word.
3433
+ * Why it ended: close_requested, member_removed, chat_deleted, replaced (its member started another), lost (the engine no longer holds it), ai_limit_reached (its project's free AI, monthly AI budget or what its payment account may still owe is spent, and it ran on Palbase's models), call_ended (its bound Palbase call ended), or the provider's word.
3360
3434
  */
3361
3435
  close_reason?: string;
3362
3436
  /**
@@ -3372,9 +3446,9 @@ export type VoiceSession = {
3372
3446
  */
3373
3447
  id: string;
3374
3448
  /**
3375
- * The provider's WebRTC answer, for the app's peer connection (on start).
3449
+ * The resolved live voice model.
3376
3450
  */
3377
- sdp?: string;
3451
+ model?: string;
3378
3452
  /**
3379
3453
  * How long it has lasted.
3380
3454
  */
@@ -3387,11 +3461,76 @@ export type VoiceSession = {
3387
3461
  * active, or closed.
3388
3462
  */
3389
3463
  status: string;
3464
+ transport: VoiceTransportView;
3390
3465
  /**
3391
3466
  * The member it is (null: the server's own).
3392
3467
  */
3393
3468
  user_id: string | null;
3394
3469
  };
3470
+ /**
3471
+ * Voice media transport: webrtc (browser SDP offer) or call (joining a Palbase Calls room).
3472
+ */
3473
+ export type VoiceTransportRequest = {
3474
+ activation?: VoiceActivation;
3475
+ /**
3476
+ * Palbase Calls room ID (required when type is call).
3477
+ */
3478
+ call_id?: string;
3479
+ /**
3480
+ * Participant identity inside the Palbase Calls room (when type is call).
3481
+ */
3482
+ identity?: string;
3483
+ /**
3484
+ * Display name inside the Palbase Calls room (when type is call).
3485
+ */
3486
+ name?: string;
3487
+ /**
3488
+ * The app's WebRTC offer SDP (required when type is webrtc).
3489
+ */
3490
+ sdp?: string;
3491
+ /**
3492
+ * Transport kind: webrtc or call.
3493
+ */
3494
+ type: "webrtc" | "call";
3495
+ };
3496
+ /**
3497
+ * Active voice session transport details.
3498
+ */
3499
+ export type VoiceTransportView = {
3500
+ activation?: VoiceActivation;
3501
+ /**
3502
+ * Bound Palbase Calls room ID (when type is call).
3503
+ */
3504
+ call_id?: string;
3505
+ /**
3506
+ * Whether the live voice model gate is currently open (when type is call).
3507
+ */
3508
+ gate_open?: boolean;
3509
+ /**
3510
+ * Bot participant identity in the call room (when type is call).
3511
+ */
3512
+ identity?: string;
3513
+ /**
3514
+ * Media server WebSocket URL (when type is call).
3515
+ */
3516
+ media_url?: string;
3517
+ /**
3518
+ * Bot participant display name (when type is call).
3519
+ */
3520
+ name?: string;
3521
+ /**
3522
+ * LiveKit room name (when type is call).
3523
+ */
3524
+ room?: string;
3525
+ /**
3526
+ * Provider WebRTC SDP answer (on start when type is webrtc).
3527
+ */
3528
+ sdp?: string;
3529
+ /**
3530
+ * Transport kind: webrtc or call.
3531
+ */
3532
+ type: "webrtc" | "call";
3533
+ };
3395
3534
  /**
3396
3535
  * The tree the tool's writes left the chat's workspace at, as a write of it answered them (PUT /ai/chats/{chat_id}/workspace/files): its manifest, its place in the workspace's history, either or both. A call that answered later names it as one answered at once does (workspace_tree): the agent's next command waits for the session's machine to have it. Left out: the tool wrote nothing there.
3397
3536
  */
@@ -3405,1187 +3544,2616 @@ export type WorkspaceTree = {
3405
3544
  */
3406
3545
  seq?: number;
3407
3546
  };
3408
- /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
3409
- export interface Events {
3547
+ export type Trigger = {
3548
+ id?: string;
3549
+ name?: string;
3550
+ kind?: "cron" | "event" | "webhook";
3551
+ enabled?: boolean;
3552
+ source_config?: TriggerSourceConfig;
3553
+ target_config?: TriggerTargetConfig;
3554
+ dedupe_key_expr?: string;
3555
+ max_runs_hour?: number;
3556
+ webhook_url?: string;
3557
+ last_fired_at?: string;
3558
+ last_error?: string;
3559
+ created_at?: string;
3560
+ updated_at?: string;
3561
+ };
3562
+ export type TriggerCreateRequest = {
3563
+ name: string;
3564
+ kind: "cron" | "event" | "webhook";
3565
+ enabled?: boolean;
3566
+ source_config?: TriggerSourceConfig;
3567
+ target_config: TriggerTargetConfig;
3568
+ dedupe_key_expr?: string;
3569
+ max_runs_hour?: number;
3570
+ };
3571
+ export type TriggerPatchRequest = {
3572
+ enabled?: boolean;
3573
+ source_config?: TriggerSourceConfig;
3574
+ target_config?: TriggerTargetConfig;
3575
+ dedupe_key_expr?: string;
3576
+ max_runs_hour?: number;
3577
+ };
3578
+ export type TriggerListResponse = {
3579
+ triggers?: Trigger[];
3580
+ };
3581
+ export type TriggerTestRequest = {
3582
+ payload?: {
3583
+ [key: string]: unknown;
3584
+ };
3585
+ execute?: boolean;
3586
+ };
3587
+ export type TriggerTestResponse = {
3588
+ trigger_id?: string;
3589
+ run_id?: string;
3590
+ target_run_id?: string;
3591
+ dedupe_key?: string;
3592
+ status?: string;
3593
+ matched?: boolean;
3594
+ prompt?: string;
3595
+ error?: string;
3596
+ };
3597
+ /**
3598
+ * Arbitrary JSON payload signed with Palbase-Signature (t=<unix>,v1=<hmac_sha256>).
3599
+ */
3600
+ export type TriggerWebhookPayload = {
3601
+ [key: string]: unknown;
3602
+ };
3603
+ export type TriggerWebhookResponse = {
3604
+ trigger_id?: string;
3605
+ run_id?: string;
3606
+ target_run_id?: string;
3607
+ dedupe_key?: string;
3608
+ status?: string;
3609
+ matched?: boolean;
3610
+ prompt?: string;
3611
+ error?: string;
3612
+ };
3613
+ export type Wait = {
3614
+ id?: string;
3615
+ owner_kind?: string;
3616
+ owner_id?: string;
3617
+ wait_kind?: "event" | "approval" | "until" | "child_run" | "mcp_auth";
3618
+ status?: "waiting" | "resumed" | "timed_out" | "canceled";
3619
+ match_topic?: string;
3620
+ match_filter?: {
3621
+ [key: string]: unknown;
3622
+ };
3623
+ approval_id?: string;
3624
+ tool_call_id?: string;
3625
+ resume_target?: {
3626
+ [key: string]: unknown;
3627
+ };
3628
+ resume_payload?: {
3629
+ [key: string]: unknown;
3630
+ };
3631
+ expires_at?: string;
3632
+ resumed_at?: string;
3633
+ created_at?: string;
3634
+ };
3635
+ export type WaitListResponse = {
3636
+ waits?: Wait[];
3637
+ };
3638
+ export type WaitSignalRequest = {
3639
+ payload?: {
3640
+ [key: string]: unknown;
3641
+ };
3642
+ };
3643
+ export type WorkflowStep = {
3644
+ run_id?: string;
3645
+ step_key?: string;
3646
+ step_index?: number;
3647
+ kind?: string;
3648
+ status?: string;
3649
+ input?: {
3650
+ [key: string]: unknown;
3651
+ };
3652
+ output?: {
3653
+ [key: string]: unknown;
3654
+ };
3655
+ error?: string;
3656
+ attempt?: number;
3657
+ started_at?: string;
3658
+ completed_at?: string;
3659
+ replayed?: boolean;
3660
+ wait_id?: string;
3661
+ };
3662
+ export type WorkflowRun = {
3663
+ id?: string;
3664
+ root_run_id?: string;
3665
+ parent_run_id?: string;
3666
+ depth?: number;
3667
+ workflow_name?: string;
3668
+ status?: "running" | "waiting" | "completed" | "failed" | "canceled";
3669
+ input?: {
3670
+ [key: string]: unknown;
3671
+ };
3672
+ output?: {
3673
+ [key: string]: unknown;
3674
+ };
3675
+ error?: string;
3676
+ metadata?: {
3677
+ [key: string]: unknown;
3678
+ };
3679
+ budget?: RootBudget;
3680
+ steps?: WorkflowStep[];
3681
+ started_at?: string;
3682
+ updated_at?: string;
3683
+ completed_at?: string;
3684
+ };
3685
+ export type WorkflowRunCreateRequest = {
3686
+ workflow_name: string;
3687
+ root_run_id?: string;
3688
+ parent_run_id?: string;
3689
+ depth?: number;
3690
+ input?: {
3691
+ [key: string]: unknown;
3692
+ };
3693
+ metadata?: {
3694
+ [key: string]: unknown;
3695
+ };
3696
+ root_budget_usd?: number;
3697
+ max_depth?: number;
3698
+ max_concurrent_children?: number;
3699
+ max_total_steps?: number;
3700
+ };
3701
+ export type WorkflowRunListResponse = {
3702
+ runs?: WorkflowRun[];
3703
+ };
3704
+ export type WorkflowStepRequest = {
3705
+ kind?: "do" | "agent" | "sleep" | "wait_event" | "wait_approval" | "child" | "parallel";
3706
+ status?: string;
3707
+ input?: {
3708
+ [key: string]: unknown;
3709
+ };
3710
+ output?: {
3711
+ [key: string]: unknown;
3712
+ };
3713
+ error?: string;
3714
+ sleep_seconds?: number;
3715
+ timeout_seconds?: number;
3716
+ match_topic?: string;
3717
+ match_filter?: {
3718
+ [key: string]: unknown;
3719
+ };
3720
+ approval_id?: string;
3721
+ };
3722
+ export type WorkflowStepResponse = {
3723
+ run_id?: string;
3724
+ step_key?: string;
3725
+ step_index?: number;
3726
+ kind?: string;
3727
+ status?: string;
3728
+ input?: {
3729
+ [key: string]: unknown;
3730
+ };
3731
+ output?: {
3732
+ [key: string]: unknown;
3733
+ };
3734
+ error?: string;
3735
+ attempt?: number;
3736
+ started_at?: string;
3737
+ completed_at?: string;
3738
+ replayed?: boolean;
3739
+ wait_id?: string;
3740
+ };
3741
+ export type WorkflowCompleteRequest = {
3742
+ status?: "completed" | "failed" | "canceled";
3743
+ output?: {
3744
+ [key: string]: unknown;
3745
+ };
3746
+ error?: string;
3747
+ };
3748
+ export type WorkflowReplayRequest = {
3749
+ from_step?: string;
3750
+ };
3751
+ export type StopTreeResponse = {
3752
+ root_run_id?: string;
3753
+ stopped?: boolean;
3754
+ canceled_workflows?: number;
3755
+ canceled_waits?: number;
3756
+ closed_permits?: number;
3757
+ canceled_responses?: number;
3758
+ };
3759
+ export type MemoryRecord = {
3760
+ id?: string;
3761
+ namespace?: string;
3762
+ key?: string;
3763
+ content?: string;
3764
+ metadata?: {
3765
+ [key: string]: unknown;
3766
+ };
3767
+ score?: number;
3768
+ expires_at?: string;
3769
+ created_at?: string;
3770
+ updated_at?: string;
3771
+ };
3772
+ export type MemoryPutRequest = {
3773
+ content: string;
3774
+ metadata?: {
3775
+ [key: string]: unknown;
3776
+ };
3777
+ embedding?: number[];
3778
+ embedding_model?: string;
3779
+ ttl_seconds?: number;
3780
+ };
3781
+ export type MemorySearchRequest = {
3782
+ query?: string;
3783
+ namespaces?: string[];
3784
+ metadata_filter?: {
3785
+ [key: string]: unknown;
3786
+ };
3787
+ query_embedding?: number[];
3788
+ limit?: number;
3789
+ };
3790
+ export type MemorySearchResponse = {
3791
+ results?: MemoryRecord[];
3792
+ };
3793
+ export type ActorGroupMembersResponse = {
3794
+ group_id?: string;
3795
+ members?: string[];
3796
+ };
3797
+ export type ActorGroupMemberRequest = {
3798
+ chat_id: string;
3799
+ role?: string;
3800
+ };
3801
+ export type ActorGroupBroadcastRequest = {
3802
+ sender_chat_id?: string;
3803
+ text: string;
3804
+ metadata?: {
3805
+ [key: string]: unknown;
3806
+ };
3807
+ deliver?: boolean;
3808
+ };
3809
+ export type ActorGroupBroadcastResponse = {
3810
+ group_id?: string;
3811
+ delivered_chats?: string[];
3812
+ };
3813
+ export type A2AAgentCard = {
3814
+ name?: string;
3815
+ protocol_version?: string;
3816
+ url?: string;
3817
+ capabilities?: {
3818
+ [key: string]: unknown;
3819
+ };
3820
+ authentication?: {
3821
+ [key: string]: unknown;
3822
+ };
3823
+ skills?: ({
3824
+ [key: string]: unknown;
3825
+ })[];
3826
+ [key: string]: unknown;
3827
+ };
3828
+ export type A2ARPCRequest = {
3829
+ jsonrpc?: string;
3830
+ id?: string;
3831
+ method: string;
3832
+ params?: {
3833
+ [key: string]: unknown;
3834
+ };
3835
+ [key: string]: unknown;
3836
+ };
3837
+ export type A2ARPCResponse = {
3838
+ jsonrpc?: string;
3839
+ id?: string;
3840
+ result?: {
3841
+ [key: string]: unknown;
3842
+ };
3843
+ error?: {
3844
+ [key: string]: unknown;
3845
+ };
3846
+ [key: string]: unknown;
3847
+ };
3848
+ export type MCPUserCredentialRequest = {
3849
+ access_token: string;
3850
+ refresh_token?: string;
3851
+ token_type?: string;
3852
+ expires_in_seconds?: number;
3853
+ scopes?: string[];
3854
+ };
3855
+ export type MCPUserCredentialResponse = {
3856
+ endpoint?: string;
3857
+ user_id?: string;
3858
+ stored?: boolean;
3859
+ expires_at?: string;
3860
+ };
3861
+ export type MCPOAuthStartResponse = {
3862
+ authorize_url?: string;
3863
+ state?: string;
3864
+ expires_at?: string;
3865
+ };
3866
+ export type MCPOAuthCallbackResponse = {
3867
+ connected?: boolean;
3868
+ endpoint?: string;
3869
+ user_id?: string;
3870
+ };
3871
+ export type TriggerEvent = {
3872
+ trigger_id?: string;
3873
+ trigger_run_id?: string;
3874
+ kind?: string;
3875
+ target_kind?: string;
3876
+ chat_id?: string;
3877
+ response_id?: string;
3878
+ workflow_run_id?: string;
3879
+ };
3880
+ export type WaitEvent = {
3881
+ wait_id?: string;
3882
+ owner_kind?: string;
3883
+ owner_id?: string;
3884
+ wait_kind?: string;
3885
+ status?: string;
3886
+ match_topic?: string;
3887
+ };
3888
+ export type WorkflowEvent = {
3889
+ workflow_run_id?: string;
3890
+ workflow_name?: string;
3891
+ root_run_id?: string;
3892
+ status?: string;
3893
+ error?: string;
3894
+ };
3895
+ export type MCPAuthEvent = {
3896
+ endpoint?: string;
3897
+ user_id?: string;
3898
+ wait_id?: string;
3899
+ authorize_url?: string;
3900
+ };
3901
+ export type TriggerSourceConfig = {
3902
+ schedule?: string;
3903
+ timezone?: string;
3904
+ topic?: string;
3905
+ filter?: {
3906
+ [key: string]: unknown;
3907
+ };
3908
+ signature_header?: string;
3909
+ timestamp_header?: string;
3910
+ max_skew_seconds?: number;
3911
+ };
3912
+ export type TriggerTargetConfig = {
3913
+ kind: "workflow" | "chat";
3914
+ workflow_name?: string;
3915
+ agent?: string;
3916
+ chat_id?: string;
3917
+ prompt_template?: string;
3918
+ model?: string;
3919
+ workspace_id?: string;
3920
+ environment?: string;
3921
+ metadata?: {
3922
+ [key: string]: string;
3923
+ };
3924
+ };
3925
+ export type RootBudget = {
3926
+ root_run_id?: string;
3927
+ budget_usd?: number;
3928
+ spent_usd?: number;
3929
+ max_depth?: number;
3930
+ max_concurrent_children?: number;
3931
+ max_total_steps?: number;
3932
+ total_steps?: number;
3933
+ stopped_at?: string;
3934
+ };
3935
+ export type WorkflowReplayResponse = {
3936
+ run?: WorkflowRun;
3937
+ cleared_steps?: number;
3938
+ };
3939
+ export type TriggerCreated = {
3940
+ id?: string;
3941
+ name?: string;
3942
+ kind?: "cron" | "event" | "webhook";
3943
+ enabled?: boolean;
3944
+ source_config?: TriggerSourceConfig;
3945
+ target_config?: TriggerTargetConfig;
3946
+ dedupe_key_expr?: string;
3947
+ max_runs_hour?: number;
3948
+ webhook_url?: string;
3949
+ webhook_secret?: string;
3950
+ last_fired_at?: string;
3951
+ last_error?: string;
3952
+ created_at?: string;
3953
+ updated_at?: string;
3954
+ };
3955
+ /**
3956
+ * Mandatory client attestation policy per platform.
3957
+ */
3958
+ export type TemplatePolicyAttestation = {
3410
3959
  /**
3411
- * ai.goal.updated: a chat's goal was set, its status changed (paused, resumed, blocked, out of budget or turns, achieved), or it was cleared.
3960
+ * iOS attestation enforcement mode.
3412
3961
  */
3413
- "ai.goal.updated": GoalEvent;
3962
+ ios?: "app_attest" | "none";
3414
3963
  /**
3415
- * ai.response.completed: a response started with background: true completed — read its answer by its id — or a chat's turn completed.
3964
+ * Android attestation enforcement mode.
3416
3965
  */
3417
- "ai.response.completed": ResponseEvent;
3966
+ android?: "play_integrity" | "key_attestation" | "none";
3418
3967
  /**
3419
- * ai.response.failed: a response started with background: true ended without completing (failed, canceled, timed out, over its budget), or a chat's turn did (failed, stopped, budget_exceeded).
3968
+ * Web attestation enforcement mode.
3420
3969
  */
3421
- "ai.response.failed": ResponseEvent;
3970
+ web?: "origin_and_session" | "none";
3971
+ };
3972
+ /**
3973
+ * Per-user spend and rate caps enforced atomically before template execution.
3974
+ */
3975
+ export type TemplatePerUserLimits = {
3422
3976
  /**
3423
- * ai.response.started: a chat's turn began — a member's message, the server's, the chat's goal, or the late messages of the turn before opened it.
3977
+ * Maximum daily spend per user in USD.
3424
3978
  */
3425
- "ai.response.started": ResponseEvent;
3979
+ max_usd_day?: number;
3426
3980
  /**
3427
- * ai.voice.closed: a chat's voice ended — closed, replaced, its member taken out, its chat deleted, lost — with how long it lasted.
3981
+ * Maximum monthly spend per user in USD.
3428
3982
  */
3429
- "ai.voice.closed": VoiceEvent;
3983
+ max_usd_month?: number;
3430
3984
  /**
3431
- * ai.voice.delegated: a person asked a voice of delegation events for something out loud; the backend answers with the voice's speak, naming the delegation.
3985
+ * Maximum requests per minute per user.
3432
3986
  */
3433
- "ai.voice.delegated": VoiceDelegatedEvent;
3987
+ rpm?: number;
3434
3988
  /**
3435
- * ai.voice.started: a chat's voice began.
3989
+ * Maximum media generations per day per user.
3436
3990
  */
3437
- "ai.voice.started": VoiceEvent;
3991
+ max_media_day?: number;
3992
+ };
3993
+ /**
3994
+ * Authentication, device attestation, and per-user budget guardrails for a template.
3995
+ */
3996
+ export type TemplateClientPolicy = {
3438
3997
  /**
3439
- * ai.secret_host_requested: an agent sent a sealed secret to a host it is not allowed for — the placeholder went as it is, and the owners are asked to allow or dismiss it. Told to the project and to Palbase's own (whose Studio emails the organization's owners), at most once a day a secret and host, and at most 10 a project a day.
3998
+ * Require a signed-in user session (default true).
3440
3999
  */
3441
- "ai.secret_host_requested": SecretHostRequested;
3442
- }
3443
- /** Palbase ai */
3444
- export declare function client(t: Transport): {
4000
+ require_auth?: boolean;
3445
4001
  /**
3446
- * Write an agent from a description
3447
- *
3448
- * A definition written from a description: instructions, a model, the project's own tools that fit (named by their name: the agent follows the code), subagents and an output shape where the description calls for them. Nothing is kept: put it (PUT /ai/agents/{name}) to have it. It is a person's (a developer's session or token: 403 person_required for the secret key), the platform pays for it, and it is bounded (429 too_many_drafts): 20 an hour by a person in a project, 60 by its people, 40 by a person across their projects — and the platform's day (429 drafts_paused).
4002
+ * Allow anonymous/guest sessions.
3449
4003
  */
3450
- draftAgent(input: {
3451
- body: AgentDraftRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3452
- signal?: AbortSignal;
3453
- }): Promise<Reply<200, AgentSuggestion>>;
4004
+ allow_anonymous_auth?: boolean;
4005
+ attestation?: TemplatePolicyAttestation;
3454
4006
  /**
3455
- * The project's agents
3456
- *
3457
- * The agents the project keeps and its backend's — each one the build its machine serves defines (its contract's x-palbase-agents) — by name. A name the project keeps is that agent's, whatever a build declares.
4007
+ * Template-specific allowed browser origins.
3458
4008
  */
3459
- listAgents(input?: {
3460
- signal?: AbortSignal;
3461
- }): Promise<Reply<200, AgentList>>;
4009
+ allowed_web_origins?: string[];
3462
4010
  /**
3463
- * An agent
3464
- *
3465
- * One the project keeps: its draft, the version published and its revision. One its backend defines: its machine, and what its last turn was defined as.
4011
+ * Android package name verified against Play Integrity.
4012
+ */
4013
+ android_package_name?: string;
4014
+ per_user_limits?: TemplatePerUserLimits;
4015
+ };
4016
+ /**
4017
+ * Server-locked input/output limits enforced on every template invocation.
4018
+ */
4019
+ export type TemplateGenerationLimits = {
4020
+ /**
4021
+ * Maximum output tokens.
4022
+ */
4023
+ max_output_tokens?: number;
4024
+ /**
4025
+ * Maximum rendered prompt length in characters.
4026
+ */
4027
+ max_input_chars?: number;
4028
+ /**
4029
+ * Maximum attachments per request.
4030
+ */
4031
+ max_attachments?: number;
4032
+ /**
4033
+ * Allowed attachment MIME types.
4034
+ */
4035
+ allowed_mime?: string[];
4036
+ /**
4037
+ * Optional locked sampling temperature.
4038
+ */
4039
+ temperature?: number | null;
4040
+ /**
4041
+ * Locked voice name for tts or voice_live templates.
4042
+ */
4043
+ voice?: string;
4044
+ };
4045
+ /**
4046
+ * Immutable version of a server-locked AI template.
4047
+ */
4048
+ export type TemplateVersionSpec = {
4049
+ /**
4050
+ * Monotonic template version number.
4051
+ */
4052
+ version: number;
4053
+ /**
4054
+ * Template modality.
4055
+ */
4056
+ modality: "text" | "image" | "video" | "stt" | "tts" | "voice_live";
4057
+ /**
4058
+ * Server-locked catalog model identifier.
4059
+ */
4060
+ model: string;
4061
+ /**
4062
+ * Ordered fallback catalog models.
4063
+ */
4064
+ fallback_models?: string[];
4065
+ /**
4066
+ * Server-locked system instructions.
4067
+ */
4068
+ system_instructions?: string;
4069
+ /**
4070
+ * Prompt template containing {{variable}} placeholders.
4071
+ */
4072
+ prompt_template?: string;
4073
+ /**
4074
+ * JSON Schema validating client-supplied variables.
4075
+ */
4076
+ variables_schema?: {
4077
+ [key: string]: unknown;
4078
+ };
4079
+ /**
4080
+ * Optional structured output JSON Schema.
4081
+ */
4082
+ response_schema?: ({
4083
+ [key: string]: unknown;
4084
+ }) | null;
4085
+ generation_limits: TemplateGenerationLimits;
4086
+ client_policy: TemplateClientPolicy;
4087
+ /**
4088
+ * Creation timestamp.
4089
+ */
4090
+ created_at: string;
4091
+ };
4092
+ /**
4093
+ * Server-locked AI template with draft and published versions.
4094
+ */
4095
+ export type TemplateView = {
4096
+ /**
4097
+ * Template identifier.
4098
+ */
4099
+ id: string;
4100
+ /**
4101
+ * Template slug name.
4102
+ */
4103
+ name: string;
4104
+ /**
4105
+ * Currently published version number, or null if unpublished.
4106
+ */
4107
+ published_version?: number | null;
4108
+ /**
4109
+ * Latest draft version number.
4110
+ */
4111
+ draft_version: number;
4112
+ published?: TemplateVersionSpec;
4113
+ draft?: TemplateVersionSpec;
4114
+ /**
4115
+ * Creation timestamp.
4116
+ */
4117
+ created_at: string;
4118
+ /**
4119
+ * Last update timestamp.
4120
+ */
4121
+ updated_at: string;
4122
+ };
4123
+ /**
4124
+ * List of server-locked AI templates.
4125
+ */
4126
+ export type TemplateListResponse = {
4127
+ /**
4128
+ * Templates in this project.
4129
+ */
4130
+ templates: TemplateView[];
4131
+ };
4132
+ /**
4133
+ * Create or save a new draft version of an AI template.
4134
+ */
4135
+ export type TemplateUpsertRequest = {
4136
+ /**
4137
+ * Template modality (defaults to text).
4138
+ */
4139
+ modality?: "text" | "image" | "video" | "stt" | "tts" | "voice_live";
4140
+ /**
4141
+ * Catalog model identifier.
4142
+ */
4143
+ model: string;
4144
+ /**
4145
+ * Ordered fallback catalog models.
4146
+ */
4147
+ fallback_models?: string[];
4148
+ /**
4149
+ * System instructions locked on the server.
4150
+ */
4151
+ system_instructions?: string;
4152
+ /**
4153
+ * Prompt template with {{variable}} placeholders.
4154
+ */
4155
+ prompt_template?: string;
4156
+ /**
4157
+ * JSON Schema for allowed client variables.
4158
+ */
4159
+ variables_schema?: {
4160
+ [key: string]: unknown;
4161
+ };
4162
+ /**
4163
+ * Optional structured JSON output schema.
4164
+ */
4165
+ response_schema?: ({
4166
+ [key: string]: unknown;
4167
+ }) | null;
4168
+ generation_limits?: TemplateGenerationLimits;
4169
+ client_policy?: TemplateClientPolicy;
4170
+ /**
4171
+ * Publish this version immediately after saving.
4172
+ */
4173
+ publish?: boolean;
4174
+ };
4175
+ /**
4176
+ * Optional explicit template version to publish or roll back to.
4177
+ */
4178
+ export type TemplateVersionSelectRequest = {
4179
+ /**
4180
+ * Target version number.
4181
+ */
4182
+ version?: number;
4183
+ };
4184
+ /**
4185
+ * Immutable version history of a template.
4186
+ */
4187
+ export type TemplateVersionListResponse = {
4188
+ /**
4189
+ * Template name.
4190
+ */
4191
+ name: string;
4192
+ /**
4193
+ * Versions ordered newest first.
4194
+ */
4195
+ versions: TemplateVersionSpec[];
4196
+ };
4197
+ /**
4198
+ * Aggregated per-user AI template consumption for one period.
4199
+ */
4200
+ export type UserSpendRow = {
4201
+ /**
4202
+ * End-user identifier.
4203
+ */
4204
+ user_id: string;
4205
+ /**
4206
+ * Template name.
4207
+ */
4208
+ template_name: string;
4209
+ /**
4210
+ * Aggregation window kind.
4211
+ */
4212
+ period_kind: "day" | "month";
4213
+ /**
4214
+ * UTC date or month key (YYYY-MM-DD or YYYY-MM).
4215
+ */
4216
+ period_key: string;
4217
+ /**
4218
+ * Total spend in billionths of a USD.
4219
+ */
4220
+ spent_nano_usd: number;
4221
+ /**
4222
+ * Total spend in USD.
4223
+ */
4224
+ spent_usd: number;
4225
+ /**
4226
+ * Total requests recorded in this bucket.
4227
+ */
4228
+ request_count: number;
4229
+ /**
4230
+ * Total media requests recorded in this bucket.
4231
+ */
4232
+ media_count: number;
4233
+ /**
4234
+ * Last update timestamp.
4235
+ */
4236
+ updated_at: string;
4237
+ };
4238
+ /**
4239
+ * Per-user AI spend summary rows.
4240
+ */
4241
+ export type UserSpendListResponse = {
4242
+ /**
4243
+ * Aggregation window kind.
4244
+ */
4245
+ period_kind: "day" | "month";
4246
+ /**
4247
+ * UTC bucket key.
4248
+ */
4249
+ period_key: string;
4250
+ /**
4251
+ * User spend rows.
4252
+ */
4253
+ items: UserSpendRow[];
4254
+ };
4255
+ /**
4256
+ * Per-user direct AI budget override or block status.
4257
+ */
4258
+ export type UserQuota = {
4259
+ /**
4260
+ * End-user identifier.
4261
+ */
4262
+ user_id: string;
4263
+ /**
4264
+ * When true, all client template calls for this user are denied.
4265
+ */
4266
+ blocked: boolean;
4267
+ /**
4268
+ * Daily USD cap override.
4269
+ */
4270
+ max_usd_day?: number | null;
4271
+ /**
4272
+ * Monthly USD cap override.
4273
+ */
4274
+ max_usd_month?: number | null;
4275
+ /**
4276
+ * Requests-per-minute cap override.
4277
+ */
4278
+ max_rpm?: number | null;
4279
+ /**
4280
+ * Optional operator note.
4281
+ */
4282
+ note?: string;
4283
+ /**
4284
+ * Last update timestamp.
4285
+ */
4286
+ updated_at?: string;
4287
+ };
4288
+ /**
4289
+ * Set per-user direct AI quota override or block state.
4290
+ */
4291
+ export type UserQuotaRequest = {
4292
+ /**
4293
+ * Block or unblock this user.
4294
+ */
4295
+ blocked?: boolean;
4296
+ /**
4297
+ * Daily USD cap override.
4298
+ */
4299
+ max_usd_day?: number | null;
4300
+ /**
4301
+ * Monthly USD cap override.
4302
+ */
4303
+ max_usd_month?: number | null;
4304
+ /**
4305
+ * Requests-per-minute cap override.
4306
+ */
4307
+ max_rpm?: number | null;
4308
+ /**
4309
+ * Optional operator note.
4310
+ */
4311
+ note?: string;
4312
+ };
4313
+ /**
4314
+ * Request a fresh single-use device attestation challenge.
4315
+ */
4316
+ export type ClientAttestChallengeRequest = {
4317
+ /**
4318
+ * Client installation identifier when no user session is present.
4319
+ */
4320
+ installation_id?: string;
4321
+ };
4322
+ /**
4323
+ * Single-use attestation challenge minted by auth.
4324
+ */
4325
+ export type ClientAttestChallengeResponse = {
4326
+ /**
4327
+ * Opaque HMAC-signed challenge string for the next assertion.
4328
+ */
4329
+ challenge: string;
4330
+ };
4331
+ /**
4332
+ * Client invocation of a published server-locked template (variables only; model and instructions are server-locked).
4333
+ */
4334
+ export type ClientTemplateRunRequest = {
4335
+ /**
4336
+ * Template variables validated against variables_schema.
4337
+ */
4338
+ variables?: {
4339
+ [key: string]: unknown;
4340
+ };
4341
+ /**
4342
+ * Stream incremental tokens as SSE when true.
4343
+ */
4344
+ stream?: boolean;
4345
+ /**
4346
+ * Optional attachments bounded by template generation_limits.
4347
+ */
4348
+ attachments?: InputImage[];
4349
+ };
4350
+ /**
4351
+ * Token and cost accounting for one template execution.
4352
+ */
4353
+ export type ClientTemplateRunUsage = {
4354
+ /**
4355
+ * Input token count.
4356
+ */
4357
+ input_tokens: number;
4358
+ /**
4359
+ * Output token count.
4360
+ */
4361
+ output_tokens: number;
4362
+ /**
4363
+ * Cost in billionths of a USD.
4364
+ */
4365
+ cost_nano_usd: number;
4366
+ /**
4367
+ * Cost in USD.
4368
+ */
4369
+ usd: number;
4370
+ };
4371
+ /**
4372
+ * Non-streaming answer from a server-locked text template.
4373
+ */
4374
+ export type ClientTemplateRunResponse = {
4375
+ /**
4376
+ * Template name.
4377
+ */
4378
+ template: string;
4379
+ /**
4380
+ * Published version executed.
4381
+ */
4382
+ version: number;
4383
+ /**
4384
+ * Catalog model that answered.
4385
+ */
4386
+ model: string;
4387
+ /**
4388
+ * Generated text answer.
4389
+ */
4390
+ text: string;
4391
+ usage: ClientTemplateRunUsage;
4392
+ };
4393
+ /**
4394
+ * Start a live WebRTC voice session locked to a published voice_live template.
4395
+ */
4396
+ export type ClientTemplateVoiceRequest = {
4397
+ /**
4398
+ * Template variables validated against variables_schema.
4399
+ */
4400
+ variables?: {
4401
+ [key: string]: unknown;
4402
+ };
4403
+ transport: VoiceTransportRequest;
4404
+ };
4405
+ /**
4406
+ * Active WebRTC voice session started from a published voice_live template.
4407
+ */
4408
+ export type ClientTemplateVoiceResponse = {
4409
+ /**
4410
+ * Voice session identifier.
4411
+ */
4412
+ id: string;
4413
+ /**
4414
+ * Template name.
4415
+ */
4416
+ template: string;
4417
+ /**
4418
+ * Published template version.
4419
+ */
4420
+ version: number;
4421
+ /**
4422
+ * Locked live voice model.
4423
+ */
4424
+ model: string;
4425
+ /**
4426
+ * Voice session status.
4427
+ */
4428
+ status: string;
4429
+ /**
4430
+ * Start timestamp.
4431
+ */
4432
+ started_at: string;
4433
+ transport: VoiceTransportView;
4434
+ };
4435
+ /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
4436
+ export interface Events {
4437
+ /**
4438
+ * ai.goal.updated: a chat's goal was set, its status changed (paused, resumed, blocked, out of budget or turns, achieved), or it was cleared.
4439
+ */
4440
+ "ai.goal.updated": GoalEvent;
4441
+ /**
4442
+ * ai.response.completed: a response started with background: true completed — read its answer by its id — or a chat's turn completed.
4443
+ */
4444
+ "ai.response.completed": ResponseEvent;
4445
+ /**
4446
+ * ai.response.failed: a response started with background: true ended without completing (failed, canceled, timed out, over its budget), or a chat's turn did (failed, stopped, budget_exceeded).
4447
+ */
4448
+ "ai.response.failed": ResponseEvent;
4449
+ /**
4450
+ * ai.response.started: a chat's turn began — a member's message, the server's, the chat's goal, or the late messages of the turn before opened it.
4451
+ */
4452
+ "ai.response.started": ResponseEvent;
4453
+ /**
4454
+ * ai.voice.closed: a chat's voice ended — closed, replaced, its member taken out, its chat deleted, lost — with how long it lasted.
4455
+ */
4456
+ "ai.voice.closed": VoiceEvent;
4457
+ /**
4458
+ * ai.voice.delegated: a person asked a voice of delegation events for something out loud; the backend answers with the voice's speak, naming the delegation.
4459
+ */
4460
+ "ai.voice.delegated": VoiceDelegatedEvent;
4461
+ /**
4462
+ * ai.voice.started: a chat's voice began.
4463
+ */
4464
+ "ai.voice.started": VoiceEvent;
4465
+ /**
4466
+ * ai.secret_host_requested: an agent sent a sealed secret to a host it is not allowed for — the placeholder went as it is, and the owners are asked to allow or dismiss it. Told to the project and to Palbase's own (whose Studio emails the organization's owners), at most once a day a secret and host, and at most 10 a project a day.
4467
+ */
4468
+ "ai.secret_host_requested": SecretHostRequested;
4469
+ /**
4470
+ * ai.trigger.fired: a declarative cron, event, or webhook trigger matched and launched its target chat, agent, or workflow run.
4471
+ */
4472
+ "ai.trigger.fired": TriggerEvent;
4473
+ /**
4474
+ * ai.wait.created: a run or workflow parked on a zero-compute durable wait for an event, schedule, approval, or external signal.
4475
+ */
4476
+ "ai.wait.created": WaitEvent;
4477
+ /**
4478
+ * ai.wait.resumed: a parked zero-compute wait received its matching event, approval, or signal and resumed execution.
4479
+ */
4480
+ "ai.wait.resumed": WaitEvent;
4481
+ /**
4482
+ * ai.wait.timed_out: a parked zero-compute wait reached its expiration deadline without receiving its expected signal.
4483
+ */
4484
+ "ai.wait.timed_out": WaitEvent;
4485
+ /**
4486
+ * ai.workflow.completed: a durable workflow run finished successfully with its final output.
4487
+ */
4488
+ "ai.workflow.completed": WorkflowEvent;
4489
+ /**
4490
+ * ai.workflow.failed: a durable workflow run ended with a failure or cancellation.
4491
+ */
4492
+ "ai.workflow.failed": WorkflowEvent;
4493
+ /**
4494
+ * ai.mcp.auth_required: an MCP tool call requires per-user OAuth authorization; the run is parked at zero compute until authorized.
4495
+ */
4496
+ "ai.mcp.auth_required": MCPAuthEvent;
4497
+ /**
4498
+ * ai.mcp.auth_completed: a user completed per-user MCP credential authorization and any waiting runs were signaled to resume.
4499
+ */
4500
+ "ai.mcp.auth_completed": MCPAuthEvent;
4501
+ }
4502
+ /** Palbase ai */
4503
+ export declare function client(t: Transport): {
4504
+ /**
4505
+ * Write an agent from a description
4506
+ *
4507
+ * A definition written from a description: instructions, a model, the project's own tools that fit (named by their name: the agent follows the code), subagents and an output shape where the description calls for them. Nothing is kept: put it (PUT /ai/agents/{name}) to have it. It is a person's (a developer's session or token: 403 person_required for the secret key), the platform pays for it, and it is bounded (429 too_many_drafts): 20 an hour by a person in a project, 60 by its people, 40 by a person across their projects — and the platform's day (429 drafts_paused).
4508
+ */
4509
+ draftAgent(input: {
4510
+ body: AgentDraftRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4511
+ signal?: AbortSignal;
4512
+ }): Promise<Reply<200, AgentSuggestion>>;
4513
+ /**
4514
+ * The project's agents
4515
+ *
4516
+ * The agents the project keeps and its backend's — each one the build its machine serves defines (its contract's x-palbase-agents) — by name. A name the project keeps is that agent's, whatever a build declares.
4517
+ */
4518
+ listAgents(input?: {
4519
+ signal?: AbortSignal;
4520
+ }): Promise<Reply<200, AgentList>>;
4521
+ /**
4522
+ * An agent
4523
+ *
4524
+ * One the project keeps: its draft, the version published and its revision. One its backend defines: its machine, and what its last turn was defined as.
3466
4525
  */
3467
4526
  getAgent(input: {
3468
4527
  path: {
3469
- name: string;
4528
+ name: string;
4529
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4530
+ signal?: AbortSignal;
4531
+ }): Promise<Reply<200, Agent>>;
4532
+ /**
4533
+ * Save an agent's draft
4534
+ *
4535
+ * Saves the draft of an agent the project keeps — a new one's first. What its chats talk to changes only once the draft is published. revision names the draft the change was made to: when another was saved since, it is refused (409 draft_changed) and nothing is lost; left out, the last save wins. A name its backend's build defines is refused (409 agent_defined_in_code): that agent is changed in the code.
4536
+ */
4537
+ putAgent(input: {
4538
+ path: {
4539
+ name: string;
4540
+ };
4541
+ query?: {
4542
+ revision?: number;
4543
+ };
4544
+ body: AgentDefinition; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4545
+ signal?: AbortSignal;
4546
+ }): Promise<Reply<200, Agent>>;
4547
+ /**
4548
+ * Forget an agent
4549
+ *
4550
+ * An agent the project keeps, its versions with it — an agent made again under its name numbers its versions after them, and a chat on one of them is told it is gone. Its chats stay; a message to one of them is refused (agent_not_found) until an agent of that name is there again. One its backend's build declares goes with the code (409 agent_defined_in_code).
4551
+ */
4552
+ deleteAgent(input: {
4553
+ path: {
4554
+ name: string;
4555
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4556
+ signal?: AbortSignal;
4557
+ }): Promise<Reply<204, undefined>>;
4558
+ /**
4559
+ * Publish an agent's draft
4560
+ *
4561
+ * Makes the draft a version, the next number, and the one its chats talk to from their next turn on. A draft that is the version published is refused (409 nothing_to_publish); an agent keeps 1000 versions (409 too_many_versions).
4562
+ */
4563
+ publishAgent(input: {
4564
+ path: {
4565
+ name: string;
4566
+ };
4567
+ body: AgentPublish; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4568
+ signal?: AbortSignal;
4569
+ }): Promise<Reply<200, Agent>>;
4570
+ /**
4571
+ * Go back to a version
4572
+ *
4573
+ * Makes a version it had the one its chats talk to, and its draft that version: a change of the draft not published is dropped.
4574
+ */
4575
+ rollbackAgent(input: {
4576
+ path: {
4577
+ name: string;
4578
+ };
4579
+ body: AgentRollback; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4580
+ signal?: AbortSignal;
4581
+ }): Promise<Reply<200, Agent>>;
4582
+ /**
4583
+ * An agent's versions
4584
+ *
4585
+ * The versions an agent the project keeps was published as, newest first.
4586
+ */
4587
+ listAgentVersions(input: {
4588
+ path: {
4589
+ name: string;
4590
+ };
4591
+ query?: {
4592
+ limit?: number; /** The next_cursor of the previous page. */
4593
+ cursor?: string;
4594
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4595
+ signal?: AbortSignal;
4596
+ }): Promise<Reply<200, AgentVersionList>>;
4597
+ /**
4598
+ * Synthesize speech from text
4599
+ *
4600
+ * Streams synthesized audio from OpenAI or ElevenLabs.
4601
+ */
4602
+ createAudioSpeech(input: {
4603
+ body: SpeechRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4604
+ signal?: AbortSignal;
4605
+ }): Promise<Reply<200, Response>>;
4606
+ /**
4607
+ * Transcribe audio to text
4608
+ *
4609
+ * Transcribes uploaded audio or a stored audio file via Deepgram or OpenAI with optional timestamps and diarization.
4610
+ */
4611
+ createAudioTranscription(input: {
4612
+ body: TranscriptionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4613
+ signal?: AbortSignal;
4614
+ }): Promise<Reply<200, TranscriptionResponse>>;
4615
+ /**
4616
+ * The chats
4617
+ *
4618
+ * The server's: every chat, or a member's (member=); a user's: the chats they are in. The newest first, a page at a time (limit, cursor), and only those labelled so when metadata= names labels.
4619
+ */
4620
+ listChats(input?: {
4621
+ query?: {
4622
+ member?: string; /** How many (1 to 100, default 100). */
4623
+ limit?: number; /** next_cursor of the page before. */
4624
+ cursor?: string; /** A label the chats have, key:value (its metadata); given again, every label named: metadata=project_id:p_123. */
4625
+ metadata?: string[]; /** Filter chats by live execution status (active returns only chats with a running or waiting turn). */
4626
+ status?: "active" | "all";
4627
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4628
+ signal?: AbortSignal;
4629
+ }): Promise<Reply<200, ChatList>>;
4630
+ /**
4631
+ * Start a chat
4632
+ *
4633
+ * The project's server's alone: its backend, with the secret key, starts a chat with a named agent or a definition of its own, and names its members. A signed-in user is answered 403 server_only, whatever the project lets them (settings.clients is what they do in the chats they are in).
4634
+ */
4635
+ createChat(input: {
4636
+ body: ChatRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4637
+ signal?: AbortSignal;
4638
+ }): Promise<Reply<201, Chat>>;
4639
+ /**
4640
+ * A chat
4641
+ *
4642
+ * A chat, with its members. A user reads only a chat they are in; any other is not found.
4643
+ */
4644
+ getChat(input: {
4645
+ path: {
4646
+ chat_id: string;
4647
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4648
+ signal?: AbortSignal;
4649
+ }): Promise<Reply<200, Chat>>;
4650
+ /**
4651
+ * Delete a chat
4652
+ *
4653
+ * Its owner or the server deletes it: a turn still running is stopped, and its history no longer counts.
4654
+ */
4655
+ deleteChat(input: {
4656
+ path: {
4657
+ chat_id: string;
4658
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4659
+ signal?: AbortSignal;
4660
+ }): Promise<Reply<204, undefined>>;
4661
+ /**
4662
+ * Decide a tool call
4663
+ *
4664
+ * A tool call that waits for a person's yes: approved it is made; denied, the agent is told, with the reason, and goes on. Decided by the member whose message began the turn (403 not_your_turn for any other) — or by the project's server, for any turn, or as that member (as).
4665
+ */
4666
+ decideChatApproval(input: {
4667
+ path: {
4668
+ chat_id: string; /** The approval (a tool event's approval_id). */
4669
+ approval_id: string;
4670
+ };
4671
+ body: DecisionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4672
+ signal?: AbortSignal;
4673
+ }): Promise<Reply<200, Decision>>;
4674
+ /**
4675
+ * Read a chat session's live execution target and machine state
4676
+ *
4677
+ * Returns the chat's active execution target, target_generation, workspace_seq, target machine online/offline state, probed ACP harnesses, and auto_failover status.
4678
+ */
4679
+ getChatExecution(input: {
4680
+ path: {
4681
+ chat_id: string;
4682
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4683
+ signal?: AbortSignal;
4684
+ }): Promise<Reply<200, ChatExecution>>;
4685
+ /**
4686
+ * Update a chat session's auto-failover policy or default model/effort
4687
+ *
4688
+ * Server-only update for auto_failover policy or default model/effort without incrementing target_generation or triggering a teleport.
4689
+ */
4690
+ patchChatExecution(input: {
4691
+ path: {
4692
+ chat_id: string;
4693
+ };
4694
+ body: PatchExecutionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4695
+ signal?: AbortSignal;
4696
+ }): Promise<Reply<200, ChatExecution>>;
4697
+ /**
4698
+ * Fork a chat before a message
4699
+ *
4700
+ * Forks the chat before one of its messages — what a person's "edit this message" makes: a new chat that begins where this one was, without that message and what came after it, for the edited message to be sent into. The project's server's alone, as starting a chat is. The fork talks to the same agent, carries the chat's labels and — unless members says otherwise — its members. What it begins with is the chat's messages and its agent's answers before that message, in the journal's order — its subagents' work left out, a member's message with the context the model read with it: the engine is given them with the fork's first turn, and its pipe writes them first (history parts). A fork of a chat that works in a workspace works in the same one, the files as they are now, on a session of its own; the workspace goes once no chat that works in it is left. A chat whose agent is at work is not forked (409 turn_running); a message that is not one of the chat's, or that its agent was not given, is 400; what came before past 512 KiB is 409 fork_too_large; past the history the project keeps, 409 history_full.
4701
+ */
4702
+ forkChat(input: {
4703
+ path: {
4704
+ chat_id: string;
4705
+ };
4706
+ body: ForkRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4707
+ signal?: AbortSignal;
4708
+ }): Promise<Reply<201, Chat>>;
4709
+ /**
4710
+ * Read the chat's goal
4711
+ *
4712
+ * The chat's goal: its status, why it stopped, what its next turn is (phase), its limits and what it has used so far. The project's server's.
4713
+ */
4714
+ getChatGoal(input: {
4715
+ path: {
4716
+ chat_id: string;
4717
+ };
4718
+ query?: {
4719
+ as?: string;
4720
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4721
+ signal?: AbortSignal;
4722
+ }): Promise<Reply<200, Goal>>;
4723
+ /**
4724
+ * Set the chat's goal
4725
+ *
4726
+ * Sets the chat's goal — replacing any it had: the engine works the chat toward the objective by itself, a turn at a time — each turn the chat's agent as it is defined now (a backend's agent is asked, told of the goal), judged when it ends, a claimed completion checked against the rubric — until it is met, or max_turns, the budget or a brake (turns that fail, that do nothing) stops it; its first turn opens at once when no turn of the chat is at work. The project's server's alone — as itself, or as a member (as: the goal is then theirs, as their message's turn is: they decide and answer its turns' approvals and app tools, and change and clear it — while they stand where they stood when it was set: in the chat, and, its agent defined for them alone, the chat theirs alone; taken out, or the chat given another member, the goal is paused with a reason saying why and its turn at work stopped). Each of its turns is the chat's: in its stream (a turn part that says the goal's, its role and number), billed, its tools served, stopped by a stop; a member's message goes before its next turn. Its status, each time it changes, is the event ai.goal.updated, and its words are goal parts of the chat's stream.
4727
+ */
4728
+ setChatGoal(input: {
4729
+ path: {
4730
+ chat_id: string;
4731
+ };
4732
+ body: GoalRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4733
+ signal?: AbortSignal;
4734
+ }): Promise<Reply<200, Goal>>;
4735
+ /**
4736
+ * Clear the chat's goal
4737
+ *
4738
+ * Clears the chat's goal: no turn of it opens again, and one at work finishes as an ordinary turn. As the server, or as the member it was set as (as); the event ai.goal.updated says it cleared.
4739
+ */
4740
+ clearChatGoal(input: {
4741
+ path: {
4742
+ chat_id: string;
4743
+ };
4744
+ query?: {
4745
+ as?: string;
4746
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4747
+ signal?: AbortSignal;
4748
+ }): Promise<Reply<204, undefined>>;
4749
+ /**
4750
+ * Change the chat's goal
4751
+ *
4752
+ * Pauses the goal (with a reason, said in its event) or resumes it — a resumed goal opens its next turn at once when no turn of the chat is at work — edits its objective or rubric, or changes a limit (null: none). As the server, or as the member it was set as (as); another member changes nothing of it (403 not_your_turn). An achieved goal is changed by setting a new one (409 goal_achieved); one set as a member who no longer stands where they stood when it was set — out of the chat, or the chat no longer theirs alone — is not resumed (409 goal_lapsed): it is cleared, or another set for the chat as it is now.
4753
+ */
4754
+ updateChatGoal(input: {
4755
+ path: {
4756
+ chat_id: string;
4757
+ };
4758
+ body: GoalPatch; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4759
+ signal?: AbortSignal;
4760
+ }): Promise<Reply<200, Goal>>;
4761
+ /**
4762
+ * Teleport a chat session to a new execution target
4763
+ *
4764
+ * Atomically moves the chat session to a new compute/executor target (serverless, cloud, pool, or machine; palbase or acp), increments target_generation to fence superseded runners, and broadcasts session.handed_off.
4765
+ */
4766
+ handoffChat(input: {
4767
+ path: {
4768
+ chat_id: string;
4769
+ };
4770
+ body: HandoffRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4771
+ signal?: AbortSignal;
4772
+ }): Promise<Reply<200, HandoffResponse>>;
4773
+ /**
4774
+ * Put a user in a chat
4775
+ *
4776
+ * Who is in a chat is the server's to say. A goal set as the chat's one member, its agent defined for them alone, is paused when another is put in it.
4777
+ */
4778
+ putChatMember(input: {
4779
+ path: {
4780
+ chat_id: string; /** The user's id. */
4781
+ user_id: string;
4782
+ };
4783
+ body: MemberRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4784
+ signal?: AbortSignal;
4785
+ }): Promise<Reply<200, Chat>>;
4786
+ /**
4787
+ * Take a user out of a chat
4788
+ *
4789
+ * The server takes anyone out; a user takes themselves out. A goal set as the member taken out is paused, and its turn at work stopped.
4790
+ */
4791
+ deleteChatMember(input: {
4792
+ path: {
4793
+ chat_id: string; /** The user's id. */
4794
+ user_id: string;
3470
4795
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3471
4796
  signal?: AbortSignal;
3472
- }): Promise<Reply<200, Agent>>;
4797
+ }): Promise<Reply<204, undefined>>;
3473
4798
  /**
3474
- * Save an agent's draft
4799
+ * A chat's messages
3475
4800
  *
3476
- * Saves the draft of an agent the project keeps — a new one's first. What its chats talk to changes only once the draft is published. revision names the draft the change was made to: when another was saved since, it is refused (409 draft_changed) and nothing is lost; left out, the last save wins. A name its backend's build defines is refused (409 agent_defined_in_code): that agent is changed in the code.
4801
+ * What its members (and the server) wrote, the newest first.
3477
4802
  */
3478
- putAgent(input: {
4803
+ listChatMessages(input: {
4804
+ path: {
4805
+ chat_id: string;
4806
+ };
4807
+ query?: {
4808
+ limit?: number; /** next_cursor of the page before. */
4809
+ cursor?: string;
4810
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4811
+ signal?: AbortSignal;
4812
+ }): Promise<Reply<200, MessagePage>>;
4813
+ /**
4814
+ * Write to a chat
4815
+ *
4816
+ * A message for the agent: a turn of its own when none runs; while one does, at its next step (next) or cutting the step it is in (now). The same client_id again is the same message. A user sends user_messages_per_minute a minute — and so does the server writing as them (429 too_many_messages); past the history the project keeps a message is refused (409 history_full). It carries pictures of the project's storage the model is shown (images) and, in a chat that works in a workspace, files put in it before the agent reads the message (files), each copied for the chat.
4817
+ */
4818
+ sendChatMessage(input: {
4819
+ path: {
4820
+ chat_id: string;
4821
+ };
4822
+ body: MessageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4823
+ signal?: AbortSignal;
4824
+ }): Promise<Reply<200, ChatMessage> | Reply<202, ChatMessage>>;
4825
+ /**
4826
+ * A picture or a file a message carries
4827
+ *
4828
+ * The bytes of a picture or a file a message of the chat carries, as it was sent (a download by its name, never a page): to the chat's members and its server. A position the message has nothing at is not found (404 attachment_not_found).
4829
+ */
4830
+ getChatMessageAttachment(input: {
4831
+ path: {
4832
+ chat_id: string; /** The message. */
4833
+ message_id: string; /** Its place among the message's attachments (its images, then its files), from 0. */
4834
+ position: number;
4835
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4836
+ signal?: AbortSignal;
4837
+ }): Promise<Reply<200, Response>>;
4838
+ /**
4839
+ * The chat's past
4840
+ *
4841
+ * The chat's past as its stream told it, a page at a time from its newest end back: the members' messages, the turns, the answers as text at their offsets, the tools and the subagents, the goal's and the voice's words — each page in the order it was told, each part under the id its channel told it (part_id), so an app holding the channel's parts and a page of these keeps each once. A page reads limit of the chat's events before the cursor, or before the oldest part the app holds of the chat's channel (before: that part's id), so the first page does not read again the day the channel told; with neither, from its newest end. Given both, the call is refused (400). A page read by turns (turns=n) ends where the chat's n-th turn before the cursor (or the newest end) opens — a goal's turn at the goal's turn_started, any other at its start, the messages that began it right after — so turns=1 is the last turn whole, and its cursor's turns=1 the turn before; a page that would read more than 5000 of the chat's events ends there, its turns saying how many it opened, its cursor going on. The page that reaches the chat's start begins with where a fork began. A voice's end is under the id its channel told it (vclosed:<voice>); a voice the engine lost, its end said by no journal, has it right after its last part. Reading a page records nothing. A call's answer is by its end, as the stream shows it. Read by the chat's members and the project's server.
4842
+ */
4843
+ listChatParts(input: {
4844
+ path: {
4845
+ chat_id: string;
4846
+ };
4847
+ query?: {
4848
+ limit?: number; /** How many of the chat's turns the page reads back to (1 to 20): it ends where the last of them opens. Not with limit. */
4849
+ turns?: number; /** A next_cursor: the page before it. Not with before. */
4850
+ cursor?: string; /** The id of the oldest part the app holds of the chat's channel (a part's id: its journal sequence): the first page is the parts told before it. Not with cursor. */
4851
+ before?: number;
4852
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4853
+ signal?: AbortSignal;
4854
+ }): Promise<Reply<200, ChatPartPage>>;
4855
+ /**
4856
+ * Pipe the chat into a channel
4857
+ *
4858
+ * Writes the chat's stream into a channel of the project's realtime from now on — a gateway's, durable — as the platform: the members' messages, the turns, the answer as it is written (gathered into a few writes a second), the tools and subagents, each the channel's event `chat` {type, id?, data}, under an id of its own so a retry is kept once. The types: `message` (a ChatMessage, as the agent got it), `turn` ({response_id, status: running|waiting|completed|failed|canceled|timed_out|budget_exceeded, user_id, solo, goal: {goal_id, role: work|verify, seq} — a turn of the chat's goal, waiting: {reason: approval|tool_output|subagents|message, text_offset, approval_id, tool_call_id, tool_name, input, publication}, end: completed|failed|stopped|budget_exceeded — as the turn's event says it, error: {code, message, retryable}}), `text` ({response_id, offset, text}: the agent's answer as it is written, at its byte offset), `reset` ({response_id, offset}: discard the answer past offset), `thinking` ({response_id, run_id, step_id, text}: the model's reasoning as it thinks, when the agent shows it — thinking: visible), `tool` ({response_id, run_id, call_id, name, status: running|awaiting_output|awaiting_approval|approved|denied|expired|completed|failed|canceled, text_offset, input, output, image_count, is_error, approval_id, agent_response_id, …}), `agent` ({run_id, response_id, parent_response_id, name, required, status, text_offset}: a subagent at work), `advisor` ({response_id, run_id, seq, kind: step|final|ask, verdict: none|heads_up|answer|unreadable, rule, message, question, told}: the agent's advisor read its work — after a step, at its answer, which waits for it, or because the agent asked; told: the agent was told at its next step), `goal` ({goal_id, kind: set|updated|turn_started|judged|verified|status_changed|cleared, goal: {objective, rubric, status, stop_code, stop_reason, phase, max_turns, max_cost_usd}, role, seq, response_id, run_id, verdict, reason, missing, from, to, code}: the chat's goal's words), `voice` ({voice_id, user_id, delegation, status: started|closed, seconds, close_reason}: the chat's live voice began or ended), `transcript` ({id, voice_id, role: user|assistant, user_id, author_name, text, final, created_at}: a line it said either way — the chat's history's message of kind voice, by its id), `seen` (the journal moved past what was handed already), and — first, in a fork's channel — `history` ({forked_from: {chat_id, before_message}, part, parts, items: [{role: user|assistant, message_id, client_id, author, author_name, text, metadata, created_at, response_id, text_truncated, attachments}]}: what the fork began with, a few items a part, a long text cut in its part, its id h and the part's place). Every type but text and reset has the journal's sequence as its id; text_offset says where in the answer a tool or subagent part happened. The project's backend is not in the stream: the gateway's members hear the chat from realtime, and one that was away is given what it missed there. Put again with the same channel it goes on where it is — one realtime refused is tried again; with another, from the chat's start, and nothing more is written into the one before. The project's server's alone.
4859
+ */
4860
+ putChatPipe(input: {
4861
+ path: {
4862
+ chat_id: string;
4863
+ };
4864
+ body: ChatPipe; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4865
+ signal?: AbortSignal;
4866
+ }): Promise<Reply<200, ChatPipeResult>>;
4867
+ /**
4868
+ * Take the chat's pipe away
4869
+ *
4870
+ * The chat's stream is written nowhere from now on. The project's server's alone.
4871
+ */
4872
+ deleteChatPipe(input: {
4873
+ path: {
4874
+ chat_id: string;
4875
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4876
+ signal?: AbortSignal;
4877
+ }): Promise<Reply<204, undefined>>;
4878
+ /**
4879
+ * Write to a subagent at work
4880
+ *
4881
+ * A message for one of the agent's subagents, at its next step: a message of the chat like any other — its writer's (or the member's the server writes as) messages a minute (429 too_many_messages), the history the project keeps (409 history_full).
4882
+ */
4883
+ sendSubagentMessage(input: {
4884
+ path: {
4885
+ chat_id: string; /** The subagent's run (an agent event's run_id). */
4886
+ run_id: string;
4887
+ };
4888
+ body: RunMessageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4889
+ signal?: AbortSignal;
4890
+ }): Promise<Reply<202, RunMessageAccepted>>;
4891
+ /**
4892
+ * Stop a subagent at work
4893
+ *
4894
+ * Stops one subagent at work — with the subagents it started and its background work: the agent that started it is told a person stopped it, and not to start that work again unless asked, and the rest of the turn goes on. Any member stops it, as any member stops the turn, and the server — as itself, or as a member (as: the server's alone; a user sending it is answered 400; one who is not a member of the chat, 403 not_a_member). Asked again, the same stop answers as it did. A run that is not a subagent at work in this chat — ended, the agent itself, another chat's — is 404.
4895
+ */
4896
+ stopSubagent(input: {
4897
+ path: {
4898
+ chat_id: string; /** The subagent's run (an agent event's run_id). */
4899
+ run_id: string;
4900
+ };
4901
+ body?: RunStopRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4902
+ signal?: AbortSignal;
4903
+ }): Promise<Reply<200, RunStopped>>;
4904
+ /**
4905
+ * Stop the agent
4906
+ *
4907
+ * Stops the turn it is working on: what it wrote stays; a message it had not read yet, and a message after, starts the next turn. Any member's; the server's as itself, or as a member (as).
4908
+ */
4909
+ stopChat(input: {
4910
+ path: {
4911
+ chat_id: string;
4912
+ };
4913
+ body?: ChatStop; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4914
+ signal?: AbortSignal;
4915
+ }): Promise<Reply<200, StopResult>>;
4916
+ /**
4917
+ * A turn's tool calls
4918
+ *
4919
+ * A turn's tool calls as the engine committed them — their arguments and results as they were (what a diff of the files the turn wrote is made of), in their order, a page at a time. The project's server's alone; a subagent's work is read by its response (an agent part's response_id).
4920
+ */
4921
+ listTurnToolCalls(input: {
4922
+ path: {
4923
+ chat_id: string;
4924
+ };
4925
+ query: {
4926
+ turn: string; /** How many calls a page holds (1 to 500; 100). */
4927
+ limit?: number; /** A next_cursor: the page after it. */
4928
+ cursor?: string;
4929
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4930
+ signal?: AbortSignal;
4931
+ }): Promise<Reply<200, TurnToolCallPage>>;
4932
+ /**
4933
+ * A tool call of the chat, whole
4934
+ *
4935
+ * One tool call of the chat, its whole answer: the chat's stream shows a call's answer by its end (its last 16 KiB, omitted_bytes what it left out) — read here whole, its secret shapes masked as the stream masks them. Read by the chat's members and the project's server; another chat's call is not found.
4936
+ */
4937
+ getChatToolCall(input: {
4938
+ path: {
4939
+ chat_id: string; /** The call: a tool part's call_id. */
4940
+ call_id: string;
4941
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4942
+ signal?: AbortSignal;
4943
+ }): Promise<Reply<200, ChatToolCall>>;
4944
+ /**
4945
+ * Answer an app's tool call
4946
+ *
4947
+ * The answer of a client tool's call, made by the app's code: the turn waiting for it goes on. The first answer is the one. Given by the app of the member whose message began the turn (403 not_your_turn for any other) — or by the project's server, for any turn, or as that member (as). A call of the project's backend (or an HTTPS tool of its) that answered {"deferred": true} — its work outlasts a call — is answered here too, by the project's server as itself, within the while it named (a minute to a day; an hour), and by no member. An answer whose tool wrote the chat's workspace names the tree its writes left (workspace_tree), as an answer given at once does: the agent's next command waits for the session's machine to have it (400 for one that names no tree).
4948
+ */
4949
+ answerChatToolCall(input: {
4950
+ path: {
4951
+ chat_id: string; /** The tool call (a tool event's call_id). */
4952
+ call_id: string;
4953
+ };
4954
+ body: ToolOutput; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4955
+ signal?: AbortSignal;
4956
+ }): Promise<Reply<200, ToolOutputAccepted>>;
4957
+ /**
4958
+ * A turn's artifacts
4959
+ *
4960
+ * What the turn's agent published as its output (palbase.artifact.publish) — a build's product, a screenshot, a report — kept in the project's own storage. The chat's members and the project's server read it, as they read the chat.
4961
+ */
4962
+ listChatTurnArtifacts(input: {
4963
+ path: {
4964
+ chat_id: string; /** The turn: a message's response_id, or a turn event's. */
4965
+ response_id: string;
4966
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4967
+ signal?: AbortSignal;
4968
+ }): Promise<Reply<200, TurnArtifacts>>;
4969
+ /**
4970
+ * An artifact of a turn
4971
+ *
4972
+ * One artifact of the turn, its bytes as the agent published them (an attachment, never a page). One the turn did not publish is not found (404 artifact_not_found).
4973
+ */
4974
+ getChatTurnArtifact(input: {
4975
+ path: {
4976
+ chat_id: string; /** The turn: a message's response_id, or a turn event's. */
4977
+ response_id: string; /** The artifact: an id of the turn's artifacts. */
4978
+ artifact_id: string;
4979
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4980
+ signal?: AbortSignal;
4981
+ }): Promise<Reply<200, Response>>;
4982
+ /**
4983
+ * What a turn of a chat cost
4984
+ *
4985
+ * What a turn of the chat cost so far, its subagents' calls counted — while it runs too (final false) — or what one subagent's work in it cost (an agent event's response_id). The project's server's: a member's key is refused (403 server_only).
4986
+ */
4987
+ getChatTurnCost(input: {
4988
+ path: {
4989
+ chat_id: string; /** The turn: a message's response_id, or a turn event's. */
4990
+ response_id: string;
4991
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4992
+ signal?: AbortSignal;
4993
+ }): Promise<Reply<200, TurnCost>>;
4994
+ /**
4995
+ * Start a chat's voice
4996
+ *
4997
+ * Starts the chat's live voice: the app's WebRTC offer in, the answer out — the audio then goes between the app and the platform's voice provider. The voice is its member's — the user who starts it, or the member the server starts it for (as): they or the server read, tell and close it, no other member. What the person asks for out loud becomes, by delegation, a turn of the chat as that member whose answer the voice says back (chat, the default), or the event ai.voice.delegated (events). What is said either way is the chat's: transcript parts of its stream and lines of its history (messages of kind voice). One voice talks in a chat at a time: a member's new voice ends the one they left open (closed replaced); another member's live voice is refused (409 voice_active). A user starts at most 5 voices an hour in the project's chats, the server's for them counted as theirs (429 too_many_voices, with Retry-After) — each is the project's spend while it lasts. Its start is the event ai.voice.started.
4998
+ */
4999
+ startChatVoice(input: {
5000
+ path: {
5001
+ chat_id: string;
5002
+ };
5003
+ body: VoiceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5004
+ signal?: AbortSignal;
5005
+ }): Promise<Reply<201, VoiceSession>>;
5006
+ /**
5007
+ * Read a chat's voice
5008
+ *
5009
+ * The chat's voice: whose it is, whether it is live, how long it has lasted and why it ended — read from the engine while it is live. Its member's, or the server's (403 not_your_voice).
5010
+ */
5011
+ getChatVoice(input: {
5012
+ path: {
5013
+ chat_id: string; /** The voice session. */
5014
+ voice_id: string;
5015
+ };
5016
+ query?: {
5017
+ as?: string;
5018
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5019
+ signal?: AbortSignal;
5020
+ }): Promise<Reply<200, VoiceSession>>;
5021
+ /**
5022
+ * Close a chat's voice
5023
+ *
5024
+ * Ends the chat's voice; the answer says how long it lasted and why it ended. Its member's, or the server's (403 not_your_voice). Its end is the event ai.voice.closed — once.
5025
+ */
5026
+ closeChatVoice(input: {
5027
+ path: {
5028
+ chat_id: string; /** The voice session. */
5029
+ voice_id: string;
5030
+ };
5031
+ query?: {
5032
+ as?: string;
5033
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5034
+ signal?: AbortSignal;
5035
+ }): Promise<Reply<200, VoiceSession>>;
5036
+ /**
5037
+ * Tell a chat's voice
5038
+ *
5039
+ * The server's alone (a member is answered 403 server_only), as itself or as the voice's member (as; another member 403 not_your_voice): a member's words would be the agent's own to every other member of the chat. Gives the chat's voice text: speak says it, know keeps it in mind, instruct changes how it behaves — speak with a delegation_id answers a request it handed over (ai.voice.delegated). A voice that has ended is 409 voice_closed.
5040
+ */
5041
+ commandChatVoice(input: {
3479
5042
  path: {
3480
- name: string;
3481
- };
3482
- query?: {
3483
- revision?: number;
5043
+ chat_id: string; /** The voice session. */
5044
+ voice_id: string;
3484
5045
  };
3485
- body: AgentDefinition; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5046
+ body: VoiceCommand; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3486
5047
  signal?: AbortSignal;
3487
- }): Promise<Reply<200, Agent>>;
5048
+ }): Promise<Reply<202, VoiceSession>>;
3488
5049
  /**
3489
- * Forget an agent
5050
+ * Turn texts into vectors
3490
5051
  *
3491
- * An agent the project keeps, its versions with it — an agent made again under its name numbers its versions after them, and a chat on one of them is told it is gone. Its chats stay; a message to one of them is refused (agent_not_found) until an agent of that name is there again. One its backend's build declares goes with the code (409 agent_defined_in_code).
5052
+ * One vector per text, in the order of the input. Up to 1,024 texts per request — a longer list is several requests, and the SDK cuts it; the platform splits a request over the provider's own limits.
3492
5053
  */
3493
- deleteAgent(input: {
3494
- path: {
3495
- name: string;
3496
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5054
+ createEmbeddings(input: {
5055
+ body: EmbeddingsRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3497
5056
  signal?: AbortSignal;
3498
- }): Promise<Reply<204, undefined>>;
5057
+ }): Promise<Reply<200, Embeddings>>;
3499
5058
  /**
3500
- * Publish an agent's draft
5059
+ * The project's tool endpoints
3501
5060
  *
3502
- * Makes the draft a version, the next number, and the one its chats talk to from their next turn on. A draft that is the version published is refused (409 nothing_to_publish); an agent keeps 1000 versions (409 too_many_versions).
5061
+ * Its HTTPS tools and MCP servers, by name (their secrets are not said again). To an environment's token each url is shown only where it is — its scheme, its host and its path's first segment — and the rest of its path, its query and its fragment each as ***: an MCP server's or a tool's key may be anywhere after the host, and an agent is not shown again a secret it did not just set (the answer to its own PUT shows it so too). A person and the project's key see each url whole.
3503
5062
  */
3504
- publishAgent(input: {
3505
- path: {
3506
- name: string;
3507
- };
3508
- body: AgentPublish; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5063
+ listEndpoints(input?: {
3509
5064
  signal?: AbortSignal;
3510
- }): Promise<Reply<200, Agent>>;
5065
+ }): Promise<Reply<200, EndpointList>>;
3511
5066
  /**
3512
- * Go back to a version
5067
+ * Put a tool endpoint
3513
5068
  *
3514
- * Makes a version it had the one its chats talk to, and its draft that version: a change of the draft not published is dropped.
5069
+ * A tool at an HTTPS address of the project's — called with a signed POST {tool, call_id, input, context: {chat_id, agent, user, metadata, turn_id, run_id, subagent, workspace} — the turn, the run that called: the agent's own, or a subagent's at work (subagent names which, null for the agent), and, in a chat that works in a workspace, the workspace as the session last wrote it, flushed before the call: workspace {chat_id, manifest_id, seq} (read its files at that tree, GET /ai/chats/{chat_id}/workspace/files?manifest=)} — and answered {output, is_error, workspace_tree?} or plain text: a tool that wrote the workspace (PUT /ai/chats/{chat_id}/workspace/files) answers workspace_tree {manifest_id, seq} — the tree its writes left, either or both — and the agent's next command sees it — or an MCP server, whose tools an agent may use: when the project says it is its own (workspace: true), told the same tree in its tools/call's _meta (palbase/workspace), answering it in its result's _meta (palbase/workspace_tree); a third party's server is told nothing of a chat or its workspace. The answer says an https tool's signing secret, once.
3515
5070
  */
3516
- rollbackAgent(input: {
5071
+ putEndpoint(input: {
3517
5072
  path: {
3518
5073
  name: string;
3519
5074
  };
3520
- body: AgentRollback; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5075
+ body: EndpointRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3521
5076
  signal?: AbortSignal;
3522
- }): Promise<Reply<200, Agent>>;
5077
+ }): Promise<Reply<200, Endpoint>>;
3523
5078
  /**
3524
- * An agent's versions
5079
+ * Forget a tool endpoint
3525
5080
  *
3526
- * The versions an agent the project keeps was published as, newest first.
5081
+ * An agent naming it can no longer start a turn until it is put again.
3527
5082
  */
3528
- listAgentVersions(input: {
5083
+ deleteEndpoint(input: {
3529
5084
  path: {
3530
5085
  name: string;
3531
- };
3532
- query?: {
3533
- limit?: number; /** The next_cursor of the previous page. */
3534
- cursor?: string;
3535
5086
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3536
5087
  signal?: AbortSignal;
3537
- }): Promise<Reply<200, AgentVersionList>>;
5088
+ }): Promise<Reply<204, undefined>>;
3538
5089
  /**
3539
- * Synthesize speech from text
5090
+ * The project's variables
3540
5091
  *
3541
- * Streams synthesized audio from OpenAI or ElevenLabs.
5092
+ * Their names, whether each is a secret, the hosts a secret may go to, where it may be put, whether it is open, and when each was set: never a value.
3542
5093
  */
3543
- createAudioSpeech(input: {
3544
- body: SpeechRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5094
+ listEnv(input?: {
3545
5095
  signal?: AbortSignal;
3546
- }): Promise<Reply<200, Response>>;
5096
+ }): Promise<Reply<200, EnvList>>;
3547
5097
  /**
3548
- * Transcribe audio to text
5098
+ * The agents' secrets' allowances
3549
5099
  *
3550
- * Transcribes uploaded audio or a stored audio file via Deepgram or OpenAI with optional timestamps and diarization.
5100
+ * The hosts the project's agents' own secrets are allowed beside their definitions': each an owner's Allow of an ask, newest first (500 at most), with whose agent (origin) and the host's registrable domain. A new value keeps them. One goes with its key: an agent the project keeps, once neither its draft nor its version published has the key (deleted, every one); a chat's own definition, with the last chat whose definition has it; a backend's agent, after 30 days with no turn.
3551
5101
  */
3552
- createAudioTranscription(input: {
3553
- body: TranscriptionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5102
+ listEnvAllowances(input?: {
3554
5103
  signal?: AbortSignal;
3555
- }): Promise<Reply<200, TranscriptionResponse>>;
5104
+ }): Promise<Reply<200, SecretHostAllowanceList>>;
3556
5105
  /**
3557
- * The chats
5106
+ * Take an allowance away
3558
5107
  *
3559
- * The server's: every chat, or a member's (member=); a user's: the chats they are in. The newest first, a page at a time (limit, cursor), and only those labelled so when metadata= names labels.
5108
+ * The host taken away from the agent's secret: an ask for it is asked again. A person's alone: an owner or an admin of the organization signed in, never a key or a token, the secret key included (403 person_required; an environment's token, token_out_of_scope).
3560
5109
  */
3561
- listChats(input?: {
3562
- query?: {
3563
- member?: string; /** How many (1 to 100, default 100). */
3564
- limit?: number; /** next_cursor of the page before. */
3565
- cursor?: string; /** A label the chats have, key:value (its metadata); given again, every label named: metadata=project_id:p_123. */
3566
- metadata?: string[]; /** Filter chats by live execution status (active returns only chats with a running or waiting turn). */
3567
- status?: "active" | "all";
5110
+ deleteEnvAllowance(input: {
5111
+ path: {
5112
+ allowance_id: string;
3568
5113
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3569
5114
  signal?: AbortSignal;
3570
- }): Promise<Reply<200, ChatList>>;
5115
+ }): Promise<Reply<204, undefined>>;
3571
5116
  /**
3572
- * Start a chat
5117
+ * The hosts the project's secrets asked for
3573
5118
  *
3574
- * The project's server's alone: its backend, with the secret key, starts a chat with a named agent or a definition of its own, and names its members. A signed-in user is answered 403 server_only, whatever the project lets them (settings.clients is what they do in the chats they are in).
5119
+ * The hosts the project's sealed secrets were sent to that they are not allowed for: each secret and host once, with how many times, newest first — its host and the registrable domain it is under (an Allow hands the secret to whoever holds that domain), and whose secret it is (a project variable, or an agent's own of an origin). The project's owners are emailed a link at most once a day for each, at most 3 a day for one secret and 10 a project a day, counted where no ask lowers the count. A project keeps 500 asked, 50 of them a secret and 100 an agent's own secrets: an ask past one forgets an asked one alone — the secret's own oldest, else the oldest of the secret that holds the most, the one asked last among equals — never a dismissed or an allowed one; it keeps 500 dismissed and 500 allowed, a decision past them forgetting the oldest of its kind. A variable removed takes its asks with it, and a key that leaves an agent its own.
3575
5120
  */
3576
- createChat(input: {
3577
- body: ChatRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5121
+ listEnvHostRequests(input?: {
5122
+ query?: {
5123
+ status?: "asked" | "allowed" | "dismissed";
5124
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3578
5125
  signal?: AbortSignal;
3579
- }): Promise<Reply<201, Chat>>;
5126
+ }): Promise<Reply<200, SecretHostRequestList>>;
3580
5127
  /**
3581
- * A chat
5128
+ * Allow an ask
3582
5129
  *
3583
- * A chat, with its members. A user reads only a chat they are in; any other is not found.
5130
+ * The owner's Allow, for any ask: its host is added to the variable's hosts (one of the project's), or to the agent's allowances (an agent's own secret: GET /ai/env/allowances), and the asks it now allows are marked allowed. A person's alone: an owner or an admin of the organization signed in, never a key or a token, the secret key included (403 person_required; an environment's token, token_out_of_scope).
3584
5131
  */
3585
- getChat(input: {
5132
+ allowEnvHostRequest(input: {
3586
5133
  path: {
3587
- chat_id: string;
5134
+ request_id: string;
3588
5135
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3589
5136
  signal?: AbortSignal;
3590
- }): Promise<Reply<200, Chat>>;
5137
+ }): Promise<Reply<200, SecretHostRequest>>;
3591
5138
  /**
3592
- * Delete a chat
5139
+ * Dismiss an ask
3593
5140
  *
3594
- * Its owner or the server deletes it: a turn still running is stopped, and its history no longer counts.
5141
+ * The owner's Dismiss: the ask is never told again (it is still counted). One allowed is not undone here: its host is the secret's (PUT /ai/env/{key} with hosts, or DELETE /ai/env/allowances/{allowance_id}, takes it away) — 409 already_allowed. A person's alone: an owner or an admin of the organization signed in, never a key or a token, the secret key included (403 person_required; an environment's token, token_out_of_scope).
3595
5142
  */
3596
- deleteChat(input: {
5143
+ dismissEnvHostRequest(input: {
3597
5144
  path: {
3598
- chat_id: string;
5145
+ request_id: string;
3599
5146
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3600
5147
  signal?: AbortSignal;
3601
- }): Promise<Reply<204, undefined>>;
5148
+ }): Promise<Reply<200, SecretHostRequest>>;
3602
5149
  /**
3603
- * Decide a tool call
5150
+ * Set a variable
3604
5151
  *
3605
- * A tool call that waits for a person's yes: approved it is made; denied, the agent is told, with the reason, and goes on. Decided by the member whose message began the turn (403 not_your_turn for any other) — or by the project's server, for any turn, or as that member (as).
5152
+ * One of the project's variables or secrets, set or set anew: every command of every session of its agents begun from now has it — on the platform's Linux machines and on the project's own pools, Linux and Mac — beside the agent's own (its definition's env), masked wherever a transcript would show it. The value is sealed where the sessions run and never answered, nor logged; a refusal never repeats it. A secret also says where it may go (hosts), where in a request it may be put (inject) and whether the agent reads it as it is (open); a field left out keeps what the variable has. A write that carries the value says them as its caller's role allows. A variable set before may leave out its value to change them alone (404 for one never set): a person's change only — an owner or an admin of the organization signed in, never a key or a token, the secret key included (403 person_required). open: true, and a secret made no secret, need acknowledge_open: true (400 open_not_acknowledged); a variable that stays no secret is refused hosts, inject and open (409 not_a_secret). A sealed value is at least 8 bytes with no line break or NUL (400 secret_unusable), and one a person may have chosen (fewer than 16 characters, or one kind of character only) needs acknowledge_guessable: true (400 secret_guessable) — the request's own value is judged, never one kept: an open secret or a variable that is no secret made sealed takes its value in the same request (400 value_required). A sealed secret is a placeholder in a session: the proxy beside the machine puts the value in only on a request to one of its hosts, and a machine with no proxy beside it (a Mac, or a Linux machine whose agent does not run it) gets no sealed secret.
3606
5153
  */
3607
- decideChatApproval(input: {
5154
+ putEnv(input: {
3608
5155
  path: {
3609
- chat_id: string; /** The approval (a tool event's approval_id). */
3610
- approval_id: string;
5156
+ key: string;
3611
5157
  };
3612
- body: DecisionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5158
+ body: EnvRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3613
5159
  signal?: AbortSignal;
3614
- }): Promise<Reply<200, Decision>>;
5160
+ }): Promise<Reply<200, EnvVar>>;
3615
5161
  /**
3616
- * Read a chat session's live execution target and machine state
5162
+ * Remove a variable
3617
5163
  *
3618
- * Returns the chat's active execution target, target_generation, workspace_seq, target machine online/offline state, probed ACP harnesses, and auto_failover status.
5164
+ * Sessions begun from now no longer have it.
3619
5165
  */
3620
- getChatExecution(input: {
5166
+ deleteEnv(input: {
3621
5167
  path: {
3622
- chat_id: string;
5168
+ key: string;
3623
5169
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3624
5170
  signal?: AbortSignal;
3625
- }): Promise<Reply<200, ChatExecution>>;
5171
+ }): Promise<Reply<204, undefined>>;
3626
5172
  /**
3627
- * Update a chat session's auto-failover policy or default model/effort
5173
+ * Allow a secret a host
3628
5174
  *
3629
- * Server-only update for auto_failover policy or default model/effort without incrementing target_generation or triggering a teleport.
5175
+ * The owner's Allow, for one of the project's variables: the host is added to a sealed secret's hosts (32 at most), and the asks it now allows are marked allowed. A sealed secret sent to it from the proxy's next renewal carries the value. Allow only a host you know the secret belongs to: an agent can be led to send a secret anywhere. A person's alone: an owner or an admin of the organization signed in, never a key or a token, the secret key included (403 person_required; an environment's token, token_out_of_scope).
3630
5176
  */
3631
- patchChatExecution(input: {
5177
+ allowEnvHost(input: {
3632
5178
  path: {
3633
- chat_id: string;
5179
+ key: string;
3634
5180
  };
3635
- body: PatchExecutionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5181
+ body: EnvHostRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3636
5182
  signal?: AbortSignal;
3637
- }): Promise<Reply<200, ChatExecution>>;
5183
+ }): Promise<Reply<200, EnvVar>>;
3638
5184
  /**
3639
- * Fork a chat before a message
5185
+ * List runtime environments
3640
5186
  *
3641
- * Forks the chat before one of its messages — what a person's "edit this message" makes: a new chat that begins where this one was, without that message and what came after it, for the edited message to be sent into. The project's server's alone, as starting a chat is. The fork talks to the same agent, carries the chat's labels and — unless members says otherwise — its members. What it begins with is the chat's messages and its agent's answers before that message, in the journal's order — its subagents' work left out, a member's message with the context the model read with it: the engine is given them with the fork's first turn, and its pipe writes them first (history parts). A fork of a chat that works in a workspace works in the same one, the files as they are now, on a session of its own; the workspace goes once no chat that works in it is left. A chat whose agent is at work is not forked (409 turn_running); a message that is not one of the chat's, or that its agent was not given, is 400; what came before past 512 KiB is 409 fork_too_large; past the history the project keeps, 409 history_full.
5187
+ * Lists the project's configured runtime environments ordered by name.
3642
5188
  */
3643
- forkChat(input: {
3644
- path: {
3645
- chat_id: string;
3646
- };
3647
- body: ForkRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5189
+ listEnvironments(input?: {
3648
5190
  signal?: AbortSignal;
3649
- }): Promise<Reply<201, Chat>>;
5191
+ }): Promise<Reply<200, EnvironmentList>>;
3650
5192
  /**
3651
- * Read the chat's goal
5193
+ * Create a runtime environment
3652
5194
  *
3653
- * The chat's goal: its status, why it stopped, what its next turn is (phase), its limits and what it has used so far. The project's server's.
5195
+ * Creates a new runtime environment (ephemeral or always_on) for the project.
3654
5196
  */
3655
- getChatGoal(input: {
5197
+ createEnvironment(input: {
5198
+ body: EnvironmentRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5199
+ signal?: AbortSignal;
5200
+ }): Promise<Reply<201, Environment>>;
5201
+ /**
5202
+ * Get a runtime environment
5203
+ *
5204
+ * Returns a single runtime environment by name.
5205
+ */
5206
+ getEnvironment(input: {
3656
5207
  path: {
3657
- chat_id: string;
3658
- };
3659
- query?: {
3660
- as?: string;
5208
+ name: string;
3661
5209
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3662
5210
  signal?: AbortSignal;
3663
- }): Promise<Reply<200, Goal>>;
5211
+ }): Promise<Reply<200, Environment>>;
3664
5212
  /**
3665
- * Set the chat's goal
5213
+ * Create or update a runtime environment
3666
5214
  *
3667
- * Sets the chat's goal — replacing any it had: the engine works the chat toward the objective by itself, a turn at a time — each turn the chat's agent as it is defined now (a backend's agent is asked, told of the goal), judged when it ends, a claimed completion checked against the rubric — until it is met, or max_turns, the budget or a brake (turns that fail, that do nothing) stops it; its first turn opens at once when no turn of the chat is at work. The project's server's alone — as itself, or as a member (as: the goal is then theirs, as their message's turn is: they decide and answer its turns' approvals and app tools, and change and clear it — while they stand where they stood when it was set: in the chat, and, its agent defined for them alone, the chat theirs alone; taken out, or the chat given another member, the goal is paused with a reason saying why and its turn at work stopped). Each of its turns is the chat's: in its stream (a turn part that says the goal's, its role and number), billed, its tools served, stopped by a stop; a member's message goes before its next turn. Its status, each time it changes, is the event ai.goal.updated, and its words are goal parts of the chat's stream.
5215
+ * Upserts a runtime environment by name.
3668
5216
  */
3669
- setChatGoal(input: {
5217
+ putEnvironment(input: {
3670
5218
  path: {
3671
- chat_id: string;
5219
+ name: string;
3672
5220
  };
3673
- body: GoalRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5221
+ body: EnvironmentRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3674
5222
  signal?: AbortSignal;
3675
- }): Promise<Reply<200, Goal>>;
5223
+ }): Promise<Reply<200, Environment>>;
3676
5224
  /**
3677
- * Clear the chat's goal
5225
+ * Delete a runtime environment
3678
5226
  *
3679
- * Clears the chat's goal: no turn of it opens again, and one at work finishes as an ordinary turn. As the server, or as the member it was set as (as); the event ai.goal.updated says it cleared.
5227
+ * Deletes a runtime environment and its build records.
3680
5228
  */
3681
- clearChatGoal(input: {
5229
+ deleteEnvironment(input: {
3682
5230
  path: {
3683
- chat_id: string;
3684
- };
3685
- query?: {
3686
- as?: string;
5231
+ name: string;
3687
5232
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3688
5233
  signal?: AbortSignal;
3689
5234
  }): Promise<Reply<204, undefined>>;
3690
5235
  /**
3691
- * Change the chat's goal
5236
+ * Queue an environment build
3692
5237
  *
3693
- * Pauses the goal (with a reason, said in its event) or resumes it — a resumed goal opens its next turn at once when no turn of the chat is at work — edits its objective or rubric, or changes a limit (null: none). As the server, or as the member it was set as (as); another member changes nothing of it (403 not_your_turn). An achieved goal is changed by setting a new one (409 goal_achieved); one set as a member who no longer stands where they stood when it was set — out of the chat, or the chat no longer theirs alone — is not resumed (409 goal_lapsed): it is cleared, or another set for the chat as it is now.
5238
+ * Queues a new immutable pre-bake build for the named environment.
3694
5239
  */
3695
- updateChatGoal(input: {
5240
+ createEnvironmentBuild(input: {
3696
5241
  path: {
3697
- chat_id: string;
3698
- };
3699
- body: GoalPatch; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5242
+ name: string;
5243
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3700
5244
  signal?: AbortSignal;
3701
- }): Promise<Reply<200, Goal>>;
5245
+ }): Promise<Reply<201, EnvironmentBuild>>;
3702
5246
  /**
3703
- * Teleport a chat session to a new execution target
5247
+ * Get an environment build
3704
5248
  *
3705
- * Atomically moves the chat session to a new compute/executor target (serverless, cloud, pool, or machine; palbase or acp), increments target_generation to fence superseded runners, and broadcasts session.handed_off.
5249
+ * Returns the status and metadata of a specific environment build.
3706
5250
  */
3707
- handoffChat(input: {
5251
+ getEnvironmentBuild(input: {
3708
5252
  path: {
3709
- chat_id: string;
3710
- };
3711
- body: HandoffRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5253
+ name: string; /** The build's identifier. */
5254
+ build_id: string;
5255
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3712
5256
  signal?: AbortSignal;
3713
- }): Promise<Reply<200, HandoffResponse>>;
5257
+ }): Promise<Reply<200, EnvironmentBuild>>;
3714
5258
  /**
3715
- * Put a user in a chat
5259
+ * Make pictures
3716
5260
  *
3717
- * Who is in a chat is the server's to say. A goal set as the chat's one member, its agent defined for them alone, is paused when another is put in it.
5261
+ * Starts a picture job and answers at once: making a picture takes the provider minutes. With reference images it edits them; a mask marks the part of the first to change. Read the job by its id; its pictures are kept for a day — save what you keep in your storage.
3718
5262
  */
3719
- putChatMember(input: {
3720
- path: {
3721
- chat_id: string; /** The user's id. */
3722
- user_id: string;
5263
+ createImage(input: {
5264
+ headers: {
5265
+ "Idempotency-Key": string;
3723
5266
  };
3724
- body: MemberRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5267
+ body: ImageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3725
5268
  signal?: AbortSignal;
3726
- }): Promise<Reply<200, Chat>>;
5269
+ }): Promise<Reply<202, Image>>;
3727
5270
  /**
3728
- * Take a user out of a chat
5271
+ * Read a picture job
3729
5272
  *
3730
- * The server takes anyone out; a user takes themselves out. A goal set as the member taken out is paused, and its turn at work stopped.
5273
+ * The job: running, its pictures, or why it failed.
3731
5274
  */
3732
- deleteChatMember(input: {
5275
+ getImage(input: {
3733
5276
  path: {
3734
- chat_id: string; /** The user's id. */
3735
- user_id: string;
5277
+ image_id: string;
3736
5278
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3737
5279
  signal?: AbortSignal;
3738
- }): Promise<Reply<204, undefined>>;
5280
+ }): Promise<Reply<200, Image>>;
3739
5281
  /**
3740
- * A chat's messages
5282
+ * Read a picture
3741
5283
  *
3742
- * What its members (and the server) wrote, the newest first.
5284
+ * The bytes of one picture of a finished job, with its media type.
3743
5285
  */
3744
- listChatMessages(input: {
5286
+ getImageFile(input: {
3745
5287
  path: {
3746
- chat_id: string;
3747
- };
3748
- query?: {
3749
- limit?: number; /** next_cursor of the page before. */
3750
- cursor?: string;
5288
+ image_id: string; /** The picture's place in the job, from 0. */
5289
+ position: number;
3751
5290
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3752
5291
  signal?: AbortSignal;
3753
- }): Promise<Reply<200, MessagePage>>;
5292
+ }): Promise<Reply<200, Response>>;
3754
5293
  /**
3755
- * Write to a chat
5294
+ * Delete a machine
3756
5295
  *
3757
- * A message for the agent: a turn of its own when none runs; while one does, at its next step (next) or cutting the step it is in (now). The same client_id again is the same message. A user sends user_messages_per_minute a minute — and so does the server writing as them (429 too_many_messages); past the history the project keeps a message is refused (409 history_full). It carries pictures of the project's storage the model is shown (images) and, in a chat that works in a workspace, files put in it before the agent reads the message (files), each copied for the chat.
5296
+ * A cordoned machine that holds no session leaves its pool; its agent (`palbase-agent`) is refused from then. One not cordoned: 409 machine_not_cordoned; one that holds a session: 409 machine_busy.
3758
5297
  */
3759
- sendChatMessage(input: {
5298
+ deleteMachine(input: {
3760
5299
  path: {
3761
- chat_id: string;
3762
- };
3763
- body: MessageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5300
+ machine: string;
5301
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3764
5302
  signal?: AbortSignal;
3765
- }): Promise<Reply<200, ChatMessage> | Reply<202, ChatMessage>>;
5303
+ }): Promise<Reply<204, undefined>>;
3766
5304
  /**
3767
- * A picture or a file a message carries
5305
+ * Cordon a machine
3768
5306
  *
3769
- * The bytes of a picture or a file a message of the chat carries, as it was sent (a download by its name, never a page): to the chat's members and its server. A position the message has nothing at is not found (404 attachment_not_found).
5307
+ * The machine takes no new session; the sessions it holds run on. Delete it once it holds none (its state says used 0).
3770
5308
  */
3771
- getChatMessageAttachment(input: {
5309
+ cordonMachine(input: {
3772
5310
  path: {
3773
- chat_id: string; /** The message. */
3774
- message_id: string; /** Its place among the message's attachments (its images, then its files), from 0. */
3775
- position: number;
5311
+ machine: string;
3776
5312
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3777
5313
  signal?: AbortSignal;
3778
- }): Promise<Reply<200, Response>>;
5314
+ }): Promise<Reply<204, undefined>>;
3779
5315
  /**
3780
- * The chat's past
5316
+ * Resume a machine
3781
5317
  *
3782
- * The chat's past as its stream told it, a page at a time from its newest end back: the members' messages, the turns, the answers as text at their offsets, the tools and the subagents, the goal's and the voice's words — each page in the order it was told, each part under the id its channel told it (part_id), so an app holding the channel's parts and a page of these keeps each once. A page reads limit of the chat's events before the cursor, or before the oldest part the app holds of the chat's channel (before: that part's id), so the first page does not read again the day the channel told; with neither, from its newest end. Given both, the call is refused (400). A page read by turns (turns=n) ends where the chat's n-th turn before the cursor (or the newest end) opens — a goal's turn at the goal's turn_started, any other at its start, the messages that began it right after — so turns=1 is the last turn whole, and its cursor's turns=1 the turn before; a page that would read more than 5000 of the chat's events ends there, its turns saying how many it opened, its cursor going on. The page that reaches the chat's start begins with where a fork began. A voice's end is under the id its channel told it (vclosed:<voice>); a voice the engine lost, its end said by no journal, has it right after its last part. Reading a page records nothing. A call's answer is by its end, as the stream shows it. Read by the chat's members and the project's server.
5318
+ * A cordoned machine takes sessions again.
3783
5319
  */
3784
- listChatParts(input: {
5320
+ resumeMachine(input: {
3785
5321
  path: {
3786
- chat_id: string;
3787
- };
3788
- query?: {
3789
- limit?: number; /** How many of the chat's turns the page reads back to (1 to 20): it ends where the last of them opens. Not with limit. */
3790
- turns?: number; /** A next_cursor: the page before it. Not with before. */
3791
- cursor?: string; /** The id of the oldest part the app holds of the chat's channel (a part's id: its journal sequence): the first page is the parts told before it. Not with cursor. */
3792
- before?: number;
5322
+ machine: string;
3793
5323
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3794
5324
  signal?: AbortSignal;
3795
- }): Promise<Reply<200, ChatPartPage>>;
5325
+ }): Promise<Reply<204, undefined>>;
3796
5326
  /**
3797
- * Pipe the chat into a channel
5327
+ * What a project may name
3798
5328
  *
3799
- * Writes the chat's stream into a channel of the project's realtime from now on — a gateway's, durable — as the platform: the members' messages, the turns, the answer as it is written (gathered into a few writes a second), the tools and subagents, each the channel's event `chat` {type, id?, data}, under an id of its own so a retry is kept once. The types: `message` (a ChatMessage, as the agent got it), `turn` ({response_id, status: running|waiting|completed|failed|canceled|timed_out|budget_exceeded, user_id, solo, goal: {goal_id, role: work|verify, seq} — a turn of the chat's goal, waiting: {reason: approval|tool_output|subagents|message, text_offset, approval_id, tool_call_id, tool_name, input, publication}, end: completed|failed|stopped|budget_exceeded — as the turn's event says it, error: {code, message, retryable}}), `text` ({response_id, offset, text}: the agent's answer as it is written, at its byte offset), `reset` ({response_id, offset}: discard the answer past offset), `thinking` ({response_id, run_id, step_id, text}: the model's reasoning as it thinks, when the agent shows it — thinking: visible), `tool` ({response_id, run_id, call_id, name, status: running|awaiting_output|awaiting_approval|approved|denied|expired|completed|failed|canceled, text_offset, input, output, image_count, is_error, approval_id, agent_response_id, …}), `agent` ({run_id, response_id, parent_response_id, name, required, status, text_offset}: a subagent at work), `advisor` ({response_id, run_id, seq, kind: step|final|ask, verdict: none|heads_up|answer|unreadable, rule, message, question, told}: the agent's advisor read its work — after a step, at its answer, which waits for it, or because the agent asked; told: the agent was told at its next step), `goal` ({goal_id, kind: set|updated|turn_started|judged|verified|status_changed|cleared, goal: {objective, rubric, status, stop_code, stop_reason, phase, max_turns, max_cost_usd}, role, seq, response_id, run_id, verdict, reason, missing, from, to, code}: the chat's goal's words), `voice` ({voice_id, user_id, delegation, status: started|closed, seconds, close_reason}: the chat's live voice began or ended), `transcript` ({id, voice_id, role: user|assistant, user_id, author_name, text, final, created_at}: a line it said either way — the chat's history's message of kind voice, by its id), `seen` (the journal moved past what was handed already), and — first, in a fork's channel — `history` ({forked_from: {chat_id, before_message}, part, parts, items: [{role: user|assistant, message_id, client_id, author, author_name, text, metadata, created_at, response_id, text_truncated, attachments}]}: what the fork began with, a few items a part, a long text cut in its part, its id h and the part's place). Every type but text and reset has the journal's sequence as its id; text_offset says where in the answer a tool or subagent part happened. The project's backend is not in the stream: the gateway's members hear the chat from realtime, and one that was away is given what it missed there. Put again with the same channel it goes on where it is — one realtime refused is tried again; with another, from the chat's start, and nothing more is written into the one before. The project's server's alone.
5329
+ * Every text model a turn may name (the default and a deprecated one marked), and the embedding and image models, with their list prices.
3800
5330
  */
3801
- putChatPipe(input: {
3802
- path: {
3803
- chat_id: string;
3804
- };
3805
- body: ChatPipe; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5331
+ listModels(input?: {
3806
5332
  signal?: AbortSignal;
3807
- }): Promise<Reply<200, ChatPipeResult>>;
5333
+ }): Promise<Reply<200, Models>>;
3808
5334
  /**
3809
- * Take the chat's pipe away
5335
+ * Revoke an enrolment key
3810
5336
  *
3811
- * The chat's stream is written nowhere from now on. The project's server's alone.
5337
+ * No machine enrols with it any more; the machines enrolled with it before are not touched (cordon and delete one: /ai/machines/{machine}).
3812
5338
  */
3813
- deleteChatPipe(input: {
5339
+ revokePoolKey(input: {
3814
5340
  path: {
3815
- chat_id: string;
5341
+ key: string;
3816
5342
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3817
5343
  signal?: AbortSignal;
3818
5344
  }): Promise<Reply<204, undefined>>;
3819
5345
  /**
3820
- * Write to a subagent at work
5346
+ * The project's runner pools
3821
5347
  *
3822
- * A message for one of the agent's subagents, at its next step: a message of the chat like any other — its writer's (or the member's the server writes as) messages a minute (429 too_many_messages), the history the project keeps (409 history_full).
5348
+ * Every pool of the project's, with what its machines hold: how many machines, the sessions they take and take now (capacity_total, capacity_used), and how many sessions wait for a place (waiting).
3823
5349
  */
3824
- sendSubagentMessage(input: {
3825
- path: {
3826
- chat_id: string; /** The subagent's run (an agent event's run_id). */
3827
- run_id: string;
3828
- };
3829
- body: RunMessageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5350
+ listPools(input?: {
3830
5351
  signal?: AbortSignal;
3831
- }): Promise<Reply<202, RunMessageAccepted>>;
5352
+ }): Promise<Reply<200, PoolList>>;
3832
5353
  /**
3833
- * Stop a subagent at work
5354
+ * Make a runner pool
3834
5355
  *
3835
- * Stops one subagent at work — with the subagents it started and its background work: the agent that started it is told a person stopped it, and not to start that work again unless asked, and the rest of the turn goes on. Any member stops it, as any member stops the turn, and the server — as itself, or as a member (as: the server's alone; a user sending it is answered 400; one who is not a member of the chat, 403 not_a_member). Asked again, the same stop answers as it did. A run that is not a subagent at work in this chat — ended, the agent itself, another chat's — is 404.
5356
+ * A pool of one type — its machines' operating system (linux or macos) and architecture (amd64 or arm64) — that the project's own machines enrol into with `palbase-agent` and a single-use key (POST /ai/pools/{pool}/keys). A chat that names it (POST /ai/chats {pool}) runs its workspace's sessions there. Managed through the API, the SDK and the CLI (palbase ai pools): the project scales it itself, reading its state (GET /ai/pools/{pool}/state). A name taken already: 409 pool_exists.
3836
5357
  */
3837
- stopSubagent(input: {
5358
+ createPool(input: {
5359
+ body: PoolRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5360
+ signal?: AbortSignal;
5361
+ }): Promise<Reply<201, Pool>>;
5362
+ /**
5363
+ * Delete a runner pool
5364
+ *
5365
+ * A pool with no machine left in it: cordon each machine, delete it once it holds no session (DELETE /ai/machines/{machine}), then the pool. One with machines: 409 pool_not_empty.
5366
+ */
5367
+ deletePool(input: {
3838
5368
  path: {
3839
- chat_id: string; /** The subagent's run (an agent event's run_id). */
3840
- run_id: string;
3841
- };
3842
- body?: RunStopRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5369
+ pool: string;
5370
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3843
5371
  signal?: AbortSignal;
3844
- }): Promise<Reply<200, RunStopped>>;
5372
+ }): Promise<Reply<204, undefined>>;
3845
5373
  /**
3846
- * Stop the agent
5374
+ * A pool's enrolment keys
3847
5375
  *
3848
- * Stops the turn it is working on: what it wrote stays; a message it had not read yet, and a message after, starts the next turn. Any member's; the server's as itself, or as a member (as).
5376
+ * Its single-use enrolment keys — when each was made, used, revoked, and when it expires — none of them said again.
3849
5377
  */
3850
- stopChat(input: {
5378
+ listPoolKeys(input: {
3851
5379
  path: {
3852
- chat_id: string;
3853
- };
3854
- body?: ChatStop; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5380
+ pool: string;
5381
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3855
5382
  signal?: AbortSignal;
3856
- }): Promise<Reply<200, StopResult>>;
5383
+ }): Promise<Reply<200, PoolKeyList>>;
3857
5384
  /**
3858
- * A turn's tool calls
5385
+ * Mint an enrolment key
3859
5386
  *
3860
- * A turn's tool calls as the engine committed them — their arguments and results as they were (what a diff of the files the turn wrote is made of), in their order, a page at a time. The project's server's alone; a subagent's work is read by its response (an agent part's response_id).
5387
+ * A single-use key a machine of the project's enrols into the pool with (saved to a file on the machine: `palbase-agent enroll --key-file <file> --capacity <n>` — never on a command line), said once, here. A machine enrolled with it serves the project's sessions once whoever minted it is gone: never minted for an environment's token.
3861
5388
  */
3862
- listTurnToolCalls(input: {
5389
+ createPoolKey(input: {
3863
5390
  path: {
3864
- chat_id: string;
5391
+ pool: string;
3865
5392
  };
3866
- query: {
3867
- turn: string; /** How many calls a page holds (1 to 500; 100). */
3868
- limit?: number; /** A next_cursor: the page after it. */
3869
- cursor?: string;
3870
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5393
+ body: PoolKeyRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3871
5394
  signal?: AbortSignal;
3872
- }): Promise<Reply<200, TurnToolCallPage>>;
5395
+ }): Promise<Reply<201, PoolKey>>;
3873
5396
  /**
3874
- * A tool call of the chat, whole
5397
+ * A runner pool's state
3875
5398
  *
3876
- * One tool call of the chat, its whole answer: the chat's stream shows a call's answer by its end (its last 16 KiB, omitted_bytes what it left out) — read here whole, its secret shapes masked as the stream masks them. Read by the chat's members and the project's server; another chat's call is not found.
5399
+ * What the project's own scaling loop reads — no webhook tells it: each machine (online, offline or cordoned; the sessions it takes and holds; since when it is idle; when it was last seen), the pool's capacity and what it holds, how many sessions wait for a place and since when the oldest has waited. Scale up by enrolling machines; scale down by cordoning one (it takes no new session) and deleting it once it holds none.
3877
5400
  */
3878
- getChatToolCall(input: {
5401
+ getPoolState(input: {
3879
5402
  path: {
3880
- chat_id: string; /** The call: a tool part's call_id. */
3881
- call_id: string;
5403
+ pool: string;
3882
5404
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3883
5405
  signal?: AbortSignal;
3884
- }): Promise<Reply<200, ChatToolCall>>;
5406
+ }): Promise<Reply<200, PoolState>>;
3885
5407
  /**
3886
- * Answer an app's tool call
5408
+ * The project's own provider keys
3887
5409
  *
3888
- * The answer of a client tool's call, made by the app's code: the turn waiting for it goes on. The first answer is the one. Given by the app of the member whose message began the turn (403 not_your_turn for any other) — or by the project's server, for any turn, or as that member (as). A call of the project's backend (or an HTTPS tool of its) that answered {"deferred": true} — its work outlasts a call — is answered here too, by the project's server as itself, within the while it named (a minute to a day; an hour), and by no member. An answer whose tool wrote the chat's workspace names the tree its writes left (workspace_tree), as an answer given at once does: the agent's next command waits for the session's machine to have it (400 for one that names no tree).
5410
+ * The providers the project connected with its own key. A key is never read back.
3889
5411
  */
3890
- answerChatToolCall(input: {
3891
- path: {
3892
- chat_id: string; /** The tool call (a tool event's call_id). */
3893
- call_id: string;
3894
- };
3895
- body: ToolOutput; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5412
+ listProviders(input?: {
3896
5413
  signal?: AbortSignal;
3897
- }): Promise<Reply<200, ToolOutputAccepted>>;
5414
+ }): Promise<Reply<200, ProviderList>>;
3898
5415
  /**
3899
- * A turn's artifacts
5416
+ * Use the project's own provider key
3900
5417
  *
3901
- * What the turn's agent published as its output (palbase.artifact.publish) — a build's product, a screenshot, a report — kept in the project's own storage. The chat's members and the project's server read it, as they read the chat.
5418
+ * From now on every call that goes to this provider goes out with the project's own key and is billed by the provider to the project. The key is shown to the provider before it is kept: one the provider refuses is not kept.
3902
5419
  */
3903
- listChatTurnArtifacts(input: {
5420
+ connectProvider(input: {
3904
5421
  path: {
3905
- chat_id: string; /** The turn: a message's response_id, or a turn event's. */
3906
- response_id: string;
3907
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5422
+ provider: string;
5423
+ };
5424
+ body: ProviderKey; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3908
5425
  signal?: AbortSignal;
3909
- }): Promise<Reply<200, TurnArtifacts>>;
5426
+ }): Promise<Reply<200, Provider>>;
3910
5427
  /**
3911
- * An artifact of a turn
5428
+ * Stop using the project's own provider key
3912
5429
  *
3913
- * One artifact of the turn, its bytes as the agent published them (an attachment, never a page). One the turn did not publish is not found (404 artifact_not_found).
5430
+ * The key is removed; calls to this provider go out with the platform's connection again.
3914
5431
  */
3915
- getChatTurnArtifact(input: {
5432
+ disconnectProvider(input: {
3916
5433
  path: {
3917
- chat_id: string; /** The turn: a message's response_id, or a turn event's. */
3918
- response_id: string; /** The artifact: an id of the turn's artifacts. */
3919
- artifact_id: string;
5434
+ provider: string;
3920
5435
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3921
5436
  signal?: AbortSignal;
3922
- }): Promise<Reply<200, Response>>;
5437
+ }): Promise<Reply<204, undefined>>;
3923
5438
  /**
3924
- * What a turn of a chat cost
5439
+ * Ask a model
3925
5440
  *
3926
- * What a turn of the chat cost so far, its subagents' calls counted — while it runs too (final false) — or what one subagent's work in it cost (an agent event's response_id). The project's server's: a member's key is refused (403 server_only).
5441
+ * Admits a response: an answer to the input, as text or — with a schema — as a JSON document of that shape, validated before it is returned. With stream: true the answer is the response's live view (text/event-stream). With background: true it answers at once and the response's end is the event ai.response.completed (or ai.response.failed). Otherwise it answers at once with the response queued; read it by its id. What the agent is given — its instructions, the conversation, the schema and the tools together — is at most 1 MiB as JSON, what the model service reads (413 request_too_large).
3927
5442
  */
3928
- getChatTurnCost(input: {
3929
- path: {
3930
- chat_id: string; /** The turn: a message's response_id, or a turn event's. */
3931
- response_id: string;
3932
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5443
+ createResponse(input: {
5444
+ headers: {
5445
+ "Idempotency-Key": string;
5446
+ };
5447
+ body: ResponseRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3933
5448
  signal?: AbortSignal;
3934
- }): Promise<Reply<200, TurnCost>>;
5449
+ }): Promise<Reply<200, Response> | Reply<202, Response>>;
3935
5450
  /**
3936
- * Start a chat's voice
5451
+ * Read a response
3937
5452
  *
3938
- * Starts the chat's live voice: the app's WebRTC offer in, the answer out — the audio then goes between the app and the platform's voice provider. The voice is its member's — the user who starts it, or the member the server starts it for (as): they or the server read, tell and close it, no other member. What the person asks for out loud becomes, by delegation, a turn of the chat as that member whose answer the voice says back (chat, the default), or the event ai.voice.delegated (events). What is said either way is the chat's: transcript parts of its stream and lines of its history (messages of kind voice). One voice talks in a chat at a time: a member's new voice ends the one they left open (closed replaced); another member's live voice is refused (409 voice_active). A user starts at most 5 voices an hour in the project's chats, the server's for them counted as theirs (429 too_many_voices, with Retry-After) — each is the project's spend while it lasts. Its start is the event ai.voice.started.
5453
+ * A response as it stands: its status, and at its end its answer, its use and — when it did not complete — why.
3939
5454
  */
3940
- startChatVoice(input: {
5455
+ getResponse(input: {
3941
5456
  path: {
3942
- chat_id: string;
3943
- };
3944
- body: VoiceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5457
+ response_id: string;
5458
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3945
5459
  signal?: AbortSignal;
3946
- }): Promise<Reply<201, VoiceSession>>;
5460
+ }): Promise<Reply<200, Response>>;
3947
5461
  /**
3948
- * Read a chat's voice
5462
+ * Stop a response
3949
5463
  *
3950
- * The chat's voice: whose it is, whether it is live, how long it has lasted and why it ended — read from the engine while it is live. Its member's, or the server's (403 not_your_voice).
5464
+ * Asks the model service to stop the response; it ends canceled, and what it used until then is recorded.
3951
5465
  */
3952
- getChatVoice(input: {
5466
+ cancelResponse(input: {
3953
5467
  path: {
3954
- chat_id: string; /** The voice session. */
3955
- voice_id: string;
3956
- };
3957
- query?: {
3958
- as?: string;
5468
+ response_id: string;
3959
5469
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3960
5470
  signal?: AbortSignal;
3961
- }): Promise<Reply<200, VoiceSession>>;
5471
+ }): Promise<Reply<200, Response>>;
3962
5472
  /**
3963
- * Close a chat's voice
5473
+ * Follow a response as it is produced
3964
5474
  *
3965
- * Ends the chat's voice; the answer says how long it lasted and why it ended. Its member's, or the server's (403 not_your_voice). Its end is the event ai.voice.closed — once.
5475
+ * The response's live view from a byte offset of its answer: every fragment as the model produces it, then the response at its end. A finished response answers its terminal at once.
3966
5476
  */
3967
- closeChatVoice(input: {
5477
+ followResponse(input: {
3968
5478
  path: {
3969
- chat_id: string; /** The voice session. */
3970
- voice_id: string;
5479
+ response_id: string;
3971
5480
  };
3972
5481
  query?: {
3973
- as?: string;
5482
+ offset?: number;
3974
5483
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3975
5484
  signal?: AbortSignal;
3976
- }): Promise<Reply<200, VoiceSession>>;
5485
+ }): Promise<Reply<200, Response>>;
3977
5486
  /**
3978
- * Tell a chat's voice
5487
+ * What the project allows its chats
3979
5488
  *
3980
- * The server's alone (a member is answered 403 server_only), as itself or as the voice's member (as; another member 403 not_your_voice): a member's words would be the agent's own to every other member of the chat. Gives the chat's voice text: speak says it, know keeps it in mind, instruct changes how it behaves — speak with a delegation_id answers a request it handed over (ai.voice.delegated). A voice that has ended is 409 voice_closed.
5489
+ * Whether its app's users talk to its agents themselves, how many messages one sends a minute, how much history it keeps, its monthly budget, and whether its app's users' work has its open secrets.
3981
5490
  */
3982
- commandChatVoice(input: {
3983
- path: {
3984
- chat_id: string; /** The voice session. */
3985
- voice_id: string;
3986
- };
3987
- body: VoiceCommand; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5491
+ getSettings(input?: {
3988
5492
  signal?: AbortSignal;
3989
- }): Promise<Reply<202, VoiceSession>>;
5493
+ }): Promise<Reply<200, Settings>>;
3990
5494
  /**
3991
- * Turn texts into vectors
5495
+ * Change what the project allows its chats
3992
5496
  *
3993
- * One vector per text, in the order of the input. Up to 1,024 texts per request — a longer list is several requests, and the SDK cuts it; the platform splits a request over the provider's own limits.
5497
+ * A field left out is left as it is. The history kept may be lowered, not raised past the plan's. A monthly budget is kept by Palbase's billing: on a stack that bills no AI it is refused (409 no_billing).
3994
5498
  */
3995
- createEmbeddings(input: {
3996
- body: EmbeddingsRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5499
+ putSettings(input: {
5500
+ body: SettingsRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3997
5501
  signal?: AbortSignal;
3998
- }): Promise<Reply<200, Embeddings>>;
5502
+ }): Promise<Reply<200, Settings>>;
3999
5503
  /**
4000
- * The project's tool endpoints
5504
+ * What the project's AI on Palbase's models costs this month
4001
5505
  *
4002
- * Its HTTPS tools and MCP servers, by name (their secrets are not said again). To an environment's token each url is shown only where it is — its scheme, its host and its path's first segment — and the rest of its path, its query and its fragment each as ***: an MCP server's or a tool's key may be anywhere after the host, and an agent is not shown again a secret it did not just set (the answer to its own PUT shows it so too). A person and the project's key see each url whole.
5506
+ * The month's spend on Palbase's models at what it is billed, the free dollar a month brings and what is left of it, the monthly budget, and whether Palbase's models serve the project now — and if not, why.
4003
5507
  */
4004
- listEndpoints(input?: {
5508
+ getSpend(input?: {
4005
5509
  signal?: AbortSignal;
4006
- }): Promise<Reply<200, EndpointList>>;
5510
+ }): Promise<Reply<200, Spend>>;
4007
5511
  /**
4008
- * Put a tool endpoint
5512
+ * Ask Palbase's support line
4009
5513
  *
4010
- * A tool at an HTTPS address of the project's — called with a signed POST {tool, call_id, input, context: {chat_id, agent, user, metadata, turn_id, run_id, subagent, workspace} — the turn, the run that called: the agent's own, or a subagent's at work (subagent names which, null for the agent), and, in a chat that works in a workspace, the workspace as the session last wrote it, flushed before the call: workspace {chat_id, manifest_id, seq} (read its files at that tree, GET /ai/chats/{chat_id}/workspace/files?manifest=)} — and answered {output, is_error, workspace_tree?} or plain text: a tool that wrote the workspace (PUT /ai/chats/{chat_id}/workspace/files) answers workspace_tree {manifest_id, seq} — the tree its writes left, either or both — and the agent's next command sees it — or an MCP server, whose tools an agent may use: when the project says it is its own (workspace: true), told the same tree in its tools/call's _meta (palbase/workspace), answering it in its result's _meta (palbase/workspace_tree); a third party's server is told nothing of a chat or its workspace. The answer says an https tool's signing secret, once.
5514
+ * A question about Palbase — its SDKs, its backend framework, its CLI, its platform — answered by a model the platform pays for, from Palbase's documentation and what the asker's project shows (context: the CLI sends its machines, their last builds and a failed build's log). When the answer finds Palbase short of what was asked, the case is logged (logged: true) and the asker is mailed when it is fixed; what was logged is Palbase's own and is not named. It is a person's (a project admin's session or token, or an environment's token narrowed to the support scope: 403 person_required for the secret key), and it is bounded (429 too_many_questions): 30 an hour by a person across their projects, 60 by a project's people — and the platform's day (429 support_paused).
4011
5515
  */
4012
- putEndpoint(input: {
4013
- path: {
4014
- name: string;
4015
- };
4016
- body: EndpointRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5516
+ askSupport(input: {
5517
+ body: SupportQuestion; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4017
5518
  signal?: AbortSignal;
4018
- }): Promise<Reply<200, Endpoint>>;
5519
+ }): Promise<Reply<200, SupportAnswer>>;
4019
5520
  /**
4020
- * Forget a tool endpoint
5521
+ * The tools an agent may be given
4021
5522
  *
4022
- * An agent naming it can no longer start a turn until it is put again.
5523
+ * The backend's tools (each one the build its machine serves declares: its contract's x-palbase-ai-tools), the project's endpoints, and the platform's.
4023
5524
  */
4024
- deleteEndpoint(input: {
4025
- path: {
4026
- name: string;
4027
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5525
+ listTools(input?: {
4028
5526
  signal?: AbortSignal;
4029
- }): Promise<Reply<204, undefined>>;
5527
+ }): Promise<Reply<200, ToolList>>;
4030
5528
  /**
4031
- * The project's variables
5529
+ * What the project's use of models cost
4032
5530
  *
4033
- * Their names, whether each is a secret, the hosts a secret may go to, where it may be put, whether it is open, and when each was set: never a value.
5531
+ * Every use, newest first: a response's tokens, an embeddings call, a picture job — with its cost at the provider's list price and whose connection paid. A use under the project's own key is billed by the provider, not by Palbase.
4034
5532
  */
4035
- listEnv(input?: {
5533
+ listUsage(input?: {
5534
+ query?: {
5535
+ limit?: number; /** The next_cursor of the previous page. */
5536
+ cursor?: string; /** Only uses of this kind: text, embedding or image. */
5537
+ kind?: "text" | "embedding" | "image" | "video" | "stt" | "tts" | "voice" | "web_search" | "machine"; /** Labels each use listed carries, as a JSON object ({"product":"p1"}): a product's spend, a task's. */
5538
+ metadata?: string;
5539
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4036
5540
  signal?: AbortSignal;
4037
- }): Promise<Reply<200, EnvList>>;
5541
+ }): Promise<Reply<200, UsagePage>>;
4038
5542
  /**
4039
- * The agents' secrets' allowances
5543
+ * OpenAI-compatible text-to-speech
4040
5544
  *
4041
- * The hosts the project's agents' own secrets are allowed beside their definitions': each an owner's Allow of an ask, newest first (500 at most), with whose agent (origin) and the host's registrable domain. A new value keeps them. One goes with its key: an agent the project keeps, once neither its draft nor its version published has the key (deleted, every one); a chat's own definition, with the last chat whose definition has it; a backend's agent, after 30 days with no turn.
5545
+ * Streams synthesized audio via OpenAI or ElevenLabs.
4042
5546
  */
4043
- listEnvAllowances(input?: {
5547
+ gatewayAudioSpeech(input: {
5548
+ body: SpeechRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4044
5549
  signal?: AbortSignal;
4045
- }): Promise<Reply<200, SecretHostAllowanceList>>;
5550
+ }): Promise<Reply<200, Response>>;
4046
5551
  /**
4047
- * Take an allowance away
5552
+ * OpenAI-compatible audio transcription
4048
5553
  *
4049
- * The host taken away from the agent's secret: an ask for it is asked again. A person's alone: an owner or an admin of the organization signed in, never a key or a token, the secret key included (403 person_required; an environment's token, token_out_of_scope).
5554
+ * Transcribes audio via OpenAI or Deepgram.
4050
5555
  */
4051
- deleteEnvAllowance(input: {
4052
- path: {
4053
- allowance_id: string;
4054
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5556
+ gatewayAudioTranscriptions(input: {
5557
+ body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4055
5558
  signal?: AbortSignal;
4056
- }): Promise<Reply<204, undefined>>;
5559
+ }): Promise<Reply<200, GatewayJSON>>;
4057
5560
  /**
4058
- * The hosts the project's secrets asked for
5561
+ * OpenAI-compatible chat completions
4059
5562
  *
4060
- * The hosts the project's sealed secrets were sent to that they are not allowed for: each secret and host once, with how many times, newest first — its host and the registrable domain it is under (an Allow hands the secret to whoever holds that domain), and whose secret it is (a project variable, or an agent's own of an origin). The project's owners are emailed a link at most once a day for each, at most 3 a day for one secret and 10 a project a day, counted where no ask lowers the count. A project keeps 500 asked, 50 of them a secret and 100 an agent's own secrets: an ask past one forgets an asked one alone — the secret's own oldest, else the oldest of the secret that holds the most, the one asked last among equals — never a dismissed or an allowed one; it keeps 500 dismissed and 500 allowed, a decision past them forgetting the oldest of its kind. A variable removed takes its asks with it, and a key that leaves an agent its own.
5563
+ * Routes to any direct-to-source text model in fast stateless mode or stateful single-engine mode when X-Palbase-Session-Id is provided.
4061
5564
  */
4062
- listEnvHostRequests(input?: {
4063
- query?: {
4064
- status?: "asked" | "allowed" | "dismissed";
4065
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5565
+ gatewayChatCompletions(input: {
5566
+ body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4066
5567
  signal?: AbortSignal;
4067
- }): Promise<Reply<200, SecretHostRequestList>>;
5568
+ }): Promise<Reply<200, GatewayJSON>>;
4068
5569
  /**
4069
- * Allow an ask
5570
+ * OpenAI-compatible embeddings
4070
5571
  *
4071
- * The owner's Allow, for any ask: its host is added to the variable's hosts (one of the project's), or to the agent's allowances (an agent's own secret: GET /ai/env/allowances), and the asks it now allows are marked allowed. A person's alone: an owner or an admin of the organization signed in, never a key or a token, the secret key included (403 person_required; an environment's token, token_out_of_scope).
5572
+ * Generates text embeddings across OpenAI, Google Gemini, Mistral, and Fireworks.
4072
5573
  */
4073
- allowEnvHostRequest(input: {
4074
- path: {
4075
- request_id: string;
4076
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5574
+ gatewayEmbeddings(input: {
5575
+ body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4077
5576
  signal?: AbortSignal;
4078
- }): Promise<Reply<200, SecretHostRequest>>;
5577
+ }): Promise<Reply<200, GatewayJSON>>;
4079
5578
  /**
4080
- * Dismiss an ask
5579
+ * OpenAI-compatible image generation
4081
5580
  *
4082
- * The owner's Dismiss: the ask is never told again (it is still counted). One allowed is not undone here: its host is the secret's (PUT /ai/env/{key} with hosts, or DELETE /ai/env/allowances/{allowance_id}, takes it away) — 409 already_allowed. A person's alone: an owner or an admin of the organization signed in, never a key or a token, the secret key included (403 person_required; an environment's token, token_out_of_scope).
5581
+ * Generates images across OpenAI, Google Imagen, and Black Forest Labs Flux.
4083
5582
  */
4084
- dismissEnvHostRequest(input: {
4085
- path: {
4086
- request_id: string;
4087
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5583
+ gatewayImagesGenerations(input: {
5584
+ body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4088
5585
  signal?: AbortSignal;
4089
- }): Promise<Reply<200, SecretHostRequest>>;
5586
+ }): Promise<Reply<200, GatewayJSON>>;
4090
5587
  /**
4091
- * Set a variable
5588
+ * Anthropic-compatible messages
4092
5589
  *
4093
- * One of the project's variables or secrets, set or set anew: every command of every session of its agents begun from now has it — on the platform's Linux machines and on the project's own pools, Linux and Mac — beside the agent's own (its definition's env), masked wherever a transcript would show it. The value is sealed where the sessions run and never answered, nor logged; a refusal never repeats it. A secret also says where it may go (hosts), where in a request it may be put (inject) and whether the agent reads it as it is (open); a field left out keeps what the variable has. A write that carries the value says them as its caller's role allows. A variable set before may leave out its value to change them alone (404 for one never set): a person's change only — an owner or an admin of the organization signed in, never a key or a token, the secret key included (403 person_required). open: true, and a secret made no secret, need acknowledge_open: true (400 open_not_acknowledged); a variable that stays no secret is refused hosts, inject and open (409 not_a_secret). A sealed value is at least 8 bytes with no line break or NUL (400 secret_unusable), and one a person may have chosen (fewer than 16 characters, or one kind of character only) needs acknowledge_guessable: true (400 secret_guessable) — the request's own value is judged, never one kept: an open secret or a variable that is no secret made sealed takes its value in the same request (400 value_required). A sealed secret is a placeholder in a session: the proxy beside the machine puts the value in only on a request to one of its hosts, and a machine with no proxy beside it (a Mac, or a Linux machine whose agent does not run it) gets no sealed secret.
5590
+ * Anthropic Messages wire routing to any direct-to-source text model in fast stateless mode or stateful single-engine mode.
4094
5591
  */
4095
- putEnv(input: {
4096
- path: {
4097
- key: string;
4098
- };
4099
- body: EnvRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5592
+ gatewayAnthropicMessages(input: {
5593
+ body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4100
5594
  signal?: AbortSignal;
4101
- }): Promise<Reply<200, EnvVar>>;
5595
+ }): Promise<Reply<200, GatewayJSON>>;
4102
5596
  /**
4103
- * Remove a variable
5597
+ * List live models (OpenAI-compatible)
4104
5598
  *
4105
- * Sessions begun from now no longer have it.
5599
+ * Returns the live DB-backed model catalog in OpenAI-compatible list format.
4106
5600
  */
4107
- deleteEnv(input: {
4108
- path: {
4109
- key: string;
5601
+ gatewayListModels(input?: {
5602
+ query?: {
5603
+ modality?: "text" | "embedding" | "image" | "video" | "stt" | "tts" | "voice_live";
5604
+ vendor?: string;
5605
+ include_deprecated?: boolean;
4110
5606
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4111
5607
  signal?: AbortSignal;
4112
- }): Promise<Reply<204, undefined>>;
5608
+ }): Promise<Reply<200, GatewayJSON>>;
4113
5609
  /**
4114
- * Allow a secret a host
5610
+ * OpenAI Responses wire
4115
5611
  *
4116
- * The owner's Allow, for one of the project's variables: the host is added to a sealed secret's hosts (32 at most), and the asks it now allows are marked allowed. A sealed secret sent to it from the proxy's next renewal carries the value. Allow only a host you know the secret belongs to: an agent can be led to send a secret anywhere. A person's alone: an owner or an admin of the organization signed in, never a key or a token, the secret key included (403 person_required; an environment's token, token_out_of_scope).
5612
+ * Routes OpenAI Responses requests directly through Palbase single engine.
4117
5613
  */
4118
- allowEnvHost(input: {
4119
- path: {
4120
- key: string;
4121
- };
4122
- body: EnvHostRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5614
+ gatewayResponses(input: {
5615
+ body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4123
5616
  signal?: AbortSignal;
4124
- }): Promise<Reply<200, EnvVar>>;
5617
+ }): Promise<Reply<200, GatewayJSON>>;
4125
5618
  /**
4126
- * List runtime environments
5619
+ * Start an asynchronous video generation job
4127
5620
  *
4128
- * Lists the project's configured runtime environments ordered by name.
5621
+ * Starts a durable asynchronous video generation job on Google Veo or Kling.
4129
5622
  */
4130
- listEnvironments(input?: {
5623
+ createVideo(input: {
5624
+ body: VideoRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4131
5625
  signal?: AbortSignal;
4132
- }): Promise<Reply<200, EnvironmentList>>;
5626
+ }): Promise<Reply<202, VideoJob>>;
4133
5627
  /**
4134
- * Create a runtime environment
5628
+ * Read a video generation job
4135
5629
  *
4136
- * Creates a new runtime environment (ephemeral or always_on) for the project.
5630
+ * Returns the status, output URL, storage path, and billed cost of a video job.
4137
5631
  */
4138
- createEnvironment(input: {
4139
- body: EnvironmentRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5632
+ getVideo(input: {
5633
+ path: {
5634
+ video_id: string;
5635
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4140
5636
  signal?: AbortSignal;
4141
- }): Promise<Reply<201, Environment>>;
5637
+ }): Promise<Reply<200, VideoJob>>;
4142
5638
  /**
4143
- * Get a runtime environment
5639
+ * Cancel a running video generation job
4144
5640
  *
4145
- * Returns a single runtime environment by name.
5641
+ * Cancels a queued or running video job.
4146
5642
  */
4147
- getEnvironment(input: {
5643
+ cancelVideo(input: {
4148
5644
  path: {
4149
- name: string;
5645
+ video_id: string;
4150
5646
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4151
5647
  signal?: AbortSignal;
4152
- }): Promise<Reply<200, Environment>>;
5648
+ }): Promise<Reply<200, VideoCancelResult>>;
4153
5649
  /**
4154
- * Create or update a runtime environment
5650
+ * List triggers
4155
5651
  *
4156
- * Upserts a runtime environment by name.
5652
+ * List all triggers configured for this project.
4157
5653
  */
4158
- putEnvironment(input: {
4159
- path: {
4160
- name: string;
4161
- };
4162
- body: EnvironmentRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5654
+ listTriggers(input?: {
4163
5655
  signal?: AbortSignal;
4164
- }): Promise<Reply<200, Environment>>;
5656
+ }): Promise<Reply<200, TriggerListResponse>>;
4165
5657
  /**
4166
- * Delete a runtime environment
5658
+ * Create a trigger
4167
5659
  *
4168
- * Deletes a runtime environment and its build records.
5660
+ * Create a declarative cron, platform event, or HMAC-signed webhook trigger.
4169
5661
  */
4170
- deleteEnvironment(input: {
4171
- path: {
4172
- name: string;
4173
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5662
+ createTrigger(input: {
5663
+ body: TriggerCreateRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4174
5664
  signal?: AbortSignal;
4175
- }): Promise<Reply<204, undefined>>;
5665
+ }): Promise<Reply<201, TriggerCreated>>;
4176
5666
  /**
4177
- * Queue an environment build
5667
+ * Get a trigger
4178
5668
  *
4179
- * Queues a new immutable pre-bake build for the named environment.
5669
+ * Fetch a single trigger by its identifier.
4180
5670
  */
4181
- createEnvironmentBuild(input: {
5671
+ getTrigger(input: {
4182
5672
  path: {
4183
- name: string;
5673
+ trigger_id: string;
4184
5674
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4185
5675
  signal?: AbortSignal;
4186
- }): Promise<Reply<201, EnvironmentBuild>>;
5676
+ }): Promise<Reply<200, Trigger>>;
4187
5677
  /**
4188
- * Get an environment build
5678
+ * Delete a trigger
4189
5679
  *
4190
- * Returns the status and metadata of a specific environment build.
5680
+ * Delete a trigger and cancel any pending cron schedule for it.
4191
5681
  */
4192
- getEnvironmentBuild(input: {
5682
+ deleteTrigger(input: {
4193
5683
  path: {
4194
- name: string; /** The build's identifier. */
4195
- build_id: string;
5684
+ trigger_id: string;
4196
5685
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4197
5686
  signal?: AbortSignal;
4198
- }): Promise<Reply<200, EnvironmentBuild>>;
5687
+ }): Promise<Reply<204, undefined>>;
4199
5688
  /**
4200
- * Make pictures
5689
+ * Update a trigger
4201
5690
  *
4202
- * Starts a picture job and answers at once: making a picture takes the provider minutes. With reference images it edits them; a mask marks the part of the first to change. Read the job by its id; its pictures are kept for a day — save what you keep in your storage.
5691
+ * Update a trigger's schedule, filter, prompt template, limits, or enabled state.
4203
5692
  */
4204
- createImage(input: {
4205
- headers: {
4206
- "Idempotency-Key": string;
5693
+ updateTrigger(input: {
5694
+ path: {
5695
+ trigger_id: string;
4207
5696
  };
4208
- body: ImageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5697
+ body: TriggerPatchRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4209
5698
  signal?: AbortSignal;
4210
- }): Promise<Reply<202, Image>>;
5699
+ }): Promise<Reply<200, Trigger>>;
4211
5700
  /**
4212
- * Read a picture job
5701
+ * Dry-run or test-fire a trigger
4213
5702
  *
4214
- * The job: running, its pictures, or why it failed.
5703
+ * Evaluate a trigger's filter and render its prompt template with sample payload; optionally fire it.
4215
5704
  */
4216
- getImage(input: {
5705
+ testTrigger(input: {
4217
5706
  path: {
4218
- image_id: string;
4219
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5707
+ trigger_id: string;
5708
+ };
5709
+ body?: TriggerTestRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4220
5710
  signal?: AbortSignal;
4221
- }): Promise<Reply<200, Image>>;
5711
+ }): Promise<Reply<200, TriggerTestResponse>>;
4222
5712
  /**
4223
- * Read a picture
5713
+ * Invoke a signed webhook trigger
4224
5714
  *
4225
- * The bytes of one picture of a finished job, with its media type.
5715
+ * Public webhook trigger endpoint authenticated with Palbase-Signature HMAC-SHA256 and anti-replay timestamp check.
4226
5716
  */
4227
- getImageFile(input: {
5717
+ invokeTriggerWebhook(input: {
4228
5718
  path: {
4229
- image_id: string; /** The picture's place in the job, from 0. */
4230
- position: number;
4231
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5719
+ trigger_id: string;
5720
+ };
5721
+ body?: TriggerWebhookPayload; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4232
5722
  signal?: AbortSignal;
4233
- }): Promise<Reply<200, Response>>;
5723
+ }): Promise<Reply<202, TriggerWebhookResponse>>;
4234
5724
  /**
4235
- * Delete a machine
5725
+ * List waits
4236
5726
  *
4237
- * A cordoned machine that holds no session leaves its pool; its agent (`palbase-agent`) is refused from then. One not cordoned: 409 machine_not_cordoned; one that holds a session: 409 machine_busy.
5727
+ * List zero-compute durable waits for this project, optionally filtered by status or owner.
4238
5728
  */
4239
- deleteMachine(input: {
4240
- path: {
4241
- machine: string;
5729
+ listWaits(input?: {
5730
+ query?: {
5731
+ status?: string; /** Filter by owner identifier */
5732
+ owner_id?: string;
4242
5733
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4243
5734
  signal?: AbortSignal;
4244
- }): Promise<Reply<204, undefined>>;
5735
+ }): Promise<Reply<200, WaitListResponse>>;
4245
5736
  /**
4246
- * Cordon a machine
5737
+ * Get a wait
4247
5738
  *
4248
- * The machine takes no new session; the sessions it holds run on. Delete it once it holds none (its state says used 0).
5739
+ * Fetch a single zero-compute durable wait by identifier.
4249
5740
  */
4250
- cordonMachine(input: {
5741
+ getWait(input: {
4251
5742
  path: {
4252
- machine: string;
5743
+ wait_id: string;
4253
5744
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4254
5745
  signal?: AbortSignal;
4255
- }): Promise<Reply<204, undefined>>;
5746
+ }): Promise<Reply<200, Wait>>;
4256
5747
  /**
4257
- * Resume a machine
5748
+ * Resume a wait with a signal payload
4258
5749
  *
4259
- * A cordoned machine takes sessions again.
5750
+ * Deliver an external signal payload to resume a parked zero-compute wait.
4260
5751
  */
4261
- resumeMachine(input: {
5752
+ signalWait(input: {
4262
5753
  path: {
4263
- machine: string;
4264
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5754
+ wait_id: string;
5755
+ };
5756
+ body?: WaitSignalRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4265
5757
  signal?: AbortSignal;
4266
- }): Promise<Reply<204, undefined>>;
5758
+ }): Promise<Reply<200, Wait>>;
4267
5759
  /**
4268
- * What a project may name
5760
+ * Cancel a wait
4269
5761
  *
4270
- * Every text model a turn may name (the default and a deprecated one marked), and the embedding and image models, with their list prices.
5762
+ * Cancel an open zero-compute wait and notify its waiting run.
4271
5763
  */
4272
- listModels(input?: {
5764
+ cancelWait(input: {
5765
+ path: {
5766
+ wait_id: string;
5767
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4273
5768
  signal?: AbortSignal;
4274
- }): Promise<Reply<200, Models>>;
5769
+ }): Promise<Reply<200, Wait>>;
4275
5770
  /**
4276
- * Revoke an enrolment key
5771
+ * List durable workflow runs
4277
5772
  *
4278
- * No machine enrols with it any more; the machines enrolled with it before are not touched (cordon and delete one: /ai/machines/{machine}).
5773
+ * List recent durable workflow runs for this project.
4279
5774
  */
4280
- revokePoolKey(input: {
4281
- path: {
4282
- key: string;
5775
+ listWorkflowRuns(input?: {
5776
+ query?: {
5777
+ workflow_name?: string; /** Filter by workflow run status */
5778
+ status?: string;
4283
5779
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4284
5780
  signal?: AbortSignal;
4285
- }): Promise<Reply<204, undefined>>;
5781
+ }): Promise<Reply<200, WorkflowRunListResponse>>;
4286
5782
  /**
4287
- * The project's runner pools
5783
+ * Start a durable workflow run
4288
5784
  *
4289
- * Every pool of the project's, with what its machines hold: how many machines, the sessions they take and take now (capacity_total, capacity_used), and how many sessions wait for a place (waiting).
5785
+ * Create a durable workflow run with optional hierarchical root_budget_usd enforcement.
4290
5786
  */
4291
- listPools(input?: {
5787
+ createWorkflowRun(input: {
5788
+ body: WorkflowRunCreateRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4292
5789
  signal?: AbortSignal;
4293
- }): Promise<Reply<200, PoolList>>;
5790
+ }): Promise<Reply<201, WorkflowRun>>;
4294
5791
  /**
4295
- * Make a runner pool
5792
+ * Get a workflow run
4296
5793
  *
4297
- * A pool of one type — its machines' operating system (linux or macos) and architecture (amd64 or arm64) — that the project's own machines enrol into with `palbase-agent` and a single-use key (POST /ai/pools/{pool}/keys). A chat that names it (POST /ai/chats {pool}) runs its workspace's sessions there. Managed through the API, the SDK and the CLI (palbase ai pools): the project scales it itself, reading its state (GET /ai/pools/{pool}/state). A name taken already: 409 pool_exists.
5794
+ * Fetch a durable workflow run along with all memoized steps and root budget spend.
4298
5795
  */
4299
- createPool(input: {
4300
- body: PoolRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5796
+ getWorkflowRun(input: {
5797
+ path: {
5798
+ run_id: string;
5799
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4301
5800
  signal?: AbortSignal;
4302
- }): Promise<Reply<201, Pool>>;
5801
+ }): Promise<Reply<200, WorkflowRun>>;
4303
5802
  /**
4304
- * Delete a runner pool
5803
+ * Record or replay a memoized workflow step
4305
5804
  *
4306
- * A pool with no machine left in it: cordon each machine, delete it once it holds no session (DELETE /ai/machines/{machine}), then the pool. One with machines: 409 pool_not_empty.
5805
+ * Idempotently record a workflow step's output or return the previously memoized result when already completed.
4307
5806
  */
4308
- deletePool(input: {
5807
+ recordWorkflowStep(input: {
4309
5808
  path: {
4310
- pool: string;
4311
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5809
+ run_id: string; /** Deterministic step key */
5810
+ step_key: string;
5811
+ };
5812
+ body: WorkflowStepRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4312
5813
  signal?: AbortSignal;
4313
- }): Promise<Reply<204, undefined>>;
5814
+ }): Promise<Reply<200, WorkflowStepResponse>>;
4314
5815
  /**
4315
- * A pool's enrolment keys
5816
+ * Complete or fail a workflow run
4316
5817
  *
4317
- * Its single-use enrolment keys — when each was made, used, revoked, and when it expires — none of them said again.
5818
+ * Mark a durable workflow run completed, failed, or canceled and emit the corresponding platform event.
4318
5819
  */
4319
- listPoolKeys(input: {
5820
+ completeWorkflowRun(input: {
4320
5821
  path: {
4321
- pool: string;
4322
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5822
+ run_id: string;
5823
+ };
5824
+ body: WorkflowCompleteRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4323
5825
  signal?: AbortSignal;
4324
- }): Promise<Reply<200, PoolKeyList>>;
5826
+ }): Promise<Reply<200, WorkflowRun>>;
4325
5827
  /**
4326
- * Mint an enrolment key
5828
+ * Replay a workflow run from Step N
4327
5829
  *
4328
- * A single-use key a machine of the project's enrols into the pool with (saved to a file on the machine: `palbase-agent enroll --key-file <file> --capacity <n>` — never on a command line), said once, here. A machine enrolled with it serves the project's sessions once whoever minted it is gone: never minted for an environment's token.
5830
+ * Clone a durable workflow run preserving memoized steps prior to the target step index or key.
4329
5831
  */
4330
- createPoolKey(input: {
5832
+ replayWorkflowRun(input: {
4331
5833
  path: {
4332
- pool: string;
5834
+ run_id: string;
4333
5835
  };
4334
- body: PoolKeyRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5836
+ body: WorkflowReplayRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4335
5837
  signal?: AbortSignal;
4336
- }): Promise<Reply<201, PoolKey>>;
5838
+ }): Promise<Reply<200, WorkflowReplayResponse>>;
4337
5839
  /**
4338
- * A runner pool's state
5840
+ * Stop an entire workflow and delegation tree
4339
5841
  *
4340
- * What the project's own scaling loop reads — no webhook tells it: each machine (online, offline or cordoned; the sessions it takes and holds; since when it is idle; when it was last seen), the pool's capacity and what it holds, how many sessions wait for a place and since when the oldest has waited. Scale up by enrolling machines; scale down by cordoning one (it takes no new session) and deleting it once it holds none.
5842
+ * One-click kill switch that cancels every workflow run, open wait, active response, and work permit under a root identifier.
4341
5843
  */
4342
- getPoolState(input: {
5844
+ stopRunTree(input: {
4343
5845
  path: {
4344
- pool: string;
5846
+ root_id: string;
4345
5847
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4346
5848
  signal?: AbortSignal;
4347
- }): Promise<Reply<200, PoolState>>;
5849
+ }): Promise<Reply<200, StopTreeResponse>>;
4348
5850
  /**
4349
- * The project's own provider keys
5851
+ * Get a memory record
4350
5852
  *
4351
- * The providers the project connected with its own key. A key is never read back.
5853
+ * Read a single memory record by namespace and key.
4352
5854
  */
4353
- listProviders(input?: {
5855
+ getMemory(input: {
5856
+ path: {
5857
+ namespace: string; /** Record key within namespace */
5858
+ key: string;
5859
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4354
5860
  signal?: AbortSignal;
4355
- }): Promise<Reply<200, ProviderList>>;
5861
+ }): Promise<Reply<200, MemoryRecord>>;
4356
5862
  /**
4357
- * Use the project's own provider key
5863
+ * Upsert a memory record
4358
5864
  *
4359
- * From now on every call that goes to this provider goes out with the project's own key and is billed by the provider to the project. The key is shown to the provider before it is kept: one the provider refuses is not kept.
5865
+ * Create or update a namespace-scoped memory record with optional metadata, vector embedding, and TTL.
4360
5866
  */
4361
- connectProvider(input: {
5867
+ putMemory(input: {
4362
5868
  path: {
4363
- provider: string;
5869
+ namespace: string; /** Record key within namespace */
5870
+ key: string;
4364
5871
  };
4365
- body: ProviderKey; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5872
+ body: MemoryPutRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4366
5873
  signal?: AbortSignal;
4367
- }): Promise<Reply<200, Provider>>;
5874
+ }): Promise<Reply<200, MemoryRecord>>;
4368
5875
  /**
4369
- * Stop using the project's own provider key
5876
+ * Delete a memory record
4370
5877
  *
4371
- * The key is removed; calls to this provider go out with the platform's connection again.
5878
+ * Delete a memory record by namespace and key.
4372
5879
  */
4373
- disconnectProvider(input: {
5880
+ deleteMemory(input: {
4374
5881
  path: {
4375
- provider: string;
5882
+ namespace: string; /** Record key within namespace */
5883
+ key: string;
4376
5884
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4377
5885
  signal?: AbortSignal;
4378
5886
  }): Promise<Reply<204, undefined>>;
4379
5887
  /**
4380
- * Ask a model
5888
+ * Hybrid search over memory records
4381
5889
  *
4382
- * Admits a response: an answer to the input, as text or — with a schema — as a JSON document of that shape, validated before it is returned. With stream: true the answer is the response's live view (text/event-stream). With background: true it answers at once and the response's end is the event ai.response.completed (or ai.response.failed). Otherwise it answers at once with the response queued; read it by its id. What the agent is given — its instructions, the conversation, the schema and the tools together — is at most 1 MiB as JSON, what the model service reads (413 request_too_large).
5890
+ * Search memory records using combined PostgreSQL full-text search, cosine vector similarity, and JSONB metadata filters.
4383
5891
  */
4384
- createResponse(input: {
4385
- headers: {
4386
- "Idempotency-Key": string;
4387
- };
4388
- body: ResponseRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5892
+ searchMemory(input: {
5893
+ body: MemorySearchRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4389
5894
  signal?: AbortSignal;
4390
- }): Promise<Reply<200, Response> | Reply<202, Response>>;
5895
+ }): Promise<Reply<200, MemorySearchResponse>>;
4391
5896
  /**
4392
- * Read a response
5897
+ * List actor group members
4393
5898
  *
4394
- * A response as it stands: its status, and at its end its answer, its use and — when it did not complete — why.
5899
+ * List all member chat identifiers enrolled in an actor group.
4395
5900
  */
4396
- getResponse(input: {
5901
+ listActorGroupMembers(input: {
4397
5902
  path: {
4398
- response_id: string;
5903
+ group_id: string;
4399
5904
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4400
5905
  signal?: AbortSignal;
4401
- }): Promise<Reply<200, Response>>;
5906
+ }): Promise<Reply<200, ActorGroupMembersResponse>>;
4402
5907
  /**
4403
- * Stop a response
5908
+ * Add a chat to an actor group
4404
5909
  *
4405
- * Asks the model service to stop the response; it ends canceled, and what it used until then is recorded.
5910
+ * Enroll a chat identifier in an actor group for multi-actor broadcast coordination.
4406
5911
  */
4407
- cancelResponse(input: {
5912
+ addActorGroupMember(input: {
4408
5913
  path: {
4409
- response_id: string;
4410
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5914
+ group_id: string;
5915
+ };
5916
+ body: ActorGroupMemberRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4411
5917
  signal?: AbortSignal;
4412
- }): Promise<Reply<200, Response>>;
5918
+ }): Promise<Reply<200, ActorGroupMembersResponse>>;
4413
5919
  /**
4414
- * Follow a response as it is produced
5920
+ * Broadcast to an actor group
4415
5921
  *
4416
- * The response's live view from a byte offset of its answer: every fragment as the model produces it, then the response at its end. A finished response answers its terminal at once.
5922
+ * Publish a message to an actor group's realtime channel and optionally deliver it to member chats.
4417
5923
  */
4418
- followResponse(input: {
5924
+ broadcastActorGroup(input: {
4419
5925
  path: {
4420
- response_id: string;
5926
+ group_id: string;
4421
5927
  };
4422
- query?: {
4423
- offset?: number;
4424
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5928
+ body: ActorGroupBroadcastRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4425
5929
  signal?: AbortSignal;
4426
- }): Promise<Reply<200, Response>>;
5930
+ }): Promise<Reply<200, ActorGroupBroadcastResponse>>;
4427
5931
  /**
4428
- * What the project allows its chats
5932
+ * Get opt-in A2A agent card
4429
5933
  *
4430
- * Whether its app's users talk to its agents themselves, how many messages one sends a minute, how much history it keeps, its monthly budget, and whether its app's users' work has its open secrets.
5934
+ * Public A2A discovery document listing only published agents explicitly opted-in via expose_a2a.
4431
5935
  */
4432
- getSettings(input?: {
5936
+ getA2AAgentCard(input?: {
4433
5937
  signal?: AbortSignal;
4434
- }): Promise<Reply<200, Settings>>;
5938
+ }): Promise<Reply<200, A2AAgentCard>>;
4435
5939
  /**
4436
- * Change what the project allows its chats
5940
+ * Execute A2A JSON-RPC 2.0 request
4437
5941
  *
4438
- * A field left out is left as it is. The history kept may be lowered, not raised past the plan's. A monthly budget is kept by Palbase's billing: on a stack that bills no AI it is refused (409 no_billing).
5942
+ * Handle A2A JSON-RPC 2.0 methods (tasks/send, tasks/get, tasks/cancel) for agents with expose_a2a enabled.
4439
5943
  */
4440
- putSettings(input: {
4441
- body: SettingsRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5944
+ callA2Arpc(input: {
5945
+ body: A2ARPCRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4442
5946
  signal?: AbortSignal;
4443
- }): Promise<Reply<200, Settings>>;
5947
+ }): Promise<Reply<200, A2ARPCResponse>>;
4444
5948
  /**
4445
- * What the project's AI on Palbase's models costs this month
5949
+ * Store a per-user sealed MCP credential
4446
5950
  *
4447
- * The month's spend on Palbase's models at what it is billed, the free dollar a month brings and what is left of it, the monthly budget, and whether Palbase's models serve the project now — and if not, why.
5951
+ * Store an encrypted per-user access token (and optional refresh token) for an MCP endpoint.
4448
5952
  */
4449
- getSpend(input?: {
5953
+ putMcpUserCredential(input: {
5954
+ path: {
5955
+ name: string; /** App user identifier */
5956
+ user_id: string;
5957
+ };
5958
+ body: MCPUserCredentialRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4450
5959
  signal?: AbortSignal;
4451
- }): Promise<Reply<200, Spend>>;
5960
+ }): Promise<Reply<200, MCPUserCredentialResponse>>;
4452
5961
  /**
4453
- * Ask Palbase's support line
5962
+ * Delete a per-user sealed MCP credential
4454
5963
  *
4455
- * A question about Palbase — its SDKs, its backend framework, its CLI, its platform — answered by a model the platform pays for, from Palbase's documentation and what the asker's project shows (context: the CLI sends its machines, their last builds and a failed build's log). When the answer finds Palbase short of what was asked, the case is logged (logged: true) and the asker is mailed when it is fixed; what was logged is Palbase's own and is not named. It is a person's (a project admin's session or token, or an environment's token narrowed to the support scope: 403 person_required for the secret key), and it is bounded (429 too_many_questions): 30 an hour by a person across their projects, 60 by a project's people — and the platform's day (429 support_paused).
5964
+ * Revoke and delete a stored per-user credential for an MCP endpoint.
4456
5965
  */
4457
- askSupport(input: {
4458
- body: SupportQuestion; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5966
+ deleteMcpUserCredential(input: {
5967
+ path: {
5968
+ name: string; /** App user identifier */
5969
+ user_id: string;
5970
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4459
5971
  signal?: AbortSignal;
4460
- }): Promise<Reply<200, SupportAnswer>>;
5972
+ }): Promise<Reply<204, undefined>>;
4461
5973
  /**
4462
- * The tools an agent may be given
5974
+ * Start MCP OAuth 2.1 PKCE flow
4463
5975
  *
4464
- * The backend's tools (each one the build its machine serves declares: its contract's x-palbase-ai-tools), the project's endpoints, and the platform's.
5976
+ * Generate an OAuth 2.1 PKCE authorization URL and signed state token for a user to connect an MCP endpoint.
4465
5977
  */
4466
- listTools(input?: {
5978
+ startMcpoAuth(input: {
5979
+ path: {
5980
+ name: string;
5981
+ };
5982
+ query?: {
5983
+ user_id?: string; /** Optional post-authorization redirect URL */
5984
+ redirect_uri?: string;
5985
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4467
5986
  signal?: AbortSignal;
4468
- }): Promise<Reply<200, ToolList>>;
5987
+ }): Promise<Reply<200, MCPOAuthStartResponse>>;
4469
5988
  /**
4470
- * What the project's use of models cost
5989
+ * Complete MCP OAuth 2.1 PKCE callback
4471
5990
  *
4472
- * Every use, newest first: a response's tokens, an embeddings call, a picture job — with its cost at the provider's list price and whose connection paid. A use under the project's own key is billed by the provider, not by Palbase.
5991
+ * Public browser callback that exchanges an OAuth 2.1 authorization code using PKCE, seals the user's token, and resumes any parked MCP auth waits.
4473
5992
  */
4474
- listUsage(input?: {
5993
+ completeMcpoAuthCallback(input?: {
4475
5994
  query?: {
4476
- limit?: number; /** The next_cursor of the previous page. */
4477
- cursor?: string; /** Only uses of this kind: text, embedding or image. */
4478
- kind?: "text" | "embedding" | "image" | "video" | "stt" | "tts" | "voice" | "web_search" | "machine"; /** Labels each use listed carries, as a JSON object ({"product":"p1"}): a product's spend, a task's. */
4479
- metadata?: string;
5995
+ code?: string; /** Signed PKCE state token */
5996
+ state?: string;
4480
5997
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4481
5998
  signal?: AbortSignal;
4482
- }): Promise<Reply<200, UsagePage>>;
5999
+ }): Promise<Reply<200, MCPOAuthCallbackResponse>>;
4483
6000
  /**
4484
- * OpenAI-compatible text-to-speech
6001
+ * List server-locked AI templates
4485
6002
  *
4486
- * Streams synthesized audio via OpenAI or ElevenLabs.
6003
+ * List server-locked AI templates.
4487
6004
  */
4488
- gatewayAudioSpeech(input: {
4489
- body: SpeechRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6005
+ listTemplates(input?: {
4490
6006
  signal?: AbortSignal;
4491
- }): Promise<Reply<200, Response>>;
6007
+ }): Promise<Reply<200, TemplateListResponse>>;
4492
6008
  /**
4493
- * OpenAI-compatible audio transcription
6009
+ * Get an AI template
4494
6010
  *
4495
- * Transcribes audio via OpenAI or Deepgram.
6011
+ * Get an AI template.
4496
6012
  */
4497
- gatewayAudioTranscriptions(input: {
4498
- body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6013
+ getTemplate(input: {
6014
+ path: {
6015
+ name: string;
6016
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4499
6017
  signal?: AbortSignal;
4500
- }): Promise<Reply<200, GatewayJSON>>;
6018
+ }): Promise<Reply<200, TemplateView>>;
4501
6019
  /**
4502
- * OpenAI-compatible chat completions
6020
+ * Create or save a new draft version of an AI template
4503
6021
  *
4504
- * Routes to any direct-to-source text model in fast stateless mode or stateful single-engine mode when X-Palbase-Session-Id is provided.
6022
+ * Create or save a new draft version of an AI template.
4505
6023
  */
4506
- gatewayChatCompletions(input: {
4507
- body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6024
+ putTemplate(input: {
6025
+ path: {
6026
+ name: string;
6027
+ };
6028
+ body: TemplateUpsertRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4508
6029
  signal?: AbortSignal;
4509
- }): Promise<Reply<200, GatewayJSON>>;
6030
+ }): Promise<Reply<200, TemplateView>>;
4510
6031
  /**
4511
- * OpenAI-compatible embeddings
6032
+ * Delete an AI template and its versions
4512
6033
  *
4513
- * Generates text embeddings across OpenAI, Google Gemini, Mistral, and Fireworks.
6034
+ * Delete an AI template and its versions.
4514
6035
  */
4515
- gatewayEmbeddings(input: {
4516
- body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6036
+ deleteTemplate(input: {
6037
+ path: {
6038
+ name: string;
6039
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4517
6040
  signal?: AbortSignal;
4518
- }): Promise<Reply<200, GatewayJSON>>;
6041
+ }): Promise<Reply<204, undefined>>;
4519
6042
  /**
4520
- * OpenAI-compatible image generation
6043
+ * Publish a template version for direct client access
4521
6044
  *
4522
- * Generates images across OpenAI, Google Imagen, and Black Forest Labs Flux.
6045
+ * Publish a template version for direct client access.
4523
6046
  */
4524
- gatewayImagesGenerations(input: {
4525
- body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6047
+ publishTemplate(input: {
6048
+ path: {
6049
+ name: string;
6050
+ };
6051
+ body?: TemplateVersionSelectRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4526
6052
  signal?: AbortSignal;
4527
- }): Promise<Reply<200, GatewayJSON>>;
6053
+ }): Promise<Reply<200, TemplateView>>;
4528
6054
  /**
4529
- * Anthropic-compatible messages
6055
+ * Roll back the published version of a template
4530
6056
  *
4531
- * Anthropic Messages wire routing to any direct-to-source text model in fast stateless mode or stateful single-engine mode.
6057
+ * Roll back the published version of a template.
4532
6058
  */
4533
- gatewayAnthropicMessages(input: {
4534
- body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6059
+ rollbackTemplate(input: {
6060
+ path: {
6061
+ name: string;
6062
+ };
6063
+ body?: TemplateVersionSelectRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4535
6064
  signal?: AbortSignal;
4536
- }): Promise<Reply<200, GatewayJSON>>;
6065
+ }): Promise<Reply<200, TemplateView>>;
4537
6066
  /**
4538
- * List live models (OpenAI-compatible)
6067
+ * List immutable versions of an AI template
4539
6068
  *
4540
- * Returns the live DB-backed model catalog in OpenAI-compatible list format.
6069
+ * List immutable versions of an AI template.
4541
6070
  */
4542
- gatewayListModels(input?: {
6071
+ listTemplateVersions(input: {
6072
+ path: {
6073
+ name: string;
6074
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6075
+ signal?: AbortSignal;
6076
+ }): Promise<Reply<200, TemplateVersionListResponse>>;
6077
+ /**
6078
+ * List per-user direct AI spend
6079
+ *
6080
+ * List per-user direct AI spend.
6081
+ */
6082
+ listUserSpend(input?: {
4543
6083
  query?: {
4544
- modality?: "text" | "embedding" | "image" | "video" | "stt" | "tts" | "voice_live";
4545
- vendor?: string;
4546
- include_deprecated?: boolean;
6084
+ user_id?: string; /** Filter by template name. */
6085
+ template_name?: string; /** Aggregation window (default day). */
6086
+ period_kind?: "day" | "month"; /** UTC date or month key. */
6087
+ period_key?: string;
4547
6088
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4548
6089
  signal?: AbortSignal;
4549
- }): Promise<Reply<200, GatewayJSON>>;
6090
+ }): Promise<Reply<200, UserSpendListResponse>>;
4550
6091
  /**
4551
- * OpenAI Responses wire
6092
+ * Get a user's direct AI quota override
4552
6093
  *
4553
- * Routes OpenAI Responses requests directly through Palbase single engine.
6094
+ * Get a user's direct AI quota override.
4554
6095
  */
4555
- gatewayResponses(input: {
4556
- body: GatewayJSON; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6096
+ getUserQuota(input: {
6097
+ path: {
6098
+ user_id: string;
6099
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4557
6100
  signal?: AbortSignal;
4558
- }): Promise<Reply<200, GatewayJSON>>;
6101
+ }): Promise<Reply<200, UserQuota>>;
4559
6102
  /**
4560
- * Start an asynchronous video generation job
6103
+ * Set a user's direct AI quota override or block state
4561
6104
  *
4562
- * Starts a durable asynchronous video generation job on Google Veo or Kling.
6105
+ * Set a user's direct AI quota override or block state.
4563
6106
  */
4564
- createVideo(input: {
4565
- body: VideoRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6107
+ putUserQuota(input: {
6108
+ path: {
6109
+ user_id: string;
6110
+ };
6111
+ body: UserQuotaRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4566
6112
  signal?: AbortSignal;
4567
- }): Promise<Reply<202, VideoJob>>;
6113
+ }): Promise<Reply<200, UserQuota>>;
4568
6114
  /**
4569
- * Read a video generation job
6115
+ * Remove a user's direct AI quota override
4570
6116
  *
4571
- * Returns the status, output URL, storage path, and billed cost of a video job.
6117
+ * Remove a user's direct AI quota override.
4572
6118
  */
4573
- getVideo(input: {
6119
+ deleteUserQuota(input: {
4574
6120
  path: {
4575
- video_id: string;
6121
+ user_id: string;
4576
6122
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4577
6123
  signal?: AbortSignal;
4578
- }): Promise<Reply<200, VideoJob>>;
6124
+ }): Promise<Reply<204, undefined>>;
4579
6125
  /**
4580
- * Cancel a running video generation job
6126
+ * Mint a single-use device attestation challenge
4581
6127
  *
4582
- * Cancels a queued or running video job.
6128
+ * Mint a single-use device attestation challenge.
4583
6129
  */
4584
- cancelVideo(input: {
6130
+ clientAttestChallenge(input?: {
6131
+ body?: ClientAttestChallengeRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6132
+ signal?: AbortSignal;
6133
+ }): Promise<Reply<200, ClientAttestChallengeResponse>>;
6134
+ /**
6135
+ * Run a published server-locked AI template from a client app
6136
+ *
6137
+ * Run a published server-locked AI template from a client app.
6138
+ */
6139
+ runClientTemplate(input: {
4585
6140
  path: {
4586
- video_id: string;
4587
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6141
+ name: string;
6142
+ };
6143
+ body: ClientTemplateRunRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4588
6144
  signal?: AbortSignal;
4589
- }): Promise<Reply<200, VideoCancelResult>>;
6145
+ }): Promise<Reply<200, ClientTemplateRunResponse>>;
6146
+ /**
6147
+ * Start a WebRTC live voice session locked to a published voice_live template
6148
+ *
6149
+ * Start a WebRTC live voice session locked to a published voice_live template.
6150
+ */
6151
+ voiceClientTemplate(input: {
6152
+ path: {
6153
+ name: string;
6154
+ };
6155
+ body: ClientTemplateVoiceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6156
+ signal?: AbortSignal;
6157
+ }): Promise<Reply<201, ClientTemplateVoiceResponse>>;
4590
6158
  };
4591
6159
  export type Client = ReturnType<typeof client>;