@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.
Files changed (149) hide show
  1. package/__tests__/update-input-roundtrip.test.d.ts +2 -0
  2. package/__tests__/update-input-roundtrip.test.d.ts.map +1 -0
  3. package/__tests__/update-input-roundtrip.test.js +791 -0
  4. package/__tests__/update-input-roundtrip.test.js.map +1 -0
  5. package/__tests__/update-input.test.js +22 -3
  6. package/__tests__/update-input.test.js.map +1 -1
  7. package/gen/agent.d.ts +21 -0
  8. package/gen/agent.d.ts.map +1 -1
  9. package/gen/agent.js +73 -1
  10. package/gen/agent.js.map +1 -1
  11. package/gen/agentchannel.d.ts +23 -1
  12. package/gen/agentchannel.d.ts.map +1 -1
  13. package/gen/agentchannel.js +55 -1
  14. package/gen/agentchannel.js.map +1 -1
  15. package/gen/agentexecution.d.ts +23 -1
  16. package/gen/agentexecution.d.ts.map +1 -1
  17. package/gen/agentexecution.js +146 -1
  18. package/gen/agentexecution.js.map +1 -1
  19. package/gen/agentinstance.d.ts +21 -0
  20. package/gen/agentinstance.d.ts.map +1 -1
  21. package/gen/agentinstance.js +32 -1
  22. package/gen/agentinstance.js.map +1 -1
  23. package/gen/agentshare.d.ts +23 -1
  24. package/gen/agentshare.d.ts.map +1 -1
  25. package/gen/agentshare.js +53 -1
  26. package/gen/agentshare.js.map +1 -1
  27. package/gen/apikey.d.ts +21 -0
  28. package/gen/apikey.d.ts.map +1 -1
  29. package/gen/apikey.js +33 -1
  30. package/gen/apikey.js.map +1 -1
  31. package/gen/artifact.d.ts +8 -0
  32. package/gen/artifact.d.ts.map +1 -1
  33. package/gen/artifact.js +1 -0
  34. package/gen/artifact.js.map +1 -1
  35. package/gen/channelapp.d.ts +21 -0
  36. package/gen/channelapp.d.ts.map +1 -1
  37. package/gen/channelapp.js +45 -0
  38. package/gen/channelapp.js.map +1 -1
  39. package/gen/environment.d.ts +21 -0
  40. package/gen/environment.d.ts.map +1 -1
  41. package/gen/environment.js +31 -1
  42. package/gen/environment.js.map +1 -1
  43. package/gen/executioncontext.d.ts +8 -0
  44. package/gen/executioncontext.d.ts.map +1 -1
  45. package/gen/executioncontext.js +1 -0
  46. package/gen/executioncontext.js.map +1 -1
  47. package/gen/iampolicy.d.ts +8 -0
  48. package/gen/iampolicy.d.ts.map +1 -1
  49. package/gen/iampolicy.js +1 -0
  50. package/gen/iampolicy.js.map +1 -1
  51. package/gen/identityaccount.d.ts +21 -0
  52. package/gen/identityaccount.d.ts.map +1 -1
  53. package/gen/identityaccount.js +46 -1
  54. package/gen/identityaccount.js.map +1 -1
  55. package/gen/identityprovider.d.ts +21 -0
  56. package/gen/identityprovider.d.ts.map +1 -1
  57. package/gen/identityprovider.js +40 -0
  58. package/gen/identityprovider.js.map +1 -1
  59. package/gen/invitation.d.ts +8 -0
  60. package/gen/invitation.d.ts.map +1 -1
  61. package/gen/invitation.js +1 -0
  62. package/gen/invitation.js.map +1 -1
  63. package/gen/mcpserver.d.ts +21 -0
  64. package/gen/mcpserver.d.ts.map +1 -1
  65. package/gen/mcpserver.js +79 -1
  66. package/gen/mcpserver.js.map +1 -1
  67. package/gen/oauthapp.d.ts +21 -0
  68. package/gen/oauthapp.d.ts.map +1 -1
  69. package/gen/oauthapp.js +39 -0
  70. package/gen/oauthapp.js.map +1 -1
  71. package/gen/organization.d.ts +21 -0
  72. package/gen/organization.d.ts.map +1 -1
  73. package/gen/organization.js +41 -1
  74. package/gen/organization.js.map +1 -1
  75. package/gen/platformclient.d.ts +21 -0
  76. package/gen/platformclient.d.ts.map +1 -1
  77. package/gen/platformclient.js +40 -1
  78. package/gen/platformclient.js.map +1 -1
  79. package/gen/project.d.ts +21 -0
  80. package/gen/project.d.ts.map +1 -1
  81. package/gen/project.js +32 -1
  82. package/gen/project.js.map +1 -1
  83. package/gen/proto-utils.d.ts +36 -0
  84. package/gen/proto-utils.d.ts.map +1 -1
  85. package/gen/proto-utils.js +58 -0
  86. package/gen/proto-utils.js.map +1 -1
  87. package/gen/schedule.d.ts +23 -1
  88. package/gen/schedule.d.ts.map +1 -1
  89. package/gen/schedule.js +79 -1
  90. package/gen/schedule.js.map +1 -1
  91. package/gen/session.d.ts +21 -0
  92. package/gen/session.d.ts.map +1 -1
  93. package/gen/session.js +80 -1
  94. package/gen/session.js.map +1 -1
  95. package/gen/skill.d.ts +8 -0
  96. package/gen/skill.d.ts.map +1 -1
  97. package/gen/skill.js +1 -0
  98. package/gen/skill.js.map +1 -1
  99. package/gen/workflow.d.ts +21 -0
  100. package/gen/workflow.d.ts.map +1 -1
  101. package/gen/workflow.js +79 -0
  102. package/gen/workflow.js.map +1 -1
  103. package/gen/workflowexecution.d.ts +21 -0
  104. package/gen/workflowexecution.d.ts.map +1 -1
  105. package/gen/workflowexecution.js +36 -1
  106. package/gen/workflowexecution.js.map +1 -1
  107. package/gen/workflowinstance.d.ts +21 -0
  108. package/gen/workflowinstance.d.ts.map +1 -1
  109. package/gen/workflowinstance.js +33 -1
  110. package/gen/workflowinstance.js.map +1 -1
  111. package/index.d.ts +20 -21
  112. package/index.d.ts.map +1 -1
  113. package/index.js +24 -23
  114. package/index.js.map +1 -1
  115. package/package.json +2 -2
  116. package/src/__tests__/update-input-roundtrip.test.ts +1031 -0
  117. package/src/__tests__/update-input.test.ts +34 -3
  118. package/src/gen/agent.ts +89 -3
  119. package/src/gen/agentchannel.ts +72 -4
  120. package/src/gen/agentexecution.ts +172 -6
  121. package/src/gen/agentinstance.ts +41 -1
  122. package/src/gen/agentshare.ts +68 -4
  123. package/src/gen/apikey.ts +42 -1
  124. package/src/gen/artifact.ts +9 -0
  125. package/src/gen/channelapp.ts +57 -1
  126. package/src/gen/environment.ts +40 -1
  127. package/src/gen/executioncontext.ts +9 -0
  128. package/src/gen/iampolicy.ts +9 -0
  129. package/src/gen/identityaccount.ts +57 -2
  130. package/src/gen/identityprovider.ts +49 -0
  131. package/src/gen/invitation.ts +9 -0
  132. package/src/gen/mcpserver.ts +95 -3
  133. package/src/gen/oauthapp.ts +48 -0
  134. package/src/gen/organization.ts +52 -2
  135. package/src/gen/platformclient.ts +49 -1
  136. package/src/gen/project.ts +41 -1
  137. package/src/gen/proto-utils.ts +64 -0
  138. package/src/gen/schedule.ts +98 -4
  139. package/src/gen/session.ts +97 -3
  140. package/src/gen/skill.ts +9 -0
  141. package/src/gen/workflow.ts +96 -2
  142. package/src/gen/workflowexecution.ts +45 -1
  143. package/src/gen/workflowinstance.ts +42 -1
  144. package/src/index.ts +24 -9
  145. package/src/update-input.ts +0 -168
  146. package/update-input.d.ts +0 -24
  147. package/update-input.d.ts.map +0 -1
  148. package/update-input.js +0 -126
  149. package/update-input.js.map +0 -1
@@ -1,18 +1,18 @@
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 { ToolApprovalOverrideSchema, McpServerUsageSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
8
+ import { ToolApprovalOverrideSchema, McpServerUsageSchema, type ToolApprovalOverride, type McpServerUsage } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
9
9
  import { SessionSchema, type Session } from "@stigmer/protos/ai/stigmer/agentic/session/v1/api_pb";
10
10
  import { SessionCommandController } from "@stigmer/protos/ai/stigmer/agentic/session/v1/command_pb";
11
11
  import { Harness, CursorMode, ExecutionTarget, GitWriteBackMode } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
12
12
  import { SessionIdSchema, UpdateSessionSubjectRequestSchema, ListSessionsRequestSchema, SessionListSchema, ListSessionsByAgentInstanceRequestSchema, ListSessionsByChannelRequestSchema, type UpdateSessionSubjectRequest, type ListSessionsRequest, type SessionList, type ListSessionsByAgentInstanceRequest, type ListSessionsByChannelRequest } from "@stigmer/protos/ai/stigmer/agentic/session/v1/io_pb";
13
13
  import { SessionQueryController } from "@stigmer/protos/ai/stigmer/agentic/session/v1/query_pb";
14
14
  import { SessionSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/spec_pb";
15
- import { GitRepoSourceSchema, LocalPathSourceSchema, WorkspaceSourceSchema, WorkspaceEntrySchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
15
+ import { GitRepoSourceSchema, LocalPathSourceSchema, WorkspaceSourceSchema, WorkspaceEntrySchema, type GitRepoSource, type LocalPathSource, type WorkspaceSource, type WorkspaceEntry } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
16
16
  import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
17
17
  import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
18
18
  import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
@@ -84,6 +84,14 @@ export class SessionClient {
84
84
 
85
85
  /** Input for creating/updating a Session. */
86
86
  export interface SessionInput {
87
+ /**
88
+ * The resource's `metadata.id`, for exact update addressing when set
89
+ * from a loaded resource. Required for updates to platform-scoped
90
+ * (org-less) kinds, where the org+slug fallback cannot match. On
91
+ * create, the cloud server stamps its own id regardless; the OSS
92
+ * server honors a caller-supplied id (existing apply semantics).
93
+ */
94
+ id?: string;
87
95
  name: string;
88
96
  slug?: string;
89
97
  org: string;
@@ -199,6 +207,7 @@ export function buildSessionProto(input: SessionInput): Session {
199
207
  apiVersion: "agentic.stigmer.ai/v1",
200
208
  kind: "Session",
201
209
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
210
+ ...(input.id && { id: input.id }),
202
211
  name: input.name,
203
212
  org: input.org,
204
213
  ...(input.slug && { slug: input.slug }),
@@ -220,3 +229,88 @@ export function buildSessionProto(input: SessionInput): Session {
220
229
  })),
221
230
  }) as Session;
222
231
  }
232
+
233
+ function toGitRepoSourceInput(msg: GitRepoSource): GitRepoSourceInput {
234
+ return {
235
+ url: msg.url ?? "",
236
+ branch: msg.branch || undefined,
237
+ commit: msg.commit || undefined,
238
+ depth: msg.depth || undefined,
239
+ writeBackMode: msg.writeBackMode || undefined,
240
+ };
241
+ }
242
+
243
+ function toLocalPathSourceInput(msg: LocalPathSource): LocalPathSourceInput {
244
+ return {
245
+ path: msg.path || undefined,
246
+ };
247
+ }
248
+
249
+ function toWorkspaceSourceInput(msg: WorkspaceSource): WorkspaceSourceInput {
250
+ return {
251
+ gitRepo: msg.source?.case === "gitRepo" ? toGitRepoSourceInput(msg.source.value) : undefined,
252
+ localPath: msg.source?.case === "localPath" ? toLocalPathSourceInput(msg.source.value) : undefined,
253
+ };
254
+ }
255
+
256
+ function toWorkspaceEntryInput(msg: WorkspaceEntry): WorkspaceEntryInput {
257
+ return {
258
+ name: msg.name || undefined,
259
+ source: toWorkspaceSourceInput(msg.source ?? create(WorkspaceSourceSchema)),
260
+ };
261
+ }
262
+
263
+ function toToolApprovalOverrideInput(msg: ToolApprovalOverride): ToolApprovalOverrideInput {
264
+ return {
265
+ toolName: msg.toolName || undefined,
266
+ requiresApproval: msg.requiresApproval || undefined,
267
+ message: msg.message || undefined,
268
+ };
269
+ }
270
+
271
+ function toMcpServerUsageInput(msg: McpServerUsage): McpServerUsageInput {
272
+ return {
273
+ mcpServerRef: toResourceRefInput(msg.mcpServerRef) ?? { org: "", slug: "" },
274
+ enabledTools: msg.enabledTools?.length ? [...msg.enabledTools] : undefined,
275
+ toolApprovalOverrides: msg.toolApprovalOverrides?.length ? msg.toolApprovalOverrides.map(toToolApprovalOverrideInput) : undefined,
276
+ };
277
+ }
278
+
279
+ /**
280
+ * Maps a fetched {@link Session} to a complete {@link SessionInput} for `update()`.
281
+ *
282
+ * The update RPC replaces the ENTIRE spec — spread this mapper's output
283
+ * and override only the fields you edit (spread nested objects the same
284
+ * way):
285
+ *
286
+ * await client.update({ ...toSessionUpdateInput(res), description: next });
287
+ *
288
+ * Proto3 defaults normalize to `undefined`; resource references keep
289
+ * `version` (pinned refs) and `kind`.
290
+ */
291
+ export function toSessionUpdateInput(resource: Session): SessionInput {
292
+ const meta = resource.metadata;
293
+ const spec = resource.spec ?? create(SessionSpecSchema);
294
+ return {
295
+ // Exact update addressing (id-first in the update pipeline) — for
296
+ // platform-scoped (org-less) kinds the org+slug fallback cannot
297
+ // match, so the id is the ONLY working address.
298
+ id: meta?.id || undefined,
299
+ name: meta?.name ?? "",
300
+ slug: meta?.slug || undefined,
301
+ org: meta?.org ?? "",
302
+ labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
303
+ visibility: meta?.visibility || undefined,
304
+ agentInstanceId: spec.agentInstanceId || undefined,
305
+ subject: spec.subject || undefined,
306
+ harnessStateId: spec.harnessStateId || undefined,
307
+ harnessStateIdHistory: spec.harnessStateIdHistory?.length ? [...spec.harnessStateIdHistory] : undefined,
308
+ metadata: Object.keys(spec.metadata ?? {}).length > 0 ? { ...spec.metadata } : undefined,
309
+ workspaceEntries: spec.workspaceEntries?.length ? spec.workspaceEntries.map(toWorkspaceEntryInput) : undefined,
310
+ mcpServerUsages: spec.mcpServerUsages?.length ? spec.mcpServerUsages.map(toMcpServerUsageInput) : undefined,
311
+ skillRefs: toResourceRefInputs(spec.skillRefs),
312
+ harness: spec.harness || undefined,
313
+ cursorMode: spec.cursorMode || undefined,
314
+ executionTarget: spec.executionTarget || undefined,
315
+ };
316
+ }
package/src/gen/skill.ts CHANGED
@@ -111,6 +111,14 @@ export class SkillClient {
111
111
 
112
112
  /** Input for creating/updating a Skill. */
113
113
  export interface SkillInput {
114
+ /**
115
+ * The resource's `metadata.id`, for exact update addressing when set
116
+ * from a loaded resource. Required for updates to platform-scoped
117
+ * (org-less) kinds, where the org+slug fallback cannot match. On
118
+ * create, the cloud server stamps its own id regardless; the OSS
119
+ * server honors a caller-supplied id (existing apply semantics).
120
+ */
121
+ id?: string;
114
122
  name: string;
115
123
  slug?: string;
116
124
  org: string;
@@ -127,6 +135,7 @@ export function buildSkillProto(input: SkillInput): Skill {
127
135
  apiVersion: "agentic.stigmer.ai/v1",
128
136
  kind: "Skill",
129
137
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
138
+ ...(input.id && { id: input.id }),
130
139
  name: input.name,
131
140
  org: input.org,
132
141
  ...(input.slug && { slug: input.slug }),
@@ -5,14 +5,14 @@ import { stripUndefined } from "./proto-utils.js";
5
5
  import { type ListParams, type ListResult, type ResourceRef } from "./types.js";
6
6
  import { create, type JsonObject } 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 { WorkflowSchema, type Workflow } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/api_pb";
10
10
  import { WorkflowCommandController } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/command_pb";
11
11
  import { WorkflowTaskKind, BudgetExceededPolicy } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/enum_pb";
12
12
  import { WorkflowIdSchema } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/io_pb";
13
13
  import { WorkflowQueryController } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/query_pb";
14
14
  import { type ServerlessWorkflowValidation } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/serverless/validation_pb";
15
- import { WorkflowSpecSchema, WorkflowDocumentSchema, ExportSchema, FlowControlSchema, WorkflowTaskSchema, WorkflowBudgetSchema } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/spec_pb";
15
+ import { WorkflowSpecSchema, WorkflowDocumentSchema, ExportSchema, FlowControlSchema, WorkflowTaskSchema, WorkflowBudgetSchema, type WorkflowDocument, type Export, type FlowControl, type WorkflowTask, type WorkflowBudget } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/spec_pb";
16
16
  import { GetTaskKindRegistryRequestSchema, GetTaskKindRegistryResponseSchema, type GetTaskKindRegistryRequest, type GetTaskKindRegistryResponse } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/task_kind_descriptor_pb";
17
17
  import { TaskKindRegistryQueryController } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/task_kind_registry_query_pb";
18
18
  import { TagWorkflowVersionInputSchema, ListWorkflowVersionsInputSchema, ListWorkflowVersionsResponseSchema, GetWorkflowVersionInputSchema, WorkflowVersionEntrySchema, type TagWorkflowVersionInput, type ListWorkflowVersionsInput, type ListWorkflowVersionsResponse, type GetWorkflowVersionInput, type WorkflowVersionEntry } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/version_pb";
@@ -131,6 +131,14 @@ export class WorkflowClient {
131
131
 
132
132
  /** Input for creating/updating a Workflow. */
133
133
  export interface WorkflowInput {
134
+ /**
135
+ * The resource's `metadata.id`, for exact update addressing when set
136
+ * from a loaded resource. Required for updates to platform-scoped
137
+ * (org-less) kinds, where the org+slug fallback cannot match. On
138
+ * create, the cloud server stamps its own id regardless; the OSS
139
+ * server honors a caller-supplied id (existing apply semantics).
140
+ */
141
+ id?: string;
134
142
  name: string;
135
143
  slug?: string;
136
144
  org: string;
@@ -250,6 +258,7 @@ export function buildWorkflowProto(input: WorkflowInput): Workflow {
250
258
  apiVersion: "agentic.stigmer.ai/v1",
251
259
  kind: "Workflow",
252
260
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
261
+ ...(input.id && { id: input.id }),
253
262
  name: input.name,
254
263
  org: input.org,
255
264
  ...(input.slug && { slug: input.slug }),
@@ -266,3 +275,88 @@ export function buildWorkflowProto(input: WorkflowInput): Workflow {
266
275
  })),
267
276
  }) as Workflow;
268
277
  }
278
+
279
+ function toWorkflowDocumentInput(msg: WorkflowDocument): WorkflowDocumentInput {
280
+ return {
281
+ dsl: msg.dsl || undefined,
282
+ namespace: msg.namespace ?? "",
283
+ name: msg.name ?? "",
284
+ version: msg.version ?? "",
285
+ description: msg.description || undefined,
286
+ };
287
+ }
288
+
289
+ function toExportInput(msg: Export): ExportInput {
290
+ return {
291
+ as: msg.as || undefined,
292
+ };
293
+ }
294
+
295
+ function toFlowControlInput(msg: FlowControl): FlowControlInput {
296
+ return {
297
+ then: msg.then || undefined,
298
+ };
299
+ }
300
+
301
+ function toWorkflowTaskInput(msg: WorkflowTask): WorkflowTaskInput {
302
+ return {
303
+ name: msg.name || undefined,
304
+ kind: msg.kind ?? 0,
305
+ taskConfig: msg.taskConfig ?? {},
306
+ export: msg.export ? toExportInput(msg.export) : undefined,
307
+ flow: msg.flow ? toFlowControlInput(msg.flow) : undefined,
308
+ compensate: msg.compensate?.length ? msg.compensate.map(toWorkflowTaskInput) : undefined,
309
+ };
310
+ }
311
+
312
+ function toEnvVarDeclarationInput(msg: EnvVarDeclaration): EnvVarDeclarationInput {
313
+ return {
314
+ isSecret: msg.isSecret || undefined,
315
+ description: msg.description || undefined,
316
+ optional: msg.optional || undefined,
317
+ };
318
+ }
319
+
320
+ function toWorkflowBudgetInput(msg: WorkflowBudget): WorkflowBudgetInput {
321
+ return {
322
+ maxCostMicros: msg.maxCostMicros || undefined,
323
+ maxTotalTokens: msg.maxTotalTokens || undefined,
324
+ maxDurationSeconds: msg.maxDurationSeconds || undefined,
325
+ onExceeded: msg.onExceeded || undefined,
326
+ };
327
+ }
328
+
329
+ /**
330
+ * Maps a fetched {@link Workflow} to a complete {@link WorkflowInput} for `update()`.
331
+ *
332
+ * The update RPC replaces the ENTIRE spec — spread this mapper's output
333
+ * and override only the fields you edit (spread nested objects the same
334
+ * way):
335
+ *
336
+ * await client.update({ ...toWorkflowUpdateInput(res), description: next });
337
+ *
338
+ * Proto3 defaults normalize to `undefined`; resource references keep
339
+ * `version` (pinned refs) and `kind`.
340
+ */
341
+ export function toWorkflowUpdateInput(resource: Workflow): WorkflowInput {
342
+ const meta = resource.metadata;
343
+ const spec = resource.spec ?? create(WorkflowSpecSchema);
344
+ return {
345
+ // Exact update addressing (id-first in the update pipeline) — for
346
+ // platform-scoped (org-less) kinds the org+slug fallback cannot
347
+ // match, so the id is the ONLY working address.
348
+ id: meta?.id || undefined,
349
+ name: meta?.name ?? "",
350
+ slug: meta?.slug || undefined,
351
+ org: meta?.org ?? "",
352
+ labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
353
+ visibility: meta?.visibility || undefined,
354
+ // Never carried over: a version message describes the NEXT update.
355
+ versionMessage: undefined,
356
+ description: spec.description || undefined,
357
+ document: toWorkflowDocumentInput(spec.document ?? create(WorkflowDocumentSchema)),
358
+ tasks: spec.tasks?.length ? spec.tasks.map(toWorkflowTaskInput) : undefined,
359
+ env: Object.keys(spec.env ?? {}).length > 0 ? Object.fromEntries(Object.entries(spec.env).map(([k, v]) => [k, toEnvVarDeclarationInput(v)])) : undefined,
360
+ budget: spec.budget ? toWorkflowBudgetInput(spec.budget) : undefined,
361
+ };
362
+ }
@@ -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, toExecVarInputMap } from "./proto-utils.js";
5
5
  import { type EnvVarInput } from "./types.js";
6
6
  import { create } from "@bufbuild/protobuf";
7
7
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
@@ -160,6 +160,14 @@ export class WorkflowExecutionClient {
160
160
 
161
161
  /** Input for creating/updating a WorkflowExecution. */
162
162
  export interface WorkflowExecutionInput {
163
+ /**
164
+ * The resource's `metadata.id`, for exact update addressing when set
165
+ * from a loaded resource. Required for updates to platform-scoped
166
+ * (org-less) kinds, where the org+slug fallback cannot match. On
167
+ * create, the cloud server stamps its own id regardless; the OSS
168
+ * server honors a caller-supplied id (existing apply semantics).
169
+ */
170
+ id?: string;
163
171
  name: string;
164
172
  slug?: string;
165
173
  org: string;
@@ -184,6 +192,7 @@ export function buildWorkflowExecutionProto(input: WorkflowExecutionInput): Work
184
192
  apiVersion: "agentic.stigmer.ai/v1",
185
193
  kind: "WorkflowExecution",
186
194
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
195
+ ...(input.id && { id: input.id }),
187
196
  name: input.name,
188
197
  org: input.org,
189
198
  ...(input.slug && { slug: input.slug }),
@@ -201,3 +210,38 @@ export function buildWorkflowExecutionProto(input: WorkflowExecutionInput): Work
201
210
  })),
