@nylorun/core 0.49.0-beta → 0.51.0-beta

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.51.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - 13eb181: No image carries the engine (ADR-161, breaking; see docs/upgrading/migration.md). The Tenant's `engine.images` is retired: `PUT /v1/tenant/sandbox` refuses it, `GET`, the `PUT` answer, the admin SDK and Studio's Compute tab no longer show it, and a value an older Runtime stored is dropped on read. The sandboxes service refuses `entrypoint: "builtin"`, so every pod copies or mounts the Runtime's engine and every computer runs the computer agent. A pod engine no longer reports an engine of its own at join. nylorun/agents no longer publishes `ghcr.io/nylorun/dev` or its `engine-<runtime>` builds (`images/dev`, `images/dev-engine` and their workflows are removed): pin your own computer image, built from the recipe in `docs/self-hosting/computer-images.md`.
8
+
9
+ ## 0.50.0-beta
10
+
11
+ ### Minor Changes
12
+
13
+ - 9f17705: The event log is for developers, telemetry for operators (ADR-159). Each event type in the catalog names its layer: `agent`, what the agent saw and did, or `runtime`, what the Runtime did to the session. `eventLayer(type)` and `EVENT_LAYERS` are exported from `@nylorun/core/contracts` and `@nylorun/agents`, with the `TurnTrace` and `OtlpSpan` types; the envelope does not change. Studio's Events tab opens on the agent's events, with Runtime and All beside them and each row's writer, and gains a Trace view: a turn's spans as a waterfall, from the per-turn trace route, with Open trace on an event and Open event on a span. Studio's proxy allows a session's tool calls and a turn's trace. `guides/OBSERVABILITY.md` is the guide for both readers.
14
+ - 2b80f71: A Tenant stream with an audit read (ADR-159, Host feature `tenant-audit`). Keys put and deleted (`key.created`, `key.revoked`), signing keys rotated and revoked (`signing_key.rotated`, `signing_key.revoked`), the tool policy and every other setting changed (`policy.changed` with the rule count, `settings.changed` with the setting's key), vault credentials written, replaced, deleted and used (`credential.created`, `.rotated`, `.deleted`, `.used`, beside the `vault_audit` rows, which are still written) and Studio sign-ins (`studio.signed_in`) are recorded in `nylorun_streams.tenant_events` (migration `0050_tenant_events`), each in the transaction of the change it records, with who acted (`principal`, from the request's credential) and what wrote it (`source`), and never a secret value: every payload is strict. The stream is not relayed to S2 and a reset keeps it. `TENANT_EVENT_TYPES`, `TENANT_EVENT_PAYLOADS`, `TenantEventSchema` and `TenantAuditPageSchema` are in `@nylorun/core/contracts`.
15
+
16
+ The Management API reads it newest first with `GET /v1/tenant/audit?since&until&types&cursor&limit`, a management key only; `POST /v1/tenant/audit/studio-sign-in` takes only Studio's key. `@nylorun/admin` adds `tenant.audit({ since, until, types, cursor, limit })` and exports the Tenant event types. Studio records each sign-in (`token`, `forwarded`, and `loopback` at most hourly) in the background, so a failure never blocks one, and adds a Tenant › Audit tab: time, type, who and a one-line summary, with a type filter and Load more. Its proxy allows the read and nothing else under the audit. `guides/OBSERVABILITY.md` has an Audit part for operators.
17
+
3
18
  ## 0.49.0-beta
4
19
 
5
20
  ### Minor Changes
