@nylorun/core 0.19.0-beta → 0.21.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 (98) hide show
  1. package/CHANGELOG.md +191 -0
  2. package/README.md +2 -2
  3. package/dist/compatibility.d.ts +148 -32
  4. package/dist/compatibility.js +154 -33
  5. package/dist/contracts.d.ts +2714 -495
  6. package/dist/contracts.js +1395 -493
  7. package/dist/define.d.ts +15 -12
  8. package/dist/define.js +11 -7
  9. package/dist/definition/approval.d.ts +16 -0
  10. package/dist/definition/approval.js +33 -0
  11. package/dist/definition/assemble.d.ts +6 -10
  12. package/dist/definition/assemble.js +48 -105
  13. package/dist/definition/bind-agent.d.ts +3 -4
  14. package/dist/definition/bind-agent.js +12 -30
  15. package/dist/definition/binding.d.ts +2 -2
  16. package/dist/definition/bound.d.ts +10 -10
  17. package/dist/definition/builder.d.ts +16 -20
  18. package/dist/definition/builder.js +29 -81
  19. package/dist/definition/code-tools.d.ts +4 -4
  20. package/dist/definition/code-tools.js +7 -22
  21. package/dist/definition/declaration.d.ts +4 -7
  22. package/dist/definition/declaration.js +29 -99
  23. package/dist/definition/{tools-capability.d.ts → deferred-tools.d.ts} +3 -13
  24. package/dist/definition/{tools-capability.js → deferred-tools.js} +2 -18
  25. package/dist/definition/delegate.d.ts +2 -4
  26. package/dist/definition/delegate.js +8 -10
  27. package/dist/definition/flow/compile.js +0 -2
  28. package/dist/definition/from.d.ts +7 -4
  29. package/dist/definition/from.js +72 -117
  30. package/dist/definition/helpers.d.ts +0 -7
  31. package/dist/definition/helpers.js +0 -5
  32. package/dist/definition/http-tool.d.ts +7 -4
  33. package/dist/definition/http-tool.js +6 -10
  34. package/dist/definition/implementations.d.ts +6 -8
  35. package/dist/definition/manifest.d.ts +11 -5
  36. package/dist/definition/manifest.js +27 -26
  37. package/dist/definition/mcp.d.ts +1 -52
  38. package/dist/definition/mcp.js +11 -60
  39. package/dist/definition/media-reference.d.ts +23 -0
  40. package/dist/definition/media-reference.js +26 -0
  41. package/dist/definition/removed.d.ts +3 -10
  42. package/dist/definition/removed.js +10 -17
  43. package/dist/definition/runtime-manifest.d.ts +30 -0
  44. package/dist/definition/runtime-manifest.js +132 -0
  45. package/dist/definition/sandbox-tools.d.ts +1 -1
  46. package/dist/definition/sandbox-tools.js +1 -1
  47. package/dist/definition/skill-tools.d.ts +13 -7
  48. package/dist/definition/skill-tools.js +23 -10
  49. package/dist/definition/trace.d.ts +18 -0
  50. package/dist/definition/trace.js +42 -0
  51. package/dist/definition/variant.d.ts +5 -4
  52. package/dist/definition/variant.js +23 -55
  53. package/dist/definition/workflow/runnable.js +1 -1
  54. package/dist/errors.d.ts +1 -1
  55. package/dist/harness-api/entries.d.ts +242 -0
  56. package/dist/harness-api/entries.js +118 -0
  57. package/dist/harness-api/gates.d.ts +167 -0
  58. package/dist/harness-api/gates.js +117 -0
  59. package/dist/harness-api/harness-api.schema.json +4975 -0
  60. package/dist/harness-api/index.d.ts +19 -3
  61. package/dist/harness-api/index.js +16 -3
  62. package/dist/harness-api/json-schema.d.ts +12 -0
  63. package/dist/harness-api/json-schema.js +61 -0
  64. package/dist/harness-api/mcp.d.ts +57 -0
  65. package/dist/harness-api/mcp.js +39 -0
  66. package/dist/harness-api/messages.d.ts +11 -5
  67. package/dist/harness-api/messages.js +5 -3
  68. package/dist/harness-api/schema.d.ts +346 -36
  69. package/dist/harness-api/schema.js +143 -22
  70. package/dist/harness-api/transport.d.ts +55 -0
  71. package/dist/harness-api/transport.js +61 -0
  72. package/dist/index.d.ts +1 -1
  73. package/dist/manifest-schemas.d.ts +6 -0
  74. package/dist/manifest-schemas.js +34 -0
  75. package/dist/schemas/agent-manifest.schema.json +897 -0
  76. package/dist/schemas/environment-manifest.schema.json +329 -0
  77. package/dist/types/agent.d.ts +1 -1
  78. package/dist/types/manifest.d.ts +48 -28
  79. package/dist/types/model.d.ts +2 -2
  80. package/dist/types/observe.d.ts +8 -20
  81. package/dist/types/part.d.ts +25 -0
  82. package/dist/types/tool.d.ts +1 -1
  83. package/dist/types/transcript.d.ts +5 -0
  84. package/dist/utils/definition-files.d.ts +11 -6
  85. package/dist/utils/definition-files.js +19 -9
  86. package/dist/utils/harness-id.d.ts +9 -0
  87. package/dist/utils/harness-id.js +11 -0
  88. package/dist/utils/runtime-tools.d.ts +19 -0
  89. package/dist/utils/runtime-tools.js +30 -0
  90. package/dist/utils/sandbox.d.ts +1 -1
  91. package/dist/utils/sandbox.js +1 -1
  92. package/package.json +11 -4
  93. package/dist/definition/capability.d.ts +0 -43
  94. package/dist/definition/capability.js +0 -82
  95. package/dist/definition/sandbox-capability.d.ts +0 -44
  96. package/dist/definition/sandbox-capability.js +0 -139
  97. package/dist/types/middleware.d.ts +0 -94
  98. /package/dist/types/{middleware.js → part.js} +0 -0
