@stigmer/sdk 0.0.36 → 0.0.40
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/__tests__/config.test.d.ts +2 -0
- package/__tests__/config.test.d.ts.map +1 -0
- package/__tests__/config.test.js +35 -0
- package/__tests__/config.test.js.map +1 -0
- package/__tests__/errors.test.d.ts +2 -0
- package/__tests__/errors.test.d.ts.map +1 -0
- package/__tests__/errors.test.js +125 -0
- package/__tests__/errors.test.js.map +1 -0
- package/__tests__/gen/errors.test.d.ts +2 -0
- package/__tests__/gen/errors.test.d.ts.map +1 -0
- package/__tests__/gen/errors.test.js +97 -0
- package/__tests__/gen/errors.test.js.map +1 -0
- package/__tests__/gen/proto-utils.test.d.ts +2 -0
- package/__tests__/gen/proto-utils.test.d.ts.map +1 -0
- package/__tests__/gen/proto-utils.test.js +45 -0
- package/__tests__/gen/proto-utils.test.js.map +1 -0
- package/__tests__/gen/session-client.test.d.ts +2 -0
- package/__tests__/gen/session-client.test.d.ts.map +1 -0
- package/__tests__/gen/session-client.test.js +148 -0
- package/__tests__/gen/session-client.test.js.map +1 -0
- package/gen/agent.d.ts +6 -0
- package/gen/agent.d.ts.map +1 -1
- package/gen/agent.js +78 -8
- package/gen/agent.js.map +1 -1
- package/gen/agentexecution.d.ts +4 -1
- package/gen/agentexecution.d.ts.map +1 -1
- package/gen/agentexecution.js +55 -6
- package/gen/agentexecution.js.map +1 -1
- package/gen/agentinstance.d.ts +4 -1
- package/gen/agentinstance.d.ts.map +1 -1
- package/gen/agentinstance.js +17 -4
- package/gen/agentinstance.js.map +1 -1
- package/gen/apikey.d.ts +2 -0
- package/gen/apikey.d.ts.map +1 -1
- package/gen/apikey.js +5 -2
- package/gen/apikey.js.map +1 -1
- package/gen/environment.d.ts +8 -0
- package/gen/environment.d.ts.map +1 -1
- package/gen/environment.js +45 -5
- package/gen/environment.js.map +1 -1
- package/gen/executioncontext.d.ts +2 -0
- package/gen/executioncontext.d.ts.map +1 -1
- package/gen/executioncontext.js +13 -5
- package/gen/executioncontext.js.map +1 -1
- package/gen/iampolicy.d.ts +2 -1
- package/gen/iampolicy.d.ts.map +1 -1
- package/gen/iampolicy.js +17 -13
- package/gen/iampolicy.js.map +1 -1
- package/gen/identityaccount.d.ts +2 -0
- package/gen/identityaccount.d.ts.map +1 -1
- package/gen/identityaccount.js +8 -3
- package/gen/identityaccount.js.map +1 -1
- package/gen/identityprovider.d.ts +2 -0
- package/gen/identityprovider.d.ts.map +1 -1
- package/gen/identityprovider.js +7 -3
- package/gen/identityprovider.js.map +1 -1
- package/gen/mcpserver.d.ts +4 -0
- package/gen/mcpserver.d.ts.map +1 -1
- package/gen/mcpserver.js +58 -11
- package/gen/mcpserver.js.map +1 -1
- package/gen/organization.d.ts +3 -0
- package/gen/organization.d.ts.map +1 -1
- package/gen/organization.js +9 -3
- package/gen/organization.js.map +1 -1
- package/gen/project.d.ts +2 -0
- package/gen/project.d.ts.map +1 -1
- package/gen/project.js +9 -4
- package/gen/project.js.map +1 -1
- package/gen/proto-utils.d.ts +6 -0
- package/gen/proto-utils.d.ts.map +1 -0
- package/gen/proto-utils.js +15 -0
- package/gen/proto-utils.js.map +1 -0
- package/gen/session.d.ts +18 -1
- package/gen/session.d.ts.map +1 -1
- package/gen/session.js +62 -3
- package/gen/session.js.map +1 -1
- package/gen/skill.d.ts +6 -1
- package/gen/skill.d.ts.map +1 -1
- package/gen/skill.js +22 -3
- package/gen/skill.js.map +1 -1
- package/gen/workflow.d.ts +2 -0
- package/gen/workflow.d.ts.map +1 -1
- package/gen/workflow.js +55 -7
- package/gen/workflow.js.map +1 -1
- package/gen/workflowexecution.d.ts +2 -0
- package/gen/workflowexecution.d.ts.map +1 -1
- package/gen/workflowexecution.js +11 -3
- package/gen/workflowexecution.js.map +1 -1
- package/gen/workflowinstance.d.ts +3 -1
- package/gen/workflowinstance.d.ts.map +1 -1
- package/gen/workflowinstance.js +9 -4
- package/gen/workflowinstance.js.map +1 -1
- package/github.d.ts +38 -0
- package/github.d.ts.map +1 -0
- package/github.js +51 -0
- package/github.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/session.d.ts +31 -0
- package/session.d.ts.map +1 -0
- package/session.js +36 -0
- package/session.js.map +1 -0
- package/src/__tests__/config.test.ts +52 -0
- package/src/__tests__/errors.test.ts +188 -0
- package/src/__tests__/gen/errors.test.ts +138 -0
- package/src/__tests__/gen/proto-utils.test.ts +53 -0
- package/src/__tests__/gen/session-client.test.ts +202 -0
- package/src/gen/agent.ts +73 -10
- package/src/gen/agentexecution.ts +55 -7
- package/src/gen/agentinstance.ts +18 -5
- package/src/gen/apikey.ts +7 -2
- package/src/gen/environment.ts +41 -5
- package/src/gen/executioncontext.ts +16 -5
- package/src/gen/iampolicy.ts +19 -10
- package/src/gen/identityaccount.ts +10 -3
- package/src/gen/identityprovider.ts +9 -3
- package/src/gen/mcpserver.ts +61 -12
- package/src/gen/organization.ts +12 -4
- package/src/gen/project.ts +11 -4
- package/src/gen/proto-utils.ts +15 -0
- package/src/gen/session.ts +82 -4
- package/src/gen/skill.ts +22 -5
- package/src/gen/workflow.ts +56 -7
- package/src/gen/workflowexecution.ts +14 -3
- package/src/gen/workflowinstance.ts +12 -5
- package/src/github.ts +89 -0
- package/src/index.ts +12 -0
- package/src/session.ts +37 -0
- package/src/stigmer.ts +3 -0
- package/stigmer.d.ts +2 -0
- package/stigmer.d.ts.map +1 -1
- package/stigmer.js +3 -0
- package/stigmer.js.map +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors";
|
|
4
|
+
import { stripUndefined } from "./proto-utils";
|
|
4
5
|
import { type DeleteResourceInput, type ResourceRef } from "./types";
|
|
5
6
|
import { create } from "@bufbuild/protobuf";
|
|
6
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
7
9
|
import { ApiResourceIdSchema, ApiResourceReferenceSchema, ApiResourceDeleteInputSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
8
10
|
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
9
11
|
import { IdentityProviderSchema, type IdentityProvider } from "@stigmer/protos/ai/stigmer/iam/identityprovider/v1/api_pb";
|
|
@@ -57,7 +59,7 @@ export class IdentityProviderClient {
|
|
|
57
59
|
|
|
58
60
|
async getByReference(ref: ResourceRef): Promise<IdentityProvider> {
|
|
59
61
|
try {
|
|
60
|
-
return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
|
|
62
|
+
return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.identity_provider }));
|
|
61
63
|
} catch (e) { throw wrapError(e); }
|
|
62
64
|
}
|
|
63
65
|
}
|
|
@@ -65,7 +67,9 @@ export class IdentityProviderClient {
|
|
|
65
67
|
/** Input for creating/updating a IdentityProvider. */
|
|
66
68
|
export interface IdentityProviderInput {
|
|
67
69
|
name: string;
|
|
70
|
+
slug?: string;
|
|
68
71
|
org: string;
|
|
72
|
+
labels?: Record<string, string>;
|
|
69
73
|
displayName?: string;
|
|
70
74
|
jwksUri?: string;
|
|
71
75
|
allowedIssuers?: string[];
|
|
@@ -81,14 +85,16 @@ function buildIdentityProviderProto(input: IdentityProviderInput): IdentityProvi
|
|
|
81
85
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
82
86
|
name: input.name,
|
|
83
87
|
org: input.org,
|
|
88
|
+
...(input.slug && { slug: input.slug }),
|
|
89
|
+
...(input.labels && { labels: input.labels }),
|
|
84
90
|
}),
|
|
85
|
-
spec: Object.assign(create(IdentityProviderSpecSchema), {
|
|
91
|
+
spec: Object.assign(create(IdentityProviderSpecSchema), stripUndefined({
|
|
86
92
|
displayName: input.displayName,
|
|
87
93
|
jwksUri: input.jwksUri,
|
|
88
94
|
allowedIssuers: input.allowedIssuers,
|
|
89
95
|
expectedAudience: input.expectedAudience,
|
|
90
96
|
rateLimitBudget: input.rateLimitBudget,
|
|
91
97
|
userinfoEndpoint: input.userinfoEndpoint,
|
|
92
|
-
}),
|
|
98
|
+
})),
|
|
93
99
|
}) as IdentityProvider;
|
|
94
100
|
}
|
package/src/gen/mcpserver.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors";
|
|
4
|
+
import { stripUndefined } from "./proto-utils";
|
|
4
5
|
import { type DeleteResourceInput, type ListParams, type ListResult, type EnvSpecInput, type ResourceRef } from "./types";
|
|
5
6
|
import { create } from "@bufbuild/protobuf";
|
|
6
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
+
import { EnvironmentSpecSchema, EnvironmentValueSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
|
|
7
9
|
import { McpServerSchema, type McpServer } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/api_pb";
|
|
8
10
|
import { McpServerCommandController } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/command_pb";
|
|
9
11
|
import { UpdateDiscoveredCapabilitiesInputSchema, type UpdateDiscoveredCapabilitiesInput } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/io_pb";
|
|
10
12
|
import { McpServerQueryController } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/query_pb";
|
|
11
|
-
import { McpServerSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/spec_pb";
|
|
13
|
+
import { McpServerSpecSchema, StdioServerConfigSchema, HttpServerConfigSchema, ToolApprovalPolicySchema } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/spec_pb";
|
|
12
14
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
13
|
-
import { ApiResourceIdSchema, ApiResourceReferenceSchema, ApiResourceDeleteInputSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
15
|
+
import { ApiResourceIdSchema, ApiResourceReferenceSchema, ApiResourceDeleteInputSchema, type UpdateVisibilityInput } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
14
16
|
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
15
17
|
import { PageInfoSchema } from "@stigmer/protos/ai/stigmer/commons/rpc/pagination_pb";
|
|
16
18
|
import { SearchRequestSchema } from "@stigmer/protos/ai/stigmer/search/v1/io_pb";
|
|
@@ -56,6 +58,12 @@ export class McpServerClient {
|
|
|
56
58
|
} catch (e) { throw wrapError(e); }
|
|
57
59
|
}
|
|
58
60
|
|
|
61
|
+
async updateVisibility(input: UpdateVisibilityInput): Promise<McpServer> {
|
|
62
|
+
try {
|
|
63
|
+
return await this.command.updateVisibility(input);
|
|
64
|
+
} catch (e) { throw wrapError(e); }
|
|
65
|
+
}
|
|
66
|
+
|
|
59
67
|
async updateDiscoveredCapabilities(input: UpdateDiscoveredCapabilitiesInput): Promise<McpServer> {
|
|
60
68
|
try {
|
|
61
69
|
return await this.command.updateDiscoveredCapabilities(input);
|
|
@@ -70,7 +78,7 @@ export class McpServerClient {
|
|
|
70
78
|
|
|
71
79
|
async getByReference(ref: ResourceRef): Promise<McpServer> {
|
|
72
80
|
try {
|
|
73
|
-
return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
|
|
81
|
+
return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.mcp_server }));
|
|
74
82
|
} catch (e) { throw wrapError(e); }
|
|
75
83
|
}
|
|
76
84
|
|
|
@@ -95,7 +103,9 @@ export class McpServerClient {
|
|
|
95
103
|
/** Input for creating/updating a McpServer. */
|
|
96
104
|
export interface McpServerInput {
|
|
97
105
|
name: string;
|
|
106
|
+
slug?: string;
|
|
98
107
|
org: string;
|
|
108
|
+
labels?: Record<string, string>;
|
|
99
109
|
description?: string;
|
|
100
110
|
iconUrl?: string;
|
|
101
111
|
stdio?: StdioServerConfigInput;
|
|
@@ -126,22 +136,61 @@ export interface ToolApprovalPolicyInput {
|
|
|
126
136
|
message?: string;
|
|
127
137
|
}
|
|
128
138
|
|
|
139
|
+
function buildStdioServerConfigProto(input: StdioServerConfigInput) {
|
|
140
|
+
return Object.assign(create(StdioServerConfigSchema), stripUndefined({
|
|
141
|
+
command: input.command,
|
|
142
|
+
args: input.args,
|
|
143
|
+
workingDir: input.workingDir,
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function buildHttpServerConfigProto(input: HttpServerConfigInput) {
|
|
148
|
+
return Object.assign(create(HttpServerConfigSchema), stripUndefined({
|
|
149
|
+
url: input.url,
|
|
150
|
+
headers: input.headers,
|
|
151
|
+
queryParams: input.queryParams,
|
|
152
|
+
timeoutSeconds: input.timeoutSeconds,
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function buildToolApprovalPolicyProto(input: ToolApprovalPolicyInput) {
|
|
157
|
+
return Object.assign(create(ToolApprovalPolicySchema), stripUndefined({
|
|
158
|
+
toolName: input.toolName,
|
|
159
|
+
message: input.message,
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
|
|
129
163
|
function buildMcpServerProto(input: McpServerInput): McpServer {
|
|
164
|
+
let envSpec;
|
|
165
|
+
if (input.envSpec) {
|
|
166
|
+
const es = create(EnvironmentSpecSchema);
|
|
167
|
+
for (const [k, v] of Object.entries(input.envSpec.variables)) {
|
|
168
|
+
es.data[k] = create(EnvironmentValueSchema, { value: v.value, isSecret: v.isSecret, description: v.description });
|
|
169
|
+
}
|
|
170
|
+
envSpec = es;
|
|
171
|
+
}
|
|
172
|
+
const defaultToolApprovals = input.defaultToolApprovals?.map(buildToolApprovalPolicyProto);
|
|
173
|
+
const spec = Object.assign(create(McpServerSpecSchema), stripUndefined({
|
|
174
|
+
description: input.description,
|
|
175
|
+
iconUrl: input.iconUrl,
|
|
176
|
+
defaultEnabledTools: input.defaultEnabledTools,
|
|
177
|
+
envSpec,
|
|
178
|
+
defaultToolApprovals,
|
|
179
|
+
}));
|
|
180
|
+
if (input.stdio) {
|
|
181
|
+
spec.serverType = { case: "stdio", value: buildStdioServerConfigProto(input.stdio) };
|
|
182
|
+
} else if (input.http) {
|
|
183
|
+
spec.serverType = { case: "http", value: buildHttpServerConfigProto(input.http) };
|
|
184
|
+
}
|
|
130
185
|
return Object.assign(create(McpServerSchema), {
|
|
131
186
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
132
187
|
kind: "McpServer",
|
|
133
188
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
134
189
|
name: input.name,
|
|
135
190
|
org: input.org,
|
|
191
|
+
...(input.slug && { slug: input.slug }),
|
|
192
|
+
...(input.labels && { labels: input.labels }),
|
|
136
193
|
}),
|
|
137
|
-
spec
|
|
138
|
-
description: input.description,
|
|
139
|
-
iconUrl: input.iconUrl,
|
|
140
|
-
stdio: input.stdio,
|
|
141
|
-
http: input.http,
|
|
142
|
-
defaultEnabledTools: input.defaultEnabledTools,
|
|
143
|
-
envSpec: input.envSpec,
|
|
144
|
-
defaultToolApprovals: input.defaultToolApprovals,
|
|
145
|
-
}),
|
|
194
|
+
spec,
|
|
146
195
|
}) as McpServer;
|
|
147
196
|
}
|
package/src/gen/organization.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors";
|
|
4
|
+
import { stripUndefined } from "./proto-utils";
|
|
4
5
|
import { type ResourceRef } from "./types";
|
|
5
6
|
import { create } from "@bufbuild/protobuf";
|
|
6
7
|
import { EmptySchema } from "@bufbuild/protobuf/wkt";
|
|
7
8
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
-
import { type FindApiResourcesRequest } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
9
|
+
import { ApiResourceReferenceSchema, type FindApiResourcesRequest } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
9
10
|
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
10
11
|
import { OrganizationSchema, type Organization } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
|
|
11
12
|
import { OrganizationCommandController } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/command_pb";
|
|
@@ -76,28 +77,35 @@ export class OrganizationClient {
|
|
|
76
77
|
/** Input for creating/updating a Organization. */
|
|
77
78
|
export interface OrganizationInput {
|
|
78
79
|
name: string;
|
|
80
|
+
slug?: string;
|
|
79
81
|
org: string;
|
|
82
|
+
labels?: Record<string, string>;
|
|
80
83
|
description?: string;
|
|
81
84
|
logoUrl?: string;
|
|
82
85
|
managementMode?: ManagementMode;
|
|
83
86
|
identityProviderRef?: ResourceRef;
|
|
84
87
|
externalOrgId?: string;
|
|
88
|
+
isPersonal?: boolean;
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
function buildOrganizationProto(input: OrganizationInput): Organization {
|
|
92
|
+
const identityProviderRef = input.identityProviderRef ? create(ApiResourceReferenceSchema, input.identityProviderRef) : undefined;
|
|
88
93
|
return Object.assign(create(OrganizationSchema), {
|
|
89
94
|
apiVersion: "tenancy.stigmer.ai/v1",
|
|
90
95
|
kind: "Organization",
|
|
91
96
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
92
97
|
name: input.name,
|
|
93
98
|
org: input.org,
|
|
99
|
+
...(input.slug && { slug: input.slug }),
|
|
100
|
+
...(input.labels && { labels: input.labels }),
|
|
94
101
|
}),
|
|
95
|
-
spec: Object.assign(create(OrganizationSpecSchema), {
|
|
102
|
+
spec: Object.assign(create(OrganizationSpecSchema), stripUndefined({
|
|
96
103
|
description: input.description,
|
|
97
104
|
logoUrl: input.logoUrl,
|
|
98
105
|
managementMode: input.managementMode,
|
|
99
|
-
identityProviderRef
|
|
106
|
+
identityProviderRef,
|
|
100
107
|
externalOrgId: input.externalOrgId,
|
|
101
|
-
|
|
108
|
+
isPersonal: input.isPersonal,
|
|
109
|
+
})),
|
|
102
110
|
}) as Organization;
|
|
103
111
|
}
|
package/src/gen/project.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors";
|
|
4
|
+
import { stripUndefined } from "./proto-utils";
|
|
4
5
|
import { type ResourceRef } from "./types";
|
|
5
6
|
import { create } from "@bufbuild/protobuf";
|
|
6
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
7
9
|
import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
8
10
|
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
9
11
|
import { ProjectSchema, type Project } from "@stigmer/protos/ai/stigmer/tenancy/project/v1/api_pb";
|
|
@@ -54,7 +56,7 @@ export class ProjectClient {
|
|
|
54
56
|
|
|
55
57
|
async getByReference(ref: ResourceRef): Promise<Project> {
|
|
56
58
|
try {
|
|
57
|
-
return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
|
|
59
|
+
return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.project }));
|
|
58
60
|
} catch (e) { throw wrapError(e); }
|
|
59
61
|
}
|
|
60
62
|
}
|
|
@@ -62,24 +64,29 @@ export class ProjectClient {
|
|
|
62
64
|
/** Input for creating/updating a Project. */
|
|
63
65
|
export interface ProjectInput {
|
|
64
66
|
name: string;
|
|
67
|
+
slug?: string;
|
|
65
68
|
org: string;
|
|
69
|
+
labels?: Record<string, string>;
|
|
66
70
|
entryPoint?: string;
|
|
67
71
|
description?: string;
|
|
68
72
|
members?: ResourceRef[];
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
function buildProjectProto(input: ProjectInput): Project {
|
|
76
|
+
const members = input.members?.map(r => create(ApiResourceReferenceSchema, r));
|
|
72
77
|
return Object.assign(create(ProjectSchema), {
|
|
73
78
|
apiVersion: "tenancy.stigmer.ai/v1",
|
|
74
79
|
kind: "Project",
|
|
75
80
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
76
81
|
name: input.name,
|
|
77
82
|
org: input.org,
|
|
83
|
+
...(input.slug && { slug: input.slug }),
|
|
84
|
+
...(input.labels && { labels: input.labels }),
|
|
78
85
|
}),
|
|
79
|
-
spec: Object.assign(create(ProjectSpecSchema), {
|
|
86
|
+
spec: Object.assign(create(ProjectSpecSchema), stripUndefined({
|
|
80
87
|
entryPoint: input.entryPoint,
|
|
81
88
|
description: input.description,
|
|
82
|
-
members
|
|
83
|
-
}),
|
|
89
|
+
members,
|
|
90
|
+
})),
|
|
84
91
|
}) as Project;
|
|
85
92
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Remove keys whose values are `undefined` so that `Object.assign`
|
|
5
|
+
* does not overwrite protobuf default values (empty maps, empty arrays).
|
|
6
|
+
*/
|
|
7
|
+
export function stripUndefined<T extends Record<string, unknown>>(obj: T): Partial<T> {
|
|
8
|
+
const result: Record<string, unknown> = {};
|
|
9
|
+
for (const key of Object.keys(obj)) {
|
|
10
|
+
if (obj[key] !== undefined) {
|
|
11
|
+
result[key] = obj[key];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return result as Partial<T>;
|
|
15
|
+
}
|
package/src/gen/session.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors";
|
|
4
|
+
import { stripUndefined } from "./proto-utils";
|
|
5
|
+
import { type ResourceRef } from "./types";
|
|
4
6
|
import { create } from "@bufbuild/protobuf";
|
|
5
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
+
import { ToolApprovalOverrideSchema, McpServerUsageSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
|
|
6
9
|
import { SessionSchema, type Session } from "@stigmer/protos/ai/stigmer/agentic/session/v1/api_pb";
|
|
7
10
|
import { SessionCommandController } from "@stigmer/protos/ai/stigmer/agentic/session/v1/command_pb";
|
|
8
11
|
import { SessionIdSchema, ListSessionsRequestSchema, SessionListSchema, ListSessionsByAgentRequestSchema, type ListSessionsRequest, type SessionList, type ListSessionsByAgentRequest } from "@stigmer/protos/ai/stigmer/agentic/session/v1/io_pb";
|
|
9
12
|
import { SessionQueryController } from "@stigmer/protos/ai/stigmer/agentic/session/v1/query_pb";
|
|
10
13
|
import { SessionSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/spec_pb";
|
|
14
|
+
import { GitRepoSourceSchema, LocalPathSourceSchema, WorkspaceSourceSchema, WorkspaceEntrySchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
|
|
15
|
+
import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
11
16
|
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
12
17
|
|
|
13
18
|
/** Provides operations on session resources. */
|
|
@@ -66,13 +71,17 @@ export class SessionClient {
|
|
|
66
71
|
/** Input for creating/updating a Session. */
|
|
67
72
|
export interface SessionInput {
|
|
68
73
|
name: string;
|
|
74
|
+
slug?: string;
|
|
69
75
|
org: string;
|
|
70
|
-
|
|
76
|
+
labels?: Record<string, string>;
|
|
77
|
+
agentInstanceId?: string;
|
|
71
78
|
subject?: string;
|
|
72
79
|
threadId?: string;
|
|
73
80
|
sandboxId?: string;
|
|
74
81
|
metadata?: Record<string, string>;
|
|
75
82
|
workspaceEntries?: WorkspaceEntryInput[];
|
|
83
|
+
mcpServerUsages?: McpServerUsageInput[];
|
|
84
|
+
skillRefs?: ResourceRef[];
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
/** SDK input type for WorkspaceEntry. */
|
|
@@ -100,21 +109,90 @@ export interface LocalPathSourceInput {
|
|
|
100
109
|
path?: string;
|
|
101
110
|
}
|
|
102
111
|
|
|
112
|
+
/** SDK input type for McpServerUsage. */
|
|
113
|
+
export interface McpServerUsageInput {
|
|
114
|
+
mcpServerRef: ResourceRef;
|
|
115
|
+
enabledTools?: string[];
|
|
116
|
+
toolApprovalOverrides?: ToolApprovalOverrideInput[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** SDK input type for ToolApprovalOverride. */
|
|
120
|
+
export interface ToolApprovalOverrideInput {
|
|
121
|
+
toolName?: string;
|
|
122
|
+
requiresApproval?: boolean;
|
|
123
|
+
message?: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function buildGitRepoSourceProto(input: GitRepoSourceInput) {
|
|
127
|
+
return Object.assign(create(GitRepoSourceSchema), stripUndefined({
|
|
128
|
+
url: input.url,
|
|
129
|
+
branch: input.branch,
|
|
130
|
+
commit: input.commit,
|
|
131
|
+
depth: input.depth,
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function buildLocalPathSourceProto(input: LocalPathSourceInput) {
|
|
136
|
+
return Object.assign(create(LocalPathSourceSchema), stripUndefined({
|
|
137
|
+
path: input.path,
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function buildWorkspaceSourceProto(input: WorkspaceSourceInput) {
|
|
142
|
+
const msg = create(WorkspaceSourceSchema);
|
|
143
|
+
if (input.gitRepo) {
|
|
144
|
+
msg.source = { case: "gitRepo", value: buildGitRepoSourceProto(input.gitRepo) };
|
|
145
|
+
} else if (input.localPath) {
|
|
146
|
+
msg.source = { case: "localPath", value: buildLocalPathSourceProto(input.localPath) };
|
|
147
|
+
}
|
|
148
|
+
return msg;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function buildWorkspaceEntryProto(input: WorkspaceEntryInput) {
|
|
152
|
+
const msg = create(WorkspaceEntrySchema);
|
|
153
|
+
if (input.name !== undefined) msg.name = input.name;
|
|
154
|
+
if (input.source) msg.source = buildWorkspaceSourceProto(input.source);
|
|
155
|
+
return msg;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function buildToolApprovalOverrideProto(input: ToolApprovalOverrideInput) {
|
|
159
|
+
return Object.assign(create(ToolApprovalOverrideSchema), stripUndefined({
|
|
160
|
+
toolName: input.toolName,
|
|
161
|
+
requiresApproval: input.requiresApproval,
|
|
162
|
+
message: input.message,
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function buildMcpServerUsageProto(input: McpServerUsageInput) {
|
|
167
|
+
const msg = create(McpServerUsageSchema);
|
|
168
|
+
if (input.mcpServerRef) msg.mcpServerRef = create(ApiResourceReferenceSchema, input.mcpServerRef);
|
|
169
|
+
if (input.enabledTools) msg.enabledTools = input.enabledTools;
|
|
170
|
+
if (input.toolApprovalOverrides) msg.toolApprovalOverrides = input.toolApprovalOverrides.map(buildToolApprovalOverrideProto);
|
|
171
|
+
return msg;
|
|
172
|
+
}
|
|
173
|
+
|
|
103
174
|
function buildSessionProto(input: SessionInput): Session {
|
|
175
|
+
const workspaceEntries = input.workspaceEntries?.map(buildWorkspaceEntryProto);
|
|
176
|
+
const mcpServerUsages = input.mcpServerUsages?.map(buildMcpServerUsageProto);
|
|
177
|
+
const skillRefs = input.skillRefs?.map(r => create(ApiResourceReferenceSchema, r));
|
|
104
178
|
return Object.assign(create(SessionSchema), {
|
|
105
179
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
106
180
|
kind: "Session",
|
|
107
181
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
108
182
|
name: input.name,
|
|
109
183
|
org: input.org,
|
|
184
|
+
...(input.slug && { slug: input.slug }),
|
|
185
|
+
...(input.labels && { labels: input.labels }),
|
|
110
186
|
}),
|
|
111
|
-
spec: Object.assign(create(SessionSpecSchema), {
|
|
187
|
+
spec: Object.assign(create(SessionSpecSchema), stripUndefined({
|
|
112
188
|
agentInstanceId: input.agentInstanceId,
|
|
113
189
|
subject: input.subject,
|
|
114
190
|
threadId: input.threadId,
|
|
115
191
|
sandboxId: input.sandboxId,
|
|
116
192
|
metadata: input.metadata,
|
|
117
|
-
workspaceEntries
|
|
118
|
-
|
|
193
|
+
workspaceEntries,
|
|
194
|
+
mcpServerUsages,
|
|
195
|
+
skillRefs,
|
|
196
|
+
})),
|
|
119
197
|
}) as Session;
|
|
120
198
|
}
|
package/src/gen/skill.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors";
|
|
4
|
+
import { stripUndefined } from "./proto-utils";
|
|
4
5
|
import { type ListParams, type ListResult, type ResourceRef } from "./types";
|
|
5
6
|
import { create } from "@bufbuild/protobuf";
|
|
6
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
7
8
|
import { SkillSchema, type Skill } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/api_pb";
|
|
8
9
|
import { SkillCommandController } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/command_pb";
|
|
9
|
-
import { SkillIdSchema, PushSkillRequestSchema, GetArtifactRequestSchema, GetArtifactResponseSchema, type PushSkillRequest, type GetArtifactRequest, type GetArtifactResponse } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/io_pb";
|
|
10
|
+
import { SkillIdSchema, PushSkillRequestSchema, PushSkillFromExecutionArtifactRequestSchema, GetArtifactRequestSchema, GetArtifactResponseSchema, type PushSkillRequest, type PushSkillFromExecutionArtifactRequest, type GetArtifactRequest, type GetArtifactResponse } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/io_pb";
|
|
10
11
|
import { SkillQueryController } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/query_pb";
|
|
11
12
|
import { SkillSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/spec_pb";
|
|
12
13
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
13
|
-
import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
14
|
+
import { ApiResourceReferenceSchema, type UpdateVisibilityInput } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
14
15
|
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
15
16
|
import { PageInfoSchema } from "@stigmer/protos/ai/stigmer/commons/rpc/pagination_pb";
|
|
16
17
|
import { SearchRequestSchema } from "@stigmer/protos/ai/stigmer/search/v1/io_pb";
|
|
@@ -34,6 +35,18 @@ export class SkillClient {
|
|
|
34
35
|
} catch (e) { throw wrapError(e); }
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
async pushFromExecutionArtifact(input: PushSkillFromExecutionArtifactRequest): Promise<Skill> {
|
|
39
|
+
try {
|
|
40
|
+
return await this.command.pushFromExecutionArtifact(input);
|
|
41
|
+
} catch (e) { throw wrapError(e); }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async updateVisibility(input: UpdateVisibilityInput): Promise<Skill> {
|
|
45
|
+
try {
|
|
46
|
+
return await this.command.updateVisibility(input);
|
|
47
|
+
} catch (e) { throw wrapError(e); }
|
|
48
|
+
}
|
|
49
|
+
|
|
37
50
|
async delete(id: string): Promise<Skill> {
|
|
38
51
|
try {
|
|
39
52
|
return await this.command.delete(create(SkillIdSchema, { value: id }));
|
|
@@ -48,7 +61,7 @@ export class SkillClient {
|
|
|
48
61
|
|
|
49
62
|
async getByReference(ref: ResourceRef): Promise<Skill> {
|
|
50
63
|
try {
|
|
51
|
-
return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
|
|
64
|
+
return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.skill }));
|
|
52
65
|
} catch (e) { throw wrapError(e); }
|
|
53
66
|
}
|
|
54
67
|
|
|
@@ -79,7 +92,9 @@ export class SkillClient {
|
|
|
79
92
|
/** Input for creating/updating a Skill. */
|
|
80
93
|
export interface SkillInput {
|
|
81
94
|
name: string;
|
|
95
|
+
slug?: string;
|
|
82
96
|
org: string;
|
|
97
|
+
labels?: Record<string, string>;
|
|
83
98
|
skillMd?: string;
|
|
84
99
|
tag?: string;
|
|
85
100
|
description?: string;
|
|
@@ -92,11 +107,13 @@ function buildSkillProto(input: SkillInput): Skill {
|
|
|
92
107
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
93
108
|
name: input.name,
|
|
94
109
|
org: input.org,
|
|
110
|
+
...(input.slug && { slug: input.slug }),
|
|
111
|
+
...(input.labels && { labels: input.labels }),
|
|
95
112
|
}),
|
|
96
|
-
spec: Object.assign(create(SkillSpecSchema), {
|
|
113
|
+
spec: Object.assign(create(SkillSpecSchema), stripUndefined({
|
|
97
114
|
skillMd: input.skillMd,
|
|
98
115
|
tag: input.tag,
|
|
99
116
|
description: input.description,
|
|
100
|
-
}),
|
|
117
|
+
})),
|
|
101
118
|
}) as Skill;
|
|
102
119
|
}
|
package/src/gen/workflow.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors";
|
|
4
|
+
import { stripUndefined } from "./proto-utils";
|
|
4
5
|
import { type EnvSpecInput, type ResourceRef } from "./types";
|
|
5
6
|
import { create, type JsonObject } from "@bufbuild/protobuf";
|
|
6
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
+
import { EnvironmentSpecSchema, EnvironmentValueSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
|
|
7
9
|
import { WorkflowSchema, type Workflow } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/api_pb";
|
|
8
10
|
import { WorkflowCommandController } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/command_pb";
|
|
9
11
|
import { WorkflowTaskKind } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/enum_pb";
|
|
10
12
|
import { WorkflowIdSchema } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/io_pb";
|
|
11
13
|
import { WorkflowQueryController } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/query_pb";
|
|
12
|
-
import { WorkflowSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/spec_pb";
|
|
14
|
+
import { WorkflowSpecSchema, WorkflowDocumentSchema, ExportSchema, FlowControlSchema, WorkflowTaskSchema } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/spec_pb";
|
|
15
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
13
16
|
import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
14
17
|
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
15
18
|
|
|
@@ -55,7 +58,7 @@ export class WorkflowClient {
|
|
|
55
58
|
|
|
56
59
|
async getByReference(ref: ResourceRef): Promise<Workflow> {
|
|
57
60
|
try {
|
|
58
|
-
return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
|
|
61
|
+
return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.workflow }));
|
|
59
62
|
} catch (e) { throw wrapError(e); }
|
|
60
63
|
}
|
|
61
64
|
}
|
|
@@ -63,7 +66,9 @@ export class WorkflowClient {
|
|
|
63
66
|
/** Input for creating/updating a Workflow. */
|
|
64
67
|
export interface WorkflowInput {
|
|
65
68
|
name: string;
|
|
69
|
+
slug?: string;
|
|
66
70
|
org: string;
|
|
71
|
+
labels?: Record<string, string>;
|
|
67
72
|
description?: string;
|
|
68
73
|
document: WorkflowDocumentInput;
|
|
69
74
|
tasks?: WorkflowTaskInput[];
|
|
@@ -98,19 +103,63 @@ export interface FlowControlInput {
|
|
|
98
103
|
then?: string;
|
|
99
104
|
}
|
|
100
105
|
|
|
106
|
+
function buildWorkflowDocumentProto(input: WorkflowDocumentInput) {
|
|
107
|
+
return Object.assign(create(WorkflowDocumentSchema), stripUndefined({
|
|
108
|
+
dsl: input.dsl,
|
|
109
|
+
namespace: input.namespace,
|
|
110
|
+
name: input.name,
|
|
111
|
+
version: input.version,
|
|
112
|
+
description: input.description,
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function buildExportProto(input: ExportInput) {
|
|
117
|
+
return Object.assign(create(ExportSchema), stripUndefined({
|
|
118
|
+
as: input.as,
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function buildFlowControlProto(input: FlowControlInput) {
|
|
123
|
+
return Object.assign(create(FlowControlSchema), stripUndefined({
|
|
124
|
+
then: input.then,
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function buildWorkflowTaskProto(input: WorkflowTaskInput) {
|
|
129
|
+
const msg = create(WorkflowTaskSchema);
|
|
130
|
+
if (input.name !== undefined) msg.name = input.name;
|
|
131
|
+
if (input.kind !== undefined) msg.kind = input.kind;
|
|
132
|
+
if (input.taskConfig !== undefined) msg.taskConfig = input.taskConfig;
|
|
133
|
+
if (input.export) msg.export = buildExportProto(input.export);
|
|
134
|
+
if (input.flow) msg.flow = buildFlowControlProto(input.flow);
|
|
135
|
+
return msg;
|
|
136
|
+
}
|
|
137
|
+
|
|
101
138
|
function buildWorkflowProto(input: WorkflowInput): Workflow {
|
|
139
|
+
const document = input.document ? buildWorkflowDocumentProto(input.document) : undefined;
|
|
140
|
+
const tasks = input.tasks?.map(buildWorkflowTaskProto);
|
|
141
|
+
let envSpec;
|
|
142
|
+
if (input.envSpec) {
|
|
143
|
+
const es = create(EnvironmentSpecSchema);
|
|
144
|
+
for (const [k, v] of Object.entries(input.envSpec.variables)) {
|
|
145
|
+
es.data[k] = create(EnvironmentValueSchema, { value: v.value, isSecret: v.isSecret, description: v.description });
|
|
146
|
+
}
|
|
147
|
+
envSpec = es;
|
|
148
|
+
}
|
|
102
149
|
return Object.assign(create(WorkflowSchema), {
|
|
103
150
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
104
151
|
kind: "Workflow",
|
|
105
152
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
106
153
|
name: input.name,
|
|
107
154
|
org: input.org,
|
|
155
|
+
...(input.slug && { slug: input.slug }),
|
|
156
|
+
...(input.labels && { labels: input.labels }),
|
|
108
157
|
}),
|
|
109
|
-
spec: Object.assign(create(WorkflowSpecSchema), {
|
|
158
|
+
spec: Object.assign(create(WorkflowSpecSchema), stripUndefined({
|
|
110
159
|
description: input.description,
|
|
111
|
-
document
|
|
112
|
-
tasks
|
|
113
|
-
envSpec
|
|
114
|
-
}),
|
|
160
|
+
document,
|
|
161
|
+
tasks,
|
|
162
|
+
envSpec,
|
|
163
|
+
})),
|
|
115
164
|
}) as Workflow;
|
|
116
165
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors";
|
|
4
|
+
import { stripUndefined } from "./proto-utils";
|
|
4
5
|
import { type EnvVarInput } from "./types";
|
|
5
6
|
import { create } from "@bufbuild/protobuf";
|
|
6
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
+
import { ExecutionValueSchema } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
|
|
7
9
|
import { WorkflowExecutionSchema, type WorkflowExecution } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/api_pb";
|
|
8
10
|
import { WorkflowExecutionCommandController } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/command_pb";
|
|
9
11
|
import { WorkflowExecutionIdSchema, WorkflowExecutionUpdateStatusInputSchema, SubmitWorkflowApprovalInputSchema, SendSignalInputSchema, CancelWorkflowExecutionInputSchema, TerminateWorkflowExecutionInputSchema, RecoverWorkflowExecutionInputSchema, PauseWorkflowExecutionInputSchema, ResumeWorkflowExecutionInputSchema, ListWorkflowExecutionsRequestSchema, WorkflowExecutionListSchema, ListWorkflowExecutionsByWorkflowRequestSchema, SubscribeWorkflowExecutionRequestSchema, type WorkflowExecutionUpdateStatusInput, type SubmitWorkflowApprovalInput, type SendSignalInput, type CancelWorkflowExecutionInput, type TerminateWorkflowExecutionInput, type RecoverWorkflowExecutionInput, type PauseWorkflowExecutionInput, type ResumeWorkflowExecutionInput, type ListWorkflowExecutionsRequest, type WorkflowExecutionList, type ListWorkflowExecutionsByWorkflowRequest, type SubscribeWorkflowExecutionRequest } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/io_pb";
|
|
@@ -118,7 +120,9 @@ export class WorkflowExecutionClient {
|
|
|
118
120
|
/** Input for creating/updating a WorkflowExecution. */
|
|
119
121
|
export interface WorkflowExecutionInput {
|
|
120
122
|
name: string;
|
|
123
|
+
slug?: string;
|
|
121
124
|
org: string;
|
|
125
|
+
labels?: Record<string, string>;
|
|
122
126
|
workflowInstanceId?: string;
|
|
123
127
|
workflowId?: string;
|
|
124
128
|
triggerMessage?: string;
|
|
@@ -128,20 +132,27 @@ export interface WorkflowExecutionInput {
|
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
function buildWorkflowExecutionProto(input: WorkflowExecutionInput): WorkflowExecution {
|
|
135
|
+
let runtimeEnv;
|
|
136
|
+
if (input.runtimeEnv) {
|
|
137
|
+
runtimeEnv = Object.fromEntries(Object.entries(input.runtimeEnv).map(([k, v]) =>
|
|
138
|
+
[k, create(ExecutionValueSchema, { value: v.value, isSecret: v.isSecret })]));
|
|
139
|
+
}
|
|
131
140
|
return Object.assign(create(WorkflowExecutionSchema), {
|
|
132
141
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
133
142
|
kind: "WorkflowExecution",
|
|
134
143
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
135
144
|
name: input.name,
|
|
136
145
|
org: input.org,
|
|
146
|
+
...(input.slug && { slug: input.slug }),
|
|
147
|
+
...(input.labels && { labels: input.labels }),
|
|
137
148
|
}),
|
|
138
|
-
spec: Object.assign(create(WorkflowExecutionSpecSchema), {
|
|
149
|
+
spec: Object.assign(create(WorkflowExecutionSpecSchema), stripUndefined({
|
|
139
150
|
workflowInstanceId: input.workflowInstanceId,
|
|
140
151
|
workflowId: input.workflowId,
|
|
141
152
|
triggerMessage: input.triggerMessage,
|
|
142
153
|
triggerMetadata: input.triggerMetadata,
|
|
143
|
-
runtimeEnv
|
|
154
|
+
runtimeEnv,
|
|
144
155
|
callbackToken: input.callbackToken,
|
|
145
|
-
}),
|
|
156
|
+
})),
|
|
146
157
|
}) as WorkflowExecution;
|
|
147
158
|
}
|