202
211
  }) as WorkflowExecution;
203
212
  }
213
+
214
+ /**
215
+ * Maps a fetched {@link WorkflowExecution} to a complete {@link WorkflowExecutionInput} for `update()`.
216
+ *
217
+ * The update RPC replaces the ENTIRE spec — spread this mapper's output
218
+ * and override only the fields you edit (spread nested objects the same
219
+ * way):
220
+ *
221
+ * await client.update({ ...toWorkflowExecutionUpdateInput(res), description: next });
222
+ *
223
+ * Proto3 defaults normalize to `undefined`; resource references keep
224
+ * `version` (pinned refs) and `kind`.
225
+ */
226
+ export function toWorkflowExecutionUpdateInput(resource: WorkflowExecution): WorkflowExecutionInput {
227
+ const meta = resource.metadata;
228
+ const spec = resource.spec ?? create(WorkflowExecutionSpecSchema);
229
+ return {
230
+ // Exact update addressing (id-first in the update pipeline) — for
231
+ // platform-scoped (org-less) kinds the org+slug fallback cannot
232
+ // match, so the id is the ONLY working address.
233
+ id: meta?.id || undefined,
234
+ name: meta?.name ?? "",
235
+ slug: meta?.slug || undefined,
236
+ org: meta?.org ?? "",
237
+ labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
238
+ visibility: meta?.visibility || undefined,
239
+ workflowInstanceId: spec.workflowInstanceId || undefined,
240
+ workflowId: spec.workflowId || undefined,
241
+ triggerMessage: spec.triggerMessage || undefined,
242
+ triggerMetadata: Object.keys(spec.triggerMetadata ?? {}).length > 0 ? { ...spec.triggerMetadata } : undefined,
243
+ runtimeEnv: toExecVarInputMap(spec.runtimeEnv),
244
+ callbackToken: spec.callbackToken?.length ? spec.callbackToken : undefined,
245
+ executionTarget: spec.executionTarget || undefined,
246
+ };
247
+ }
@@ -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 WorkflowInstanceClient {
82
82
 
83
83
  /** Input for creating/updating a WorkflowInstance. */
84
84
  export interface WorkflowInstanceInput {
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;
@@ -99,6 +107,7 @@ export function buildWorkflowInstanceProto(input: WorkflowInstanceInput): Workfl
99
107
  apiVersion: "agentic.stigmer.ai/v1",
100
108
  kind: "WorkflowInstance",
101
109
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
110
+ ...(input.id && { id: input.id }),
102
111
  name: input.name,
103
112
  org: input.org,
104
113
  ...(input.slug && { slug: input.slug }),
@@ -113,3 +122,35 @@ export function buildWorkflowInstanceProto(input: WorkflowInstanceInput): Workfl
113
122
  })),
