@nylorun/core 0.44.0-beta → 0.46.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,26 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.46.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - 5b49361: A pod Agent on an Agent Substrate cluster can be a computer (ADR-149, ADR-150): with `NYLORUN_SANDBOX_GATEWAY_URL` and `NYLORUN_COMPUTER_TICKET_KEY_FILE` set (the Runtime's Helm chart sets both), its sessions' runs go to the harness container, and their sandbox tools, file reads and writes, skill folders and disk versions reach the Agent's actor through the sandbox gateway and `atenet-router`, with a ticket core signs (Ed25519). The engine's `--service computer` runs no loop: it serves commands (a start and attaches, each under 50 s) and files on port 8080, checks each ticket against the key its template carries, and answers the wake-up probe on `/ready`. A harness opens a computer with `computer.open`; core wakes it, waits until it is ready, writes a seed onto a new disk, runs the disk's setup through it and passes a version's start check. The tools, `runtime.json` and every other backend are unchanged.
8
+
9
+ - `@nylorun/core`: Harness API 5.6 (`harness-api/v5.6.json`): `routing.sandbox.computer` and the request `computer.open`.
10
+ - `@nylorun/runtime`: `--service computer`; the `computer` sandbox backend; `NYLORUN_SANDBOX_GATEWAY_URL` and `NYLORUN_COMPUTER_TICKET_KEY_FILE`.
11
+
12
+ ## 0.45.0-beta
13
+
14
+ ### Minor Changes
15
+
16
+ - 17951fe: A client can give one Agent a trigger over the API (D88, ADR-145; Host feature `api-triggers`). `PUT /v1/agents/{agentId}/triggers/{triggerId}` creates or replaces the Agent's trigger of a fourth origin, `api`: the body is a `Trigger` exactly as a definition's `runtime.triggers` entry holds it (one of `schedule` with `timezone`, `at` or `webhook`; `session`; `prompt`) and an optional `title`. A new one is active with its next time; a replaced one gets its next time again and keeps its status; the same body again changes nothing and records no event. An id the definition declares, or one an agent's trigger or a booked wake holds, is `409 trigger_conflict`. The checks and limits are a definition's, and `runtime.limits.triggers.count` now counts the triggers an Agent's agents made and those clients put together (`422 trigger_limit`). Upgrades and moves never touch an `api` trigger, `DELETE` removes it, and pause, resume, run and a webhook's secret work as for any trigger.
17
+
18
+ - `@nylorun/core`: `TRIGGER_ORIGINS` adds `api`; `TriggerPutSchema`; `TriggerView.principal`; `agent.trigger_created` and `agent.trigger_updated` carry `origin`, `principal`, the timing and `changed` (their `sessionId` is now optional, set for `agent` only; `kind` adds `webhook`), and `agent.trigger_deleted` carries `origin`; Host feature `api-triggers`.
19
+ - `@nylorun/runtime`: the route; `agent_triggers.principal` and the `api` origin (store migration 0049, run at start).
20
+ - `@nylorun/agents`: `agents.putTrigger(agentId, triggerId, trigger)`; `deleteTrigger` deletes `api` triggers too.
21
+ - `nylorun`: `nylorun agents triggers put <id> <trigger>` with `--schedule`, `--timezone`, `--at`, `--webhook`, `--session`, `--prompt` and `--title`, or a JSON file; `rm` deletes `api` triggers.
22
+ - `@nylorun/studio`: the Triggers tab shows where each trigger came from (the definition's version, the agent that made it, or the principal that put it), its prompt and time zone for every origin, and deletes one an agent made or a client put; Activity words trigger changes and filters them.
23
+
3
24
  ## 0.44.0-beta
4
25
 
5
26
  ### Minor Changes
@@ -259,6 +259,13 @@ export declare const OPTIONAL_HOST_FEATURES: readonly ["tenant-fixture-model", "
259
259
  * `runtime.limits.triggers`; and `GET /v1/runs/stream`, the Tenant's runs as server-sent events.
260
260
  */
261
261
  "agent-triggers",
262
+ /**
263
+ * Triggers a client puts on one Agent (D88): `PUT /v1/agents/{id}/triggers/{triggerId}` with a
264
+ * `Trigger` and an optional `title` creates or replaces the Agent's `api` trigger; `DELETE`
265
+ * removes it; the list shows `origin: api` and its `principal`; the trigger events carry `origin`,
266
+ * `principal` and `changed`.
267
+ */
268
+ "api-triggers",
262
269
  /**
263
270
  * A message's `delivery: "steer"` (D85): to a busy agent session it waits in the session queue
264
271
  * marked `steer`, and our engine takes it into the running turn before its next step (the
@@ -281,6 +281,13 @@ export const OPTIONAL_HOST_FEATURES = [
281
281
  * `runtime.limits.triggers`; and `GET /v1/runs/stream`, the Tenant's runs as server-sent events.
282
282
  */
283
283
  "agent-triggers",
284
+ /**
285
+ * Triggers a client puts on one Agent (D88): `PUT /v1/agents/{id}/triggers/{triggerId}` with a
286
+ * `Trigger` and an optional `title` creates or replaces the Agent's `api` trigger; `DELETE`
287
+ * removes it; the list shows `origin: api` and its `principal`; the trigger events carry `origin`,
288
+ * `principal` and `changed`.
289
+ */
290
+ "api-triggers",
284
291
  /**
285
292
  * A message's `delivery: "steer"` (D85): to a busy agent session it waits in the session queue
286
293
  * marked `steer`, and our engine takes it into the running turn before its next step (the
@@ -728,6 +728,28 @@ export declare const MemoryUpdatedPayloadSchema: z.ZodObject<{
728
728
  }, z.core.$loose>;
729
729
  export declare const AGENT_EVENT_TYPES: readonly ["agent.created", "agent.attached", "agent.detached", "agent.deleted", "agent.running", "agent.suspended", "agent.relaunched", "agent.lost", "agent.reset", "agent.failed", "agent.forked", "agent.outdated", "agent.version_changed", "agent.start_failed", "agent.egress", "agent.run", "agent.trigger_paused", "agent.trigger_resumed", "agent.trigger_secret_rotated", "agent.trigger_created", "agent.trigger_updated", "agent.trigger_deleted", "agent.memory_updated"];
730
730
  export type AgentEventType = (typeof AGENT_EVENT_TYPES)[number];
731
+ /** `agent.trigger_created` and `agent.trigger_updated`'s payload (D83, D88). */
732
+ export declare const TriggerChangePayloadSchema: z.ZodObject<{
733
+ triggerId: z.ZodString;
734
+ kind: z.ZodEnum<{
735
+ at: "at";
736
+ schedule: "schedule";
737
+ webhook: "webhook";
738
+ }>;
739
+ origin: z.ZodOptional<z.ZodEnum<{
740
+ agent: "agent";
741
+ api: "api";
742
+ }>>;
743
+ sessionId: z.ZodOptional<z.ZodString>;
744
+ principal: z.ZodOptional<z.ZodString>;
745
+ session: z.ZodString;
746
+ title: z.ZodOptional<z.ZodString>;
747
+ schedule: z.ZodOptional<z.ZodString>;
748
+ timezone: z.ZodOptional<z.ZodString>;
749
+ at: z.ZodOptional<z.ZodString>;
750
+ changed: z.ZodOptional<z.ZodArray<z.ZodString>>;
751
+ nextRunAt: z.ZodNullable<z.ZodString>;
752
+ }, z.core.$loose>;
731
753
  /** The payload of each Agent lifecycle event. */
732
754
  export declare const AGENT_EVENT_PAYLOADS: {
733
755
  readonly "agent.created": z.ZodObject<{
@@ -885,19 +907,31 @@ export declare const AGENT_EVENT_PAYLOADS: {
885
907
  triggerId: z.ZodString;
886
908
  }, z.core.$loose>;
887
909
  /**
888
- * An agent made a trigger with the `triggers` tool (D83), or replaced one with the same id
889
- * (`agent.trigger_updated`): the session whose agent made it (`sessionId`), the session it runs
890
- * in (`session`), its title and its next run.
910
+ * An agent made a trigger with the `triggers` tool (D83), or a client put one over the API
911
+ * (D88), or either replaced one with the same id (`agent.trigger_updated`): where it came from
912
+ * (`origin`), the session whose agent made it (`sessionId`, for `agent`) or who put it
913
+ * (`principal`, for `api`), the session it runs in (`session`), its timing, its title, its next
914
+ * run, and on an update the fields that changed (`changed`).
891
915
  */
892
916
  readonly "agent.trigger_created": z.ZodObject<{
893
917
  triggerId: z.ZodString;
894
918
  kind: z.ZodEnum<{
895
919
  at: "at";
896
920
  schedule: "schedule";
921
+ webhook: "webhook";
897
922
  }>;
898
- sessionId: z.ZodString;
923
+ origin: z.ZodOptional<z.ZodEnum<{
924
+ agent: "agent";
925
+ api: "api";
926
+ }>>;
927
+ sessionId: z.ZodOptional<z.ZodString>;
928
+ principal: z.ZodOptional<z.ZodString>;
899
929
  session: z.ZodString;
900
930
  title: z.ZodOptional<z.ZodString>;
931
+ schedule: z.ZodOptional<z.ZodString>;
932
+ timezone: z.ZodOptional<z.ZodString>;
933
+ at: z.ZodOptional<z.ZodString>;
934
+ changed: z.ZodOptional<z.ZodArray<z.ZodString>>;
901
935
  nextRunAt: z.ZodNullable<z.ZodString>;
902
936
  }, z.core.$loose>;
903
937
  readonly "agent.trigger_updated": z.ZodObject<{
@@ -905,15 +939,32 @@ export declare const AGENT_EVENT_PAYLOADS: {
905
939
  kind: z.ZodEnum<{
906
940
  at: "at";
907
941
  schedule: "schedule";
942
+ webhook: "webhook";
908
943
  }>;
909
- sessionId: z.ZodString;
944
+ origin: z.ZodOptional<z.ZodEnum<{
945
+ agent: "agent";
946
+ api: "api";
947
+ }>>;
948
+ sessionId: z.ZodOptional<z.ZodString>;
949
+ principal: z.ZodOptional<z.ZodString>;
910
950
  session: z.ZodString;
911
951
  title: z.ZodOptional<z.ZodString>;
952
+ schedule: z.ZodOptional<z.ZodString>;
953
+ timezone: z.ZodOptional<z.ZodString>;
954
+ at: z.ZodOptional<z.ZodString>;
955
+ changed: z.ZodOptional<z.ZodArray<z.ZodString>>;
912
956
  nextRunAt: z.ZodNullable<z.ZodString>;
913
957
  }, z.core.$loose>;
914
- /** A trigger an agent made was deleted: by an agent of `sessionId`, or over the API (`principal`). */
958
+ /**
959
+ * A trigger an agent made or a client put was deleted: by an agent of `sessionId`, or over the
960
+ * API (`principal`); `origin` says which kind of trigger it was (D88).
961
+ */
915
962
  readonly "agent.trigger_deleted": z.ZodObject<{
916
963
  triggerId: z.ZodString;
964
+ origin: z.ZodOptional<z.ZodEnum<{
965
+ agent: "agent";
966
+ api: "api";
967
+ }>>;
917
968
  sessionId: z.ZodOptional<z.ZodString>;
918
969
  principal: z.ZodOptional<z.ZodString>;
919
970
  }, z.core.$loose>;
@@ -1341,17 +1392,6 @@ export declare const HarnessSectionSchema: z.ZodUnion<readonly [z.ZodType<Workfl
1341
1392
  export declare const TriggerIdSchema: z.ZodString;
1342
1393
  /** The signature schemes a webhook trigger verifies: Standard Webhooks only. */
1343
1394
  export declare const WEBHOOK_SCHEMES: readonly ["standard-webhooks"];
1344
- /**
1345
- * One trigger of an agent manifest's `runtime.triggers`: exactly one of
1346
- * `schedule` (five-field cron, minute granularity, in `timezone`, an IANA name, default UTC), `at`
1347
- * (one run at an RFC 3339 time with an offset) or `webhook` (a webhook endpoint verified with the
1348
- * named scheme), plus the `session` each run goes to and the author's `prompt`.
1349
- *
1350
- * `session` is a session id of the Agent, opened on the trigger's first run if it does not
1351
- * exist, or `"new"` for a new session per run (`run-<runId>`). The Runtime keeps no main session.
1352
- * The cron's smallest gap, the `at` time, the prompt's length and how many triggers a
1353
- * manifest holds are checked against the Tenant's Runtime limits when it is saved.
1354
- */
1355
1395
  export declare const TriggerSchema: z.ZodObject<{
1356
1396
  schedule: z.ZodOptional<z.ZodString>;
1357
1397
  timezone: z.ZodOptional<z.ZodString>;
@@ -1374,11 +1414,12 @@ export declare function triggerKindOf(trigger: Trigger): Exclude<TriggerKind, "w
1374
1414
  */
1375
1415
  export declare const TRIGGER_STATUSES: readonly ["active", "paused", "completed"];
1376
1416
  /**
1377
- * Where a trigger's definition comes from (D83): `manifest` (the version's `runtime.triggers`),
1378
- * `agent` (made by an agent of the Agent's sessions with the `triggers` tool, kept by the Agent)
1379
- * or `wake` (a session's booked wake, never listed).
1417
+ * Where a trigger's definition comes from (D83, D88): `manifest` (the version's `runtime.triggers`),
1418
+ * `agent` (made by an agent of the Agent's sessions with the `triggers` tool, kept by the Agent),
1419
+ * `api` (put on the Agent by a client, `PUT /v1/agents/{id}/triggers/{triggerId}`, kept by the
1420
+ * Agent with the principal that put it) or `wake` (a session's booked wake, never listed).
1380
1421
  */
1381
- export declare const TRIGGER_ORIGINS: readonly ["manifest", "agent", "wake"];
1422
+ export declare const TRIGGER_ORIGINS: readonly ["manifest", "agent", "api", "wake"];
1382
1423
  export type TriggerOrigin = (typeof TRIGGER_ORIGINS)[number];
1383
1424
  /**
1384
1425
  * `GET /v1/agents/{id}/triggers`: one trigger, from its manifest entry (or, for one an agent made,
@@ -1394,11 +1435,13 @@ export declare const TriggerViewSchema: z.ZodObject<{
1394
1435
  }>;
1395
1436
  origin: z.ZodEnum<{
1396
1437
  agent: "agent";
1438
+ api: "api";
1397
1439
  manifest: "manifest";
1398
1440
  wake: "wake";
1399
1441
  }>;
1400
1442
  title: z.ZodNullable<z.ZodString>;
1401
1443
  createdSessionId: z.ZodNullable<z.ZodString>;
1444
+ principal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1402
1445
  status: z.ZodEnum<{
1403
1446
  active: "active";
1404
1447
  completed: "completed";
@@ -1427,11 +1470,13 @@ export declare const TriggerListSchema: z.ZodObject<{
1427
1470
  }>;
1428
1471
  origin: z.ZodEnum<{
1429
1472
  agent: "agent";
1473
+ api: "api";
1430
1474
  manifest: "manifest";
1431
1475
  wake: "wake";
1432
1476
  }>;
1433
1477
  title: z.ZodNullable<z.ZodString>;
1434
1478
  createdSessionId: z.ZodNullable<z.ZodString>;
1479
+ principal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1435
1480
  status: z.ZodEnum<{
1436
1481
  active: "active";
1437
1482
  completed: "completed";
@@ -1449,10 +1494,27 @@ export declare const TriggerListSchema: z.ZodObject<{
1449
1494
  prompt: z.ZodOptional<z.ZodString>;
1450
1495
  }, z.core.$strict>>;
1451
1496
  }, z.core.$strict>;
1497
+ /** The longest title an agent or a client gives a trigger it makes. */
1498
+ export declare const TRIGGER_TITLE_MAX = 80;
1499
+ /**
1500
+ * The body of `PUT /v1/agents/{agentId}/triggers/{triggerId}` (D88): a `Trigger`, exactly as a
1501
+ * definition's `runtime.triggers` entry holds it, and an optional `title`. It creates the Agent's
1502
+ * `api` trigger with that id, or replaces it; the same body again changes nothing.
1503
+ */
1504
+ export declare const TriggerPutSchema: z.ZodObject<{
1505
+ schedule: z.ZodOptional<z.ZodString>;
1506
+ timezone: z.ZodOptional<z.ZodString>;
1507
+ at: z.ZodOptional<z.ZodISODateTime>;
1508
+ webhook: z.ZodOptional<z.ZodEnum<{
1509
+ "standard-webhooks": "standard-webhooks";
1510
+ }>>;
1511
+ session: z.ZodString;
1512
+ prompt: z.ZodString;
1513
+ title: z.ZodOptional<z.ZodString>;
1514
+ }, z.core.$strict>;
1515
+ export type TriggerPut = z.infer<typeof TriggerPutSchema>;
1452
1516
  /** `in` of the `triggers` tool (D83): a delay in minutes, hours or days, such as `30m`, `2h`, `1d`. */
1453
1517
  export declare const TRIGGER_DELAY_PATTERN: RegExp;
1454
- /** The longest title an agent gives a trigger it makes. */
1455
- export declare const TRIGGER_TITLE_MAX = 80;
1456
1518
  /** Where an agent-made trigger runs: the calling session (`this`), or a session of its own (`own`). */
1457
1519
  export declare const TRIGGER_TOOL_SESSIONS: readonly ["this", "own"];
1458
1520
  /**
@@ -1592,6 +1654,7 @@ export declare const TenantRunSchema: z.ZodObject<{
1592
1654
  late: z.ZodBoolean;
1593
1655
  origin: z.ZodEnum<{
1594
1656
  agent: "agent";
1657
+ api: "api";
1595
1658
  manifest: "manifest";
1596
1659
  wake: "wake";
1597
1660
  }>;
@@ -1626,6 +1689,7 @@ export declare const TenantRunEventSchema: z.ZodObject<{
1626
1689
  late: z.ZodBoolean;
1627
1690
  origin: z.ZodEnum<{
1628
1691
  agent: "agent";
1692
+ api: "api";
1629
1693
  manifest: "manifest";
1630
1694
  wake: "wake";
1631
1695
  }>;
package/dist/contracts.js CHANGED
@@ -1172,6 +1172,27 @@ export const AGENT_EVENT_TYPES = [
1172
1172
  // Memory (track T5, D72): a turn changed the Agent's memories.
1173
1173
  "agent.memory_updated",
1174
1174
  ];
1175
+ /** `agent.trigger_created` and `agent.trigger_updated`'s payload (D83, D88). */
1176
+ export const TriggerChangePayloadSchema = z
1177
+ .object({
1178
+ triggerId: z.string(),
1179
+ kind: z.enum(["schedule", "at", "webhook"]),
1180
+ /** Absent on events recorded before D88, which were all `agent`. */
1181
+ origin: z.enum(["agent", "api"]).optional(),
1182
+ /** The session whose agent made it: an `agent` trigger's. */
1183
+ sessionId: z.string().optional(),
1184
+ /** Who put it: an `api` trigger's. */
1185
+ principal: z.string().optional(),
1186
+ session: z.string(),
1187
+ title: z.string().optional(),
1188
+ schedule: z.string().optional(),
1189
+ timezone: z.string().optional(),
1190
+ at: z.string().optional(),
1191
+ /** On `agent.trigger_updated` from D88: the definition's fields that changed. */
1192
+ changed: z.array(z.string()).optional(),
1193
+ nextRunAt: z.string().nullable(),
1194
+ })
1195
+ .passthrough();
1175
1196
  /** The payload of each Agent lifecycle event. */
1176
1197
  export const AGENT_EVENT_PAYLOADS = {
1177
1198
  "agent.created": z
@@ -1268,34 +1289,26 @@ export const AGENT_EVENT_PAYLOADS = {
1268
1289
  /** A webhook trigger's signing secret was made or replaced; the one before stopped working. */
1269
1290
  "agent.trigger_secret_rotated": z.object({ triggerId: z.string() }).passthrough(),
1270
1291
  /**
1271
- * An agent made a trigger with the `triggers` tool (D83), or replaced one with the same id
1272
- * (`agent.trigger_updated`): the session whose agent made it (`sessionId`), the session it runs
1273
- * in (`session`), its title and its next run.
1292
+ * An agent made a trigger with the `triggers` tool (D83), or a client put one over the API
1293
+ * (D88), or either replaced one with the same id (`agent.trigger_updated`): where it came from
1294
+ * (`origin`), the session whose agent made it (`sessionId`, for `agent`) or who put it
1295
+ * (`principal`, for `api`), the session it runs in (`session`), its timing, its title, its next
1296
+ * run, and on an update the fields that changed (`changed`).
1274
1297
  */
1275
- "agent.trigger_created": z
1276
- .object({
1277
- triggerId: z.string(),
1278
- kind: z.enum(["schedule", "at"]),
1279
- sessionId: z.string(),
1280
- session: z.string(),
1281
- title: z.string().optional(),
1282
- nextRunAt: z.string().nullable(),
1283
- })
1284
- .passthrough(),
1285
- "agent.trigger_updated": z
1298
+ "agent.trigger_created": TriggerChangePayloadSchema,
1299
+ "agent.trigger_updated": TriggerChangePayloadSchema,
1300
+ /**
1301
+ * A trigger an agent made or a client put was deleted: by an agent of `sessionId`, or over the
1302
+ * API (`principal`); `origin` says which kind of trigger it was (D88).
1303
+ */
1304
+ "agent.trigger_deleted": z
1286
1305
  .object({
1287
1306
  triggerId: z.string(),
1288
- kind: z.enum(["schedule", "at"]),
1289
- sessionId: z.string(),
1290
- session: z.string(),
1291
- title: z.string().optional(),
1292
- nextRunAt: z.string().nullable(),
1307
+ origin: z.enum(["agent", "api"]).optional(),
1308
+ sessionId: z.string().optional(),
1309
+ principal: z.string().optional(),
1293
1310
  })
1294
1311
  .passthrough(),
1295
- /** A trigger an agent made was deleted: by an agent of `sessionId`, or over the API (`principal`). */
1296
- "agent.trigger_deleted": z
1297
- .object({ triggerId: z.string(), sessionId: z.string().optional(), principal: z.string().optional() })
1298
- .passthrough(),
1299
1312
  /** A turn changed the Agent's memories (`memory.updated` in its session): which, and how. */
1300
1313
  "agent.memory_updated": MemoryUpdatedPayloadSchema.extend({ sessionId: z.string(), turnId: z.string() }),
1301
1314
  };
@@ -1902,8 +1915,7 @@ export const WEBHOOK_SCHEMES = ["standard-webhooks"];
1902
1915
  * The cron's smallest gap, the `at` time, the prompt's length and how many triggers a
1903
1916
  * manifest holds are checked against the Tenant's Runtime limits when it is saved.
1904
1917
  */
1905
- export const TriggerSchema = z
1906
- .strictObject({
1918
+ const TRIGGER_FIELDS = {
1907
1919
  schedule: z
1908
1920
  .string()
1909
1921
  .regex(/^\S+(\s+\S+){4}$/, { message: "schedule is five cron fields: minute hour day-of-month month day-of-week" })
@@ -1913,15 +1925,16 @@ export const TriggerSchema = z
1913
1925
  webhook: z.enum(WEBHOOK_SCHEMES).optional(),
1914
1926
  session: z.string().min(1).max(200),
1915
1927
  prompt: z.string().min(1),
1916
- })
1917
- .superRefine((trigger, ctx) => {
1928
+ };
1929
+ /** A trigger has exactly one of `schedule`, `at` or `webhook`, and `timezone` only with `schedule`. */
1930
+ function checkTriggerKind(trigger, ctx) {
1918
1931
  const kinds = [trigger.schedule, trigger.at, trigger.webhook].filter((value) => value !== undefined);
1919
1932
  if (kinds.length !== 1)
1920
1933
  ctx.addIssue({ code: "custom", message: "A trigger has exactly one of schedule, at or webhook" });
1921
1934
  if (trigger.timezone !== undefined && trigger.schedule === undefined)
1922
1935
  ctx.addIssue({ code: "custom", path: ["timezone"], message: "timezone goes with schedule" });
1923
- })
1924
- .meta({ id: "Trigger" });
1936
+ }
1937
+ export const TriggerSchema = z.strictObject(TRIGGER_FIELDS).superRefine(checkTriggerKind).meta({ id: "Trigger" });
1925
1938
  /** What a trigger is: the field it has, or `wake` for a session's own booking. */
1926
1939
  export const TRIGGER_KINDS = ["schedule", "at", "webhook", "wake"];
1927
1940
  /** A trigger's kind, from its manifest entry. */
@@ -1934,11 +1947,12 @@ export function triggerKindOf(trigger) {
1934
1947
  */
1935
1948
  export const TRIGGER_STATUSES = ["active", "paused", "completed"];
1936
1949
  /**
1937
- * Where a trigger's definition comes from (D83): `manifest` (the version's `runtime.triggers`),
1938
- * `agent` (made by an agent of the Agent's sessions with the `triggers` tool, kept by the Agent)
1939
- * or `wake` (a session's booked wake, never listed).
1950
+ * Where a trigger's definition comes from (D83, D88): `manifest` (the version's `runtime.triggers`),
1951
+ * `agent` (made by an agent of the Agent's sessions with the `triggers` tool, kept by the Agent),
1952
+ * `api` (put on the Agent by a client, `PUT /v1/agents/{id}/triggers/{triggerId}`, kept by the
1953
+ * Agent with the principal that put it) or `wake` (a session's booked wake, never listed).
1940
1954
  */
1941
- export const TRIGGER_ORIGINS = ["manifest", "agent", "wake"];
1955
+ export const TRIGGER_ORIGINS = ["manifest", "agent", "api", "wake"];
1942
1956
  /**
1943
1957
  * `GET /v1/agents/{id}/triggers`: one trigger, from its manifest entry (or, for one an agent made,
1944
1958
  * its own definition) and the Agent's state.
@@ -1948,10 +1962,12 @@ export const TriggerViewSchema = z
1948
1962
  id: z.string(),
1949
1963
  kind: z.enum(TRIGGER_KINDS),
1950
1964
  origin: z.enum(TRIGGER_ORIGINS),
1951
- /** The title an agent gave a trigger it made; null for a manifest's. */
1965
+ /** The title an agent or a client gave a trigger it made; null for a manifest's. */
1952
1966
  title: z.string().nullable(),
1953
- /** The session whose agent made it; null for a manifest's. */
1967
+ /** The session whose agent made it; null for a manifest's or an `api` trigger. */
1954
1968
  createdSessionId: z.string().nullable(),
1969
+ /** Who put an `api` trigger (D88); null for every other origin. Absent from a Runtime before D88. */
1970
+ principal: z.string().nullable().optional(),
1955
1971
  status: z.enum(TRIGGER_STATUSES),
1956
1972
  /** `manual`, `new` for one an upgrade added, `undeclared` for an agent's while the version lacks `engine.triggers`. */
1957
1973
  pausedReason: z.string().nullable(),
@@ -1975,10 +1991,18 @@ export const TriggerViewSchema = z
1975
1991
  })
1976
1992
  .strict();
1977
1993
  export const TriggerListSchema = z.object({ triggers: z.array(TriggerViewSchema) }).strict();
1994
+ /** The longest title an agent or a client gives a trigger it makes. */
1995
+ export const TRIGGER_TITLE_MAX = 80;
1996
+ /**
1997
+ * The body of `PUT /v1/agents/{agentId}/triggers/{triggerId}` (D88): a `Trigger`, exactly as a
1998
+ * definition's `runtime.triggers` entry holds it, and an optional `title`. It creates the Agent's
1999
+ * `api` trigger with that id, or replaces it; the same body again changes nothing.
2000
+ */
2001
+ export const TriggerPutSchema = z
2002
+ .strictObject({ ...TRIGGER_FIELDS, title: z.string().min(1).max(TRIGGER_TITLE_MAX).optional() })
2003
+ .superRefine(checkTriggerKind);
1978
2004
  /** `in` of the `triggers` tool (D83): a delay in minutes, hours or days, such as `30m`, `2h`, `1d`. */
1979
2005
  export const TRIGGER_DELAY_PATTERN = /^[1-9][0-9]*(m|h|d)$/;
1980
- /** The longest title an agent gives a trigger it makes. */
1981
- export const TRIGGER_TITLE_MAX = 80;
1982
2006
  /** Where an agent-made trigger runs: the calling session (`this`), or a session of its own (`own`). */
1983
2007
  export const TRIGGER_TOOL_SESSIONS = ["this", "own"];
1984
2008
  const triggerCreateSchema = z
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://docs.nylorun.com/schemas/harness-api/v5.5.json",
3
+ "$id": "https://docs.nylorun.com/schemas/harness-api/v5.6.json",
4
4
  "title": "Nylorun Harness API 5",
5
5
  "$defs": {
6
6
  "ArtifactMeta": {
@@ -845,6 +845,10 @@
845
845
  "additionalProperties": {
846
846
  "type": "string"
847
847
  }
848
+ },
849
+ "computer": {
850
+ "type": "boolean",
851
+ "const": true
848
852
  }
849
853
  },
850
854
  "required": [
@@ -1410,6 +1414,10 @@
1410
1414
  "additionalProperties": {
1411
1415
  "type": "string"
1412
1416
  }
1417
+ },
1418
+ "computer": {
1419
+ "type": "boolean",
1420
+ "const": true
1413
1421
  }
1414
1422
  },
1415
1423
  "required": [
@@ -3612,6 +3620,10 @@
3612
3620
  "additionalProperties": {
3613
3621
  "type": "string"
3614
3622
  }
3623
+ },
3624
+ "computer": {
3625
+ "type": "boolean",
3626
+ "const": true
3615
3627
  }
3616
3628
  },
3617
3629
  "required": [
@@ -4620,6 +4632,50 @@
4620
4632
  ],
4621
4633
  "additionalProperties": false
4622
4634
  },
4635
+ "computer.open.params": {
4636
+ "type": "object",
4637
+ "properties": {
4638
+ "runId": {
4639
+ "type": "string",
4640
+ "minLength": 1,
4641
+ "maxLength": 512
4642
+ },
4643
+ "environmentId": {
4644
+ "type": "string",
4645
+ "minLength": 1,
4646
+ "maxLength": 512
4647
+ }
4648
+ },
4649
+ "required": [
4650
+ "runId",
4651
+ "environmentId"
4652
+ ],
4653
+ "additionalProperties": false
4654
+ },
4655
+ "computer.open.result": {
4656
+ "type": "object",
4657
+ "properties": {
4658
+ "url": {
4659
+ "type": "string",
4660
+ "format": "uri"
4661
+ },
4662
+ "ticket": {
4663
+ "type": "string",
4664
+ "minLength": 1
4665
+ },
4666
+ "expiresAt": {
4667
+ "type": "integer",
4668
+ "minimum": -9007199254740991,
4669
+ "maximum": 9007199254740991
4670
+ }
4671
+ },
4672
+ "required": [
4673
+ "url",
4674
+ "ticket",
4675
+ "expiresAt"
4676
+ ],
4677
+ "additionalProperties": false
4678
+ },
4623
4679
  "artifact.read.params": {
4624
4680
  "type": "object",
4625
4681
  "properties": {
@@ -58,9 +58,11 @@ export function harnessApiSchemas() {
58
58
  * which a v5 harness that offers no `triggers` tool never sees. Revision 4: the effect kind `inputs`
59
59
  (D85): the messages steered into the running turn, which core answers at once and a v5 harness
60
60
  that never asks for it never sees. Revision 5: `artifact.write` `begin` may carry
61
- `audience: "model"` (ADR-139), which core accepts and only our own engine sends.
61
+ `audience: "model"` (ADR-139), which core accepts and only our own engine sends. Revision 6:
62
+ `routing.sandbox.computer` and the request `computer.open` (ADR-149), which a v5 harness never
63
+ sees unless the Tenant's pod Agents are computers.
62
64
  */
63
- const SCHEMA_REVISION = 5;
65
+ const SCHEMA_REVISION = 6;
64
66
  /** The JSON Schema document of the Harness API (draft 2020-12). */
65
67
  export function harnessApiJsonSchema() {
66
68
  const $defs = {};
@@ -348,6 +348,7 @@ export declare const RunRoutingSchema: z.ZodObject<{
348
348
  environmentId: z.ZodOptional<z.ZodString>;
349
349
  spec: z.ZodOptional<z.ZodUnknown>;
350
350
  environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
351
+ computer: z.ZodOptional<z.ZodLiteral<true>>;
351
352
  }, z.core.$strict>>;
352
353
  }, z.core.$strict>;
353
354
  /**
@@ -505,6 +506,7 @@ export declare const TurnStartSchema: z.ZodObject<{
505
506
  environmentId: z.ZodOptional<z.ZodString>;
506
507
  spec: z.ZodOptional<z.ZodUnknown>;
507
508
  environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
509
+ computer: z.ZodOptional<z.ZodLiteral<true>>;
508
510
  }, z.core.$strict>>;
509
511
  }, z.core.$strict>;
510
512
  trace: z.ZodOptional<z.ZodObject<{
@@ -748,6 +750,7 @@ export declare const harnessRequests: {
748
750
  environmentId: z.ZodOptional<z.ZodString>;
749
751
  spec: z.ZodOptional<z.ZodUnknown>;
750
752
  environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
753
+ computer: z.ZodOptional<z.ZodLiteral<true>>;
751
754
  }, z.core.$strict>>;
752
755
  }, z.core.$strict>;
753
756
  trace: z.ZodOptional<z.ZodObject<{
@@ -1003,6 +1006,24 @@ export declare const harnessRequests: {
1003
1006
  base64: z.ZodString;
1004
1007
  }, z.core.$strict>;
1005
1008
  };
1009
+ /**
1010
+ * Opens the computer of the run's session (ADR-149, Harness API 5.6): `environmentId` must be
1011
+ * the run's `routing.sandbox.environmentId` with `computer: true`. Core wakes it, waits until it
1012
+ * is ready, writes a seed onto a new disk and runs the disk's setup when needed, and answers the
1013
+ * sandbox gateway's URL for it, a ticket the gateway and the computer check, and when the ticket
1014
+ * expires (ms since the epoch). A harness opens it again before then.
1015
+ */
1016
+ "computer.open": {
1017
+ params: z.ZodObject<{
1018
+ runId: z.ZodString;
1019
+ environmentId: z.ZodString;
1020
+ }, z.core.$strict>;
1021
+ result: z.ZodObject<{
1022
+ url: z.ZodString;
1023
+ ticket: z.ZodString;
1024
+ expiresAt: z.ZodNumber;
1025
+ }, z.core.$strict>;
1026
+ };
1006
1027
  /**
1007
1028
  * An artifact the run's session may read (the artifact seam, protocol 15): one of the session's
1008
1029
  * own, or a Tenant-wide one its messages named; anything else is `not_found`, alike. The answer
@@ -265,6 +265,12 @@ export const RunRoutingSchema = z
265
265
  * the sentinel `nylorun_managed`, and each `environment_variable`'s value. Never a secret.
266
266
  */
267
267
  environment: z.record(z.string(), z.string()).optional(),
268
+ /**
269
+ * The sandbox is a computer (ADR-149, Harness API 5.6): an Agent Substrate actor whose
270
+ * engine runs no loop. A harness opens it with `computer.open` and sends its sandbox
271
+ * calls to it through the sandbox gateway.
272
+ */
273
+ computer: z.literal(true).optional(),
268
274
  })
269
275
  .strict()
270
276
  .optional(),
@@ -577,6 +583,17 @@ export const harnessRequests = {
577
583
  .strict(),
578
584
  result: z.object({ base64: z.string() }).strict(),
579
585
  },
586
+ /**
587
+ * Opens the computer of the run's session (ADR-149, Harness API 5.6): `environmentId` must be
588
+ * the run's `routing.sandbox.environmentId` with `computer: true`. Core wakes it, waits until it
589
+ * is ready, writes a seed onto a new disk and runs the disk's setup when needed, and answers the
590
+ * sandbox gateway's URL for it, a ticket the gateway and the computer check, and when the ticket
591
+ * expires (ms since the epoch). A harness opens it again before then.
592
+ */
593
+ "computer.open": {
594
+ params: runId.extend({ environmentId: id }).strict(),
595
+ result: z.object({ url: z.string().url(), ticket: z.string().min(1), expiresAt: z.number().int() }).strict(),
596
+ },
580
597
  /**
581
598
  * An artifact the run's session may read (the artifact seam, protocol 15): one of the session's
582
599
  * own, or a Tenant-wide one its messages named; anything else is `not_found`, alike. The answer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/core",
3
- "version": "0.44.0-beta",
3
+ "version": "0.46.0-beta",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Shared agent definitions and wire contracts",