@nylorun/core 0.23.0-beta → 0.25.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/compatibility.d.ts +127 -59
  3. package/dist/compatibility.js +128 -60
  4. package/dist/contracts.d.ts +2413 -893
  5. package/dist/contracts.js +1144 -491
  6. package/dist/define.d.ts +1 -0
  7. package/dist/define.js +1 -0
  8. package/dist/definition/approval.d.ts +1 -1
  9. package/dist/definition/bound.d.ts +2 -0
  10. package/dist/definition/builder.d.ts +2 -2
  11. package/dist/definition/builder.js +1 -1
  12. package/dist/definition/code-tools.d.ts +1 -1
  13. package/dist/definition/declaration.js +3 -0
  14. package/dist/definition/delegate.d.ts +1 -1
  15. package/dist/definition/delegate.js +1 -1
  16. package/dist/definition/from.d.ts +2 -2
  17. package/dist/definition/from.js +1 -1
  18. package/dist/definition/http-tool.d.ts +3 -3
  19. package/dist/definition/mcp.d.ts +4 -4
  20. package/dist/definition/mcp.js +3 -3
  21. package/dist/definition/removed.d.ts +7 -0
  22. package/dist/definition/removed.js +21 -1
  23. package/dist/definition/sections.d.ts +64 -0
  24. package/dist/definition/sections.js +227 -0
  25. package/dist/definition/variant.d.ts +1 -1
  26. package/dist/definition/variant.js +4 -4
  27. package/dist/harness-api/entries.d.ts +1 -1
  28. package/dist/harness-api/entries.js +1 -1
  29. package/dist/harness-api/gates.d.ts +1 -1
  30. package/dist/harness-api/gates.js +1 -1
  31. package/dist/harness-api/harness-api.schema.json +182 -6
  32. package/dist/harness-api/index.d.ts +3 -3
  33. package/dist/harness-api/index.js +3 -3
  34. package/dist/harness-api/json-schema.d.ts +1 -1
  35. package/dist/harness-api/json-schema.js +3 -3
  36. package/dist/harness-api/mcp.js +1 -1
  37. package/dist/harness-api/messages.d.ts +10 -8
  38. package/dist/harness-api/messages.js +1 -1
  39. package/dist/harness-api/schema.d.ts +82 -13
  40. package/dist/harness-api/schema.js +63 -19
  41. package/dist/harness-api/transcript.d.ts +1 -1
  42. package/dist/harness-api/transport.d.ts +1 -1
  43. package/dist/harness-api/transport.js +1 -1
  44. package/dist/manifest-schemas.d.ts +9 -5
  45. package/dist/manifest-schemas.js +24 -27
  46. package/dist/schemas/agent-manifest.schema.json +1534 -250
  47. package/dist/schemas/harness-manifest.schema.json +1273 -0
  48. package/dist/schemas/{environment-manifest.schema.json → runtime-manifest.schema.json} +109 -68
  49. package/dist/types/manifest.d.ts +87 -15
  50. package/dist/types/manifest.js +4 -0
  51. package/dist/types/model.d.ts +5 -0
  52. package/dist/types/observe.d.ts +1 -1
  53. package/dist/types/part.d.ts +5 -0
  54. package/dist/types/tool.d.ts +4 -4
  55. package/dist/utils/definition-files.d.ts +3 -2
  56. package/dist/utils/definition-files.js +4 -3
  57. package/dist/utils/file-systems.d.ts +1 -1
  58. package/dist/utils/file-systems.js +1 -1
  59. package/dist/utils/harness-id.d.ts +1 -1
  60. package/dist/utils/harness-id.js +1 -1
  61. package/dist/utils/memory.d.ts +64 -0
  62. package/dist/utils/memory.js +139 -0
  63. package/dist/utils/runtime-limits.d.ts +55 -4
  64. package/dist/utils/runtime-limits.js +106 -3
  65. package/dist/utils/runtime-tools.d.ts +3 -3
  66. package/dist/utils/runtime-tools.js +3 -3
  67. package/package.json +6 -5
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://docs.nylorun.com/schemas/harness-api/v4.json",
4
- "title": "Nylorun Harness API 4",
3
+ "$id": "https://docs.nylorun.com/schemas/harness-api/v5.json",
4
+ "title": "Nylorun Harness API 5",
5
5
  "$defs": {
6
6
  "ArtifactMeta": {
7
7
  "type": "object",
@@ -179,6 +179,27 @@
179
179
  "kind"
180
180
  ],
181
181
  "additionalProperties": false
182
+ },
183
+ {
184
+ "type": "object",
185
+ "properties": {
186
+ "kind": {
187
+ "type": "string",
188
+ "const": "runtime"
189
+ },
190
+ "operation": {
191
+ "type": "string",
192
+ "enum": [
193
+ "schedule_wake",
194
+ "memory"
195
+ ]
196
+ }
197
+ },
198
+ "required": [
199
+ "kind",
200
+ "operation"
201
+ ],
202
+ "additionalProperties": false
182
203
  }
