@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
|
@@ -14,12 +14,14 @@ import {
|
|
|
14
14
|
} from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/api_pb";
|
|
15
15
|
import { IdentityAccountSpecSchema } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/spec_pb";
|
|
16
16
|
import { IdentityAccountProvisioningMode } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/enum_pb";
|
|
17
|
-
import { buildOrganizationProto } from "../gen/organization";
|
|
18
|
-
import { buildIdentityAccountProto } from "../gen/identityaccount";
|
|
19
17
|
import {
|
|
18
|
+
buildOrganizationProto,
|
|
20
19
|
toOrganizationUpdateInput,
|
|
20
|
+
} from "../gen/organization";
|
|
21
|
+
import {
|
|
22
|
+
buildIdentityAccountProto,
|
|
21
23
|
toIdentityAccountUpdateInput,
|
|
22
|
-
} from "../
|
|
24
|
+
} from "../gen/identityaccount";
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* Update RPCs are full-spec replacements, so a complete mapper must
|
|
@@ -139,6 +141,14 @@ describe("toOrganizationUpdateInput", () => {
|
|
|
139
141
|
|
|
140
142
|
expect(toOrganizationUpdateInput(org).org).toBe("bare");
|
|
141
143
|
});
|
|
144
|
+
|
|
145
|
+
it("carries metadata.id for exact update addressing", () => {
|
|
146
|
+
const built = buildOrganizationProto(
|
|
147
|
+
toOrganizationUpdateInput(fullOrganization()),
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
expect(built.metadata?.id).toBe("acme");
|
|
151
|
+
});
|
|
142
152
|
});
|
|
143
153
|
|
|
144
154
|
describe("toIdentityAccountUpdateInput", () => {
|
|
@@ -163,6 +173,27 @@ describe("toIdentityAccountUpdateInput", () => {
|
|
|
163
173
|
expect(input.slug).toBe("ada-lovelace");
|
|
164
174
|
});
|
|
165
175
|
|
|
176
|
+
it("carries metadata.id — the ONLY address that works for a real (org-less) account", () => {
|
|
177
|
+
// Identity accounts are platform-scoped: metadata.org is never set in
|
|
178
|
+
// production, so the pipeline's org+slug fallback structurally cannot
|
|
179
|
+
// match one. Without the id, this update is NOT_FOUND by construction.
|
|
180
|
+
const account = create(IdentityAccountSchema, {
|
|
181
|
+
metadata: {
|
|
182
|
+
id: "ida_01JEXAMPLE",
|
|
183
|
+
name: "ada@acme.example",
|
|
184
|
+
slug: "ada-acme-example",
|
|
185
|
+
},
|
|
186
|
+
spec: { idpId: "auth0|abc123" },
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const built = buildIdentityAccountProto(
|
|
190
|
+
toIdentityAccountUpdateInput(account),
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
expect(built.metadata?.id).toBe("ida_01JEXAMPLE");
|
|
194
|
+
expect(built.metadata?.slug).toBe("ada-acme-example");
|
|
195
|
+
});
|
|
196
|
+
|
|
166
197
|
it("preserves the rest of the spec when a caller overrides only preferences", () => {
|
|
167
198
|
const account = fullIdentityAccount();
|
|
168
199
|
const mapped = toIdentityAccountUpdateInput(account);
|
package/src/gen/agent.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, toResourceRefInputs } from "./proto-utils.js";
|
|
5
5
|
import { 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";
|
|
@@ -9,8 +9,8 @@ import { AgentSchema, type Agent } from "@stigmer/protos/ai/stigmer/agentic/agen
|
|
|
9
9
|
import { AgentCommandController } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/command_pb";
|
|
10
10
|
import { AgentIdSchema, GetDefaultAgentRequestSchema, type GetDefaultAgentRequest } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/io_pb";
|
|
11
11
|
import { AgentQueryController } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/query_pb";
|
|
12
|
-
import { AgentSpecSchema, ToolApprovalOverrideSchema, McpServerUsageSchema, McpAccessSchema, SubAgentSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
|
|
13
|
-
import { EnvVarDeclarationSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
|
|
12
|
+
import { AgentSpecSchema, ToolApprovalOverrideSchema, McpServerUsageSchema, McpAccessSchema, SubAgentSchema, type ToolApprovalOverride, type McpServerUsage, type McpAccess, type SubAgent } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
|
|
13
|
+
import { EnvVarDeclarationSchema, type EnvVarDeclaration } from "@stigmer/protos/ai/stigmer/agentic/environment/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 { ApiResourceReferenceSchema, type UpdateVisibilityInput } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
@@ -100,6 +100,14 @@ export class AgentClient {
|
|
|
100
100
|
|
|
101
101
|
/** Input for creating/updating a Agent. */
|
|
102
102
|
export interface AgentInput {
|
|
103
|
+
/**
|
|
104
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
105
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
106
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
107
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
108
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
109
|
+
*/
|
|
110
|
+
id?: string;
|
|
103
111
|
name: string;
|
|
104
112
|
slug?: string;
|
|
105
113
|
org: string;
|
|
@@ -205,6 +213,7 @@ export function buildAgentProto(input: AgentInput): Agent {
|
|
|
205
213
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
206
214
|
kind: "Agent",
|
|
207
215
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
216
|
+
...(input.id && { id: input.id }),
|
|
208
217
|
name: input.name,
|
|
209
218
|
org: input.org,
|
|
210
219
|
...(input.slug && { slug: input.slug }),
|
|
@@ -222,3 +231,80 @@ export function buildAgentProto(input: AgentInput): Agent {
|
|
|
222
231
|
})),
|
|
223
232
|
}) as Agent;
|
|
224
233
|
}
|
|
234
|
+
|
|
235
|
+
function toToolApprovalOverrideInput(msg: ToolApprovalOverride): ToolApprovalOverrideInput {
|
|
236
|
+
return {
|
|
237
|
+
toolName: msg.toolName || undefined,
|
|
238
|
+
requiresApproval: msg.requiresApproval || undefined,
|
|
239
|
+
message: msg.message || undefined,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function toMcpServerUsageInput(msg: McpServerUsage): McpServerUsageInput {
|
|
244
|
+
return {
|
|
245
|
+
mcpServerRef: toResourceRefInput(msg.mcpServerRef) ?? { org: "", slug: "" },
|
|
246
|
+
enabledTools: msg.enabledTools?.length ? [...msg.enabledTools] : undefined,
|
|
247
|
+
toolApprovalOverrides: msg.toolApprovalOverrides?.length ? msg.toolApprovalOverrides.map(toToolApprovalOverrideInput) : undefined,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function toMcpAccessInput(msg: McpAccess): McpAccessInput {
|
|
252
|
+
return {
|
|
253
|
+
mcpServer: msg.mcpServer ?? "",
|
|
254
|
+
enabledTools: msg.enabledTools?.length ? [...msg.enabledTools] : undefined,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function toSubAgentInput(msg: SubAgent): SubAgentInput {
|
|
259
|
+
return {
|
|
260
|
+
name: msg.name ?? "",
|
|
261
|
+
description: msg.description || undefined,
|
|
262
|
+
instructions: msg.instructions || undefined,
|
|
263
|
+
mcpAccess: msg.mcpAccess?.length ? msg.mcpAccess.map(toMcpAccessInput) : undefined,
|
|
264
|
+
skillRefs: toResourceRefInputs(msg.skillRefs),
|
|
265
|
+
modelOverride: msg.modelOverride || undefined,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function toEnvVarDeclarationInput(msg: EnvVarDeclaration): EnvVarDeclarationInput {
|
|
270
|
+
return {
|
|
271
|
+
isSecret: msg.isSecret || undefined,
|
|
272
|
+
description: msg.description || undefined,
|
|
273
|
+
optional: msg.optional || undefined,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Maps a fetched {@link Agent} to a complete {@link AgentInput} for `update()`.
|
|
279
|
+
*
|
|
280
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
281
|
+
* and override only the fields you edit (spread nested objects the same
|
|
282
|
+
* way):
|
|
283
|
+
*
|
|
284
|
+
* await client.update({ ...toAgentUpdateInput(res), description: next });
|
|
285
|
+
*
|
|
286
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
287
|
+
* `version` (pinned refs) and `kind`.
|
|
288
|
+
*/
|
|
289
|
+
export function toAgentUpdateInput(resource: Agent): AgentInput {
|
|
290
|
+
const meta = resource.metadata;
|
|
291
|
+
const spec = resource.spec ?? create(AgentSpecSchema);
|
|
292
|
+
return {
|
|
293
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
294
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
295
|
+
// match, so the id is the ONLY working address.
|
|
296
|
+
id: meta?.id || undefined,
|
|
297
|
+
name: meta?.name ?? "",
|
|
298
|
+
slug: meta?.slug || undefined,
|
|
299
|
+
org: meta?.org ?? "",
|
|
300
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
301
|
+
visibility: meta?.visibility || undefined,
|
|
302
|
+
description: spec.description || undefined,
|
|
303
|
+
iconUrl: spec.iconUrl || undefined,
|
|
304
|
+
instructions: spec.instructions || undefined,
|
|
305
|
+
mcpServerUsages: spec.mcpServerUsages?.length ? spec.mcpServerUsages.map(toMcpServerUsageInput) : undefined,
|
|
306
|
+
skillRefs: toResourceRefInputs(spec.skillRefs),
|
|
307
|
+
subAgents: spec.subAgents?.length ? spec.subAgents.map(toSubAgentInput) : undefined,
|
|
308
|
+
env: Object.keys(spec.env ?? {}).length > 0 ? Object.fromEntries(Object.entries(spec.env).map(([k, v]) => [k, toEnvVarDeclarationInput(v)])) : undefined,
|
|
309
|
+
};
|
|
310
|
+
}
|
package/src/gen/agentchannel.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, 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";
|
|
@@ -15,9 +15,9 @@ import { ChannelMessageCommandController } from "@stigmer/protos/ai/stigmer/agen
|
|
|
15
15
|
import { SendChannelMessageOutputSchema, SendChannelMessageInputSchema, ListChannelTemplatesInputSchema, ChannelTemplatesSchema, ListMessagingChannelsInputSchema, MessagingChannelsSchema, type SendChannelMessageOutput, type SendChannelMessageInput, type ListChannelTemplatesInput, type ChannelTemplates, type ListMessagingChannelsInput, type MessagingChannels } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/message_io_pb";
|
|
16
16
|
import { ChannelMessageQueryController } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/message_query_pb";
|
|
17
17
|
import { AgentChannelQueryController } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/query_pb";
|
|
18
|
-
import { AgentChannelSpecSchema, SlackChannelConfigSchema, WhatsAppChannelConfigSchema } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/spec_pb";
|
|
19
|
-
import { ServiceTier } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
20
|
-
import { RunConfigSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/invocation_pb";
|
|
18
|
+
import { AgentChannelSpecSchema, SlackChannelConfigSchema, WhatsAppChannelConfigSchema, type SlackChannelConfig, type WhatsAppChannelConfig } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/spec_pb";
|
|
19
|
+
import { ServiceTier, ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
20
|
+
import { RunConfigSchema, type RunConfig } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/invocation_pb";
|
|
21
21
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
22
22
|
import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
|
|
23
23
|
import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
@@ -176,6 +176,14 @@ export class AgentChannelClient {
|
|
|
176
176
|
|
|
177
177
|
/** Input for creating/updating a AgentChannel. */
|
|
178
178
|
export interface AgentChannelInput {
|
|
179
|
+
/**
|
|
180
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
181
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
182
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
183
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
184
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
185
|
+
*/
|
|
186
|
+
id?: string;
|
|
179
187
|
name: string;
|
|
180
188
|
slug?: string;
|
|
181
189
|
org: string;
|
|
@@ -206,6 +214,7 @@ export interface RunConfigInput {
|
|
|
206
214
|
maxCostUsd?: number;
|
|
207
215
|
maxToolRounds?: number;
|
|
208
216
|
serviceTier?: ServiceTier;
|
|
217
|
+
thinkingMode?: ThinkingMode;
|
|
209
218
|
}
|
|
210
219
|
|
|
211
220
|
function buildSlackChannelConfigProto(input: SlackChannelConfigInput) {
|
|
@@ -225,6 +234,7 @@ function buildRunConfigProto(input: RunConfigInput) {
|
|
|
225
234
|
maxCostUsd: input.maxCostUsd,
|
|
226
235
|
maxToolRounds: input.maxToolRounds,
|
|
227
236
|
serviceTier: input.serviceTier,
|
|
237
|
+
thinkingMode: input.thinkingMode,
|
|
228
238
|
}));
|
|
229
239
|
}
|
|
230
240
|
|
|
@@ -250,6 +260,7 @@ export function buildAgentChannelProto(input: AgentChannelInput): AgentChannel {
|
|
|
250
260
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
251
261
|
kind: "AgentChannel",
|
|
252
262
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
263
|
+
...(input.id && { id: input.id }),
|
|
253
264
|
name: input.name,
|
|
254
265
|
org: input.org,
|
|
255
266
|
...(input.slug && { slug: input.slug }),
|
|
@@ -259,3 +270,60 @@ export function buildAgentChannelProto(input: AgentChannelInput): AgentChannel {
|
|
|
259
270
|
spec,
|
|
260
271
|
}) as AgentChannel;
|
|
261
272
|
}
|
|
273
|
+
|
|
274
|
+
function toSlackChannelConfigInput(msg: SlackChannelConfig): SlackChannelConfigInput {
|
|
275
|
+
return {
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function toWhatsAppChannelConfigInput(msg: WhatsAppChannelConfig): WhatsAppChannelConfigInput {
|
|
280
|
+
return {
|
|
281
|
+
phoneNumberId: msg.phoneNumberId || undefined,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function toRunConfigInput(msg: RunConfig): RunConfigInput {
|
|
286
|
+
return {
|
|
287
|
+
modelName: msg.modelName || undefined,
|
|
288
|
+
maxCostUsd: msg.maxCostUsd || undefined,
|
|
289
|
+
maxToolRounds: msg.maxToolRounds || undefined,
|
|
290
|
+
serviceTier: msg.serviceTier || undefined,
|
|
291
|
+
thinkingMode: msg.thinkingMode || undefined,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Maps a fetched {@link AgentChannel} to a complete {@link AgentChannelInput} for `update()`.
|
|
297
|
+
*
|
|
298
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
299
|
+
* and override only the fields you edit (spread nested objects the same
|
|
300
|
+
* way):
|
|
301
|
+
*
|
|
302
|
+
* await client.update({ ...toAgentChannelUpdateInput(res), description: next });
|
|
303
|
+
*
|
|
304
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
305
|
+
* `version` (pinned refs) and `kind`.
|
|
306
|
+
*/
|
|
307
|
+
export function toAgentChannelUpdateInput(resource: AgentChannel): AgentChannelInput {
|
|
308
|
+
const meta = resource.metadata;
|
|
309
|
+
const spec = resource.spec ?? create(AgentChannelSpecSchema);
|
|
310
|
+
return {
|
|
311
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
312
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
313
|
+
// match, so the id is the ONLY working address.
|
|
314
|
+
id: meta?.id || undefined,
|
|
315
|
+
name: meta?.name ?? "",
|
|
316
|
+
slug: meta?.slug || undefined,
|
|
317
|
+
org: meta?.org ?? "",
|
|
318
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
319
|
+
visibility: meta?.visibility || undefined,
|
|
320
|
+
agentRef: toResourceRefInput(spec.agentRef) ?? { org: "", slug: "" },
|
|
321
|
+
enabled: spec.enabled || undefined,
|
|
322
|
+
slack: spec.providerConfig?.case === "slack" ? toSlackChannelConfigInput(spec.providerConfig.value) : undefined,
|
|
323
|
+
whatsapp: spec.providerConfig?.case === "whatsapp" ? toWhatsAppChannelConfigInput(spec.providerConfig.value) : undefined,
|
|
324
|
+
environmentRefs: toResourceRefInputs(spec.environmentRefs),
|
|
325
|
+
appRef: toResourceRefInput(spec.appRef),
|
|
326
|
+
proactiveMessagingEnabled: spec.proactiveMessagingEnabled || undefined,
|
|
327
|
+
runConfig: spec.runConfig ? toRunConfigInput(spec.runConfig) : undefined,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
@@ -1,21 +1,22 @@
|
|
|
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, toResourceRefInput, toResourceRefInputs, toExecVarInputMap } from "./proto-utils.js";
|
|
5
5
|
import { type ResourceRef, type EnvVarInput } from "./types.js";
|
|
6
6
|
import { create, type JsonObject } from "@bufbuild/protobuf";
|
|
7
|
+
import { timestampDate } from "@bufbuild/protobuf/wkt";
|
|
7
8
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
-
import { ToolApprovalOverrideSchema, McpServerUsageSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
|
|
9
|
+
import { ToolApprovalOverrideSchema, McpServerUsageSchema, type ToolApprovalOverride, type McpServerUsage } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
|
|
9
10
|
import { AgentExecutionSchema, type AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
10
11
|
import { AgentExecutionCommandController } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/command_pb";
|
|
11
|
-
import { InteractionMode, ApprovalMode, ServiceTier } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
12
|
+
import { InteractionMode, ApprovalMode, ServiceTier, ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
12
13
|
import { AgentExecutionIdSchema, AgentExecutionUpdateStatusInputSchema, UpdateStatusResponseSchema, SubmitApprovalInputSchema, SubmitFileDecisionInputSchema, CancelAgentExecutionInputSchema, TerminateAgentExecutionInputSchema, RecoverAgentExecutionInputSchema, PauseAgentExecutionInputSchema, ResumeAgentExecutionInputSchema, UploadAttachmentRequestSchema, UploadAttachmentResponseSchema, ListAgentExecutionsRequestSchema, AgentExecutionListSchema, ListAgentExecutionsBySessionRequestSchema, GetArtifactDownloadUrlRequestSchema, GetArtifactDownloadUrlResponseSchema, GetArtifactContentRequestSchema, GetArtifactContentResponseSchema, GetExecutionUsageReportInputSchema, GetExecutionUsageReportOutputSchema, GetSessionUsageReportInputSchema, GetSessionUsageReportOutputSchema, GetAgentUsageReportInputSchema, GetAgentUsageReportOutputSchema, GetOrgUsageReportInputSchema, GetOrgUsageReportOutputSchema, GetAgentExecutionSummaryRequestSchema, AgentExecutionSummarySchema, type AgentExecutionUpdateStatusInput, type UpdateStatusResponse, type SubmitApprovalInput, type SubmitFileDecisionInput, type CancelAgentExecutionInput, type TerminateAgentExecutionInput, type RecoverAgentExecutionInput, type PauseAgentExecutionInput, type ResumeAgentExecutionInput, type UploadAttachmentRequest, type UploadAttachmentResponse, type ListAgentExecutionsRequest, type AgentExecutionList, type ListAgentExecutionsBySessionRequest, type GetArtifactDownloadUrlRequest, type GetArtifactDownloadUrlResponse, type GetArtifactContentRequest, type GetArtifactContentResponse, type GetExecutionUsageReportInput, type GetExecutionUsageReportOutput, type GetSessionUsageReportInput, type GetSessionUsageReportOutput, type GetAgentUsageReportInput, type GetAgentUsageReportOutput, type GetOrgUsageReportInput, type GetOrgUsageReportOutput, type GetAgentExecutionSummaryRequest, type AgentExecutionSummary } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/io_pb";
|
|
13
14
|
import { AgentExecutionQueryController } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/query_pb";
|
|
14
|
-
import { AgentExecutionSpecSchema, ContextManagementConfigSchema, ExecutionConfigSchema, AttachmentSchema, ConversationCatchupSchema, DeclaredPreferencesSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
|
|
15
|
+
import { AgentExecutionSpecSchema, ContextManagementConfigSchema, ExecutionConfigSchema, AttachmentSchema, ConversationCatchupSchema, DeclaredPreferencesSchema, type ContextManagementConfig, type ExecutionConfig, type Attachment, type ConversationCatchup, type DeclaredPreferences } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
|
|
15
16
|
import { ExecutionValueSchema } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
|
|
16
17
|
import { Harness, CursorMode, ExecutionTarget, GitWriteBackMode } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
|
|
17
|
-
import { SessionSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/spec_pb";
|
|
18
|
-
import { GitRepoSourceSchema, LocalPathSourceSchema, WorkspaceSourceSchema, WorkspaceEntrySchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
|
|
18
|
+
import { SessionSpecSchema, type SessionSpec } from "@stigmer/protos/ai/stigmer/agentic/session/v1/spec_pb";
|
|
19
|
+
import { GitRepoSourceSchema, LocalPathSourceSchema, WorkspaceSourceSchema, WorkspaceEntrySchema, type GitRepoSource, type LocalPathSource, type WorkspaceSource, type WorkspaceEntry } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
|
|
19
20
|
import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
|
|
20
21
|
import { ApiResourceIdSchema, ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
21
22
|
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
@@ -173,6 +174,14 @@ export class AgentExecutionClient {
|
|
|
173
174
|
|
|
174
175
|
/** Input for creating/updating a AgentExecution. */
|
|
175
176
|
export interface AgentExecutionInput {
|
|
177
|
+
/**
|
|
178
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
179
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
180
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
181
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
182
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
183
|
+
*/
|
|
184
|
+
id?: string;
|
|
176
185
|
name: string;
|
|
177
186
|
slug?: string;
|
|
178
187
|
org: string;
|
|
@@ -262,6 +271,7 @@ export interface ExecutionConfigInput {
|
|
|
262
271
|
buildFromPlan?: boolean;
|
|
263
272
|
approvalMode?: ApprovalMode;
|
|
264
273
|
serviceTier?: ServiceTier;
|
|
274
|
+
thinkingMode?: ThinkingMode;
|
|
265
275
|
}
|
|
266
276
|
|
|
267
277
|
/** SDK input type for ContextManagementConfig. */
|
|
@@ -378,6 +388,7 @@ function buildExecutionConfigProto(input: ExecutionConfigInput) {
|
|
|
378
388
|
if (input.buildFromPlan !== undefined) msg.buildFromPlan = input.buildFromPlan;
|
|
379
389
|
if (input.approvalMode !== undefined) msg.approvalMode = input.approvalMode;
|
|
380
390
|
if (input.serviceTier !== undefined) msg.serviceTier = input.serviceTier;
|
|
391
|
+
if (input.thinkingMode !== undefined) msg.thinkingMode = input.thinkingMode;
|
|
381
392
|
return msg;
|
|
382
393
|
}
|
|
383
394
|
|
|
@@ -421,6 +432,7 @@ export function buildAgentExecutionProto(input: AgentExecutionInput): AgentExecu
|
|
|
421
432
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
422
433
|
kind: "AgentExecution",
|
|
423
434
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
435
|
+
...(input.id && { id: input.id }),
|
|
424
436
|
name: input.name,
|
|
425
437
|
org: input.org,
|
|
426
438
|
...(input.slug && { slug: input.slug }),
|
|
@@ -446,3 +458,157 @@ export function buildAgentExecutionProto(input: AgentExecutionInput): AgentExecu
|
|
|
446
458
|
})),
|
|
447
459
|
}) as AgentExecution;
|
|
448
460
|
}
|
|
461
|
+
|
|
462
|
+
function toGitRepoSourceInput(msg: GitRepoSource): GitRepoSourceInput {
|
|
463
|
+
return {
|
|
464
|
+
url: msg.url ?? "",
|
|
465
|
+
branch: msg.branch || undefined,
|
|
466
|
+
commit: msg.commit || undefined,
|
|
467
|
+
depth: msg.depth || undefined,
|
|
468
|
+
writeBackMode: msg.writeBackMode || undefined,
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
function toLocalPathSourceInput(msg: LocalPathSource): LocalPathSourceInput {
|
|
473
|
+
return {
|
|
474
|
+
path: msg.path || undefined,
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function toWorkspaceSourceInput(msg: WorkspaceSource): WorkspaceSourceInput {
|
|
479
|
+
return {
|
|
480
|
+
gitRepo: msg.source?.case === "gitRepo" ? toGitRepoSourceInput(msg.source.value) : undefined,
|
|
481
|
+
localPath: msg.source?.case === "localPath" ? toLocalPathSourceInput(msg.source.value) : undefined,
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
function toWorkspaceEntryInput(msg: WorkspaceEntry): WorkspaceEntryInput {
|
|
486
|
+
return {
|
|
487
|
+
name: msg.name || undefined,
|
|
488
|
+
source: toWorkspaceSourceInput(msg.source ?? create(WorkspaceSourceSchema)),
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
function toToolApprovalOverrideInput(msg: ToolApprovalOverride): ToolApprovalOverrideInput {
|
|
493
|
+
return {
|
|
494
|
+
toolName: msg.toolName || undefined,
|
|
495
|
+
requiresApproval: msg.requiresApproval || undefined,
|
|
496
|
+
message: msg.message || undefined,
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function toMcpServerUsageInput(msg: McpServerUsage): McpServerUsageInput {
|
|
501
|
+
return {
|
|
502
|
+
mcpServerRef: toResourceRefInput(msg.mcpServerRef) ?? { org: "", slug: "" },
|
|
503
|
+
enabledTools: msg.enabledTools?.length ? [...msg.enabledTools] : undefined,
|
|
504
|
+
toolApprovalOverrides: msg.toolApprovalOverrides?.length ? msg.toolApprovalOverrides.map(toToolApprovalOverrideInput) : undefined,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function toSessionSpecInput(msg: SessionSpec): SessionSpecInput {
|
|
509
|
+
return {
|
|
510
|
+
agentInstanceId: msg.agentInstanceId || undefined,
|
|
511
|
+
subject: msg.subject || undefined,
|
|
512
|
+
harnessStateId: msg.harnessStateId || undefined,
|
|
513
|
+
harnessStateIdHistory: msg.harnessStateIdHistory?.length ? [...msg.harnessStateIdHistory] : undefined,
|
|
514
|
+
metadata: Object.keys(msg.metadata ?? {}).length > 0 ? { ...msg.metadata } : undefined,
|
|
515
|
+
workspaceEntries: msg.workspaceEntries?.length ? msg.workspaceEntries.map(toWorkspaceEntryInput) : undefined,
|
|
516
|
+
mcpServerUsages: msg.mcpServerUsages?.length ? msg.mcpServerUsages.map(toMcpServerUsageInput) : undefined,
|
|
517
|
+
skillRefs: toResourceRefInputs(msg.skillRefs),
|
|
518
|
+
harness: msg.harness || undefined,
|
|
519
|
+
cursorMode: msg.cursorMode || undefined,
|
|
520
|
+
executionTarget: msg.executionTarget || undefined,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
function toContextManagementConfigInput(msg: ContextManagementConfig): ContextManagementConfigInput {
|
|
525
|
+
return {
|
|
526
|
+
disableSummarization: msg.disableSummarization || undefined,
|
|
527
|
+
customTriggerThreshold: msg.customTriggerThreshold || undefined,
|
|
528
|
+
customTargetTokens: msg.customTargetTokens || undefined,
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
function toExecutionConfigInput(msg: ExecutionConfig): ExecutionConfigInput {
|
|
533
|
+
return {
|
|
534
|
+
modelName: msg.modelName || undefined,
|
|
535
|
+
contextManagement: msg.contextManagement ? toContextManagementConfigInput(msg.contextManagement) : undefined,
|
|
536
|
+
maxToolRounds: msg.maxToolRounds || undefined,
|
|
537
|
+
maxToolResultChars: msg.maxToolResultChars || undefined,
|
|
538
|
+
maxCostUsd: msg.maxCostUsd || undefined,
|
|
539
|
+
interactionMode: msg.interactionMode || undefined,
|
|
540
|
+
structuredOutputSchema: msg.structuredOutputSchema,
|
|
541
|
+
buildFromPlan: msg.buildFromPlan || undefined,
|
|
542
|
+
approvalMode: msg.approvalMode || undefined,
|
|
543
|
+
serviceTier: msg.serviceTier || undefined,
|
|
544
|
+
thinkingMode: msg.thinkingMode || undefined,
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function toAttachmentInput(msg: Attachment): AttachmentInput {
|
|
549
|
+
return {
|
|
550
|
+
filename: msg.filename || undefined,
|
|
551
|
+
storageKey: msg.storageKey || undefined,
|
|
552
|
+
mountPath: msg.mountPath || undefined,
|
|
553
|
+
contentType: msg.contentType || undefined,
|
|
554
|
+
extract: msg.extract || undefined,
|
|
555
|
+
localPath: msg.localPath || undefined,
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
function toConversationCatchupInput(msg: ConversationCatchup): ConversationCatchupInput {
|
|
560
|
+
return {
|
|
561
|
+
digest: msg.digest || undefined,
|
|
562
|
+
windowEnd: msg.windowEnd ? timestampDate(msg.windowEnd) : undefined,
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function toDeclaredPreferencesInput(msg: DeclaredPreferences): DeclaredPreferencesInput {
|
|
567
|
+
return {
|
|
568
|
+
orgContext: msg.orgContext || undefined,
|
|
569
|
+
userContext: msg.userContext || undefined,
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Maps a fetched {@link AgentExecution} to a complete {@link AgentExecutionInput} for `update()`.
|
|
575
|
+
*
|
|
576
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
577
|
+
* and override only the fields you edit (spread nested objects the same
|
|
578
|
+
* way):
|
|
579
|
+
*
|
|
580
|
+
* await client.update({ ...toAgentExecutionUpdateInput(res), description: next });
|
|
581
|
+
*
|
|
582
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
583
|
+
* `version` (pinned refs) and `kind`.
|
|
584
|
+
*/
|
|
585
|
+
export function toAgentExecutionUpdateInput(resource: AgentExecution): AgentExecutionInput {
|
|
586
|
+
const meta = resource.metadata;
|
|
587
|
+
const spec = resource.spec ?? create(AgentExecutionSpecSchema);
|
|
588
|
+
return {
|
|
589
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
590
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
591
|
+
// match, so the id is the ONLY working address.
|
|
592
|
+
id: meta?.id || undefined,
|
|
593
|
+
name: meta?.name ?? "",
|
|
594
|
+
slug: meta?.slug || undefined,
|
|
595
|
+
org: meta?.org ?? "",
|
|
596
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
597
|
+
visibility: meta?.visibility || undefined,
|
|
598
|
+
sessionId: spec.sessionId || undefined,
|
|
599
|
+
agentId: spec.agentId || undefined,
|
|
600
|
+
sessionSpec: spec.sessionSpec ? toSessionSpecInput(spec.sessionSpec) : undefined,
|
|
601
|
+
message: spec.message || undefined,
|
|
602
|
+
executionConfig: spec.executionConfig ? toExecutionConfigInput(spec.executionConfig) : undefined,
|
|
603
|
+
runtimeEnv: toExecVarInputMap(spec.runtimeEnv),
|
|
604
|
+
callbackToken: spec.callbackToken?.length ? spec.callbackToken : undefined,
|
|
605
|
+
autoApproveAll: spec.autoApproveAll || undefined,
|
|
606
|
+
parentWorkflowId: spec.parentWorkflowId || undefined,
|
|
607
|
+
attachments: spec.attachments?.length ? spec.attachments.map(toAttachmentInput) : undefined,
|
|
608
|
+
workspaceFileRefs: spec.workspaceFileRefs?.length ? [...spec.workspaceFileRefs] : undefined,
|
|
609
|
+
activityTaskQueue: spec.activityTaskQueue || undefined,
|
|
610
|
+
supersedesExecutionId: spec.supersedesExecutionId || undefined,
|
|
611
|
+
conversationCatchup: spec.conversationCatchup ? toConversationCatchupInput(spec.conversationCatchup) : undefined,
|
|
612
|
+
declaredPreferences: spec.declaredPreferences ? toDeclaredPreferencesInput(spec.declaredPreferences) : undefined,
|
|
613
|
+
};
|
|
614
|
+
}
|
package/src/gen/agentinstance.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";
|
|
@@ -82,6 +82,14 @@ export class AgentInstanceClient {
|
|
|
82
82
|
|
|
83
83
|
/** Input for creating/updating a AgentInstance. */
|
|
84
84
|
export interface AgentInstanceInput {
|
|
85
|
+
/**
|
|
86
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
87
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
88
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
89
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
90
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
91
|
+
*/
|
|
92
|
+
id?: string;
|
|
85
93
|
name: string;
|
|
86
94
|
slug?: string;
|
|
87
95
|
org: string;
|
|
@@ -98,6 +106,7 @@ export function buildAgentInstanceProto(input: AgentInstanceInput): AgentInstanc
|
|
|
98
106
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
99
107
|
kind: "AgentInstance",
|
|
100
108
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
109
|
+
...(input.id && { id: input.id }),
|
|
101
110
|
name: input.name,
|
|
102
111
|
org: input.org,
|
|
103
112
|
...(input.slug && { slug: input.slug }),
|
|
@@ -111,3 +120,34 @@ export function buildAgentInstanceProto(input: AgentInstanceInput): AgentInstanc
|
|
|
111
120
|
})),
|
|
112
121
|
}) as AgentInstance;
|
|
113
122
|
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Maps a fetched {@link AgentInstance} to a complete {@link AgentInstanceInput} for `update()`.
|
|
126
|
+
*
|
|
127
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
128
|
+
* and override only the fields you edit (spread nested objects the same
|
|
129
|
+
* way):
|
|
130
|
+
*
|
|
131
|
+
* await client.update({ ...toAgentInstanceUpdateInput(res), description: next });
|
|
132
|
+
*
|
|
133
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
134
|
+
* `version` (pinned refs) and `kind`.
|
|
135
|
+
*/
|
|
136
|
+
export function toAgentInstanceUpdateInput(resource: AgentInstance): AgentInstanceInput {
|
|
137
|
+
const meta = resource.metadata;
|
|
138
|
+
const spec = resource.spec ?? create(AgentInstanceSpecSchema);
|
|
139
|
+
return {
|
|
140
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
141
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
142
|
+
// match, so the id is the ONLY working address.
|
|
143
|
+
id: meta?.id || undefined,
|
|
144
|
+
name: meta?.name ?? "",
|
|
145
|
+
slug: meta?.slug || undefined,
|
|
146
|
+
org: meta?.org ?? "",
|
|
147
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
148
|
+
visibility: meta?.visibility || undefined,
|
|
149
|
+
agentId: spec.agentId || undefined,
|
|
150
|
+
description: spec.description || undefined,
|
|
151
|
+
environmentRefs: toResourceRefInputs(spec.environmentRefs),
|
|
152
|
+
};
|
|
153
|
+
}
|