@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.
- package/README.md +34 -12
- package/package.json +5 -3
- package/src/agent-conversions.ts +201 -0
- package/src/agent-manager.ts +272 -83
- package/src/agent.ts +1029 -219
- package/src/api.ts +54 -0
- package/src/auth.ts +3 -3
- package/src/authorization.ts +1702 -52
- package/src/cache.ts +5 -4
- package/src/catalog.ts +22 -0
- package/src/http-subject.ts +13 -2
- package/src/index.ts +194 -17
- package/src/indexeddb.ts +5 -16
- package/src/internal/gen/v1/agent_pb.ts +353 -74
- package/src/internal/gen/v1/authentication_pb.ts +1 -1
- package/src/internal/gen/v1/authorization_pb.ts +505 -27
- 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 +434 -29
- package/src/internal/gen/v1/plugin_pb.ts +92 -22
- package/src/internal/gen/v1/pluginruntime_pb.ts +95 -6
- 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 +349 -67
- package/src/invoker.ts +6 -35
- package/src/plugin.ts +12 -12
- package/src/pluginruntime.ts +337 -49
- package/src/protocol/v1.ts +19 -0
- package/src/protocol-internal.ts +19 -0
- package/src/protocol.ts +183 -0
- package/src/provider-kind.ts +7 -3
- package/src/provider.ts +21 -13
- package/src/runtime-log-host.ts +81 -53
- package/src/runtime.ts +72 -0
- package/src/s3.ts +15 -29
- package/src/secrets.ts +3 -3
- package/src/workflow-manager.ts +350 -121
- package/src/workflow.ts +2598 -389
package/src/api.ts
CHANGED
|
@@ -6,6 +6,26 @@ export interface Subject {
|
|
|
6
6
|
kind: string;
|
|
7
7
|
displayName: string;
|
|
8
8
|
authSource: string;
|
|
9
|
+
email: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Subject payload authored by provider-side hooks.
|
|
14
|
+
*/
|
|
15
|
+
export interface SubjectInput {
|
|
16
|
+
id: string;
|
|
17
|
+
kind: string;
|
|
18
|
+
displayName: string;
|
|
19
|
+
authSource: string;
|
|
20
|
+
email?: string | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Provider-owned external identity attached to an incoming provider request.
|
|
25
|
+
*/
|
|
26
|
+
export interface ExternalIdentity {
|
|
27
|
+
type: string;
|
|
28
|
+
id: string;
|
|
9
29
|
}
|
|
10
30
|
|
|
11
31
|
/**
|
|
@@ -26,6 +46,13 @@ export interface Access {
|
|
|
26
46
|
role: string;
|
|
27
47
|
}
|
|
28
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Describes public host metadata available to provider code.
|
|
51
|
+
*/
|
|
52
|
+
export interface Host {
|
|
53
|
+
publicBaseUrl: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
29
56
|
/**
|
|
30
57
|
* Request metadata forwarded to provider handlers by the Gestalt runtime.
|
|
31
58
|
*/
|
|
@@ -33,8 +60,12 @@ export interface Request {
|
|
|
33
60
|
token: string;
|
|
34
61
|
connectionParams: Record<string, string>;
|
|
35
62
|
subject: Subject;
|
|
63
|
+
agentSubject: Subject;
|
|
64
|
+
externalIdentity: ExternalIdentity;
|
|
65
|
+
agentExternalIdentity: ExternalIdentity;
|
|
36
66
|
credential: Credential;
|
|
37
67
|
access: Access;
|
|
68
|
+
host: Host;
|
|
38
69
|
idempotencyKey: string;
|
|
39
70
|
// Workflow callback metadata uses a JSON-style lowerCamelCase object such as
|
|
40
71
|
// runId, target.plugin.pluginName, trigger.scheduleId, and trigger.event.specVersion.
|
|
@@ -106,6 +137,10 @@ export function request(
|
|
|
106
137
|
workflow: Record<string, unknown> = {},
|
|
107
138
|
invocationToken = "",
|
|
108
139
|
idempotencyKey = "",
|
|
140
|
+
host: Partial<Host> = {},
|
|
141
|
+
agentSubject: Partial<Subject> = {},
|
|
142
|
+
externalIdentity: Partial<ExternalIdentity> = {},
|
|
143
|
+
agentExternalIdentity: Partial<ExternalIdentity> = {},
|
|
109
144
|
): Request {
|
|
110
145
|
return {
|
|
111
146
|
token,
|
|
@@ -117,6 +152,22 @@ export function request(
|
|
|
117
152
|
kind: subject.kind ?? "",
|
|
118
153
|
displayName: subject.displayName ?? "",
|
|
119
154
|
authSource: subject.authSource ?? "",
|
|
155
|
+
email: subject.email ?? "",
|
|
156
|
+
},
|
|
157
|
+
agentSubject: {
|
|
158
|
+
id: agentSubject.id ?? "",
|
|
159
|
+
kind: agentSubject.kind ?? "",
|
|
160
|
+
displayName: agentSubject.displayName ?? "",
|
|
161
|
+
authSource: agentSubject.authSource ?? "",
|
|
162
|
+
email: agentSubject.email ?? "",
|
|
163
|
+
},
|
|
164
|
+
externalIdentity: {
|
|
165
|
+
type: externalIdentity.type ?? "",
|
|
166
|
+
id: externalIdentity.id ?? "",
|
|
167
|
+
},
|
|
168
|
+
agentExternalIdentity: {
|
|
169
|
+
type: agentExternalIdentity.type ?? "",
|
|
170
|
+
id: agentExternalIdentity.id ?? "",
|
|
120
171
|
},
|
|
121
172
|
credential: {
|
|
122
173
|
mode: credential.mode ?? "",
|
|
@@ -131,6 +182,9 @@ export function request(
|
|
|
131
182
|
workflow: {
|
|
132
183
|
...workflow,
|
|
133
184
|
},
|
|
185
|
+
host: {
|
|
186
|
+
publicBaseUrl: host.publicBaseUrl ?? "",
|
|
187
|
+
},
|
|
134
188
|
invocationToken,
|
|
135
189
|
idempotencyKey: idempotencyKey.trim(),
|
|
136
190
|
};
|
package/src/auth.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProviderBase, type ProviderBaseOptions } from "./provider.ts";
|
|
2
2
|
import type { MaybePromise } from "./api.ts";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -52,7 +52,7 @@ export interface AuthenticationSessionSettings {
|
|
|
52
52
|
/**
|
|
53
53
|
* Runtime hooks required to implement a Gestalt authentication provider.
|
|
54
54
|
*/
|
|
55
|
-
export interface AuthenticationProviderOptions extends
|
|
55
|
+
export interface AuthenticationProviderOptions extends ProviderBaseOptions {
|
|
56
56
|
beginLogin: (
|
|
57
57
|
request: BeginLoginRequest,
|
|
58
58
|
) => MaybePromise<BeginLoginResponse>;
|
|
@@ -68,7 +68,7 @@ export interface AuthenticationProviderOptions extends RuntimeProviderOptions {
|
|
|
68
68
|
/**
|
|
69
69
|
* Authentication provider implementation consumed by the Gestalt runtime.
|
|
70
70
|
*/
|
|
71
|
-
export class AuthenticationProvider extends
|
|
71
|
+
export class AuthenticationProvider extends ProviderBase {
|
|
72
72
|
readonly kind = "authentication" as const;
|
|
73
73
|
|
|
74
74
|
private readonly beginLoginHandler: AuthenticationProviderOptions["beginLogin"];
|