@valon-technologies/gestalt 0.0.1-alpha.17 → 0.0.1-alpha.19

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 (39) hide show
  1. package/README.md +34 -12
  2. package/package.json +5 -3
  3. package/src/agent-conversions.ts +201 -0
  4. package/src/agent-manager.ts +272 -83
  5. package/src/agent.ts +1029 -219
  6. package/src/api.ts +54 -0
  7. package/src/auth.ts +3 -3
  8. package/src/authorization.ts +1702 -52
  9. package/src/cache.ts +5 -4
  10. package/src/catalog.ts +22 -0
  11. package/src/http-subject.ts +13 -2
  12. package/src/index.ts +194 -17
  13. package/src/indexeddb.ts +5 -16
  14. package/src/internal/gen/v1/agent_pb.ts +353 -74
  15. package/src/internal/gen/v1/authentication_pb.ts +1 -1
  16. package/src/internal/gen/v1/authorization_pb.ts +505 -27
  17. package/src/internal/gen/v1/cache_pb.ts +1 -1
  18. package/src/internal/gen/v1/datastore_pb.ts +1 -1
  19. package/src/internal/gen/v1/external_credential_pb.ts +434 -29
  20. package/src/internal/gen/v1/plugin_pb.ts +92 -22
  21. package/src/internal/gen/v1/pluginruntime_pb.ts +95 -6
  22. package/src/internal/gen/v1/runtime_pb.ts +1 -1
  23. package/src/internal/gen/v1/s3_pb.ts +1 -1
  24. package/src/internal/gen/v1/secrets_pb.ts +1 -1
  25. package/src/internal/gen/v1/workflow_pb.ts +349 -67
  26. package/src/invoker.ts +6 -35
  27. package/src/plugin.ts +12 -12
  28. package/src/pluginruntime.ts +337 -49
  29. package/src/protocol/v1.ts +19 -0
  30. package/src/protocol-internal.ts +19 -0
  31. package/src/protocol.ts +183 -0
  32. package/src/provider-kind.ts +7 -3
  33. package/src/provider.ts +21 -13
  34. package/src/runtime-log-host.ts +81 -53
  35. package/src/runtime.ts +72 -0
  36. package/src/s3.ts +15 -29
  37. package/src/secrets.ts +3 -3
  38. package/src/workflow-manager.ts +350 -121
  39. package/src/workflow.ts +2598 -389
package/src/cache.ts CHANGED
@@ -4,7 +4,7 @@ import { createClient, type Client, type Interceptor } from "@connectrpc/connect
4
4
  import { createGrpcTransport } from "@connectrpc/connect-node";
5
5
 
6
6
  import { Cache as CacheService } from "./internal/gen/v1/cache_pb.ts";
7
- import { RuntimeProvider, type RuntimeProviderOptions } from "./provider.ts";
7
+ import { ProviderBase, type ProviderBaseOptions } from "./provider.ts";
8
8
  import type { MaybePromise } from "./api.ts";
9
9
 
10
10
  /** Base environment variable for discovering cache runtime sockets. */
