@xtrape/capsule-contracts-node 0.1.0-public-review.0 → 0.1.0-public-review.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,9 +13,9 @@ schemas, inferred TypeScript types, enum values, ID helpers, pagination helpers,
13
13
  and protocol error helpers for the Agent/Admin/System wire contracts.
14
14
 
15
15
  > **Package status:** Xtrape Capsule is currently in **Public Review** before
16
- > the `v0.1.0 Public Preview` release. This package is prepared for npm
17
- > publication under the `public-review` dist-tag. APIs, contracts, deployment
18
- > instructions, and SDK interfaces may still change.
16
+ > the `v0.1.0 Public Preview` release. This package is **published to npm** under the
17
+ > `public-review` dist-tag. APIs, contracts, deployment instructions, and SDK
18
+ > interfaces may still change.
19
19
 
20
20
  ## Install
21
21
 
@@ -155,8 +155,26 @@ const action = ActionDefinitionInputSchema.parse({
155
155
 
156
156
  ## Validate Action Prepare Result
157
157
 
158
- Action prepare responses are delivered as successful Command Results. The
159
- SDK/backend convention is:
158
+ Use `ActionPrepareResultSchema` to validate the action-prepare payload directly:
159
+
160
+ ```ts
161
+ import { ActionPrepareResultSchema } from "@xtrape/capsule-contracts-node";
162
+
163
+ const prepare = ActionPrepareResultSchema.parse({
164
+ initialPayload: { message: "hello" },
165
+ currentState: { service: "ready" },
166
+ inputSchema: {
167
+ type: "object",
168
+ properties: {
169
+ message: { type: "string", default: "hello" },
170
+ },
171
+ },
172
+ });
173
+ ```
174
+
175
+ When reported back to Opstage for an `ACTION_PREPARE` command, this shape is
176
+ placed under `ReportCommandResultRequest.data`. Command result reporting still
177
+ uses `ReportCommandResultRequestSchema`:
160
178
 
161
179
  ```ts
162
180
  import { ReportCommandResultRequestSchema } from "@xtrape/capsule-contracts-node";
@@ -262,6 +280,9 @@ const response = paginate(items, query.page, query.pageSize, total);
262
280
  Opstage CE backend validation and protocol handling.
263
281
  - [`xtrape-capsule-agent-node`](https://github.com/xtrape-com/xtrape-capsule-agent-node)
264
282
  — Node embedded Agent SDK request/response types.
283
+ - [`xtrape-capsule-demo`](https://github.com/xtrape-com/xtrape-capsule-demo)
284
+ — End-to-end runnable Capsule Service that imports these schemas through
285
+ the Agent SDK.
265
286
  - Capsule Service implementations that want local validation before reporting to
266
287
  Opstage.
267
288
 
@@ -274,6 +295,25 @@ const response = paginate(items, query.page, query.pageSize, total);
274
295
  During Public Review and Public Preview, keep CE, Agent SDK, and Contracts on
275
296
  matching minor versions. The wire protocol may still evolve before `v1.0`.
276
297
 
298
+ ## Schema Stability
299
+
300
+ The package follows semver. For Public Review and Public Preview, the
301
+ guarantees per schema group are:
302
+
303
+ | Group | Stability | Notes |
304
+ | ---------------------------------------------------------------------------------------------------------------- | :---------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
305
+ | Status enums (`AgentStatus`, `CapsuleServiceStatus`, `HealthStatus`, `CommandStatus`, `DangerLevel`, `TokenStatus`) | Stable | New values may be added in minor versions; existing values will not be removed before `v1.0`. |
306
+ | Agent ↔ Backend wire schemas (`RegisterAgentRequest`, `AgentHeartbeat*`, `ServiceReport*`, `ReportCommandResult*`) | Evolving | Field shape is stable; additive optional fields may land in minor versions. Required fields will not be added before `v1.0` without a deprecation cycle. |
307
+ | Capsule Service shapes (`CapsuleManifest`, `ReportedService`, `HealthReportInput`, `ConfigItemInput`, `ActionDefinitionInput`) | Evolving | Same policy as wire schemas. |
308
+ | Persisted shapes (`Agent`, `CapsuleService`, `ConfigItem`, `ActionDefinition`, `Command*`, `AuditEvent`, `User`) | Evolving | Track CE storage; safe to consume read-only. |
309
+ | `ActionPrepareResultSchema` | Provisional | Added in `0.1.0-public-review.0`. Field shape may still tighten before `v1.0`. |
310
+ | `Command.type` enum | Evolving | Currently `ACTION_PREPARE` / `ACTION_EXECUTE`. New types may be added. |
311
+ | Error codes (`ErrorCode`) | Evolving | New codes may be added. Existing codes will not change meaning before `v1.0`. |
312
+ | Helpers (`newId`, `parseSort`, `paginate`, `HttpError`, `ListQueryBase`) | Provisional | Helpful for backend-style consumers but not strictly part of the wire spec; may move to a separate utility package — see [#8](https://github.com/xtrape-com/xtrape-capsule-contracts-node/issues/8). |
313
+
314
+ **Until `v1.0`**, pin to a single minor across CE / Agent SDK / Contracts.
315
+ Breaking changes will be called out in `CHANGELOG.md`.
316
+
277
317
  ## Documentation
278
318
 
279
319
  - Contracts overview: https://xtrape-com.github.io/xtrape-capsule-site/contracts/overview
package/dist/index.cjs CHANGED
@@ -22,6 +22,7 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  ActionDefinitionInputSchema: () => ActionDefinitionInputSchema,
24
24
  ActionDefinitionSchema: () => ActionDefinitionSchema,
25
+ ActionPrepareResultSchema: () => ActionPrepareResultSchema,
25
26
  AdminLoginRequestSchema: () => AdminLoginRequestSchema,
26
27
  AdminSessionSchema: () => AdminSessionSchema,
27
28
  AgentHeartbeatRequestSchema: () => AgentHeartbeatRequestSchema,
@@ -43,6 +44,7 @@ __export(index_exports, {
43
44
  CommandSchema: () => CommandSchema,
44
45
  CommandStatus: () => CommandStatus,
45
46
  CommandStatusSchema: () => CommandStatusSchema,
47
+ CommandTypeSchema: () => CommandTypeSchema,
46
48
  ConfigItemInputSchema: () => ConfigItemInputSchema,
47
49
  ConfigItemSchema: () => ConfigItemSchema,
48
50
  CreateActionCommandRequestSchema: () => CreateActionCommandRequestSchema,
@@ -63,6 +65,7 @@ __export(index_exports, {
63
65
  RegistrationTokenSchema: () => RegistrationTokenSchema,
64
66
  ReportCommandResultRequestSchema: () => ReportCommandResultRequestSchema,
65
67
  ReportedServiceSchema: () => ReportedServiceSchema,
68
+ RuntimeKindSchema: () => RuntimeKindSchema,
66
69
  ServiceReportRequestSchema: () => ServiceReportRequestSchema,
67
70
  SystemHealthSchema: () => SystemHealthSchema,
68
71
  SystemVersionSchema: () => SystemVersionSchema,
@@ -70,6 +73,7 @@ __export(index_exports, {
70
73
  UserRole: () => UserRole,
71
74
  UserSchema: () => UserSchema,
72
75
  actionDefinitionInputSchema: () => actionDefinitionInputSchema,
76
+ actionPrepareResultSchema: () => actionPrepareResultSchema,
73
77
  adminLoginRequestSchema: () => adminLoginRequestSchema,
74
78
  agentHeartbeatRequestSchema: () => agentHeartbeatRequestSchema,
75
79
  configItemInputSchema: () => configItemInputSchema,
@@ -150,7 +154,8 @@ var ReportedServiceSchema = import_zod.z.object({ code: import_zod.z.string().mi
150
154
  var reportedServiceSchema = ReportedServiceSchema;
151
155
  var ServiceReportRequestSchema = import_zod.z.object({ services: import_zod.z.array(ReportedServiceSchema).min(1) });
152
156
  var serviceReportRequestSchema = ServiceReportRequestSchema;
153
- var RegisterAgentRequestSchema = import_zod.z.object({ registrationToken: import_zod.z.string().startsWith("opstage_reg_"), agent: import_zod.z.object({ code: import_zod.z.string(), name: import_zod.z.string().optional(), mode: import_zod.z.literal("embedded"), runtime: import_zod.z.string().optional() }), service: ReportedServiceSchema.optional() });
157
+ var RuntimeKindSchema = import_zod.z.enum(["nodejs", "java", "python", "go", "other"]);
158
+ var RegisterAgentRequestSchema = import_zod.z.object({ registrationToken: import_zod.z.string().startsWith("opstage_reg_"), agent: import_zod.z.object({ code: import_zod.z.string(), name: import_zod.z.string().optional(), mode: import_zod.z.literal("embedded"), runtime: RuntimeKindSchema.optional() }), service: ReportedServiceSchema.optional() });
154
159
  var registerAgentRequestSchema = RegisterAgentRequestSchema;
155
160
  var RegisterAgentResponseSchema = import_zod.z.object({ agentId: import_zod.z.string().startsWith("agt_"), agentToken: import_zod.z.string().startsWith("opstage_agent_"), heartbeatIntervalSeconds: import_zod.z.number().int(), commandPollIntervalSeconds: import_zod.z.number().int() });
156
161
  var AgentHeartbeatResponseSchema = import_zod.z.object({ heartbeatIntervalSeconds: import_zod.z.number().int(), commandPollIntervalSeconds: import_zod.z.number().int() });
@@ -161,9 +166,17 @@ var HealthReportSchema = import_zod.z.object({ id: import_zod.z.string().startsW
161
166
  var ConfigItemSchema = import_zod.z.object({ id: import_zod.z.string().startsWith("cfg_"), serviceId: import_zod.z.string().startsWith("svc_"), key: import_zod.z.string(), label: import_zod.z.string().nullable().optional(), type: import_zod.z.string(), source: import_zod.z.string().nullable().optional(), editable: import_zod.z.boolean().default(false), sensitive: import_zod.z.boolean(), valuePreview: import_zod.z.string().nullable().optional(), defaultValue: import_zod.z.string().nullable().optional(), secretRef: import_zod.z.string().nullable().optional() });
162
167
  var ActionDefinitionSchema = import_zod.z.object({ id: import_zod.z.string().startsWith("act_"), serviceId: import_zod.z.string().startsWith("svc_"), name: import_zod.z.string(), label: import_zod.z.string(), description: import_zod.z.string().nullable().optional(), dangerLevel: import_zod.z.enum(DangerLevel), requiresConfirmation: import_zod.z.boolean(), category: import_zod.z.string().optional(), order: import_zod.z.number().int().optional(), inputSchema: AnyJson.optional(), outputSchema: AnyJson.optional(), timeoutSeconds: import_zod.z.number().int().optional() });
163
168
  var CapsuleServiceDetailSchema = CapsuleServiceSchema.extend({ manifest: AnyJson.optional(), health: HealthReportSchema.nullable().optional(), configs: import_zod.z.array(ConfigItemSchema).optional(), actions: import_zod.z.array(ActionDefinitionSchema).optional() });
169
+ var ActionPrepareResultSchema = import_zod.z.object({
170
+ action: AnyJson.optional(),
171
+ inputSchema: AnyJson.optional(),
172
+ initialPayload: AnyJson.optional(),
173
+ currentState: AnyJson.optional()
174
+ });
175
+ var actionPrepareResultSchema = ActionPrepareResultSchema;
164
176
  var CreateActionCommandRequestSchema = import_zod.z.object({ payload: AnyJson.optional(), confirmation: import_zod.z.boolean().optional() });
165
177
  var createActionCommandRequestSchema = CreateActionCommandRequestSchema;
166
- var CommandSchema = import_zod.z.object({ id: import_zod.z.string().startsWith("cmd_"), agentId: import_zod.z.string().startsWith("agt_"), serviceId: import_zod.z.string().startsWith("svc_"), type: import_zod.z.enum(["ACTION_PREPARE", "ACTION_EXECUTE", "ACTION"]), actionName: import_zod.z.string(), status: CommandStatusSchema, payload: AnyJson.optional(), createdByUserId: import_zod.z.string().startsWith("usr_").nullable().optional(), createdAt: import_zod.z.string(), startedAt: import_zod.z.string().nullable().optional(), completedAt: import_zod.z.string().nullable().optional(), expiresAt: import_zod.z.string().nullable().optional() });
178
+ var CommandTypeSchema = import_zod.z.enum(["ACTION_PREPARE", "ACTION_EXECUTE"]);
179
+ var CommandSchema = import_zod.z.object({ id: import_zod.z.string().startsWith("cmd_"), agentId: import_zod.z.string().startsWith("agt_"), serviceId: import_zod.z.string().startsWith("svc_"), type: CommandTypeSchema, actionName: import_zod.z.string(), status: CommandStatusSchema, payload: AnyJson.optional(), createdByUserId: import_zod.z.string().startsWith("usr_").nullable().optional(), createdAt: import_zod.z.string(), startedAt: import_zod.z.string().nullable().optional(), completedAt: import_zod.z.string().nullable().optional(), expiresAt: import_zod.z.string().nullable().optional() });
167
180
  var ReportCommandResultRequestSchema = import_zod.z.object({ success: import_zod.z.boolean(), message: import_zod.z.string().optional(), data: AnyJson.optional(), error: AnyJson.optional(), startedAt: import_zod.z.string().optional(), finishedAt: import_zod.z.string().optional() });
168
181
  var reportCommandResultRequestSchema = ReportCommandResultRequestSchema;
169
182
  var CommandResultSchema = import_zod.z.object({ id: import_zod.z.string().startsWith("crs_"), commandId: import_zod.z.string().startsWith("cmd_"), success: import_zod.z.boolean(), message: import_zod.z.string().nullable().optional(), data: AnyJson.optional(), error: AnyJson.optional(), reportedAt: import_zod.z.string() });
@@ -202,6 +215,7 @@ function paginate(items, page, pageSize, total) {
202
215
  0 && (module.exports = {
203
216
  ActionDefinitionInputSchema,
204
217
  ActionDefinitionSchema,
218
+ ActionPrepareResultSchema,
205
219
  AdminLoginRequestSchema,
206
220
  AdminSessionSchema,
207
221
  AgentHeartbeatRequestSchema,
@@ -223,6 +237,7 @@ function paginate(items, page, pageSize, total) {
223
237
  CommandSchema,
224
238
  CommandStatus,
225
239
  CommandStatusSchema,
240
+ CommandTypeSchema,
226
241
  ConfigItemInputSchema,
227
242
  ConfigItemSchema,
228
243
  CreateActionCommandRequestSchema,
@@ -243,6 +258,7 @@ function paginate(items, page, pageSize, total) {
243
258
  RegistrationTokenSchema,
244
259
  ReportCommandResultRequestSchema,
245
260
  ReportedServiceSchema,
261
+ RuntimeKindSchema,
246
262
  ServiceReportRequestSchema,
247
263
  SystemHealthSchema,
248
264
  SystemVersionSchema,
@@ -250,6 +266,7 @@ function paginate(items, page, pageSize, total) {
250
266
  UserRole,
251
267
  UserSchema,
252
268
  actionDefinitionInputSchema,
269
+ actionPrepareResultSchema,
253
270
  adminLoginRequestSchema,
254
271
  agentHeartbeatRequestSchema,
255
272
  configItemInputSchema,
package/dist/index.d.cts CHANGED
@@ -1244,23 +1244,25 @@ declare const serviceReportRequestSchema: z.ZodObject<{
1244
1244
  }[] | undefined;
1245
1245
  }[];
1246
1246
  }>;
1247
+ declare const RuntimeKindSchema: z.ZodEnum<["nodejs", "java", "python", "go", "other"]>;
1248
+ type RuntimeKind = z.infer<typeof RuntimeKindSchema>;
1247
1249
  declare const RegisterAgentRequestSchema: z.ZodObject<{
1248
1250
  registrationToken: z.ZodString;
1249
1251
  agent: z.ZodObject<{
1250
1252
  code: z.ZodString;
1251
1253
  name: z.ZodOptional<z.ZodString>;
1252
1254
  mode: z.ZodLiteral<"embedded">;
1253
- runtime: z.ZodOptional<z.ZodString>;
1255
+ runtime: z.ZodOptional<z.ZodEnum<["nodejs", "java", "python", "go", "other"]>>;
1254
1256
  }, "strip", z.ZodTypeAny, {
1255
1257
  code: string;
1256
1258
  mode: "embedded";
1257
1259
  name?: string | undefined;
1258
- runtime?: string | undefined;
1260
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1259
1261
  }, {
1260
1262
  code: string;
1261
1263
  mode: "embedded";
1262
1264
  name?: string | undefined;
1263
- runtime?: string | undefined;
1265
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1264
1266
  }>;
1265
1267
  service: z.ZodOptional<z.ZodObject<{
1266
1268
  code: z.ZodString;
@@ -1424,7 +1426,7 @@ declare const RegisterAgentRequestSchema: z.ZodObject<{
1424
1426
  code: string;
1425
1427
  mode: "embedded";
1426
1428
  name?: string | undefined;
1427
- runtime?: string | undefined;
1429
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1428
1430
  };
1429
1431
  service?: {
1430
1432
  code: string;
@@ -1468,7 +1470,7 @@ declare const RegisterAgentRequestSchema: z.ZodObject<{
1468
1470
  code: string;
1469
1471
  mode: "embedded";
1470
1472
  name?: string | undefined;
1471
- runtime?: string | undefined;
1473
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1472
1474
  };
1473
1475
  service?: {
1474
1476
  code: string;
@@ -1514,17 +1516,17 @@ declare const registerAgentRequestSchema: z.ZodObject<{
1514
1516
  code: z.ZodString;
1515
1517
  name: z.ZodOptional<z.ZodString>;
1516
1518
  mode: z.ZodLiteral<"embedded">;
1517
- runtime: z.ZodOptional<z.ZodString>;
1519
+ runtime: z.ZodOptional<z.ZodEnum<["nodejs", "java", "python", "go", "other"]>>;
1518
1520
  }, "strip", z.ZodTypeAny, {
1519
1521
  code: string;
1520
1522
  mode: "embedded";
1521
1523
  name?: string | undefined;
1522
- runtime?: string | undefined;
1524
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1523
1525
  }, {
1524
1526
  code: string;
1525
1527
  mode: "embedded";
1526
1528
  name?: string | undefined;
1527
- runtime?: string | undefined;
1529
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1528
1530
  }>;
1529
1531
  service: z.ZodOptional<z.ZodObject<{
1530
1532
  code: z.ZodString;
@@ -1688,7 +1690,7 @@ declare const registerAgentRequestSchema: z.ZodObject<{
1688
1690
  code: string;
1689
1691
  mode: "embedded";
1690
1692
  name?: string | undefined;
1691
- runtime?: string | undefined;
1693
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1692
1694
  };
1693
1695
  service?: {
1694
1696
  code: string;
@@ -1732,7 +1734,7 @@ declare const registerAgentRequestSchema: z.ZodObject<{
1732
1734
  code: string;
1733
1735
  mode: "embedded";
1734
1736
  name?: string | undefined;
1735
- runtime?: string | undefined;
1737
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1736
1738
  };
1737
1739
  service?: {
1738
1740
  code: string;
@@ -2231,6 +2233,45 @@ declare const CapsuleServiceDetailSchema: z.ZodObject<{
2231
2233
  lastHealthAt?: string | null | undefined;
2232
2234
  }>;
2233
2235
  type CapsuleServiceDetail = z.infer<typeof CapsuleServiceDetailSchema>;
2236
+ /**
2237
+ * Shape returned by an Agent's action `prepare` handler when responding to an
2238
+ * `ACTION_PREPARE` command. Used by the SDK as the contract between
2239
+ * `prepare()` callbacks and the backend; the backend forwards it to the UI as
2240
+ * the `data` field of the prepare command result.
2241
+ */
2242
+ declare const ActionPrepareResultSchema: z.ZodObject<{
2243
+ action: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2244
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2245
+ initialPayload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2246
+ currentState: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2247
+ }, "strip", z.ZodTypeAny, {
2248
+ inputSchema?: Record<string, any> | undefined;
2249
+ action?: Record<string, any> | undefined;
2250
+ initialPayload?: Record<string, any> | undefined;
2251
+ currentState?: Record<string, any> | undefined;
2252
+ }, {
2253
+ inputSchema?: Record<string, any> | undefined;
2254
+ action?: Record<string, any> | undefined;
2255
+ initialPayload?: Record<string, any> | undefined;
2256
+ currentState?: Record<string, any> | undefined;
2257
+ }>;
2258
+ type ActionPrepareResult = z.infer<typeof ActionPrepareResultSchema>;
2259
+ declare const actionPrepareResultSchema: z.ZodObject<{
2260
+ action: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2261
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2262
+ initialPayload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2263
+ currentState: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2264
+ }, "strip", z.ZodTypeAny, {
2265
+ inputSchema?: Record<string, any> | undefined;
2266
+ action?: Record<string, any> | undefined;
2267
+ initialPayload?: Record<string, any> | undefined;
2268
+ currentState?: Record<string, any> | undefined;
2269
+ }, {
2270
+ inputSchema?: Record<string, any> | undefined;
2271
+ action?: Record<string, any> | undefined;
2272
+ initialPayload?: Record<string, any> | undefined;
2273
+ currentState?: Record<string, any> | undefined;
2274
+ }>;
2234
2275
  declare const CreateActionCommandRequestSchema: z.ZodObject<{
2235
2276
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2236
2277
  confirmation: z.ZodOptional<z.ZodBoolean>;
@@ -2252,11 +2293,13 @@ declare const createActionCommandRequestSchema: z.ZodObject<{
2252
2293
  payload?: Record<string, any> | undefined;
2253
2294
  confirmation?: boolean | undefined;
2254
2295
  }>;
2296
+ declare const CommandTypeSchema: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE"]>;
2297
+ type CommandType = z.infer<typeof CommandTypeSchema>;
2255
2298
  declare const CommandSchema: z.ZodObject<{
2256
2299
  id: z.ZodString;
2257
2300
  agentId: z.ZodString;
2258
2301
  serviceId: z.ZodString;
2259
- type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE", "ACTION"]>;
2302
+ type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE"]>;
2260
2303
  actionName: z.ZodString;
2261
2304
  status: z.ZodEnum<["PENDING", "RUNNING", "SUCCEEDED", "FAILED", "EXPIRED", "CANCELLED"]>;
2262
2305
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -2266,7 +2309,7 @@ declare const CommandSchema: z.ZodObject<{
2266
2309
  completedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2267
2310
  expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2268
2311
  }, "strip", z.ZodTypeAny, {
2269
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2312
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2270
2313
  id: string;
2271
2314
  createdAt: string;
2272
2315
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2279,7 +2322,7 @@ declare const CommandSchema: z.ZodObject<{
2279
2322
  startedAt?: string | null | undefined;
2280
2323
  completedAt?: string | null | undefined;
2281
2324
  }, {
2282
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2325
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2283
2326
  id: string;
2284
2327
  createdAt: string;
2285
2328
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2368,7 +2411,7 @@ declare const CommandDetailSchema: z.ZodObject<{
2368
2411
  id: z.ZodString;
2369
2412
  agentId: z.ZodString;
2370
2413
  serviceId: z.ZodString;
2371
- type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE", "ACTION"]>;
2414
+ type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE"]>;
2372
2415
  actionName: z.ZodString;
2373
2416
  status: z.ZodEnum<["PENDING", "RUNNING", "SUCCEEDED", "FAILED", "EXPIRED", "CANCELLED"]>;
2374
2417
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -2404,7 +2447,7 @@ declare const CommandDetailSchema: z.ZodObject<{
2404
2447
  error?: Record<string, any> | undefined;
2405
2448
  }>>>;
2406
2449
  }, "strip", z.ZodTypeAny, {
2407
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2450
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2408
2451
  id: string;
2409
2452
  createdAt: string;
2410
2453
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2426,7 +2469,7 @@ declare const CommandDetailSchema: z.ZodObject<{
2426
2469
  error?: Record<string, any> | undefined;
2427
2470
  } | null | undefined;
2428
2471
  }, {
2429
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2472
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2430
2473
  id: string;
2431
2474
  createdAt: string;
2432
2475
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2463,9 +2506,9 @@ declare const AuditEventSchema: z.ZodObject<{
2463
2506
  }, "strip", z.ZodTypeAny, {
2464
2507
  id: string;
2465
2508
  createdAt: string;
2509
+ action: string;
2466
2510
  result: "SUCCESS" | "FAILURE";
2467
2511
  actorType: "USER" | "AGENT" | "SYSTEM";
2468
- action: string;
2469
2512
  message?: string | null | undefined;
2470
2513
  actorId?: string | null | undefined;
2471
2514
  targetType?: string | null | undefined;
@@ -2474,9 +2517,9 @@ declare const AuditEventSchema: z.ZodObject<{
2474
2517
  }, {
2475
2518
  id: string;
2476
2519
  createdAt: string;
2520
+ action: string;
2477
2521
  result: "SUCCESS" | "FAILURE";
2478
2522
  actorType: "USER" | "AGENT" | "SYSTEM";
2479
- action: string;
2480
2523
  message?: string | null | undefined;
2481
2524
  actorId?: string | null | undefined;
2482
2525
  targetType?: string | null | undefined;
@@ -2492,7 +2535,7 @@ declare const DashboardSummarySchema: z.ZodObject<{
2492
2535
  id: z.ZodString;
2493
2536
  agentId: z.ZodString;
2494
2537
  serviceId: z.ZodString;
2495
- type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE", "ACTION"]>;
2538
+ type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE"]>;
2496
2539
  actionName: z.ZodString;
2497
2540
  status: z.ZodEnum<["PENDING", "RUNNING", "SUCCEEDED", "FAILED", "EXPIRED", "CANCELLED"]>;
2498
2541
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -2502,7 +2545,7 @@ declare const DashboardSummarySchema: z.ZodObject<{
2502
2545
  completedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2503
2546
  expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2504
2547
  }, "strip", z.ZodTypeAny, {
2505
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2548
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2506
2549
  id: string;
2507
2550
  createdAt: string;
2508
2551
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2515,7 +2558,7 @@ declare const DashboardSummarySchema: z.ZodObject<{
2515
2558
  startedAt?: string | null | undefined;
2516
2559
  completedAt?: string | null | undefined;
2517
2560
  }, {
2518
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2561
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2519
2562
  id: string;
2520
2563
  createdAt: string;
2521
2564
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2542,9 +2585,9 @@ declare const DashboardSummarySchema: z.ZodObject<{
2542
2585
  }, "strip", z.ZodTypeAny, {
2543
2586
  id: string;
2544
2587
  createdAt: string;
2588
+ action: string;
2545
2589
  result: "SUCCESS" | "FAILURE";
2546
2590
  actorType: "USER" | "AGENT" | "SYSTEM";
2547
- action: string;
2548
2591
  message?: string | null | undefined;
2549
2592
  actorId?: string | null | undefined;
2550
2593
  targetType?: string | null | undefined;
@@ -2553,9 +2596,9 @@ declare const DashboardSummarySchema: z.ZodObject<{
2553
2596
  }, {
2554
2597
  id: string;
2555
2598
  createdAt: string;
2599
+ action: string;
2556
2600
  result: "SUCCESS" | "FAILURE";
2557
2601
  actorType: "USER" | "AGENT" | "SYSTEM";
2558
- action: string;
2559
2602
  message?: string | null | undefined;
2560
2603
  actorId?: string | null | undefined;
2561
2604
  targetType?: string | null | undefined;
@@ -2567,7 +2610,7 @@ declare const DashboardSummarySchema: z.ZodObject<{
2567
2610
  serviceCounts: Record<string, number>;
2568
2611
  commandCounts: Record<string, number>;
2569
2612
  recentCommands?: {
2570
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2613
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2571
2614
  id: string;
2572
2615
  createdAt: string;
2573
2616
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2583,9 +2626,9 @@ declare const DashboardSummarySchema: z.ZodObject<{
2583
2626
  recentAuditEvents?: {
2584
2627
  id: string;
2585
2628
  createdAt: string;
2629
+ action: string;
2586
2630
  result: "SUCCESS" | "FAILURE";
2587
2631
  actorType: "USER" | "AGENT" | "SYSTEM";
2588
- action: string;
2589
2632
  message?: string | null | undefined;
2590
2633
  actorId?: string | null | undefined;
2591
2634
  targetType?: string | null | undefined;
@@ -2597,7 +2640,7 @@ declare const DashboardSummarySchema: z.ZodObject<{
2597
2640
  serviceCounts: Record<string, number>;
2598
2641
  commandCounts: Record<string, number>;
2599
2642
  recentCommands?: {
2600
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2643
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2601
2644
  id: string;
2602
2645
  createdAt: string;
2603
2646
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2613,9 +2656,9 @@ declare const DashboardSummarySchema: z.ZodObject<{
2613
2656
  recentAuditEvents?: {
2614
2657
  id: string;
2615
2658
  createdAt: string;
2659
+ action: string;
2616
2660
  result: "SUCCESS" | "FAILURE";
2617
2661
  actorType: "USER" | "AGENT" | "SYSTEM";
2618
- action: string;
2619
2662
  message?: string | null | undefined;
2620
2663
  actorId?: string | null | undefined;
2621
2664
  targetType?: string | null | undefined;
@@ -2738,4 +2781,4 @@ declare function paginate<T>(items: T[], page: number, pageSize: number, total:
2738
2781
  };
2739
2782
  };
2740
2783
 
2741
- export { type ActionDefinition, type ActionDefinitionInput, ActionDefinitionInputSchema, ActionDefinitionSchema, type AdminLoginRequest, AdminLoginRequestSchema, type AdminSession, AdminSessionSchema, type Agent, type AgentHeartbeatRequest, AgentHeartbeatRequestSchema, type AgentHeartbeatResponse, AgentHeartbeatResponseSchema, AgentSchema, AgentStatus, AgentStatusSchema, AnyJson, AuditActorType, type AuditEvent, AuditEventSchema, AuditResult, type CapsuleManifest, CapsuleManifestSchema, type CapsuleService, type CapsuleServiceDetail, CapsuleServiceDetailSchema, CapsuleServiceSchema, CapsuleServiceStatus, CapsuleServiceStatusSchema, type Command, type CommandDetail, CommandDetailSchema, type CommandResult, CommandResultSchema, CommandSchema, CommandStatus, CommandStatusSchema, type ConfigItem, type ConfigItemInput, ConfigItemInputSchema, ConfigItemSchema, type CreateActionCommandRequest, CreateActionCommandRequestSchema, type CreateRegistrationTokenRequest, CreateRegistrationTokenRequestSchema, type CreateRegistrationTokenResponse, CreateRegistrationTokenResponseSchema, type CreateUserRequest, DangerLevel, DangerLevelSchema, type DashboardSummary, DashboardSummarySchema, ErrorCode, type ErrorEnvelope, type HealthReport, type HealthReportInput, HealthReportInputSchema, HealthReportSchema, HealthStatus, HealthStatusSchema, HttpError, type IdPrefix, ListQueryBase, type Pagination, type RegisterAgentRequest, RegisterAgentRequestSchema, type RegisterAgentResponse, RegisterAgentResponseSchema, type RegistrationToken, RegistrationTokenSchema, type ReportCommandResultRequest, ReportCommandResultRequestSchema, type ReportedService, ReportedServiceSchema, type ResetUserPasswordRequest, type ServiceReportRequest, ServiceReportRequestSchema, type SuccessEnvelope, type SystemHealth, SystemHealthSchema, type SystemVersion, SystemVersionSchema, TokenStatus, type UpdateUserRequest, type User, UserRole, UserSchema, actionDefinitionInputSchema, adminLoginRequestSchema, agentHeartbeatRequestSchema, configItemInputSchema, createActionCommandRequestSchema, createRegistrationTokenRequestSchema, createUserRequestSchema, healthReportInputSchema, idPrefixes, newId, paginate, parseSort, registerAgentRequestSchema, reportCommandResultRequestSchema, reportedServiceSchema, resetUserPasswordRequestSchema, serviceReportRequestSchema, updateUserRequestSchema };
2784
+ export { type ActionDefinition, type ActionDefinitionInput, ActionDefinitionInputSchema, ActionDefinitionSchema, type ActionPrepareResult, ActionPrepareResultSchema, type AdminLoginRequest, AdminLoginRequestSchema, type AdminSession, AdminSessionSchema, type Agent, type AgentHeartbeatRequest, AgentHeartbeatRequestSchema, type AgentHeartbeatResponse, AgentHeartbeatResponseSchema, AgentSchema, AgentStatus, AgentStatusSchema, AnyJson, AuditActorType, type AuditEvent, AuditEventSchema, AuditResult, type CapsuleManifest, CapsuleManifestSchema, type CapsuleService, type CapsuleServiceDetail, CapsuleServiceDetailSchema, CapsuleServiceSchema, CapsuleServiceStatus, CapsuleServiceStatusSchema, type Command, type CommandDetail, CommandDetailSchema, type CommandResult, CommandResultSchema, CommandSchema, CommandStatus, CommandStatusSchema, type CommandType, CommandTypeSchema, type ConfigItem, type ConfigItemInput, ConfigItemInputSchema, ConfigItemSchema, type CreateActionCommandRequest, CreateActionCommandRequestSchema, type CreateRegistrationTokenRequest, CreateRegistrationTokenRequestSchema, type CreateRegistrationTokenResponse, CreateRegistrationTokenResponseSchema, type CreateUserRequest, DangerLevel, DangerLevelSchema, type DashboardSummary, DashboardSummarySchema, ErrorCode, type ErrorEnvelope, type HealthReport, type HealthReportInput, HealthReportInputSchema, HealthReportSchema, HealthStatus, HealthStatusSchema, HttpError, type IdPrefix, ListQueryBase, type Pagination, type RegisterAgentRequest, RegisterAgentRequestSchema, type RegisterAgentResponse, RegisterAgentResponseSchema, type RegistrationToken, RegistrationTokenSchema, type ReportCommandResultRequest, ReportCommandResultRequestSchema, type ReportedService, ReportedServiceSchema, type ResetUserPasswordRequest, type RuntimeKind, RuntimeKindSchema, type ServiceReportRequest, ServiceReportRequestSchema, type SuccessEnvelope, type SystemHealth, SystemHealthSchema, type SystemVersion, SystemVersionSchema, TokenStatus, type UpdateUserRequest, type User, UserRole, UserSchema, actionDefinitionInputSchema, actionPrepareResultSchema, adminLoginRequestSchema, agentHeartbeatRequestSchema, configItemInputSchema, createActionCommandRequestSchema, createRegistrationTokenRequestSchema, createUserRequestSchema, healthReportInputSchema, idPrefixes, newId, paginate, parseSort, registerAgentRequestSchema, reportCommandResultRequestSchema, reportedServiceSchema, resetUserPasswordRequestSchema, serviceReportRequestSchema, updateUserRequestSchema };
package/dist/index.d.ts CHANGED
@@ -1244,23 +1244,25 @@ declare const serviceReportRequestSchema: z.ZodObject<{
1244
1244
  }[] | undefined;
1245
1245
  }[];
1246
1246
  }>;
1247
+ declare const RuntimeKindSchema: z.ZodEnum<["nodejs", "java", "python", "go", "other"]>;
1248
+ type RuntimeKind = z.infer<typeof RuntimeKindSchema>;
1247
1249
  declare const RegisterAgentRequestSchema: z.ZodObject<{
1248
1250
  registrationToken: z.ZodString;
1249
1251
  agent: z.ZodObject<{
1250
1252
  code: z.ZodString;
1251
1253
  name: z.ZodOptional<z.ZodString>;
1252
1254
  mode: z.ZodLiteral<"embedded">;
1253
- runtime: z.ZodOptional<z.ZodString>;
1255
+ runtime: z.ZodOptional<z.ZodEnum<["nodejs", "java", "python", "go", "other"]>>;
1254
1256
  }, "strip", z.ZodTypeAny, {
1255
1257
  code: string;
1256
1258
  mode: "embedded";
1257
1259
  name?: string | undefined;
1258
- runtime?: string | undefined;
1260
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1259
1261
  }, {
1260
1262
  code: string;
1261
1263
  mode: "embedded";
1262
1264
  name?: string | undefined;
1263
- runtime?: string | undefined;
1265
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1264
1266
  }>;
1265
1267
  service: z.ZodOptional<z.ZodObject<{
1266
1268
  code: z.ZodString;
@@ -1424,7 +1426,7 @@ declare const RegisterAgentRequestSchema: z.ZodObject<{
1424
1426
  code: string;
1425
1427
  mode: "embedded";
1426
1428
  name?: string | undefined;
1427
- runtime?: string | undefined;
1429
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1428
1430
  };
1429
1431
  service?: {
1430
1432
  code: string;
@@ -1468,7 +1470,7 @@ declare const RegisterAgentRequestSchema: z.ZodObject<{
1468
1470
  code: string;
1469
1471
  mode: "embedded";
1470
1472
  name?: string | undefined;
1471
- runtime?: string | undefined;
1473
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1472
1474
  };
1473
1475
  service?: {
1474
1476
  code: string;
@@ -1514,17 +1516,17 @@ declare const registerAgentRequestSchema: z.ZodObject<{
1514
1516
  code: z.ZodString;
1515
1517
  name: z.ZodOptional<z.ZodString>;
1516
1518
  mode: z.ZodLiteral<"embedded">;
1517
- runtime: z.ZodOptional<z.ZodString>;
1519
+ runtime: z.ZodOptional<z.ZodEnum<["nodejs", "java", "python", "go", "other"]>>;
1518
1520
  }, "strip", z.ZodTypeAny, {
1519
1521
  code: string;
1520
1522
  mode: "embedded";
1521
1523
  name?: string | undefined;
1522
- runtime?: string | undefined;
1524
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1523
1525
  }, {
1524
1526
  code: string;
1525
1527
  mode: "embedded";
1526
1528
  name?: string | undefined;
1527
- runtime?: string | undefined;
1529
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1528
1530
  }>;
1529
1531
  service: z.ZodOptional<z.ZodObject<{
1530
1532
  code: z.ZodString;
@@ -1688,7 +1690,7 @@ declare const registerAgentRequestSchema: z.ZodObject<{
1688
1690
  code: string;
1689
1691
  mode: "embedded";
1690
1692
  name?: string | undefined;
1691
- runtime?: string | undefined;
1693
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1692
1694
  };
1693
1695
  service?: {
1694
1696
  code: string;
@@ -1732,7 +1734,7 @@ declare const registerAgentRequestSchema: z.ZodObject<{
1732
1734
  code: string;
1733
1735
  mode: "embedded";
1734
1736
  name?: string | undefined;
1735
- runtime?: string | undefined;
1737
+ runtime?: "nodejs" | "java" | "python" | "go" | "other" | undefined;
1736
1738
  };
1737
1739
  service?: {
1738
1740
  code: string;
@@ -2231,6 +2233,45 @@ declare const CapsuleServiceDetailSchema: z.ZodObject<{
2231
2233
  lastHealthAt?: string | null | undefined;
2232
2234
  }>;
2233
2235
  type CapsuleServiceDetail = z.infer<typeof CapsuleServiceDetailSchema>;
2236
+ /**
2237
+ * Shape returned by an Agent's action `prepare` handler when responding to an
2238
+ * `ACTION_PREPARE` command. Used by the SDK as the contract between
2239
+ * `prepare()` callbacks and the backend; the backend forwards it to the UI as
2240
+ * the `data` field of the prepare command result.
2241
+ */
2242
+ declare const ActionPrepareResultSchema: z.ZodObject<{
2243
+ action: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2244
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2245
+ initialPayload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2246
+ currentState: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2247
+ }, "strip", z.ZodTypeAny, {
2248
+ inputSchema?: Record<string, any> | undefined;
2249
+ action?: Record<string, any> | undefined;
2250
+ initialPayload?: Record<string, any> | undefined;
2251
+ currentState?: Record<string, any> | undefined;
2252
+ }, {
2253
+ inputSchema?: Record<string, any> | undefined;
2254
+ action?: Record<string, any> | undefined;
2255
+ initialPayload?: Record<string, any> | undefined;
2256
+ currentState?: Record<string, any> | undefined;
2257
+ }>;
2258
+ type ActionPrepareResult = z.infer<typeof ActionPrepareResultSchema>;
2259
+ declare const actionPrepareResultSchema: z.ZodObject<{
2260
+ action: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2261
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2262
+ initialPayload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2263
+ currentState: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2264
+ }, "strip", z.ZodTypeAny, {
2265
+ inputSchema?: Record<string, any> | undefined;
2266
+ action?: Record<string, any> | undefined;
2267
+ initialPayload?: Record<string, any> | undefined;
2268
+ currentState?: Record<string, any> | undefined;
2269
+ }, {
2270
+ inputSchema?: Record<string, any> | undefined;
2271
+ action?: Record<string, any> | undefined;
2272
+ initialPayload?: Record<string, any> | undefined;
2273
+ currentState?: Record<string, any> | undefined;
2274
+ }>;
2234
2275
  declare const CreateActionCommandRequestSchema: z.ZodObject<{
2235
2276
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2236
2277
  confirmation: z.ZodOptional<z.ZodBoolean>;
@@ -2252,11 +2293,13 @@ declare const createActionCommandRequestSchema: z.ZodObject<{
2252
2293
  payload?: Record<string, any> | undefined;
2253
2294
  confirmation?: boolean | undefined;
2254
2295
  }>;
2296
+ declare const CommandTypeSchema: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE"]>;
2297
+ type CommandType = z.infer<typeof CommandTypeSchema>;
2255
2298
  declare const CommandSchema: z.ZodObject<{
2256
2299
  id: z.ZodString;
2257
2300
  agentId: z.ZodString;
2258
2301
  serviceId: z.ZodString;
2259
- type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE", "ACTION"]>;
2302
+ type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE"]>;
2260
2303
  actionName: z.ZodString;
2261
2304
  status: z.ZodEnum<["PENDING", "RUNNING", "SUCCEEDED", "FAILED", "EXPIRED", "CANCELLED"]>;
2262
2305
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -2266,7 +2309,7 @@ declare const CommandSchema: z.ZodObject<{
2266
2309
  completedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2267
2310
  expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2268
2311
  }, "strip", z.ZodTypeAny, {
2269
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2312
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2270
2313
  id: string;
2271
2314
  createdAt: string;
2272
2315
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2279,7 +2322,7 @@ declare const CommandSchema: z.ZodObject<{
2279
2322
  startedAt?: string | null | undefined;
2280
2323
  completedAt?: string | null | undefined;
2281
2324
  }, {
2282
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2325
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2283
2326
  id: string;
2284
2327
  createdAt: string;
2285
2328
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2368,7 +2411,7 @@ declare const CommandDetailSchema: z.ZodObject<{
2368
2411
  id: z.ZodString;
2369
2412
  agentId: z.ZodString;
2370
2413
  serviceId: z.ZodString;
2371
- type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE", "ACTION"]>;
2414
+ type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE"]>;
2372
2415
  actionName: z.ZodString;
2373
2416
  status: z.ZodEnum<["PENDING", "RUNNING", "SUCCEEDED", "FAILED", "EXPIRED", "CANCELLED"]>;
2374
2417
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -2404,7 +2447,7 @@ declare const CommandDetailSchema: z.ZodObject<{
2404
2447
  error?: Record<string, any> | undefined;
2405
2448
  }>>>;
2406
2449
  }, "strip", z.ZodTypeAny, {
2407
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2450
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2408
2451
  id: string;
2409
2452
  createdAt: string;
2410
2453
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2426,7 +2469,7 @@ declare const CommandDetailSchema: z.ZodObject<{
2426
2469
  error?: Record<string, any> | undefined;
2427
2470
  } | null | undefined;
2428
2471
  }, {
2429
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2472
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2430
2473
  id: string;
2431
2474
  createdAt: string;
2432
2475
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2463,9 +2506,9 @@ declare const AuditEventSchema: z.ZodObject<{
2463
2506
  }, "strip", z.ZodTypeAny, {
2464
2507
  id: string;
2465
2508
  createdAt: string;
2509
+ action: string;
2466
2510
  result: "SUCCESS" | "FAILURE";
2467
2511
  actorType: "USER" | "AGENT" | "SYSTEM";
2468
- action: string;
2469
2512
  message?: string | null | undefined;
2470
2513
  actorId?: string | null | undefined;
2471
2514
  targetType?: string | null | undefined;
@@ -2474,9 +2517,9 @@ declare const AuditEventSchema: z.ZodObject<{
2474
2517
  }, {
2475
2518
  id: string;
2476
2519
  createdAt: string;
2520
+ action: string;
2477
2521
  result: "SUCCESS" | "FAILURE";
2478
2522
  actorType: "USER" | "AGENT" | "SYSTEM";
2479
- action: string;
2480
2523
  message?: string | null | undefined;
2481
2524
  actorId?: string | null | undefined;
2482
2525
  targetType?: string | null | undefined;
@@ -2492,7 +2535,7 @@ declare const DashboardSummarySchema: z.ZodObject<{
2492
2535
  id: z.ZodString;
2493
2536
  agentId: z.ZodString;
2494
2537
  serviceId: z.ZodString;
2495
- type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE", "ACTION"]>;
2538
+ type: z.ZodEnum<["ACTION_PREPARE", "ACTION_EXECUTE"]>;
2496
2539
  actionName: z.ZodString;
2497
2540
  status: z.ZodEnum<["PENDING", "RUNNING", "SUCCEEDED", "FAILED", "EXPIRED", "CANCELLED"]>;
2498
2541
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -2502,7 +2545,7 @@ declare const DashboardSummarySchema: z.ZodObject<{
2502
2545
  completedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2503
2546
  expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2504
2547
  }, "strip", z.ZodTypeAny, {
2505
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2548
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2506
2549
  id: string;
2507
2550
  createdAt: string;
2508
2551
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2515,7 +2558,7 @@ declare const DashboardSummarySchema: z.ZodObject<{
2515
2558
  startedAt?: string | null | undefined;
2516
2559
  completedAt?: string | null | undefined;
2517
2560
  }, {
2518
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2561
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2519
2562
  id: string;
2520
2563
  createdAt: string;
2521
2564
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2542,9 +2585,9 @@ declare const DashboardSummarySchema: z.ZodObject<{
2542
2585
  }, "strip", z.ZodTypeAny, {
2543
2586
  id: string;
2544
2587
  createdAt: string;
2588
+ action: string;
2545
2589
  result: "SUCCESS" | "FAILURE";
2546
2590
  actorType: "USER" | "AGENT" | "SYSTEM";
2547
- action: string;
2548
2591
  message?: string | null | undefined;
2549
2592
  actorId?: string | null | undefined;
2550
2593
  targetType?: string | null | undefined;
@@ -2553,9 +2596,9 @@ declare const DashboardSummarySchema: z.ZodObject<{
2553
2596
  }, {
2554
2597
  id: string;
2555
2598
  createdAt: string;
2599
+ action: string;
2556
2600
  result: "SUCCESS" | "FAILURE";
2557
2601
  actorType: "USER" | "AGENT" | "SYSTEM";
2558
- action: string;
2559
2602
  message?: string | null | undefined;
2560
2603
  actorId?: string | null | undefined;
2561
2604
  targetType?: string | null | undefined;
@@ -2567,7 +2610,7 @@ declare const DashboardSummarySchema: z.ZodObject<{
2567
2610
  serviceCounts: Record<string, number>;
2568
2611
  commandCounts: Record<string, number>;
2569
2612
  recentCommands?: {
2570
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2613
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2571
2614
  id: string;
2572
2615
  createdAt: string;
2573
2616
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2583,9 +2626,9 @@ declare const DashboardSummarySchema: z.ZodObject<{
2583
2626
  recentAuditEvents?: {
2584
2627
  id: string;
2585
2628
  createdAt: string;
2629
+ action: string;
2586
2630
  result: "SUCCESS" | "FAILURE";
2587
2631
  actorType: "USER" | "AGENT" | "SYSTEM";
2588
- action: string;
2589
2632
  message?: string | null | undefined;
2590
2633
  actorId?: string | null | undefined;
2591
2634
  targetType?: string | null | undefined;
@@ -2597,7 +2640,7 @@ declare const DashboardSummarySchema: z.ZodObject<{
2597
2640
  serviceCounts: Record<string, number>;
2598
2641
  commandCounts: Record<string, number>;
2599
2642
  recentCommands?: {
2600
- type: "ACTION_PREPARE" | "ACTION_EXECUTE" | "ACTION";
2643
+ type: "ACTION_PREPARE" | "ACTION_EXECUTE";
2601
2644
  id: string;
2602
2645
  createdAt: string;
2603
2646
  status: "PENDING" | "RUNNING" | "SUCCEEDED" | "FAILED" | "EXPIRED" | "CANCELLED";
@@ -2613,9 +2656,9 @@ declare const DashboardSummarySchema: z.ZodObject<{
2613
2656
  recentAuditEvents?: {
2614
2657
  id: string;
2615
2658
  createdAt: string;
2659
+ action: string;
2616
2660
  result: "SUCCESS" | "FAILURE";
2617
2661
  actorType: "USER" | "AGENT" | "SYSTEM";
2618
- action: string;
2619
2662
  message?: string | null | undefined;
2620
2663
  actorId?: string | null | undefined;
2621
2664
  targetType?: string | null | undefined;
@@ -2738,4 +2781,4 @@ declare function paginate<T>(items: T[], page: number, pageSize: number, total:
2738
2781
  };
2739
2782
  };
2740
2783
 
2741
- export { type ActionDefinition, type ActionDefinitionInput, ActionDefinitionInputSchema, ActionDefinitionSchema, type AdminLoginRequest, AdminLoginRequestSchema, type AdminSession, AdminSessionSchema, type Agent, type AgentHeartbeatRequest, AgentHeartbeatRequestSchema, type AgentHeartbeatResponse, AgentHeartbeatResponseSchema, AgentSchema, AgentStatus, AgentStatusSchema, AnyJson, AuditActorType, type AuditEvent, AuditEventSchema, AuditResult, type CapsuleManifest, CapsuleManifestSchema, type CapsuleService, type CapsuleServiceDetail, CapsuleServiceDetailSchema, CapsuleServiceSchema, CapsuleServiceStatus, CapsuleServiceStatusSchema, type Command, type CommandDetail, CommandDetailSchema, type CommandResult, CommandResultSchema, CommandSchema, CommandStatus, CommandStatusSchema, type ConfigItem, type ConfigItemInput, ConfigItemInputSchema, ConfigItemSchema, type CreateActionCommandRequest, CreateActionCommandRequestSchema, type CreateRegistrationTokenRequest, CreateRegistrationTokenRequestSchema, type CreateRegistrationTokenResponse, CreateRegistrationTokenResponseSchema, type CreateUserRequest, DangerLevel, DangerLevelSchema, type DashboardSummary, DashboardSummarySchema, ErrorCode, type ErrorEnvelope, type HealthReport, type HealthReportInput, HealthReportInputSchema, HealthReportSchema, HealthStatus, HealthStatusSchema, HttpError, type IdPrefix, ListQueryBase, type Pagination, type RegisterAgentRequest, RegisterAgentRequestSchema, type RegisterAgentResponse, RegisterAgentResponseSchema, type RegistrationToken, RegistrationTokenSchema, type ReportCommandResultRequest, ReportCommandResultRequestSchema, type ReportedService, ReportedServiceSchema, type ResetUserPasswordRequest, type ServiceReportRequest, ServiceReportRequestSchema, type SuccessEnvelope, type SystemHealth, SystemHealthSchema, type SystemVersion, SystemVersionSchema, TokenStatus, type UpdateUserRequest, type User, UserRole, UserSchema, actionDefinitionInputSchema, adminLoginRequestSchema, agentHeartbeatRequestSchema, configItemInputSchema, createActionCommandRequestSchema, createRegistrationTokenRequestSchema, createUserRequestSchema, healthReportInputSchema, idPrefixes, newId, paginate, parseSort, registerAgentRequestSchema, reportCommandResultRequestSchema, reportedServiceSchema, resetUserPasswordRequestSchema, serviceReportRequestSchema, updateUserRequestSchema };
2784
+ export { type ActionDefinition, type ActionDefinitionInput, ActionDefinitionInputSchema, ActionDefinitionSchema, type ActionPrepareResult, ActionPrepareResultSchema, type AdminLoginRequest, AdminLoginRequestSchema, type AdminSession, AdminSessionSchema, type Agent, type AgentHeartbeatRequest, AgentHeartbeatRequestSchema, type AgentHeartbeatResponse, AgentHeartbeatResponseSchema, AgentSchema, AgentStatus, AgentStatusSchema, AnyJson, AuditActorType, type AuditEvent, AuditEventSchema, AuditResult, type CapsuleManifest, CapsuleManifestSchema, type CapsuleService, type CapsuleServiceDetail, CapsuleServiceDetailSchema, CapsuleServiceSchema, CapsuleServiceStatus, CapsuleServiceStatusSchema, type Command, type CommandDetail, CommandDetailSchema, type CommandResult, CommandResultSchema, CommandSchema, CommandStatus, CommandStatusSchema, type CommandType, CommandTypeSchema, type ConfigItem, type ConfigItemInput, ConfigItemInputSchema, ConfigItemSchema, type CreateActionCommandRequest, CreateActionCommandRequestSchema, type CreateRegistrationTokenRequest, CreateRegistrationTokenRequestSchema, type CreateRegistrationTokenResponse, CreateRegistrationTokenResponseSchema, type CreateUserRequest, DangerLevel, DangerLevelSchema, type DashboardSummary, DashboardSummarySchema, ErrorCode, type ErrorEnvelope, type HealthReport, type HealthReportInput, HealthReportInputSchema, HealthReportSchema, HealthStatus, HealthStatusSchema, HttpError, type IdPrefix, ListQueryBase, type Pagination, type RegisterAgentRequest, RegisterAgentRequestSchema, type RegisterAgentResponse, RegisterAgentResponseSchema, type RegistrationToken, RegistrationTokenSchema, type ReportCommandResultRequest, ReportCommandResultRequestSchema, type ReportedService, ReportedServiceSchema, type ResetUserPasswordRequest, type RuntimeKind, RuntimeKindSchema, type ServiceReportRequest, ServiceReportRequestSchema, type SuccessEnvelope, type SystemHealth, SystemHealthSchema, type SystemVersion, SystemVersionSchema, TokenStatus, type UpdateUserRequest, type User, UserRole, UserSchema, actionDefinitionInputSchema, actionPrepareResultSchema, adminLoginRequestSchema, agentHeartbeatRequestSchema, configItemInputSchema, createActionCommandRequestSchema, createRegistrationTokenRequestSchema, createUserRequestSchema, healthReportInputSchema, idPrefixes, newId, paginate, parseSort, registerAgentRequestSchema, reportCommandResultRequestSchema, reportedServiceSchema, resetUserPasswordRequestSchema, serviceReportRequestSchema, updateUserRequestSchema };
package/dist/index.js CHANGED
@@ -59,7 +59,8 @@ var ReportedServiceSchema = z.object({ code: z.string().min(1).max(80), name: z.
59
59
  var reportedServiceSchema = ReportedServiceSchema;
60
60
  var ServiceReportRequestSchema = z.object({ services: z.array(ReportedServiceSchema).min(1) });
61
61
  var serviceReportRequestSchema = ServiceReportRequestSchema;
62
- var RegisterAgentRequestSchema = z.object({ registrationToken: z.string().startsWith("opstage_reg_"), agent: z.object({ code: z.string(), name: z.string().optional(), mode: z.literal("embedded"), runtime: z.string().optional() }), service: ReportedServiceSchema.optional() });
62
+ var RuntimeKindSchema = z.enum(["nodejs", "java", "python", "go", "other"]);
63
+ var RegisterAgentRequestSchema = z.object({ registrationToken: z.string().startsWith("opstage_reg_"), agent: z.object({ code: z.string(), name: z.string().optional(), mode: z.literal("embedded"), runtime: RuntimeKindSchema.optional() }), service: ReportedServiceSchema.optional() });
63
64
  var registerAgentRequestSchema = RegisterAgentRequestSchema;
64
65
  var RegisterAgentResponseSchema = z.object({ agentId: z.string().startsWith("agt_"), agentToken: z.string().startsWith("opstage_agent_"), heartbeatIntervalSeconds: z.number().int(), commandPollIntervalSeconds: z.number().int() });
65
66
  var AgentHeartbeatResponseSchema = z.object({ heartbeatIntervalSeconds: z.number().int(), commandPollIntervalSeconds: z.number().int() });
@@ -70,9 +71,17 @@ var HealthReportSchema = z.object({ id: z.string().startsWith("hlr_"), serviceId
70
71
  var ConfigItemSchema = z.object({ id: z.string().startsWith("cfg_"), serviceId: z.string().startsWith("svc_"), key: z.string(), label: z.string().nullable().optional(), type: z.string(), source: z.string().nullable().optional(), editable: z.boolean().default(false), sensitive: z.boolean(), valuePreview: z.string().nullable().optional(), defaultValue: z.string().nullable().optional(), secretRef: z.string().nullable().optional() });
71
72
  var ActionDefinitionSchema = z.object({ id: z.string().startsWith("act_"), serviceId: z.string().startsWith("svc_"), name: z.string(), label: z.string(), description: z.string().nullable().optional(), dangerLevel: z.enum(DangerLevel), requiresConfirmation: z.boolean(), category: z.string().optional(), order: z.number().int().optional(), inputSchema: AnyJson.optional(), outputSchema: AnyJson.optional(), timeoutSeconds: z.number().int().optional() });
72
73
  var CapsuleServiceDetailSchema = CapsuleServiceSchema.extend({ manifest: AnyJson.optional(), health: HealthReportSchema.nullable().optional(), configs: z.array(ConfigItemSchema).optional(), actions: z.array(ActionDefinitionSchema).optional() });
74
+ var ActionPrepareResultSchema = z.object({
75
+ action: AnyJson.optional(),
76
+ inputSchema: AnyJson.optional(),
77
+ initialPayload: AnyJson.optional(),
78
+ currentState: AnyJson.optional()
79
+ });
80
+ var actionPrepareResultSchema = ActionPrepareResultSchema;
73
81
  var CreateActionCommandRequestSchema = z.object({ payload: AnyJson.optional(), confirmation: z.boolean().optional() });
74
82
  var createActionCommandRequestSchema = CreateActionCommandRequestSchema;
75
- var CommandSchema = z.object({ id: z.string().startsWith("cmd_"), agentId: z.string().startsWith("agt_"), serviceId: z.string().startsWith("svc_"), type: z.enum(["ACTION_PREPARE", "ACTION_EXECUTE", "ACTION"]), actionName: z.string(), status: CommandStatusSchema, payload: AnyJson.optional(), createdByUserId: z.string().startsWith("usr_").nullable().optional(), createdAt: z.string(), startedAt: z.string().nullable().optional(), completedAt: z.string().nullable().optional(), expiresAt: z.string().nullable().optional() });
83
+ var CommandTypeSchema = z.enum(["ACTION_PREPARE", "ACTION_EXECUTE"]);
84
+ var CommandSchema = z.object({ id: z.string().startsWith("cmd_"), agentId: z.string().startsWith("agt_"), serviceId: z.string().startsWith("svc_"), type: CommandTypeSchema, actionName: z.string(), status: CommandStatusSchema, payload: AnyJson.optional(), createdByUserId: z.string().startsWith("usr_").nullable().optional(), createdAt: z.string(), startedAt: z.string().nullable().optional(), completedAt: z.string().nullable().optional(), expiresAt: z.string().nullable().optional() });
76
85
  var ReportCommandResultRequestSchema = z.object({ success: z.boolean(), message: z.string().optional(), data: AnyJson.optional(), error: AnyJson.optional(), startedAt: z.string().optional(), finishedAt: z.string().optional() });
77
86
  var reportCommandResultRequestSchema = ReportCommandResultRequestSchema;
78
87
  var CommandResultSchema = z.object({ id: z.string().startsWith("crs_"), commandId: z.string().startsWith("cmd_"), success: z.boolean(), message: z.string().nullable().optional(), data: AnyJson.optional(), error: AnyJson.optional(), reportedAt: z.string() });
@@ -110,6 +119,7 @@ function paginate(items, page, pageSize, total) {
110
119
  export {
111
120
  ActionDefinitionInputSchema,
112
121
  ActionDefinitionSchema,
122
+ ActionPrepareResultSchema,
113
123
  AdminLoginRequestSchema,
114
124
  AdminSessionSchema,
115
125
  AgentHeartbeatRequestSchema,
@@ -131,6 +141,7 @@ export {
131
141
  CommandSchema,
132
142
  CommandStatus,
133
143
  CommandStatusSchema,
144
+ CommandTypeSchema,
134
145
  ConfigItemInputSchema,
135
146
  ConfigItemSchema,
136
147
  CreateActionCommandRequestSchema,
@@ -151,6 +162,7 @@ export {
151
162
  RegistrationTokenSchema,
152
163
  ReportCommandResultRequestSchema,
153
164
  ReportedServiceSchema,
165
+ RuntimeKindSchema,
154
166
  ServiceReportRequestSchema,
155
167
  SystemHealthSchema,
156
168
  SystemVersionSchema,
@@ -158,6 +170,7 @@ export {
158
170
  UserRole,
159
171
  UserSchema,
160
172
  actionDefinitionInputSchema,
173
+ actionPrepareResultSchema,
161
174
  adminLoginRequestSchema,
162
175
  agentHeartbeatRequestSchema,
163
176
  configItemInputSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtrape/capsule-contracts-node",
3
- "version": "0.1.0-public-review.0",
3
+ "version": "0.1.0-public-review.1",
4
4
  "description": "TypeScript contracts and Zod schemas for Xtrape Capsule and Opstage wire protocols.",
5
5
  "keywords": [
6
6
  "xtrape",
@@ -1730,7 +1730,7 @@ components:
1730
1730
  pattern: '^svc_'
1731
1731
  type:
1732
1732
  type: string
1733
- enum: [ACTION_PREPARE, ACTION_EXECUTE, ACTION]
1733
+ enum: [ACTION_PREPARE, ACTION_EXECUTE]
1734
1734
  actionName:
1735
1735
  type: string
1736
1736
  status: