@stigmer/sdk 0.0.36 → 0.0.40

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 (136) hide show
  1. package/__tests__/config.test.d.ts +2 -0
  2. package/__tests__/config.test.d.ts.map +1 -0
  3. package/__tests__/config.test.js +35 -0
  4. package/__tests__/config.test.js.map +1 -0
  5. package/__tests__/errors.test.d.ts +2 -0
  6. package/__tests__/errors.test.d.ts.map +1 -0
  7. package/__tests__/errors.test.js +125 -0
  8. package/__tests__/errors.test.js.map +1 -0
  9. package/__tests__/gen/errors.test.d.ts +2 -0
  10. package/__tests__/gen/errors.test.d.ts.map +1 -0
  11. package/__tests__/gen/errors.test.js +97 -0
  12. package/__tests__/gen/errors.test.js.map +1 -0
  13. package/__tests__/gen/proto-utils.test.d.ts +2 -0
  14. package/__tests__/gen/proto-utils.test.d.ts.map +1 -0
  15. package/__tests__/gen/proto-utils.test.js +45 -0
  16. package/__tests__/gen/proto-utils.test.js.map +1 -0
  17. package/__tests__/gen/session-client.test.d.ts +2 -0
  18. package/__tests__/gen/session-client.test.d.ts.map +1 -0
  19. package/__tests__/gen/session-client.test.js +148 -0
  20. package/__tests__/gen/session-client.test.js.map +1 -0
  21. package/gen/agent.d.ts +6 -0
  22. package/gen/agent.d.ts.map +1 -1
  23. package/gen/agent.js +78 -8
  24. package/gen/agent.js.map +1 -1
  25. package/gen/agentexecution.d.ts +4 -1
  26. package/gen/agentexecution.d.ts.map +1 -1
  27. package/gen/agentexecution.js +55 -6
  28. package/gen/agentexecution.js.map +1 -1
  29. package/gen/agentinstance.d.ts +4 -1
  30. package/gen/agentinstance.d.ts.map +1 -1
  31. package/gen/agentinstance.js +17 -4
  32. package/gen/agentinstance.js.map +1 -1
  33. package/gen/apikey.d.ts +2 -0
  34. package/gen/apikey.d.ts.map +1 -1
  35. package/gen/apikey.js +5 -2
  36. package/gen/apikey.js.map +1 -1
  37. package/gen/environment.d.ts +8 -0
  38. package/gen/environment.d.ts.map +1 -1
  39. package/gen/environment.js +45 -5
  40. package/gen/environment.js.map +1 -1
  41. package/gen/executioncontext.d.ts +2 -0
  42. package/gen/executioncontext.d.ts.map +1 -1
  43. package/gen/executioncontext.js +13 -5
  44. package/gen/executioncontext.js.map +1 -1
  45. package/gen/iampolicy.d.ts +2 -1
  46. package/gen/iampolicy.d.ts.map +1 -1
  47. package/gen/iampolicy.js +17 -13
  48. package/gen/iampolicy.js.map +1 -1
  49. package/gen/identityaccount.d.ts +2 -0
  50. package/gen/identityaccount.d.ts.map +1 -1
  51. package/gen/identityaccount.js +8 -3
  52. package/gen/identityaccount.js.map +1 -1
  53. package/gen/identityprovider.d.ts +2 -0
  54. package/gen/identityprovider.d.ts.map +1 -1
  55. package/gen/identityprovider.js +7 -3
  56. package/gen/identityprovider.js.map +1 -1
  57. package/gen/mcpserver.d.ts +4 -0
  58. package/gen/mcpserver.d.ts.map +1 -1
  59. package/gen/mcpserver.js +58 -11
  60. package/gen/mcpserver.js.map +1 -1
  61. package/gen/organization.d.ts +3 -0
  62. package/gen/organization.d.ts.map +1 -1
  63. package/gen/organization.js +9 -3
  64. package/gen/organization.js.map +1 -1
  65. package/gen/project.d.ts +2 -0
  66. package/gen/project.d.ts.map +1 -1
  67. package/gen/project.js +9 -4
  68. package/gen/project.js.map +1 -1
  69. package/gen/proto-utils.d.ts +6 -0
  70. package/gen/proto-utils.d.ts.map +1 -0
  71. package/gen/proto-utils.js +15 -0
  72. package/gen/proto-utils.js.map +1 -0
  73. package/gen/session.d.ts +18 -1
  74. package/gen/session.d.ts.map +1 -1
  75. package/gen/session.js +62 -3
  76. package/gen/session.js.map +1 -1
  77. package/gen/skill.d.ts +6 -1
  78. package/gen/skill.d.ts.map +1 -1
  79. package/gen/skill.js +22 -3
  80. package/gen/skill.js.map +1 -1
  81. package/gen/workflow.d.ts +2 -0
  82. package/gen/workflow.d.ts.map +1 -1
  83. package/gen/workflow.js +55 -7
  84. package/gen/workflow.js.map +1 -1
  85. package/gen/workflowexecution.d.ts +2 -0
  86. package/gen/workflowexecution.d.ts.map +1 -1
  87. package/gen/workflowexecution.js +11 -3
  88. package/gen/workflowexecution.js.map +1 -1
  89. package/gen/workflowinstance.d.ts +3 -1
  90. package/gen/workflowinstance.d.ts.map +1 -1
  91. package/gen/workflowinstance.js +9 -4
  92. package/gen/workflowinstance.js.map +1 -1
  93. package/github.d.ts +38 -0
  94. package/github.d.ts.map +1 -0
  95. package/github.js +51 -0
  96. package/github.js.map +1 -0
  97. package/index.d.ts +2 -0
  98. package/index.d.ts.map +1 -1
  99. package/index.js +4 -0
  100. package/index.js.map +1 -1
  101. package/package.json +2 -2
  102. package/session.d.ts +31 -0
  103. package/session.d.ts.map +1 -0
  104. package/session.js +36 -0
  105. package/session.js.map +1 -0
  106. package/src/__tests__/config.test.ts +52 -0
  107. package/src/__tests__/errors.test.ts +188 -0
  108. package/src/__tests__/gen/errors.test.ts +138 -0
  109. package/src/__tests__/gen/proto-utils.test.ts +53 -0
  110. package/src/__tests__/gen/session-client.test.ts +202 -0
  111. package/src/gen/agent.ts +73 -10
  112. package/src/gen/agentexecution.ts +55 -7
  113. package/src/gen/agentinstance.ts +18 -5
  114. package/src/gen/apikey.ts +7 -2
  115. package/src/gen/environment.ts +41 -5
  116. package/src/gen/executioncontext.ts +16 -5
  117. package/src/gen/iampolicy.ts +19 -10
  118. package/src/gen/identityaccount.ts +10 -3
  119. package/src/gen/identityprovider.ts +9 -3
  120. package/src/gen/mcpserver.ts +61 -12
  121. package/src/gen/organization.ts +12 -4
  122. package/src/gen/project.ts +11 -4
  123. package/src/gen/proto-utils.ts +15 -0
  124. package/src/gen/session.ts +82 -4
  125. package/src/gen/skill.ts +22 -5
  126. package/src/gen/workflow.ts +56 -7
  127. package/src/gen/workflowexecution.ts +14 -3
  128. package/src/gen/workflowinstance.ts +12 -5
  129. package/src/github.ts +89 -0
  130. package/src/index.ts +12 -0
  131. package/src/session.ts +37 -0
  132. package/src/stigmer.ts +3 -0
  133. package/stigmer.d.ts +2 -0
  134. package/stigmer.d.ts.map +1 -1
  135. package/stigmer.js +3 -0
  136. package/stigmer.js.map +1 -1
package/src/gen/agent.ts CHANGED
@@ -1,16 +1,18 @@
1
1
  // Code generated by stigmer-codegen. DO NOT EDIT.
2
2
 
3
3
  import { wrapError } from "./errors";
4
+ import { stripUndefined } from "./proto-utils";
4
5
  import { type ListParams, type ListResult, type EnvSpecInput, type ResourceRef } from "./types";
5
6
  import { create } from "@bufbuild/protobuf";
6
7
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
7
8
  import { AgentSchema, type Agent } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
8
9
  import { AgentCommandController } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/command_pb";
9
- import { AgentIdSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/io_pb";
10
+ import { AgentIdSchema, GetDefaultAgentRequestSchema, type GetDefaultAgentRequest } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/io_pb";
10
11
  import { AgentQueryController } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/query_pb";
11
- import { AgentSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
12
+ import { AgentSpecSchema, ToolApprovalOverrideSchema, McpServerUsageSchema, McpAccessSchema, SubAgentSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
13
+ import { EnvironmentSpecSchema, EnvironmentValueSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
12
14
  import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
13
- import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
15
+ import { ApiResourceReferenceSchema, type UpdateVisibilityInput } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
14
16
  import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
15
17
  import { PageInfoSchema } from "@stigmer/protos/ai/stigmer/commons/rpc/pagination_pb";
16
18
  import { SearchRequestSchema } from "@stigmer/protos/ai/stigmer/search/v1/io_pb";
@@ -46,6 +48,12 @@ export class AgentClient {
46
48
  } catch (e) { throw wrapError(e); }
47
49
  }
48
50
 
51
+ async updateVisibility(input: UpdateVisibilityInput): Promise<Agent> {
52
+ try {
53
+ return await this.command.updateVisibility(input);
54
+ } catch (e) { throw wrapError(e); }
55
+ }
56
+
49
57
  async delete(id: string): Promise<Agent> {
50
58
  try {
51
59
  return await this.command.delete(create(AgentIdSchema, { value: id }));
@@ -60,7 +68,13 @@ export class AgentClient {
60
68
 
61
69
  async getByReference(ref: ResourceRef): Promise<Agent> {
62
70
  try {
63
- return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
71
+ return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.agent }));
72
+ } catch (e) { throw wrapError(e); }
73
+ }
74
+
75
+ async getDefault(input: GetDefaultAgentRequest): Promise<Agent> {
76
+ try {
77
+ return await this.query.getDefault(input);
64
78
  } catch (e) { throw wrapError(e); }
65
79
  }
66
80
 
@@ -85,7 +99,9 @@ export class AgentClient {
85
99
  /** Input for creating/updating a Agent. */
86
100
  export interface AgentInput {
87
101
  name: string;
102
+ slug?: string;
88
103
  org: string;
104
+ labels?: Record<string, string>;
89
105
  description?: string;
90
106
  iconUrl?: string;
91
107
  instructions?: string;
@@ -125,22 +141,69 @@ export interface McpAccessInput {
125
141
  enabledTools?: string[];
126
142
  }
127
143
 
144
+ function buildToolApprovalOverrideProto(input: ToolApprovalOverrideInput) {
145
+ return Object.assign(create(ToolApprovalOverrideSchema), stripUndefined({
146
+ toolName: input.toolName,
147
+ requiresApproval: input.requiresApproval,
148
+ message: input.message,
149
+ }));
150
+ }
151
+
152
+ function buildMcpServerUsageProto(input: McpServerUsageInput) {
153
+ const msg = create(McpServerUsageSchema);
154
+ if (input.mcpServerRef) msg.mcpServerRef = create(ApiResourceReferenceSchema, input.mcpServerRef);
155
+ if (input.enabledTools) msg.enabledTools = input.enabledTools;
156
+ if (input.toolApprovalOverrides) msg.toolApprovalOverrides = input.toolApprovalOverrides.map(buildToolApprovalOverrideProto);
157
+ return msg;
158
+ }
159
+
160
+ function buildMcpAccessProto(input: McpAccessInput) {
161
+ return Object.assign(create(McpAccessSchema), stripUndefined({
162
+ mcpServer: input.mcpServer,
163
+ enabledTools: input.enabledTools,
164
+ }));
165
+ }
166
+
167
+ function buildSubAgentProto(input: SubAgentInput) {
168
+ const msg = create(SubAgentSchema);
169
+ if (input.name !== undefined) msg.name = input.name;
170
+ if (input.description !== undefined) msg.description = input.description;
171
+ if (input.instructions !== undefined) msg.instructions = input.instructions;
172
+ if (input.mcpAccess) msg.mcpAccess = input.mcpAccess.map(buildMcpAccessProto);
173
+ if (input.skillRefs) msg.skillRefs = input.skillRefs.map(r => create(ApiResourceReferenceSchema, r));
174
+ if (input.modelOverride !== undefined) msg.modelOverride = input.modelOverride;
175
+ return msg;
176
+ }
177
+
128
178
  function buildAgentProto(input: AgentInput): Agent {
179
+ const mcpServerUsages = input.mcpServerUsages?.map(buildMcpServerUsageProto);
180
+ const skillRefs = input.skillRefs?.map(r => create(ApiResourceReferenceSchema, r));
181
+ const subAgents = input.subAgents?.map(buildSubAgentProto);
182
+ let envSpec;
183
+ if (input.envSpec) {
184
+ const es = create(EnvironmentSpecSchema);
185
+ for (const [k, v] of Object.entries(input.envSpec.variables)) {
186
+ es.data[k] = create(EnvironmentValueSchema, { value: v.value, isSecret: v.isSecret, description: v.description });
187
+ }
188
+ envSpec = es;
189
+ }
129
190
  return Object.assign(create(AgentSchema), {
130
191
  apiVersion: "agentic.stigmer.ai/v1",
131
192
  kind: "Agent",
132
193
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
133
194
  name: input.name,
134
195
  org: input.org,
196
+ ...(input.slug && { slug: input.slug }),
197
+ ...(input.labels && { labels: input.labels }),
135
198
  }),
136
- spec: Object.assign(create(AgentSpecSchema), {
199
+ spec: Object.assign(create(AgentSpecSchema), stripUndefined({
137
200
  description: input.description,
138
201
  iconUrl: input.iconUrl,
139
202
  instructions: input.instructions,
140
- mcpServerUsages: input.mcpServerUsages,
141
- skillRefs: input.skillRefs,
142
- subAgents: input.subAgents,
143
- envSpec: input.envSpec,
144
- }),
203
+ mcpServerUsages,
204
+ skillRefs,
205
+ subAgents,
206
+ envSpec,
207
+ })),
145
208
  }) as Agent;
146
209
  }
@@ -1,14 +1,16 @@
1
1
  // Code generated by stigmer-codegen. DO NOT EDIT.
2
2
 
3
3
  import { wrapError } from "./errors";
4
+ import { stripUndefined } from "./proto-utils";
4
5
  import { type EnvVarInput } from "./types";
5
6
  import { create } from "@bufbuild/protobuf";
6
7
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
7
8
  import { AgentExecutionSchema, type AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
8
9
  import { AgentExecutionCommandController } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/command_pb";
9
- import { AgentExecutionIdSchema, AgentExecutionUpdateStatusInputSchema, SubmitApprovalInputSchema, CancelAgentExecutionInputSchema, TerminateAgentExecutionInputSchema, RecoverAgentExecutionInputSchema, PauseAgentExecutionInputSchema, ResumeAgentExecutionInputSchema, UploadAttachmentRequestSchema, UploadAttachmentResponseSchema, ListAgentExecutionsRequestSchema, AgentExecutionListSchema, ListAgentExecutionsBySessionRequestSchema, GetArtifactDownloadUrlRequestSchema, GetArtifactDownloadUrlResponseSchema, GetSessionUsageReportInputSchema, GetSessionUsageReportOutputSchema, GetAgentUsageReportInputSchema, GetAgentUsageReportOutputSchema, GetOrgUsageReportInputSchema, GetOrgUsageReportOutputSchema, type AgentExecutionUpdateStatusInput, type SubmitApprovalInput, 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 GetSessionUsageReportInput, type GetSessionUsageReportOutput, type GetAgentUsageReportInput, type GetAgentUsageReportOutput, type GetOrgUsageReportInput, type GetOrgUsageReportOutput } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/io_pb";
10
+ import { AgentExecutionIdSchema, AgentExecutionUpdateStatusInputSchema, SubmitApprovalInputSchema, CancelAgentExecutionInputSchema, TerminateAgentExecutionInputSchema, RecoverAgentExecutionInputSchema, PauseAgentExecutionInputSchema, ResumeAgentExecutionInputSchema, UploadAttachmentRequestSchema, UploadAttachmentResponseSchema, ListAgentExecutionsRequestSchema, AgentExecutionListSchema, ListAgentExecutionsBySessionRequestSchema, GetArtifactDownloadUrlRequestSchema, GetArtifactDownloadUrlResponseSchema, GetArtifactContentRequestSchema, GetArtifactContentResponseSchema, GetSessionUsageReportInputSchema, GetSessionUsageReportOutputSchema, GetAgentUsageReportInputSchema, GetAgentUsageReportOutputSchema, GetOrgUsageReportInputSchema, GetOrgUsageReportOutputSchema, type AgentExecutionUpdateStatusInput, type SubmitApprovalInput, 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 GetSessionUsageReportInput, type GetSessionUsageReportOutput, type GetAgentUsageReportInput, type GetAgentUsageReportOutput, type GetOrgUsageReportInput, type GetOrgUsageReportOutput } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/io_pb";
10
11
  import { AgentExecutionQueryController } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/query_pb";
11
- import { AgentExecutionSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
12
+ import { AgentExecutionSpecSchema, ContextManagementConfigSchema, ExecutionConfigSchema, AttachmentSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
13
+ import { ExecutionValueSchema } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
12
14
  import { ApiResourceIdSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
13
15
  import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
14
16
 
@@ -120,6 +122,12 @@ export class AgentExecutionClient {
120
122
  } catch (e) { throw wrapError(e); }
121
123
  }
122
124
 
125
+ async getArtifactContent(input: GetArtifactContentRequest): Promise<GetArtifactContentResponse> {
126
+ try {
127
+ return await this.query.getArtifactContent(input);
128
+ } catch (e) { throw wrapError(e); }
129
+ }
130
+
123
131
  async getSessionUsageReport(input: GetSessionUsageReportInput): Promise<GetSessionUsageReportOutput> {
124
132
  try {
125
133
  return await this.query.getSessionUsageReport(input);
@@ -142,7 +150,9 @@ export class AgentExecutionClient {
142
150
  /** Input for creating/updating a AgentExecution. */
143
151
  export interface AgentExecutionInput {
144
152
  name: string;
153
+ slug?: string;
145
154
  org: string;
155
+ labels?: Record<string, string>;
146
156
  sessionId?: string;
147
157
  agentId?: string;
148
158
  message?: string;
@@ -181,25 +191,63 @@ export interface AttachmentInput {
181
191
  localPath?: string;
182
192
  }
183
193
 
194
+ function buildContextManagementConfigProto(input: ContextManagementConfigInput) {
195
+ return Object.assign(create(ContextManagementConfigSchema), stripUndefined({
196
+ disableSummarization: input.disableSummarization,
197
+ customTriggerThreshold: input.customTriggerThreshold,
198
+ customTargetTokens: input.customTargetTokens,
199
+ }));
200
+ }
201
+
202
+ function buildExecutionConfigProto(input: ExecutionConfigInput) {
203
+ const msg = create(ExecutionConfigSchema);
204
+ if (input.modelName !== undefined) msg.modelName = input.modelName;
205
+ if (input.contextManagement) msg.contextManagement = buildContextManagementConfigProto(input.contextManagement);
206
+ if (input.maxToolRounds !== undefined) msg.maxToolRounds = input.maxToolRounds;
207
+ if (input.maxToolResultChars !== undefined) msg.maxToolResultChars = input.maxToolResultChars;
208
+ if (input.maxCostUsd !== undefined) msg.maxCostUsd = input.maxCostUsd;
209
+ return msg;
210
+ }
211
+
212
+ function buildAttachmentProto(input: AttachmentInput) {
213
+ return Object.assign(create(AttachmentSchema), stripUndefined({
214
+ filename: input.filename,
215
+ storageKey: input.storageKey,
216
+ mountPath: input.mountPath,
217
+ contentType: input.contentType,
218
+ extract: input.extract,
219
+ localPath: input.localPath,
220
+ }));
221
+ }
222
+
184
223
  function buildAgentExecutionProto(input: AgentExecutionInput): AgentExecution {
224
+ const executionConfig = input.executionConfig ? buildExecutionConfigProto(input.executionConfig) : undefined;
225
+ let runtimeEnv;
226
+ if (input.runtimeEnv) {
227
+ runtimeEnv = Object.fromEntries(Object.entries(input.runtimeEnv).map(([k, v]) =>
228
+ [k, create(ExecutionValueSchema, { value: v.value, isSecret: v.isSecret })]));
229
+ }
230
+ const attachments = input.attachments?.map(buildAttachmentProto);
185
231
  return Object.assign(create(AgentExecutionSchema), {
186
232
  apiVersion: "agentic.stigmer.ai/v1",
187
233
  kind: "AgentExecution",
188
234
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
189
235
  name: input.name,
190
236
  org: input.org,
237
+ ...(input.slug && { slug: input.slug }),
238
+ ...(input.labels && { labels: input.labels }),
191
239
  }),
192
- spec: Object.assign(create(AgentExecutionSpecSchema), {
240
+ spec: Object.assign(create(AgentExecutionSpecSchema), stripUndefined({
193
241
  sessionId: input.sessionId,
194
242
  agentId: input.agentId,
195
243
  message: input.message,
196
- executionConfig: input.executionConfig,
197
- runtimeEnv: input.runtimeEnv,
244
+ executionConfig,
245
+ runtimeEnv,
198
246
  callbackToken: input.callbackToken,
199
247
  autoApproveAll: input.autoApproveAll,
200
248
  parentWorkflowId: input.parentWorkflowId,
201
- attachments: input.attachments,
249
+ attachments,
202
250
  workspaceFileRefs: input.workspaceFileRefs,
203
- }),
251
+ })),
204
252
  }) as AgentExecution;
205
253
  }
@@ -1,14 +1,16 @@
1
1
  // Code generated by stigmer-codegen. DO NOT EDIT.
2
2
 
3
3
  import { wrapError } from "./errors";
4
+ import { stripUndefined } from "./proto-utils";
4
5
  import { type ResourceRef } from "./types";
5
6
  import { create } from "@bufbuild/protobuf";
6
7
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
7
8
  import { AgentInstanceSchema, type AgentInstance } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/api_pb";
8
9
  import { AgentInstanceCommandController } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/command_pb";
9
- import { AgentInstanceIdSchema, GetAgentInstancesByAgentRequestSchema, AgentInstanceListSchema, type GetAgentInstancesByAgentRequest, type AgentInstanceList } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/io_pb";
10
+ import { AgentInstanceIdSchema, GetAgentInstancesByAgentRequestSchema, AgentInstanceListSchema, ListAgentInstancesRequestSchema, type GetAgentInstancesByAgentRequest, type AgentInstanceList, type ListAgentInstancesRequest } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/io_pb";
10
11
  import { AgentInstanceQueryController } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/query_pb";
11
12
  import { AgentInstanceSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/spec_pb";
13
+ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
12
14
  import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
13
15
  import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
14
16
 
@@ -60,7 +62,13 @@ export class AgentInstanceClient {
60
62
 
61
63
  async getByReference(ref: ResourceRef): Promise<AgentInstance> {
62
64
  try {
63
- return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
65
+ return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.agent_instance }));
66
+ } catch (e) { throw wrapError(e); }
67
+ }
68
+
69
+ async list(input: ListAgentInstancesRequest): Promise<AgentInstanceList> {
70
+ try {
71
+ return await this.query.list(input);
64
72
  } catch (e) { throw wrapError(e); }
65
73
  }
66
74
  }
@@ -68,24 +76,29 @@ export class AgentInstanceClient {
68
76
  /** Input for creating/updating a AgentInstance. */
69
77
  export interface AgentInstanceInput {
70
78
  name: string;
79
+ slug?: string;
71
80
  org: string;
81
+ labels?: Record<string, string>;
72
82
  agentId?: string;
73
83
  description?: string;
74
84
  environmentRefs?: ResourceRef[];
75
85
  }
76
86
 
77
87
  function buildAgentInstanceProto(input: AgentInstanceInput): AgentInstance {
88
+ const environmentRefs = input.environmentRefs?.map(r => create(ApiResourceReferenceSchema, r));
78
89
  return Object.assign(create(AgentInstanceSchema), {
79
90
  apiVersion: "agentic.stigmer.ai/v1",
80
91
  kind: "AgentInstance",
81
92
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
82
93
  name: input.name,
83
94
  org: input.org,
95
+ ...(input.slug && { slug: input.slug }),
96
+ ...(input.labels && { labels: input.labels }),
84
97
  }),
85
- spec: Object.assign(create(AgentInstanceSpecSchema), {
98
+ spec: Object.assign(create(AgentInstanceSpecSchema), stripUndefined({
86
99
  agentId: input.agentId,
87
100
  description: input.description,
88
- environmentRefs: input.environmentRefs,
89
- }),
101
+ environmentRefs,
102
+ })),
90
103
  }) as AgentInstance;
91
104
  }
package/src/gen/apikey.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // Code generated by stigmer-codegen. DO NOT EDIT.
2
2
 
3
3
  import { wrapError } from "./errors";
4
+ import { stripUndefined } from "./proto-utils";
4
5
  import { create } from "@bufbuild/protobuf";
5
6
  import { EmptySchema } from "@bufbuild/protobuf/wkt";
6
7
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
@@ -61,7 +62,9 @@ export class ApiKeyClient {
61
62
  /** Input for creating/updating a ApiKey. */
62
63
  export interface ApiKeyInput {
63
64
  name: string;
65
+ slug?: string;
64
66
  org: string;
67
+ labels?: Record<string, string>;
65
68
  keyHash?: string;
66
69
  fingerprint?: string;
67
70
  expiresAt?: Date | string;
@@ -75,12 +78,14 @@ function buildApiKeyProto(input: ApiKeyInput): ApiKey {
75
78
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
76
79
  name: input.name,
77
80
  org: input.org,
81
+ ...(input.slug && { slug: input.slug }),
82
+ ...(input.labels && { labels: input.labels }),
78
83
  }),
79
- spec: Object.assign(create(ApiKeySpecSchema), {
84
+ spec: Object.assign(create(ApiKeySpecSchema), stripUndefined({
80
85
  keyHash: input.keyHash,
81
86
  fingerprint: input.fingerprint,
82
87
  expiresAt: input.expiresAt,
83
88
  neverExpires: input.neverExpires,
84
- }),
89
+ })),
85
90
  }) as ApiKey;
86
91
  }
@@ -1,13 +1,16 @@
1
1
  // Code generated by stigmer-codegen. DO NOT EDIT.
2
2
 
3
3
  import { wrapError } from "./errors";
4
+ import { stripUndefined } from "./proto-utils";
4
5
  import { type DeleteResourceInput, type ResourceRef, type EnvVarInput } from "./types";
5
6
  import { create } from "@bufbuild/protobuf";
6
7
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
7
8
  import { EnvironmentSchema, type Environment } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/api_pb";
8
9
  import { EnvironmentCommandController } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/command_pb";
10
+ import { UpdateEnvironmentVariablesRequestSchema, RemoveEnvironmentVariablesRequestSchema, EnvironmentSecretValueInputSchema, ListEnvironmentsRequestSchema, EnvironmentListSchema, type UpdateEnvironmentVariablesRequest, type RemoveEnvironmentVariablesRequest, type EnvironmentSecretValueInput, type ListEnvironmentsRequest, type EnvironmentList } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/io_pb";
9
11
  import { EnvironmentQueryController } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/query_pb";
10
- import { EnvironmentSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
12
+ import { EnvironmentValueSchema, EnvironmentSpecSchema, type EnvironmentValue } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
13
+ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
11
14
  import { ApiResourceIdSchema, ApiResourceReferenceSchema, ApiResourceDeleteInputSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
12
15
  import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
13
16
 
@@ -49,6 +52,18 @@ export class EnvironmentClient {
49
52
  } catch (e) { throw wrapError(e); }
50
53
  }
51
54
 
55
+ async updateVariables(input: UpdateEnvironmentVariablesRequest): Promise<Environment> {
56
+ try {
57
+ return await this.command.updateVariables(input);
58
+ } catch (e) { throw wrapError(e); }
59
+ }
60
+
61
+ async removeVariables(input: RemoveEnvironmentVariablesRequest): Promise<Environment> {
62
+ try {
63
+ return await this.command.removeVariables(input);
64
+ } catch (e) { throw wrapError(e); }
65
+ }
66
+
52
67
  async get(id: string): Promise<Environment> {
53
68
  try {
54
69
  return await this.query.get(create(ApiResourceIdSchema, { value: id }));
@@ -57,7 +72,19 @@ export class EnvironmentClient {
57
72
 
58
73
  async getByReference(ref: ResourceRef): Promise<Environment> {
59
74
  try {
60
- return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
75
+ return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.environment }));
76
+ } catch (e) { throw wrapError(e); }
77
+ }
78
+
79
+ async getSecretValue(input: EnvironmentSecretValueInput): Promise<EnvironmentValue> {
80
+ try {
81
+ return await this.query.getSecretValue(input);
82
+ } catch (e) { throw wrapError(e); }
83
+ }
84
+
85
+ async list(input: ListEnvironmentsRequest): Promise<EnvironmentList> {
86
+ try {
87
+ return await this.query.list(input);
61
88
  } catch (e) { throw wrapError(e); }
62
89
  }
63
90
  }
@@ -65,22 +92,31 @@ export class EnvironmentClient {
65
92
  /** Input for creating/updating a Environment. */
66
93
  export interface EnvironmentInput {
67
94
  name: string;
95
+ slug?: string;
68
96
  org: string;
97
+ labels?: Record<string, string>;
69
98
  description?: string;
70
99
  data?: Record<string, EnvVarInput>;
71
100
  }
72
101
 
73
102
  function buildEnvironmentProto(input: EnvironmentInput): Environment {
103
+ let data;
104
+ if (input.data) {
105
+ data = Object.fromEntries(Object.entries(input.data).map(([k, v]) =>
106
+ [k, create(EnvironmentValueSchema, { value: v.value, isSecret: v.isSecret, description: v.description })]));
107
+ }
74
108
  return Object.assign(create(EnvironmentSchema), {
75
109
  apiVersion: "agentic.stigmer.ai/v1",
76
110
  kind: "Environment",
77
111
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
78
112
  name: input.name,
79
113
  org: input.org,
114
+ ...(input.slug && { slug: input.slug }),
115
+ ...(input.labels && { labels: input.labels }),
80
116
  }),
81
- spec: Object.assign(create(EnvironmentSpecSchema), {
117
+ spec: Object.assign(create(EnvironmentSpecSchema), stripUndefined({
82
118
  description: input.description,
83
- data: input.data,
84
- }),
119
+ data,
120
+ })),
85
121
  }) as Environment;
86
122
  }
@@ -1,6 +1,7 @@
1
1
  // Code generated by stigmer-codegen. DO NOT EDIT.
2
2
 
3
3
  import { wrapError } from "./errors";
4
+ import { stripUndefined } from "./proto-utils";
4
5
  import { type DeleteResourceInput, type ResourceRef, type EnvVarInput } from "./types";
5
6
  import { create } from "@bufbuild/protobuf";
6
7
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
@@ -8,7 +9,8 @@ import { ExecutionContextSchema, type ExecutionContext } from "@stigmer/protos/a
8
9
  import { ExecutionContextCommandController } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/command_pb";
9
10
  import { ExecutionContextIdSchema, ExecutionContextExecutionIdInputSchema, type ExecutionContextExecutionIdInput } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/io_pb";
10
11
  import { ExecutionContextQueryController } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/query_pb";
11
- import { ExecutionContextSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
12
+ import { ExecutionContextSpecSchema, ExecutionValueSchema } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
13
+ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
12
14
  import { ApiResourceReferenceSchema, ApiResourceDeleteInputSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
13
15
  import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
14
16
 
@@ -52,7 +54,7 @@ export class ExecutionContextClient {
52
54
 
53
55
  async getByReference(ref: ResourceRef): Promise<ExecutionContext> {
54
56
  try {
55
- return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
57
+ return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.execution_context }));
56
58
  } catch (e) { throw wrapError(e); }
57
59
  }
58
60
 
@@ -66,22 +68,31 @@ export class ExecutionContextClient {
66
68
  /** Input for creating/updating a ExecutionContext. */
67
69
  export interface ExecutionContextInput {
68
70
  name: string;
71
+ slug?: string;
69
72
  org: string;
73
+ labels?: Record<string, string>;
70
74
  executionId?: string;
71
75
  data?: Record<string, EnvVarInput>;
72
76
  }
73
77
 
74
78
  function buildExecutionContextProto(input: ExecutionContextInput): ExecutionContext {
79
+ let data;
80
+ if (input.data) {
81
+ data = Object.fromEntries(Object.entries(input.data).map(([k, v]) =>
82
+ [k, create(ExecutionValueSchema, { value: v.value, isSecret: v.isSecret })]));
83
+ }
75
84
  return Object.assign(create(ExecutionContextSchema), {
76
85
  apiVersion: "agentic.stigmer.ai/v1",
77
86
  kind: "ExecutionContext",
78
87
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
79
88
  name: input.name,
80
89
  org: input.org,
90
+ ...(input.slug && { slug: input.slug }),
91
+ ...(input.labels && { labels: input.labels }),
81
92
  }),
82
- spec: Object.assign(create(ExecutionContextSpecSchema), {
93
+ spec: Object.assign(create(ExecutionContextSpecSchema), stripUndefined({
83
94
  executionId: input.executionId,
84
- data: input.data,
85
- }),
95
+ data,
96
+ })),
86
97
  }) as ExecutionContext;
87
98
  }
@@ -1,6 +1,7 @@
1
1
  // Code generated by stigmer-codegen. DO NOT EDIT.
2
2
 
3
3
  import { wrapError } from "./errors";
4
+ import { stripUndefined } from "./proto-utils";
4
5
  import { create } from "@bufbuild/protobuf";
5
6
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
6
7
  import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
@@ -32,12 +33,6 @@ export class IamPolicyClient {
32
33
  } catch (e) { throw wrapError(e); }
33
34
  }
34
35
 
35
- async createPlatformLink(input: IamPolicySpec): Promise<IamPolicy> {
36
- try {
37
- return await this.command.createPlatformLink(input);
38
- } catch (e) { throw wrapError(e); }
39
- }
40
-
41
36
  async bootstrapPolicy(input: IamPolicySpec): Promise<IamPolicy> {
42
37
  try {
43
38
  return await this.command.bootstrapPolicy(input);
@@ -78,7 +73,9 @@ export class IamPolicyClient {
78
73
  /** Input for creating/updating a IamPolicy. */
79
74
  export interface IamPolicyInput {
80
75
  name: string;
76
+ slug?: string;
81
77
  org: string;
78
+ labels?: Record<string, string>;
82
79
  principal: ApiResourceRefInput;
83
80
  resource: ApiResourceRefInput;
84
81
  relation: string;
@@ -91,18 +88,30 @@ export interface ApiResourceRefInput {
91
88
  relation?: string;
92
89
  }
93
90
 
91
+ function buildApiResourceRefProto(input: ApiResourceRefInput) {
92
+ return Object.assign(create(ApiResourceRefSchema), stripUndefined({
93
+ kind: input.kind,
94
+ id: input.id,
95
+ relation: input.relation,
96
+ }));
97
+ }
98
+
94
99
  function buildIamPolicyProto(input: IamPolicyInput): IamPolicy {
100
+ const principal = input.principal ? buildApiResourceRefProto(input.principal) : undefined;
101
+ const resource = input.resource ? buildApiResourceRefProto(input.resource) : undefined;
95
102
  return Object.assign(create(IamPolicySchema), {
96
103
  apiVersion: "iam.stigmer.ai/v1",
97
104
  kind: "IamPolicy",
98
105
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
99
106
  name: input.name,
100
107
  org: input.org,
108
+ ...(input.slug && { slug: input.slug }),
109
+ ...(input.labels && { labels: input.labels }),
101
110
  }),
102
- spec: Object.assign(create(IamPolicySpecSchema), {
103
- principal: input.principal,
104
- resource: input.resource,
111
+ spec: Object.assign(create(IamPolicySpecSchema), stripUndefined({
112
+ principal,
113
+ resource,
105
114
  relation: input.relation,
106
- }),
115
+ })),
107
116
  }) as IamPolicy;
108
117
  }
@@ -1,10 +1,12 @@
1
1
  // Code generated by stigmer-codegen. DO NOT EDIT.
2
2
 
3
3
  import { wrapError } from "./errors";
4
+ import { stripUndefined } from "./proto-utils";
4
5
  import { type ResourceRef } from "./types";
5
6
  import { create } from "@bufbuild/protobuf";
6
7
  import { EmptySchema } from "@bufbuild/protobuf/wkt";
7
8
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
9
+ import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
8
10
  import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
9
11
  import { type ApiResourceAuditActor } from "@stigmer/protos/ai/stigmer/commons/apiresource/status_pb";
10
12
  import { IdentityAccountSchema, type IdentityAccount } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/api_pb";
@@ -82,7 +84,9 @@ export class IdentityAccountClient {
82
84
  /** Input for creating/updating a IdentityAccount. */
83
85
  export interface IdentityAccountInput {
84
86
  name: string;
87
+ slug?: string;
85
88
  org: string;
89
+ labels?: Record<string, string>;
86
90
  idpId: string;
87
91
  email?: string;
88
92
  firstName?: string;
@@ -94,14 +98,17 @@ export interface IdentityAccountInput {
94
98
  }
95
99
 
96
100
  function buildIdentityAccountProto(input: IdentityAccountInput): IdentityAccount {
101
+ const identityProviderRef = input.identityProviderRef ? create(ApiResourceReferenceSchema, input.identityProviderRef) : undefined;
97
102
  return Object.assign(create(IdentityAccountSchema), {
98
103
  apiVersion: "iam.stigmer.ai/v1",
99
104
  kind: "IdentityAccount",
100
105
  metadata: Object.assign(create(ApiResourceMetadataSchema), {
101
106
  name: input.name,
102
107
  org: input.org,
108
+ ...(input.slug && { slug: input.slug }),
109
+ ...(input.labels && { labels: input.labels }),
103
110
  }),
104
- spec: Object.assign(create(IdentityAccountSpecSchema), {
111
+ spec: Object.assign(create(IdentityAccountSpecSchema), stripUndefined({
105
112
  idpId: input.idpId,
106
113
  email: input.email,
107
114
  firstName: input.firstName,
@@ -109,7 +116,7 @@ function buildIdentityAccountProto(input: IdentityAccountInput): IdentityAccount
109
116
  pictureUrl: input.pictureUrl,
110
117
  isMachineAccount: input.isMachineAccount,
111
118
  provisioningMode: input.provisioningMode,
112
- identityProviderRef: input.identityProviderRef,
113
- }),
119
+ identityProviderRef,
120
+ })),
114
121
  }) as IdentityAccount;
115
122
  }