@valon-technologies/gestalt 0.0.1-alpha.20 → 0.0.1-alpha.21
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/README.md +4 -6
- package/package.json +1 -4
- package/src/agent-conversions.ts +69 -2
- package/src/agent-manager.ts +26 -22
- package/src/agent.ts +33 -27
- package/src/api.ts +19 -0
- package/src/authorization.ts +0 -63
- package/src/index.ts +48 -60
- package/src/indexeddb.ts +450 -46
- package/src/internal/gen/v1/agent_pb.ts +103 -162
- package/src/internal/gen/v1/authentication_pb.ts +1 -1
- package/src/internal/gen/v1/authorization_pb.ts +1 -1
- package/src/internal/gen/v1/cache_pb.ts +1 -1
- package/src/internal/gen/v1/datastore_pb.ts +1 -1
- package/src/internal/gen/v1/external_credential_pb.ts +1 -1
- package/src/internal/gen/v1/plugin_pb.ts +94 -16
- package/src/internal/gen/v1/pluginruntime_pb.ts +1 -1
- package/src/internal/gen/v1/runtime_pb.ts +1 -1
- package/src/internal/gen/v1/s3_pb.ts +1 -1
- package/src/internal/gen/v1/secrets_pb.ts +1 -1
- package/src/internal/gen/v1/workflow_pb.ts +170 -74
- package/src/plugin.ts +4 -4
- package/src/runtime.ts +17 -4
- package/src/workflow-manager.ts +53 -57
- package/src/workflow.ts +231 -163
- package/src/protocol/v1.ts +0 -19
- package/src/test-agent-contract.ts +0 -43
package/src/authorization.ts
CHANGED
|
@@ -113,14 +113,6 @@ const AUTHORIZATION_RELAY_TOKEN_HEADER = "x-gestalt-host-service-relay-token";
|
|
|
113
113
|
|
|
114
114
|
/** Subject type used for canonical Gestalt subject ids in managed grants. */
|
|
115
115
|
export const AUTHORIZATION_SUBJECT_TYPE_SUBJECT = "subject";
|
|
116
|
-
/** Managed authorization resource type for agent sessions. */
|
|
117
|
-
export const AGENT_SESSION_RESOURCE_TYPE = "agent_session";
|
|
118
|
-
/** Relation that grants view and edit access to an agent session. */
|
|
119
|
-
export const AGENT_SESSION_RELATION_EDITOR = "editor";
|
|
120
|
-
/** Action checked when reading a shared agent session. */
|
|
121
|
-
export const AGENT_SESSION_ACTION_VIEW = "view";
|
|
122
|
-
/** Action checked when creating turns or resolving interactions in a session. */
|
|
123
|
-
export const AGENT_SESSION_ACTION_EDIT = "edit";
|
|
124
116
|
|
|
125
117
|
export interface AuthorizationSubject {
|
|
126
118
|
type: string;
|
|
@@ -508,20 +500,6 @@ export class AuthorizationClient {
|
|
|
508
500
|
await this.client.writeRelationships(authorizationWriteRelationshipsInputToProto(request));
|
|
509
501
|
}
|
|
510
502
|
|
|
511
|
-
/**
|
|
512
|
-
* Grants a canonical Gestalt subject id editor access to an agent session.
|
|
513
|
-
*
|
|
514
|
-
* This writes the host-managed `agent_session` relationship through the SDK.
|
|
515
|
-
*/
|
|
516
|
-
async grantAgentSessionEditor(
|
|
517
|
-
subjectId: string,
|
|
518
|
-
sessionId: string,
|
|
519
|
-
): Promise<void> {
|
|
520
|
-
await this.writeRelationships(
|
|
521
|
-
agentSessionEditorWriteRequest(subjectId, sessionId),
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
503
|
async getMetadata(): Promise<AuthorizationMetadata> {
|
|
526
504
|
return authorizationMetadataFromProto(await this.client.getMetadata({}));
|
|
527
505
|
}
|
|
@@ -920,13 +898,6 @@ export function authorizationSubjectSetTarget(
|
|
|
920
898
|
};
|
|
921
899
|
}
|
|
922
900
|
|
|
923
|
-
/** Creates the managed authorization resource for an agent session. */
|
|
924
|
-
export function agentSessionAuthorizationResource(
|
|
925
|
-
sessionId: string,
|
|
926
|
-
): AuthorizationResource {
|
|
927
|
-
return authorizationResource(AGENT_SESSION_RESOURCE_TYPE, sessionId);
|
|
928
|
-
}
|
|
929
|
-
|
|
930
901
|
/** Creates an authorization action reference. */
|
|
931
902
|
export function authorizationAction(
|
|
932
903
|
name: string,
|
|
@@ -959,40 +930,6 @@ export function authorizationRelationshipWithTarget(
|
|
|
959
930
|
: { target, relation, resource, properties };
|
|
960
931
|
}
|
|
961
932
|
|
|
962
|
-
/**
|
|
963
|
-
* Creates the relationship that shares an agent session with a canonical
|
|
964
|
-
* Gestalt subject id such as `user:123`.
|
|
965
|
-
*
|
|
966
|
-
* The returned relationship mirrors the subject into both the legacy `subject`
|
|
967
|
-
* field and the generalized `target.subject` field so it remains compatible
|
|
968
|
-
* with mixed host/provider versions.
|
|
969
|
-
*/
|
|
970
|
-
export function agentSessionEditorRelationship(
|
|
971
|
-
subjectId: string,
|
|
972
|
-
sessionId: string,
|
|
973
|
-
): AuthorizationRelationship {
|
|
974
|
-
const subject = authorizationSubject(
|
|
975
|
-
AUTHORIZATION_SUBJECT_TYPE_SUBJECT,
|
|
976
|
-
subjectId,
|
|
977
|
-
);
|
|
978
|
-
return {
|
|
979
|
-
subject,
|
|
980
|
-
target: authorizationSubjectTarget(subject),
|
|
981
|
-
relation: AGENT_SESSION_RELATION_EDITOR,
|
|
982
|
-
resource: agentSessionAuthorizationResource(sessionId),
|
|
983
|
-
};
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
/** Creates a relationship-write request that shares an agent session. */
|
|
987
|
-
export function agentSessionEditorWriteRequest(
|
|
988
|
-
subjectId: string,
|
|
989
|
-
sessionId: string,
|
|
990
|
-
): AuthorizationWriteRelationshipsInput {
|
|
991
|
-
return {
|
|
992
|
-
writes: [agentSessionEditorRelationship(subjectId, sessionId)],
|
|
993
|
-
};
|
|
994
|
-
}
|
|
995
|
-
|
|
996
933
|
/** Creates a relationship key for authorization deletes. */
|
|
997
934
|
export function authorizationRelationshipKey(
|
|
998
935
|
subject: AuthorizationSubject,
|
package/src/index.ts
CHANGED
|
@@ -29,19 +29,12 @@
|
|
|
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,
|
|
36
32
|
Authorization,
|
|
37
33
|
AuthorizationClient,
|
|
38
34
|
AuthorizationProvider,
|
|
39
35
|
AUTHORIZATION_SUBJECT_TYPE_SUBJECT,
|
|
40
36
|
ENV_AUTHORIZATION_SOCKET,
|
|
41
37
|
ENV_AUTHORIZATION_SOCKET_TOKEN,
|
|
42
|
-
agentSessionAuthorizationResource,
|
|
43
|
-
agentSessionEditorRelationship,
|
|
44
|
-
agentSessionEditorWriteRequest,
|
|
45
38
|
authorizationAction,
|
|
46
39
|
createAuthorizationProviderService,
|
|
47
40
|
defineAuthorizationProvider,
|
|
@@ -157,17 +150,17 @@ export {
|
|
|
157
150
|
ENV_AGENT_MANAGER_SOCKET,
|
|
158
151
|
ENV_AGENT_MANAGER_SOCKET_TOKEN,
|
|
159
152
|
AgentManager,
|
|
160
|
-
type
|
|
161
|
-
type
|
|
162
|
-
type
|
|
163
|
-
type
|
|
164
|
-
type
|
|
165
|
-
type
|
|
166
|
-
type
|
|
167
|
-
type
|
|
168
|
-
type
|
|
169
|
-
type
|
|
170
|
-
type
|
|
153
|
+
type AgentManagerCancelTurn,
|
|
154
|
+
type AgentManagerCreateSession,
|
|
155
|
+
type AgentManagerCreateTurn,
|
|
156
|
+
type AgentManagerGetSession,
|
|
157
|
+
type AgentManagerGetTurn,
|
|
158
|
+
type AgentManagerListInteractions,
|
|
159
|
+
type AgentManagerListSessions,
|
|
160
|
+
type AgentManagerListTurnEvents,
|
|
161
|
+
type AgentManagerListTurns,
|
|
162
|
+
type AgentManagerResolveInteraction,
|
|
163
|
+
type AgentManagerUpdateSession,
|
|
171
164
|
type AgentManagerWorkspace,
|
|
172
165
|
type AgentManagerWorkspaceGitCheckout,
|
|
173
166
|
} from "./agent-manager.ts";
|
|
@@ -175,26 +168,26 @@ export {
|
|
|
175
168
|
ENV_WORKFLOW_MANAGER_SOCKET,
|
|
176
169
|
ENV_WORKFLOW_MANAGER_SOCKET_TOKEN,
|
|
177
170
|
WorkflowManager,
|
|
178
|
-
type
|
|
179
|
-
type
|
|
180
|
-
type
|
|
181
|
-
type
|
|
182
|
-
type
|
|
183
|
-
type
|
|
184
|
-
type
|
|
185
|
-
type
|
|
186
|
-
type
|
|
187
|
-
type
|
|
188
|
-
type
|
|
189
|
-
type
|
|
190
|
-
type
|
|
191
|
-
type
|
|
192
|
-
type
|
|
193
|
-
type
|
|
194
|
-
type
|
|
195
|
-
type
|
|
196
|
-
type
|
|
197
|
-
type
|
|
171
|
+
type WorkflowManagerCreateDefinition,
|
|
172
|
+
type WorkflowManagerCreateTrigger,
|
|
173
|
+
type WorkflowManagerCreateSchedule,
|
|
174
|
+
type WorkflowManagerDeleteDefinition,
|
|
175
|
+
type WorkflowManagerDeleteTrigger,
|
|
176
|
+
type WorkflowManagerDeleteSchedule,
|
|
177
|
+
type WorkflowManagerGetDefinition,
|
|
178
|
+
type WorkflowManagerGetTrigger,
|
|
179
|
+
type WorkflowManagerGetSchedule,
|
|
180
|
+
type WorkflowManagerPauseTrigger,
|
|
181
|
+
type WorkflowManagerPauseSchedule,
|
|
182
|
+
type WorkflowManagerPublishEvent,
|
|
183
|
+
type WorkflowManagerResumeTrigger,
|
|
184
|
+
type WorkflowManagerResumeSchedule,
|
|
185
|
+
type WorkflowManagerSignalOrStartRun,
|
|
186
|
+
type WorkflowManagerSignalRun,
|
|
187
|
+
type WorkflowManagerStartRun,
|
|
188
|
+
type WorkflowManagerUpdateDefinition,
|
|
189
|
+
type WorkflowManagerUpdateTrigger,
|
|
190
|
+
type WorkflowManagerUpdateSchedule,
|
|
198
191
|
} from "./workflow-manager.ts";
|
|
199
192
|
export {
|
|
200
193
|
ENV_RUNTIME_LOG_HOST_SOCKET,
|
|
@@ -240,8 +233,6 @@ export {
|
|
|
240
233
|
export {
|
|
241
234
|
type ConnectedToken,
|
|
242
235
|
PluginProvider,
|
|
243
|
-
connectionModeToProtoValue,
|
|
244
|
-
connectionParamToProto,
|
|
245
236
|
definePlugin,
|
|
246
237
|
isPluginProvider,
|
|
247
238
|
operation,
|
|
@@ -347,11 +338,17 @@ export {
|
|
|
347
338
|
NotFoundError,
|
|
348
339
|
AlreadyExistsError,
|
|
349
340
|
TransactionError,
|
|
341
|
+
IndexedDBCursorSnapshot,
|
|
350
342
|
ColumnType,
|
|
343
|
+
compareIndexedDBValues,
|
|
344
|
+
indexedDBRangeBounds,
|
|
351
345
|
indexedDBSocketEnv,
|
|
352
346
|
indexedDBSocketTokenEnv,
|
|
347
|
+
newIndexedDBCursorSnapshot,
|
|
353
348
|
type Record,
|
|
354
349
|
type KeyRange,
|
|
350
|
+
type IndexedDBCursorSnapshotEntry,
|
|
351
|
+
type IndexedDBOpenCursorRequest,
|
|
355
352
|
type TransactionMode,
|
|
356
353
|
type TransactionDurabilityHint,
|
|
357
354
|
type TransactionOptions,
|
|
@@ -423,7 +420,6 @@ export {
|
|
|
423
420
|
type AgentSessionStartConfig,
|
|
424
421
|
type AgentSessionStartHook,
|
|
425
422
|
type AgentSessionStartHookOutput,
|
|
426
|
-
type AgentSubjectContext,
|
|
427
423
|
type AgentToolAnnotations,
|
|
428
424
|
type AgentToolRef,
|
|
429
425
|
type AgentTurn,
|
|
@@ -493,6 +489,14 @@ export {
|
|
|
493
489
|
workflowExecutionReference,
|
|
494
490
|
workflowExecutionReferenceFromReference,
|
|
495
491
|
workflowExecutionReferenceInputFromReference,
|
|
492
|
+
workflowAgentStep,
|
|
493
|
+
workflowAgentStepFromProto,
|
|
494
|
+
workflowAgentStepInputFromStep,
|
|
495
|
+
workflowAgentStepToProto,
|
|
496
|
+
workflowAgentStepWhen,
|
|
497
|
+
workflowAgentStepWhenFromProto,
|
|
498
|
+
workflowAgentStepWhenInputFromWhen,
|
|
499
|
+
workflowAgentStepWhenToProto,
|
|
496
500
|
workflowOutputBinding,
|
|
497
501
|
workflowOutputBindingInputFromBinding,
|
|
498
502
|
workflowOutputDelivery,
|
|
@@ -509,17 +513,11 @@ export {
|
|
|
509
513
|
workflowSignalFromSignal,
|
|
510
514
|
workflowSignalInputFromSignal,
|
|
511
515
|
type BoundWorkflowAgentTarget,
|
|
512
|
-
type BoundWorkflowAgentTargetInput,
|
|
513
516
|
type BoundWorkflowEventTrigger,
|
|
514
|
-
type BoundWorkflowEventTriggerInput,
|
|
515
517
|
type BoundWorkflowPluginTarget,
|
|
516
|
-
type BoundWorkflowPluginTargetInput,
|
|
517
518
|
type BoundWorkflowRun,
|
|
518
|
-
type BoundWorkflowRunInput,
|
|
519
519
|
type BoundWorkflowSchedule,
|
|
520
|
-
type BoundWorkflowScheduleInput,
|
|
521
520
|
type BoundWorkflowTarget,
|
|
522
|
-
type BoundWorkflowTargetInput,
|
|
523
521
|
type CancelWorkflowProviderRunRequest,
|
|
524
522
|
type DeleteWorkflowProviderEventTriggerRequest,
|
|
525
523
|
type DeleteWorkflowProviderScheduleRequest,
|
|
@@ -551,31 +549,21 @@ export {
|
|
|
551
549
|
type UpsertWorkflowProviderEventTriggerRequest,
|
|
552
550
|
type UpsertWorkflowProviderScheduleRequest,
|
|
553
551
|
type WorkflowAccessPermission,
|
|
554
|
-
type WorkflowAccessPermissionInput,
|
|
555
552
|
type WorkflowActor,
|
|
556
|
-
type WorkflowActorInput,
|
|
557
553
|
type WorkflowEvent,
|
|
558
|
-
type WorkflowEventInput,
|
|
559
554
|
type WorkflowEventMatch,
|
|
560
|
-
type
|
|
561
|
-
type WorkflowEventTriggerInvocationInput,
|
|
555
|
+
type WorkflowEventTriggerInvocation,
|
|
562
556
|
type WorkflowExecutionReference,
|
|
563
|
-
type
|
|
557
|
+
type WorkflowAgentStep,
|
|
558
|
+
type WorkflowAgentStepWhen,
|
|
564
559
|
type WorkflowOutputBinding,
|
|
565
|
-
type WorkflowOutputBindingInput,
|
|
566
560
|
type WorkflowOutputDelivery,
|
|
567
|
-
type WorkflowOutputDeliveryInput,
|
|
568
561
|
type WorkflowOutputValueSource,
|
|
569
|
-
type WorkflowOutputValueSourceInput,
|
|
570
562
|
type WorkflowProviderOptions,
|
|
571
563
|
type WorkflowRunAsSubject,
|
|
572
|
-
type WorkflowRunAsSubjectInput,
|
|
573
|
-
type WorkflowRunTriggerInput,
|
|
574
564
|
type WorkflowRunTrigger,
|
|
575
565
|
type WorkflowScheduleTrigger,
|
|
576
|
-
type WorkflowScheduleTriggerInput,
|
|
577
566
|
type WorkflowSignal,
|
|
578
|
-
type WorkflowSignalInput,
|
|
579
567
|
} from "./workflow.ts";
|
|
580
568
|
export {
|
|
581
569
|
GENAI_OPERATION_CHAT,
|