@@ -259,6 +259,12 @@ export declare const OPTIONAL_HOST_FEATURES: readonly ["tenant-fixture-model", "
259
259
  * `turn.start`.
260
260
  */
261
261
  "message-context",
262
+ /**
263
+ * The Tenant's stream (ADR-159): `GET /v1/tenant/audit` (the Management API) pages, newest first,
264
+ * the keys put and deleted, signing keys rotated and revoked, tool policy and settings changes,
265
+ * vault credentials written and used, and Studio sign-ins, each with who did it and no secret.
266
+ */
267
+ "tenant-audit",
262
268
  /**
263
269
  * The triggers capability (D83): an agent whose version declares `harness.engine.triggers` sets
264
270
  * up its own triggers with the `triggers` tool, kept by the Agent (`origin: agent` in
@@ -281,6 +281,12 @@ export const OPTIONAL_HOST_FEATURES = [
281
281
  * `turn.start`.
282
282
  */
283
283
  "message-context",
284
+ /**
285
+ * The Tenant's stream (ADR-159): `GET /v1/tenant/audit` (the Management API) pages, newest first,
286
+ * the keys put and deleted, signing keys rotated and revoked, tool policy and settings changes,
287
+ * vault credentials written and used, and Studio sign-ins, each with who did it and no secret.
288
+ */
289
+ "tenant-audit",
284
290
  /**
285
291
  * The triggers capability (D83): an agent whose version declares `harness.engine.triggers` sets
286
292
  * up its own triggers with the `triggers` tool, kept by the Agent (`origin: agent` in
@@ -1076,6 +1076,192 @@ export declare const ListAgentEventsResponseSchema: z.ZodObject<{
1076
1076
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1077
1077
  }, z.core.$strict>>;
1078
1078
  }, z.core.$strict>;
1079
+ /** The schema id of the Tenant's events (its stream in the record, ADR-159). */
1080
+ export declare const TENANT_EVENT_SCHEMA = "nylorun.tenant-event/1";
1081
+ /**
1082
+ * The Tenant's stream (ADR-159, Host feature `tenant-audit`): who changed who may reach the Tenant
1083
+ * and what its sessions may do, and each use of a vault credential, read with
1084
+ * `GET /v1/tenant/audit`. Every type is the Runtime's record (layer `runtime`): the Runtime saw it
1085
+ * happen, in the change's own transaction where it could; no harness writes one. No payload carries
1086
+ * a secret value: keys, signing keys, rules and credentials are named, never shown.
1087
+ */
1088
+ export declare const TENANT_EVENT_TYPES: readonly ["key.created", "key.revoked", "signing_key.rotated", "signing_key.revoked", "policy.changed", "settings.changed", "credential.created", "credential.rotated", "credential.deleted", "credential.used", "studio.signed_in"];
1089
+ export type TenantEventType = (typeof TENANT_EVENT_TYPES)[number];
1090
+ /**
1091
+ * What wrote a Tenant event: `api`, a request to the Runtime or Management API; `operate`,
1092
+ * `nylorun-operate` on the Tenant's machine; `runtime`, the Runtime on its own (a gate using a
1093
+ * credential, a sweep deleting an Agent); `studio`, Studio's server, for a sign-in.
1094
+ */
1095
+ export declare const TENANT_EVENT_SOURCES: readonly ["api", "operate", "runtime", "studio"];
1096
+ export type TenantEventSource = (typeof TENANT_EVENT_SOURCES)[number];
1097
+ /** How a person signed in to Studio: on its loopback address, with a login token, or through a sign-in proxy. */
1098
+ export declare const STUDIO_SIGN_IN_METHODS: readonly ["loopback", "token", "forwarded"];
1099
+ export type StudioSignInMethod = (typeof STUDIO_SIGN_IN_METHODS)[number];
1100
+ /**
1101
+ * The payload of each Tenant event. Each is strict, so a write that carries anything else, a
1102
+ * secret above all, is refused.
1103
+ */
1104
+ export declare const TENANT_EVENT_PAYLOADS: {
1105
+ /** Key `keyId` was issued; `rotated` when it replaced a key of that name. */
1106
+ readonly "key.created": z.ZodObject<{
1107
+ keyId: z.ZodString;
1108
+ role: z.ZodEnum<{
1109
+ application: "application";
1110
+ management: "management";
1111
+ }>;
1112
+ rotated: z.ZodBoolean;
1113
+ }, z.core.$strict>;
1114
+ readonly "key.revoked": z.ZodObject<{
1115
+ keyId: z.ZodString;
1116
+ role: z.ZodEnum<{
1117
+ application: "application";
1118
+ management: "management";
1119
+ }>;
1120
+ }, z.core.$strict>;
1121
+ /** The standby key became `current`; the old current one `previous`, the old previous one `revoked`. */
1122
+ readonly "signing_key.rotated": z.ZodObject<{
1123
+ current: z.ZodString;
1124
+ standby: z.ZodString;
1125
+ previous: z.ZodOptional<z.ZodString>;
1126
+ revoked: z.ZodOptional<z.ZodString>;
1127
+ force: z.ZodBoolean;
1128
+ }, z.core.$strict>;
1129
+ /** Key `keyId` was revoked from `state`. */
1130
+ readonly "signing_key.revoked": z.ZodObject<{
1131
+ keyId: z.ZodString;
1132
+ state: z.ZodEnum<{
1133
+ previous: "previous";
1134
+ standby: "standby";
1135
+ }>;
1136
+ }, z.core.$strict>;
1137
+ /** The tool policy now holds `rules` rules, as of `updatedAt`; the rules are read from `GET /v1/tenant/tool-policy`. */
1138
+ readonly "policy.changed": z.ZodObject<{
1139
+ rules: z.ZodNumber;
1140
+ updatedAt: z.ZodString;
1141
+ }, z.core.$strict>;
1142
+ /**
1143
+ * Setting `key` was replaced: `limits.config`, `environments.config`, `artifacts.config`,
1144
+ * `skills.config`, `model.budgets`, `model.inputs` or `model` (the provider and model in force,
1145
+ * `provider` and `model`; `model.inputs` names the catalog model in `model`). Never its value.
1146
+ */
1147
+ readonly "settings.changed": z.ZodObject<{
1148
+ key: z.ZodString;
1149
+ provider: z.ZodOptional<z.ZodString>;
1150
+ model: z.ZodOptional<z.ZodString>;
1151
+ }, z.core.$strict>;
1152
+ readonly "credential.created": z.ZodObject<{
1153
+ vaultId: z.ZodOptional<z.ZodString>;
1154
+ credentialId: z.ZodOptional<z.ZodString>;
1155
+ sessionId: z.ZodOptional<z.ZodString>;
1156
+ target: z.ZodOptional<z.ZodString>;
1157
+ outcome: z.ZodString;
1158
+ }, z.core.$strict>;
1159
+ readonly "credential.rotated": z.ZodObject<{
1160
+ vaultId: z.ZodOptional<z.ZodString>;
1161
+ credentialId: z.ZodOptional<z.ZodString>;
1162
+ sessionId: z.ZodOptional<z.ZodString>;
1163
+ target: z.ZodOptional<z.ZodString>;
1164
+ outcome: z.ZodString;
1165
+ }, z.core.$strict>;
1166
+ readonly "credential.deleted": z.ZodObject<{
1167
+ vaultId: z.ZodOptional<z.ZodString>;
1168
+ credentialId: z.ZodOptional<z.ZodString>;
1169
+ sessionId: z.ZodOptional<z.ZodString>;
1170
+ target: z.ZodOptional<z.ZodString>;
1171
+ outcome: z.ZodString;
1172
+ }, z.core.$strict>;
1173
+ readonly "credential.used": z.ZodObject<{
1174
+ vaultId: z.ZodOptional<z.ZodString>;
1175
+ credentialId: z.ZodOptional<z.ZodString>;
1176
+ sessionId: z.ZodOptional<z.ZodString>;
1177
+ target: z.ZodOptional<z.ZodString>;
1178
+ outcome: z.ZodString;
1179
+ }, z.core.$strict>;
1180
+ /** A browser signed in to Studio, by `method`, as `subject` when it names a person. */
1181
+ readonly "studio.signed_in": z.ZodObject<{
1182
+ method: z.ZodEnum<{
1183
+ forwarded: "forwarded";
1184
+ loopback: "loopback";
1185
+ token: "token";
1186
+ }>;
1187
+ subject: z.ZodOptional<z.ZodString>;
1188
+ }, z.core.$strict>;
1189
+ };
1190
+ export type TenantEventPayload<T extends TenantEventType> = z.infer<(typeof TENANT_EVENT_PAYLOADS)[T]>;
1191
+ /**
1192
+ * One event on the Tenant's stream, numbered from 0. `principal` is who acted, from the request's
1193
+ * credential: a key's name (`bootstrap`, `studio`, an application key's), `<key>:<subject>` for a
1194
+ * key acting for a person, `<issuer>:<subject>` for a token, `operate` for `nylorun-operate`,
1195
+ * and `host` for the Runtime itself.
1196
+ */
1197
+ export declare const TenantEventSchema: z.ZodObject<{
1198
+ schema: z.ZodLiteral<"nylorun.tenant-event/1">;
1199
+ seq: z.ZodNumber;
1200
+ time: z.ZodString;
1201
+ type: z.ZodEnum<{
1202
+ "credential.created": "credential.created";
1203
+ "credential.deleted": "credential.deleted";
1204
+ "credential.rotated": "credential.rotated";
1205
+ "credential.used": "credential.used";
1206
+ "key.created": "key.created";
1207
+ "key.revoked": "key.revoked";
1208
+ "policy.changed": "policy.changed";
1209
+ "settings.changed": "settings.changed";
1210
+ "signing_key.revoked": "signing_key.revoked";
1211
+ "signing_key.rotated": "signing_key.rotated";
1212
+ "studio.signed_in": "studio.signed_in";
1213
+ }>;
1214
+ source: z.ZodEnum<{
1215
+ api: "api";
1216
+ operate: "operate";
1217
+ runtime: "runtime";
1218
+ studio: "studio";
1219
+ }>;
1220
+ principal: z.ZodString;
1221
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1222
+ }, z.core.$strict>;
1223
+ export type TenantEvent = z.infer<typeof TenantEventSchema>;
1224
+ /** A page of the Tenant's events, newest first; `nextCursor` reads older ones. */
1225
+ export declare const TenantAuditPageSchema: z.ZodObject<{
1226
+ events: z.ZodArray<z.ZodObject<{
1227
+ schema: z.ZodLiteral<"nylorun.tenant-event/1">;
1228
+ seq: z.ZodNumber;
1229
+ time: z.ZodString;
1230
+ type: z.ZodEnum<{
1231
+ "credential.created": "credential.created";
1232
+ "credential.deleted": "credential.deleted";
1233
+ "credential.rotated": "credential.rotated";
1234
+ "credential.used": "credential.used";
1235
+ "key.created": "key.created";
1236
+ "key.revoked": "key.revoked";
1237
+ "policy.changed": "policy.changed";
1238
+ "settings.changed": "settings.changed";
1239
+ "signing_key.revoked": "signing_key.revoked";
1240
+ "signing_key.rotated": "signing_key.rotated";
1241
+ "studio.signed_in": "studio.signed_in";
1242
+ }>;
1243
+ source: z.ZodEnum<{
1244
+ api: "api";
1245
+ operate: "operate";
1246
+ runtime: "runtime";
1247
+ studio: "studio";
1248
+ }>;
1249
+ principal: z.ZodString;
1250
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1251
+ }, z.core.$strict>>;
1252
+ nextCursor: z.ZodNullable<z.ZodString>;
1253
+ }, z.core.$strict>;
1254
+ export type TenantAuditPage = z.infer<typeof TenantAuditPageSchema>;
1255
+ /** `POST /v1/tenant/audit/studio-sign-in`: how a person signed in to Studio, and who when known. */
1256
+ export declare const StudioSignInRequestSchema: z.ZodObject<{
1257
+ method: z.ZodEnum<{
1258
+ forwarded: "forwarded";
1259
+ loopback: "loopback";
1260
+ token: "token";
1261
+ }>;
1262
+ subject: z.ZodOptional<z.ZodString>;
1263
+ }, z.core.$strict>;
1264
+ export type StudioSignInRequest = z.infer<typeof StudioSignInRequestSchema>;
1079
1265
  /**
1080
1266
  * A model role's name (Host feature `model-roles`, ADR-154): a lowercase letter, then up to 31
1081
1267
  * lowercase letters, digits and `-`, such as `builder`.
@@ -1120,9 +1306,6 @@ export declare const TenantEnvironmentsConfigSchema: z.ZodObject<{
1120
1306
  lifecycle: z.ZodOptional<z.ZodObject<{
1121
1307
  stopGrace: z.ZodOptional<z.ZodString>;
1122
1308
  }, z.core.$strict>>;
1123
- engine: z.ZodOptional<z.ZodObject<{
1124
- images: z.ZodOptional<z.ZodArray<z.ZodString>>;
1125
- }, z.core.$strict>>;
1126
1309
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1127
1310
  hosts: z.ZodArray<z.ZodEnum<{
1128
1311
  "harness-container": "harness-container";
@@ -1149,9 +1332,6 @@ export declare const PutTenantEnvironmentsRequestSchema: z.ZodObject<{
1149
1332
  lifecycle: z.ZodOptional<z.ZodObject<{
1150
1333
  stopGrace: z.ZodOptional<z.ZodString>;
1151
1334
  }, z.core.$strict>>;
1152
- engine: z.ZodOptional<z.ZodObject<{
1153
- images: z.ZodOptional<z.ZodArray<z.ZodString>>;
1154
- }, z.core.$strict>>;
1155
1335
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1156
1336
  hosts: z.ZodArray<z.ZodEnum<{
1157
1337
  "harness-container": "harness-container";
@@ -4594,6 +4774,12 @@ export declare const EventSourceKindSchema: z.ZodEnum<{
4594
4774
  "tool-gate": "tool-gate";
4595
4775
  }>;
4596
4776
  export type EventSourceKind = z.infer<typeof EventSourceKindSchema>;
4777
+ /**
4778
+ * Whose account an event is: the agent's or the Runtime's (ADR-159). A session's events have one each
4779
+ * (`EVENT_CATALOG`); every event on an Agent's stream (`AGENT_EVENT_TYPES`) is the Runtime's.
4780
+ */
4781
+ export declare const EVENT_LAYERS: readonly ["agent", "runtime"];
4782
+ export type EventLayer = (typeof EVENT_LAYERS)[number];
4597
4783
  /**
4598
4784
  * How far an event can be trusted, by who could forge it. `observed`: the Runtime saw it itself
4599
4785
  * (commands, the tools core serves, gate records, core's settle). `claimed`: a harness reported
@@ -6026,6 +6212,7 @@ export declare const EVENT_CATALOG: {
6026
6212
  }, z.core.$loose>;
6027
6213
  readonly source: "api";
6028
6214
  readonly version: 1;
6215
+ readonly layer: "agent";
6029
6216
  };
6030
6217
  readonly "command.approve": {
6031
6218
  readonly payload: z.ZodObject<{
@@ -6037,6 +6224,7 @@ export declare const EVENT_CATALOG: {
6037
6224
  }, z.core.$loose>;
6038
6225
  readonly source: "api";
6039
6226
  readonly version: 1;
6227
+ readonly layer: "agent";
6040
6228
  };
6041
6229
  readonly "command.respond": {
6042
6230
  readonly payload: z.ZodObject<{
@@ -6048,6 +6236,7 @@ export declare const EVENT_CATALOG: {
6048
6236
  }, z.core.$loose>;
6049
6237
  readonly source: "api";
6050
6238
  readonly version: 1;
6239
+ readonly layer: "agent";
6051
6240
  };
6052
6241
  readonly "turn.completed": {
6053
6242
  readonly payload: z.ZodObject<{
@@ -6067,6 +6256,7 @@ export declare const EVENT_CATALOG: {
6067
6256
  }, z.core.$loose>;
6068
6257
  readonly source: "loop";
6069
6258
  readonly version: 1;
6259
+ readonly layer: "agent";
6070
6260
  };
6071
6261
  readonly "turn.paused": {
6072
6262
  readonly payload: z.ZodObject<{
@@ -6082,6 +6272,7 @@ export declare const EVENT_CATALOG: {
6082
6272
  }, z.core.$loose>;
6083
6273
  readonly source: "loop";
6084
6274
  readonly version: 1;
6275
+ readonly layer: "agent";
6085
6276
  };
6086
6277
  readonly "turn.failed": {
6087
6278
  readonly payload: z.ZodObject<{
@@ -6105,6 +6296,7 @@ export declare const EVENT_CATALOG: {
6105
6296
  }, z.core.$loose>;
6106
6297
  readonly source: "loop";
6107
6298
  readonly version: 1;
6299
+ readonly layer: "agent";
6108
6300
  };
6109
6301
  readonly "turn.cancelled": {
6110
6302
  readonly payload: z.ZodObject<{
@@ -6124,6 +6316,7 @@ export declare const EVENT_CATALOG: {
6124
6316
  }, z.core.$loose>;
6125
6317
  readonly source: "api";
6126
6318
  readonly version: 1;
6319
+ readonly layer: "agent";
6127
6320
  };
6128
6321
  readonly "turn.version_kept": {
6129
6322
  readonly payload: z.ZodObject<{
@@ -6142,6 +6335,7 @@ export declare const EVENT_CATALOG: {
6142
6335
  }, z.core.$loose>;
6143
6336
  readonly source: "api";
6144
6337
  readonly version: 1;
6338
+ readonly layer: "runtime";
6145
6339
  };
6146
6340
  readonly "session.model": {
6147
6341
  readonly payload: z.ZodObject<{
@@ -6196,6 +6390,7 @@ export declare const EVENT_CATALOG: {
6196
6390
  }, z.core.$loose>;
6197
6391
  readonly source: "api";
6198
6392
  readonly version: 1;
6393
+ readonly layer: "runtime";
6199
6394
  };
6200
6395
  readonly "message.queued": {
6201
6396
  readonly payload: z.ZodObject<{
@@ -6209,6 +6404,7 @@ export declare const EVENT_CATALOG: {
6209
6404
  }, z.core.$loose>;
6210
6405
  readonly source: "api";
6211
6406
  readonly version: 1;
6407
+ readonly layer: "runtime";
6212
6408
  };
6213
6409
  readonly "queue.taken": {
6214
6410
  readonly payload: z.ZodObject<{
@@ -6218,6 +6414,7 @@ export declare const EVENT_CATALOG: {
6218
6414
  }, z.core.$loose>;
6219
6415
  readonly source: "api";
6220
6416
  readonly version: 1;
6417
+ readonly layer: "runtime";
6221
6418
  };
6222
6419
  readonly "queue.failed": {
6223
6420
  readonly payload: z.ZodObject<{
@@ -6230,6 +6427,7 @@ export declare const EVENT_CATALOG: {
6230
6427
  }, z.core.$loose>;
6231
6428
  readonly source: "api";
6232
6429
  readonly version: 1;
6430
+ readonly layer: "runtime";
6233
6431
  };
6234
6432
  readonly "queue.cancelled": {
6235
6433
  readonly payload: z.ZodObject<{
@@ -6238,6 +6436,7 @@ export declare const EVENT_CATALOG: {
6238
6436
  }, z.core.$loose>;
6239
6437
  readonly source: "api";
6240
6438
  readonly version: 1;
6439
+ readonly layer: "runtime";
6241
6440
  };
6242
6441
  readonly "wake.booked": {
6243
6442
  readonly payload: z.ZodObject<{
@@ -6248,6 +6447,7 @@ export declare const EVENT_CATALOG: {
6248
6447
  }, z.core.$loose>;
6249
6448
  readonly source: "api";
6250
6449
  readonly version: 1;
6450
+ readonly layer: "runtime";
6251
6451
  };
6252
6452
  readonly "wake.cancelled": {
6253
6453
  readonly payload: z.ZodObject<{
@@ -6255,6 +6455,7 @@ export declare const EVENT_CATALOG: {
6255
6455
  }, z.core.$loose>;
6256
6456
  readonly source: "api";
6257
6457
  readonly version: 1;
6458
+ readonly layer: "runtime";
6258
6459
  };
6259
6460
  readonly "memory.updated": {
6260
6461
  readonly payload: z.ZodObject<{
@@ -6273,6 +6474,7 @@ export declare const EVENT_CATALOG: {
6273
6474
  }, z.core.$loose>;
6274
6475
  readonly source: "api";
6275
6476
  readonly version: 1;
6477
+ readonly layer: "agent";
6276
6478
  };
6277
6479
  readonly "message.assistant": {
6278
6480
  readonly payload: z.ZodObject<{
@@ -6317,6 +6519,7 @@ export declare const EVENT_CATALOG: {
6317
6519
  }, z.core.$loose>;
6318
6520
  readonly source: "loop";
6319
6521
  readonly version: 1;
6522
+ readonly layer: "agent";
6320
6523
  };
6321
6524
  readonly "model.failed": {
6322
6525
  readonly payload: z.ZodObject<{
@@ -6352,6 +6555,7 @@ export declare const EVENT_CATALOG: {
6352
6555
  }, z.core.$loose>;
6353
6556
  readonly source: "loop";
6354
6557
  readonly version: 1;
6558
+ readonly layer: "agent";
6355
6559
  };
6356
6560
  readonly "context.compacted": {
6357
6561
  readonly payload: z.ZodObject<{
@@ -6390,6 +6594,7 @@ export declare const EVENT_CATALOG: {
6390
6594
  }, z.core.$loose>;
6391
6595
  readonly source: "loop";
6392
6596
  readonly version: 1;
6597
+ readonly layer: "agent";
6393
6598
  };
6394
6599
  readonly "tool.completed": {
6395
6600
  readonly payload: z.ZodObject<{
@@ -6447,6 +6652,7 @@ export declare const EVENT_CATALOG: {
6447
6652
  }, z.core.$loose>;
6448
6653
  readonly source: "loop";
6449
6654
  readonly version: 1;
6655
+ readonly layer: "agent";
6450
6656
  };
6451
6657
  readonly "effect.uncertain": {
6452
6658
  readonly payload: z.ZodObject<{
@@ -6455,6 +6661,7 @@ export declare const EVENT_CATALOG: {
6455
6661
  }, z.core.$loose>;
6456
6662
  readonly source: "loop";
6457
6663
  readonly version: 1;
6664
+ readonly layer: "agent";
6458
6665
  };
6459
6666
  readonly "delegation.started": {
6460
6667
  readonly payload: z.ZodObject<{
@@ -6467,6 +6674,7 @@ export declare const EVENT_CATALOG: {
6467
6674
  }, z.core.$loose>;
6468
6675
  readonly source: "loop";
6469
6676
  readonly version: 1;
6677
+ readonly layer: "agent";
6470
6678
  };
6471
6679
  readonly "delegation.completed": {
6472
6680
  readonly payload: z.ZodObject<{
@@ -6479,6 +6687,7 @@ export declare const EVENT_CATALOG: {
6479
6687
  }, z.core.$loose>;
6480
6688
  readonly source: "loop";
6481
6689
  readonly version: 1;
6690
+ readonly layer: "agent";
6482
6691
  };
6483
6692
  readonly "mcp.discovered": {
6484
6693
  readonly payload: z.ZodObject<{
@@ -6504,6 +6713,7 @@ export declare const EVENT_CATALOG: {
6504
6713
  }, z.core.$loose>;
6505
6714
  readonly source: "loop";
6506
6715
  readonly version: 1;
6716
+ readonly layer: "runtime";
6507
6717
  };
6508
6718
  readonly "plan.updated": {
6509
6719
  readonly payload: z.ZodObject<{
@@ -6521,6 +6731,7 @@ export declare const EVENT_CATALOG: {
6521
6731
  }, z.core.$loose>;
6522
6732
  readonly source: "loop";
6523
6733
  readonly version: 1;
6734
+ readonly layer: "agent";
6524
6735
  };
6525
6736
  readonly "engine.diagnostic": {
6526
6737
  readonly payload: z.ZodObject<{
@@ -6530,6 +6741,7 @@ export declare const EVENT_CATALOG: {
6530
6741
  }, z.core.$loose>;
6531
6742
  readonly source: "loop";
6532
6743
  readonly version: 1;
6744
+ readonly layer: "runtime";
6533
6745
  };
6534
6746
  readonly "environment.state": {
6535
6747
  readonly payload: z.ZodObject<{
@@ -6549,6 +6761,7 @@ export declare const EVENT_CATALOG: {
6549
6761
  }, z.core.$loose>;
6550
6762
  readonly source: "loop";
6551
6763
  readonly version: 1;
6764
+ readonly layer: "runtime";
6552
6765
  };
6553
6766
  readonly "environment.exec": {
6554
6767
  readonly payload: z.ZodObject<{
@@ -6560,6 +6773,7 @@ export declare const EVENT_CATALOG: {
6560
6773
  }, z.core.$loose>;
6561
6774
  readonly source: "loop";
6562
6775
  readonly version: 1;
6776
+ readonly layer: "runtime";
6563
6777
  };
6564
6778
  readonly "agent.attached": {
6565
6779
  readonly payload: z.ZodObject<{
@@ -6567,6 +6781,7 @@ export declare const EVENT_CATALOG: {
6567
6781
  }, z.core.$loose>;
6568
6782
  readonly source: "api";
6569
6783
  readonly version: 1;
6784
+ readonly layer: "runtime";
6570
6785
  };
6571
6786
  readonly "node.started": {
6572
6787
  readonly payload: z.ZodObject<{
@@ -6577,6 +6792,7 @@ export declare const EVENT_CATALOG: {
6577
6792
  }, z.core.$loose>;
6578
6793
  readonly source: "loop";
6579
6794
  readonly version: 1;
6795
+ readonly layer: "agent";
6580
6796
  };
6581
6797
  readonly "node.completed": {
6582
6798
  readonly payload: z.ZodObject<{
@@ -6598,6 +6814,7 @@ export declare const EVENT_CATALOG: {
6598
6814
  }, z.core.$loose>;
6599
6815
  readonly source: "loop";
6600
6816
  readonly version: 1;
6817
+ readonly layer: "agent";
6601
6818
  };
6602
6819
  readonly "node.agent": {
6603
6820
  readonly payload: z.ZodObject<{
@@ -6608,6 +6825,7 @@ export declare const EVENT_CATALOG: {
6608
6825
  }, z.core.$loose>;
6609
6826
  readonly source: "loop";
6610
6827
  readonly version: 1;
6828
+ readonly layer: "agent";
6611
6829
  };
6612
6830
  readonly "loop.iteration": {
6613
6831
  readonly payload: z.ZodObject<{
@@ -6619,6 +6837,7 @@ export declare const EVENT_CATALOG: {
6619
6837
  }, z.core.$loose>;
6620
6838
  readonly source: "loop";
6621
6839
  readonly version: 1;
6840
+ readonly layer: "agent";
6622
6841
  };
6623
6842
  readonly "loop.verified": {
6624
6843
  readonly payload: z.ZodObject<{
@@ -6630,6 +6849,7 @@ export declare const EVENT_CATALOG: {
6630
6849
  }, z.core.$loose>;
6631
6850
  readonly source: "api";
6632
6851
  readonly version: 1;
6852
+ readonly layer: "agent";
6633
6853
  };
6634
6854
  readonly "artifact.created": {
6635
6855
  readonly payload: z.ZodObject<{
@@ -6656,6 +6876,7 @@ export declare const EVENT_CATALOG: {
6656
6876
  }, z.core.$loose>;
6657
6877
  readonly source: "api";
6658
6878
  readonly version: 1;
6879
+ readonly layer: "runtime";
6659
6880
  };
6660
6881
  readonly "artifact.version.created": {
6661
6882
  readonly payload: z.ZodObject<{
@@ -6682,6 +6903,7 @@ export declare const EVENT_CATALOG: {
6682
6903
  }, z.core.$loose>;
6683
6904
  readonly source: "api";
6684
6905
  readonly version: 1;
6906
+ readonly layer: "runtime";
6685
6907
  };
6686
6908
  readonly "artifact.deleted": {
6687
6909
  readonly payload: z.ZodObject<{
@@ -6690,6 +6912,7 @@ export declare const EVENT_CATALOG: {
6690
6912
  }, z.core.$loose>;
6691
6913
  readonly source: "api";
6692
6914
  readonly version: 1;
6915
+ readonly layer: "runtime";
6693
6916
  };
6694
6917
  readonly "artifact.export.skipped": {
6695
6918
  readonly payload: z.ZodObject<{
@@ -6707,6 +6930,7 @@ export declare const EVENT_CATALOG: {
6707
6930
  }, z.core.$loose>;
6708
6931
  readonly source: "api";
6709
6932
  readonly version: 1;
6933
+ readonly layer: "runtime";
6710
6934
  };
6711
6935
  readonly "artifact.export.failed": {
6712
6936
  readonly payload: z.ZodObject<{
@@ -6715,6 +6939,7 @@ export declare const EVENT_CATALOG: {
6715
6939
  }, z.core.$loose>;
6716
6940
  readonly source: "api";
6717
6941
  readonly version: 1;
6942
+ readonly layer: "runtime";
6718
6943
  };
6719
6944
  readonly "transcript.updated": {
6720
6945
  readonly payload: z.ZodObject<{
@@ -6724,11 +6949,14 @@ export declare const EVENT_CATALOG: {
6724
6949
  }, z.core.$loose>;
6725
6950
  readonly source: "loop";
6726
6951
  readonly version: 1;
6952
+ readonly layer: "agent";
6727
6953
  readonly visibility: "internal";
6728
6954
  };
6729
6955
  };
6730
6956
  export type EventType = keyof typeof EVENT_CATALOG;
6731
6957
  export declare const EVENT_TYPES: readonly EventType[];
6958
+ /** An event type's layer (ADR-159); `undefined` for a type this version does not know. */
6959
+ export declare function eventLayer(type: string): EventLayer | undefined;
6732
6960
  /** Drops the index signatures `passthrough` adds, so plain interfaces are assignable. */
6733
6961
  type Closed<T> = T extends readonly (infer U)[] ? Closed<U>[] : T extends object ? {
6734
6962
  [K in keyof T as string extends K ? never : K]: Closed<T[K]>;
@@ -7172,9 +7400,6 @@ export declare const SeedTenantConfigRequestSchema: z.ZodObject<{
7172
7400
  lifecycle: z.ZodOptional<z.ZodObject<{
7173
7401
  stopGrace: z.ZodOptional<z.ZodString>;
7174
7402
  }, z.core.$strict>>;
7175
- engine: z.ZodOptional<z.ZodObject<{
7176
- images: z.ZodOptional<z.ZodArray<z.ZodString>>;
7177
- }, z.core.$strict>>;
7178
7403
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
7179
7404
  hosts: z.ZodArray<z.ZodEnum<{
7180
7405
  "harness-container": "harness-container";
@@ -7900,9 +8125,6 @@ export declare const EffectiveSandboxConfigSchema: z.ZodObject<{
7900
8125
  sandbox: "sandbox";
7901
8126
  }>>;
7902
8127
  }, z.core.$strict>>>;
7903
- engine: z.ZodOptional<z.ZodObject<{
7904
- images: z.ZodArray<z.ZodString>;
7905
- }, z.core.$strict>>;
7906
8128
  }, z.core.$strict>;
7907
8129
  export type EffectiveSandboxConfig = z.infer<typeof EffectiveSandboxConfigSchema>;
7908
8130
  /**
@@ -7954,9 +8176,6 @@ export declare const TenantSandboxViewSchema: z.ZodObject<{
7954
8176
  lifecycle: z.ZodOptional<z.ZodObject<{
7955
8177
  stopGrace: z.ZodOptional<z.ZodString>;
7956
8178
  }, z.core.$strict>>;
7957
- engine: z.ZodOptional<z.ZodObject<{
7958
- images: z.ZodOptional<z.ZodArray<z.ZodString>>;
7959
- }, z.core.$strict>>;
7960
8179
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
7961
8180
  hosts: z.ZodArray<z.ZodEnum<{
7962
8181
  "harness-container": "harness-container";
@@ -7987,9 +8206,6 @@ export declare const TenantSandboxViewSchema: z.ZodObject<{
7987
8206
  sandbox: "sandbox";
7988
8207
  }>>;
7989
8208
  }, z.core.$strict>>>;
7990
- engine: z.ZodOptional<z.ZodObject<{
7991
- images: z.ZodArray<z.ZodString>;
7992
- }, z.core.$strict>>;
7993
8209
  }, z.core.$strict>;
7994
8210
  cluster: z.ZodOptional<z.ZodNullable<z.ZodObject<{
7995
8211
  namespace: z.ZodString;
package/dist/contracts.js CHANGED
@@ -779,7 +779,7 @@ export const EnvironmentLimitsSchema = z
779
779
  const runtimeFields = {
780
780
  /** `virtual`, `pod` (needs sandbox pods, `nylorun local sandbox enable`) or `none`. Fixed. */
781
781
  kind: z.enum(ENVIRONMENT_KINDS),
782
- /** Pods only: the workload image (default the Tenant's, else `python:3.13-slim`). */
782
+ /** Pods only: the workload image, by digest (default `python:3.13-slim`). */
783
783
  image: z.string().min(1).optional(),
784
784
  resources: resourcesSchema.optional(),
785
785
  /** Pods only: the volume's size (default 5GiB). Fixed. */
@@ -1343,6 +1343,124 @@ export const AgentEventSchema = z
1343
1343
  export const ListAgentEventsResponseSchema = z
1344
1344
  .object({ events: z.array(AgentEventSchema) })
1345
1345
  .strict();
1346
+ /** The schema id of the Tenant's events (its stream in the record, ADR-159). */
1347
+ export const TENANT_EVENT_SCHEMA = "nylorun.tenant-event/1";
1348
+ /**
1349
+ * The Tenant's stream (ADR-159, Host feature `tenant-audit`): who changed who may reach the Tenant
1350
+ * and what its sessions may do, and each use of a vault credential, read with
1351
+ * `GET /v1/tenant/audit`. Every type is the Runtime's record (layer `runtime`): the Runtime saw it
1352
+ * happen, in the change's own transaction where it could; no harness writes one. No payload carries
1353
+ * a secret value: keys, signing keys, rules and credentials are named, never shown.
1354
+ */
1355
+ export const TENANT_EVENT_TYPES = [
1356
+ // An application or management key was put (created, or rotated: `rotated`) or deleted.
1357
+ "key.created",
1358
+ "key.revoked",
1359
+ // The signing keys rotated, or one was revoked.
1360
+ "signing_key.rotated",
1361
+ "signing_key.revoked",
1362
+ // The tool policy was replaced.
1363
+ "policy.changed",
1364
+ // Another Tenant setting was replaced: limits, compute, artifacts, skills, budgets, the model.
1365
+ "settings.changed",
1366
+ // A vault credential was written, replaced, deleted or used (each `vault_audit` row of one).
1367
+ "credential.created",
1368
+ "credential.rotated",
1369
+ "credential.deleted",
1370
+ "credential.used",
1371
+ // A person signed in to Studio (Studio records it with its own key).
1372
+ "studio.signed_in",
1373
+ ];
1374
+ /**
1375
+ * What wrote a Tenant event: `api`, a request to the Runtime or Management API; `operate`,
1376
+ * `nylorun-operate` on the Tenant's machine; `runtime`, the Runtime on its own (a gate using a
1377
+ * credential, a sweep deleting an Agent); `studio`, Studio's server, for a sign-in.
1378
+ */
1379
+ export const TENANT_EVENT_SOURCES = ["api", "operate", "runtime", "studio"];
1380
+ /** How a person signed in to Studio: on its loopback address, with a login token, or through a sign-in proxy. */
1381
+ export const STUDIO_SIGN_IN_METHODS = ["loopback", "token", "forwarded"];
1382
+ /**
1383
+ * A credential event's payload: the `vault_audit` row's fields, never the credential's value.
1384
+ * `outcome` is the row's (`created`, `copied`, `rotated`, `deleted`, `approved`, `refused`); a use
1385
+ * names the session it was for and the URL it was sent to (`target`).
1386
+ */
1387
+ const CredentialEventPayloadSchema = z
1388
+ .object({
1389
+ vaultId: z.string().optional(),
1390
+ credentialId: z.string().optional(),
1391
+ sessionId: z.string().optional(),
1392
+ target: z.string().optional(),
1393
+ outcome: z.string(),
1394
+ })
1395
+ .strict();
1396
+ const KeyRoleNameSchema = z.enum(["application", "management"]);
1397
+ /**
1398
+ * The payload of each Tenant event. Each is strict, so a write that carries anything else, a
1399
+ * secret above all, is refused.
1400
+ */
1401
+ export const TENANT_EVENT_PAYLOADS = {
1402
+ /** Key `keyId` was issued; `rotated` when it replaced a key of that name. */
1403
+ "key.created": z.object({ keyId: z.string(), role: KeyRoleNameSchema, rotated: z.boolean() }).strict(),
1404
+ "key.revoked": z.object({ keyId: z.string(), role: KeyRoleNameSchema }).strict(),
1405
+ /** The standby key became `current`; the old current one `previous`, the old previous one `revoked`. */
1406
+ "signing_key.rotated": z
1407
+ .object({
1408
+ current: z.string(),
1409
+ standby: z.string(),
1410
+ previous: z.string().optional(),
1411
+ revoked: z.string().optional(),
1412
+ force: z.boolean(),
1413
+ })
1414
+ .strict(),
1415
+ /** Key `keyId` was revoked from `state`. */
1416
+ "signing_key.revoked": z.object({ keyId: z.string(), state: z.enum(["previous", "standby"]) }).strict(),
1417
+ /** The tool policy now holds `rules` rules, as of `updatedAt`; the rules are read from `GET /v1/tenant/tool-policy`. */
1418
+ "policy.changed": z.object({ rules: z.number().int().nonnegative(), updatedAt: z.string() }).strict(),
1419
+ /**
1420
+ * Setting `key` was replaced: `limits.config`, `environments.config`, `artifacts.config`,
1421
+ * `skills.config`, `model.budgets`, `model.inputs` or `model` (the provider and model in force,
1422
+ * `provider` and `model`; `model.inputs` names the catalog model in `model`). Never its value.
1423
+ */
1424
+ "settings.changed": z
1425
+ .object({ key: z.string(), provider: z.string().optional(), model: z.string().optional() })
1426
+ .strict(),
1427
+ "credential.created": CredentialEventPayloadSchema,
1428
+ "credential.rotated": CredentialEventPayloadSchema,
1429
+ "credential.deleted": CredentialEventPayloadSchema,
1430
+ "credential.used": CredentialEventPayloadSchema,
1431
+ /** A browser signed in to Studio, by `method`, as `subject` when it names a person. */
1432
+ "studio.signed_in": z
1433
+ .object({ method: z.enum(STUDIO_SIGN_IN_METHODS), subject: z.string().optional() })
1434
+ .strict(),
1435
+ };
1436
+ /**
1437
+ * One event on the Tenant's stream, numbered from 0. `principal` is who acted, from the request's
1438
+ * credential: a key's name (`bootstrap`, `studio`, an application key's), `<key>:<subject>` for a
1439
+ * key acting for a person, `<issuer>:<subject>` for a token, `operate` for `nylorun-operate`,
1440
+ * and `host` for the Runtime itself.
1441
+ */
1442
+ export const TenantEventSchema = z
1443
+ .object({
1444
+ schema: z.literal(TENANT_EVENT_SCHEMA),
1445
+ seq: z.number().int().nonnegative(),
1446
+ time: z.string(),
1447
+ type: z.enum(TENANT_EVENT_TYPES),
1448
+ source: z.enum(TENANT_EVENT_SOURCES),
1449
+ principal: z.string(),
1450
+ payload: z.record(z.string(), z.unknown()),
1451
+ })
1452
+ .strict();
1453
+ /** A page of the Tenant's events, newest first; `nextCursor` reads older ones. */
1454
+ export const TenantAuditPageSchema = z
1455
+ .object({ events: z.array(TenantEventSchema), nextCursor: z.string().nullable() })
1456
+ .strict();
1457
+ /** `POST /v1/tenant/audit/studio-sign-in`: how a person signed in to Studio, and who when known. */
1458
+ export const StudioSignInRequestSchema = z
1459
+ .object({
1460
+ method: z.enum(STUDIO_SIGN_IN_METHODS),
1461
+ subject: z.string().min(1).max(200).optional(),
1462
+ })
1463
+ .strict();
1346
1464
  /**
1347
1465
  * A model role's name (Host feature `model-roles`, ADR-154): a lowercase letter, then up to 31
1348
1466
  * lowercase letters, digits and `-`, such as `builder`.
@@ -1404,21 +1522,6 @@ export const TenantEnvironmentsConfigSchema = z
1404
1522
  })
1405
1523
  .strict()
1406
1524
  .optional(),
1407
- /**
1408
- * Pods: images that carry this Runtime's engine under `/opt/nylorun` (ADR-99), by repository
1409
- * (`ghcr.io/nylorun/bot-worker`). A pod of a listed image runs that engine with nothing copied
1410
- * in, while the engine is the Runtime's own version; otherwise the engine is copied in, as for
1411
- * any other image.
1412
- */
1413
- engine: z
1414
- .object({
1415
- images: z
1416
- .array(z.string().min(1).max(256).regex(/^[a-z0-9]([a-z0-9._:/-]*[a-z0-9])?$/, "an image repository, without a tag or digest"))
1417
- .max(32)
1418
- .optional(),
1419
- })
1420
- .strict()
1421
- .optional(),
1422
1525
  /**
1423
1526
  * Where each harness may run, by harness id (`nylorun`, or `*` for the rest):
1424
1527
  * `harness-container` (the Runtime's harness) and `sandbox` (the engine in a pod).
@@ -3110,6 +3213,11 @@ export const EventSourceKindSchema = z.enum([
3110
3213
  "human",
3111
3214
  "api",
3112
3215
  ]);
3216
+ /**
3217
+ * Whose account an event is: the agent's or the Runtime's (ADR-159). A session's events have one each
3218
+ * (`EVENT_CATALOG`); every event on an Agent's stream (`AGENT_EVENT_TYPES`) is the Runtime's.
3219
+ */
3220
+ export const EVENT_LAYERS = ["agent", "runtime"];
3113
3221
  /**
3114
3222
  * How far an event can be trusted, by who could forge it. `observed`: the Runtime saw it itself
3115
3223
  * (commands, the tools core serves, gate records, core's settle). `claimed`: a harness reported
@@ -3948,65 +4056,73 @@ export const McpDiscoveredPayloadSchema = z
3948
4056
  * new type or a protocol version, never an edit in place.
3949
4057
  */
3950
4058
  export const EVENT_CATALOG = {
3951
- "command.message": { payload: CommandMessagePayloadSchema, source: "api", version: 1 },
3952
- "command.approve": { payload: CommandApprovePayloadSchema, source: "api", version: 1 },
3953
- "command.respond": { payload: CommandRespondPayloadSchema, source: "api", version: 1 },
3954
- "turn.completed": { payload: TurnCompletedPayloadSchema, source: "loop", version: 1 },
3955
- "turn.paused": { payload: TurnPausedPayloadSchema, source: "loop", version: 1 },
3956
- "turn.failed": { payload: TurnFailedPayloadSchema, source: "loop", version: 1 },
3957
- "turn.cancelled": { payload: TurnCancelledPayloadSchema, source: "api", version: 1 },
3958
- "turn.version_kept": { payload: TurnVersionKeptPayloadSchema, source: "api", version: 1 },
3959
- "session.model": { payload: SessionModelPayloadSchema, source: "api", version: 1 },
3960
- "message.queued": { payload: MessageQueuedPayloadSchema, source: "api", version: 1 },
3961
- "queue.taken": { payload: QueueTakenPayloadSchema, source: "api", version: 1 },
3962
- "queue.failed": { payload: QueueFailedPayloadSchema, source: "api", version: 1 },
3963
- "queue.cancelled": { payload: QueueCancelledPayloadSchema, source: "api", version: 1 },
3964
- "wake.booked": { payload: WakeBookedPayloadSchema, source: "api", version: 1 },
3965
- "wake.cancelled": { payload: WakeCancelledPayloadSchema, source: "api", version: 1 },
3966
- "memory.updated": { payload: MemoryUpdatedPayloadSchema, source: "api", version: 1 },
3967
- "message.assistant": { payload: AssistantMessagePayloadSchema, source: "loop", version: 1 },
3968
- "model.failed": { payload: ModelFailedPayloadSchema, source: "loop", version: 1 },
3969
- "context.compacted": { payload: ContextCompactedPayloadSchema, source: "loop", version: 1 },
3970
- "tool.completed": { payload: ToolCompletedPayloadSchema, source: "loop", version: 1 },
3971
- "effect.uncertain": { payload: EffectUncertainPayloadSchema, source: "loop", version: 1 },
3972
- "delegation.started": { payload: DelegationPayloadSchema, source: "loop", version: 1 },
3973
- "delegation.completed": { payload: DelegationPayloadSchema, source: "loop", version: 1 },
3974
- "mcp.discovered": { payload: McpDiscoveredPayloadSchema, source: "loop", version: 1 },
3975
- "plan.updated": { payload: PlanUpdatedPayloadSchema, source: "loop", version: 1 },
3976
- "engine.diagnostic": { payload: EngineDiagnosticPayloadSchema, source: "loop", version: 1 },
3977
- "environment.state": { payload: EnvironmentStatePayloadSchema, source: "loop", version: 1 },
3978
- "environment.exec": { payload: EnvironmentExecPayloadSchema, source: "loop", version: 1 },
3979
- "agent.attached": { payload: AgentAttachedPayloadSchema, source: "api", version: 1 },
3980
- "node.started": { payload: NodeStartedPayloadSchema, source: "loop", version: 1 },
3981
- "node.completed": { payload: NodeCompletedPayloadSchema, source: "loop", version: 1 },
3982
- "node.agent": { payload: NodeAgentPayloadSchema, source: "loop", version: 1 },
3983
- "loop.iteration": { payload: LoopIterationPayloadSchema, source: "loop", version: 1 },
3984
- "loop.verified": { payload: LoopVerifiedPayloadSchema, source: "api", version: 1 },
3985
- "artifact.created": { payload: ArtifactVersionPayloadSchema, source: "api", version: 1 },
4059
+ "command.message": { payload: CommandMessagePayloadSchema, source: "api", version: 1, layer: "agent" },
4060
+ "command.approve": { payload: CommandApprovePayloadSchema, source: "api", version: 1, layer: "agent" },
4061
+ "command.respond": { payload: CommandRespondPayloadSchema, source: "api", version: 1, layer: "agent" },
4062
+ "turn.completed": { payload: TurnCompletedPayloadSchema, source: "loop", version: 1, layer: "agent" },
4063
+ "turn.paused": { payload: TurnPausedPayloadSchema, source: "loop", version: 1, layer: "agent" },
4064
+ "turn.failed": { payload: TurnFailedPayloadSchema, source: "loop", version: 1, layer: "agent" },
4065
+ "turn.cancelled": { payload: TurnCancelledPayloadSchema, source: "api", version: 1, layer: "agent" },
4066
+ "turn.version_kept": { payload: TurnVersionKeptPayloadSchema, source: "api", version: 1, layer: "runtime" },
4067
+ "session.model": { payload: SessionModelPayloadSchema, source: "api", version: 1, layer: "runtime" },
4068
+ "message.queued": { payload: MessageQueuedPayloadSchema, source: "api", version: 1, layer: "runtime" },
4069
+ "queue.taken": { payload: QueueTakenPayloadSchema, source: "api", version: 1, layer: "runtime" },
4070
+ "queue.failed": { payload: QueueFailedPayloadSchema, source: "api", version: 1, layer: "runtime" },
4071
+ "queue.cancelled": { payload: QueueCancelledPayloadSchema, source: "api", version: 1, layer: "runtime" },
4072
+ "wake.booked": { payload: WakeBookedPayloadSchema, source: "api", version: 1, layer: "runtime" },
4073
+ "wake.cancelled": { payload: WakeCancelledPayloadSchema, source: "api", version: 1, layer: "runtime" },
4074
+ "memory.updated": { payload: MemoryUpdatedPayloadSchema, source: "api", version: 1, layer: "agent" },
4075
+ "message.assistant": { payload: AssistantMessagePayloadSchema, source: "loop", version: 1, layer: "agent" },
4076
+ "model.failed": { payload: ModelFailedPayloadSchema, source: "loop", version: 1, layer: "agent" },
4077
+ "context.compacted": { payload: ContextCompactedPayloadSchema, source: "loop", version: 1, layer: "agent" },
4078
+ "tool.completed": { payload: ToolCompletedPayloadSchema, source: "loop", version: 1, layer: "agent" },
4079
+ "effect.uncertain": { payload: EffectUncertainPayloadSchema, source: "loop", version: 1, layer: "agent" },
4080
+ "delegation.started": { payload: DelegationPayloadSchema, source: "loop", version: 1, layer: "agent" },
4081
+ "delegation.completed": { payload: DelegationPayloadSchema, source: "loop", version: 1, layer: "agent" },
4082
+ "mcp.discovered": { payload: McpDiscoveredPayloadSchema, source: "loop", version: 1, layer: "runtime" },
4083
+ "plan.updated": { payload: PlanUpdatedPayloadSchema, source: "loop", version: 1, layer: "agent" },
4084
+ "engine.diagnostic": { payload: EngineDiagnosticPayloadSchema, source: "loop", version: 1, layer: "runtime" },
4085
+ "environment.state": { payload: EnvironmentStatePayloadSchema, source: "loop", version: 1, layer: "runtime" },
4086
+ "environment.exec": { payload: EnvironmentExecPayloadSchema, source: "loop", version: 1, layer: "runtime" },
4087
+ "agent.attached": { payload: AgentAttachedPayloadSchema, source: "api", version: 1, layer: "runtime" },
4088
+ "node.started": { payload: NodeStartedPayloadSchema, source: "loop", version: 1, layer: "agent" },
4089
+ "node.completed": { payload: NodeCompletedPayloadSchema, source: "loop", version: 1, layer: "agent" },
4090
+ "node.agent": { payload: NodeAgentPayloadSchema, source: "loop", version: 1, layer: "agent" },
4091
+ "loop.iteration": { payload: LoopIterationPayloadSchema, source: "loop", version: 1, layer: "agent" },
4092
+ "loop.verified": { payload: LoopVerifiedPayloadSchema, source: "api", version: 1, layer: "agent" },
4093
+ "artifact.created": { payload: ArtifactVersionPayloadSchema, source: "api", version: 1, layer: "runtime" },
3986
4094
  "artifact.version.created": {
3987
4095
  payload: ArtifactVersionPayloadSchema,
3988
4096
  source: "api",
3989
4097
  version: 1,
4098
+ layer: "runtime",
3990
4099
  },
3991
- "artifact.deleted": { payload: ArtifactDeletedPayloadSchema, source: "api", version: 1 },
4100
+ "artifact.deleted": { payload: ArtifactDeletedPayloadSchema, source: "api", version: 1, layer: "runtime" },
3992
4101
  "artifact.export.skipped": {
3993
4102
  payload: ArtifactExportSkippedPayloadSchema,
3994
4103
  source: "api",
3995
4104
  version: 1,
4105
+ layer: "runtime",
3996
4106
  },
3997
4107
  "artifact.export.failed": {
3998
4108
  payload: ArtifactExportFailedPayloadSchema,
3999
4109
  source: "api",
4000
4110
  version: 1,
4111
+ layer: "runtime",
4001
4112
  },
4002
4113
  "transcript.updated": {
4003
4114
  payload: TranscriptUpdatedPayloadSchema,
4004
4115
  source: "loop",
4005
4116
  version: 1,
4117
+ layer: "agent",
4006
4118
  visibility: "internal",
4007
4119
  },
4008
4120
  };
4009
4121
  export const EVENT_TYPES = Object.keys(EVENT_CATALOG);
4122
+ /** An event type's layer (ADR-159); `undefined` for a type this version does not know. */
4123
+ export function eventLayer(type) {
4124
+ return Object.hasOwn(EVENT_CATALOG, type) ? EVENT_CATALOG[type].layer : undefined;
4125
+ }
4010
4126
  export function isEventType(type) {
4011
4127
  return Object.hasOwn(EVENT_CATALOG, type);
4012
4128
  }
@@ -4724,8 +4840,6 @@ export const EffectiveSandboxConfigSchema = z
4724
4840
  placement: z
4725
4841
  .record(z.string(), z.object({ hosts: z.array(z.enum(PLACEMENT_HOSTS)) }).strict())
4726
4842
  .optional(),
4727
- /** Pods: the image repositories that carry this Runtime's engine (ADR-99); none by default. */
4728
- engine: z.object({ images: z.array(z.string()) }).strict().optional(),
4729
4843
  })
4730
4844
  .strict();
4731
4845
  const SandboxBackendNameSchema = z.enum(["virtual", "local"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/core",
3
- "version": "0.49.0-beta",
3
+ "version": "0.51.0-beta",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Shared agent definitions and wire contracts",