@stigmer/sdk 1.0.4 → 2.0.0

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 (170) hide show
  1. package/__tests__/gen/invitation-client.test.d.ts +2 -0
  2. package/__tests__/gen/invitation-client.test.d.ts.map +1 -0
  3. package/__tests__/gen/invitation-client.test.js +106 -0
  4. package/__tests__/gen/invitation-client.test.js.map +1 -0
  5. package/__tests__/gen/proto-utils.test.js +41 -1
  6. package/__tests__/gen/proto-utils.test.js.map +1 -1
  7. package/__tests__/gen/session-client.test.js +10 -6
  8. package/__tests__/gen/session-client.test.js.map +1 -1
  9. package/__tests__/stigmer.test.d.ts +2 -0
  10. package/__tests__/stigmer.test.d.ts.map +1 -0
  11. package/__tests__/stigmer.test.js +94 -0
  12. package/__tests__/stigmer.test.js.map +1 -0
  13. package/activity.d.ts +26 -0
  14. package/activity.d.ts.map +1 -0
  15. package/activity.js +30 -0
  16. package/activity.js.map +1 -0
  17. package/billing.d.ts +9 -2
  18. package/billing.d.ts.map +1 -1
  19. package/billing.js +1 -0
  20. package/billing.js.map +1 -1
  21. package/config.d.ts +19 -0
  22. package/config.d.ts.map +1 -1
  23. package/config.js.map +1 -1
  24. package/gen/agent.d.ts +2 -0
  25. package/gen/agent.d.ts.map +1 -1
  26. package/gen/agent.js +1 -0
  27. package/gen/agent.js.map +1 -1
  28. package/gen/agentexecution.d.ts +7 -0
  29. package/gen/agentexecution.d.ts.map +1 -1
  30. package/gen/agentexecution.js +6 -0
  31. package/gen/agentexecution.js.map +1 -1
  32. package/gen/agentinstance.d.ts +4 -0
  33. package/gen/agentinstance.d.ts.map +1 -1
  34. package/gen/agentinstance.js +9 -0
  35. package/gen/agentinstance.js.map +1 -1
  36. package/gen/apikey.d.ts +2 -0
  37. package/gen/apikey.d.ts.map +1 -1
  38. package/gen/apikey.js +4 -2
  39. package/gen/apikey.js.map +1 -1
  40. package/gen/artifact.d.ts +2 -0
  41. package/gen/artifact.d.ts.map +1 -1
  42. package/gen/artifact.js +1 -0
  43. package/gen/artifact.js.map +1 -1
  44. package/gen/authorization-config.d.ts.map +1 -1
  45. package/gen/authorization-config.js +0 -1
  46. package/gen/authorization-config.js.map +1 -1
  47. package/gen/client.d.ts +0 -4
  48. package/gen/client.d.ts.map +1 -1
  49. package/gen/client.js +0 -4
  50. package/gen/client.js.map +1 -1
  51. package/gen/environment.d.ts +2 -0
  52. package/gen/environment.d.ts.map +1 -1
  53. package/gen/environment.js +1 -0
  54. package/gen/environment.js.map +1 -1
  55. package/gen/executioncontext.d.ts +2 -0
  56. package/gen/executioncontext.d.ts.map +1 -1
  57. package/gen/executioncontext.js +1 -0
  58. package/gen/executioncontext.js.map +1 -1
  59. package/gen/iampolicy.d.ts +2 -0
  60. package/gen/iampolicy.d.ts.map +1 -1
  61. package/gen/iampolicy.js +1 -0
  62. package/gen/iampolicy.js.map +1 -1
  63. package/gen/identityaccount.d.ts +2 -0
  64. package/gen/identityaccount.d.ts.map +1 -1
  65. package/gen/identityaccount.js +1 -0
  66. package/gen/identityaccount.js.map +1 -1
  67. package/gen/identityprovider.d.ts +2 -0
  68. package/gen/identityprovider.d.ts.map +1 -1
  69. package/gen/identityprovider.js +1 -0
  70. package/gen/identityprovider.js.map +1 -1
  71. package/gen/invitation.d.ts +2 -0
  72. package/gen/invitation.d.ts.map +1 -1
  73. package/gen/invitation.js +4 -2
  74. package/gen/invitation.js.map +1 -1
  75. package/gen/mcpserver.d.ts +2 -0
  76. package/gen/mcpserver.d.ts.map +1 -1
  77. package/gen/mcpserver.js +1 -0
  78. package/gen/mcpserver.js.map +1 -1
  79. package/gen/oauthapp.d.ts +2 -0
  80. package/gen/oauthapp.d.ts.map +1 -1
  81. package/gen/oauthapp.js +1 -0
  82. package/gen/oauthapp.js.map +1 -1
  83. package/gen/organization.d.ts +2 -0
  84. package/gen/organization.d.ts.map +1 -1
  85. package/gen/organization.js +1 -0
  86. package/gen/organization.js.map +1 -1
  87. package/gen/platformclient.d.ts +2 -0
  88. package/gen/platformclient.d.ts.map +1 -1
  89. package/gen/platformclient.js +4 -2
  90. package/gen/platformclient.js.map +1 -1
  91. package/gen/project.d.ts +2 -0
  92. package/gen/project.d.ts.map +1 -1
  93. package/gen/project.js +1 -0
  94. package/gen/project.js.map +1 -1
  95. package/gen/proto-utils.d.ts +6 -0
  96. package/gen/proto-utils.d.ts.map +1 -1
  97. package/gen/proto-utils.js +9 -0
  98. package/gen/proto-utils.js.map +1 -1
  99. package/gen/session.d.ts +5 -4
  100. package/gen/session.d.ts.map +1 -1
  101. package/gen/session.js +3 -3
  102. package/gen/session.js.map +1 -1
  103. package/gen/skill.d.ts +3 -0
  104. package/gen/skill.d.ts.map +1 -1
  105. package/gen/skill.js +3 -1
  106. package/gen/skill.js.map +1 -1
  107. package/gen/workflow.d.ts +11 -1
  108. package/gen/workflow.d.ts.map +1 -1
  109. package/gen/workflow.js +37 -1
  110. package/gen/workflow.js.map +1 -1
  111. package/gen/workflowexecution.d.ts +4 -0
  112. package/gen/workflowexecution.d.ts.map +1 -1
  113. package/gen/workflowexecution.js +2 -0
  114. package/gen/workflowexecution.js.map +1 -1
  115. package/gen/workflowinstance.d.ts +4 -0
  116. package/gen/workflowinstance.d.ts.map +1 -1
  117. package/gen/workflowinstance.js +9 -0
  118. package/gen/workflowinstance.js.map +1 -1
  119. package/index.d.ts +3 -0
  120. package/index.d.ts.map +1 -1
  121. package/index.js +2 -0
  122. package/index.js.map +1 -1
  123. package/package.json +2 -2
  124. package/runner-adapter.d.ts +22 -0
  125. package/runner-adapter.d.ts.map +1 -0
  126. package/runner-adapter.js +2 -0
  127. package/runner-adapter.js.map +1 -0
  128. package/src/__tests__/gen/invitation-client.test.ts +132 -0
  129. package/src/__tests__/gen/proto-utils.test.ts +47 -1
  130. package/src/__tests__/gen/session-client.test.ts +12 -6
  131. package/src/__tests__/stigmer.test.ts +133 -0
  132. package/src/activity.ts +51 -0
  133. package/src/billing.ts +10 -2
  134. package/src/config.ts +20 -0
  135. package/src/gen/agent.ts +3 -0
  136. package/src/gen/agentexecution.ts +11 -1
  137. package/src/gen/agentinstance.ts +10 -1
  138. package/src/gen/apikey.ts +6 -2
  139. package/src/gen/artifact.ts +3 -0
  140. package/src/gen/authorization-config.ts +0 -1
  141. package/src/gen/client.ts +0 -5
  142. package/src/gen/environment.ts +3 -0
  143. package/src/gen/executioncontext.ts +3 -0
  144. package/src/gen/iampolicy.ts +3 -0
  145. package/src/gen/identityaccount.ts +3 -0
  146. package/src/gen/identityprovider.ts +3 -0
  147. package/src/gen/invitation.ts +6 -2
  148. package/src/gen/mcpserver.ts +3 -0
  149. package/src/gen/oauthapp.ts +3 -0
  150. package/src/gen/organization.ts +3 -0
  151. package/src/gen/platformclient.ts +6 -2
  152. package/src/gen/project.ts +3 -0
  153. package/src/gen/proto-utils.ts +11 -0
  154. package/src/gen/session.ts +8 -7
  155. package/src/gen/skill.ts +6 -1
  156. package/src/gen/workflow.ts +35 -3
  157. package/src/gen/workflowexecution.ts +6 -0
  158. package/src/gen/workflowinstance.ts +10 -1
  159. package/src/index.ts +11 -0
  160. package/src/runner-adapter.ts +21 -0
  161. package/src/stigmer.ts +69 -0
  162. package/stigmer.d.ts +23 -0
  163. package/stigmer.d.ts.map +1 -1
  164. package/stigmer.js +51 -0
  165. package/stigmer.js.map +1 -1
  166. package/gen/runner.d.ts +0 -32
  167. package/gen/runner.d.ts.map +0 -1
  168. package/gen/runner.js +0 -130
  169. package/gen/runner.js.map +0 -1
  170. package/src/gen/runner.ts +0 -122