@@ -33,7 +33,7 @@ export interface CacheSetOptions {
33
33
  /**
34
34
  * Runtime hooks required to implement a Gestalt cache provider.
35
35
  */
36
- export interface CacheProviderOptions extends RuntimeProviderOptions {
36
+ export interface CacheProviderOptions extends ProviderBaseOptions {
37
37
  get: (key: string) => MaybePromise<Uint8Array | null | undefined>;
38
38
  set: (
39
39
  key: string,
@@ -139,7 +139,8 @@ export class Cache {
139
139
  ...(transportOptions.nodeOptions
140
140
  ? {
141
141
  nodeOptions: {
142
- createConnection: () => connect(transportOptions.nodeOptions!.path),
142
+ createConnection: () =>
143
+ connect({ path: transportOptions.nodeOptions!.path }),
143
144
  },
144
145
  }
145
146
  : {}),
@@ -223,7 +224,7 @@ export class Cache {
223
224
  /**
224
225
  * Cache provider implementation consumed by the Gestalt runtime.
225
226
  */
226
- export class CacheProvider extends RuntimeProvider {
227
+ export class CacheProvider extends ProviderBase {
227
228
  readonly kind = "cache" as const;
228
229
 
229
230
  private readonly getHandler: CacheProviderOptions["get"];
package/src/catalog.ts CHANGED
@@ -15,6 +15,16 @@ export interface CatalogParameter {
15
15
  default?: unknown;
16
16
  }
17
17
 
18
+ /**
19
+ * Optional host hints attached to a catalog operation.
20
+ */
21
+ export interface OperationAnnotations {
22
+ readOnlyHint?: boolean;
23
+ idempotentHint?: boolean;
24
+ destructiveHint?: boolean;
25
+ openWorldHint?: boolean;
26
+ }
27
+
18
28
  /**
19
29
  * JSON-schema-like description used in provider catalogs.
20
30
  */
@@ -38,9 +48,12 @@ export interface CatalogOperation {
38
48
  parameters?: CatalogParameter[];
39
49
  inputSchema?: CatalogSchema;
40
50
  outputSchema?: CatalogSchema;
51
+ annotations?: OperationAnnotations;
52
+ requiredScopes?: string[];
41
53
  tags?: string[];
42
54
  readOnly?: boolean;
43
55
  visible?: boolean;
56
+ transport?: string;
44
57
  allowedRoles?: string[];
45
58
  }
46
59
 
@@ -182,6 +195,12 @@ function toCatalogJsonObject(
182
195
  if (operation.outputSchema !== undefined) {
183
196
  serialized.outputSchema = operation.outputSchema;
184
197
  }
198
+ if (operation.annotations !== undefined) {
199
+ serialized.annotations = operation.annotations;
200
+ }
201
+ if (operation.requiredScopes && operation.requiredScopes.length > 0) {
202
+ serialized.requiredScopes = operation.requiredScopes;
203
+ }
185
204
  if (operation.tags && operation.tags.length > 0) {
186
205
  serialized.tags = operation.tags;
187
206
  }
@@ -191,6 +210,9 @@ function toCatalogJsonObject(
191
210
  if (operation.visible !== undefined) {
192
211
  serialized.visible = operation.visible;
193
212
  }
213
+ if (operation.transport) {
214
+ serialized.transport = operation.transport;
215
+ }
194
216
  if (operation.allowedRoles && operation.allowedRoles.length > 0) {
195
217
  serialized.allowedRoles = operation.allowedRoles;
196
218
  }
@@ -1,4 +1,11 @@
1
- import type { Access, Credential, MaybePromise, Subject } from "./api.ts";
1
+ import type {
2
+ Access,
3
+ Credential,
4
+ Host,
5
+ MaybePromise,
6
+ Subject,
7
+ SubjectInput,
8
+ } from "./api.ts";
2
9
 
3
10
  /**
4
11
  * Verified hosted HTTP request metadata passed into optional plugin-local
@@ -26,6 +33,7 @@ export interface HTTPSubjectResolutionContext {
26
33
  subject: Subject;
27
34
  credential: Credential;
28
35
  access: Access;
36
+ host: Host;
29
37
  workflow: Record<string, unknown>;
30
38
  }
31
39
 
@@ -59,7 +67,7 @@ export function httpSubjectError(
59
67
  export type HTTPSubjectResolver = (
60
68
  request: HTTPSubjectRequest,
61
69
  context: HTTPSubjectResolutionContext,
62
- ) => MaybePromise<Subject | null | undefined>;
70
+ ) => MaybePromise<SubjectInput | null | undefined>;
63
71
 
64
72
  export function cloneHTTPSubjectRequest(
65
73
  input: HTTPSubjectRequest,
@@ -96,6 +104,9 @@ export function cloneHTTPSubjectResolutionContext(
96
104
  access: {
97
105
  ...input.access,
98
106
  },
107
+ host: {
108
+ ...input.host,
109
+ },
99
110
  workflow: {
100
111
  ...input.workflow,
101
112
  },
package/src/index.ts CHANGED
@@ -29,21 +29,79 @@
29
29
  * ```
30
30
  */
31
31
  export {
32
+ AGENT_SESSION_ACTION_EDIT,
33
+ AGENT_SESSION_ACTION_VIEW,
34
+ AGENT_SESSION_RELATION_EDITOR,
35
+ AGENT_SESSION_RESOURCE_TYPE,
32
36
  Authorization,
33
37
  AuthorizationClient,
38
+ AuthorizationProvider,
39
+ AUTHORIZATION_SUBJECT_TYPE_SUBJECT,
34
40
  ENV_AUTHORIZATION_SOCKET,
35
41
  ENV_AUTHORIZATION_SOCKET_TOKEN,
36
- type AuthorizationActionSearchMessage,
37
- type AuthorizationDecisionMessage,
42
+ agentSessionAuthorizationResource,
43
+ agentSessionEditorRelationship,
44
+ agentSessionEditorWriteRequest,
45
+ authorizationAction,
46
+ createAuthorizationProviderService,
47
+ defineAuthorizationProvider,
48
+ authorizationRelationship,
49
+ authorizationRelationshipKeyWithTarget,
50
+ authorizationRelationshipKey,
51
+ authorizationRelationshipWithTarget,
52
+ authorizationResource,
53
+ authorizationResourceTarget,
54
+ authorizationSubject,
55
+ authorizationSubjectSet,
56
+ authorizationSubjectSetTarget,
57
+ authorizationSubjectTarget,
58
+ isAuthorizationProvider,
59
+ type AuthorizationAction,
60
+ type AuthorizationActionSearch,
61
+ type AuthorizationDecision,
38
62
  type AuthorizationEvaluateInput,
39
- type AuthorizationMetadataMessage,
63
+ type AuthorizationEvaluateManyInput,
64
+ type AuthorizationEvaluationsResponse,
65
+ type AuthorizationEffectiveSearchSubjectsInput,
66
+ type AuthorizationEffectiveSubjectSearch,
67
+ type AuthorizationExpandInput,
68
+ type AuthorizationExpand,
69
+ type AuthorizationExpandNode,
70
+ type AuthorizationGetActiveModel,
71
+ type AuthorizationListModelsInput,
72
+ type AuthorizationListModels,
73
+ type AuthorizationMetadata,
74
+ type AuthorizationModel,
75
+ type AuthorizationModelAction,
76
+ type AuthorizationModelAllowedTarget,
77
+ type AuthorizationModelAllowedTargetKind,
78
+ type AuthorizationModelComputedUserset,
79
+ type AuthorizationModelRef,
80
+ type AuthorizationModelRelation,
81
+ type AuthorizationModelResourceType,
82
+ type AuthorizationModelRewrite,
83
+ type AuthorizationModelRewriteKind,
84
+ type AuthorizationModelRewriteThis,
85
+ type AuthorizationModelRewriteUnion,
86
+ type AuthorizationModelSubjectSetTarget,
87
+ type AuthorizationModelTupleToUserset,
88
+ type AuthorizationProviderOptions,
40
89
  type AuthorizationReadRelationshipsInput,
41
- type AuthorizationReadRelationshipsMessage,
42
- type AuthorizationResourceSearchMessage,
90
+ type AuthorizationReadRelationships,
91
+ type AuthorizationRelationship,
92
+ type AuthorizationRelationshipKey,
93
+ type AuthorizationRelationshipTarget,
94
+ type AuthorizationRelationshipTargetKind,
95
+ type AuthorizationResource,
96
+ type AuthorizationSubjectSet,
97
+ type AuthorizationResourceSearch,
43
98
  type AuthorizationSearchActionsInput,
44
99
  type AuthorizationSearchResourcesInput,
45
100
  type AuthorizationSearchSubjectsInput,
46
- type AuthorizationSubjectSearchMessage,
101
+ type AuthorizationSubject,
102
+ type AuthorizationSubjectSearch,
103
+ type AuthorizationWriteRelationshipsInput,
104
+ type AuthorizationWriteModelInput,
47
105
  } from "./authorization.ts";
48
106
  export {
49
107
  connectionParam,
@@ -52,12 +110,15 @@ export {
52
110
  responseBrand,
53
111
  request,
54
112
  type Access,
113
+ type Host,
55
114
  type MaybePromise,
56
115
  type Credential,
116
+ type ExternalIdentity,
57
117
  type OperationResult,
58
118
  type Request,
59
119
  type Response,
60
120
  type Subject,
121
+ type SubjectInput,
61
122
  } from "./api.ts";
62
123
  export {
63
124
  type HTTPSubjectRequest,
@@ -76,6 +137,7 @@ export {
76
137
  type CatalogOperation,
77
138
  type CatalogParameter,
78
139
  type CatalogSchema,
140
+ type OperationAnnotations,
79
141
  } from "./catalog.ts";
80
142
  export {
81
143
  buildProviderBinary,
@@ -106,18 +168,20 @@ export {
106
168
  type AgentManagerListTurnsInput,
107
169
  type AgentManagerResolveInteractionInput,
108
170
  type AgentManagerUpdateSessionInput,
171
+ type AgentManagerWorkspace,
172
+ type AgentManagerWorkspaceGitCheckout,
109
173
  } from "./agent-manager.ts";
110
174
  export {
111
175
  ENV_WORKFLOW_MANAGER_SOCKET,
112
176
  ENV_WORKFLOW_MANAGER_SOCKET_TOKEN,
113
177
  WorkflowManager,
114
- type ManagedWorkflowEventTriggerMessage,
115
- type ManagedWorkflowScheduleMessage,
116
- type WorkflowEventMessage,
178
+ type WorkflowManagerCreateDefinitionInput,
117
179
  type WorkflowManagerCreateTriggerInput,
118
180
  type WorkflowManagerCreateScheduleInput,
181
+ type WorkflowManagerDeleteDefinitionInput,
119
182
  type WorkflowManagerDeleteTriggerInput,
120
183
  type WorkflowManagerDeleteScheduleInput,
184
+ type WorkflowManagerGetDefinitionInput,
121
185
  type WorkflowManagerGetTriggerInput,
122
186
  type WorkflowManagerGetScheduleInput,
123
187
  type WorkflowManagerPauseTriggerInput,
@@ -125,6 +189,10 @@ export {
125
189
  type WorkflowManagerPublishEventInput,
126
190
  type WorkflowManagerResumeTriggerInput,
127
191
  type WorkflowManagerResumeScheduleInput,
192
+ type WorkflowManagerSignalOrStartRunInput,
193
+ type WorkflowManagerSignalRunInput,
194
+ type WorkflowManagerStartRunInput,
195
+ type WorkflowManagerUpdateDefinitionInput,
128
196
  type WorkflowManagerUpdateTriggerInput,
129
197
  type WorkflowManagerUpdateScheduleInput,
130
198
  } from "./workflow-manager.ts";
@@ -135,7 +203,7 @@ export {
135
203
  RuntimeLogHost,
136
204
  type RuntimeLogAppendInput,
137
205
  type RuntimeLogAppendLogsInput,
138
- type RuntimeLogAppendResponseMessage,
206
+ type RuntimeLogAppendResponse,
139
207
  type RuntimeLogStreamInput,
140
208
  type RuntimeLogStreamName,
141
209
  type RuntimeLogWriterOptions,
@@ -187,15 +255,15 @@ export {
187
255
  type SessionCatalogHandler,
188
256
  } from "./plugin.ts";
189
257
  export {
190
- RuntimeProvider,
191
- isRuntimeProvider,
258
+ ProviderBase,
259
+ isProviderBase,
192
260
  slugName,
193
261
  type CloseHandler,
194
262
  type ConfigureHandler,
195
263
  type HealthCheckHandler,
196
264
  type ProviderKind,
197
265
  type ProviderMetadata,
198
- type RuntimeProviderOptions,
266
+ type ProviderBaseOptions,
199
267
  type StartHandler,
200
268
  type WarningsHandler,
201
269
  } from "./provider.ts";
@@ -208,9 +276,17 @@ export {
208
276
  type GetPluginRuntimeSessionRequest,
209
277
  type HostedPlugin,
210
278
  type ListPluginRuntimeSessionsRequest,
279
+ type PluginRuntimeAgentWorkspace,
280
+ type PluginRuntimeAgentWorkspaceGitCheckout,
281
+ type PluginRuntimeImagePullAuth,
282
+ type PluginRuntimePreparedAgentWorkspace,
211
283
  type PluginRuntimeProviderOptions,
212
284
  type PluginRuntimeSession,
285
+ type PluginRuntimeSessionLifecycle,
213
286
  type PluginRuntimeSupport,
287
+ type PreparePluginRuntimeWorkspaceRequest,
288
+ type PreparePluginRuntimeWorkspaceResponse,
289
+ type RemovePluginRuntimeWorkspaceRequest,
214
290
  type StartHostedPluginRequest,
215
291
  type StartPluginRuntimeSessionRequest,
216
292
  type StopPluginRuntimeSessionRequest,
@@ -331,22 +407,28 @@ export {
331
407
  defineAgentProvider,
332
408
  isAgentProvider,
333
409
  type AgentActor,
410
+ type AgentHostExecuteToolInput,
411
+ type AgentHostListToolsInput,
412
+ type AgentHostResolveConnectionInput,
334
413
  type AgentInteraction,
335
414
  type AgentMessage,
336
415
  type AgentMessagePart,
337
416
  type AgentMessagePartImageRef,
338
417
  type AgentMessagePartToolCall,
339
418
  type AgentMessagePartToolResult,
419
+ type AgentPreparedWorkspace,
340
420
  type AgentProviderCapabilities,
341
421
  type AgentProviderOptions,
342
422
  type AgentSession,
423
+ type AgentSessionStartConfig,
424
+ type AgentSessionStartHook,
425
+ type AgentSessionStartHookOutput,
426
+ type AgentSubjectContext,
427
+ type AgentToolAnnotations,
343
428
  type AgentToolRef,
344
429
  type AgentTurn,
345
430
  type AgentTurnDisplay,
346
- type AgentTurnDisplayInit,
347
- type AgentTurnDisplayValue,
348
431
  type AgentTurnEvent,
349
- type AgentTurnEventInit,
350
432
  type CancelAgentProviderTurnRequest,
351
433
  type CreateAgentProviderSessionRequest,
352
434
  type CreateAgentProviderTurnRequest,
@@ -359,46 +441,141 @@ export {
359
441
  type ListAgentToolsRequest,
360
442
  type ListAgentToolsResponse,
361
443
  type ListAgentProviderInteractionsRequest,
444
+ type ListAgentProviderInteractionsResponse,
362
445
  type ListAgentProviderSessionsRequest,
446
+ type ListAgentProviderSessionsResponse,
363
447
  type ListAgentProviderTurnEventsRequest,
448
+ type ListAgentProviderTurnEventsResponse,
364
449
  type ListAgentProviderTurnsRequest,
450
+ type ListAgentProviderTurnsResponse,
365
451
  type ListedAgentTool,
452
+ type ResolveAgentConnectionRequest,
366
453
  type ResolveAgentProviderInteractionRequest,
454
+ type ResolvedAgentConnection,
367
455
  type ResolvedAgentTool,
368
456
  type UpdateAgentProviderSessionRequest,
369
457
  } from "./agent.ts";
370
458
  export {
371
459
  ENV_WORKFLOW_HOST_SOCKET,
460
+ ENV_WORKFLOW_HOST_SOCKET_TOKEN,
372
461
  WorkflowHost,
373
462
  WorkflowProvider,
374
463
  WorkflowRunStatus,
464
+ boundWorkflowAgentTarget,
465
+ boundWorkflowAgentTargetInputFromTarget,
466
+ boundWorkflowEventTrigger,
467
+ boundWorkflowEventTriggerFromTrigger,
468
+ boundWorkflowEventTriggerInputFromTrigger,
469
+ boundWorkflowPluginTarget,
470
+ boundWorkflowPluginTargetInputFromTarget,
471
+ boundWorkflowRun,
472
+ boundWorkflowRunFromRun,
473
+ boundWorkflowRunInputFromRun,
474
+ boundWorkflowSchedule,
475
+ boundWorkflowScheduleFromSchedule,
476
+ boundWorkflowScheduleInputFromSchedule,
477
+ boundWorkflowTarget,
478
+ boundWorkflowTargetFromTarget,
479
+ boundWorkflowTargetInputFromTarget,
375
480
  createWorkflowProviderService,
376
481
  defineWorkflowProvider,
377
482
  isWorkflowProvider,
483
+ workflowAccessPermission,
484
+ workflowAccessPermissionInputFromPermission,
485
+ workflowActor,
486
+ workflowActorInputFromActor,
487
+ workflowEvent,
488
+ workflowEventFromEvent,
489
+ workflowEventInputFromEvent,
490
+ workflowEventMatch,
491
+ workflowEventMatchInputFromMatch,
492
+ workflowEventTriggerInvocation,
493
+ workflowExecutionReference,
494
+ workflowExecutionReferenceFromReference,
495
+ workflowExecutionReferenceInputFromReference,
496
+ workflowOutputBinding,
497
+ workflowOutputBindingInputFromBinding,
498
+ workflowOutputDelivery,
499
+ workflowOutputDeliveryInputFromDelivery,
500
+ workflowOutputValueSource,
501
+ workflowOutputValueSourceInputFromSource,
502
+ workflowRunAsSubject,
503
+ workflowRunAsSubjectInputFromSubject,
504
+ workflowRunTrigger,
505
+ workflowRunTriggerFromTrigger,
506
+ workflowRunTriggerInputFromTrigger,
507
+ workflowScheduleTrigger,
508
+ workflowSignal,
509
+ workflowSignalFromSignal,
510
+ workflowSignalInputFromSignal,
511
+ type BoundWorkflowAgentTarget,
512
+ type BoundWorkflowAgentTargetInput,
378
513
  type BoundWorkflowEventTrigger,
514
+ type BoundWorkflowEventTriggerInput,
515
+ type BoundWorkflowPluginTarget,
516
+ type BoundWorkflowPluginTargetInput,
379
517
  type BoundWorkflowRun,
518
+ type BoundWorkflowRunInput,
380
519
  type BoundWorkflowSchedule,
520
+ type BoundWorkflowScheduleInput,
521
+ type BoundWorkflowTarget,
522
+ type BoundWorkflowTargetInput,
381
523
  type CancelWorkflowProviderRunRequest,
382
524
  type DeleteWorkflowProviderEventTriggerRequest,
383
525
  type DeleteWorkflowProviderScheduleRequest,
526
+ type GetWorkflowExecutionReferenceRequest,
384
527
  type GetWorkflowProviderEventTriggerRequest,
385
528
  type GetWorkflowProviderRunRequest,
386
529
  type GetWorkflowProviderScheduleRequest,
387
- type InvokeWorkflowOperationRequest,
530
+ type InvokeWorkflowOperationInput,
388
531
  type InvokeWorkflowOperationResponse,
532
+ type ListWorkflowExecutionReferencesRequest,
389
533
  type ListWorkflowProviderEventTriggersRequest,
390
534
  type ListWorkflowProviderRunsRequest,
391
535
  type ListWorkflowProviderSchedulesRequest,
536
+ type ManagedWorkflowDefinition,
537
+ type ManagedWorkflowEventTrigger,
538
+ type ManagedWorkflowRun,
539
+ type ManagedWorkflowRunSignal,
540
+ type ManagedWorkflowSchedule,
392
541
  type PauseWorkflowProviderEventTriggerRequest,
393
542
  type PauseWorkflowProviderScheduleRequest,
394
543
  type PublishWorkflowProviderEventRequest,
544
+ type PutWorkflowExecutionReferenceRequest,
395
545
  type ResumeWorkflowProviderEventTriggerRequest,
396
546
  type ResumeWorkflowProviderScheduleRequest,
547
+ type SignalOrStartWorkflowProviderRunRequest,
548
+ type SignalWorkflowProviderRunRequest,
549
+ type SignalWorkflowRunResponse,
397
550
  type StartWorkflowProviderRunRequest,
398
551
  type UpsertWorkflowProviderEventTriggerRequest,
399
552
  type UpsertWorkflowProviderScheduleRequest,
553
+ type WorkflowAccessPermission,
554
+ type WorkflowAccessPermissionInput,
555
+ type WorkflowActor,
556
+ type WorkflowActorInput,
400
557
  type WorkflowEvent,
558
+ type WorkflowEventInput,
559
+ type WorkflowEventMatch,
560
+ type WorkflowEventMatchInput,
561
+ type WorkflowEventTriggerInvocationInput,
562
+ type WorkflowExecutionReference,
563
+ type WorkflowExecutionReferenceInput,
564
+ type WorkflowOutputBinding,
565
+ type WorkflowOutputBindingInput,
566
+ type WorkflowOutputDelivery,
567
+ type WorkflowOutputDeliveryInput,
568
+ type WorkflowOutputValueSource,
569
+ type WorkflowOutputValueSourceInput,
401
570
  type WorkflowProviderOptions,
571
+ type WorkflowRunAsSubject,
572
+ type WorkflowRunAsSubjectInput,
573
+ type WorkflowRunTriggerInput,
574
+ type WorkflowRunTrigger,
575
+ type WorkflowScheduleTrigger,
576
+ type WorkflowScheduleTriggerInput,
577
+ type WorkflowSignal,
578
+ type WorkflowSignalInput,
402
579
  } from "./workflow.ts";
403
580
  export {
404
581
  GENAI_OPERATION_CHAT,
package/src/indexeddb.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  TransactionMode as ProtoTransactionMode,
9
9
  TransactionDurabilityHint as ProtoTransactionDurabilityHint,
10
10
  } from "./internal/gen/v1/datastore_pb";
11
+ import { dateFromTimestamp, timestampFromDate } from "./protocol.ts";
11
12
 
12
13
  const ENV_INDEXEDDB_SOCKET = "GESTALT_INDEXEDDB_SOCKET";
13
14
  const INDEXEDDB_SOCKET_TOKEN_SUFFIX = "_TOKEN";
@@ -536,7 +537,8 @@ export class IndexedDB {
536
537
  ...(transportOptions.nodeOptions
537
538
  ? {
538
539
  nodeOptions: {
539
- createConnection: () => connect(transportOptions.nodeOptions!.path),
540
+ createConnection: () =>
541
+ connect({ path: transportOptions.nodeOptions!.path }),
540
542
  },
541
543
  }
542
544
  : {}),
@@ -1276,7 +1278,7 @@ function toProtoTypedValue(v: unknown): any {
1276
1278
  return { kind: { case: "floatValue", value: v } };
1277
1279
  }
1278
1280
  if (typeof v === "string") return { kind: { case: "stringValue", value: v } };
1279
- if (v instanceof Date) return { kind: { case: "timeValue", value: toProtoTimestamp(v) } };
1281
+ if (v instanceof Date) return { kind: { case: "timeValue", value: timestampFromDate(v) } };
1280
1282
  if (v instanceof Uint8Array) return { kind: { case: "bytesValue", value: v } };
1281
1283
  if (v instanceof ArrayBuffer) return { kind: { case: "bytesValue", value: new Uint8Array(v) } };
1282
1284
  return { kind: { case: "jsonValue", value: toProtoJsonValue(v) } };
@@ -1296,7 +1298,7 @@ function fromProtoTypedValue(v: any): unknown {
1296
1298
  case "boolValue":
1297
1299
  return v.kind.value;
1298
1300
  case "timeValue":
1299
- return fromProtoTimestamp(v.kind.value);
1301
+ return dateFromTimestamp(v.kind.value);
1300
1302
  case "bytesValue":
1301
1303
  return new Uint8Array(v.kind.value);
1302
1304
  case "jsonValue":
@@ -1315,19 +1317,6 @@ function toProtoKeyRange(kr: KeyRange): any {
1315
1317
  };
1316
1318
  }
1317
1319
 
1318
- function toProtoTimestamp(value: Date): any {
1319
- const millis = value.getTime();
1320
- const seconds = Math.trunc(millis / 1000);
1321
- const nanos = Math.trunc((millis % 1000) * 1_000_000);
1322
- return { seconds: BigInt(seconds), nanos };
1323
- }
1324
-
1325
- function fromProtoTimestamp(value: any): Date {
1326
- const seconds = Number(value?.seconds ?? 0n);
1327
- const nanos = Number(value?.nanos ?? 0);
1328
- return new Date((seconds * 1000) + Math.trunc(nanos / 1_000_000));
1329
- }
1330
-
1331
1320
  function toJsInt(value: bigint): number | bigint {
1332
1321
  const asNumber = Number(value);
1333
1322
  return Number.isSafeInteger(asNumber) ? asNumber : value;