183
204
  ]
184
205
  },
@@ -600,10 +621,31 @@
600
621
  "kind"
601
622
  ],
602
623
  "additionalProperties": false
624
+ },
625
+ {
626
+ "type": "object",
627
+ "properties": {
628
+ "kind": {
629
+ "type": "string",
630
+ "const": "runtime"
631
+ },
632
+ "operation": {
633
+ "type": "string",
634
+ "enum": [
635
+ "schedule_wake",
636
+ "memory"
637
+ ]
638
+ }
639
+ },
640
+ "required": [
641
+ "kind",
642
+ "operation"
643
+ ],
644
+ "additionalProperties": false
603
645
  }
604
646
  ]
605
647
  },
606
- "TurnEnvironment": {
648
+ "TurnAgent": {
607
649
  "type": "object",
608
650
  "properties": {
609
651
  "id": {
@@ -631,6 +673,9 @@
631
673
  "workspace"
632
674
  ],
633
675
  "additionalProperties": false
676
+ },
677
+ "selfWake": {
678
+ "type": "boolean"
634
679
  }
635
680
  },
636
681
  "required": [
@@ -1106,6 +1151,58 @@
1106
1151
  },
1107
1152
  "additionalProperties": {}
1108
1153
  },
1154
+ "definition": {
1155
+ "type": "object",
1156
+ "properties": {
1157
+ "name": {
1158
+ "type": "string"
1159
+ },
1160
+ "version": {
1161
+ "type": "integer",
1162
+ "exclusiveMinimum": 0,
1163
+ "maximum": 9007199254740991
1164
+ }
1165
+ },
1166
+ "required": [
1167
+ "name",
1168
+ "version"
1169
+ ],
1170
+ "additionalProperties": false
1171
+ },
1172
+ "loop": {
1173
+ "type": "object",
1174
+ "propertyNames": {
1175
+ "type": "string"
1176
+ },
1177
+ "additionalProperties": {}
1178
+ },
1179
+ "memory": {
1180
+ "type": "object",
1181
+ "properties": {
1182
+ "access": {
1183
+ "type": "string",
1184
+ "enum": [
1185
+ "read_write",
1186
+ "read_only"
1187
+ ]
1188
+ },
1189
+ "instructions": {
1190
+ "type": "string"
1191
+ },
1192
+ "index": {
1193
+ "type": "string"
1194
+ },
1195
+ "truncated": {
1196
+ "type": "boolean"
1197
+ }
1198
+ },
1199
+ "required": [
1200
+ "access",
1201
+ "index",
1202
+ "truncated"
1203
+ ],
1204
+ "additionalProperties": false
1205
+ },
1109
1206
  "checkpoint": {
1110
1207
  "type": "object",
1111
1208
  "propertyNames": {
@@ -1431,7 +1528,7 @@
1431
1528
  ],
1432
1529
  "additionalProperties": false
1433
1530
  },