@@ -15,9 +15,11 @@ import { type ServerlessWorkflowValidation } from "@stigmer/protos/ai/stigmer/ag
15
15
  import { WorkflowSpecSchema, WorkflowDocumentSchema, ExportSchema, FlowControlSchema, WorkflowTaskSchema, WorkflowBudgetSchema } 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
+ 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";
18
19
  import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
19
- import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
20
- import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
20
+ import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
21
+ import { ApiResourceReferenceSchema, type UpdateVisibilityInput } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
22
+ import { ApiResourceMetadataSchema, ApiResourceMetadataVersionSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
21
23
  import { PageInfoSchema } from "@stigmer/protos/ai/stigmer/commons/rpc/pagination_pb";
22
24
  import { SearchRequestSchema } from "@stigmer/protos/ai/stigmer/search/v1/io_pb";
23
25
  import { SearchService } from "@stigmer/protos/ai/stigmer/search/v1/query_pb";
@@ -54,6 +56,12 @@ export class WorkflowClient {
54
56
  } catch (e) { throw wrapError(e); }
55
57
  }
56
58
 
59
+ async updateVisibility(input: UpdateVisibilityInput): Promise<Workflow> {
60
+ try {
61
+ return await this.command.updateVisibility(input);
62
+ } catch (e) { throw wrapError(e); }
63
+ }
64
+
57
65
  async delete(id: string): Promise<Workflow> {
58
66
  try {
59
67
  return await this.command.delete(create(WorkflowIdSchema, { value: id }));
@@ -66,6 +74,12 @@ export class WorkflowClient {
66
74
  } catch (e) { throw wrapError(e); }
67
75
  }
68
76
 
77
+ async tagVersion(input: TagWorkflowVersionInput): Promise<Workflow> {
78
+ try {
79
+ return await this.command.tagVersion(input);
80
+ } catch (e) { throw wrapError(e); }
81
+ }
82
+
69
83
  async get(id: string): Promise<Workflow> {
70
84
  try {
71
85
  return await this.query.get(create(WorkflowIdSchema, { value: id }));
@@ -78,6 +92,18 @@ export class WorkflowClient {
78
92
  } catch (e) { throw wrapError(e); }
79
93
  }
80
94
 
95
+ async listVersions(input: ListWorkflowVersionsInput): Promise<ListWorkflowVersionsResponse> {
96
+ try {
97
+ return await this.query.listVersions(input);
98
+ } catch (e) { throw wrapError(e); }
99
+ }
100
+
101
+ async getVersion(input: GetWorkflowVersionInput): Promise<WorkflowVersionEntry> {
102
+ try {
103
+ return await this.query.getVersion(input);
104
+ } catch (e) { throw wrapError(e); }
105
+ }
106
+
81
107
  async getTaskKindRegistry(input: GetTaskKindRegistryRequest): Promise<GetTaskKindRegistryResponse> {
82
108
  try {
83
109
  return await this.taskKindRegistryQuery.getTaskKindRegistry(input);
@@ -109,6 +135,8 @@ export interface WorkflowInput {
109
135
  slug?: string;
110
136
  org: string;
111
137
  labels?: Record<string, string>;
138
+ visibility?: ApiResourceVisibility;
139
+ versionMessage?: string;
112
140
  description?: string;
113
141
  document: WorkflowDocumentInput;
114
142
  tasks?: WorkflowTaskInput[];
@@ -127,11 +155,12 @@ export interface WorkflowDocumentInput {
127
155
 
128
156
  /** SDK input type for WorkflowTask. */
129
157
  export interface WorkflowTaskInput {
130
- name: string;
158
+ name?: string;
131
159
  kind: WorkflowTaskKind;
132
160
  taskConfig: JsonObject;
133
161
  export?: ExportInput;
134
162
  flow?: FlowControlInput;
163
+ compensate?: WorkflowTaskInput[];
135
164
  }
136
165
 
137
166
  /** SDK input type for Export. */
@@ -188,6 +217,7 @@ function buildWorkflowTaskProto(input: WorkflowTaskInput) {
188
217
  if (input.taskConfig !== undefined) msg.taskConfig = input.taskConfig;
189
218
  if (input.export) msg.export = buildExportProto(input.export);
190
219
  if (input.flow) msg.flow = buildFlowControlProto(input.flow);
220
+ if (input.compensate) msg.compensate = input.compensate.map(buildWorkflowTaskProto);
191
221
  return msg;
192
222
  }
193
223
 
@@ -224,6 +254,8 @@ function buildWorkflowProto(input: WorkflowInput): Workflow {
224
254
  org: input.org,
225
255
  ...(input.slug && { slug: input.slug }),
226
256
  ...(input.labels && { labels: input.labels }),
257
+ ...(input.visibility && { visibility: input.visibility }),
258
+ ...(input.versionMessage && { version: Object.assign(create(ApiResourceMetadataVersionSchema), { message: input.versionMessage }) }),
227
259
  }),
228
260
  spec: Object.assign(create(WorkflowSpecSchema), stripUndefined({
229
261
  description: input.description,
@@ -6,12 +6,14 @@ import { type EnvVarInput } from "./types";
6
6
  import { create } from "@bufbuild/protobuf";
7
7
  import { createClient, type Client, type Transport } from "@connectrpc/connect";
8
8
  import { ExecutionValueSchema } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
9
+ import { ExecutionTarget } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
9
10
  import { WorkflowExecutionSchema, type WorkflowExecution } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/api_pb";
10
11
  import { WorkflowExecutionCommandController } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/command_pb";
11
12
  import { WorkflowExecutionEventSchema, type WorkflowExecutionEvent } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/event_pb";
12
13
  import { WorkflowExecutionIdSchema, WorkflowExecutionUpdateStatusInputSchema, SubmitWorkflowApprovalInputSchema, SubmitWorkflowTaskApprovalInputSchema, SendSignalInputSchema, CancelWorkflowExecutionInputSchema, TerminateWorkflowExecutionInputSchema, RecoverWorkflowExecutionInputSchema, PauseWorkflowExecutionInputSchema, ResumeWorkflowExecutionInputSchema, ListWorkflowExecutionsRequestSchema, WorkflowExecutionListSchema, ListWorkflowExecutionsByWorkflowRequestSchema, SubscribeWorkflowExecutionRequestSchema, GetEventLogRequestSchema, GetEventLogResponseSchema, SubscribeEventsRequestSchema, GetExecutionSummaryRequestSchema, ExecutionSummarySchema, ListPendingApprovalsRequestSchema, PendingApprovalsListSchema, type WorkflowExecutionUpdateStatusInput, type SubmitWorkflowApprovalInput, type SubmitWorkflowTaskApprovalInput, type SendSignalInput, type CancelWorkflowExecutionInput, type TerminateWorkflowExecutionInput, type RecoverWorkflowExecutionInput, type PauseWorkflowExecutionInput, type ResumeWorkflowExecutionInput, type ListWorkflowExecutionsRequest, type WorkflowExecutionList, type ListWorkflowExecutionsByWorkflowRequest, type SubscribeWorkflowExecutionRequest, type GetEventLogRequest, type GetEventLogResponse, type SubscribeEventsRequest, type GetExecutionSummaryRequest, type ExecutionSummary, type ListPendingApprovalsRequest, type PendingApprovalsList } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/io_pb";
13
14
  import { WorkflowExecutionQueryController } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/query_pb";
14
15
  import { WorkflowExecutionSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/spec_pb";
16
+ import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
15
17
  import { ApiResourceIdSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
16
18
  import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
17
19
 
@@ -156,12 +158,14 @@ export interface WorkflowExecutionInput {
156
158
  slug?: string;
157
159
  org: string;
158
160
  labels?: Record<string, string>;
161
+ visibility?: ApiResourceVisibility;
159
162
  workflowInstanceId?: string;
160
163
  workflowId?: string;
161
164
  triggerMessage?: string;
162
165
  triggerMetadata?: Record<string, string>;
163
166
  runtimeEnv?: Record<string, EnvVarInput>;
164
167
  callbackToken?: Uint8Array;
168
+ executionTarget?: ExecutionTarget;
165
169
  }
166
170
 
167
171
  function buildWorkflowExecutionProto(input: WorkflowExecutionInput): WorkflowExecution {
@@ -178,6 +182,7 @@ function buildWorkflowExecutionProto(input: WorkflowExecutionInput): WorkflowExe
178
182
  org: input.org,
179
183
  ...(input.slug && { slug: input.slug }),
180
184
  ...(input.labels && { labels: input.labels }),
185
+ ...(input.visibility && { visibility: input.visibility }),
181
186
  }),
182
187
  spec: Object.assign(create(WorkflowExecutionSpecSchema), stripUndefined({
183
188
  workflowInstanceId: input.workflowInstanceId,
@@ -186,6 +191,7 @@ function buildWorkflowExecutionProto(input: WorkflowExecutionInput): WorkflowExe
186
191
  triggerMetadata: input.triggerMetadata,
187
192
  runtimeEnv,
188
193
  callbackToken: input.callbackToken,
194
+ executionTarget: input.executionTarget,
189
195
  })),
190
196
  }) as WorkflowExecution;
191
197
  }
@@ -11,7 +11,8 @@ import { WorkflowInstanceIdSchema, GetWorkflowInstancesByWorkflowRequestSchema,
11
11
  import { WorkflowInstanceQueryController } from "@stigmer/protos/ai/stigmer/agentic/workflowinstance/v1/query_pb";
12
12
  import { WorkflowInstanceSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/workflowinstance/v1/spec_pb";
13
13
  import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
14
- import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
14
+ import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
15
+ import { ApiResourceReferenceSchema, type UpdateVisibilityInput } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
15
16
  import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
16
17
 
17
18
  /** Provides operations on workflowinstance resources. */
@@ -42,6 +43,12 @@ export class WorkflowInstanceClient {
42
43
  } catch (e) { throw wrapError(e); }
43
44
  }
44
45
 
46
+ async updateVisibility(input: UpdateVisibilityInput): Promise<WorkflowInstance> {
47
+ try {
48
+ return await this.command.updateVisibility(input);
49
+ } catch (e) { throw wrapError(e); }
50
+ }
51
+
45
52
  async delete(id: string): Promise<WorkflowInstance> {
46
53
  try {
47
54
  return await this.command.delete(create(WorkflowInstanceIdSchema, { value: id }));
@@ -73,6 +80,7 @@ export interface WorkflowInstanceInput {
73
80
  slug?: string;
74
81
  org: string;
75
82
  labels?: Record<string, string>;
83
+ visibility?: ApiResourceVisibility;
76
84
  workflowId?: string;
77
85
  description?: string;
78
86
  environmentRefs?: ResourceRef[];
@@ -88,6 +96,7 @@ function buildWorkflowInstanceProto(input: WorkflowInstanceInput): WorkflowInsta
88
96
  org: input.org,
89
97
  ...(input.slug && { slug: input.slug }),
90
98
  ...(input.labels && { labels: input.labels }),
99
+ ...(input.visibility && { visibility: input.visibility }),
91
100
  }),
92
101
  spec: Object.assign(create(WorkflowInstanceSpecSchema), stripUndefined({
93
102
  workflowId: input.workflowId,
package/src/index.ts CHANGED
@@ -3,6 +3,9 @@
3
3
  // Top-level client
4
4
  export { Stigmer } from "./stigmer";
5
5
 
6
+ // Runner adapter
7
+ export { type RunnerAdapter } from "./runner-adapter";
8
+
6
9
  // Configuration
7
10
  export { type StigmerConfig, type TokenProvider } from "./config";
8
11
 
@@ -44,6 +47,14 @@ export {
44
47
  } from "./iam-role";
45
48
  export { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
46
49
 
50
+ // Activity client (unified recents)
51
+ export {
52
+ ActivityClient,
53
+ type ListRecentActivityParams,
54
+ type ListRecentActivityResponse,
55
+ } from "./activity";
56
+ export type { RecentActivityEntry as RecentActivityEntryProto } from "./activity";
57
+
47
58
  // Billing client
48
59
  export {
49
60
  BillingClient,
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Framework-agnostic RunnerAdapter interface.
3
+ *
4
+ * This is the canonical type definition re-exported by `@stigmer/react`.
5
+ * Non-React consumers (Node.js scripts, custom frameworks) can import
6
+ * directly from `@stigmer/sdk`.
7
+ *
8
+ * When `executionTarget` is `"local"`, SDK clients automatically call
9
+ * the adapter at the appropriate lifecycle points. The consumer never
10
+ * needs to manage runner processes directly.
11
+ */
12
+ export interface RunnerAdapter {
13
+ /** Called after a session is created with executionTarget=LOCAL. */
14
+ onSessionCreated(sessionId: string): Promise<void>;
15
+ /** Called when a session reaches a terminal phase. */
16
+ onSessionTerminated(sessionId: string): Promise<void>;
17
+ /** Called after a workflow execution is created with executionTarget=LOCAL. */
18
+ onWorkflowExecutionCreated(executionId: string): Promise<void>;
19
+ /** Called when a workflow execution reaches a terminal phase. */
20
+ onWorkflowExecutionTerminated(executionId: string): Promise<void>;
21
+ }
package/src/stigmer.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ActivityClient } from "./activity";
1
2
  import { BillingClient } from "./billing";
2
3
  import { GeneratedClient } from "./gen/client";
3
4
  import { GitHubClient } from "./github";
@@ -9,6 +10,9 @@ import {
9
10
  type StigmerConfig,
10
11
  type TokenProvider,
11
12
  } from "./config";
13
+ import { ExecutionTarget } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
14
+
15
+ type ExecutionTargetOption = StigmerConfig["executionTarget"];
12
16
 
13
17
  /**
14
18
  * Top-level Stigmer API client.
@@ -55,6 +59,19 @@ export class Stigmer extends GeneratedClient {
55
59
  */
56
60
  readonly fetch: typeof globalThis.fetch | undefined;
57
61
 
62
+ /**
63
+ * Default execution target for sessions and workflow executions.
64
+ *
65
+ * When set, `session.create()` and `workflowExecution.create()`
66
+ * apply this as the default when the per-call input does not
67
+ * specify an explicit `executionTarget`.
68
+ *
69
+ * `undefined` means the server decides (LOCAL for OSS, CLOUD for
70
+ * managed).
71
+ */
72
+ readonly defaultExecutionTarget: ExecutionTarget | undefined;
73
+
74
+ readonly activity: ActivityClient;
58
75
  readonly billing: BillingClient;
59
76
  readonly platform: PlatformClient;
60
77
  readonly search: SearchClient;
@@ -70,14 +87,39 @@ export class Stigmer extends GeneratedClient {
70
87
 
71
88
  this.baseUrl = config.baseUrl;
72
89
  this.fetch = config.fetch;
90
+ this.defaultExecutionTarget = toExecutionTarget(config.executionTarget);
73
91
  this._tokenProvider = config.apiKey
74
92
  ? () => config.apiKey!
75
93
  : config.getAccessToken ?? (() => null);
76
94
 
95
+ this.activity = new ActivityClient(transport);
77
96
  this.billing = new BillingClient(transport);
78
97
  this.platform = new PlatformClient(transport);
79
98
  this.search = new SearchClient(transport);
80
99
  this.github = new GitHubClient(transport);
100
+
101
+ if (this.defaultExecutionTarget != null) {
102
+ this._applyExecutionTargetDefaults();
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Wrap `session.create/apply` so that the client-level
108
+ * `defaultExecutionTarget` is applied when the per-call input
109
+ * does not specify one.
110
+ *
111
+ * WorkflowExecutionInput does not yet have `executionTarget` in
112
+ * codegen; that will be wired once the codegen schema is updated.
113
+ */
114
+ private _applyExecutionTargetDefaults(): void {
115
+ const target = this.defaultExecutionTarget!;
116
+ const origSessionCreate = this.session.create.bind(this.session);
117
+ const origSessionApply = this.session.apply.bind(this.session);
118
+
119
+ this.session.create = (input) =>
120
+ origSessionCreate(applySessionDefault(input, target));
121
+ this.session.apply = (input) =>
122
+ origSessionApply(applySessionDefault(input, target));
81
123
  }
82
124
 
83
125
  /**
@@ -94,3 +136,30 @@ export class Stigmer extends GeneratedClient {
94
136
  return await this._tokenProvider();
95
137
  }
96
138
  }
139
+
140
+ function toExecutionTarget(
141
+ opt: ExecutionTargetOption,
142
+ ): ExecutionTarget | undefined {
143
+ switch (opt) {
144
+ case "local":
145
+ return ExecutionTarget.LOCAL;
146
+ case "cloud":
147
+ return ExecutionTarget.CLOUD;
148
+ default:
149
+ return undefined;
150
+ }
151
+ }
152
+
153
+ function applySessionDefault<T extends { executionTarget?: ExecutionTarget }>(
154
+ input: T,
155
+ target: ExecutionTarget,
156
+ ): T {
157
+ if (
158
+ input.executionTarget == null ||
159
+ input.executionTarget === ExecutionTarget.UNSPECIFIED
160
+ ) {
161
+ return { ...input, executionTarget: target };
162
+ }
163
+ return input;
164
+ }
165
+
package/stigmer.d.ts CHANGED
@@ -1,9 +1,11 @@
1
+ import { ActivityClient } from "./activity";
1
2
  import { BillingClient } from "./billing";
2
3
  import { GeneratedClient } from "./gen/client";
3
4
  import { GitHubClient } from "./github";
4
5
  import { PlatformClient } from "./platform";
5
6
  import { SearchClient } from "./search";
6
7
  import { type StigmerConfig } from "./config";
8
+ import { ExecutionTarget } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
7
9
  /**
8
10
  * Top-level Stigmer API client.
9
11
  *
@@ -47,12 +49,33 @@ export declare class Stigmer extends GeneratedClient {
47
49
  * in Tauri where the global `fetch` is restricted by CSP/CORS.
48
50
  */
49
51
  readonly fetch: typeof globalThis.fetch | undefined;
52
+ /**
53
+ * Default execution target for sessions and workflow executions.
54
+ *
55
+ * When set, `session.create()` and `workflowExecution.create()`
56
+ * apply this as the default when the per-call input does not
57
+ * specify an explicit `executionTarget`.
58
+ *
59
+ * `undefined` means the server decides (LOCAL for OSS, CLOUD for
60
+ * managed).
61
+ */
62
+ readonly defaultExecutionTarget: ExecutionTarget | undefined;
63
+ readonly activity: ActivityClient;
50
64
  readonly billing: BillingClient;
51
65
  readonly platform: PlatformClient;
52
66
  readonly search: SearchClient;
53
67
  readonly github: GitHubClient;
54
68
  private readonly _tokenProvider;
55
69
  constructor(config: StigmerConfig);
70
+ /**
71
+ * Wrap `session.create/apply` so that the client-level
72
+ * `defaultExecutionTarget` is applied when the per-call input
73
+ * does not specify one.
74
+ *
75
+ * WorkflowExecutionInput does not yet have `executionTarget` in
76
+ * codegen; that will be wired once the codegen schema is updated.
77
+ */
78
+ private _applyExecutionTargetDefaults;
56
79
  /**
57
80
  * Retrieve the current authentication credential.
58
81
  *
package/stigmer.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stigmer.d.ts","sourceRoot":"","sources":["../src/stigmer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,M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nB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAC;AAIxF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,OAAQ,SAAQ,eAAe;IAC1C;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC;IAEpD;;;;;;;;;OASG;IACH,QAAQ,CAAC,sBAAsB,EAAE,eAAe,GAAG,SAAS,CAAC;IAE7D,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;gBAEnC,MAAM,EAAE,aAAa;IAwBjC;;;;;;;OAOG;IACH,OAAO,CAAC,6BAA6B;IAWrC;;;;;;;;;OASG;IACG,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAGlD"}
package/stigmer.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { ActivityClient } from "./activity";
1
2
  import { BillingClient } from "./billing";
2
3
  import { GeneratedClient } from "./gen/client";
3
4
  import { GitHubClient } from "./github";
@@ -5,6 +6,7 @@ import { PlatformClient } from "./platform";
5
6
  import { SearchClient } from "./search";
6
7
  import { createStigmerTransport } from "./transport";
7
8
  import { validateConfig, } from "./config";
9
+ import { ExecutionTarget } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
8
10
  /**
9
11
  * Top-level Stigmer API client.
10
12
  *
@@ -48,6 +50,18 @@ export class Stigmer extends GeneratedClient {
48
50
  * in Tauri where the global `fetch` is restricted by CSP/CORS.
49
51
  */
50
52
  fetch;
53
+ /**
54
+ * Default execution target for sessions and workflow executions.
55
+ *
56
+ * When set, `session.create()` and `workflowExecution.create()`
57
+ * apply this as the default when the per-call input does not
58
+ * specify an explicit `executionTarget`.
59
+ *
60
+ * `undefined` means the server decides (LOCAL for OSS, CLOUD for
61
+ * managed).
62
+ */
63
+ defaultExecutionTarget;
64
+ activity;
51
65
  billing;
52
66
  platform;
53
67
  search;
@@ -59,13 +73,33 @@ export class Stigmer extends GeneratedClient {
59
73
  super(transport);
60
74
  this.baseUrl = config.baseUrl;
61
75
  this.fetch = config.fetch;
76
+ this.defaultExecutionTarget = toExecutionTarget(config.executionTarget);
62
77
  this._tokenProvider = config.apiKey
63
78
  ? () => config.apiKey
64
79
  : config.getAccessToken ?? (() => null);
80
+ this.activity = new ActivityClient(transport);
65
81
  this.billing = new BillingClient(transport);
66
82
  this.platform = new PlatformClient(transport);
67
83
  this.search = new SearchClient(transport);
68
84
  this.github = new GitHubClient(transport);
85
+ if (this.defaultExecutionTarget != null) {
86
+ this._applyExecutionTargetDefaults();
87
+ }
88
+ }
89
+ /**
90
+ * Wrap `session.create/apply` so that the client-level
91
+ * `defaultExecutionTarget` is applied when the per-call input
92
+ * does not specify one.
93
+ *
94
+ * WorkflowExecutionInput does not yet have `executionTarget` in
95
+ * codegen; that will be wired once the codegen schema is updated.
96
+ */
97
+ _applyExecutionTargetDefaults() {
98
+ const target = this.defaultExecutionTarget;
99
+ const origSessionCreate = this.session.create.bind(this.session);
100
+ const origSessionApply = this.session.apply.bind(this.session);
101
+ this.session.create = (input) => origSessionCreate(applySessionDefault(input, target));
102
+ this.session.apply = (input) => origSessionApply(applySessionDefault(input, target));
69
103
  }
70
104
  /**
71
105
  * Retrieve the current authentication credential.
@@ -81,4 +115,21 @@ export class Stigmer extends GeneratedClient {
81
115
  return await this._tokenProvider();
82
116
  }
83
117
  }
118
+ function toExecutionTarget(opt) {
119
+ switch (opt) {
120
+ case "local":
121
+ return ExecutionTarget.LOCAL;
122
+ case "cloud":
123
+ return ExecutionTarget.CLOUD;
124
+ default:
125
+ return undefined;
126
+ }
127
+ }
128
+ function applySessionDefault(input, target) {
129
+ if (input.executionTarget == null ||
130
+ input.executionTarget === ExecutionTarget.UNSPECIFIED) {
131
+ return { ...input, executionTarget: target };
132
+ }
133
+ return input;
134
+ }
84
135
  //# sourceMappingURL=stigmer.js.map
package/stigmer.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stigmer.js","sourceRoot":"","sources":["../src/stigmer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACL,cAAc,GAGf,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,OAAQ,SAAQ,eAAe;IAC1C;;;;;;OAMG;IACM,OAAO,CAAS;IAEzB;;;;;;;;OAQG;IACM,KAAK,CAAsC;IAE3C,OAAO,CAAgB;IACvB,QAAQ,CAAiB;IACzB,MAAM,CAAe;IACrB,MAAM,CAAe;IAEb,cAAc,CAAgB;IAE/C,YAAY,MAAqB;QAC/B,cAAc,CAAC,MAAM,CAAC,CAAC;QAEvB,MAAM,SAAS,GAAG,MAAM,CAAC,eAAe,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAC3E,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B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G,IAAI,CAAC,sBAAuB,CAAC;QAC5C,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjE,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE/D,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,KAAK,EAAE,EAAE,CAC9B,iBAAiB,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,EAAE,CAC7B,gBAAgB,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,iBAAiB;QACrB,OAAO,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IACrC,CAAC;CACF;AAED,SAAS,iBAAiB,CACxB,GAA0B;IAE1B,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,eAAe,CAAC,KAAK,CAAC;QAC/B,KAAK,OAAO;YACV,OAAO,eAAe,CAAC,KAAK,CAAC;QAC/B;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAC1B,KAAQ,EACR,MAAuB;IAEvB,IACE,KAAK,CAAC,eAAe,IAAI,IAAI;QAC7B,KAAK,CAAC,eAAe,KAAK,eAAe,CAAC,WAAW,EACrD,CAAC;QACD,OAAO,EAAE,GAAG,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/gen/runner.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import { BidiStream } from "./bidi-stream";
2
- import { type ResourceRef } from "./types";
3
- import { type Transport } from "@connectrpc/connect";
4
- import { type Runner } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/api_pb";
5
- import { type RunnerSendCommandInput, type RunnerCommandResponse, type RunnerStopInput, type RunnerStreamClientMessage, type RunnerStreamServerMessage, type CreateLaunchTokenRequest, type CreateLaunchTokenResponse, type ExchangeLaunchTokenRequest, type ExchangeLaunchTokenResponse, type ListRunnersRequest, type RunnerList } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/io_pb";
6
- /** Provides operations on runner resources. */
7
- export declare class RunnerClient {
8
- private readonly command;
9
- private readonly query;
10
- constructor(transport: Transport);
11
- apply(input: RunnerInput): Promise<Runner>;
12
- create(input: RunnerInput): Promise<Runner>;
13
- update(input: RunnerInput): Promise<Runner>;
14
- delete(id: string): Promise<Runner>;
15
- sendCommand(input: RunnerSendCommandInput): Promise<RunnerCommandResponse>;
16
- stop(input: RunnerStopInput): Promise<Runner>;
17
- connect(signal?: AbortSignal): BidiStream<RunnerStreamClientMessage, RunnerStreamServerMessage>;
18
- createLaunchToken(input: CreateLaunchTokenRequest): Promise<CreateLaunchTokenResponse>;
19
- exchangeLaunchToken(input: ExchangeLaunchTokenRequest): Promise<ExchangeLaunchTokenResponse>;
20
- get(id: string): Promise<Runner>;
21
- getByReference(ref: ResourceRef): Promise<Runner>;
22
- list(input: ListRunnersRequest): Promise<RunnerList>;
23
- }
24
- /** Input for creating/updating a Runner. */
25
- export interface RunnerInput {
26
- name: string;
27
- slug?: string;
28
- org: string;
29
- labels?: Record<string, string>;
30
- description?: string;
31
- }
32
- //# sourceMappingURL=runner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/gen/runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;A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AO,CAAC,MAAM,CAAC;IAMjD,IAAI,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;CAK3D;AAED,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
package/gen/runner.js DELETED
@@ -1,130 +0,0 @@
1
- // Code generated by stigmer-codegen. DO NOT EDIT.
2
- import { BidiStream } from "./bidi-stream";
3
- import { wrapError } from "./errors";
4
- import { stripUndefined } from "./proto-utils";
5
- import { create } from "@bufbuild/protobuf";
6
- import { createClient } from "@connectrpc/connect";
7
- import { RunnerSchema } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/api_pb";
8
- import { RunnerCommandController } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/command_pb";
9
- import { RunnerIdSchema } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/io_pb";
10
- import { RunnerQueryController } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/query_pb";
11
- import { RunnerSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/spec_pb";
12
- 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";
14
- import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
15
- /** Provides operations on runner resources. */
16
- export class RunnerClient {
17
- command;
18
- query;
19
- constructor(transport) {
20
- this.command = createClient(RunnerCommandController, transport);
21
- this.query = createClient(RunnerQueryController, transport);
22
- }
23
- async apply(input) {
24
- try {
25
- return await this.command.apply(buildRunnerProto(input));
26
- }
27
- catch (e) {
28
- throw wrapError(e);
29
- }
30
- }
31
- async create(input) {
32
- try {
33
- return await this.command.create(buildRunnerProto(input));
34
- }
35
- catch (e) {
36
- throw wrapError(e);
37
- }
38
- }
39
- async update(input) {
40
- try {
41
- return await this.command.update(buildRunnerProto(input));
42
- }
43
- catch (e) {
44
- throw wrapError(e);
45
- }
46
- }
47
- async delete(id) {
48
- try {
49
- return await this.command.delete(create(RunnerIdSchema, { value: id }));
50
- }
51
- catch (e) {
52
- throw wrapError(e);
53
- }
54
- }
55
- async sendCommand(input) {
56
- try {
57
- return await this.command.sendCommand(input);
58
- }
59
- catch (e) {
60
- throw wrapError(e);
61
- }
62
- }
63
- async stop(input) {
64
- try {
65
- return await this.command.stop(input);
66
- }
67
- catch (e) {
68
- throw wrapError(e);
69
- }
70
- }
71
- connect(signal) {
72
- return new BidiStream((reqs) => this.command.connect(reqs, { signal }));
73
- }
74
- async createLaunchToken(input) {
75
- try {
76
- return await this.command.createLaunchToken(input);
77
- }
78
- catch (e) {
79
- throw wrapError(e);
80
- }
81
- }
82
- async exchangeLaunchToken(input) {
83
- try {
84
- return await this.command.exchangeLaunchToken(input);
85
- }
86
- catch (e) {
87
- throw wrapError(e);
88
- }
89
- }
90
- async get(id) {
91
- try {
92
- return await this.query.get(create(RunnerIdSchema, { value: id }));
93
- }
94
- catch (e) {
95
- throw wrapError(e);
96
- }
97
- }
98
- async getByReference(ref) {
99
- try {
100
- return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.runner }));
101
- }
102
- catch (e) {
103
- throw wrapError(e);
104
- }
105
- }
106
- async list(input) {
107
- try {
108
- return await this.query.list(input);
109
- }
110
- catch (e) {
111
- throw wrapError(e);
112
- }
113
- }
114
- }
115
- function buildRunnerProto(input) {
116
- return Object.assign(create(RunnerSchema), {
117
- apiVersion: "agentic.stigmer.ai/v1",
118
- kind: "Runner",
119
- metadata: Object.assign(create(ApiResourceMetadataSchema), {
120
- name: input.name,
121
- org: input.org,
122
- ...(input.slug && { slug: input.slug }),
123
- ...(input.labels && { labels: input.labels }),
124
- }),
125
- spec: Object.assign(create(RunnerSpecSchema), stripUndefined({
126
- description: input.description,
127
- })),
128
- });
129
- }
130
- //# sourceMappingURL=runner.js.map