114
123
  }) as WorkflowInstance;
115
124
  }
125
+
126
+ /**
127
+ * Maps a fetched {@link WorkflowInstance} to a complete {@link WorkflowInstanceInput} for `update()`.
128
+ *
129
+ * The update RPC replaces the ENTIRE spec — spread this mapper's output
130
+ * and override only the fields you edit (spread nested objects the same
131
+ * way):
132
+ *
133
+ * await client.update({ ...toWorkflowInstanceUpdateInput(res), description: next });
134
+ *
135
+ * Proto3 defaults normalize to `undefined`; resource references keep
136
+ * `version` (pinned refs) and `kind`.
137
+ */
138
+ export function toWorkflowInstanceUpdateInput(resource: WorkflowInstance): WorkflowInstanceInput {
139
+ const meta = resource.metadata;
140
+ const spec = resource.spec ?? create(WorkflowInstanceSpecSchema);
141
+ return {
142
+ // Exact update addressing (id-first in the update pipeline) — for
143
+ // platform-scoped (org-less) kinds the org+slug fallback cannot
144
+ // match, so the id is the ONLY working address.
145
+ id: meta?.id || undefined,
146
+ name: meta?.name ?? "",
147
+ slug: meta?.slug || undefined,
148
+ org: meta?.org ?? "",
149
+ labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
150
+ visibility: meta?.visibility || undefined,
151
+ workflowId: spec.workflowId || undefined,
152
+ description: spec.description || undefined,
153
+ environmentRefs: toResourceRefInputs(spec.environmentRefs),
154
+ executionVisibility: spec.executionVisibility || undefined,
155
+ };
156
+ }
package/src/index.ts CHANGED
@@ -61,12 +61,6 @@ export {
61
61
  isResourceAvailable,
62
62
  } from "./resource-availability.js";
