@stigmer/sdk 3.12.5 → 3.12.6
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__/update-input-roundtrip.test.d.ts +2 -0
- package/__tests__/update-input-roundtrip.test.d.ts.map +1 -0
- package/__tests__/update-input-roundtrip.test.js +791 -0
- package/__tests__/update-input-roundtrip.test.js.map +1 -0
- package/__tests__/update-input.test.js +22 -3
- package/__tests__/update-input.test.js.map +1 -1
- package/gen/agent.d.ts +21 -0
- package/gen/agent.d.ts.map +1 -1
- package/gen/agent.js +73 -1
- package/gen/agent.js.map +1 -1
- package/gen/agentchannel.d.ts +23 -1
- package/gen/agentchannel.d.ts.map +1 -1
- package/gen/agentchannel.js +55 -1
- package/gen/agentchannel.js.map +1 -1
- package/gen/agentexecution.d.ts +23 -1
- package/gen/agentexecution.d.ts.map +1 -1
- package/gen/agentexecution.js +146 -1
- package/gen/agentexecution.js.map +1 -1
- package/gen/agentinstance.d.ts +21 -0
- package/gen/agentinstance.d.ts.map +1 -1
- package/gen/agentinstance.js +32 -1
- package/gen/agentinstance.js.map +1 -1
- package/gen/agentshare.d.ts +23 -1
- package/gen/agentshare.d.ts.map +1 -1
- package/gen/agentshare.js +53 -1
- package/gen/agentshare.js.map +1 -1
- package/gen/apikey.d.ts +21 -0
- package/gen/apikey.d.ts.map +1 -1
- package/gen/apikey.js +33 -1
- package/gen/apikey.js.map +1 -1
- package/gen/artifact.d.ts +8 -0
- package/gen/artifact.d.ts.map +1 -1
- package/gen/artifact.js +1 -0
- package/gen/artifact.js.map +1 -1
- package/gen/channelapp.d.ts +21 -0
- package/gen/channelapp.d.ts.map +1 -1
- package/gen/channelapp.js +45 -0
- package/gen/channelapp.js.map +1 -1
- package/gen/environment.d.ts +21 -0
- package/gen/environment.d.ts.map +1 -1
- package/gen/environment.js +31 -1
- package/gen/environment.js.map +1 -1
- package/gen/executioncontext.d.ts +8 -0
- package/gen/executioncontext.d.ts.map +1 -1
- package/gen/executioncontext.js +1 -0
- package/gen/executioncontext.js.map +1 -1
- package/gen/iampolicy.d.ts +8 -0
- package/gen/iampolicy.d.ts.map +1 -1
- package/gen/iampolicy.js +1 -0
- package/gen/iampolicy.js.map +1 -1
- package/gen/identityaccount.d.ts +21 -0
- package/gen/identityaccount.d.ts.map +1 -1
- package/gen/identityaccount.js +46 -1
- package/gen/identityaccount.js.map +1 -1
- package/gen/identityprovider.d.ts +21 -0
- package/gen/identityprovider.d.ts.map +1 -1
- package/gen/identityprovider.js +40 -0
- package/gen/identityprovider.js.map +1 -1
- package/gen/invitation.d.ts +8 -0
- package/gen/invitation.d.ts.map +1 -1
- package/gen/invitation.js +1 -0
- package/gen/invitation.js.map +1 -1
- package/gen/mcpserver.d.ts +21 -0
- package/gen/mcpserver.d.ts.map +1 -1
- package/gen/mcpserver.js +79 -1
- package/gen/mcpserver.js.map +1 -1
- package/gen/oauthapp.d.ts +21 -0
- package/gen/oauthapp.d.ts.map +1 -1
- package/gen/oauthapp.js +39 -0
- package/gen/oauthapp.js.map +1 -1
- package/gen/organization.d.ts +21 -0
- package/gen/organization.d.ts.map +1 -1
- package/gen/organization.js +41 -1
- package/gen/organization.js.map +1 -1
- package/gen/platformclient.d.ts +21 -0
- package/gen/platformclient.d.ts.map +1 -1
- package/gen/platformclient.js +40 -1
- package/gen/platformclient.js.map +1 -1
- package/gen/project.d.ts +21 -0
- package/gen/project.d.ts.map +1 -1
- package/gen/project.js +32 -1
- package/gen/project.js.map +1 -1
- package/gen/proto-utils.d.ts +36 -0
- package/gen/proto-utils.d.ts.map +1 -1
- package/gen/proto-utils.js +58 -0
- package/gen/proto-utils.js.map +1 -1
- package/gen/schedule.d.ts +23 -1
- package/gen/schedule.d.ts.map +1 -1
- package/gen/schedule.js +79 -1
- package/gen/schedule.js.map +1 -1
- package/gen/session.d.ts +21 -0
- package/gen/session.d.ts.map +1 -1
- package/gen/session.js +80 -1
- package/gen/session.js.map +1 -1
- package/gen/skill.d.ts +8 -0
- package/gen/skill.d.ts.map +1 -1
- package/gen/skill.js +1 -0
- package/gen/skill.js.map +1 -1
- package/gen/workflow.d.ts +21 -0
- package/gen/workflow.d.ts.map +1 -1
- package/gen/workflow.js +79 -0
- package/gen/workflow.js.map +1 -1
- package/gen/workflowexecution.d.ts +21 -0
- package/gen/workflowexecution.d.ts.map +1 -1
- package/gen/workflowexecution.js +36 -1
- package/gen/workflowexecution.js.map +1 -1
- package/gen/workflowinstance.d.ts +21 -0
- package/gen/workflowinstance.d.ts.map +1 -1
- package/gen/workflowinstance.js +33 -1
- package/gen/workflowinstance.js.map +1 -1
- package/index.d.ts +20 -21
- package/index.d.ts.map +1 -1
- package/index.js +24 -23
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/update-input-roundtrip.test.ts +1031 -0
- package/src/__tests__/update-input.test.ts +34 -3
- package/src/gen/agent.ts +89 -3
- package/src/gen/agentchannel.ts +72 -4
- package/src/gen/agentexecution.ts +172 -6
- package/src/gen/agentinstance.ts +41 -1
- package/src/gen/agentshare.ts +68 -4
- package/src/gen/apikey.ts +42 -1
- package/src/gen/artifact.ts +9 -0
- package/src/gen/channelapp.ts +57 -1
- package/src/gen/environment.ts +40 -1
- package/src/gen/executioncontext.ts +9 -0
- package/src/gen/iampolicy.ts +9 -0
- package/src/gen/identityaccount.ts +57 -2
- package/src/gen/identityprovider.ts +49 -0
- package/src/gen/invitation.ts +9 -0
- package/src/gen/mcpserver.ts +95 -3
- package/src/gen/oauthapp.ts +48 -0
- package/src/gen/organization.ts +52 -2
- package/src/gen/platformclient.ts +49 -1
- package/src/gen/project.ts +41 -1
- package/src/gen/proto-utils.ts +64 -0
- package/src/gen/schedule.ts +98 -4
- package/src/gen/session.ts +97 -3
- package/src/gen/skill.ts +9 -0
- package/src/gen/workflow.ts +96 -2
- package/src/gen/workflowexecution.ts +45 -1
- package/src/gen/workflowinstance.ts +42 -1
- package/src/index.ts +24 -9
- package/src/update-input.ts +0 -168
- package/update-input.d.ts +0 -24
- package/update-input.d.ts.map +0 -1
- package/update-input.js +0 -126
- package/update-input.js.map +0 -1
package/src/gen/mcpserver.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors.js";
|
|
4
|
-
import { stripUndefined } from "./proto-utils.js";
|
|
4
|
+
import { stripUndefined, toResourceRefInput } from "./proto-utils.js";
|
|
5
5
|
import { type DeleteResourceInput, type ListParams, type ListResult, type ResourceRef } from "./types.js";
|
|
6
6
|
import { create } from "@bufbuild/protobuf";
|
|
7
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
-
import { EnvVarDeclarationSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
|
|
8
|
+
import { EnvVarDeclarationSchema, type EnvVarDeclaration } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
|
|
9
9
|
import { McpServerSchema, type McpServer } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/api_pb";
|
|
10
10
|
import { McpServerCommandController } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/command_pb";
|
|
11
11
|
import { ConnectInputSchema, InitiateOAuthConnectInputSchema, InitiateOAuthConnectOutputSchema, CompleteOAuthConnectInputSchema, CompleteOAuthConnectOutputSchema, DisconnectOAuthInputSchema, DisconnectOAuthOutputSchema, SetOrgOAuthAppInputSchema, SetOrgOAuthAppOutputSchema, DeleteOrgOAuthAppInputSchema, DeleteOrgOAuthAppOutputSchema, GetOAuthGrantStatusInputSchema, GetOAuthGrantStatusOutputSchema, GetOrgOAuthAppInputSchema, GetOrgOAuthAppOutputSchema, type ConnectInput, type InitiateOAuthConnectInput, type InitiateOAuthConnectOutput, type CompleteOAuthConnectInput, type CompleteOAuthConnectOutput, type DisconnectOAuthInput, type DisconnectOAuthOutput, type SetOrgOAuthAppInput, type SetOrgOAuthAppOutput, type DeleteOrgOAuthAppInput, type DeleteOrgOAuthAppOutput, type GetOAuthGrantStatusInput, type GetOAuthGrantStatusOutput, type GetOrgOAuthAppInput, type GetOrgOAuthAppOutput } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/io_pb";
|
|
12
12
|
import { McpServerQueryController } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/query_pb";
|
|
13
|
-
import { McpServerSpecSchema, StdioServerConfigSchema, HttpServerConfigSchema, ToolApprovalPolicySchema, McpServerAuthSchema } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/spec_pb";
|
|
13
|
+
import { McpServerSpecSchema, StdioServerConfigSchema, HttpServerConfigSchema, ToolApprovalPolicySchema, McpServerAuthSchema, type StdioServerConfig, type HttpServerConfig, type ToolApprovalPolicy, type McpServerAuth } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/spec_pb";
|
|
14
14
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
15
15
|
import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
|
|
16
16
|
import { ApiResourceIdSchema, ApiResourceReferenceSchema, ApiResourceDeleteInputSchema, type UpdateVisibilityInput } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
@@ -152,6 +152,14 @@ export class McpServerClient {
|
|
|
152
152
|
|
|
153
153
|
/** Input for creating/updating a McpServer. */
|
|
154
154
|
export interface McpServerInput {
|
|
155
|
+
/**
|
|
156
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
157
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
158
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
159
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
160
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
161
|
+
*/
|
|
162
|
+
id?: string;
|
|
155
163
|
name: string;
|
|
156
164
|
slug?: string;
|
|
157
165
|
org: string;
|
|
@@ -280,6 +288,7 @@ export function buildMcpServerProto(input: McpServerInput): McpServer {
|
|
|
280
288
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
281
289
|
kind: "McpServer",
|
|
282
290
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
291
|
+
...(input.id && { id: input.id }),
|
|
283
292
|
name: input.name,
|
|
284
293
|
org: input.org,
|
|
285
294
|
...(input.slug && { slug: input.slug }),
|
|
@@ -289,3 +298,86 @@ export function buildMcpServerProto(input: McpServerInput): McpServer {
|
|
|
289
298
|
spec,
|
|
290
299
|
}) as McpServer;
|
|
291
300
|
}
|
|
301
|
+
|
|
302
|
+
function toStdioServerConfigInput(msg: StdioServerConfig): StdioServerConfigInput {
|
|
303
|
+
return {
|
|
304
|
+
command: msg.command ?? "",
|
|
305
|
+
args: msg.args?.length ? [...msg.args] : undefined,
|
|
306
|
+
workingDir: msg.workingDir || undefined,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function toHttpServerConfigInput(msg: HttpServerConfig): HttpServerConfigInput {
|
|
311
|
+
return {
|
|
312
|
+
url: msg.url ?? "",
|
|
313
|
+
headers: Object.keys(msg.headers ?? {}).length > 0 ? { ...msg.headers } : undefined,
|
|
314
|
+
queryParams: Object.keys(msg.queryParams ?? {}).length > 0 ? { ...msg.queryParams } : undefined,
|
|
315
|
+
timeoutSeconds: msg.timeoutSeconds || undefined,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function toEnvVarDeclarationInput(msg: EnvVarDeclaration): EnvVarDeclarationInput {
|
|
320
|
+
return {
|
|
321
|
+
isSecret: msg.isSecret || undefined,
|
|
322
|
+
description: msg.description || undefined,
|
|
323
|
+
optional: msg.optional || undefined,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function toToolApprovalPolicyInput(msg: ToolApprovalPolicy): ToolApprovalPolicyInput {
|
|
328
|
+
return {
|
|
329
|
+
toolName: msg.toolName || undefined,
|
|
330
|
+
message: msg.message || undefined,
|
|
331
|
+
fromDestructiveHint: msg.fromDestructiveHint || undefined,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function toMcpServerAuthInput(msg: McpServerAuth): McpServerAuthInput {
|
|
336
|
+
return {
|
|
337
|
+
oauthAppRef: toResourceRefInput(msg.oauthAppRef),
|
|
338
|
+
targetEnvVar: msg.targetEnvVar || undefined,
|
|
339
|
+
tokenLifetimeHint: msg.tokenLifetimeHint || undefined,
|
|
340
|
+
scopeHints: msg.scopeHints?.length ? [...msg.scopeHints] : undefined,
|
|
341
|
+
discoveryUrl: msg.discoveryUrl || undefined,
|
|
342
|
+
oauthOnly: msg.oauthOnly || undefined,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Maps a fetched {@link McpServer} to a complete {@link McpServerInput} for `update()`.
|
|
348
|
+
*
|
|
349
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
350
|
+
* and override only the fields you edit (spread nested objects the same
|
|
351
|
+
* way):
|
|
352
|
+
*
|
|
353
|
+
* await client.update({ ...toMcpServerUpdateInput(res), description: next });
|
|
354
|
+
*
|
|
355
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
356
|
+
* `version` (pinned refs) and `kind`.
|
|
357
|
+
*/
|
|
358
|
+
export function toMcpServerUpdateInput(resource: McpServer): McpServerInput {
|
|
359
|
+
const meta = resource.metadata;
|
|
360
|
+
const spec = resource.spec ?? create(McpServerSpecSchema);
|
|
361
|
+
return {
|
|
362
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
363
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
364
|
+
// match, so the id is the ONLY working address.
|
|
365
|
+
id: meta?.id || undefined,
|
|
366
|
+
name: meta?.name ?? "",
|
|
367
|
+
slug: meta?.slug || undefined,
|
|
368
|
+
org: meta?.org ?? "",
|
|
369
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
370
|
+
visibility: meta?.visibility || undefined,
|
|
371
|
+
description: spec.description || undefined,
|
|
372
|
+
iconUrl: spec.iconUrl || undefined,
|
|
373
|
+
tags: spec.tags?.length ? [...spec.tags] : undefined,
|
|
374
|
+
stdio: spec.serverType?.case === "stdio" ? toStdioServerConfigInput(spec.serverType.value) : undefined,
|
|
375
|
+
http: spec.serverType?.case === "http" ? toHttpServerConfigInput(spec.serverType.value) : undefined,
|
|
376
|
+
defaultEnabledTools: spec.defaultEnabledTools?.length ? [...spec.defaultEnabledTools] : undefined,
|
|
377
|
+
env: Object.keys(spec.env ?? {}).length > 0 ? Object.fromEntries(Object.entries(spec.env).map(([k, v]) => [k, toEnvVarDeclarationInput(v)])) : undefined,
|
|
378
|
+
pinnedToolApprovals: spec.pinnedToolApprovals?.length ? spec.pinnedToolApprovals.map(toToolApprovalPolicyInput) : undefined,
|
|
379
|
+
repositoryUrl: spec.repositoryUrl || undefined,
|
|
380
|
+
githubStars: spec.githubStars || undefined,
|
|
381
|
+
auth: spec.auth ? toMcpServerAuthInput(spec.auth) : undefined,
|
|
382
|
+
};
|
|
383
|
+
}
|
package/src/gen/oauthapp.ts
CHANGED
|
@@ -74,6 +74,14 @@ export class OAuthAppClient {
|
|
|
74
74
|
|
|
75
75
|
/** Input for creating/updating a OAuthApp. */
|
|
76
76
|
export interface OAuthAppInput {
|
|
77
|
+
/**
|
|
78
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
79
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
80
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
81
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
82
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
83
|
+
*/
|
|
84
|
+
id?: string;
|
|
77
85
|
name: string;
|
|
78
86
|
slug?: string;
|
|
79
87
|
org: string;
|
|
@@ -97,6 +105,7 @@ export function buildOAuthAppProto(input: OAuthAppInput): OAuthApp {
|
|
|
97
105
|
apiVersion: "iam.stigmer.ai/v1",
|
|
98
106
|
kind: "OAuthApp",
|
|
99
107
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
108
|
+
...(input.id && { id: input.id }),
|
|
100
109
|
name: input.name,
|
|
101
110
|
org: input.org,
|
|
102
111
|
...(input.slug && { slug: input.slug }),
|
|
@@ -118,3 +127,42 @@ export function buildOAuthAppProto(input: OAuthAppInput): OAuthApp {
|
|
|
118
127
|
})),
|
|
119
128
|
}) as OAuthApp;
|
|
120
129
|
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Maps a fetched {@link OAuthApp} to a complete {@link OAuthAppInput} for `update()`.
|
|
133
|
+
*
|
|
134
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
135
|
+
* and override only the fields you edit (spread nested objects the same
|
|
136
|
+
* way):
|
|
137
|
+
*
|
|
138
|
+
* await client.update({ ...toOAuthAppUpdateInput(res), description: next });
|
|
139
|
+
*
|
|
140
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
141
|
+
* `version` (pinned refs) and `kind`.
|
|
142
|
+
*/
|
|
143
|
+
export function toOAuthAppUpdateInput(resource: OAuthApp): OAuthAppInput {
|
|
144
|
+
const meta = resource.metadata;
|
|
145
|
+
const spec = resource.spec ?? create(OAuthAppSpecSchema);
|
|
146
|
+
return {
|
|
147
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
148
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
149
|
+
// match, so the id is the ONLY working address.
|
|
150
|
+
id: meta?.id || undefined,
|
|
151
|
+
name: meta?.name ?? "",
|
|
152
|
+
slug: meta?.slug || undefined,
|
|
153
|
+
org: meta?.org ?? "",
|
|
154
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
155
|
+
visibility: meta?.visibility || undefined,
|
|
156
|
+
provider: spec.provider || undefined,
|
|
157
|
+
clientId: spec.clientId || undefined,
|
|
158
|
+
clientSecret: spec.clientSecret || undefined,
|
|
159
|
+
authorizationUrl: spec.authorizationUrl || undefined,
|
|
160
|
+
tokenUrl: spec.tokenUrl || undefined,
|
|
161
|
+
scopes: spec.scopes?.length ? [...spec.scopes] : undefined,
|
|
162
|
+
userinfoUrl: spec.userinfoUrl || undefined,
|
|
163
|
+
scopeParameterName: spec.scopeParameterName || undefined,
|
|
164
|
+
vendorApprovalStatus: spec.vendorApprovalStatus || undefined,
|
|
165
|
+
vendorApprovalDocsUrl: spec.vendorApprovalDocsUrl || undefined,
|
|
166
|
+
tokenEndpointAuthMethod: spec.tokenEndpointAuthMethod || undefined,
|
|
167
|
+
};
|
|
168
|
+
}
|
package/src/gen/organization.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors.js";
|
|
4
|
-
import { stripUndefined } from "./proto-utils.js";
|
|
4
|
+
import { stripUndefined, toResourceRefInput } from "./proto-utils.js";
|
|
5
5
|
import { type ResourceRef } from "./types.js";
|
|
6
6
|
import { create } from "@bufbuild/protobuf";
|
|
7
7
|
import { EmptySchema } from "@bufbuild/protobuf/wkt";
|
|
@@ -14,7 +14,7 @@ import { OrganizationCommandController } from "@stigmer/protos/ai/stigmer/tenanc
|
|
|
14
14
|
import { ManagementMode } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/enum_pb";
|
|
15
15
|
import { OrganizationIdSchema, OrganizationListSchema, OrganizationsSchema, OrganizationExternalLookupSchema, type OrganizationList, type Organizations, type OrganizationExternalLookup } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/io_pb";
|
|
16
16
|
import { OrganizationQueryController } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/query_pb";
|
|
17
|
-
import { OrganizationSpecSchema, OrganizationPreferencesSchema } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/spec_pb";
|
|
17
|
+
import { OrganizationSpecSchema, OrganizationPreferencesSchema, type OrganizationPreferences } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/spec_pb";
|
|
18
18
|
|
|
19
19
|
/** Provides operations on organization resources. */
|
|
20
20
|
export class OrganizationClient {
|
|
@@ -77,6 +77,14 @@ export class OrganizationClient {
|
|
|
77
77
|
|
|
78
78
|
/** Input for creating/updating a Organization. */
|
|
79
79
|
export interface OrganizationInput {
|
|
80
|
+
/**
|
|
81
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
82
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
83
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
84
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
85
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
86
|
+
*/
|
|
87
|
+
id?: string;
|
|
80
88
|
name: string;
|
|
81
89
|
slug?: string;
|
|
82
90
|
org: string;
|
|
@@ -109,6 +117,7 @@ export function buildOrganizationProto(input: OrganizationInput): Organization {
|
|
|
109
117
|
apiVersion: "tenancy.stigmer.ai/v1",
|
|
110
118
|
kind: "Organization",
|
|
111
119
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
120
|
+
...(input.id && { id: input.id }),
|
|
112
121
|
name: input.name,
|
|
113
122
|
org: input.org,
|
|
114
123
|
...(input.slug && { slug: input.slug }),
|
|
@@ -126,3 +135,44 @@ export function buildOrganizationProto(input: OrganizationInput): Organization {
|
|
|
126
135
|
})),
|
|
127
136
|
}) as Organization;
|
|
128
137
|
}
|
|
138
|
+
|
|
139
|
+
function toOrganizationPreferencesInput(msg: OrganizationPreferences): OrganizationPreferencesInput {
|
|
140
|
+
return {
|
|
141
|
+
standingContext: msg.standingContext || undefined,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Maps a fetched {@link Organization} to a complete {@link OrganizationInput} for `update()`.
|
|
147
|
+
*
|
|
148
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
149
|
+
* and override only the fields you edit (spread nested objects the same
|
|
150
|
+
* way):
|
|
151
|
+
*
|
|
152
|
+
* await client.update({ ...toOrganizationUpdateInput(res), description: next });
|
|
153
|
+
*
|
|
154
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
155
|
+
* `version` (pinned refs) and `kind`.
|
|
156
|
+
*/
|
|
157
|
+
export function toOrganizationUpdateInput(resource: Organization): OrganizationInput {
|
|
158
|
+
const meta = resource.metadata;
|
|
159
|
+
const spec = resource.spec ?? create(OrganizationSpecSchema);
|
|
160
|
+
return {
|
|
161
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
162
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
163
|
+
// match, so the id is the ONLY working address.
|
|
164
|
+
id: meta?.id || undefined,
|
|
165
|
+
name: meta?.name ?? "",
|
|
166
|
+
slug: meta?.slug || undefined,
|
|
167
|
+
org: meta?.org || meta?.slug || "",
|
|
168
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
169
|
+
visibility: meta?.visibility || undefined,
|
|
170
|
+
description: spec.description || undefined,
|
|
171
|
+
logoUrl: spec.logoUrl || undefined,
|
|
172
|
+
managementMode: spec.managementMode || undefined,
|
|
173
|
+
identityProviderRef: toResourceRefInput(spec.identityProviderRef),
|
|
174
|
+
externalOrgId: spec.externalOrgId || undefined,
|
|
175
|
+
isPersonal: spec.isPersonal || undefined,
|
|
176
|
+
preferences: spec.preferences ? toOrganizationPreferencesInput(spec.preferences) : undefined,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors.js";
|
|
4
|
-
import { stripUndefined, toTimestamp } from "./proto-utils.js";
|
|
4
|
+
import { stripUndefined, toTimestamp, toResourceRefInputs } from "./proto-utils.js";
|
|
5
5
|
import { type DeleteResourceInput, type ResourceRef } from "./types.js";
|
|
6
6
|
import { create } from "@bufbuild/protobuf";
|
|
7
|
+
import { timestampDate } from "@bufbuild/protobuf/wkt";
|
|
7
8
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
9
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
9
10
|
import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
|
|
@@ -90,6 +91,14 @@ export class PlatformClientClient {
|
|
|
90
91
|
|
|
91
92
|
/** Input for creating/updating a PlatformClient. */
|
|
92
93
|
export interface PlatformClientInput {
|
|
94
|
+
/**
|
|
95
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
96
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
97
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
98
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
99
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
100
|
+
*/
|
|
101
|
+
id?: string;
|
|
93
102
|
name: string;
|
|
94
103
|
slug?: string;
|
|
95
104
|
org: string;
|
|
@@ -114,6 +123,7 @@ export function buildPlatformClientProto(input: PlatformClientInput): PlatformCl
|
|
|
114
123
|
apiVersion: "iam.stigmer.ai/v1",
|
|
115
124
|
kind: "PlatformClient",
|
|
116
125
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
126
|
+
...(input.id && { id: input.id }),
|
|
117
127
|
name: input.name,
|
|
118
128
|
org: input.org,
|
|
119
129
|
...(input.slug && { slug: input.slug }),
|
|
@@ -134,3 +144,41 @@ export function buildPlatformClientProto(input: PlatformClientInput): PlatformCl
|
|
|
134
144
|
})),
|
|
135
145
|
}) as PlatformClient;
|
|
136
146
|
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Maps a fetched {@link PlatformClient} to a complete {@link PlatformClientInput} for `update()`.
|
|
150
|
+
*
|
|
151
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
152
|
+
* and override only the fields you edit (spread nested objects the same
|
|
153
|
+
* way):
|
|
154
|
+
*
|
|
155
|
+
* await client.update({ ...toPlatformClientUpdateInput(res), description: next });
|
|
156
|
+
*
|
|
157
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
158
|
+
* `version` (pinned refs) and `kind`.
|
|
159
|
+
*/
|
|
160
|
+
export function toPlatformClientUpdateInput(resource: PlatformClient): PlatformClientInput {
|
|
161
|
+
const meta = resource.metadata;
|
|
162
|
+
const spec = resource.spec ?? create(PlatformClientSpecSchema);
|
|
163
|
+
return {
|
|
164
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
165
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
166
|
+
// match, so the id is the ONLY working address.
|
|
167
|
+
id: meta?.id || undefined,
|
|
168
|
+
name: meta?.name ?? "",
|
|
169
|
+
slug: meta?.slug || undefined,
|
|
170
|
+
org: meta?.org ?? "",
|
|
171
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
172
|
+
visibility: meta?.visibility || undefined,
|
|
173
|
+
clientId: spec.clientId || undefined,
|
|
174
|
+
clientSecretHash: spec.clientSecretHash || undefined,
|
|
175
|
+
secretFingerprint: spec.secretFingerprint || undefined,
|
|
176
|
+
expiresAt: spec.expiresAt ? timestampDate(spec.expiresAt) : undefined,
|
|
177
|
+
neverExpires: spec.neverExpires || undefined,
|
|
178
|
+
autoProvisionAccounts: spec.autoProvisionAccounts || undefined,
|
|
179
|
+
autoGrantOnOrg: spec.autoGrantOnOrg || undefined,
|
|
180
|
+
autoGrantRole: spec.autoGrantRole || undefined,
|
|
181
|
+
allowedOrigins: spec.allowedOrigins?.length ? [...spec.allowedOrigins] : undefined,
|
|
182
|
+
environmentRefs: toResourceRefInputs(spec.environmentRefs),
|
|
183
|
+
};
|
|
184
|
+
}
|
package/src/gen/project.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors.js";
|
|
4
|
-
import { stripUndefined } from "./proto-utils.js";
|
|
4
|
+
import { stripUndefined, toResourceRefInputs } from "./proto-utils.js";
|
|
5
5
|
import { type ResourceRef } from "./types.js";
|
|
6
6
|
import { create } from "@bufbuild/protobuf";
|
|
7
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
@@ -64,6 +64,14 @@ export class ProjectClient {
|
|
|
64
64
|
|
|
65
65
|
/** Input for creating/updating a Project. */
|
|
66
66
|
export interface ProjectInput {
|
|
67
|
+
/**
|
|
68
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
69
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
70
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
71
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
72
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
73
|
+
*/
|
|
74
|
+
id?: string;
|
|
67
75
|
name: string;
|
|
68
76
|
slug?: string;
|
|
69
77
|
org: string;
|
|
@@ -80,6 +88,7 @@ export function buildProjectProto(input: ProjectInput): Project {
|
|
|
80
88
|
apiVersion: "tenancy.stigmer.ai/v1",
|
|
81
89
|
kind: "Project",
|
|
82
90
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
91
|
+
...(input.id && { id: input.id }),
|
|
83
92
|
name: input.name,
|
|
84
93
|
org: input.org,
|
|
85
94
|
...(input.slug && { slug: input.slug }),
|
|
@@ -93,3 +102,34 @@ export function buildProjectProto(input: ProjectInput): Project {
|
|
|
93
102
|
})),
|
|
94
103
|
}) as Project;
|
|
95
104
|
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Maps a fetched {@link Project} to a complete {@link ProjectInput} for `update()`.
|
|
108
|
+
*
|
|
109
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
110
|
+
* and override only the fields you edit (spread nested objects the same
|
|
111
|
+
* way):
|
|
112
|
+
*
|
|
113
|
+
* await client.update({ ...toProjectUpdateInput(res), description: next });
|
|
114
|
+
*
|
|
115
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
116
|
+
* `version` (pinned refs) and `kind`.
|
|
117
|
+
*/
|
|
118
|
+
export function toProjectUpdateInput(resource: Project): ProjectInput {
|
|
119
|
+
const meta = resource.metadata;
|
|
120
|
+
const spec = resource.spec ?? create(ProjectSpecSchema);
|
|
121
|
+
return {
|
|
122
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
123
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
124
|
+
// match, so the id is the ONLY working address.
|
|
125
|
+
id: meta?.id || undefined,
|
|
126
|
+
name: meta?.name ?? "",
|
|
127
|
+
slug: meta?.slug || undefined,
|
|
128
|
+
org: meta?.org ?? "",
|
|
129
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
130
|
+
visibility: meta?.visibility || undefined,
|
|
131
|
+
entryPoint: spec.entryPoint || undefined,
|
|
132
|
+
description: spec.description || undefined,
|
|
133
|
+
members: toResourceRefInputs(spec.members),
|
|
134
|
+
};
|
|
135
|
+
}
|
package/src/gen/proto-utils.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { timestampFromDate, type Timestamp } from "@bufbuild/protobuf/wkt";
|
|
4
|
+
import type { ApiResourceReference } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
5
|
+
import type { EnvironmentSpec, EnvironmentValue } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
|
|
6
|
+
import type { ExecutionValue } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
|
|
7
|
+
import type { EnvSpecInput, EnvVarInput, ResourceRef } from "./types.js";
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
10
|
* Remove keys whose values are `undefined` so that `Object.assign`
|
|
@@ -24,3 +28,63 @@ export function toTimestamp(value: Date | string): Timestamp {
|
|
|
24
28
|
const date = value instanceof Date ? value : new Date(value);
|
|
25
29
|
return timestampFromDate(date);
|
|
26
30
|
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Narrow a fetched ApiResourceReference to the ResourceRef input shape,
|
|
34
|
+
* or `undefined` when the reference is absent/empty (the builders treat a
|
|
35
|
+
* ref without org and slug as "no reference"). `version` is preserved —
|
|
36
|
+
* dropping it would reset a pinned reference to "latest". `kind` is also
|
|
37
|
+
* preserved: builders overwrite it where the proto annotates a reference
|
|
38
|
+
* kind, but refs without that annotation (e.g. an organization's
|
|
39
|
+
* identityProviderRef) carry the stored kind, so dropping it would be
|
|
40
|
+
* lossy.
|
|
41
|
+
*/
|
|
42
|
+
export function toResourceRefInput(ref: ApiResourceReference | undefined): ResourceRef | undefined {
|
|
43
|
+
if (!ref || (!ref.org && !ref.slug)) return undefined;
|
|
44
|
+
return {
|
|
45
|
+
org: ref.org,
|
|
46
|
+
slug: ref.slug,
|
|
47
|
+
...(ref.version && { version: ref.version }),
|
|
48
|
+
...(ref.kind && { kind: ref.kind }),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Map a repeated ApiResourceReference to ResourceRef inputs, or `undefined`
|
|
54
|
+
* when the list is absent/empty (the mappers' canonical shape for empty
|
|
55
|
+
* lists).
|
|
56
|
+
*/
|
|
57
|
+
export function toResourceRefInputs(refs: ApiResourceReference[] | undefined): ResourceRef[] | undefined {
|
|
58
|
+
if (!refs || refs.length === 0) return undefined;
|
|
59
|
+
return refs.map((r) => toResourceRefInput(r) ?? { org: "", slug: "" });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Convert a fetched EnvironmentSpec to the EnvSpecInput shape, or
|
|
64
|
+
* `undefined` when absent/empty.
|
|
65
|
+
*/
|
|
66
|
+
export function toEnvSpecInput(spec: EnvironmentSpec | undefined): EnvSpecInput | undefined {
|
|
67
|
+
if (!spec) return undefined;
|
|
68
|
+
const variables = toEnvVarInputMap(spec.data);
|
|
69
|
+
return variables ? { variables } : undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Convert a map of EnvironmentValue to EnvVarInput entries, or `undefined`
|
|
74
|
+
* when the map is absent/empty.
|
|
75
|
+
*/
|
|
76
|
+
export function toEnvVarInputMap(data: Record<string, EnvironmentValue> | undefined): Record<string, EnvVarInput> | undefined {
|
|
77
|
+
if (!data || Object.keys(data).length === 0) return undefined;
|
|
78
|
+
return Object.fromEntries(Object.entries(data).map(([k, v]) =>
|
|
79
|
+
[k, { value: v.value, isSecret: v.isSecret || undefined, description: v.description || undefined }]));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Convert a map of ExecutionValue to EnvVarInput entries, or `undefined`
|
|
84
|
+
* when the map is absent/empty.
|
|
85
|
+
*/
|
|
86
|
+
export function toExecVarInputMap(data: Record<string, ExecutionValue> | undefined): Record<string, EnvVarInput> | undefined {
|
|
87
|
+
if (!data || Object.keys(data).length === 0) return undefined;
|
|
88
|
+
return Object.fromEntries(Object.entries(data).map(([k, v]) =>
|
|
89
|
+
[k, { value: v.value, isSecret: v.isSecret || undefined }]));
|
|
90
|
+
}
|
package/src/gen/schedule.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors.js";
|
|
4
|
-
import { stripUndefined } from "./proto-utils.js";
|
|
4
|
+
import { stripUndefined, toResourceRefInput, toResourceRefInputs } from "./proto-utils.js";
|
|
5
5
|
import { type ResourceRef } from "./types.js";
|
|
6
6
|
import { create } from "@bufbuild/protobuf";
|
|
7
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
-
import { ServiceTier } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
9
|
-
import { RunConfigSchema, AgentInvocationSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/invocation_pb";
|
|
8
|
+
import { ServiceTier, ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
9
|
+
import { RunConfigSchema, AgentInvocationSchema, type RunConfig, type AgentInvocation } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/invocation_pb";
|
|
10
10
|
import { ScheduleSchema, type Schedule } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/api_pb";
|
|
11
11
|
import { ScheduleCommandController } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/command_pb";
|
|
12
12
|
import { ScheduleIdSchema, ScheduleTriggerResultSchema, GetSchedulesByAgentRequestSchema, ScheduleListSchema, ListSchedulesRequestSchema, ListScheduleRunsRequestSchema, ScheduleRunListSchema, type ScheduleTriggerResult, type GetSchedulesByAgentRequest, type ScheduleList, type ListSchedulesRequest, type ListScheduleRunsRequest, type ScheduleRunList } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/io_pb";
|
|
13
13
|
import { ScheduleQueryController } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/query_pb";
|
|
14
14
|
import { ScheduleSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/spec_pb";
|
|
15
15
|
import { Harness, GitWriteBackMode } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
|
|
16
|
-
import { GitRepoSourceSchema, LocalPathSourceSchema, WorkspaceSourceSchema, WorkspaceEntrySchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
|
|
16
|
+
import { GitRepoSourceSchema, LocalPathSourceSchema, WorkspaceSourceSchema, WorkspaceEntrySchema, type GitRepoSource, type LocalPathSource, type WorkspaceSource, type WorkspaceEntry } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
|
|
17
17
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
18
18
|
import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
|
|
19
19
|
import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
@@ -98,6 +98,14 @@ export class ScheduleClient {
|
|
|
98
98
|
|
|
99
99
|
/** Input for creating/updating a Schedule. */
|
|
100
100
|
export interface ScheduleInput {
|
|
101
|
+
/**
|
|
102
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
103
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
104
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
105
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
106
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
107
|
+
*/
|
|
108
|
+
id?: string;
|
|
101
109
|
name: string;
|
|
102
110
|
slug?: string;
|
|
103
111
|
org: string;
|
|
@@ -151,6 +159,7 @@ export interface RunConfigInput {
|
|
|
151
159
|
maxCostUsd?: number;
|
|
152
160
|
maxToolRounds?: number;
|
|
153
161
|
serviceTier?: ServiceTier;
|
|
162
|
+
thinkingMode?: ThinkingMode;
|
|
154
163
|
}
|
|
155
164
|
|
|
156
165
|
function buildGitRepoSourceProto(input: GitRepoSourceInput) {
|
|
@@ -192,6 +201,7 @@ function buildRunConfigProto(input: RunConfigInput) {
|
|
|
192
201
|
maxCostUsd: input.maxCostUsd,
|
|
193
202
|
maxToolRounds: input.maxToolRounds,
|
|
194
203
|
serviceTier: input.serviceTier,
|
|
204
|
+
thinkingMode: input.thinkingMode,
|
|
195
205
|
}));
|
|
196
206
|
}
|
|
197
207
|
|
|
@@ -219,6 +229,7 @@ export function buildScheduleProto(input: ScheduleInput): Schedule {
|
|
|
219
229
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
220
230
|
kind: "Schedule",
|
|
221
231
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
232
|
+
...(input.id && { id: input.id }),
|
|
222
233
|
name: input.name,
|
|
223
234
|
org: input.org,
|
|
224
235
|
...(input.slug && { slug: input.slug }),
|
|
@@ -228,3 +239,86 @@ export function buildScheduleProto(input: ScheduleInput): Schedule {
|
|
|
228
239
|
spec,
|
|
229
240
|
}) as Schedule;
|
|
230
241
|
}
|
|
242
|
+
|
|
243
|
+
function toGitRepoSourceInput(msg: GitRepoSource): GitRepoSourceInput {
|
|
244
|
+
return {
|
|
245
|
+
url: msg.url ?? "",
|
|
246
|
+
branch: msg.branch || undefined,
|
|
247
|
+
commit: msg.commit || undefined,
|
|
248
|
+
depth: msg.depth || undefined,
|
|
249
|
+
writeBackMode: msg.writeBackMode || undefined,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function toLocalPathSourceInput(msg: LocalPathSource): LocalPathSourceInput {
|
|
254
|
+
return {
|
|
255
|
+
path: msg.path || undefined,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function toWorkspaceSourceInput(msg: WorkspaceSource): WorkspaceSourceInput {
|
|
260
|
+
return {
|
|
261
|
+
gitRepo: msg.source?.case === "gitRepo" ? toGitRepoSourceInput(msg.source.value) : undefined,
|
|
262
|
+
localPath: msg.source?.case === "localPath" ? toLocalPathSourceInput(msg.source.value) : undefined,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function toWorkspaceEntryInput(msg: WorkspaceEntry): WorkspaceEntryInput {
|
|
267
|
+
return {
|
|
268
|
+
name: msg.name || undefined,
|
|
269
|
+
source: toWorkspaceSourceInput(msg.source ?? create(WorkspaceSourceSchema)),
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function toRunConfigInput(msg: RunConfig): RunConfigInput {
|
|
274
|
+
return {
|
|
275
|
+
modelName: msg.modelName || undefined,
|
|
276
|
+
maxCostUsd: msg.maxCostUsd || undefined,
|
|
277
|
+
maxToolRounds: msg.maxToolRounds || undefined,
|
|
278
|
+
serviceTier: msg.serviceTier || undefined,
|
|
279
|
+
thinkingMode: msg.thinkingMode || undefined,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function toAgentInvocationInput(msg: AgentInvocation): AgentInvocationInput {
|
|
284
|
+
return {
|
|
285
|
+
agentRef: toResourceRefInput(msg.agentRef) ?? { org: "", slug: "" },
|
|
286
|
+
message: msg.message || undefined,
|
|
287
|
+
harness: msg.harness || undefined,
|
|
288
|
+
workspaceEntries: msg.workspaceEntries?.length ? msg.workspaceEntries.map(toWorkspaceEntryInput) : undefined,
|
|
289
|
+
environmentRefs: toResourceRefInputs(msg.environmentRefs),
|
|
290
|
+
runConfig: msg.runConfig ? toRunConfigInput(msg.runConfig) : undefined,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Maps a fetched {@link Schedule} to a complete {@link ScheduleInput} for `update()`.
|
|
296
|
+
*
|
|
297
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
298
|
+
* and override only the fields you edit (spread nested objects the same
|
|
299
|
+
* way):
|
|
300
|
+
*
|
|
301
|
+
* await client.update({ ...toScheduleUpdateInput(res), description: next });
|
|
302
|
+
*
|
|
303
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
304
|
+
* `version` (pinned refs) and `kind`.
|
|
305
|
+
*/
|
|
306
|
+
export function toScheduleUpdateInput(resource: Schedule): ScheduleInput {
|
|
307
|
+
const meta = resource.metadata;
|
|
308
|
+
const spec = resource.spec ?? create(ScheduleSpecSchema);
|
|
309
|
+
return {
|
|
310
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
311
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
312
|
+
// match, so the id is the ONLY working address.
|
|
313
|
+
id: meta?.id || undefined,
|
|
314
|
+
name: meta?.name ?? "",
|
|
315
|
+
slug: meta?.slug || undefined,
|
|
316
|
+
org: meta?.org ?? "",
|
|
317
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
318
|
+
visibility: meta?.visibility || undefined,
|
|
319
|
+
cron: spec.cron || undefined,
|
|
320
|
+
timeZone: spec.timeZone || undefined,
|
|
321
|
+
enabled: spec.enabled || undefined,
|
|
322
|
+
agent: spec.target?.case === "agent" ? toAgentInvocationInput(spec.target.value) : undefined,
|
|
323
|
+
};
|
|
324
|
+
}
|