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
@@ -530,12 +530,61 @@ export interface TurnArtifact {
530
530
  checksum: string;
531
531
  createdAt: string;
532
532
  }
533
+ /** Controls when a call-transport voice opens its live model connection. */
534
+ export interface VoiceActivation {
535
+ /** open (always connected) or manual (0-cost sleep until activated explicitly or woken by wakePhrases). */
536
+ mode?: 'open' | 'manual';
537
+ /** Case-insensitive phrases that wake a manual-mode voice when heard in the call's transcript. */
538
+ wakePhrases?: string[];
539
+ /** Seconds of silence before returning a manual-mode voice gate to sleep (default 15). */
540
+ idleCloseSeconds?: number;
541
+ }
542
+ /** Voice media transport on start: WebRTC SDP offer or a Palbase Calls room. */
543
+ export type StartVoiceTransport = {
544
+ type: 'webrtc';
545
+ /** The app's WebRTC offer (an SDP) — the browser's peer connection's (palbase/web's connectVoice makes it). */
546
+ sdp: string;
547
+ } | {
548
+ type: 'call';
549
+ /** Palbase Calls room ID to join as a live voice participant. */
550
+ callId: string;
551
+ /** Participant identity inside the call room. */
552
+ identity?: string;
553
+ /** Display name inside the call room. */
554
+ name?: string;
555
+ /** Controls open vs manual/wake-phrase gating for this call participant. */
556
+ activation?: VoiceActivation;
557
+ };
558
+ /** Active voice session transport view. */
559
+ export interface ChatVoiceTransport {
560
+ type: 'webrtc' | 'call' | (string & {});
561
+ /** Provider WebRTC SDP answer (on start when type is webrtc). */
562
+ sdp?: string;
563
+ /** Bound Palbase Calls room ID (when type is call). */
564
+ callId?: string;
565
+ /** Bot participant identity in the call room (when type is call). */
566
+ identity?: string;
567
+ /** Bot participant display name (when type is call). */
568
+ name?: string;
569
+ /** LiveKit room name (when type is call). */
570
+ room?: string;
571
+ /** Media server WebSocket URL (when type is call). */
572
+ mediaUrl?: string;
573
+ /** Activation policy (when type is call). */
574
+ activation?: VoiceActivation;
575
+ /** Whether the live voice model gate is currently open (when type is call). */
576
+ gateOpen?: boolean;
577
+ }
533
578
  /** A chat's voice: whose it is, what becomes of what is asked of it out loud, whether it is live, how long, why it ended. */
