@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.
Files changed (175) 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 +795 -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/execution/__tests__/transcript.test.d.ts +2 -0
  8. package/execution/__tests__/transcript.test.d.ts.map +1 -0
  9. package/execution/__tests__/transcript.test.js +527 -0
  10. package/execution/__tests__/transcript.test.js.map +1 -0
  11. package/execution/conversation-rules.d.ts +64 -0
  12. package/execution/conversation-rules.d.ts.map +1 -0
  13. package/execution/conversation-rules.js +113 -0
  14. package/execution/conversation-rules.js.map +1 -0
  15. package/execution/transcript.d.ts +171 -0
  16. package/execution/transcript.d.ts.map +1 -0
  17. package/execution/transcript.js +484 -0
  18. package/execution/transcript.js.map +1 -0
  19. package/gen/agent.d.ts +21 -0
  20. package/gen/agent.d.ts.map +1 -1
  21. package/gen/agent.js +73 -1
  22. package/gen/agent.js.map +1 -1
  23. package/gen/agentchannel.d.ts +23 -1
  24. package/gen/agentchannel.d.ts.map +1 -1
  25. package/gen/agentchannel.js +55 -1
  26. package/gen/agentchannel.js.map +1 -1
  27. package/gen/agentexecution.d.ts +34 -1
  28. package/gen/agentexecution.d.ts.map +1 -1
  29. package/gen/agentexecution.js +176 -2
  30. package/gen/agentexecution.js.map +1 -1
  31. package/gen/agentinstance.d.ts +21 -0
  32. package/gen/agentinstance.d.ts.map +1 -1
  33. package/gen/agentinstance.js +32 -1
  34. package/gen/agentinstance.js.map +1 -1
  35. package/gen/agentshare.d.ts +23 -1
  36. package/gen/agentshare.d.ts.map +1 -1
  37. package/gen/agentshare.js +53 -1
  38. package/gen/agentshare.js.map +1 -1
  39. package/gen/apikey.d.ts +21 -0
  40. package/gen/apikey.d.ts.map +1 -1
  41. package/gen/apikey.js +33 -1
  42. package/gen/apikey.js.map +1 -1
  43. package/gen/artifact.d.ts +8 -0
  44. package/gen/artifact.d.ts.map +1 -1
  45. package/gen/artifact.js +1 -0
  46. package/gen/artifact.js.map +1 -1
  47. package/gen/channelapp.d.ts +21 -0
  48. package/gen/channelapp.d.ts.map +1 -1
  49. package/gen/channelapp.js +45 -0
  50. package/gen/channelapp.js.map +1 -1
  51. package/gen/client.d.ts +5 -1
  52. package/gen/client.d.ts.map +1 -1
  53. package/gen/client.js +4 -0
  54. package/gen/client.js.map +1 -1
  55. package/gen/environment.d.ts +21 -0
  56. package/gen/environment.d.ts.map +1 -1
  57. package/gen/environment.js +31 -1
  58. package/gen/environment.js.map +1 -1
  59. package/gen/executioncontext.d.ts +8 -0
  60. package/gen/executioncontext.d.ts.map +1 -1
  61. package/gen/executioncontext.js +1 -0
  62. package/gen/executioncontext.js.map +1 -1
  63. package/gen/iampolicy.d.ts +8 -0
  64. package/gen/iampolicy.d.ts.map +1 -1
  65. package/gen/iampolicy.js +1 -0
  66. package/gen/iampolicy.js.map +1 -1
  67. package/gen/identityaccount.d.ts +22 -0
  68. package/gen/identityaccount.d.ts.map +1 -1
  69. package/gen/identityaccount.js +48 -1
  70. package/gen/identityaccount.js.map +1 -1
  71. package/gen/identityprovider.d.ts +21 -0
  72. package/gen/identityprovider.d.ts.map +1 -1
  73. package/gen/identityprovider.js +40 -0
  74. package/gen/identityprovider.js.map +1 -1
  75. package/gen/invitation.d.ts +8 -0
  76. package/gen/invitation.d.ts.map +1 -1
  77. package/gen/invitation.js +1 -0
  78. package/gen/invitation.js.map +1 -1
  79. package/gen/mcpserver.d.ts +21 -0
  80. package/gen/mcpserver.d.ts.map +1 -1
  81. package/gen/mcpserver.js +79 -1
  82. package/gen/mcpserver.js.map +1 -1
  83. package/gen/memory.d.ts +58 -0
  84. package/gen/memory.d.ts.map +1 -0
  85. package/gen/memory.js +143 -0
  86. package/gen/memory.js.map +1 -0
  87. package/gen/oauthapp.d.ts +21 -0
  88. package/gen/oauthapp.d.ts.map +1 -1
  89. package/gen/oauthapp.js +39 -0
  90. package/gen/oauthapp.js.map +1 -1
  91. package/gen/organization.d.ts +22 -0
  92. package/gen/organization.d.ts.map +1 -1
  93. package/gen/organization.js +43 -1
  94. package/gen/organization.js.map +1 -1
  95. package/gen/platformclient.d.ts +21 -0
  96. package/gen/platformclient.d.ts.map +1 -1
  97. package/gen/platformclient.js +40 -1
  98. package/gen/platformclient.js.map +1 -1
  99. package/gen/project.d.ts +21 -0
  100. package/gen/project.d.ts.map +1 -1
  101. package/gen/project.js +32 -1
  102. package/gen/project.js.map +1 -1
  103. package/gen/proto-utils.d.ts +36 -0
  104. package/gen/proto-utils.d.ts.map +1 -1
  105. package/gen/proto-utils.js +58 -0
  106. package/gen/proto-utils.js.map +1 -1
  107. package/gen/schedule.d.ts +23 -1
  108. package/gen/schedule.d.ts.map +1 -1
  109. package/gen/schedule.js +79 -1
  110. package/gen/schedule.js.map +1 -1
  111. package/gen/session.d.ts +21 -0
  112. package/gen/session.d.ts.map +1 -1
  113. package/gen/session.js +80 -1
  114. package/gen/session.js.map +1 -1
  115. package/gen/skill.d.ts +8 -0
  116. package/gen/skill.d.ts.map +1 -1
  117. package/gen/skill.js +1 -0
  118. package/gen/skill.js.map +1 -1
  119. package/gen/workflow.d.ts +21 -0
  120. package/gen/workflow.d.ts.map +1 -1
  121. package/gen/workflow.js +79 -0
  122. package/gen/workflow.js.map +1 -1
  123. package/gen/workflowexecution.d.ts +21 -0
  124. package/gen/workflowexecution.d.ts.map +1 -1
  125. package/gen/workflowexecution.js +36 -1
  126. package/gen/workflowexecution.js.map +1 -1
  127. package/gen/workflowinstance.d.ts +21 -0
  128. package/gen/workflowinstance.d.ts.map +1 -1
  129. package/gen/workflowinstance.js +33 -1
  130. package/gen/workflowinstance.js.map +1 -1
  131. package/index.d.ts +23 -21
  132. package/index.d.ts.map +1 -1
  133. package/index.js +27 -23
  134. package/index.js.map +1 -1
  135. package/package.json +2 -2
  136. package/src/__tests__/update-input-roundtrip.test.ts +1035 -0
  137. package/src/__tests__/update-input.test.ts +34 -3
  138. package/src/execution/__tests__/transcript.golden.md +100 -0
  139. package/src/execution/__tests__/transcript.test.ts +627 -0
  140. package/src/execution/conversation-rules.ts +119 -0
  141. package/src/execution/transcript.ts +735 -0
  142. package/src/gen/agent.ts +89 -3
  143. package/src/gen/agentchannel.ts +72 -4
  144. package/src/gen/agentexecution.ts +216 -6
  145. package/src/gen/agentinstance.ts +41 -1
  146. package/src/gen/agentshare.ts +68 -4
  147. package/src/gen/apikey.ts +42 -1
  148. package/src/gen/artifact.ts +9 -0
  149. package/src/gen/channelapp.ts +57 -1
  150. package/src/gen/client.ts +6 -1
  151. package/src/gen/environment.ts +40 -1
  152. package/src/gen/executioncontext.ts +9 -0
  153. package/src/gen/iampolicy.ts +9 -0
  154. package/src/gen/identityaccount.ts +60 -2
  155. package/src/gen/identityprovider.ts +49 -0
  156. package/src/gen/invitation.ts +9 -0
  157. package/src/gen/mcpserver.ts +95 -3
  158. package/src/gen/memory.ts +164 -0
  159. package/src/gen/oauthapp.ts +48 -0
  160. package/src/gen/organization.ts +55 -2
  161. package/src/gen/platformclient.ts +49 -1
  162. package/src/gen/project.ts +41 -1
  163. package/src/gen/proto-utils.ts +64 -0
  164. package/src/gen/schedule.ts +98 -4
  165. package/src/gen/session.ts +97 -3
  166. package/src/gen/skill.ts +9 -0
  167. package/src/gen/workflow.ts +96 -2
  168. package/src/gen/workflowexecution.ts +45 -1
  169. package/src/gen/workflowinstance.ts +42 -1
  170. package/src/index.ts +52 -9
  171. package/src/update-input.ts +0 -168
  172. package/update-input.d.ts +0 -24
  173. package/update-input.d.ts.map +0 -1
  174. package/update-input.js +0 -126
  175. package/update-input.js.map +0 -1