@@ -1,10 +1,26 @@
1
1
  /**
2
- * `@nylorun/core/harness-api`: the protocol between core and a harness (Harness API v1). Types,
3
- * schemas, the effect request hash, transcript edits and the RPC channel; no engine and no I/O.
2
+ * `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 3).
3
+ * Everything a harness sends or reads has a schema here, and the Runtime validates with the same
4
+ * schemas, so these types are the enforced ones: the frames and messages (`schema.ts`), the
5
+ * transport and the pod join (`transport.ts`), the Model and Tool Gate bodies (`gates.ts`), the
6
+ * MCP snapshot (`mcp.ts`), transcript entries and the effect id rule (`entries.ts`), the effect
7
+ * request hash and transcript edits. No engine and no I/O.
8
+ *
9
+ * Three version numbers apply: the transport (path and header, 1), the messages
10
+ * (`HARNESS_API_VERSION`, 3) and the Runtime protocol, which only the Runtime's own APIs carry.
4
11
  */
5
12
  export * from "./messages.js";
6
13
  export { HarnessApiError } from "./errors.js";
7
14
  export { effectRequestHash, requestIdentity } from "./hash.js";
8
15
  export { CHUNK_BYTES, TranscriptFoldError, applyUpdate, applyUpdates, transcriptOf, transcriptUpdates, withTranscript, type TranscriptUpdate, } from "./transcript.js";
9
16
  export { createChannel, memoryChannels, memoryPorts, type Frame, type HarnessChannel, type MemoryPortsOptions, type MessageListener, type Port, type RequestHandler, } from "./rpc.js";
10
- export { EffectIntentSchema, FrameSchema, TurnOutputSchema, TurnStartSchema, validateFrame, validateMessage, validateParams, validateResult, } from "./schema.js";
17
+ export { EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, NativeToolSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, coreMessages, coreRequests, harnessRequests, validateFrame, validateMessage, validateParams, validateResult, } from "./schema.js";
18
+ export * from "./transport.js";
19
+ export * from "./gates.js";
20
+ export * from "./mcp.js";
21
+ export * from "./entries.js";
22
+ export type { ModelCall, ModelCallTool, ModelCandidate, ModelFailureCode, ModelFailureOutcome, ModelFinishReason, ModelOutputBlock, ModelToolCall, ModelUsage, PromptContentPart, PromptItem, } from "../types/model.js";
23
+ export type { InputEvent, TranscriptEntry } from "../types/transcript.js";
24
+ export type { ToolResult } from "../types/tool.js";
25
+ export { harnessApiJsonSchema, harnessApiSchemas } from "./json-schema.js";
26
+ export { DEFAULT_HARNESS, HARNESS_ID_PATTERN, isHarnessId } from "../utils/harness-id.js";
@@ -1,10 +1,23 @@
1
1
  /**
2
- * `@nylorun/core/harness-api`: the protocol between core and a harness (Harness API v1). Types,
3
- * schemas, the effect request hash, transcript edits and the RPC channel; no engine and no I/O.
2
+ * `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 3).
3
+ * Everything a harness sends or reads has a schema here, and the Runtime validates with the same
4
+ * schemas, so these types are the enforced ones: the frames and messages (`schema.ts`), the
5
+ * transport and the pod join (`transport.ts`), the Model and Tool Gate bodies (`gates.ts`), the
6
+ * MCP snapshot (`mcp.ts`), transcript entries and the effect id rule (`entries.ts`), the effect
7
+ * request hash and transcript edits. No engine and no I/O.
8
+ *
9
+ * Three version numbers apply: the transport (path and header, 1), the messages
10
+ * (`HARNESS_API_VERSION`, 3) and the Runtime protocol, which only the Runtime's own APIs carry.
4
11
  */