63
63
 
64
- // Complete update-input mappers (full-spec-replace round-trip safety)
65
- export {
66
- toOrganizationUpdateInput,
67
- toIdentityAccountUpdateInput,
68
- } from "./update-input.js";
69
-
70
64
  // Authorization config and IAM role utilities
71
65
  export {
72
66
  getGrantableRoles,
@@ -166,10 +160,14 @@ export {
166
160
  type EnvVarInput,
167
161
  } from "./gen/types.js";
168
162
 
169
- // Re-export all resource client classes and input types
163
+ // Re-export all resource client classes and input types. The
164
+ // toXxxUpdateInput mappers are the full-spec-replace safety layer: they
165
+ // rebuild a COMPLETE input from a fetched resource so subset editors can
166
+ // spread-and-override without wiping unlisted fields.
170
167
  export {
171
168
  AgentClient,
172
169
  buildAgentProto,
170
+ toAgentUpdateInput,
173
171
  type AgentInput,
174
172
  type McpServerUsageInput,
175
173
  type ToolApprovalOverrideInput,
@@ -179,11 +177,13 @@ export {
179
177
  } from "./gen/agent.js";
180
178
  export {
181
179
  AgentChannelClient,
180
+ toAgentChannelUpdateInput,
182
181
  type AgentChannelInput,
183
182
  type SlackChannelConfigInput,
184
183
  } from "./gen/agentchannel.js";
185
184
  export {
186
185
  AgentExecutionClient,
186
+ toAgentExecutionUpdateInput,
187
187
  type AgentExecutionInput,
188
188
  type ExecutionConfigInput,
189
189
  type ContextManagementConfigInput,
@@ -191,21 +191,25 @@ export {
191
191
  } from "./gen/agentexecution.js";
192
192
  export {
193
193
  AgentInstanceClient,
194
+ toAgentInstanceUpdateInput,
194
195
  type AgentInstanceInput,
195
196
  } from "./gen/agentinstance.js";
196
197
  export {
197
198
  AgentShareClient,
199
+ toAgentShareUpdateInput,
198
200
  type AgentShareInput,
199
201
  type AgentShareMessagesInput,
200
202
  } from "./gen/agentshare.js";
201
- export { ApiKeyClient, type ApiKeyInput } from "./gen/apikey.js";
203
+ export { ApiKeyClient, toApiKeyUpdateInput, type ApiKeyInput } from "./gen/apikey.js";
202
204
  export {
203
205
  ChannelAppClient,
206
+ toChannelAppUpdateInput,
204
207
  type ChannelAppInput,
205
208
  type SlackChannelAppConfigInput,
206
209
  } from "./gen/channelapp.js";
207
210
  export {
208
211
  EnvironmentClient,
212
+ toEnvironmentUpdateInput,
209
213
  type EnvironmentInput,
210
214
  } from "./gen/environment.js";
211
215
  export {
@@ -219,6 +223,7 @@ export {
219
223
  } from "./gen/iampolicy.js";
220
224
  export {
221
225
  IdentityAccountClient,
226
+ toIdentityAccountUpdateInput,
222
227
  type IdentityAccountInput,
223
228
  } from "./gen/identityaccount.js";
224
229
  export {
@@ -227,15 +232,18 @@ export {
227
232
  } from "./gen/invitation.js";
228
233
  export {
229
234
  IdentityProviderClient,
235
+ toIdentityProviderUpdateInput,
230
236
  type IdentityProviderInput,
231
237
  } from "./gen/identityprovider.js";
232
238
  export {
233
239
  OAuthAppClient,
240
+ toOAuthAppUpdateInput,
234
241
  type OAuthAppInput,
235
242
  } from "./gen/oauthapp.js";
236
243
  export {
237
244
  McpServerClient,
238
245
  buildMcpServerProto,
246
+ toMcpServerUpdateInput,
239
247
  type McpServerInput,
240
248
  type StdioServerConfigInput,
241
249
  type HttpServerConfigInput,
@@ -251,22 +259,26 @@ export {
251
259
  } from "./mcpserver-connect.js";
252
260
  export {
253
261
  OrganizationClient,
262
+ toOrganizationUpdateInput,
254
263
  type OrganizationInput,
255
264
  } from "./gen/organization.js";
256
265
  export {
257
266
  PlatformClientClient,
267
+ toPlatformClientUpdateInput,
258
268
  type PlatformClientInput,
259
269
  } from "./gen/platformclient.js";
260
- export { ProjectClient, type ProjectInput } from "./gen/project.js";
270
+ export { ProjectClient, toProjectUpdateInput, type ProjectInput } from "./gen/project.js";
261
271
  export {
262
272
  ScheduleClient,
263
273
  buildScheduleProto,
274
+ toScheduleUpdateInput,
264
275
  type ScheduleInput,
265
276
  type AgentInvocationInput,
266
277
  type RunConfigInput,
267
278
  } from "./gen/schedule.js";
268
279
  export {
269
280
  SessionClient,
281
+ toSessionUpdateInput,
270
282
  type SessionInput,
271
283
  type WorkspaceEntryInput,
272
284
  type WorkspaceSourceInput,
@@ -311,6 +323,7 @@ export { SkillClient, type SkillInput } from "./gen/skill.js";
311
323
  export { RoutedSkillClient, MAX_INLINE_ARTIFACT_BYTES } from "./skill.js";
312
324
  export {
313
325
  WorkflowClient,
326
+ toWorkflowUpdateInput,
314
327
  type WorkflowInput,
315
328
  type WorkflowDocumentInput,
316
329
  type WorkflowTaskInput,
@@ -319,9 +332,11 @@ export {
319
332
  } from "./gen/workflow.js";
320
333
  export {
321
334
  WorkflowExecutionClient,
335
+ toWorkflowExecutionUpdateInput,
322
336
  type WorkflowExecutionInput,
323
337
  } from "./gen/workflowexecution.js";
324
338
  export {
325
339
  WorkflowInstanceClient,
340
+ toWorkflowInstanceUpdateInput,
326
341
  type WorkflowInstanceInput,
327
342
  } from "./gen/workflowinstance.js";