@stigmer/sdk 3.12.5 → 3.12.7
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 +795 -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/execution/__tests__/transcript.test.d.ts +2 -0
- package/execution/__tests__/transcript.test.d.ts.map +1 -0
- package/execution/__tests__/transcript.test.js +527 -0
- package/execution/__tests__/transcript.test.js.map +1 -0
- package/execution/conversation-rules.d.ts +64 -0
- package/execution/conversation-rules.d.ts.map +1 -0
- package/execution/conversation-rules.js +113 -0
- package/execution/conversation-rules.js.map +1 -0
- package/execution/transcript.d.ts +171 -0
- package/execution/transcript.d.ts.map +1 -0
- package/execution/transcript.js +484 -0
- package/execution/transcript.js.map +1 -0
- 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 +34 -1
- package/gen/agentexecution.d.ts.map +1 -1
- package/gen/agentexecution.js +176 -2
- 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/client.d.ts +5 -1
- package/gen/client.d.ts.map +1 -1
- package/gen/client.js +4 -0
- package/gen/client.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 +22 -0
- package/gen/identityaccount.d.ts.map +1 -1
- package/gen/identityaccount.js +48 -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/memory.d.ts +58 -0
- package/gen/memory.d.ts.map +1 -0
- package/gen/memory.js +143 -0
- package/gen/memory.js.map +1 -0
- 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 +22 -0
- package/gen/organization.d.ts.map +1 -1
- package/gen/organization.js +43 -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 +23 -21
- package/index.d.ts.map +1 -1
- package/index.js +27 -23
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/update-input-roundtrip.test.ts +1035 -0
- package/src/__tests__/update-input.test.ts +34 -3
- package/src/execution/__tests__/transcript.golden.md +100 -0
- package/src/execution/__tests__/transcript.test.ts +627 -0
- package/src/execution/conversation-rules.ts +119 -0
- package/src/execution/transcript.ts +735 -0
- package/src/gen/agent.ts +89 -3
- package/src/gen/agentchannel.ts +72 -4
- package/src/gen/agentexecution.ts +216 -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/client.ts +6 -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 +60 -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/memory.ts +164 -0
- package/src/gen/oauthapp.ts +48 -0
- package/src/gen/organization.ts +55 -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 +52 -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/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, RecalledMemoryFactSchema, RecalledMemoriesSchema, type ContextManagementConfig, type ExecutionConfig, type Attachment, type ConversationCatchup, type DeclaredPreferences, type RecalledMemoryFact, type RecalledMemories } 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;
|
|
@@ -193,6 +202,7 @@ export interface AgentExecutionInput {
|
|
|
193
202
|
supersedesExecutionId?: string;
|
|
194
203
|
conversationCatchup?: ConversationCatchupInput;
|
|
195
204
|
declaredPreferences?: DeclaredPreferencesInput;
|
|
205
|
+
recalledMemories?: RecalledMemoriesInput;
|
|
196
206
|
}
|
|
197
207
|
|
|
198
208
|
/** SDK input type for SessionSpec. */
|
|
@@ -262,6 +272,7 @@ export interface ExecutionConfigInput {
|
|
|
262
272
|
buildFromPlan?: boolean;
|
|
263
273
|
approvalMode?: ApprovalMode;
|
|
264
274
|
serviceTier?: ServiceTier;
|
|
275
|
+
thinkingMode?: ThinkingMode;
|
|
265
276
|
}
|
|
266
277
|
|
|
267
278
|
/** SDK input type for ContextManagementConfig. */
|
|
@@ -293,6 +304,18 @@ export interface DeclaredPreferencesInput {
|
|
|
293
304
|
userContext?: string;
|
|
294
305
|
}
|
|
295
306
|
|
|
307
|
+
/** SDK input type for RecalledMemories. */
|
|
308
|
+
export interface RecalledMemoriesInput {
|
|
309
|
+
enabled?: boolean;
|
|
310
|
+
facts?: RecalledMemoryFactInput[];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** SDK input type for RecalledMemoryFact. */
|
|
314
|
+
export interface RecalledMemoryFactInput {
|
|
315
|
+
memoryId?: string;
|
|
316
|
+
content?: string;
|
|
317
|
+
}
|
|
318
|
+
|
|
296
319
|
function buildGitRepoSourceProto(input: GitRepoSourceInput) {
|
|
297
320
|
return Object.assign(create(GitRepoSourceSchema), stripUndefined({
|
|
298
321
|
url: input.url,
|
|
@@ -378,6 +401,7 @@ function buildExecutionConfigProto(input: ExecutionConfigInput) {
|
|
|
378
401
|
if (input.buildFromPlan !== undefined) msg.buildFromPlan = input.buildFromPlan;
|
|
379
402
|
if (input.approvalMode !== undefined) msg.approvalMode = input.approvalMode;
|
|
380
403
|
if (input.serviceTier !== undefined) msg.serviceTier = input.serviceTier;
|
|
404
|
+
if (input.thinkingMode !== undefined) msg.thinkingMode = input.thinkingMode;
|
|
381
405
|
return msg;
|
|
382
406
|
}
|
|
383
407
|
|
|
@@ -406,6 +430,20 @@ function buildDeclaredPreferencesProto(input: DeclaredPreferencesInput) {
|
|
|
406
430
|
}));
|
|
407
431
|
}
|
|
408
432
|
|
|
433
|
+
function buildRecalledMemoryFactProto(input: RecalledMemoryFactInput) {
|
|
434
|
+
return Object.assign(create(RecalledMemoryFactSchema), stripUndefined({
|
|
435
|
+
memoryId: input.memoryId,
|
|
436
|
+
content: input.content,
|
|
437
|
+
}));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function buildRecalledMemoriesProto(input: RecalledMemoriesInput) {
|
|
441
|
+
const msg = create(RecalledMemoriesSchema);
|
|
442
|
+
if (input.enabled !== undefined) msg.enabled = input.enabled;
|
|
443
|
+
if (input.facts) msg.facts = input.facts.map(buildRecalledMemoryFactProto);
|
|
444
|
+
return msg;
|
|
445
|
+
}
|
|
446
|
+
|
|
409
447
|
export function buildAgentExecutionProto(input: AgentExecutionInput): AgentExecution {
|
|
410
448
|
const sessionSpec = input.sessionSpec ? buildSessionSpecProto(input.sessionSpec) : undefined;
|
|
411
449
|
const executionConfig = input.executionConfig ? buildExecutionConfigProto(input.executionConfig) : undefined;
|
|
@@ -417,10 +455,12 @@ export function buildAgentExecutionProto(input: AgentExecutionInput): AgentExecu
|
|
|
417
455
|
const attachments = input.attachments?.map(buildAttachmentProto);
|
|
418
456
|
const conversationCatchup = input.conversationCatchup ? buildConversationCatchupProto(input.conversationCatchup) : undefined;
|
|
419
457
|
const declaredPreferences = input.declaredPreferences ? buildDeclaredPreferencesProto(input.declaredPreferences) : undefined;
|
|
458
|
+
const recalledMemories = input.recalledMemories ? buildRecalledMemoriesProto(input.recalledMemories) : undefined;
|
|
420
459
|
return Object.assign(create(AgentExecutionSchema), {
|
|
421
460
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
422
461
|
kind: "AgentExecution",
|
|
423
462
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
463
|
+
...(input.id && { id: input.id }),
|
|
424
464
|
name: input.name,
|
|
425
465
|
org: input.org,
|
|
426
466
|
...(input.slug && { slug: input.slug }),
|
|
@@ -443,6 +483,176 @@ export function buildAgentExecutionProto(input: AgentExecutionInput): AgentExecu
|
|
|
443
483
|
supersedesExecutionId: input.supersedesExecutionId,
|
|
444
484
|
conversationCatchup,
|
|
445
485
|
declaredPreferences,
|
|
486
|
+
recalledMemories,
|
|
446
487
|
})),
|
|
447
488
|
}) as AgentExecution;
|
|
448
489
|
}
|
|
490
|
+
|
|
491
|
+
function toGitRepoSourceInput(msg: GitRepoSource): GitRepoSourceInput {
|
|
492
|
+
return {
|
|
493
|
+
url: msg.url ?? "",
|
|
494
|
+
branch: msg.branch || undefined,
|
|
495
|
+
commit: msg.commit || undefined,
|
|
496
|
+
depth: msg.depth || undefined,
|
|
497
|
+
writeBackMode: msg.writeBackMode || undefined,
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
function toLocalPathSourceInput(msg: LocalPathSource): LocalPathSourceInput {
|
|
502
|
+
return {
|
|
503
|
+
path: msg.path || undefined,
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
function toWorkspaceSourceInput(msg: WorkspaceSource): WorkspaceSourceInput {
|
|
508
|
+
return {
|
|
509
|
+
gitRepo: msg.source?.case === "gitRepo" ? toGitRepoSourceInput(msg.source.value) : undefined,
|
|
510
|
+
localPath: msg.source?.case === "localPath" ? toLocalPathSourceInput(msg.source.value) : undefined,
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function toWorkspaceEntryInput(msg: WorkspaceEntry): WorkspaceEntryInput {
|
|
515
|
+
return {
|
|
516
|
+
name: msg.name || undefined,
|
|
517
|
+
source: toWorkspaceSourceInput(msg.source ?? create(WorkspaceSourceSchema)),
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function toToolApprovalOverrideInput(msg: ToolApprovalOverride): ToolApprovalOverrideInput {
|
|
522
|
+
return {
|
|
523
|
+
toolName: msg.toolName || undefined,
|
|
524
|
+
requiresApproval: msg.requiresApproval || undefined,
|
|
525
|
+
message: msg.message || undefined,
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
function toMcpServerUsageInput(msg: McpServerUsage): McpServerUsageInput {
|
|
530
|
+
return {
|
|
531
|
+
mcpServerRef: toResourceRefInput(msg.mcpServerRef) ?? { org: "", slug: "" },
|
|
532
|
+
enabledTools: msg.enabledTools?.length ? [...msg.enabledTools] : undefined,
|
|
533
|
+
toolApprovalOverrides: msg.toolApprovalOverrides?.length ? msg.toolApprovalOverrides.map(toToolApprovalOverrideInput) : undefined,
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function toSessionSpecInput(msg: SessionSpec): SessionSpecInput {
|
|
538
|
+
return {
|
|
539
|
+
agentInstanceId: msg.agentInstanceId || undefined,
|
|
540
|
+
subject: msg.subject || undefined,
|
|
541
|
+
harnessStateId: msg.harnessStateId || undefined,
|
|
542
|
+
harnessStateIdHistory: msg.harnessStateIdHistory?.length ? [...msg.harnessStateIdHistory] : undefined,
|
|
543
|
+
metadata: Object.keys(msg.metadata ?? {}).length > 0 ? { ...msg.metadata } : undefined,
|
|
544
|
+
workspaceEntries: msg.workspaceEntries?.length ? msg.workspaceEntries.map(toWorkspaceEntryInput) : undefined,
|
|
545
|
+
mcpServerUsages: msg.mcpServerUsages?.length ? msg.mcpServerUsages.map(toMcpServerUsageInput) : undefined,
|
|
546
|
+
skillRefs: toResourceRefInputs(msg.skillRefs),
|
|
547
|
+
harness: msg.harness || undefined,
|
|
548
|
+
cursorMode: msg.cursorMode || undefined,
|
|
549
|
+
executionTarget: msg.executionTarget || undefined,
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function toContextManagementConfigInput(msg: ContextManagementConfig): ContextManagementConfigInput {
|
|
554
|
+
return {
|
|
555
|
+
disableSummarization: msg.disableSummarization || undefined,
|
|
556
|
+
customTriggerThreshold: msg.customTriggerThreshold || undefined,
|
|
557
|
+
customTargetTokens: msg.customTargetTokens || undefined,
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function toExecutionConfigInput(msg: ExecutionConfig): ExecutionConfigInput {
|
|
562
|
+
return {
|
|
563
|
+
modelName: msg.modelName || undefined,
|
|
564
|
+
contextManagement: msg.contextManagement ? toContextManagementConfigInput(msg.contextManagement) : undefined,
|
|
565
|
+
maxToolRounds: msg.maxToolRounds || undefined,
|
|
566
|
+
maxToolResultChars: msg.maxToolResultChars || undefined,
|
|
567
|
+
maxCostUsd: msg.maxCostUsd || undefined,
|
|
568
|
+
interactionMode: msg.interactionMode || undefined,
|
|
569
|
+
structuredOutputSchema: msg.structuredOutputSchema,
|
|
570
|
+
buildFromPlan: msg.buildFromPlan || undefined,
|
|
571
|
+
approvalMode: msg.approvalMode || undefined,
|
|
572
|
+
serviceTier: msg.serviceTier || undefined,
|
|
573
|
+
thinkingMode: msg.thinkingMode || undefined,
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function toAttachmentInput(msg: Attachment): AttachmentInput {
|
|
578
|
+
return {
|
|
579
|
+
filename: msg.filename || undefined,
|
|
580
|
+
storageKey: msg.storageKey || undefined,
|
|
581
|
+
mountPath: msg.mountPath || undefined,
|
|
582
|
+
contentType: msg.contentType || undefined,
|
|
583
|
+
extract: msg.extract || undefined,
|
|
584
|
+
localPath: msg.localPath || undefined,
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function toConversationCatchupInput(msg: ConversationCatchup): ConversationCatchupInput {
|
|
589
|
+
return {
|
|
590
|
+
digest: msg.digest || undefined,
|
|
591
|
+
windowEnd: msg.windowEnd ? timestampDate(msg.windowEnd) : undefined,
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function toDeclaredPreferencesInput(msg: DeclaredPreferences): DeclaredPreferencesInput {
|
|
596
|
+
return {
|
|
597
|
+
orgContext: msg.orgContext || undefined,
|
|
598
|
+
userContext: msg.userContext || undefined,
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function toRecalledMemoryFactInput(msg: RecalledMemoryFact): RecalledMemoryFactInput {
|
|
603
|
+
return {
|
|
604
|
+
memoryId: msg.memoryId || undefined,
|
|
605
|
+
content: msg.content || undefined,
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function toRecalledMemoriesInput(msg: RecalledMemories): RecalledMemoriesInput {
|
|
610
|
+
return {
|
|
611
|
+
enabled: msg.enabled || undefined,
|
|
612
|
+
facts: msg.facts?.length ? msg.facts.map(toRecalledMemoryFactInput) : undefined,
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Maps a fetched {@link AgentExecution} to a complete {@link AgentExecutionInput} for `update()`.
|
|
618
|
+
*
|
|
619
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
620
|
+
* and override only the fields you edit (spread nested objects the same
|
|
621
|
+
* way):
|
|
622
|
+
*
|
|
623
|
+
* await client.update({ ...toAgentExecutionUpdateInput(res), description: next });
|
|
624
|
+
*
|
|
625
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
626
|
+
* `version` (pinned refs) and `kind`.
|
|
627
|
+
*/
|
|
628
|
+
export function toAgentExecutionUpdateInput(resource: AgentExecution): AgentExecutionInput {
|
|
629
|
+
const meta = resource.metadata;
|
|
630
|
+
const spec = resource.spec ?? create(AgentExecutionSpecSchema);
|
|
631
|
+
return {
|
|
632
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
633
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
634
|
+
// match, so the id is the ONLY working address.
|
|
635
|
+
id: meta?.id || undefined,
|
|
636
|
+
name: meta?.name ?? "",
|
|
637
|
+
slug: meta?.slug || undefined,
|
|
638
|
+
org: meta?.org ?? "",
|
|
639
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
640
|
+
visibility: meta?.visibility || undefined,
|
|
641
|
+
sessionId: spec.sessionId || undefined,
|
|
642
|
+
agentId: spec.agentId || undefined,
|
|
643
|
+
sessionSpec: spec.sessionSpec ? toSessionSpecInput(spec.sessionSpec) : undefined,
|
|
644
|
+
message: spec.message || undefined,
|
|
645
|
+
executionConfig: spec.executionConfig ? toExecutionConfigInput(spec.executionConfig) : undefined,
|
|
646
|
+
runtimeEnv: toExecVarInputMap(spec.runtimeEnv),
|
|
647
|
+
callbackToken: spec.callbackToken?.length ? spec.callbackToken : undefined,
|
|
648
|
+
autoApproveAll: spec.autoApproveAll || undefined,
|
|
649
|
+
parentWorkflowId: spec.parentWorkflowId || undefined,
|
|
650
|
+
attachments: spec.attachments?.length ? spec.attachments.map(toAttachmentInput) : undefined,
|
|
651
|
+
workspaceFileRefs: spec.workspaceFileRefs?.length ? [...spec.workspaceFileRefs] : undefined,
|
|
652
|
+
activityTaskQueue: spec.activityTaskQueue || undefined,
|
|
653
|
+
supersedesExecutionId: spec.supersedesExecutionId || undefined,
|
|
654
|
+
conversationCatchup: spec.conversationCatchup ? toConversationCatchupInput(spec.conversationCatchup) : undefined,
|
|
655
|
+
declaredPreferences: spec.declaredPreferences ? toDeclaredPreferencesInput(spec.declaredPreferences) : undefined,
|
|
656
|
+
recalledMemories: spec.recalledMemories ? toRecalledMemoriesInput(spec.recalledMemories) : undefined,
|
|
657
|
+
};
|
|
658
|
+
}
|
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
|
+
}
|