1434
- "environment": {
1531
+ "agent": {
1435
1532
  "type": "object",
1436
1533
  "properties": {
1437
1534
  "id": {
@@ -1459,6 +1556,9 @@
1459
1556
  "workspace"
1460
1557
  ],
1461
1558
  "additionalProperties": false
1559
+ },
1560
+ "selfWake": {
1561
+ "type": "boolean"
1462
1562
  }
1463
1563
  },
1464
1564
  "required": [
@@ -3134,7 +3234,7 @@
3134
3234
  "properties": {
3135
3235
  "api": {
3136
3236
  "type": "number",
3137
- "const": 4
3237
+ "const": 5
3138
3238
  },
3139
3239
  "tenantId": {
3140
3240
  "type": "string",
@@ -3246,6 +3346,58 @@
3246
3346
  },
3247
3347
  "additionalProperties": {}
3248
3348
  },
3349
+ "definition": {
3350
+ "type": "object",
3351
+ "properties": {
3352
+ "name": {
3353
+ "type": "string"
3354
+ },
3355
+ "version": {
3356
+ "type": "integer",
3357
+ "exclusiveMinimum": 0,
3358
+ "maximum": 9007199254740991
3359
+ }
3360
+ },
3361
+ "required": [
3362
+ "name",
3363
+ "version"
3364
+ ],
3365
+ "additionalProperties": false
3366
+ },
3367
+ "loop": {
3368
+ "type": "object",
3369
+ "propertyNames": {
3370
+ "type": "string"
3371
+ },
3372
+ "additionalProperties": {}
3373
+ },
3374
+ "memory": {
3375
+ "type": "object",
3376
+ "properties": {
3377
+ "access": {
3378
+ "type": "string",
3379
+ "enum": [
3380
+ "read_write",
3381
+ "read_only"
3382
+ ]
3383
+ },
3384
+ "instructions": {
3385
+ "type": "string"
3386
+ },
3387
+ "index": {
3388
+ "type": "string"
3389
+ },
3390
+ "truncated": {
3391
+ "type": "boolean"
3392
+ }
3393
+ },
3394
+ "required": [
3395
+ "access",
3396
+ "index",
3397
+ "truncated"
3398
+ ],
3399
+ "additionalProperties": false
3400
+ },
3249
3401
  "checkpoint": {
3250
3402
  "type": "object",
3251
3403
  "propertyNames": {
@@ -3571,7 +3723,7 @@
3571
3723
  ],
3572
3724
  "additionalProperties": false
3573
3725
  },
3574
- "environment": {
3726
+ "agent": {
3575
3727
  "type": "object",
3576
3728
  "properties": {
3577
3729
  "id": {
@@ -3599,6 +3751,9 @@
3599
3751
  "workspace"
3600
3752
  ],
3601
3753
  "additionalProperties": false
3754
+ },
3755
+ "selfWake": {
3756
+ "type": "boolean"
3602
3757
  }
3603
3758
  },
3604
3759
  "required": [
@@ -3839,6 +3994,27 @@
3839
3994
  "kind"
3840
3995
  ],
3841
3996
  "additionalProperties": false
3997
+ },
3998
+ {
3999
+ "type": "object",
4000
+ "properties": {
4001
+ "kind": {
4002
+ "type": "string",
4003
+ "const": "runtime"
4004
+ },
4005
+ "operation": {
4006
+ "type": "string",
4007
+ "enum": [
4008
+ "schedule_wake",
4009
+ "memory"
4010
+ ]
4011
+ }
4012
+ },
4013
+ "required": [
4014
+ "kind",
4015
+ "operation"
4016
+ ],
4017
+ "additionalProperties": false
3842
4018
  }
3843
4019
  ]
3844
4020
  },
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 4).
2
+ * `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 5).
3
3
  * Everything a harness sends or reads has a schema here, and the Runtime validates with the same
4
4
  * schemas, so these types are the enforced ones: the frames and messages (`schema.ts`), the
5
5
  * transport and the pod join (`transport.ts`), the Model and Tool Gate bodies (`gates.ts`), the
@@ -8,14 +8,14 @@
8
8
  * no I/O.
9
9
  *
10
10
  * Three version numbers apply: the transport (path and header, 1), the messages
11
- * (`HARNESS_API_VERSION`, 4) and the Runtime protocol, which only the Runtime's own APIs carry.
11
+ * (`HARNESS_API_VERSION`, 5) and the Runtime protocol, which only the Runtime's own APIs carry.
12
12
  */
13
13
  export * from "./messages.js";
14
14
  export { HarnessApiError } from "./errors.js";
15
15
  export { effectRequestHash, requestIdentity } from "./hash.js";
16
16
  export { TranscriptFoldError, applyUpdate, applyUpdates, transcriptOf, transcriptUpdates, withTranscript, type TranscriptUpdate, } from "./transcript.js";
17
17
  export { createChannel, memoryChannels, memoryPorts, type Frame, type HarnessChannel, type MemoryPortsOptions, type MessageListener, type Port, type RequestHandler, } from "./rpc.js";
18
- export { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema, TurnEnvironmentSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, coreMessages, coreRequests, harnessRequests, validateFrame, validateMessage, validateParams, validateResult, } from "./schema.js";
18
+ export { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema, TurnAgentSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, TurnMemorySchema, coreMessages, coreRequests, harnessRequests, validateFrame, validateMessage, validateParams, validateResult, } from "./schema.js";
19
19
  export * from "./transport.js";
20
20
  export * from "./gates.js";
21
21
  export * from "./mcp.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 4).
2
+ * `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 5).
3
3
  * Everything a harness sends or reads has a schema here, and the Runtime validates with the same
