@tomflow/proflow-platform-host 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,252 @@
1
+ import { z } from "zod";
2
+ declare const configSchema: z.ZodPipe<z.ZodObject<{
3
+ stateRoot: z.ZodString;
4
+ workspaceRoot: z.ZodString;
5
+ host: z.ZodDefault<z.ZodString>;
6
+ port: z.ZodDefault<z.ZodNumber>;
7
+ executionBaseUrl: z.ZodPipe<z.ZodPipe<z.ZodURL, z.ZodTransform<URL, string>>, z.ZodTransform<string, URL>>;
8
+ executionTransportCredentialFile: z.ZodOptional<z.ZodString>;
9
+ modelBaseUrl: z.ZodPipe<z.ZodPipe<z.ZodURL, z.ZodTransform<URL, string>>, z.ZodTransform<string, URL>>;
10
+ modelTransportCredentialFile: z.ZodOptional<z.ZodString>;
11
+ gatewayTransportCredentialFile: z.ZodOptional<z.ZodString>;
12
+ roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
13
+ agentPackageRef: z.ZodEnum<{
14
+ "@tomflow/proflow-agent-controller-dev": "@tomflow/proflow-agent-controller-dev";
15
+ "@tomflow/proflow-agent-product": "@tomflow/proflow-agent-product";
16
+ "@tomflow/proflow-agent-test-ops": "@tomflow/proflow-agent-test-ops";
17
+ }>;
18
+ registeredPackageVersion: z.ZodString;
19
+ roleRef: z.ZodString;
20
+ carrierUrl: z.ZodURL;
21
+ }, z.core.$strict>>>;
22
+ }, z.core.$strict>, z.ZodTransform<{
23
+ host: string;
24
+ port: number;
25
+ executionBaseUrl: string;
26
+ executionTransportCredentialFile?: string | undefined;
27
+ modelBaseUrl: string;
28
+ modelTransportCredentialFile?: string | undefined;
29
+ gatewayTransportCredentialFile?: string | undefined;
30
+ roles: {
31
+ agentPackageRef: "@tomflow/proflow-agent-controller-dev" | "@tomflow/proflow-agent-product" | "@tomflow/proflow-agent-test-ops";
32
+ registeredPackageVersion: string;
33
+ roleRef: string;
34
+ carrierUrl: string;
35
+ }[];
36
+ stateRoot: string;
37
+ workspaceRoot: string;
38
+ }, {
39
+ stateRoot: string;
40
+ workspaceRoot: string;
41
+ host: string;
42
+ port: number;
43
+ executionBaseUrl: string;
44
+ executionTransportCredentialFile?: string | undefined;
45
+ modelBaseUrl: string;
46
+ modelTransportCredentialFile?: string | undefined;
47
+ gatewayTransportCredentialFile?: string | undefined;
48
+ roles: {
49
+ agentPackageRef: "@tomflow/proflow-agent-controller-dev" | "@tomflow/proflow-agent-product" | "@tomflow/proflow-agent-test-ops";
50
+ registeredPackageVersion: string;
51
+ roleRef: string;
52
+ carrierUrl: string;
53
+ }[];
54
+ }>>;
55
+ export type PlatformHostConfig = z.infer<typeof configSchema>;
56
+ export declare const parsePlatformHostConfig: (value: unknown) => PlatformHostConfig;
57
+ export declare function loadPlatformHostConfig(path: string): Promise<{
58
+ host: string;
59
+ port: number;
60
+ executionBaseUrl: string;
61
+ executionTransportCredentialFile?: string | undefined;
62
+ modelBaseUrl: string;
63
+ modelTransportCredentialFile?: string | undefined;
64
+ gatewayTransportCredentialFile?: string | undefined;
65
+ roles: {
66
+ agentPackageRef: "@tomflow/proflow-agent-controller-dev" | "@tomflow/proflow-agent-product" | "@tomflow/proflow-agent-test-ops";
67
+ registeredPackageVersion: string;
68
+ roleRef: string;
69
+ carrierUrl: string;
70
+ }[];
71
+ stateRoot: string;
72
+ workspaceRoot: string;
73
+ }>;
74
+ export type DependencyReadiness = {
75
+ status: "READY" | "NOT_READY";
76
+ liveness: "UP" | "DOWN";
77
+ owner: "task" | "agent" | "execution" | "model";
78
+ detail?: unknown;
79
+ };
80
+ export type PlatformHostStatus = {
81
+ process: "STOPPED" | "STARTING" | "RUNNING" | "DRAINING";
82
+ liveness: "UP" | "DOWN";
83
+ transport: "UP" | "DOWN";
84
+ readiness: "READY" | "NOT_READY";
85
+ accepting: boolean;
86
+ inFlight: number;
87
+ dependencies: {
88
+ task: DependencyReadiness;
89
+ agent: DependencyReadiness;
90
+ execution: DependencyReadiness;
91
+ model: DependencyReadiness;
92
+ };
93
+ };
94
+ export type PlatformHostBrowserOwnerPorts = {
95
+ task: {
96
+ getWorkerBinding(taskId: string, roleRef: string): Promise<{
97
+ workerRef: string;
98
+ conversationLocator: string | null;
99
+ } | null>;
100
+ bindWorker(input: {
101
+ taskId: string;
102
+ roleRef: string;
103
+ workerRef: string;
104
+ conversationLocator: string;
105
+ }): Promise<void>;
106
+ };
107
+ agent: {
108
+ listPendingMessages(limit: number): Promise<Array<{
109
+ messageId: string;
110
+ threadId: string;
111
+ taskId: string;
112
+ kind: "QUESTION" | "REPLY";
113
+ fromRoleRef: string;
114
+ fromWorkerRef: string;
115
+ targetRoleRef: string;
116
+ targetWorkerRef: string;
117
+ replyToMessageId: string | null;
118
+ content: string;
119
+ status: "PENDING";
120
+ deliveryAttemptCount: number;
121
+ lastDeliveryErrorCode: string | null;
122
+ executionRef: string | null;
123
+ evidenceRef: string | null;
124
+ }>>;
125
+ getPendingMessage(messageRef: string): Promise<{
126
+ messageId: string;
127
+ threadId: string;
128
+ taskId: string;
129
+ kind: "QUESTION" | "REPLY";
130
+ fromRoleRef: string;
131
+ fromWorkerRef: string;
132
+ targetRoleRef: string;
133
+ targetWorkerRef: string;
134
+ replyToMessageId: string | null;
135
+ content: string;
136
+ status: "PENDING";
137
+ deliveryAttemptCount: number;
138
+ lastDeliveryErrorCode: string | null;
139
+ executionRef: string | null;
140
+ evidenceRef: string | null;
141
+ }>;
142
+ reportDeliveryOutcome(input: {
143
+ messageRef: string;
144
+ outcome: "DELIVERED" | "FAILED" | "UNKNOWN";
145
+ executionRef?: string;
146
+ evidenceRef?: string;
147
+ errorCode?: string;
148
+ }): Promise<void>;
149
+ };
150
+ };
151
+ export type PlatformHostExecutionIdentityPort = {
152
+ authorize(request: {
153
+ callerRef: string;
154
+ roleRef?: string | undefined;
155
+ taskId?: string | undefined;
156
+ nodeId?: string | undefined;
157
+ runNo?: number | undefined;
158
+ workerRef?: string | undefined;
159
+ projectRoot?: string | undefined;
160
+ capability: string;
161
+ input: unknown;
162
+ }): Promise<boolean>;
163
+ };
164
+ export type PlatformHostTaskDriverPorts = {
165
+ getTask(taskId: string): Promise<{
166
+ taskId: string;
167
+ status: string;
168
+ version: number;
169
+ currentNodeId: string | null;
170
+ roleBindings: Array<{
171
+ roleRef: string;
172
+ workerRef: string | null;
173
+ }>;
174
+ }>;
175
+ getTaskDriveProjection(taskId: string): Promise<{
176
+ taskId: string;
177
+ taskStatus: string;
178
+ taskVersion: number;
179
+ terminal: boolean;
180
+ currentNode: {
181
+ nodeId: string;
182
+ status: string;
183
+ version: number;
184
+ runNo: number;
185
+ requiredAgentPackageRef: string;
186
+ } | null;
187
+ roleBinding: {
188
+ agentPackageRef: string;
189
+ roleRef: string;
190
+ workerRef: string | null;
191
+ conversationLocator: string | null;
192
+ } | null;
193
+ canDrive: boolean;
194
+ blockedReason: string | null;
195
+ }>;
196
+ getNodeContext(taskId: string, nodeId: string): Promise<{
197
+ task: {
198
+ taskId: string;
199
+ status: string;
200
+ version: number;
201
+ };
202
+ node: {
203
+ nodeId: string;
204
+ status: string;
205
+ version: number;
206
+ runNo: number;
207
+ requiredAgentPackageRef: string;
208
+ workerRef: string | null;
209
+ };
210
+ }>;
211
+ startTask(input: {
212
+ taskId: string;
213
+ expectedTaskVersion: number;
214
+ idempotencyKey: string;
215
+ }): Promise<unknown>;
216
+ startNode(input: {
217
+ taskId: string;
218
+ nodeId: string;
219
+ expectedTaskVersion: number;
220
+ expectedNodeVersion: number;
221
+ idempotencyKey: string;
222
+ }): Promise<unknown>;
223
+ };
224
+ export type PlatformHostAgentIdentityPorts = {
225
+ getRegisteredRole(roleRef: string): Promise<{
226
+ roleRef: string;
227
+ }>;
228
+ };
229
+ export type PlatformHostRoleManagement = {
230
+ invoke(operation: string, input: unknown): Promise<unknown>;
231
+ };
232
+ export declare function createPlatformHost(input: {
233
+ config: PlatformHostConfig;
234
+ log?: (entry: Record<string, unknown>) => void;
235
+ executionCredential?: string;
236
+ }): Readonly<{
237
+ start: () => Promise<{
238
+ host: string;
239
+ port: number;
240
+ }>;
241
+ stop: () => Promise<void>;
242
+ status: () => Promise<PlatformHostStatus>;
243
+ browserOwnerPorts: PlatformHostBrowserOwnerPorts;
244
+ executionIdentity: PlatformHostExecutionIdentityPort;
245
+ taskDriverPorts: PlatformHostTaskDriverPorts;
246
+ agentIdentityPorts: PlatformHostAgentIdentityPorts;
247
+ restart(): Promise<{
248
+ host: string;
249
+ port: number;
250
+ }>;
251
+ }>;
252
+ export {};