5
12
  export * from "./messages.js";
6
13
  export { HarnessApiError } from "./errors.js";
7
14
  export { effectRequestHash, requestIdentity } from "./hash.js";
8
15
  export { CHUNK_BYTES, TranscriptFoldError, applyUpdate, applyUpdates, transcriptOf, transcriptUpdates, withTranscript, } from "./transcript.js";
9
16
  export { createChannel, memoryChannels, memoryPorts, } from "./rpc.js";
10
- export { EffectIntentSchema, FrameSchema, TurnOutputSchema, TurnStartSchema, validateFrame, validateMessage, validateParams, validateResult, } from "./schema.js";
17
+ export { EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, NativeToolSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, coreMessages, coreRequests, harnessRequests, validateFrame, validateMessage, validateParams, validateResult, } from "./schema.js";
18
+ export * from "./transport.js";
19
+ export * from "./gates.js";
20
+ export * from "./mcp.js";
21
+ export * from "./entries.js";
22
+ export { harnessApiJsonSchema, harnessApiSchemas } from "./json-schema.js";
23
+ export { DEFAULT_HARNESS, HARNESS_ID_PATTERN, isHarnessId } from "../utils/harness-id.js";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The Harness API as one JSON Schema document (R4.5, Q4), generated from the same zod schemas the
3
+ * Runtime validates with, so a harness written in another language validates against what core
4
+ * enforces. The build writes it to `dist/harness-api/harness-api.schema.json`
5
+ * (`@nylorun/core/harness-api/schema.json`). `$defs` holds every published schema by name, and
6
+ * each request's params and result as `<method>.params` and `<method>.result`.
7
+ */
8
+ import { z } from "zod";
9
+ /** Every published schema by name, and each request's and message's params and result. */
10
+ export declare function harnessApiSchemas(): Record<string, z.ZodType>;
11
+ /** The JSON Schema document of the Harness API (draft 2020-12). */
12
+ export declare function harnessApiJsonSchema(): Record<string, unknown>;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * The Harness API as one JSON Schema document (R4.5, Q4), generated from the same zod schemas the
3
+ * Runtime validates with, so a harness written in another language validates against what core
4
+ * enforces. The build writes it to `dist/harness-api/harness-api.schema.json`
5
+ * (`@nylorun/core/harness-api/schema.json`). `$defs` holds every published schema by name, and
6
+ * each request's params and result as `<method>.params` and `<method>.result`.
7
+ */
8
+ import { z } from "zod";
9
+ import * as gates from "./gates.js";
10
+ import * as mcp from "./mcp.js";
11
+ import * as entries from "./entries.js";
12
+ import * as transport from "./transport.js";
13
+ import { HARNESS_API_VERSION } from "./messages.js";
14
+ import { EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, NativeToolSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, coreMessages, coreRequests, harnessRequests, } from "./schema.js";
15
+ const named = {
16
+ EffectIntentSchema,
17
+ FrameSchema,
18
+ HarnessCheckpointSchema,
19
+ IntentAnswerSchema,
20
+ NativeToolSchema,
21
+ OutcomeAnswerSchema,
22
+ RecordedOutcomeSchema,
23
+ RunGrantSchema,
24
+ RunRoutingSchema,
25
+ TraceContextSchema,
26
+ TranscriptUpdateSchema,
27
+ TurnOutputSchema,
28
+ TurnStartSchema,
29
+ ...gates,
30
+ ...mcp,
31
+ ...entries,
32
+ ...transport,
33
+ };
34
+ /** Every published schema by name, and each request's and message's params and result. */
35
+ export function harnessApiSchemas() {
36
+ const out = {};
37
+ for (const [name, value] of Object.entries(named))
38
+ if (value instanceof z.ZodType && name.endsWith("Schema"))
39
+ out[name.slice(0, -"Schema".length)] = value;
40
+ for (const [method, { params, result }] of Object.entries({ ...harnessRequests, ...coreRequests })) {
41
+ out[`${method}.params`] = params;
42
+ out[`${method}.result`] = result;
43
+ }
44
+ for (const [method, params] of Object.entries(coreMessages))
45
+ out[`${method}.params`] = params;
46
+ return out;
47
+ }
48
+ /** The JSON Schema document of the Harness API (draft 2020-12). */
49
+ export function harnessApiJsonSchema() {
50
+ const $defs = {};
51
+ for (const [name, schema] of Object.entries(harnessApiSchemas())) {
52
+ const { $schema: _, ...definition } = z.toJSONSchema(schema, { io: "input", unrepresentable: "any" });
53
+ $defs[name] = definition;
54
+ }
55
+ return {
56
+ $schema: "https://json-schema.org/draft/2020-12/schema",
57
+ $id: `https://docs.nylorun.com/schemas/harness-api/v${HARNESS_API_VERSION}.json`,
58
+ title: `Nylorun Harness API ${HARNESS_API_VERSION}`,
59
+ $defs,
60
+ };
61
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * A session's MCP snapshot (R4.5): the tools its remote MCP servers listed, recorded once per
3
+ * session (`session.mcp`, the first recorded wins) and handed to every run in
4
+ * `TurnStart.routing.mcpSnapshot`. A harness offers the model exactly these tools (those not
5
+ * `deferred`) and calls one through the Tool Gate by its server and `serverToolName`.
6
+ */
7
+ import { z } from "zod";
8
+ export declare const McpToolRecordSchema: z.ZodObject<{
9
+ agentId: z.ZodOptional<z.ZodString>;
10
+ serverName: z.ZodString;
11
+ serverToolName: z.ZodString;
12
+ name: z.ZodString;
13
+ description: z.ZodOptional<z.ZodString>;
14
+ inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
15
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
16
+ annotations: z.ZodOptional<z.ZodObject<{
17
+ readOnlyHint: z.ZodOptional<z.ZodBoolean>;
18
+ idempotentHint: z.ZodOptional<z.ZodBoolean>;
19
+ }, z.core.$strip>>;
20
+ deferred: z.ZodOptional<z.ZodLiteral<true>>;
21
+ }, z.core.$strip>;
22
+ /** A server's own instructions (MCP `initialize`), for the note on its deferred tools. */
23
+ export declare const McpServerNoteSchema: z.ZodObject<{
24
+ agentId: z.ZodOptional<z.ZodString>;
25
+ serverName: z.ZodString;
26
+ instructions: z.ZodString;
27
+ }, z.core.$strip>;
28
+ export declare const McpSnapshotSchema: z.ZodObject<{
29
+ snapshotSchemaVersion: z.ZodLiteral<1>;
30
+ manifestHash: z.ZodString;
31
+ mcpTools: z.ZodReadonly<z.ZodArray<z.ZodObject<{
32
+ agentId: z.ZodOptional<z.ZodString>;
33
+ serverName: z.ZodString;
34
+ serverToolName: z.ZodString;
35
+ name: z.ZodString;
36
+ description: z.ZodOptional<z.ZodString>;
37
+ inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
38
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
39
+ annotations: z.ZodOptional<z.ZodObject<{
40
+ readOnlyHint: z.ZodOptional<z.ZodBoolean>;
41
+ idempotentHint: z.ZodOptional<z.ZodBoolean>;
42
+ }, z.core.$strip>>;
43
+ deferred: z.ZodOptional<z.ZodLiteral<true>>;
44
+ }, z.core.$strip>>>;
45
+ servers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
46
+ agentId: z.ZodOptional<z.ZodString>;
47
+ serverName: z.ZodString;
48
+ instructions: z.ZodString;
49
+ }, z.core.$strip>>>>;
50
+ }, z.core.$strip>;
51
+ type DeepReadonly<T> = T extends readonly (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? {
52
+ readonly [K in keyof T]: DeepReadonly<T[K]>;
53
+ } : T;
54
+ export type McpToolRecord = DeepReadonly<z.infer<typeof McpToolRecordSchema>>;
55
+ export type McpServerNote = DeepReadonly<z.infer<typeof McpServerNoteSchema>>;
56
+ export type McpSnapshot = DeepReadonly<z.infer<typeof McpSnapshotSchema>>;
57
+ export {};
@@ -0,0 +1,39 @@
1
+ /**
2
+ * A session's MCP snapshot (R4.5): the tools its remote MCP servers listed, recorded once per
3
+ * session (`session.mcp`, the first recorded wins) and handed to every run in
4
+ * `TurnStart.routing.mcpSnapshot`. A harness offers the model exactly these tools (those not
5
+ * `deferred`) and calls one through the Tool Gate by its server and `serverToolName`.
6
+ */
7
+ import { z } from "zod";
8
+ const jsonObject = z.record(z.string(), z.unknown());
9
+ export const McpToolRecordSchema = z.object({
10
+ /** The agent used as a tool that declares the server; absent for the session's root agent. */
11
+ agentId: z.string().optional(),
12
+ serverName: z.string(),
13
+ /** The tool's name on its server, which the call sends. */
14
+ serverToolName: z.string(),
15
+ /** The name the model knows it by. */
16
+ name: z.string(),
17
+ description: z.string().optional(),
18
+ inputSchema: jsonObject,
19
+ outputSchema: jsonObject.optional(),
20
+ /** The server's hints that calling the tool again is safe. */
21
+ annotations: z
22
+ .object({ readOnlyHint: z.boolean().optional(), idempotentHint: z.boolean().optional() })
23
+ .optional(),
24
+ /** Out of the model's tool list for the session's life; found through the deferred-tools tool. */
25
+ deferred: z.literal(true).optional(),
26
+ });
27
+ /** A server's own instructions (MCP `initialize`), for the note on its deferred tools. */
28
+ export const McpServerNoteSchema = z.object({
29
+ agentId: z.string().optional(),
30
+ serverName: z.string(),
31
+ instructions: z.string(),
32
+ });
33
+ export const McpSnapshotSchema = z.object({
34
+ snapshotSchemaVersion: z.literal(1),
35
+ manifestHash: z.string(),
36
+ mcpTools: z.array(McpToolRecordSchema).readonly(),
37
+ /** The servers that gave instructions; absent when none did. */
38
+ servers: z.array(McpServerNoteSchema).readonly().optional(),
39
+ });
@@ -7,8 +7,10 @@
7
7
  * (`schema.ts`), which a socket validates it with.
8
8
  */
9
9
  import type { z } from "zod";
10
- import type { EffectIntentSchema, IntentAnswerSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, ReleaseReasonSchema, RequestTypes, RunGrantSchema, RunRoutingSchema, TurnOutputSchema, TurnStartSchema, WorkspaceBytesCallSchema, WorkspaceCallSchema, WorkspaceListCallSchema, WorkspaceRecordSchema, WorkspaceSessionSchema, coreMessages, coreRequests, harnessRequests } from "./schema.js";
11
- export declare const HARNESS_API_VERSION = 2;
10
+ import type { EffectIntentSchema, IntentAnswerSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, ReleaseReasonSchema, RequestTypes, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TurnOutputSchema, TurnStartSchema, WorkspaceBytesCallSchema, WorkspaceCallSchema, WorkspaceListCallSchema, WorkspaceDiskCallSchema, WorkspaceRecordSchema, WorkspaceSessionSchema, coreMessages, coreRequests, harnessRequests } from "./schema.js";
11
+ export declare const HARNESS_API_VERSION = 3;
12
+ /** The most state a custom harness may keep per session (R4.2): its serialized JSON, in bytes. */
13
+ export declare const MAX_HARNESS_STATE_BYTES: number;
12
14
  /** Why core stopped a run. Matches the advance's abort kinds. */
13
15
  export declare const ABORT_REASONS: readonly ["cancel", "shutdown", "deadline", "ownership.lost"];
14
16
  export type AbortReason = (typeof ABORT_REASONS)[number];
@@ -16,9 +18,9 @@ export type AbortReason = (typeof ABORT_REASONS)[number];
16
18
  export type ReleaseReason = z.infer<typeof ReleaseReasonSchema>;
17
19
  /**
18
20
  * Events a harness may claim: for a run it holds, or for a workspace request core sent it. A
19
- * `sandbox.state` claim carries the workspace's compute record, which core keeps.
21
+ * `environment.state` claim carries the workspace's compute record, which core keeps.
20
22
  */
21
- export declare const HARNESS_CLAIMS: readonly ["sandbox.state", "sandbox.exec"];
23
+ export declare const HARNESS_CLAIMS: readonly ["environment.state", "environment.exec"];
22
24
  export type HarnessClaim = (typeof HARNESS_CLAIMS)[number];
23
25
  export declare const HARNESS_ERROR_CODES: readonly ["run_not_held", "turn_cancelled", "ownership_lost", "effect_drift", "invalid", "unavailable", "internal"];
24
26
  export type HarnessErrorCode = (typeof HARNESS_ERROR_CODES)[number];
@@ -30,6 +32,8 @@ export type RecordedOutcome = z.infer<typeof RecordedOutcomeSchema>;
30
32
  export type RunGrant = z.infer<typeof RunGrantSchema>;
31
33
  /** Where a harness sends the session's tool calls. */
32
34
  export type RunRouting = z.infer<typeof RunRoutingSchema>;
35
+ /** W3C trace context a turn carries (R4.10). */
36
+ export type TraceContext = z.infer<typeof TraceContextSchema>;
33
37
  /** What a run starts from: `turn.start` (message, continue, resume) or `approval.answer`. */
34
38
  export type TurnStart = z.infer<typeof TurnStartSchema>;
35
39
  /**
@@ -44,7 +48,7 @@ export type IntentAnswer = z.infer<typeof IntentAnswerSchema>;
44
48
  export type OutcomeAnswer = z.infer<typeof OutcomeAnswerSchema>;
45
49
  /** Requests a harness sends to core, with their answers. */
46
50
  export type HarnessRequests = RequestTypes<typeof harnessRequests>;
47
- /** The session a workspace request acts for: the workspace's owner and its sandbox resource. */
51
+ /** The session a workspace request acts for, and the Environment whose workspace it is. */
48
52
  export type WorkspaceSession = z.infer<typeof WorkspaceSessionSchema>;
49
53
  /** A workspace's compute record, as the harness keeps it. */
50
54
  export type WorkspaceRecord = z.infer<typeof WorkspaceRecordSchema>;
@@ -54,6 +58,8 @@ export type WorkspaceCall = z.infer<typeof WorkspaceCallSchema>;
54
58
  export type WorkspaceBytesCall = z.infer<typeof WorkspaceBytesCallSchema>;
55
59
  /** The regular files under a directory of a workspace (the turn-end export, F8.2). */
56
60
  export type WorkspaceListCall = z.infer<typeof WorkspaceListCallSchema>;
61
+ /** One operation on a workspace's disk (R2d step 3). */
62
+ export type WorkspaceDiskCall = z.infer<typeof WorkspaceDiskCallSchema>;
57
63
  /** Requests core sends to a harness that declared `workspace` (F6.2), with their answers. */
58
64
  export type CoreRequests = RequestTypes<typeof coreRequests>;
59
65
  /** Messages core sends to a harness, without an answer. */
@@ -1,11 +1,13 @@
1
- export const HARNESS_API_VERSION = 2;
1
+ export const HARNESS_API_VERSION = 3;
2
+ /** The most state a custom harness may keep per session (R4.2): its serialized JSON, in bytes. */
3
+ export const MAX_HARNESS_STATE_BYTES = 256 * 1024;
2
4
  /** Why core stopped a run. Matches the advance's abort kinds. */
3
5
  export const ABORT_REASONS = ["cancel", "shutdown", "deadline", "ownership.lost"];
4
6
  /**
5
7
  * Events a harness may claim: for a run it holds, or for a workspace request core sent it. A
6
- * `sandbox.state` claim carries the workspace's compute record, which core keeps.
8
+ * `environment.state` claim carries the workspace's compute record, which core keeps.
7
9
  */
8
- export const HARNESS_CLAIMS = ["sandbox.state", "sandbox.exec"];
10
+ export const HARNESS_CLAIMS = ["environment.state", "environment.exec"];
9
11
  export const HARNESS_ERROR_CODES = [
10
12
  "run_not_held",
11
13
  "turn_cancelled",