@valon-technologies/gestalt 0.0.1-alpha.34 → 0.0.1-alpha.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valon-technologies/gestalt",
3
- "version": "0.0.1-alpha.34",
3
+ "version": "0.0.1-alpha.36",
4
4
  "description": "TypeScript SDK for Gestalt executable providers",
5
5
  "type": "module",
6
6
  "repository": {
package/src/api.ts CHANGED
@@ -7,6 +7,9 @@ export interface Subject {
7
7
  id: string;
8
8
  credentialSubjectId: string;
9
9
  email: string;
10
+ kind?: string | undefined;
11
+ displayName?: string | undefined;
12
+ authSource?: string | undefined;
10
13
  }
11
14
 
12
15
  /**
@@ -169,11 +172,17 @@ export function request(
169
172
  id: subject.id ?? "",
170
173
  credentialSubjectId: subject.credentialSubjectId ?? "",
171
174
  email: subject.email ?? "",
175
+ kind: subject.kind,
176
+ displayName: subject.displayName,
177
+ authSource: subject.authSource,
172
178
  },
173
179
  agentSubject: {
174
180
  id: agentSubject.id ?? "",
175
181
  credentialSubjectId: agentSubject.credentialSubjectId ?? "",
176
182
  email: agentSubject.email ?? "",
183
+ kind: agentSubject.kind,
184
+ displayName: agentSubject.displayName,
185
+ authSource: agentSubject.authSource,
177
186
  },
178
187
  credential: {
179
188
  mode: credential.mode ?? "",
@@ -2,18 +2,30 @@ import { create } from "@bufbuild/protobuf";
2
2
  import {
3
3
  Code,
4
4
  ConnectError,
5
+ createClient,
6
+ type Client,
5
7
  type ServiceImpl,
6
8
  } from "@connectrpc/connect";
9
+ import { EmptySchema } from "@bufbuild/protobuf/wkt";
7
10
 
8
11
  import {
12
+ ActionSchema,
13
+ AddRelationshipRequestSchema,
9
14
  AddRelationshipResponseSchema,
15
+ AuthorizationModelSchema,
16
+ AuthorizationModelResourceTypeFilterSchema,
10
17
  AuthorizationModelRefSchema,
11
18
  AuthorizationModelResourceTypeSchema,
19
+ CheckAccessManyRequestSchema,
12
20
  CheckAccessManyResponseSchema,
21
+ CheckAccessRequestSchema,
13
22
  CheckAccessResponseSchema,
14
23
  DefaultAccessPolicy as ProtoDefaultAccessPolicy,
24
+ DeleteRelationshipRequestSchema,
15
25
  DeleteRelationshipResponseSchema,
16
26
  GetActiveModelRefResponseSchema,
27
+ ListActiveModelResourceTypesRequestSchema,
28
+ ListRelationshipsRequestSchema,
17
29
  ListActiveModelResourceTypesResponseSchema,
18
30
  ListRelationshipsResponseSchema,
19
31
  ModelActionSchema,
@@ -24,7 +36,9 @@ import {
24
36
  RelationshipTargetType as ProtoRelationshipTargetType,
25
37
  RelationshipTupleSchema,
26
38
  ResourceSchema,
39
+ SetActiveModelRequestSchema,
27
40
  SetActiveModelResponseSchema,
41
+ SetAuthorizationStateRequestSchema,
28
42
  SetAuthorizationStateResponseSchema,
29
43
  SourceLayer as ProtoSourceLayer,
30
44
  SubjectSchema,
@@ -32,30 +46,46 @@ import {
32
46
  SubjectSetTypeSchema,
33
47
  AuthorizationProvider as AuthorizationProviderService,
34
48
  type AddRelationshipRequest as ProtoAddRelationshipRequest,
49
+ type AddRelationshipResponse as ProtoAddRelationshipResponse,
35
50
  type AuthorizationModel as ProtoAuthorizationModel,
36
51
  type AuthorizationModelResourceType as ProtoAuthorizationModelResourceType,
37
52
  type CheckAccessManyRequest as ProtoCheckAccessManyRequest,
53
+ type CheckAccessManyResponse as ProtoCheckAccessManyResponse,
38
54
  type CheckAccessRequest as ProtoCheckAccessRequest,
55
+ type CheckAccessResponse as ProtoCheckAccessResponse,
39
56
  type DeleteRelationshipRequest as ProtoDeleteRelationshipRequest,
57
+ type DeleteRelationshipResponse as ProtoDeleteRelationshipResponse,
58
+ type GetActiveModelRefResponse as ProtoGetActiveModelRefResponse,
40
59
  type ListActiveModelResourceTypesRequest as ProtoListActiveModelResourceTypesRequest,
60
+ type ListActiveModelResourceTypesResponse as ProtoListActiveModelResourceTypesResponse,
41
61
  type ListRelationshipsRequest as ProtoListRelationshipsRequest,
62
+ type ListRelationshipsResponse as ProtoListRelationshipsResponse,
42
63
  type ModelAllowedTarget as ProtoModelAllowedTarget,
43
64
  type Relationship as ProtoRelationship,
44
65
  type RelationshipFilter as ProtoRelationshipFilter,
45
66
  type RelationshipTarget as ProtoRelationshipTarget,
46
67
  type RelationshipTuple as ProtoRelationshipTuple,
68
+ type SetActiveModelResponse as ProtoSetActiveModelResponse,
47
69
  type SetActiveModelRequest as ProtoSetActiveModelRequest,
70
+ type SetAuthorizationStateResponse as ProtoSetAuthorizationStateResponse,
48
71
  type SetAuthorizationStateRequest as ProtoSetAuthorizationStateRequest,
49
72
  type SubjectSet as ProtoSubjectSet,
50
73
  } from "./internal/gen/v1/authorization_pb.ts";
51
74
  import { errorMessage, type MaybePromise } from "./api.ts";
52
75
  import { ProviderBase, type ProviderBaseOptions } from "./provider.ts";
53
76
  import {
77
+ dateFromTimestamp,
54
78
  jsonObjectFromStruct,
55
79
  structFromObject,
56
80
  timestampFromDate,
57
81
  type JsonObjectInput,
58
82
  } from "./protocol.ts";
83
+ import {
84
+ createHostServiceGrpcTransport,
85
+ hostServiceMetadataInterceptors,
86
+ parseHostServiceTarget,
87
+ requireHostServiceTarget,
88
+ } from "./host-service.ts";
59
89
 
60
90
  export const RelationshipTargetType = {
61
91
  UNSPECIFIED: ProtoRelationshipTargetType.UNSPECIFIED,
@@ -253,6 +283,138 @@ export interface ListActiveModelResourceTypesResponse {
253
283
  modelId?: string | undefined;
254
284
  }
255
285
 
286
+ export interface Authorization {
287
+ checkAccess(request: CheckAccessRequest): Promise<CheckAccessResponse>;
288
+ checkAccessMany(
289
+ request: CheckAccessManyRequest,
290
+ ): Promise<CheckAccessManyResponse>;
291
+ listRelationships(
292
+ request: ListRelationshipsRequest,
293
+ ): Promise<ListRelationshipsResponse>;
294
+ addRelationship(
295
+ request: AddRelationshipRequest,
296
+ ): Promise<AddRelationshipResponse>;
297
+ deleteRelationship(
298
+ request: DeleteRelationshipRequest,
299
+ ): Promise<DeleteRelationshipResponse>;
300
+ setAuthorizationState(
301
+ request: SetAuthorizationStateRequest,
302
+ ): Promise<SetAuthorizationStateResponse>;
303
+ getActiveModelRef(): Promise<GetActiveModelRefResponse>;
304
+ setActiveModel(
305
+ request: SetActiveModelRequest,
306
+ ): Promise<SetActiveModelResponse>;
307
+ listActiveModelResourceTypes(
308
+ request: ListActiveModelResourceTypesRequest,
309
+ ): Promise<ListActiveModelResourceTypesResponse>;
310
+ }
311
+
312
+ class AuthorizationImpl implements Authorization {
313
+ private readonly client: Client<typeof AuthorizationProviderService>;
314
+
315
+ constructor(target?: string, relayToken?: string) {
316
+ const host = target
317
+ ? { target, token: relayToken?.trim() ?? "" }
318
+ : requireHostServiceTarget("authorization");
319
+ const transport = createHostServiceGrpcTransport(
320
+ parseHostServiceTarget("authorization", host.target),
321
+ hostServiceMetadataInterceptors(host.token, ""),
322
+ );
323
+ this.client = createClient(AuthorizationProviderService, transport);
324
+ }
325
+
326
+ async checkAccess(request: CheckAccessRequest): Promise<CheckAccessResponse> {
327
+ return checkAccessResponseFromProto(
328
+ await this.client.checkAccess(checkAccessRequestToProto(request)),
329
+ );
330
+ }
331
+
332
+ async checkAccessMany(
333
+ request: CheckAccessManyRequest,
334
+ ): Promise<CheckAccessManyResponse> {
335
+ return checkAccessManyResponseFromProto(
336
+ await this.client.checkAccessMany(checkAccessManyRequestToProto(request)),
337
+ );
338
+ }
339
+
340
+ async listRelationships(
341
+ request: ListRelationshipsRequest,
342
+ ): Promise<ListRelationshipsResponse> {
343
+ return listRelationshipsResponseFromProto(
344
+ await this.client.listRelationships(listRelationshipsRequestToProto(request)),
345
+ );
346
+ }
347
+
348
+ async addRelationship(
349
+ request: AddRelationshipRequest,
350
+ ): Promise<AddRelationshipResponse> {
351
+ return addRelationshipResponseFromProto(
352
+ await this.client.addRelationship(addRelationshipRequestToProto(request)),
353
+ );
354
+ }
355
+
356
+ async deleteRelationship(
357
+ request: DeleteRelationshipRequest,
358
+ ): Promise<DeleteRelationshipResponse> {
359
+ return deleteRelationshipResponseFromProto(
360
+ await this.client.deleteRelationship(deleteRelationshipRequestToProto(request)),
361
+ );
362
+ }
363
+
364
+ async setAuthorizationState(
365
+ request: SetAuthorizationStateRequest,
366
+ ): Promise<SetAuthorizationStateResponse> {
367
+ return setAuthorizationStateResponseFromProto(
368
+ await this.client.setAuthorizationState(
369
+ setAuthorizationStateRequestToProto(request),
370
+ ),
371
+ );
372
+ }
373
+
374
+ async getActiveModelRef(): Promise<GetActiveModelRefResponse> {
375
+ return getActiveModelRefResponseFromProto(
376
+ await this.client.getActiveModelRef(create(EmptySchema)),
377
+ );
378
+ }
379
+
380
+ async setActiveModel(
381
+ request: SetActiveModelRequest,
382
+ ): Promise<SetActiveModelResponse> {
383
+ return setActiveModelResponseFromProto(
384
+ await this.client.setActiveModel(setActiveModelRequestToProto(request)),
385
+ );
386
+ }
387
+
388
+ async listActiveModelResourceTypes(
389
+ request: ListActiveModelResourceTypesRequest,
390
+ ): Promise<ListActiveModelResourceTypesResponse> {
391
+ return listActiveModelResourceTypesResponseFromProto(
392
+ await this.client.listActiveModelResourceTypes(
393
+ listActiveModelResourceTypesRequestToProto(request),
394
+ ),
395
+ );
396
+ }
397
+ }
398
+
399
+ let sharedAuthorization:
400
+ | { target: string; token: string; client: Authorization }
401
+ | undefined;
402
+
403
+ export function Authorization(): Authorization {
404
+ const { target, token } = requireHostServiceTarget("authorization");
405
+ if (
406
+ sharedAuthorization &&
407
+ sharedAuthorization.target === target &&
408
+ sharedAuthorization.token === token
409
+ ) {
410
+ return sharedAuthorization.client;
411
+ }
412
+
413
+ const client = new AuthorizationImpl(target, token);
414
+ sharedAuthorization = { target, token, client };
415
+ return client;
416
+ }
417
+
256
418
  export interface AuthorizationProviderOptions extends ProviderBaseOptions {
257
419
  checkAccess: (request: CheckAccessRequest) => MaybePromise<CheckAccessResponse>;
258
420
  checkAccessMany: (
@@ -471,6 +633,30 @@ function checkAccessRequestFromProto(
471
633
  };
472
634
  }
473
635
 
636
+ function checkAccessRequestToProto(value: CheckAccessRequest) {
637
+ return create(CheckAccessRequestSchema, {
638
+ subject: subjectToProto(value.subject),
639
+ action: value.action
640
+ ? create(ActionSchema, {
641
+ name: value.action.name ?? "",
642
+ properties: value.action.properties === undefined
643
+ ? undefined
644
+ : structFromObject(value.action.properties),
645
+ })
646
+ : undefined,
647
+ resource: resourceToProto(value.resource),
648
+ });
649
+ }
650
+
651
+ function checkAccessResponseFromProto(
652
+ value: ProtoCheckAccessResponse,
653
+ ): CheckAccessResponse {
654
+ return {
655
+ allowed: value.allowed,
656
+ modelId: value.modelId,
657
+ };
658
+ }
659
+
474
660
  function checkAccessResponseToProto(value: CheckAccessResponse | undefined) {
475
661
  if (!value) {
476
662
  throw new ConnectError(
@@ -492,6 +678,20 @@ function checkAccessManyRequestFromProto(
492
678
  };
493
679
  }
494
680
 
681
+ function checkAccessManyRequestToProto(value: CheckAccessManyRequest) {
682
+ return create(CheckAccessManyRequestSchema, {
683
+ requests: (value.requests ?? []).map(checkAccessRequestToProto),
684
+ });
685
+ }
686
+
687
+ function checkAccessManyResponseFromProto(
688
+ value: ProtoCheckAccessManyResponse,
689
+ ): CheckAccessManyResponse {
690
+ return {
691
+ decisions: value.decisions.map(checkAccessResponseFromProto),
692
+ };
693
+ }
694
+
495
695
  function checkAccessManyResponseToProto(
496
696
  value: CheckAccessManyResponse | undefined,
497
697
  ) {
@@ -516,6 +716,25 @@ function listRelationshipsRequestFromProto(
516
716
  };
517
717
  }
518
718
 
719
+ function listRelationshipsRequestToProto(
720
+ value: ListRelationshipsRequest,
721
+ ) {
722
+ return create(ListRelationshipsRequestSchema, {
723
+ filter: relationshipFilterToProto(value.filter),
724
+ pageSize: value.pageSize ?? 0,
725
+ pageToken: value.pageToken ?? "",
726
+ });
727
+ }
728
+
729
+ function listRelationshipsResponseFromProto(
730
+ value: ProtoListRelationshipsResponse,
731
+ ): ListRelationshipsResponse {
732
+ return {
733
+ relationships: value.relationships.map(relationshipFromProtoRequired),
734
+ nextPageToken: value.nextPageToken,
735
+ };
736
+ }
737
+
519
738
  function listRelationshipsResponseToProto(
520
739
  value: ListRelationshipsResponse | undefined,
521
740
  ) {
@@ -539,6 +758,20 @@ function addRelationshipRequestFromProto(
539
758
  };
540
759
  }
541
760
 
761
+ function addRelationshipRequestToProto(value: AddRelationshipRequest) {
762
+ return create(AddRelationshipRequestSchema, {
763
+ relationship: relationshipToProto(value.relationship),
764
+ });
765
+ }
766
+
767
+ function addRelationshipResponseFromProto(
768
+ value: ProtoAddRelationshipResponse,
769
+ ): AddRelationshipResponse {
770
+ return {
771
+ relationship: relationshipFromProto(value.relationship),
772
+ };
773
+ }
774
+
542
775
  function addRelationshipResponseToProto(
543
776
  value: AddRelationshipResponse | undefined,
544
777
  ) {
@@ -563,6 +796,18 @@ function deleteRelationshipRequestFromProto(
563
796
  };
564
797
  }
565
798
 
799
+ function deleteRelationshipRequestToProto(value: DeleteRelationshipRequest) {
800
+ return create(DeleteRelationshipRequestSchema, {
801
+ relationshipTuple: relationshipTupleToProto(value.relationshipTuple),
802
+ });
803
+ }
804
+
805
+ function deleteRelationshipResponseFromProto(
806
+ _value: ProtoDeleteRelationshipResponse,
807
+ ): DeleteRelationshipResponse {
808
+ return {};
809
+ }
810
+
566
811
  function setAuthorizationStateRequestFromProto(
567
812
  value: ProtoSetAuthorizationStateRequest,
568
813
  ): SetAuthorizationStateRequest {
@@ -572,6 +817,23 @@ function setAuthorizationStateRequestFromProto(
572
817
  };
573
818
  }
574
819
 
820
+ function setAuthorizationStateRequestToProto(
821
+ value: SetAuthorizationStateRequest,
822
+ ) {
823
+ return create(SetAuthorizationStateRequestSchema, {
824
+ model: authorizationModelToProto(value.model),
825
+ relationships: (value.relationships ?? []).map(relationshipToProtoRequired),
826
+ });
827
+ }
828
+
829
+ function setAuthorizationStateResponseFromProto(
830
+ value: ProtoSetAuthorizationStateResponse,
831
+ ): SetAuthorizationStateResponse {
832
+ return {
833
+ activeModel: authorizationModelRefFromProto(value.activeModel),
834
+ };
835
+ }
836
+
575
837
  function setAuthorizationStateResponseToProto(
576
838
  value: SetAuthorizationStateResponse | undefined,
577
839
  ) {
@@ -588,6 +850,14 @@ function setAuthorizationStateResponseToProto(
588
850
  });
589
851
  }
590
852
 
853
+ function getActiveModelRefResponseFromProto(
854
+ value: ProtoGetActiveModelRefResponse,
855
+ ): GetActiveModelRefResponse {
856
+ return {
857
+ model: authorizationModelRefFromProto(value.model),
858
+ };
859
+ }
860
+
591
861
  function getActiveModelRefResponseToProto(
592
862
  value: GetActiveModelRefResponse | undefined,
593
863
  ) {
@@ -610,6 +880,20 @@ function setActiveModelRequestFromProto(
610
880
  };
611
881
  }
612
882
 
883
+ function setActiveModelRequestToProto(value: SetActiveModelRequest) {
884
+ return create(SetActiveModelRequestSchema, {
885
+ model: authorizationModelToProto(value.model),
886
+ });
887
+ }
888
+
889
+ function setActiveModelResponseFromProto(
890
+ value: ProtoSetActiveModelResponse,
891
+ ): SetActiveModelResponse {
892
+ return {
893
+ model: authorizationModelRefFromProto(value.model),
894
+ };
895
+ }
896
+
613
897
  function setActiveModelResponseToProto(value: SetActiveModelResponse | undefined) {
614
898
  if (!value) {
615
899
  throw new ConnectError(
@@ -637,6 +921,31 @@ function listActiveModelResourceTypesRequestFromProto(
637
921
  };
638
922
  }
639
923
 
924
+ function listActiveModelResourceTypesRequestToProto(
925
+ value: ListActiveModelResourceTypesRequest,
926
+ ) {
927
+ return create(ListActiveModelResourceTypesRequestSchema, {
928
+ filter: value.filter
929
+ ? create(AuthorizationModelResourceTypeFilterSchema, {
930
+ name: value.filter.name ?? "",
931
+ sourceLayer: value.filter.sourceLayer ?? SourceLayer.UNSPECIFIED,
932
+ })
933
+ : undefined,
934
+ pageSize: value.pageSize ?? 0,
935
+ pageToken: value.pageToken ?? "",
936
+ });
937
+ }
938
+
939
+ function listActiveModelResourceTypesResponseFromProto(
940
+ value: ProtoListActiveModelResourceTypesResponse,
941
+ ): ListActiveModelResourceTypesResponse {
942
+ return {
943
+ resourceTypes: value.resourceTypes.map(authorizationModelResourceTypeFromProto),
944
+ nextPageToken: value.nextPageToken,
945
+ modelId: value.modelId,
946
+ };
947
+ }
948
+
640
949
  function listActiveModelResourceTypesResponseToProto(
641
950
  value: ListActiveModelResourceTypesResponse | undefined,
642
951
  ) {
@@ -720,6 +1029,21 @@ function relationshipFilterFromProto(
720
1029
  };
721
1030
  }
722
1031
 
1032
+ function relationshipFilterToProto(value: RelationshipFilter | undefined) {
1033
+ if (!value) {
1034
+ return undefined;
1035
+ }
1036
+ return {
1037
+ target: relationshipTargetToProto(value.target),
1038
+ relation: value.relation ?? "",
1039
+ resource: resourceToProto(value.resource),
1040
+ targetType: value.targetType ?? RelationshipTargetType.UNSPECIFIED,
1041
+ targetEntityType: value.targetEntityType ?? "",
1042
+ resourceType: value.resourceType ?? "",
1043
+ sourceLayer: value.sourceLayer ?? SourceLayer.UNSPECIFIED,
1044
+ };
1045
+ }
1046
+
723
1047
  function relationshipFromProto(
724
1048
  value: ProtoRelationship | undefined,
725
1049
  ): Relationship | undefined {
@@ -848,6 +1172,19 @@ function authorizationModelFromProto(
848
1172
  };
849
1173
  }
850
1174
 
1175
+ function authorizationModelToProto(value: AuthorizationModel | undefined) {
1176
+ if (!value) {
1177
+ return undefined;
1178
+ }
1179
+ return create(AuthorizationModelSchema, {
1180
+ id: value.id ?? "",
1181
+ version: value.version ?? "",
1182
+ resourceTypes: (value.resourceTypes ?? []).map(
1183
+ authorizationModelResourceTypeToProto,
1184
+ ),
1185
+ });
1186
+ }
1187
+
851
1188
  function authorizationModelResourceTypeFromProto(
852
1189
  value: ProtoAuthorizationModelResourceType,
853
1190
  ): AuthorizationModelResourceType {
@@ -935,6 +1272,19 @@ function modelAllowedTargetToProto(value: ModelAllowedTarget) {
935
1272
  return create(ModelAllowedTargetSchema);
936
1273
  }
937
1274
 
1275
+ function authorizationModelRefFromProto(
1276
+ value: ProtoGetActiveModelRefResponse["model"] | undefined,
1277
+ ): AuthorizationModelRef | undefined {
1278
+ if (!value) {
1279
+ return undefined;
1280
+ }
1281
+ return {
1282
+ id: value.id,
1283
+ version: value.version,
1284
+ createdAt: value.createdAt ? dateFromTimestamp(value.createdAt) : undefined,
1285
+ };
1286
+ }
1287
+
938
1288
  function authorizationModelRefToProto(value: AuthorizationModelRef) {
939
1289
  return create(AuthorizationModelRefSchema, {
940
1290
  id: value.id ?? "",
package/src/index.ts CHANGED
@@ -110,6 +110,7 @@ export {
110
110
  type RuntimeLogWriterOptions,
111
111
  } from "./runtime-log-host.ts";
112
112
  export {
113
+ Authorization,
113
114
  AuthorizationProvider,
114
115
  DefaultAccessPolicy,
115
116
  RelationshipTargetType,
@@ -119,6 +120,7 @@ export {
119
120
  isAuthorizationProvider,
120
121
  type AddRelationshipRequest,
121
122
  type AddRelationshipResponse,
123
+ type Authorization as AuthorizationClient,
122
124
  type AuthorizationAction,
123
125
  type AuthorizationModel,
124
126
  type AuthorizationModelRef,
package/src/runtime.ts CHANGED
@@ -75,7 +75,7 @@ import {
75
75
  } from "./internal/gen/v1/runtime_pb.ts";
76
76
  import { S3 as S3Service } from "./internal/gen/v1/s3_pb.ts";
77
77
  import { WorkflowProvider as WorkflowProviderService } from "./internal/gen/v1/workflow_pb.ts";
78
- import { errorMessage, type OperationResult, type Request } from "./api.ts";
78
+ import { errorMessage, parseSubjectId, type OperationResult, type Request } from "./api.ts";
79
79
  import {
80
80
  AgentProvider,
81
81
  createAgentProviderService,
@@ -835,11 +835,13 @@ function providerRequest(
835
835
  id: subject?.id ?? "",
836
836
  credentialSubjectId: subject?.credentialSubjectId ?? "",
837
837
  email: subject?.email ?? "",
838
+ kind: subjectKind(subject?.id ?? ""),
838
839
  },
839
840
  agentSubject: {
840
841
  id: agentSubject?.id ?? "",
841
842
  credentialSubjectId: agentSubject?.credentialSubjectId ?? "",
842
843
  email: agentSubject?.email ?? "",
844
+ kind: subjectKind(agentSubject?.id ?? ""),
843
845
  },
844
846
  credential: {
845
847
  mode: credential?.mode ?? "",
@@ -864,6 +866,10 @@ function providerRequest(
864
866
  };
865
867
  }
866
868
 
869
+ function subjectKind(subjectID: string): string {
870
+ return parseSubjectId(subjectID)?.kind ?? "";
871
+ }
872
+
867
873
  function providerRequestToolRefs(
868
874
  requestContext?: ProtoRequestContext,
869
875
  ): AgentToolRef[] {
package/src/workflow.ts CHANGED
@@ -1766,11 +1766,11 @@ export function evaluateWorkflowValue(ctx: WorkflowEvalContext, input: WorkflowV
1766
1766
  }
1767
1767
 
1768
1768
  export function renderWorkflowTemplate(ctx: WorkflowEvalContext, template: string): string {
1769
- return template.replace(/\$\$\{/g, "\u0000{").replace(/\$\{([^{}]+)\}/g, (_match, expr: string) => {
1769
+ return template.replace(/\$\$\{\{/g, "\u0000{{").replace(/\$\{\{([^{}]+)\}\}/g, (_match, expr: string) => {
1770
1770
  const resolved = templateExpressionValue(ctx, expr.trim());
1771
1771
  if (!resolved.ok) throw new WorkflowValueError(`template expression "${expr.trim()}" did not resolve`);
1772
1772
  return renderTemplateValue(resolved.value);
1773
- }).replace(/\u0000\{/g, "${");
1773
+ }).replace(/\u0000\{\{/g, "${{");
1774
1774
  }
1775
1775
 
1776
1776
  export function pathValue(value: unknown, path: string): { value: unknown; ok: boolean } {