4
4
  * schemas, so these types are the enforced ones: the frames and messages (`schema.ts`), the
5
5
  * transport and the pod join (`transport.ts`), the Model and Tool Gate bodies (`gates.ts`), the
@@ -8,14 +8,14 @@
8
8
  * no I/O.
9
9
  *
10
10
  * Three version numbers apply: the transport (path and header, 1), the messages
11
- * (`HARNESS_API_VERSION`, 4) and the Runtime protocol, which only the Runtime's own APIs carry.
11
+ * (`HARNESS_API_VERSION`, 5) and the Runtime protocol, which only the Runtime's own APIs carry.
12
12
  */
13
13
  export * from "./messages.js";
14
14
  export { HarnessApiError } from "./errors.js";
15
15
  export { effectRequestHash, requestIdentity } from "./hash.js";
16
16
  export { TranscriptFoldError, applyUpdate, applyUpdates, transcriptOf, transcriptUpdates, withTranscript, } from "./transcript.js";
17
17
  export { createChannel, memoryChannels, memoryPorts, } from "./rpc.js";
18
- export { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema, TurnEnvironmentSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, coreMessages, coreRequests, harnessRequests, validateFrame, validateMessage, validateParams, validateResult, } from "./schema.js";
18
+ export { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema, TurnAgentSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, TurnMemorySchema, coreMessages, coreRequests, harnessRequests, validateFrame, validateMessage, validateParams, validateResult, } from "./schema.js";
19
19
  export * from "./transport.js";
20
20
  export * from "./gates.js";
21
21
  export * from "./mcp.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The Harness API as one JSON Schema document (R4.5, Q4), generated from the same zod schemas the
2
+ * The Harness API as one JSON Schema document, generated from the same zod schemas the
3
3
  * Runtime validates with, so a harness written in another language validates against what core
4
4
  * enforces. The build writes it to `dist/harness-api/harness-api.schema.json`
5
5
  * (`@nylorun/core/harness-api/schema.json`). `$defs` holds every published schema by name, and
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The Harness API as one JSON Schema document (R4.5, Q4), generated from the same zod schemas the
2
+ * The Harness API as one JSON Schema document, generated from the same zod schemas the
3
3
  * Runtime validates with, so a harness written in another language validates against what core
4
4
  * enforces. The build writes it to `dist/harness-api/harness-api.schema.json`
5
5
  * (`@nylorun/core/harness-api/schema.json`). `$defs` holds every published schema by name, and
@@ -11,7 +11,7 @@ import * as mcp from "./mcp.js";
11
11
  import * as entries from "./entries.js";
12
12
  import * as transport from "./transport.js";
13
13
  import { HARNESS_API_VERSION } from "./messages.js";
14
- import { ArtifactMetaSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema, TurnEnvironmentSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, coreMessages, coreRequests, harnessRequests, } from "./schema.js";
14
+ import { ArtifactMetaSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema, TurnAgentSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, coreMessages, coreRequests, harnessRequests, } from "./schema.js";
15
15
  const named = {
16
16
  ArtifactMetaSchema,
17
17
  EffectIntentSchema,
@@ -20,7 +20,7 @@ const named = {
20
20
  IntentAnswerSchema,
21
21
  ModelDescriptorSchema,
22
22
  EffectTargetSchema,
23
- TurnEnvironmentSchema,
23
+ TurnAgentSchema,
24
24
  OutcomeAnswerSchema,
25
25
  RecordedOutcomeSchema,
26
26
  RunGrantSchema,
@@ -42,7 +42,7 @@ export const McpSnapshotSchema = z.object({
42
42
  });
43
43
  /** One tool of a server, as a turn sees it. */
44
44
  export const McpToolFactSchema = McpToolRecordSchema.extend({
45
- /** False when the turn's manifest disables it (R2b C9): the record refuses its calls. */
45
+ /** False when the turn's manifest disables it: the record refuses its calls. */
46
46
  enabled: z.boolean(),
47
47
  /** The manifest's `deferred` setting of the tool; absent, the harness decides. */
48
48
  deferred: z.boolean().optional(),
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Harness API v4 (blueprint D37–D42; the harness boundary, protocol 15): the messages between
2
+ * Harness API v4 (the harness boundary, protocol 15): the messages between
3
3
  * core and a harness. A run is a lease on one session's segment; core records, the harness runs
4
4
  * the engine. Who executes what: the harness runs model, MCP, HTTP and sandbox calls and its own
5
5
  * tools (our engine's skill, artifact and deferred-tool tools among them, over the
@@ -10,8 +10,8 @@
10
10
  * which a socket validates it with.
11
11
  */
12
12
  import type { z } from "zod";
13
- import type { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, EffectTargetSchema, IntentAnswerSchema, ModelDescriptorSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, ReleaseReasonSchema, RequestTypes, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TurnEnvironmentSchema, TurnOutputSchema, TurnStartSchema, WorkspaceCallSchema, WorkspaceDiskCallSchema, WorkspaceRecordSchema, WorkspaceSessionSchema, coreMessages, coreRequests, harnessRequests } from "./schema.js";
14
- export declare const HARNESS_API_VERSION = 4;
13
+ import type { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, EffectTargetSchema, IntentAnswerSchema, ModelDescriptorSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, ReleaseReasonSchema, RequestTypes, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TurnAgentSchema, TurnMemorySchema, TurnOutputSchema, TurnStartSchema, WorkspaceCallSchema, WorkspaceDiskCallSchema, WorkspaceRecordSchema, WorkspaceSessionSchema, coreMessages, coreRequests, harnessRequests } from "./schema.js";
14
+ export declare const HARNESS_API_VERSION = 5;
15
15
  /** Why core stopped a run. Matches the advance's abort kinds. */
16
16
  export declare const ABORT_REASONS: readonly ["cancel", "shutdown", "deadline", "ownership.lost"];
17
17
  export type AbortReason = (typeof ABORT_REASONS)[number];
@@ -42,7 +42,9 @@ export type EffectIntent = z.infer<typeof EffectIntentSchema>;
42
42
  /** What a tool call runs: the record routes it by `kind` (protocol 15). */
43
43
  export type EffectTarget = z.infer<typeof EffectTargetSchema>;
44
44
  /** The Environment a turn runs in (`turn.start.environment`, protocol 15). */
45
- export type TurnEnvironment = z.infer<typeof TurnEnvironmentSchema>;
45
+ export type TurnAgent = z.infer<typeof TurnAgentSchema>;
46
+ /** The Agent's memory as a turn starts (`turn.start.memory`). */
47
+ export type TurnMemory = z.infer<typeof TurnMemorySchema>;
46
48
  /** An artifact as the artifact seam shows it to a harness (`artifact.read`, `artifact.write`). */
47
49
  export type ArtifactMeta = z.infer<typeof ArtifactMetaSchema>;
48
50
  /** One `artifact.read` answer: the artifact, and up to one chunk of its bytes from `offset`. */
@@ -58,11 +60,11 @@ export type ArtifactWriteResult = ResultOf<"artifact.write">;
58
60
  export type CompactionFacts = z.infer<typeof CompactionFactsSchema>;
59
61
  /** A completed outcome of the segment, with the hash of the request it answered. */
60
62
  export type RecordedOutcome = z.infer<typeof RecordedOutcomeSchema>;
61
- /** The lease on one run. `token` is the run token (F5) when the gates require one. */
63
+ /** The lease on one run. `token` is the run token when the gates require one. */
62
64
  export type RunGrant = z.infer<typeof RunGrantSchema>;
63
65
  /** Where a harness sends the session's tool calls. */
64
66
  export type RunRouting = z.infer<typeof RunRoutingSchema>;
65
- /** W3C trace context a turn carries (R4.10). */
67
+ /** W3C trace context a turn carries. */
66
68
  export type TraceContext = z.infer<typeof TraceContextSchema>;
67
69
  /** The model a turn's calls use when they name none (`turn.start.model`, protocol 15). */
68
70
  export type ModelDescriptor = z.infer<typeof ModelDescriptorSchema>;
@@ -86,9 +88,9 @@ export type WorkspaceSession = z.infer<typeof WorkspaceSessionSchema>;
86
88
  export type WorkspaceRecord = z.infer<typeof WorkspaceRecordSchema>;
87
89
  /** A sandbox tool call core sends to the harness that serves workspaces. */
88
90
  export type WorkspaceCall = z.infer<typeof WorkspaceCallSchema>;
89
- /** One operation on a workspace's disk (R2d step 3). */
91
+ /** One operation on a workspace's disk. */
90
92
  export type WorkspaceDiskCall = z.infer<typeof WorkspaceDiskCallSchema>;
91
- /** Requests core sends to a harness that declared `workspace` (F6.2), with their answers. */
93
+ /** Requests core sends to a harness that declared `workspace`, with their answers. */
92
94
  export type CoreRequests = RequestTypes<typeof coreRequests>;
93
95
  /** Messages core sends to a harness, without an answer. */
94
96
  export type CoreMessages = {
@@ -1,4 +1,4 @@
1
- export const HARNESS_API_VERSION = 4;
1
+ export const HARNESS_API_VERSION = 5;
2
2
  /** Why core stopped a run. Matches the advance's abort kinds. */
3
3
  export const ABORT_REASONS = ["cancel", "shutdown", "deadline", "ownership.lost"];
4
4
  /**
@@ -113,6 +113,12 @@ export declare const EffectTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
113
113
  kind: z.ZodLiteral<"sandbox">;
114
114
  }, z.core.$strict>, z.ZodObject<{
115
115
  kind: z.ZodLiteral<"harness">;
116
+ }, z.core.$strict>, z.ZodObject<{
117
+ kind: z.ZodLiteral<"runtime">;
118
+ operation: z.ZodEnum<{
119
+ memory: "memory";
120
+ schedule_wake: "schedule_wake";
121
+ }>;
116
122
  }, z.core.$strict>], "kind">;
117
123
  /**
118
124
  * One effect the engine asks for: a `HostEffect`, by structure. Model intents carry no `input`.
@@ -167,6 +173,12 @@ export declare const EffectIntentSchema: z.ZodObject<{
167
173
  kind: z.ZodLiteral<"sandbox">;
168
174
  }, z.core.$strict>, z.ZodObject<{
169
175
  kind: z.ZodLiteral<"harness">;
176
+ }, z.core.$strict>, z.ZodObject<{
177
+ kind: z.ZodLiteral<"runtime">;
178
+ operation: z.ZodEnum<{
179
+ memory: "memory";
180
+ schedule_wake: "schedule_wake";
181
+ }>;
170
182
  }, z.core.$strict>], "kind">>;
171
183
  skill: z.ZodOptional<z.ZodString>;
172
184
  purpose: z.ZodOptional<z.ZodLiteral<"summary">>;
@@ -243,7 +255,7 @@ export declare const WorkspaceCallSchema: z.ZodObject<{
243
255
  input: z.ZodUnknown;
244
256
  }, z.core.$strict>;
245
257
  /**
246
- * One operation on the disk of a workspace (R2d step 3): `list` its entries (files with mode and
258
+ * One operation on the disk of a workspace: `list` its entries (files with mode and
247
259
  * modification time, links, empty directories; paths relative to the volume, `workspace/…` and
248
260
  * in a pod `harness/…`), `read` a range of one file (answered `{kind: "read", base64, eof}`),
249
261
  * `clear` it (the engine's own files stay), or `put` entries back in order. A `workspace.read`
@@ -311,7 +323,7 @@ export declare const WorkspaceDiskCallSchema: z.ZodObject<{
311
323
  }, z.core.$strict>>;
312
324
  }, z.core.$strict>]>;
313
325
  }, z.core.$strict>;
314
- /** The lease on one run. `token` is the run token (F5) when the gates require one. */
326
+ /** The lease on one run. `token` is the run token when the gates require one. */
315
327
  export declare const RunGrantSchema: z.ZodObject<{
316
328
  runId: z.ZodString;
317
329
  sessionId: z.ZodString;
@@ -331,10 +343,12 @@ export declare const RunRoutingSchema: z.ZodObject<{
331
343
  }, z.core.$strict>>;
332
344
  }, z.core.$strict>;
333
345
  /**
334
- * The fields of `TurnStart.checkpoint` a harness reads (R4.2); the rest are our engine's. An
346
+ * The fields of `TurnStart.checkpoint` a harness reads; the rest are our engine's. An
335
347
  * agent turn's `input` is the turn's message: a string, `{text, metadata?}`, `{content,
336
- * metadata?}` with user content parts, `{kind: "continue"}` for the next segment of a yielded
337
- * turn, or an approval or response event. Effect ids are prefixed `<turnId>:<segment>:`
348
+ * metadata?}` with user content parts, `{kind: "messages", messages}` for messages that waited in
349
+ * the session's queue (protocol 17: each one of the shapes before, each its own user message, in
350
+ * order), `{kind: "continue"}` for the next segment of a yielded turn, or an approval or response
351
+ * event. Effect ids are prefixed `<turnId>:<segment>:`
338
352
  * (`effectIdOf`), and every intent carries `manifestHash`. `state` is the harness's own, as its
339
353
  * last output left it: core stores it unread (at most `limits.harnessStateBytes` for a harness
340
354
  * other than ours) and folds the transcript every segment, whatever the state holds. A model
@@ -377,11 +391,12 @@ export declare const ModelDescriptorSchema: z.ZodObject<{
377
391
  reasoning: z.ZodOptional<z.ZodBoolean>;
378
392
  }, z.core.$strict>;
379
393
  /**
380
- * The Environment a turn runs in (protocol 15): its id and kind and, when the session has a
394
+ * The Agent a turn runs on (Harness API 5, protocol 16): its id and kind and, when it has a
381
395
  * sandbox, the workspace its commands start in. A harness writes the model's instructions and
382
396
  * defines its sandbox tools from it; the sandbox's spec is the routing's (`routing.sandbox.spec`).
397
+ * The Agent's runtime section never reaches the harness.
383
398
  */
384
- export declare const TurnEnvironmentSchema: z.ZodObject<{
399
+ export declare const TurnAgentSchema: z.ZodObject<{
385
400
  id: z.ZodString;
386
401
  kind: z.ZodEnum<{
387
402
  none: "none";
@@ -391,6 +406,24 @@ export declare const TurnEnvironmentSchema: z.ZodObject<{
391
406
  sandbox: z.ZodOptional<z.ZodObject<{
392
407
  workspace: z.ZodString;
393
408
  }, z.core.$strict>>;
409
+ selfWake: z.ZodOptional<z.ZodBoolean>;
410
+ }, z.core.$strict>;
411
+ /**
412
+ * The Agent's memory as a turn starts, present when the version its session runs
413
+ * sets `harness.memory`: its access in every turn, the agent's own `instructions`, and the index a
414
+ * harness pins in the session (one line per memory, newest first, with its description, within
415
+ * the Runtime limits `memoryIndexLines` and `memoryIndexBytes`; `truncated` when some were left
416
+ * out). A harness offers the `memory` tool (a `runtime` effect, operation `memory`), view only for
417
+ * `read_only` and for its sub-agents.
418
+ */
419
+ export declare const TurnMemorySchema: z.ZodObject<{
420
+ access: z.ZodEnum<{
421
+ read_only: "read_only";
422
+ read_write: "read_write";
423
+ }>;
424
+ instructions: z.ZodOptional<z.ZodString>;
425
+ index: z.ZodString;
426
+ truncated: z.ZodBoolean;
394
427
  }, z.core.$strict>;
395
428
  /** What a run starts from: `turn.start` (message, continue, resume) or `approval.answer`. */
396
429
  export declare const TurnStartSchema: z.ZodObject<{
@@ -403,6 +436,20 @@ export declare const TurnStartSchema: z.ZodObject<{
403
436
  flow: "flow";
404
437
  }>;
405
438
  manifest: z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>;
439
+ definition: z.ZodOptional<z.ZodObject<{
440
+ name: z.ZodString;
441
+ version: z.ZodNumber;
442
+ }, z.core.$strict>>;
443
+ loop: z.ZodOptional<z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>>;
444
+ memory: z.ZodOptional<z.ZodObject<{
445
+ access: z.ZodEnum<{
446
+ read_only: "read_only";
447
+ read_write: "read_write";
448
+ }>;
449
+ instructions: z.ZodOptional<z.ZodString>;
450
+ index: z.ZodString;
451
+ truncated: z.ZodBoolean;
452
+ }, z.core.$strict>>;
406
453
  checkpoint: z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>;
407
454
  mcp: z.ZodOptional<z.ZodObject<{
408
455
  servers: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -476,7 +523,7 @@ export declare const TurnStartSchema: z.ZodObject<{
476
523
  maxOutputTokens: z.ZodNumber;
477
524
  reasoning: z.ZodOptional<z.ZodBoolean>;
478
525
  }, z.core.$strict>>;
479
- environment: z.ZodOptional<z.ZodObject<{
526
+ agent: z.ZodOptional<z.ZodObject<{
480
527
  id: z.ZodString;
481
528
  kind: z.ZodEnum<{
482
529
  none: "none";
@@ -486,6 +533,7 @@ export declare const TurnStartSchema: z.ZodObject<{
486
533
  sandbox: z.ZodOptional<z.ZodObject<{
487
534
  workspace: z.ZodString;
488
535
  }, z.core.$strict>>;
536
+ selfWake: z.ZodOptional<z.ZodBoolean>;
489
537
  }, z.core.$strict>>;
490
538
  }, z.core.$strict>;
491
539
  /**
@@ -584,7 +632,7 @@ export type RequestTypes<Schemas extends RequestSchemas> = {
584
632
  /** Requests a harness sends to core, with their answers. */
585
633
  export declare const harnessRequests: {
586
634
  /**
587
- * `features.workspace` declares that the harness serves the Tenant's workspaces (F6.2):
635
+ * `features.workspace` declares that the harness serves the Tenant's workspaces:
588
636
  * core then sends it the `workspace.*` requests. The answer names the Tenant (its workspace
589
637
  * keys are scoped by it) and the sandbox backend preference the harness selects with.
590
638
  */
@@ -598,7 +646,7 @@ export declare const harnessRequests: {
598
646
  }, z.core.$strict>;
599
647
  }, z.core.$strict>;
600
648
  result: z.ZodObject<{
601
- api: z.ZodLiteral<4>;
649
+ api: z.ZodLiteral<5>;
602
650
  tenantId: z.ZodString;
603
651
  sandbox: z.ZodObject<{
604
652
  backend: z.ZodNullable<z.ZodString>;
@@ -629,6 +677,20 @@ export declare const harnessRequests: {
629
677
  flow: "flow";
630
678
  }>;
631
679
  manifest: z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>;
680
+ definition: z.ZodOptional<z.ZodObject<{
681
+ name: z.ZodString;
682
+ version: z.ZodNumber;
683
+ }, z.core.$strict>>;
684
+ loop: z.ZodOptional<z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>>;
685
+ memory: z.ZodOptional<z.ZodObject<{
686
+ access: z.ZodEnum<{
687
+ read_only: "read_only";
688
+ read_write: "read_write";
689
+ }>;
690
+ instructions: z.ZodOptional<z.ZodString>;
691
+ index: z.ZodString;
692
+ truncated: z.ZodBoolean;
693
+ }, z.core.$strict>>;
632
694
  checkpoint: z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>;
633
695
  mcp: z.ZodOptional<z.ZodObject<{
634
696
  servers: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -702,7 +764,7 @@ export declare const harnessRequests: {
702
764
  maxOutputTokens: z.ZodNumber;
703
765
  reasoning: z.ZodOptional<z.ZodBoolean>;
704
766
  }, z.core.$strict>>;
705
- environment: z.ZodOptional<z.ZodObject<{
767
+ agent: z.ZodOptional<z.ZodObject<{
706
768
  id: z.ZodString;
707
769
  kind: z.ZodEnum<{
708
770
  none: "none";
@@ -712,6 +774,7 @@ export declare const harnessRequests: {
712
774
  sandbox: z.ZodOptional<z.ZodObject<{
713
775
  workspace: z.ZodString;
714
776
  }, z.core.$strict>>;
777
+ selfWake: z.ZodOptional<z.ZodBoolean>;
715
778
  }, z.core.$strict>>;
716
779
  }, z.core.$strict>;
717
780
  }, z.core.$strict>;
@@ -771,6 +834,12 @@ export declare const harnessRequests: {
771
834
  kind: z.ZodLiteral<"sandbox">;
772
835
  }, z.core.$strict>, z.ZodObject<{
773
836
  kind: z.ZodLiteral<"harness">;
837
+ }, z.core.$strict>, z.ZodObject<{
838
+ kind: z.ZodLiteral<"runtime">;
839
+ operation: z.ZodEnum<{
840
+ memory: "memory";
841
+ schedule_wake: "schedule_wake";
842
+ }>;
774
843
  }, z.core.$strict>], "kind">>;
775
844
  skill: z.ZodOptional<z.ZodString>;
776
845
  purpose: z.ZodOptional<z.ZodLiteral<"summary">>;
@@ -898,7 +967,7 @@ export declare const harnessRequests: {
898
967
  }, z.core.$strict>;
899
968
  };
900
969
  /**
901
- * A definition file's bytes, base64 (track R2 M4): one the run's definition names, for the
970
+ * A definition file's bytes, base64: one the run's definition names, for the
902
971
  * skills its sandbox mounts. With `offset` and `length` (at most `turn.start.limits.chunkBytes`,
903
972
  * its default without `length`; more is `limit_exceeded`), only those bytes: fewer than
904
973
  * `length`, none past the end, once the file ends. Without them the whole file, which must then
@@ -1289,7 +1358,7 @@ export declare const harnessRequests: {
1289
1358
  };
1290
1359
  };
1291
1360
  /**
1292
- * Requests core sends to a harness that declared `workspace` (F6.2), with their answers. A
1361
+ * Requests core sends to a harness that declared `workspace`, with their answers. A
1293
1362
  * sandbox tool's answer is its `SandboxToolOutcome`; the harness claims its `environment.*` events
1294
1363
  * while the request is in flight.
1295
1364
  */