534
579
  export interface ChatVoice {
535
580
  id: string;
536
581
  chatId: string;
537
582
  /** Its member; null: the server's own. */
538
583
  userId: string | null;
584
+ /** The resolved live voice model. */
585
+ model?: string;
586
+ /** Media transport state (webrtc or call). */
587
+ transport: ChatVoiceTransport;
539
588
  /** chat: what the person asks for is a turn of the chat as its member, whose answer the voice says; events: ai.voice.delegated. */
540
589
  delegation: 'chat' | 'events' | (string & {});
541
590
  status: 'active' | 'closed' | (string & {});
@@ -544,12 +593,14 @@ export interface ChatVoice {
544
593
  startedAt: string;
545
594
  /** null: live. */
546
595
  closedAt: string | null;
547
- /** Why it ended: close_requested, member_removed, chat_deleted, replaced, lost, or the provider's word ('' while live). */
596
+ /** Why it ended: close_requested, member_removed, chat_deleted, replaced, lost, call_ended, ai_limit_reached, or the provider's word ('' while live). */
548
597
  closeReason: string;
549
598
  }
550
599
  export interface StartVoice {
551
- /** The app's WebRTC offer (an SDP) — the browser's peer connection's (palbase/web's connectVoice makes it). */
552
- sdp: string;
600
+ /** Media transport: WebRTC SDP offer ({ type: 'webrtc', sdp }) or Palbase Calls room ({ type: 'call', callId, ... }). */
601
+ transport: StartVoiceTransport;
602
+ /** Live voice model (e.g. openai/gpt-live-1, openai/gpt-realtime, openai/gpt-realtime-mini, google/gemini-live-2.5). */
603
+ model?: string;
553
604
  /** The voice it speaks in; left out, the provider's default. */
554
605
  voice?: string;
555
606
  /**
@@ -572,11 +623,12 @@ export interface StartVoice {
572
623
  export interface VoiceCommand {
573
624
  /**
574
625
  * speak: say this exactly and nothing else — once what the voice is saying ends, in the order they came; tell: say it
575
- * in your own words; know: keep it in mind; instruct: behave so from now on.
626
+ * in your own words; know: keep it in mind; instruct: behave so from now on; activate / deactivate: open or sleep a
627
+ * manual-mode call-transport voice gate.
576
628
  */
577
- type: 'speak' | 'tell' | 'know' | 'instruct';
578
- /** 16 KiB at most. */
579
- text: string;
629
+ type: 'speak' | 'tell' | 'know' | 'instruct' | 'activate' | 'deactivate';
630
+ /** 16 KiB at most. Required for speak, tell, know and instruct; omitted for activate and deactivate. */
631
+ text?: string;
580
632
  /** speak or tell: the request it answers (ai.voice.delegated's delegation_id). */
581
633
  delegationId?: string;
582
634
  /** speak only: cut what the voice is saying and say the text at once. */
@@ -586,21 +638,19 @@ export interface VoiceCommand {
586
638
  signal?: AbortSignal;
587
639
  }
588
640
  /**
589
- * A chat's live voice, from its server: the app's WebRTC offer in, the provider's answer out — the audio then goes
590
- * between the app and the platform's voice provider. What is said either way is the chat's: transcript parts of its
591
- * stream and messages of kind voice of its history. One voice talks in a chat at a time.
641
+ * A chat's live voice, from its server: over WebRTC (offer in, answer out) or bound to a Palbase Calls room
642
+ * (transport: { type: 'call', callId }). What is said either way is the chat's: transcript parts of its stream
643
+ * and messages of kind voice of its history. One voice talks in a chat at a time.
592
644
  */
593
645
  export interface Voices {
594
- /** Starts it: its id and the answer (sdp) for the app's peer connection. Its start is the event ai.voice.started. */
595
- start(id: string, voice: StartVoice): Promise<ChatVoice & {
596
- sdp: string;
597
- }>;
646
+ /** Starts it: returns the voice session (with transport.sdp for webrtc or call room/gate metadata for call). Its start is the event ai.voice.started. */
647
+ start(id: string, voice: StartVoice): Promise<ChatVoice>;
598
648
  /** The voice: its member's, or the server's (403 not_your_voice). */
599
649
  get(id: string, voiceId: string, options?: {
600
650
  as?: string;
601
651
  signal?: AbortSignal;
602
652
  }): Promise<ChatVoice>;
603
- /** Gives it text — the server's alone, as itself or as the voice's member; one that has ended is 409 voice_closed. */
653
+ /** Gives it text or gate control — the server's alone, as itself or as the voice's member; one that has ended is 409 voice_closed. */
604
654
  command(id: string, voiceId: string, command: VoiceCommand): Promise<ChatVoice>;
605
655
  /** Ends it: how long it lasted and why it ended. Its end is the event ai.voice.closed, once. */
606
656
  close(id: string, voiceId: string, options?: {
@@ -4,7 +4,10 @@ export { AISchemaError, prepare } from './schema.js';
4
4
  export { ToolError } from './tools.js';
5
5
  export type { Infer, StandardSchema } from './schema.js';
6
6
  export { partial } from './partial.js';
7
- export type { AISettings, Agent, AgentTool, AgentVersion, Agents, AutoFailoverPolicy, Chat, ChatEvents, ChatExecution, ChatGoal, ChatMessage, ChatStreamPart, ChatToolCall, ChatVoice, Chats, ComputeTarget, CreateChat, Decision, Endpoint, EndpointInput, Endpoints, Environment, EnvironmentBuild, EnvironmentNetwork, EnvironmentRequest, EnvironmentResources, EnvironmentRuntime, EnvironmentScaling, Environments, ExecutionTarget, ExecutorTarget, ForkChat, GoalChange, Goals, HandoffOptions, HandoffResult, MemberInput, MessageAttachment, MessageFile, MessageImage, PendingHandoff, SendMessage, SetGoal, Settings, StartVoice, TargetSummary, TurnAdvisorCost, TurnArtifact, TurnCost, TurnRunCost, TurnToolCall, UpdateExecutionOptions, VoiceCommand, Voices, } from './chats.js';
7
+ export type { AISettings, Agent, AgentTool, AgentVersion, Agents, AutoFailoverPolicy, Chat, ChatEvents, ChatExecution, ChatGoal, ChatMessage, ChatStreamPart, ChatToolCall, ChatVoice, ChatVoiceTransport, Chats, ComputeTarget, CreateChat, Decision, Endpoint, EndpointInput, Endpoints, Environment, EnvironmentBuild, EnvironmentNetwork, EnvironmentRequest, EnvironmentResources, EnvironmentRuntime, EnvironmentScaling, Environments, ExecutionTarget, ExecutorTarget, ForkChat, GoalChange, Goals, HandoffOptions, HandoffResult, MemberInput, MessageAttachment, MessageFile, MessageImage, PendingHandoff, SendMessage, SetGoal, Settings, StartVoice, StartVoiceTransport, TargetSummary, TurnAdvisorCost, TurnArtifact, TurnCost, TurnRunCost, TurnToolCall, UpdateExecutionOptions, VoiceActivation, VoiceCommand, Voices, } from './chats.js';
8
+ export { WorkflowParkedError } from './workflows.js';
9
+ export type { ActorGroupBroadcastRequest, ActorGroupBroadcastResponse, ActorGroupMembersResponse, ActorGroups, DurableGraph, DurableWorkflow, GraphDefinition, MCPAuth, MCPOAuthStartResponse, MCPUserCredentialRequest, MCPUserCredentialResponse, Memory, MemoryPutRequest, MemoryRecord, MemorySearchRequest, StopTreeResponse, Trigger, TriggerCreateRequest, TriggerCreated, TriggerPatchRequest, TriggerTestRequest, TriggerTestResponse, Triggers, Wait, Waits, WorkflowCompleteRequest, WorkflowReplayResponse, WorkflowRun, WorkflowRunCreateRequest, WorkflowRunOptions, WorkflowStep, WorkflowStepContext, WorkflowStepRequest, Workflows, } from './workflows.js';
10
+ export type { Template, TemplateClientPolicy, TemplateGenerationLimits, TemplatePerUserLimits, TemplatePolicyAttestation, Templates, TemplateUpsert, TemplateVersion, UserQuota, UserQuotas, UserQuotaUpdate, UserSpend, UserSpendQuery, } from './templates.js';
8
11
  export type { EnvVariable, EnvVariableOptions, EnvVariables, MachineHarness, Pool, PoolKey, PoolKeyEnroll, PoolKeyMinted, PoolKeys, PoolMachine, PoolMachines, PoolState, Pools, SecretHostAllowance, SecretHostAllowances, SecretHostRequest, SecretHostRequests, } from './pools.js';
9
12
  export type { AdvisorDefinition, AgentContext, AgentDefinitionInput, AgentEnvEntry, BackendAgent, BackendAgentOptions, BackendTool, BackendToolOptions, ChatContext, ClientTool, ClientToolOptions, DeferredAnswer, Effort, HttpsToolRef, McpToolRef, EnvInject, PlatformToolName, PlatformToolRef, PreparedOutput, SecretDescription, SubagentDefinition, Thinking, Tool, ToolAnswer, ToolContext, ToolReply, ToolWorkspace, TurnDefinition, TurnMessage, WorkspaceTree, } from './tools.js';
10
13
  export type { AgentEvent, ChatEvent, ContextCompactedEvent, ContextOffloadedEvent, GoalEvent, GoalKind, HistoryEvent, HistoryItem, MessageEvent, Publication, ResetEvent, SessionHandedOffEvent, SessionMachineStatusEvent, SessionSummaryEvent, TextEvent, ThinkingEvent, ToolEvent, ToolStatus, TranscriptEvent, TurnEnd, TurnEvent, TurnStatus, VoiceEvent, WaitingReason, } from '../../internal/src/chat.js';
@@ -0,0 +1,76 @@
1
+ import type * as modules from '../../internal/src/modules/index.js';
2
+ type AIModule = ReturnType<typeof modules.ai.client>;
3
+ export type Template = modules.ai.TemplateView;
4
+ export type TemplateVersion = modules.ai.TemplateVersionSpec;
5
+ export type TemplateUpsert = modules.ai.TemplateUpsertRequest;
6
+ export type TemplateClientPolicy = modules.ai.TemplateClientPolicy;
7
+ export type TemplateGenerationLimits = modules.ai.TemplateGenerationLimits;
8
+ export type TemplatePerUserLimits = modules.ai.TemplatePerUserLimits;
9
+ export type TemplatePolicyAttestation = modules.ai.TemplatePolicyAttestation;
10
+ export type UserSpend = modules.ai.UserSpendRow;
11
+ export type UserQuota = modules.ai.UserQuota;
12
+ export type UserQuotaUpdate = modules.ai.UserQuotaRequest;
13
+ export interface Templates {
14
+ /** Lists all guardrailed client AI templates in this project. */
15
+ list(opts?: {
16
+ signal?: AbortSignal;
17
+ }): Promise<Template[]>;
18
+ /** Gets a template (including its published version and latest draft) by slug name. */
19
+ get(name: string, opts?: {
20
+ signal?: AbortSignal;
21
+ }): Promise<Template>;
22
+ /** Creates or updates a draft version of a server-locked client AI template. */
23
+ save(name: string, spec: TemplateUpsert, opts?: {
24
+ signal?: AbortSignal;
25
+ }): Promise<Template>;
26
+ /** Publishes the latest draft (or an explicit version) so clients can invoke it. */
27
+ publish(name: string, opts?: {
28
+ version?: number;
29
+ signal?: AbortSignal;
30
+ }): Promise<Template>;
31
+ /** Rolls back the published pointer to an earlier template version. */
32
+ rollback(name: string, opts?: {
33
+ version?: number;
34
+ signal?: AbortSignal;
35
+ }): Promise<Template>;
36
+ /** Lists immutable version history of a template. */
37
+ versions(name: string, opts?: {
38
+ signal?: AbortSignal;
39
+ }): Promise<TemplateVersion[]>;
40
+ /** Deletes a template and all of its versions. */
41
+ delete(name: string, opts?: {
42
+ signal?: AbortSignal;
43
+ }): Promise<void>;
44
+ }
45
+ export interface UserSpendQuery {
46
+ userId?: string;
47
+ templateName?: string;
48
+ periodKind?: 'day' | 'month';
49
+ periodKey?: string;
50
+ signal?: AbortSignal;
51
+ }
52
+ export interface UserQuotas {
53
+ /** Lists per-user direct AI spend rows for a period (`day` or `month`). */
54
+ listSpend(query?: UserSpendQuery): Promise<{
55
+ periodKind: string;
56
+ periodKey: string;
57
+ items: UserSpend[];
58
+ }>;
59
+ /** Gets an end user's direct AI quota override and block status. */
60
+ get(userId: string, opts?: {
61
+ signal?: AbortSignal;
62
+ }): Promise<UserQuota>;
63
+ /** Sets or updates an end user's direct AI quota override or block state. */
64
+ set(userId: string, quota: UserQuotaUpdate, opts?: {
65
+ signal?: AbortSignal;
66
+ }): Promise<UserQuota>;
67
+ /** Removes an end user's custom quota override (reverting to template defaults). */
68
+ delete(userId: string, opts?: {
69
+ signal?: AbortSignal;
70
+ }): Promise<void>;
71
+ }
72
+ export declare function templatesOf(module: AIModule): {
73
+ templates: Templates;
74
+ userQuotas: UserQuotas;
75
+ };
76
+ export {};
@@ -0,0 +1,201 @@
1
+ import type * as modules from '../../internal/src/modules/index.js';
2
+ type Module = ReturnType<typeof modules.ai.client>;
3
+ export type Trigger = modules.ai.Trigger;
4
+ export type TriggerCreated = modules.ai.TriggerCreated;
5
+ export type TriggerCreateRequest = modules.ai.TriggerCreateRequest;
6
+ export type TriggerPatchRequest = modules.ai.TriggerPatchRequest;
7
+ export type TriggerTestRequest = modules.ai.TriggerTestRequest;
8
+ export type TriggerTestResponse = modules.ai.TriggerTestResponse;
9
+ export type Wait = modules.ai.Wait;
10
+ export type WorkflowRun = modules.ai.WorkflowRun;
11
+ export type WorkflowRunCreateRequest = modules.ai.WorkflowRunCreateRequest;
12
+ export type WorkflowStep = modules.ai.WorkflowStep;
13
+ export type WorkflowStepRequest = modules.ai.WorkflowStepRequest;
14
+ export type WorkflowCompleteRequest = modules.ai.WorkflowCompleteRequest;
15
+ export type WorkflowReplayResponse = modules.ai.WorkflowReplayResponse;
16
+ export type StopTreeResponse = modules.ai.StopTreeResponse;
17
+ export type MemoryRecord = modules.ai.MemoryRecord;
18
+ export type MemoryPutRequest = modules.ai.MemoryPutRequest;
19
+ export type MemorySearchRequest = modules.ai.MemorySearchRequest;
20
+ export type ActorGroupMembersResponse = modules.ai.ActorGroupMembersResponse;
21
+ export type ActorGroupBroadcastRequest = modules.ai.ActorGroupBroadcastRequest;
22
+ export type ActorGroupBroadcastResponse = modules.ai.ActorGroupBroadcastResponse;
23
+ export type MCPUserCredentialRequest = modules.ai.MCPUserCredentialRequest;
24
+ export type MCPUserCredentialResponse = modules.ai.MCPUserCredentialResponse;
25
+ export type MCPOAuthStartResponse = modules.ai.MCPOAuthStartResponse;
26
+ export interface Triggers {
27
+ create(request: TriggerCreateRequest, options?: {
28
+ signal?: AbortSignal;
29
+ }): Promise<TriggerCreated>;
30
+ list(options?: {
31
+ signal?: AbortSignal;
32
+ }): Promise<Trigger[]>;
33
+ get(triggerId: string, options?: {
34
+ signal?: AbortSignal;
35
+ }): Promise<Trigger>;
36
+ update(triggerId: string, patch: TriggerPatchRequest, options?: {
37
+ signal?: AbortSignal;
38
+ }): Promise<Trigger>;
39
+ delete(triggerId: string, options?: {
40
+ signal?: AbortSignal;
41
+ }): Promise<void>;
42
+ test(triggerId: string, request?: TriggerTestRequest, options?: {
43
+ signal?: AbortSignal;
44
+ }): Promise<TriggerTestResponse>;
45
+ }
46
+ export interface Waits {
47
+ list(options?: {
48
+ status?: string;
49
+ ownerId?: string;
50
+ signal?: AbortSignal;
51
+ }): Promise<Wait[]>;
52
+ get(waitId: string, options?: {
53
+ signal?: AbortSignal;
54
+ }): Promise<Wait>;
55
+ signal(waitId: string, payload?: Record<string, unknown>, options?: {
56
+ signal?: AbortSignal;
57
+ }): Promise<Wait>;
58
+ cancel(waitId: string, options?: {
59
+ signal?: AbortSignal;
60
+ }): Promise<Wait>;
61
+ }
62
+ export interface Workflows {
63
+ create(request: WorkflowRunCreateRequest, options?: {
64
+ signal?: AbortSignal;
65
+ }): Promise<WorkflowRun>;
66
+ list(options?: {
67
+ workflowName?: string;
68
+ status?: string;
69
+ signal?: AbortSignal;
70
+ }): Promise<WorkflowRun[]>;
71
+ get(runId: string, options?: {
72
+ signal?: AbortSignal;
73
+ }): Promise<WorkflowRun>;
74
+ recordStep(runId: string, stepKey: string, request: WorkflowStepRequest, options?: {
75
+ signal?: AbortSignal;
76
+ }): Promise<WorkflowStep>;
77
+ complete(runId: string, request: WorkflowCompleteRequest, options?: {
78
+ signal?: AbortSignal;
79
+ }): Promise<WorkflowRun>;
80
+ replay(runId: string, options?: {
81
+ fromStep?: string;
82
+ signal?: AbortSignal;
83
+ }): Promise<WorkflowReplayResponse>;
84
+ stopTree(rootRunId: string, options?: {
85
+ signal?: AbortSignal;
86
+ }): Promise<StopTreeResponse>;
87
+ }
88
+ export interface Memory {
89
+ put(namespace: string, key: string, request: MemoryPutRequest, options?: {
90
+ signal?: AbortSignal;
91
+ }): Promise<MemoryRecord>;
92
+ get(namespace: string, key: string, options?: {
93
+ signal?: AbortSignal;
94
+ }): Promise<MemoryRecord>;
95
+ delete(namespace: string, key: string, options?: {
96
+ signal?: AbortSignal;
97
+ }): Promise<void>;
98
+ search(request: MemorySearchRequest, options?: {
99
+ signal?: AbortSignal;
100
+ }): Promise<MemoryRecord[]>;
101
+ }
102
+ export interface ActorGroups {
103
+ members(groupId: string, options?: {
104
+ signal?: AbortSignal;
105
+ }): Promise<string[]>;
106
+ addMember(groupId: string, chatId: string, options?: {
107
+ role?: string;
108
+ signal?: AbortSignal;
109
+ }): Promise<string[]>;
110
+ broadcast(groupId: string, request: ActorGroupBroadcastRequest, options?: {
111
+ signal?: AbortSignal;
112
+ }): Promise<ActorGroupBroadcastResponse>;
113
+ }
114
+ export interface MCPAuth {
115
+ setUserCredential(endpoint: string, userId: string, request: MCPUserCredentialRequest, options?: {
116
+ signal?: AbortSignal;
117
+ }): Promise<MCPUserCredentialResponse>;
118
+ deleteUserCredential(endpoint: string, userId: string, options?: {
119
+ signal?: AbortSignal;
120
+ }): Promise<void>;
121
+ startOAuth(endpoint: string, userId: string, options?: {
122
+ redirectUri?: string;
123
+ signal?: AbortSignal;
124
+ }): Promise<MCPOAuthStartResponse>;
125
+ }
126
+ /** Thrown by step.sleep / step.waitForEvent / step.waitForApproval when a workflow run parks at zero compute. */
127
+ export declare class WorkflowParkedError extends Error {
128
+ readonly runId: string;
129
+ readonly stepKey: string;
130
+ readonly waitId: string;
131
+ constructor(runId: string, stepKey: string, waitId: string);
132
+ }
133
+ export interface WorkflowStepContext {
134
+ readonly runId: string;
135
+ /** Runs fn once and memoizes its output under key; replays return the stored output without re-running fn. */
136
+ do<T>(key: string, fn: () => T | Promise<T>): Promise<T>;
137
+ /** Runs multiple named branches concurrently and memoizes their combined output under key. */
138
+ parallel<T extends Record<string, () => unknown | Promise<unknown>>>(key: string, tasks: T): Promise<{
139
+ [K in keyof T]: Awaited<ReturnType<T[K]>>;
140
+ }>;
141
+ /** Parks the run at zero compute for seconds; once elapsed, returns on replay. */
142
+ sleep(key: string, seconds: number): Promise<void>;
143
+ /** Parks the run at zero compute until a matching platform event arrives; returns the event payload on resume. */
144
+ waitForEvent<T = Record<string, unknown>>(key: string, topic: string, options?: {
145
+ filter?: Record<string, unknown>;
146
+ timeoutSeconds?: number;
147
+ }): Promise<T>;
148
+ /** Parks the run at zero compute until an approval decision arrives; returns the decision payload on resume. */
149
+ waitForApproval<T = Record<string, unknown>>(key: string, options?: {
150
+ approvalId?: string;
151
+ timeoutSeconds?: number;
152
+ }): Promise<T>;
153
+ }
154
+ export interface WorkflowRunOptions {
155
+ /** Resume an existing run ID (replaying all already-completed steps from Palbase's durable step log). */
156
+ runId?: string;
157
+ rootRunId?: string;
158
+ parentRunId?: string;
159
+ depth?: number;
160
+ rootBudgetUsd?: number;
161
+ maxDepth?: number;
162
+ maxConcurrentChildren?: number;
163
+ maxTotalSteps?: number;
164
+ metadata?: Record<string, unknown>;
165
+ signal?: AbortSignal;
166
+ }
167
+ export interface DurableWorkflow<In, Out> {
168
+ readonly name: string;
169
+ run(input: In, options?: WorkflowRunOptions): Promise<{
170
+ runId: string;
171
+ status: 'completed' | 'waiting';
172
+ output?: Out;
173
+ waitId?: string;
174
+ }>;
175
+ }
176
+ export interface GraphDefinition<State extends Record<string, unknown>> {
177
+ start: string;
178
+ nodes: Record<string, (state: State, step: WorkflowStepContext) => State | Partial<State> | Promise<State | Partial<State>>>;
179
+ edges: Record<string, string | ((state: State) => string)>;
180
+ maxSteps?: number;
181
+ }
182
+ export interface DurableGraph<State extends Record<string, unknown>> {
183
+ readonly name: string;
184
+ run(initialState: State, options?: WorkflowRunOptions): Promise<{
185
+ runId: string;
186
+ status: 'completed' | 'waiting';
187
+ state?: State;
188
+ waitId?: string;
189
+ }>;
190
+ }
191
+ export declare function orchestrationOf(module: Module): {
192
+ triggers: Triggers;
193
+ waits: Waits;
194
+ workflows: Workflows;
195
+ memory: Memory;
196
+ groups: ActorGroups;
197
+ mcpAuth: MCPAuth;
198
+ workflow<In, Out>(name: string, fn: (input: In, step: WorkflowStepContext) => Out | Promise<Out>): DurableWorkflow<In, Out>;
199
+ graph<State extends Record<string, unknown>>(name: string, def: GraphDefinition<State>): DurableGraph<State>;
200
+ };
201
+ export {};
@@ -2,10 +2,10 @@ import * as modules from '../../../internal/src/modules/index.js';
2
2
  import type { Transport } from '../../../internal/src/transport.js';
3
3
  /** A project's environment as an access token reaches it: each module's operations under the paths the edge opens to one, a server's calls. */
4
4
  export interface Project {
5
- ai: Pick<modules.ai.Client, "draftAgent" | "listAgents" | "getAgent" | "putAgent" | "deleteAgent" | "publishAgent" | "rollbackAgent" | "listAgentVersions" | "createAudioSpeech" | "createAudioTranscription" | "listChats" | "createChat" | "getChat" | "deleteChat" | "decideChatApproval" | "getChatExecution" | "patchChatExecution" | "forkChat" | "getChatGoal" | "setChatGoal" | "clearChatGoal" | "updateChatGoal" | "handoffChat" | "putChatMember" | "deleteChatMember" | "listChatMessages" | "sendChatMessage" | "getChatMessageAttachment" | "listChatParts" | "putChatPipe" | "deleteChatPipe" | "sendSubagentMessage" | "stopSubagent" | "stopChat" | "listTurnToolCalls" | "getChatToolCall" | "answerChatToolCall" | "listChatTurnArtifacts" | "getChatTurnArtifact" | "getChatTurnCost" | "startChatVoice" | "getChatVoice" | "closeChatVoice" | "commandChatVoice" | "createEmbeddings" | "listEndpoints" | "putEndpoint" | "deleteEndpoint" | "listEnv" | "listEnvAllowances" | "deleteEnvAllowance" | "listEnvHostRequests" | "allowEnvHostRequest" | "dismissEnvHostRequest" | "putEnv" | "deleteEnv" | "allowEnvHost" | "listEnvironments" | "createEnvironment" | "getEnvironment" | "putEnvironment" | "deleteEnvironment" | "createEnvironmentBuild" | "getEnvironmentBuild" | "createImage" | "getImage" | "getImageFile" | "deleteMachine" | "cordonMachine" | "resumeMachine" | "listModels" | "revokePoolKey" | "listPools" | "createPool" | "deletePool" | "listPoolKeys" | "createPoolKey" | "getPoolState" | "listProviders" | "connectProvider" | "disconnectProvider" | "createResponse" | "getResponse" | "cancelResponse" | "followResponse" | "getSettings" | "putSettings" | "getSpend" | "askSupport" | "listTools" | "listUsage" | "gatewayAudioSpeech" | "gatewayAudioTranscriptions" | "gatewayChatCompletions" | "gatewayEmbeddings" | "gatewayImagesGenerations" | "gatewayAnthropicMessages" | "gatewayListModels" | "gatewayResponses" | "createVideo" | "getVideo" | "cancelVideo">;
5
+ ai: Pick<modules.ai.Client, "draftAgent" | "listAgents" | "getAgent" | "putAgent" | "deleteAgent" | "publishAgent" | "rollbackAgent" | "listAgentVersions" | "createAudioSpeech" | "createAudioTranscription" | "listChats" | "createChat" | "getChat" | "deleteChat" | "decideChatApproval" | "getChatExecution" | "patchChatExecution" | "forkChat" | "getChatGoal" | "setChatGoal" | "clearChatGoal" | "updateChatGoal" | "handoffChat" | "putChatMember" | "deleteChatMember" | "listChatMessages" | "sendChatMessage" | "getChatMessageAttachment" | "listChatParts" | "putChatPipe" | "deleteChatPipe" | "sendSubagentMessage" | "stopSubagent" | "stopChat" | "listTurnToolCalls" | "getChatToolCall" | "answerChatToolCall" | "listChatTurnArtifacts" | "getChatTurnArtifact" | "getChatTurnCost" | "startChatVoice" | "getChatVoice" | "closeChatVoice" | "commandChatVoice" | "createEmbeddings" | "listEndpoints" | "putEndpoint" | "deleteEndpoint" | "listEnv" | "listEnvAllowances" | "deleteEnvAllowance" | "listEnvHostRequests" | "allowEnvHostRequest" | "dismissEnvHostRequest" | "putEnv" | "deleteEnv" | "allowEnvHost" | "listEnvironments" | "createEnvironment" | "getEnvironment" | "putEnvironment" | "deleteEnvironment" | "createEnvironmentBuild" | "getEnvironmentBuild" | "createImage" | "getImage" | "getImageFile" | "deleteMachine" | "cordonMachine" | "resumeMachine" | "listModels" | "revokePoolKey" | "listPools" | "createPool" | "deletePool" | "listPoolKeys" | "createPoolKey" | "getPoolState" | "listProviders" | "connectProvider" | "disconnectProvider" | "createResponse" | "getResponse" | "cancelResponse" | "followResponse" | "getSettings" | "putSettings" | "getSpend" | "askSupport" | "listTools" | "listUsage" | "gatewayAudioSpeech" | "gatewayAudioTranscriptions" | "gatewayChatCompletions" | "gatewayEmbeddings" | "gatewayImagesGenerations" | "gatewayAnthropicMessages" | "gatewayListModels" | "gatewayResponses" | "createVideo" | "getVideo" | "cancelVideo" | "listTriggers" | "createTrigger" | "getTrigger" | "deleteTrigger" | "updateTrigger" | "testTrigger" | "listWaits" | "getWait" | "signalWait" | "cancelWait" | "listWorkflowRuns" | "createWorkflowRun" | "getWorkflowRun" | "recordWorkflowStep" | "completeWorkflowRun" | "replayWorkflowRun" | "stopRunTree" | "getMemory" | "putMemory" | "deleteMemory" | "searchMemory" | "listActorGroupMembers" | "addActorGroupMember" | "broadcastActorGroup" | "callA2Arpc" | "putMcpUserCredential" | "deleteMcpUserCredential" | "startMcpoAuth" | "listTemplates" | "getTemplate" | "putTemplate" | "deleteTemplate" | "publishTemplate" | "rollbackTemplate" | "listTemplateVersions" | "listUserSpend" | "getUserQuota" | "putUserQuota" | "deleteUserQuota" | "clientAttestChallenge" | "runClientTemplate" | "voiceClientTemplate">;
6
6
  analytics: Pick<modules.analytics.Client, "listAudiences" | "createAudience" | "previewAudience" | "getAudience" | "deleteAudience" | "updateAudience" | "listAudienceMembers" | "alias" | "batch" | "getEventBreakdown" | "capture" | "sendConsoleHistory" | "getConsoleConfig" | "listConsoleRecords" | "listEventNames" | "listEvents" | "getEventTimeline" | "runFunnel" | "identify" | "page" | "sendPerf" | "listPerfGroups" | "getPerfConfig" | "getPerfTimeline" | "listRequestLines" | "getMachineTraffic" | "runRetention" | "screen" | "getSettings" | "putSettings" | "getSummary" | "listTraces" | "sendTrace" | "sendTraceBatch" | "getTraceHops" | "listSessionTraces" | "getTraceSummary" | "getTraceTimeline" | "searchPeople" | "setPersonProperties" | "getPerson" | "listPersonEvents" | "getEventCatalog" | "defineEvent">;
7
7
  auth: Pick<modules.auth.Client, "adminVerifyDeviceAssertion" | "adminGetAttestPolicy" | "adminGetAttestObservations" | "adminRecordAttestObservations" | "adminListAuditEvents" | "adminExportAuditEvents" | "adminVerifyAuditTrail" | "adminGetAuthSettings" | "adminUpdateAuthSettings" | "adminGetBreachWatch" | "adminListHooks" | "adminCreateHook" | "adminUpdateHook" | "adminDeleteHook" | "adminListHookExecutions" | "adminListIntegrations" | "adminPutIntegration" | "adminDeleteIntegration" | "adminListOAuthClients" | "adminCreateOAuthClient" | "adminGetOAuthClient" | "adminDeleteOAuthClient" | "adminUpdateOAuthClient" | "adminListProviders" | "adminGetPhoneSettings" | "adminUpdatePhoneSettings" | "adminToggleProvider" | "adminListRoles" | "adminUpsertRole" | "adminDeleteRole" | "adminListServiceAccounts" | "adminCreateServiceAccount" | "adminGetServiceAccount" | "adminRevokeServiceAccount" | "adminRotateServiceAccount" | "adminListSessions" | "adminRevokeSession" | "adminListSigningKeys" | "adminRotateSigningKey" | "socialAdminConfig" | "socialCredentialPut" | "socialCredentialDelete" | "socialProviderPatch" | "adminGetStats" | "adminSendTestTemplate" | "adminListTestUsers" | "adminCreateTestUsers" | "adminSetTestUserPhone" | "adminCreateTestSignupAddress" | "adminDeleteTestUser" | "adminCreateCustomToken" | "adminListUsers" | "adminCreateUser" | "adminImportUsers" | "adminGetUser" | "adminDeleteUser" | "adminUpdateUser" | "adminBanUser" | "adminGetUserConsents" | "adminRevokeUserCredentials" | "adminExportUser" | "adminListUserMfaFactors" | "adminResetUserMfa" | "adminResetUserPassword" | "adminListUserRoles" | "adminAssignUserRole" | "adminRevokeUserRole" | "adminRevokeUserSessions" | "adminUnbanUser" | "adminGetInstallationConsents" | "adminRefuseConsents" | "adminInviteUser">;
8
- calls: Pick<modules.calls.Client, "adminListCalls" | "adminGetCall" | "adminEndCall" | "createCallTicket" | "getCallSettings" | "putCallSettings" | "rotateCallHookSecret">;
8
+ calls: Pick<modules.calls.Client, "adminListCalls" | "adminGetCall" | "adminEndCall" | "createCallTicket" | "adminGetCallTranscription" | "adminStartCallTranscription" | "adminStopCallTranscription" | "adminIngestCallTranscriptionAudio" | "getCallSettings" | "putCallSettings" | "rotateCallHookSecret">;
9
9
  flags: Pick<modules.flags.Client, "getValues" | "batchUserValues" | "getDelta" | "getEvaluations" | "listExperiments" | "startExperiment" | "getExperiment" | "getExperimentResults" | "stopExperiment" | "declareExperimentWinner" | "getCurrentInstallations" | "getInstallationsDaily" | "getSnapshot" | "listDefinitions" | "getDefinition" | "putDefinition" | "deleteDefinition" | "activateTemplates" | "getActiveTemplate" | "getTemplateCapabilities" | "getTemplateDraft" | "createTemplateDraft" | "discardTemplateDraft" | "putTemplateParameter" | "removeTemplateParameter" | "reviewTemplateDraft" | "publishTemplate" | "getPublishReceipt" | "restoreTemplateVersion" | "listTemplateVersions" | "getTemplateVersion" | "getUserValues" | "putUserValues" | "deleteUserValues" | "putUserValue" | "deleteUserValue">;
10
10
  iap: Pick<modules.iap.Client, "getAppleAccount" | "disconnectApple" | "createAppleGrant" | "getAppleReadiness" | "setXcodeCertificate" | "clearXcodeCertificate" | "setXcodeOfferKey" | "getCatalog" | "saveCatalog" | "planCatalog" | "getCatalogPlan" | "confirmCatalogPlan" | "declineCatalogPlan" | "listCatalogRevisions" | "getCatalogRevision" | "restoreCatalogRevision" | "validateCatalog" | "listCharts" | "getChartsOverview" | "getChart" | "createCheckout" | "createCheckoutRedemption" | "listCoupons" | "createCoupon" | "getCoupon" | "revokeCoupon" | "listCouponCodes" | "searchCustomers" | "getCustomer" | "grantCredits" | "listCreditEntries" | "forgiveCredits" | "listCustomerGrants" | "grantEntitlement" | "revokeGrant" | "getCustomerHistory" | "holdSpend" | "setCustomerLimit" | "clearCustomerLimit" | "grantLimit" | "spend" | "commitSpend" | "extendHold" | "releaseSpend" | "reverseSpend" | "cancelSubscription" | "extendSubscription" | "refundSubscription" | "listExperiments" | "startExperiment" | "getExperiment" | "getExperimentResults" | "stopExperiment" | "declareExperimentWinner" | "getGoogleAccount" | "connectGoogle" | "disconnectGoogle" | "getOfferings" | "getOfferStats" | "listPaywalls" | "createPaywall" | "listPaywallAssets" | "registerPaywallAsset" | "deletePaywallAsset" | "listPaywallTemplates" | "getPaywallTemplateAsset" | "validatePaywall" | "getPaywall" | "deletePaywall" | "savePaywallDraft" | "publishPaywall" | "listPaywallVersions" | "getPaywallVersion" | "listPlacements" | "listAttributeKeys" | "setPlacement" | "deletePlacement" | "recordPaywallExposure" | "getPlacementPaywall" | "previewPlacement" | "getPlacementResults" | "getPlacementRules" | "setPlacementRules" | "getSettings" | "updateSettings">;
11
11
  journeys: Pick<modules.journeys.Client, "listJourneys" | "createJourney" | "listPersonRuns" | "simulateJourney" | "validateJourney" | "getJourney" | "updateJourney" | "deleteJourney" | "copyJourney" | "publishJourney" | "listJourneyRuns" | "getJourneyStats" | "stopJourney" | "testJourney">;