@@ -1,19 +1,19 @@
1
1
  // Code generated by stigmer-codegen. DO NOT EDIT.
2
2
 
3
3
  import { wrapError } from "./errors.js";
4
- import { stripUndefined } from "./proto-utils.js";
4
+ import { stripUndefined, toResourceRefInput, toResourceRefInputs } from "./proto-utils.js";
5
5
  import { type ResourceRef } from "./types.js";
6
6
  import { create } from "@bufbuild/protobuf";
7
7
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
8
- import { ServiceTier } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
9
- import { RunConfigSchema, AgentInvocationSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/invocation_pb";
8
+ import { ServiceTier, ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
9
+ import { RunConfigSchema, AgentInvocationSchema, type RunConfig, type AgentInvocation } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/invocation_pb";
10
10
  import { ScheduleSchema, type Schedule } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/api_pb";
11
11
  import { ScheduleCommandController } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/command_pb";
12
12
  import { ScheduleIdSchema, ScheduleTriggerResultSchema, GetSchedulesByAgentRequestSchema, ScheduleListSchema, ListSchedulesRequestSchema, ListScheduleRunsRequestSchema, ScheduleRunListSchema, type ScheduleTriggerResult, type GetSchedulesByAgentRequest, type ScheduleList, type ListSchedulesRequest, type ListScheduleRunsRequest, type ScheduleRunList } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/io_pb";
13
13
  import { ScheduleQueryController } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/query_pb";
14
14
  import { ScheduleSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/schedule/v1/spec_pb";
15
15
  import { Harness, GitWriteBackMode } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
16
- import { GitRepoSourceSchema, LocalPathSourceSchema, WorkspaceSourceSchema, WorkspaceEntrySchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
16
+ import { GitRepoSourceSchema, LocalPathSourceSchema, WorkspaceSourceSchema, WorkspaceEntrySchema, type GitRepoSource, type LocalPathSource, type WorkspaceSource, type WorkspaceEntry } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
17
17
  import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
18
18
  import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
19
19
  import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
@@ -98,6 +98,14 @@ export class ScheduleClient {
98
98
 
99
99
  /** Input for creating/updating a Schedule. */
100
100
  export interface ScheduleInput {
101
+ /**
102
+ * The resource's `metadata.id`, for exact update addressing when set
103
+ * from a loaded resource. Required for updates to platform-scoped
104
+ * (org-less) kinds, where the org+slug fallback cannot match. On
105
+ * create, the cloud server stamps its own id regardless; the OSS
106
+ * server honors a caller-supplied id (existing apply semantics).
107
+ */
108
+ id?: string;
101
109
  name: string;
102
110
  slug?: string;
103
111
  org: string;
@@ -151,6 +159,7 @@ export interface RunConfigInput {
151
159
  maxCostUsd?: number;
152
160
  maxToolRounds?: number;
153
161
  serviceTier?: ServiceTier;
162
+ thinkingMode?: ThinkingMode;
154
163
  }
155
164
 
156
165
  function buildGitRepoSourceProto(input: GitRepoSourceInput) {
@@ -192,6 +201,7 @@ function buildRunConfigProto(input: RunConfigInput) {
192
201
  maxCostUsd: input.maxCostUsd,
193
202
  maxToolRounds: input.maxToolRounds,
194
203
  serviceTier: input.serviceTier,
204
+ thinkingMode: input.thinkingMode,
195
205
  }));
196
206
  }
197
207
 
@@ -219,6 +229,7 @@ export function buildScheduleProto(input: ScheduleInput): Schedule {
219
229
  apiVersion: "agentic.stigmer.ai/v1",
220
230
  kind: "Schedule",
221
231
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
232
+ ...(input.id && { id: input.id }),
222
233
  name: input.name,
223
234
  org: input.org,
224
235
  ...(input.slug && { slug: input.slug }),
@@ -228,3 +239,86 @@ export function buildScheduleProto(input: ScheduleInput): Schedule {
228
239
  spec,
229
240
  }) as Schedule;
230
241
  }
242
+
243
+ function toGitRepoSourceInput(msg: GitRepoSource): GitRepoSourceInput {
244
+ return {
245
+ url: msg.url ?? "",
246
+ branch: msg.branch || undefined,
247
+ commit: msg.commit || undefined,
248
+ depth: msg.depth || undefined,
249
+ writeBackMode: msg.writeBackMode || undefined,
250
+ };
251
+ }
252
+
253
+ function toLocalPathSourceInput(msg: LocalPathSource): LocalPathSourceInput {
254
+ return {
255
+ path: msg.path || undefined,
256
+ };
257
+ }
258
+
259
+ function toWorkspaceSourceInput(msg: WorkspaceSource): WorkspaceSourceInput {
260
+ return {
261
+ gitRepo: msg.source?.case === "gitRepo" ? toGitRepoSourceInput(msg.source.value) : undefined,
262
+ localPath: msg.source?.case === "localPath" ? toLocalPathSourceInput(msg.source.value) : undefined,
263
+ };
264
+ }
265
+
266
+ function toWorkspaceEntryInput(msg: WorkspaceEntry): WorkspaceEntryInput {
267
+ return {
268
+ name: msg.name || undefined,
269
+ source: toWorkspaceSourceInput(msg.source ?? create(WorkspaceSourceSchema)),
270
+ };
271
+ }
272
+
273
+ function toRunConfigInput(msg: RunConfig): RunConfigInput {
274
+ return {
275
+ modelName: msg.modelName || undefined,
276
+ maxCostUsd: msg.maxCostUsd || undefined,
277
+ maxToolRounds: msg.maxToolRounds || undefined,
278
+ serviceTier: msg.serviceTier || undefined,
279
+ thinkingMode: msg.thinkingMode || undefined,
280
+ };
281
+ }
282
+
283
+ function toAgentInvocationInput(msg: AgentInvocation): AgentInvocationInput {
284
+ return {
285
+ agentRef: toResourceRefInput(msg.agentRef) ?? { org: "", slug: "" },
286
+ message: msg.message || undefined,
287
+ harness: msg.harness || undefined,
288
+ workspaceEntries: msg.workspaceEntries?.length ? msg.workspaceEntries.map(toWorkspaceEntryInput) : undefined,
289
+ environmentRefs: toResourceRefInputs(msg.environmentRefs),
290
+ runConfig: msg.runConfig ? toRunConfigInput(msg.runConfig) : undefined,
291
+ };
292
+ }
293
+
294
+ /**
295
+ * Maps a fetched {@link Schedule} to a complete {@link ScheduleInput} for `update()`.
296
+ *
297
+ * The update RPC replaces the ENTIRE spec — spread this mapper's output
298
+ * and override only the fields you edit (spread nested objects the same
299
+ * way):
300
+ *
301
+ * await client.update({ ...toScheduleUpdateInput(res), description: next });
302
+ *
303
+ * Proto3 defaults normalize to `undefined`; resource references keep
304
+ * `version` (pinned refs) and `kind`.
305
+ */
306
+ export function toScheduleUpdateInput(resource: Schedule): ScheduleInput {
307
+ const meta = resource.metadata;
308
+ const spec = resource.spec ?? create(ScheduleSpecSchema);
309
+ return {
310
+ // Exact update addressing (id-first in the update pipeline) — for
311
+ // platform-scoped (org-less) kinds the org+slug fallback cannot
312
+ // match, so the id is the ONLY working address.
313
+ id: meta?.id || undefined,
314
+ name: meta?.name ?? "",
315
+ slug: meta?.slug || undefined,
316
+ org: meta?.org ?? "",
317
+ labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
318
+ visibility: meta?.visibility || undefined,
319
+ cron: spec.cron || undefined,
320
+ timeZone: spec.timeZone || undefined,
321
+ enabled: spec.enabled || undefined,
322
+ agent: spec.target?.case === "agent" ? toAgentInvocationInput(spec.target.value) : undefined,
323
+ };
324
+ }
@@ -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
+ }