@valon-technologies/gestalt 0.0.1-alpha.18 → 0.0.1-alpha.20

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.
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,
@@ -224,7 +224,7 @@ export class Cache {
224
224
  /**
225
225
  * Cache provider implementation consumed by the Gestalt runtime.
226
226
  */
227
- export class CacheProvider extends RuntimeProvider {
227
+ export class CacheProvider extends ProviderBase {
228
228
  readonly kind = "cache" as const;
229
229
 
230
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, Host, 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
@@ -60,7 +67,7 @@ export function httpSubjectError(
60
67
  export type HTTPSubjectResolver = (
61
68
  request: HTTPSubjectRequest,
62
69
  context: HTTPSubjectResolutionContext,
63
- ) => MaybePromise<Subject | null | undefined>;
70
+ ) => MaybePromise<SubjectInput | null | undefined>;
64
71
 
65
72
  export function cloneHTTPSubjectRequest(
66
73
  input: HTTPSubjectRequest,
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,
@@ -55,10 +113,12 @@ export {
55
113
  type Host,
56
114
  type MaybePromise,
57
115
  type Credential,
116
+ type ExternalIdentity,
58
117
  type OperationResult,
59
118
  type Request,
60
119
  type Response,
61
120
  type Subject,
121
+ type SubjectInput,
62
122
  } from "./api.ts";
63
123
  export {
64
124
  type HTTPSubjectRequest,
@@ -77,6 +137,7 @@ export {
77
137
  type CatalogOperation,
78
138
  type CatalogParameter,
79
139
  type CatalogSchema,
140
+ type OperationAnnotations,
80
141
  } from "./catalog.ts";
81
142
  export {
82
143
  buildProviderBinary,
@@ -107,18 +168,20 @@ export {
107
168
  type AgentManagerListTurnsInput,
108
169
  type AgentManagerResolveInteractionInput,
109
170
  type AgentManagerUpdateSessionInput,
171
+ type AgentManagerWorkspace,
172
+ type AgentManagerWorkspaceGitCheckout,
110
173
  } from "./agent-manager.ts";
111
174
  export {
112
175
  ENV_WORKFLOW_MANAGER_SOCKET,
113
176
  ENV_WORKFLOW_MANAGER_SOCKET_TOKEN,
114
177
  WorkflowManager,
115
- type ManagedWorkflowEventTriggerMessage,
116
- type ManagedWorkflowScheduleMessage,
117
- type WorkflowEventMessage,
178
+ type WorkflowManagerCreateDefinitionInput,
118
179
  type WorkflowManagerCreateTriggerInput,
119
180
  type WorkflowManagerCreateScheduleInput,
181
+ type WorkflowManagerDeleteDefinitionInput,
120
182
  type WorkflowManagerDeleteTriggerInput,
121
183
  type WorkflowManagerDeleteScheduleInput,
184
+ type WorkflowManagerGetDefinitionInput,
122
185
  type WorkflowManagerGetTriggerInput,
123
186
  type WorkflowManagerGetScheduleInput,
124
187
  type WorkflowManagerPauseTriggerInput,
@@ -126,6 +189,10 @@ export {
126
189
  type WorkflowManagerPublishEventInput,
127
190
  type WorkflowManagerResumeTriggerInput,
128
191
  type WorkflowManagerResumeScheduleInput,
192
+ type WorkflowManagerSignalOrStartRunInput,
193
+ type WorkflowManagerSignalRunInput,
194
+ type WorkflowManagerStartRunInput,
195
+ type WorkflowManagerUpdateDefinitionInput,
129
196
  type WorkflowManagerUpdateTriggerInput,
130
197
  type WorkflowManagerUpdateScheduleInput,
131
198
  } from "./workflow-manager.ts";
@@ -136,7 +203,7 @@ export {
136
203
  RuntimeLogHost,
137
204
  type RuntimeLogAppendInput,
138
205
  type RuntimeLogAppendLogsInput,
139
- type RuntimeLogAppendResponseMessage,
206
+ type RuntimeLogAppendResponse,
140
207
  type RuntimeLogStreamInput,
141
208
  type RuntimeLogStreamName,
142
209
  type RuntimeLogWriterOptions,
@@ -188,15 +255,15 @@ export {
188
255
  type SessionCatalogHandler,
189
256
  } from "./plugin.ts";
190
257
  export {
191
- RuntimeProvider,
192
- isRuntimeProvider,
258
+ ProviderBase,
259
+ isProviderBase,
193
260
  slugName,
194
261
  type CloseHandler,
195
262
  type ConfigureHandler,
196
263
  type HealthCheckHandler,
197
264
  type ProviderKind,
198
265
  type ProviderMetadata,
199
- type RuntimeProviderOptions,
266
+ type ProviderBaseOptions,
200
267
  type StartHandler,
201
268
  type WarningsHandler,
202
269
  } from "./provider.ts";
@@ -209,9 +276,17 @@ export {
209
276
  type GetPluginRuntimeSessionRequest,
210
277
  type HostedPlugin,
211
278
  type ListPluginRuntimeSessionsRequest,
279
+ type PluginRuntimeAgentWorkspace,
280
+ type PluginRuntimeAgentWorkspaceGitCheckout,
281
+ type PluginRuntimeImagePullAuth,
282
+ type PluginRuntimePreparedAgentWorkspace,
212
283
  type PluginRuntimeProviderOptions,
213
284
  type PluginRuntimeSession,
285
+ type PluginRuntimeSessionLifecycle,
214
286
  type PluginRuntimeSupport,
287
+ type PreparePluginRuntimeWorkspaceRequest,
288
+ type PreparePluginRuntimeWorkspaceResponse,
289
+ type RemovePluginRuntimeWorkspaceRequest,
215
290
  type StartHostedPluginRequest,
216
291
  type StartPluginRuntimeSessionRequest,
217
292
  type StopPluginRuntimeSessionRequest,
@@ -332,22 +407,28 @@ export {
332
407
  defineAgentProvider,
333
408
  isAgentProvider,
334
409
  type AgentActor,
410
+ type AgentHostExecuteToolInput,
411
+ type AgentHostListToolsInput,
412
+ type AgentHostResolveConnectionInput,
335
413
  type AgentInteraction,
336
414
  type AgentMessage,
337
415
  type AgentMessagePart,
338
416
  type AgentMessagePartImageRef,
339
417
  type AgentMessagePartToolCall,
340
418
  type AgentMessagePartToolResult,
419
+ type AgentPreparedWorkspace,
341
420
  type AgentProviderCapabilities,
342
421
  type AgentProviderOptions,
343
422
  type AgentSession,
423
+ type AgentSessionStartConfig,
424
+ type AgentSessionStartHook,
425
+ type AgentSessionStartHookOutput,
426
+ type AgentSubjectContext,
427
+ type AgentToolAnnotations,
344
428
  type AgentToolRef,
345
429
  type AgentTurn,
346
430
  type AgentTurnDisplay,
347
- type AgentTurnDisplayInit,
348
- type AgentTurnDisplayValue,
349
431
  type AgentTurnEvent,
350
- type AgentTurnEventInit,
351
432
  type CancelAgentProviderTurnRequest,
352
433
  type CreateAgentProviderSessionRequest,
353
434
  type CreateAgentProviderTurnRequest,
@@ -360,9 +441,13 @@ export {
360
441
  type ListAgentToolsRequest,
361
442
  type ListAgentToolsResponse,
362
443
  type ListAgentProviderInteractionsRequest,
444
+ type ListAgentProviderInteractionsResponse,
363
445
  type ListAgentProviderSessionsRequest,
446
+ type ListAgentProviderSessionsResponse,
364
447
  type ListAgentProviderTurnEventsRequest,
448
+ type ListAgentProviderTurnEventsResponse,
365
449
  type ListAgentProviderTurnsRequest,
450
+ type ListAgentProviderTurnsResponse,
366
451
  type ListedAgentTool,
367
452
  type ResolveAgentConnectionRequest,
368
453
  type ResolveAgentProviderInteractionRequest,
@@ -372,36 +457,125 @@ export {
372
457
  } from "./agent.ts";
373
458
  export {
374
459
  ENV_WORKFLOW_HOST_SOCKET,
460
+ ENV_WORKFLOW_HOST_SOCKET_TOKEN,
375
461
  WorkflowHost,
376
462
  WorkflowProvider,
377
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,
378
480
  createWorkflowProviderService,
379
481
  defineWorkflowProvider,
380
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,
381
513
  type BoundWorkflowEventTrigger,
514
+ type BoundWorkflowEventTriggerInput,
515
+ type BoundWorkflowPluginTarget,
516
+ type BoundWorkflowPluginTargetInput,
382
517
  type BoundWorkflowRun,
518
+ type BoundWorkflowRunInput,
383
519
  type BoundWorkflowSchedule,
520
+ type BoundWorkflowScheduleInput,
521
+ type BoundWorkflowTarget,
522
+ type BoundWorkflowTargetInput,
384
523
  type CancelWorkflowProviderRunRequest,
385
524
  type DeleteWorkflowProviderEventTriggerRequest,
386
525
  type DeleteWorkflowProviderScheduleRequest,
526
+ type GetWorkflowExecutionReferenceRequest,
387
527
  type GetWorkflowProviderEventTriggerRequest,
388
528
  type GetWorkflowProviderRunRequest,
389
529
  type GetWorkflowProviderScheduleRequest,
390
- type InvokeWorkflowOperationRequest,
530
+ type InvokeWorkflowOperationInput,
391
531
  type InvokeWorkflowOperationResponse,
532
+ type ListWorkflowExecutionReferencesRequest,
392
533
  type ListWorkflowProviderEventTriggersRequest,
393
534
  type ListWorkflowProviderRunsRequest,
394
535
  type ListWorkflowProviderSchedulesRequest,
536
+ type ManagedWorkflowDefinition,
537
+ type ManagedWorkflowEventTrigger,
538
+ type ManagedWorkflowRun,
539
+ type ManagedWorkflowRunSignal,
540
+ type ManagedWorkflowSchedule,
395
541
  type PauseWorkflowProviderEventTriggerRequest,
396
542
  type PauseWorkflowProviderScheduleRequest,
397
543
  type PublishWorkflowProviderEventRequest,
544
+ type PutWorkflowExecutionReferenceRequest,
398
545
  type ResumeWorkflowProviderEventTriggerRequest,
399
546
  type ResumeWorkflowProviderScheduleRequest,
547
+ type SignalOrStartWorkflowProviderRunRequest,
548
+ type SignalWorkflowProviderRunRequest,
549
+ type SignalWorkflowRunResponse,
400
550
  type StartWorkflowProviderRunRequest,
401
551
  type UpsertWorkflowProviderEventTriggerRequest,
402
552
  type UpsertWorkflowProviderScheduleRequest,
553
+ type WorkflowAccessPermission,
554
+ type WorkflowAccessPermissionInput,
555
+ type WorkflowActor,
556
+ type WorkflowActorInput,
403
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,
404
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,
405
579
  } from "./workflow.ts";
406
580
  export {
407
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";
@@ -1277,7 +1278,7 @@ function toProtoTypedValue(v: unknown): any {
1277
1278
  return { kind: { case: "floatValue", value: v } };
1278
1279
  }
1279
1280
  if (typeof v === "string") return { kind: { case: "stringValue", value: v } };
1280
- if (v instanceof Date) return { kind: { case: "timeValue", value: toProtoTimestamp(v) } };
1281
+ if (v instanceof Date) return { kind: { case: "timeValue", value: timestampFromDate(v) } };
1281
1282
  if (v instanceof Uint8Array) return { kind: { case: "bytesValue", value: v } };
1282
1283
  if (v instanceof ArrayBuffer) return { kind: { case: "bytesValue", value: new Uint8Array(v) } };
1283
1284
  return { kind: { case: "jsonValue", value: toProtoJsonValue(v) } };
@@ -1297,7 +1298,7 @@ function fromProtoTypedValue(v: any): unknown {
1297
1298
  case "boolValue":
1298
1299
  return v.kind.value;
1299
1300
  case "timeValue":
1300
- return fromProtoTimestamp(v.kind.value);
1301
+ return dateFromTimestamp(v.kind.value);
1301
1302
  case "bytesValue":
1302
1303
  return new Uint8Array(v.kind.value);
1303
1304
  case "jsonValue":
@@ -1316,19 +1317,6 @@ function toProtoKeyRange(kr: KeyRange): any {
1316
1317
  };
1317
1318
  }
1318
1319
 
1319
- function toProtoTimestamp(value: Date): any {
1320
- const millis = value.getTime();
1321
- const seconds = Math.trunc(millis / 1000);
1322
- const nanos = Math.trunc((millis % 1000) * 1_000_000);
1323
- return { seconds: BigInt(seconds), nanos };
1324
- }
1325
-
1326
- function fromProtoTimestamp(value: any): Date {
1327
- const seconds = Number(value?.seconds ?? 0n);
1328
- const nanos = Number(value?.nanos ?? 0);
1329
- return new Date((seconds * 1000) + Math.trunc(nanos / 1_000_000));
1330
- }
1331
-
1332
1320
  function toJsInt(value: bigint): number | bigint {
1333
1321
  const asNumber = Number(value);
1334
1322
  return Number.isSafeInteger(asNumber) ? asNumber : value;