@nylorun/core 0.22.0-beta → 0.23.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 (73) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/README.md +1 -1
  3. package/dist/compatibility.d.ts +32 -16
  4. package/dist/compatibility.js +33 -17
  5. package/dist/contracts.d.ts +531 -88
  6. package/dist/contracts.js +297 -199
  7. package/dist/define.d.ts +8 -12
  8. package/dist/define.js +7 -11
  9. package/dist/definition/assemble.d.ts +1 -3
  10. package/dist/definition/assemble.js +4 -8
  11. package/dist/definition/bound.d.ts +1 -1
  12. package/dist/definition/delegate.d.ts +5 -0
  13. package/dist/definition/delegate.js +6 -1
  14. package/dist/definition/from.d.ts +4 -2
  15. package/dist/definition/from.js +11 -29
  16. package/dist/definition/http-tool.d.ts +5 -3
  17. package/dist/definition/http-tool.js +8 -5
  18. package/dist/definition/manifest.d.ts +7 -6
  19. package/dist/definition/manifest.js +7 -6
  20. package/dist/definition/mcp.d.ts +1 -1
  21. package/dist/definition/media-reference.d.ts +2 -11
  22. package/dist/definition/media-reference.js +0 -12
  23. package/dist/definition/model-failure.js +1 -0
  24. package/dist/definition/removed.js +1 -0
  25. package/dist/definition/trace.d.ts +0 -7
  26. package/dist/definition/trace.js +0 -34
  27. package/dist/definition/variant.d.ts +1 -1
  28. package/dist/definition/variant.js +1 -3
  29. package/dist/harness-api/artifacts.d.ts +84 -0
  30. package/dist/harness-api/artifacts.js +128 -0
  31. package/dist/harness-api/gates.d.ts +0 -4
  32. package/dist/harness-api/gates.js +0 -4
  33. package/dist/harness-api/harness-api.schema.json +2422 -924
  34. package/dist/harness-api/index.d.ts +9 -6
  35. package/dist/harness-api/index.js +9 -6
  36. package/dist/harness-api/json-schema.js +5 -2
  37. package/dist/harness-api/mcp.d.ts +77 -30
  38. package/dist/harness-api/mcp.js +42 -25
  39. package/dist/harness-api/messages.d.ts +45 -17
  40. package/dist/harness-api/messages.js +20 -5
  41. package/dist/harness-api/schema.d.ts +538 -198
  42. package/dist/harness-api/schema.js +298 -59
  43. package/dist/harness-api/transcript.d.ts +8 -10
  44. package/dist/harness-api/transcript.js +27 -11
  45. package/dist/harness-api/transport.d.ts +7 -1
  46. package/dist/harness-api/transport.js +10 -7
  47. package/dist/schemas/agent-manifest.schema.json +5 -146
  48. package/dist/schemas/environment-manifest.schema.json +56 -16
  49. package/dist/types/manifest.d.ts +3 -13
  50. package/dist/types/model.d.ts +10 -5
  51. package/dist/utils/definition-files.d.ts +20 -6
  52. package/dist/utils/definition-files.js +31 -17
  53. package/dist/utils/file-systems.d.ts +20 -0
  54. package/dist/utils/file-systems.js +20 -0
  55. package/dist/utils/harness-id.d.ts +4 -1
  56. package/dist/utils/harness-id.js +4 -1
  57. package/dist/utils/media-types.d.ts +30 -0
  58. package/dist/utils/media-types.js +128 -0
  59. package/dist/utils/runtime-limits.d.ts +229 -0
  60. package/dist/utils/runtime-limits.js +482 -0
  61. package/dist/utils/runtime-tools.d.ts +8 -16
  62. package/dist/utils/runtime-tools.js +8 -27
  63. package/dist/utils/sandbox.d.ts +4 -1
  64. package/dist/utils/sandbox.js +4 -1
  65. package/package.json +1 -1
  66. package/dist/definition/deferred-tools.d.ts +0 -27
  67. package/dist/definition/deferred-tools.js +0 -82
  68. package/dist/definition/runtime-manifest.d.ts +0 -30
  69. package/dist/definition/runtime-manifest.js +0 -132
  70. package/dist/definition/sandbox-tools.d.ts +0 -5
  71. package/dist/definition/sandbox-tools.js +0 -109
  72. package/dist/definition/skill-tools.d.ts +0 -23
  73. package/dist/definition/skill-tools.js +0 -76
@@ -95,7 +95,7 @@
95
95
  "timeoutMs": {
96
96
  "type": "integer",
97
97
  "exclusiveMinimum": 0,
98
- "maximum": 300000
98
+ "maximum": 2147483647
99
99
  }
100
100
  },
101
101
  "required": [
@@ -293,151 +293,10 @@
293
293
  ]
294
294
  },
295
295
  "secrets": {
296
- "maxItems": 64,
297
296
  "type": "array",
298
297
  "items": {
299
298
  "type": "string",
300
- "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$"
301
- }
302
- }
303
- },
304
- "additionalProperties": false
305
- },
306
- "runtime": {
307
- "type": "object",
308
- "properties": {
309
- "sandbox": {
310
- "type": "object",
311
- "properties": {
312
- "image": {
313
- "type": "string",
314
- "minLength": 1
315
- },
316
- "network": {
317
- "type": "object",
318
- "properties": {
319
- "preset": {
320
- "type": "string",
321
- "enum": [
322
- "none",
323
- "dev",
324
- "open"
325
- ]
326
- },
327
- "allow": {
328
- "type": "array",
329
- "items": {
330
- "type": "string"
331
- }
332
- }
333
- },
334
- "additionalProperties": false
335
- },
336
- "resources": {
337
- "type": "object",
338
- "properties": {
339
- "cpus": {
340
- "type": "integer",
341
- "minimum": 1,
342
- "maximum": 64
343
- },
344
- "memory": {
345
- "type": "string"
346
- }
347
- },
348
- "additionalProperties": false
349
- },
350
- "idle": {
351
- "type": "string"
352
- }
353
- },
354
- "additionalProperties": false
355
- },
356
- "tools": {
357
- "type": "array",
358
- "items": {
359
- "type": "object",
360
- "properties": {
361
- "name": {
362
- "type": "string",
363
- "pattern": "^[A-Za-z0-9_-]{1,64}$"
364
- },
365
- "description": {
366
- "type": "string"
367
- },
368
- "inputSchema": {
369
- "type": "object",
370
- "propertyNames": {
371
- "type": "string"
372
- },
373
- "additionalProperties": {}
374
- },
375
- "outputSchema": {
376
- "type": "object",
377
- "propertyNames": {
378
- "type": "string"
379
- },
380
- "additionalProperties": {}
381
- },
382
- "agent": {
383
- "$ref": "#/$defs/ToolAgentManifest"
384
- },
385
- "http": {
386
- "type": "object",
387
- "properties": {
388
- "url": {
389
- "type": "string"
390
- },
391
- "method": {
392
- "type": "string",
393
- "enum": [
394
- "GET",
395
- "POST",
396
- "PUT",
397
- "PATCH",
398
- "DELETE"
399
- ]
400
- },
401
- "credential": {
402
- "type": "string",
403
- "minLength": 1
404
- },
405
- "timeoutMs": {
406
- "type": "integer",
407
- "exclusiveMinimum": 0,
408
- "maximum": 300000
409
- }
410
- },
411
- "required": [
412
- "url"
413
- ],
414
- "additionalProperties": false
415
- },
416
- "approval": {
417
- "type": "string",
418
- "enum": [
419
- "never",
420
- "always"
421
- ]
422
- },
423
- "fn": {
424
- "description": "Reserved for a later kind of tool; refused for now."
425
- },
426
- "command": {
427
- "description": "Reserved for a later kind of tool; refused for now."
428
- }
429
- },
430
- "required": [
431
- "name",
432
- "inputSchema"
433
- ],
434
- "additionalProperties": false
435
- }
436
- },
437
- "instructions": {
438
- "type": "array",
439
- "items": {
440
- "type": "string"
299
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
441
300
  }
442
301
  }
443
302
  },
@@ -539,7 +398,7 @@
539
398
  "cpus": {
540
399
  "type": "integer",
541
400
  "minimum": 1,
542
- "maximum": 64
401
+ "maximum": 9007199254740991
543
402
  },
544
403
  "memory": {
545
404
  "type": "string"
@@ -652,7 +511,7 @@
652
511
  "timeoutMs": {
653
512
  "type": "integer",
654
513
  "exclusiveMinimum": 0,
655
- "maximum": 300000
514
+ "maximum": 2147483647
656
515
  }
657
516
  },
658
517
  "required": [
@@ -844,7 +703,7 @@
844
703
  "timeoutMs": {
845
704
  "type": "integer",
846
705
  "exclusiveMinimum": 0,
847
- "maximum": 300000
706
+ "maximum": 2147483647
848
707
  }
849
708
  },
850
709
  "required": [
@@ -17,8 +17,7 @@
17
17
  "description": "An environment manifest's name, such as `analyst-box`"
18
18
  },
19
19
  "description": {
20
- "type": "string",
21
- "maxLength": 1024
20
+ "type": "string"
22
21
  },
23
22
  "kind": {
24
23
  "type": "string",
@@ -38,7 +37,7 @@
38
37
  "cpus": {
39
38
  "type": "integer",
40
39
  "minimum": 1,
41
- "maximum": 64
40
+ "maximum": 9007199254740991
42
41
  },
43
42
  "memory": {
44
43
  "type": "string"
@@ -78,15 +77,13 @@
78
77
  "additionalProperties": false
79
78
  },
80
79
  "setup": {
81
- "maxItems": 16,
82
80
  "type": "array",
83
81
  "items": {
84
82
  "type": "object",
85
83
  "properties": {
86
84
  "command": {
87
85
  "type": "string",
88
- "minLength": 1,
89
- "maxLength": 4096
86
+ "minLength": 1
90
87
  },
91
88
  "cwd": {
92
89
  "type": "string",
@@ -104,7 +101,6 @@
104
101
  }
105
102
  },
106
103
  "files": {
107
- "maxItems": 16,
108
104
  "type": "array",
109
105
  "items": {
110
106
  "anyOf": [
@@ -181,6 +177,55 @@
181
177
  ]
182
178
  }
183
179
  },
180
+ "limits": {
181
+ "type": "object",
182
+ "properties": {
183
+ "artifacts": {
184
+ "type": "object",
185
+ "properties": {
186
+ "fileBytes": {
187
+ "type": "integer",
188
+ "exclusiveMinimum": 0,
189
+ "maximum": 9007199254740991
190
+ },
191
+ "totalBytes": {
192
+ "type": "integer",
193
+ "exclusiveMinimum": 0,
194
+ "maximum": 9007199254740991
195
+ }
196
+ },
197
+ "additionalProperties": false
198
+ },
199
+ "skills": {
200
+ "type": "object",
201
+ "properties": {
202
+ "totalBytes": {
203
+ "type": "integer",
204
+ "exclusiveMinimum": 0,
205
+ "maximum": 9007199254740991
206
+ }
207
+ },
208
+ "additionalProperties": false
209
+ },
210
+ "disk": {
211
+ "type": "object",
212
+ "properties": {
213
+ "versionBytes": {
214
+ "type": "integer",
215
+ "exclusiveMinimum": 0,
216
+ "maximum": 9007199254740991
217
+ },
218
+ "versionEntries": {
219
+ "type": "integer",
220
+ "exclusiveMinimum": 0,
221
+ "maximum": 9007199254740991
222
+ }
223
+ },
224
+ "additionalProperties": false
225
+ }
226
+ },
227
+ "additionalProperties": false
228
+ },
184
229
  "secrets": {
185
230
  "type": "object",
186
231
  "propertyNames": {
@@ -197,7 +242,6 @@
197
242
  },
198
243
  "allowedHosts": {
199
244
  "minItems": 1,
200
- "maxItems": 32,
201
245
  "type": "array",
202
246
  "items": {
203
247
  "type": "string"
@@ -225,8 +269,7 @@
225
269
  "type": "boolean"
226
270
  },
227
271
  "description": {
228
- "type": "string",
229
- "maxLength": 500
272
+ "type": "string"
230
273
  }
231
274
  },
232
275
  "required": [
@@ -246,8 +289,7 @@
246
289
  "type": "boolean"
247
290
  },
248
291
  "description": {
249
- "type": "string",
250
- "maxLength": 500
292
+ "type": "string"
251
293
  }
252
294
  },
253
295
  "required": [
@@ -286,8 +328,7 @@
286
328
  "type": "boolean"
287
329
  },
288
330
  "description": {
289
- "type": "string",
290
- "maxLength": 500
331
+ "type": "string"
291
332
  }
292
333
  },
293
334
  "required": [
@@ -327,8 +368,7 @@
327
368
  "type": "boolean"
328
369
  },
329
370
  "description": {
330
- "type": "string",
331
- "maxLength": 500
371
+ "type": "string"
332
372
  }
333
373
  },
334
374
  "required": [
@@ -88,8 +88,9 @@ export interface McpToolSettings {
88
88
  readonly approval?: ApprovalMode;
89
89
  /**
90
90
  * `true`: the tool leaves the model's tool list; the model finds it with `tool_search` and runs
91
- * it with `tool_call` (R2b C10). Default: the server's `deferred`, else deferred when the
92
- * agent's MCP tools would take more than a tenth of the model's context window.
91
+ * it with `tool_call` (R2b C10). A hint the harness reads (`turn.start.mcp`): Nylorun's engine
92
+ * follows it, and without one defers when the agent's MCP tools would take more than a tenth of
93
+ * the model's context window.
93
94
  */
94
95
  readonly deferred?: boolean;
95
96
  }
@@ -139,16 +140,6 @@ export interface SandboxManifest {
139
140
  /** Stop compute after this long without use, e.g. "15m". Files persist. */
140
141
  readonly idle?: string;
141
142
  }
142
- /**
143
- * What the Runtime adds to a session's agent when it pins it: the session's sandbox, the tools the
144
- * Runtime serves (the sandbox tools, the artifact tools, the skill tools) and the text that goes
145
- * with them. Only the Runtime writes it; a definition or a turn variant that sets it is refused.
146
- */
147
- export interface RuntimeManifest {
148
- readonly sandbox?: SandboxManifest;
149
- readonly tools?: readonly ToolManifest[];
150
- readonly instructions?: readonly string[];
151
- }
152
143
  export interface AgentManifest {
153
144
  readonly manifestSchemaVersion: ManifestSchemaVersion;
154
145
  readonly id: string;
@@ -162,7 +153,6 @@ export interface AgentManifest {
162
153
  readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
163
154
  /** What the agent needs of its session's Environment, checked when a session opens (D65). */
164
155
  readonly requires?: AgentRequirements;
165
- readonly runtime?: RuntimeManifest;
166
156
  }
167
157
  /** What an agent needs of the Environment its session opens on (protocol 14, D65). */
168
158
  export interface AgentRequirements {
@@ -50,6 +50,11 @@ export interface ModelCandidate {
50
50
  }
51
51
  /** Why a model call failed in a known way (Model Calls §6.1). */
52
52
  export type ModelFailureCode = "context_overflow" | "rate_limited" | "overloaded" | "timeout" | "transient" | "content_policy" | "auth" | "invalid_request" | "invalid_output"
53
+ /**
54
+ * The call holds a part the model or its provider API cannot take (protocol 15): a file kind
55
+ * the model does not read, or a text file sent as a media part. Nothing was sent; never retried.
56
+ */
57
+ | "unsupported_input"
53
58
  /** A model budget's cap is reached (`PUT /v1/tenant/budgets`); never retried. */
54
59
  | "budget_exhausted";
55
60
  /**
@@ -191,21 +196,21 @@ export interface ModelCall {
191
196
  readonly model?: ModelDirective;
192
197
  readonly prompt: readonly PromptItem[];
193
198
  readonly tools: readonly ModelCallTool[];
194
- /** Optional portable contract for this turn's terminal JSON result. */
195
- readonly outputSchema?: JsonObject;
196
199
  readonly executionId: string;
197
200
  }
198
201
  export interface ModelAdapterContext {
199
202
  readonly request: ModelRequest;
200
203
  readonly invocationId: string;
201
204
  readonly signal: AbortSignal;
202
- /** Set when the engine calls the model to summarize history (Model Calls §8). */
205
+ /**
206
+ * Set when the engine calls the model to summarize history (Model Calls §8). Engine-internal:
207
+ * the call's effect says `purpose: "summary"`, and the compaction's facts go with its
208
+ * transcript edit.
209
+ */
203
210
  readonly compaction?: {
204
211
  readonly trigger: "threshold" | "overflow";
205
212
  readonly tokensBefore: number;
206
213
  readonly keptTokens: number;
207
- /** An intermediate call of a chunked summary; only the last one completes the compaction. */
208
- readonly partial?: boolean;
209
214
  };
210
215
  /** Publishes one JSON-safe provider request derived from the canonical ModelCall. */
211
216
  reportPreparedCall(prepared: ModelPreparedCall): void;
@@ -1,13 +1,19 @@
1
- /** The largest definition file the Runtime stores. */
2
- export declare const DEFINITION_FILE_MAX_BYTES: number;
3
- /** The most files one skill may have. */
4
- export declare const SKILL_FILES_MAX = 500;
5
- /** The longest path of a file in a skill's folder. */
6
- export declare const SKILL_FILE_PATH_MAX = 512;
1
+ /**
2
+ * The most bytes one skill's files may hold together when the Tenant sets no limit of its own
3
+ * (2 GiB, Tenant setting `skills.config`); an Environment's manifest may set a lower one. No file
4
+ * and no count of files has a limit of its own.
5
+ */
6
+ export declare const SKILL_TOTAL_BYTES_DEFAULT: number;
7
7
  /** The file every skill has: its frontmatter and instructions. */
8
8
  export declare const SKILL_ENTRY = "SKILL.md";
9
9
  /** Where a session's sandbox holds each skill's files, read-only: `/skills/<name>@<hash>/`. */
10
10
  export declare const SKILLS_MOUNT = "/skills";
11
+ /**
12
+ * The longest path of a file in a skill's folder: what the longest path a workspace's file
13
+ * system takes (`FILE_PATH_MAX`) leaves under the skill's mount folder, `/skills/<name>@<12 hex>/`
14
+ * with a name as long as a file name may be.
15
+ */
16
+ export declare const SKILL_FILE_PATH_MAX: number;
11
17
  /**
12
18
  * The folder of a sandbox that holds one version of a skill, read-only (D66):
13
19
  * `/skills/<name>@<12 hex>`, the hex from the SHA-256 of its canonical file map. A version keeps
@@ -29,6 +35,14 @@ export declare function skillFilesIssue(files: unknown): string | undefined;
29
35
  * agents it uses as tools, and those of a flow's agents, as `sha256:<hex>`.
30
36
  */
31
37
  export declare function definitionFilesOf(document: unknown, into?: Set<string>): Set<string>;
38
+ /**
39
+ * Every skill a definition document carries, as written: its agents' skills, those of the agents
40
+ * it uses as tools, and those of a flow's agents. A skill two agents carry comes once for each.
41
+ */
42
+ export declare function skillsOf(document: unknown): Generator<{
43
+ readonly name?: unknown;
44
+ readonly files?: Readonly<Record<string, unknown>>;
45
+ }>;
32
46
  /**
33
47
  * A `SKILL.md`'s instructions: the text after its YAML frontmatter (`---` lines), without the
34
48
  * blank line that follows it. Text without frontmatter is returned whole.
@@ -6,16 +6,23 @@
6
6
  import { sha256 } from "@noble/hashes/sha2.js";
7
7
  import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
8
8
  import { canonical } from "./canonical.js";
9
- /** The largest definition file the Runtime stores. */
10
- export const DEFINITION_FILE_MAX_BYTES = 10 * 1024 * 1024;
11
- /** The most files one skill may have. */
12
- export const SKILL_FILES_MAX = 500;
13
- /** The longest path of a file in a skill's folder. */
14
- export const SKILL_FILE_PATH_MAX = 512;
9
+ import { FILE_NAME_MAX, FILE_PATH_MAX } from "./file-systems.js";
10
+ /**
11
+ * The most bytes one skill's files may hold together when the Tenant sets no limit of its own
12
+ * (2 GiB, Tenant setting `skills.config`); an Environment's manifest may set a lower one. No file
13
+ * and no count of files has a limit of its own.
14
+ */
15
+ export const SKILL_TOTAL_BYTES_DEFAULT = 2 * 1024 * 1024 * 1024;
15
16
  /** The file every skill has: its frontmatter and instructions. */
16
17
  export const SKILL_ENTRY = "SKILL.md";
17
18
  /** Where a session's sandbox holds each skill's files, read-only: `/skills/<name>@<hash>/`. */
18
19
  export const SKILLS_MOUNT = "/skills";
20
+ /**
21
+ * The longest path of a file in a skill's folder: what the longest path a workspace's file
22
+ * system takes (`FILE_PATH_MAX`) leaves under the skill's mount folder, `/skills/<name>@<12 hex>/`
23
+ * with a name as long as a file name may be.
24
+ */
25
+ export const SKILL_FILE_PATH_MAX = FILE_PATH_MAX - `${SKILLS_MOUNT}/${"n".repeat(FILE_NAME_MAX)}@${"0".repeat(12)}/`.length;
19
26
  /**
20
27
  * The folder of a sandbox that holds one version of a skill, read-only (D66):
21
28
  * `/skills/<name>@<12 hex>`, the hex from the SHA-256 of its canonical file map. A version keeps
@@ -50,14 +57,12 @@ export function skillFilesIssue(files) {
50
57
  if (!files || typeof files !== "object" || Array.isArray(files))
51
58
  return `files must map each path in the skill's folder to sha256:<hex>`;
52
59
  const entries = Object.entries(files);
53
- if (entries.length > SKILL_FILES_MAX)
54
- return `has ${entries.length} files; a skill may have at most ${SKILL_FILES_MAX}`;
55
60
  if (!(SKILL_ENTRY in files))
56
61
  return `files must include ${SKILL_ENTRY}`;
57
62
  for (const [path, hash] of entries) {
58
63
  const issue = skillFilePathIssue(path);
59
64
  if (issue)
60
- return `file path ${JSON.stringify(path.slice(0, 80))} ${issue}`;
65
+ return `file path ${JSON.stringify(path.slice(0, FILE_PATH_MAX))} ${issue}`;
61
66
  if (!isDefinitionFileHash(hash))
62
67
  return `file ${JSON.stringify(path)} must name its content as sha256:<64 lowercase hex>`;
63
68
  }
@@ -68,21 +73,30 @@ export function skillFilesIssue(files) {
68
73
  * agents it uses as tools, and those of a flow's agents, as `sha256:<hex>`.
69
74
  */
70
75
  export function definitionFilesOf(document, into = new Set()) {
76
+ for (const skill of skillsOf(document))
77
+ for (const hash of Object.values(skill.files ?? {}))
78
+ if (isDefinitionFileHash(hash))
79
+ into.add(hash);
80
+ return into;
81
+ }
82
+ /**
83
+ * Every skill a definition document carries, as written: its agents' skills, those of the agents
84
+ * it uses as tools, and those of a flow's agents. A skill two agents carry comes once for each.
85
+ */
86
+ export function* skillsOf(document) {
71
87
  if (!document || typeof document !== "object")
72
- return into;
88
+ return;
73
89
  const value = document;
74
90
  if (value.kind === "workflow") {
75
91
  for (const agent of Object.values(value.agents ?? {}))
76
- definitionFilesOf(agent, into);
77
- return into;
92
+ yield* skillsOf(agent);
93
+ return;
78
94
  }
79
95
  for (const skill of Object.values(value.skills ?? {}))
80
- for (const hash of Object.values(skill?.files ?? {}))
81
- if (isDefinitionFileHash(hash))
82
- into.add(hash);
96
+ if (skill)
97
+ yield skill;
83
98
  for (const tool of value.tools ?? [])
84
- definitionFilesOf(tool.agent, into);
85
- return into;
99
+ yield* skillsOf(tool.agent);
86
100
  }
87
101
  /**
88
102
  * A `SKILL.md`'s instructions: the text after its YAML frontmatter (`---` lines), without the
@@ -0,0 +1,20 @@
1
+ /**
2
+ * What the file systems a workspace lives on take (B15: constants fixed by a standard, not
3
+ * limits): artifact names and folder paths are written as file names and paths there, when an
4
+ * artifact is copied into a sandbox, a folder unpacked, a skill mounted or a file downloaded.
5
+ */
6
+ /**
7
+ * The longest file name: `NAME_MAX`, 255 on ext4, XFS, APFS and NTFS (POSIX `<limits.h>`).
8
+ */
9
+ export declare const FILE_NAME_MAX = 255;
10
+ /**
11
+ * The longest path: `PATH_MAX` of macOS (1024, `<sys/syslimits.h>`), where a local Runtime's
12
+ * virtual workspace lives, and the smallest of the systems a workspace lives on (Linux's is
13
+ * 4096).
14
+ */
15
+ export declare const FILE_PATH_MAX = 1024;
16
+ /**
17
+ * The longest target a symbolic link of a folder artifact may name: Linux's `PATH_MAX` (4096,
18
+ * `<linux/limits.h>`), the most `symlink(2)` stores, since a sandbox's disk is a Linux file system.
19
+ */
20
+ export declare const LINK_TARGET_MAX = 4096;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * What the file systems a workspace lives on take (B15: constants fixed by a standard, not
3
+ * limits): artifact names and folder paths are written as file names and paths there, when an
4
+ * artifact is copied into a sandbox, a folder unpacked, a skill mounted or a file downloaded.
5
+ */
6
+ /**
7
+ * The longest file name: `NAME_MAX`, 255 on ext4, XFS, APFS and NTFS (POSIX `<limits.h>`).
8
+ */
9
+ export const FILE_NAME_MAX = 255;
10
+ /**
11
+ * The longest path: `PATH_MAX` of macOS (1024, `<sys/syslimits.h>`), where a local Runtime's
12
+ * virtual workspace lives, and the smallest of the systems a workspace lives on (Linux's is
13
+ * 4096).
14
+ */
15
+ export const FILE_PATH_MAX = 1024;
16
+ /**
17
+ * The longest target a symbolic link of a folder artifact may name: Linux's `PATH_MAX` (4096,
18
+ * `<linux/limits.h>`), the most `symlink(2)` stores, since a sandbox's disk is a Linux file system.
19
+ */
20
+ export const LINK_TARGET_MAX = 4096;
@@ -4,6 +4,9 @@
4
4
  */
5
5
  /** The harness of a session that names no other: ours (`@nylorun/harness`). */
6
6
  export declare const DEFAULT_HARNESS = "nylorun";
7
- /** Lowercase letters, digits and dashes, starting with a letter: 2 to 63 characters. */
7
+ /**
8
+ * Lowercase letters, digits and dashes, starting with a letter: 2 to 63 characters, an RFC 1123
9
+ * DNS label's length; an identifier's grammar is the protocol's (it crosses the Runtime API, the Harness API and tokens, and means the same in every installation), so its length is a constant of protocol 15, not a setting.
10
+ */
8
11
  export declare const HARNESS_ID_PATTERN: RegExp;
9
12
  export declare function isHarnessId(value: unknown): value is string;
@@ -4,7 +4,10 @@
4
4
  */
5
5
  /** The harness of a session that names no other: ours (`@nylorun/harness`). */
6
6
  export const DEFAULT_HARNESS = "nylorun";
7
- /** Lowercase letters, digits and dashes, starting with a letter: 2 to 63 characters. */
7
+ /**
8
+ * Lowercase letters, digits and dashes, starting with a letter: 2 to 63 characters, an RFC 1123
9
+ * DNS label's length; an identifier's grammar is the protocol's (it crosses the Runtime API, the Harness API and tokens, and means the same in every installation), so its length is a constant of protocol 15, not a setting.
10
+ */
8
11
  export const HARNESS_ID_PATTERN = /^[a-z][a-z0-9-]{1,62}$/;
9
12
  export function isHarnessId(value) {
10
13
  return typeof value === "string" && HARNESS_ID_PATTERN.test(value);
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Media types of file artifacts: what an upload may declare, what a name's extension implies,
3
+ * and which model input a file is (`modelInputOf`, protocol 12): text, an image, a PDF, an Office
4
+ * document, audio or video. A model reads a file only when its inputs include that one. The
5
+ * Runtime types what it stores with these, a harness what it reads and writes over the Harness
6
+ * API's artifact seam and how it shows a file to the model, and the Model Gate what it refuses
7
+ * (protocol 15), so all three agree.
8
+ */
9
+ import type { ModelInput } from "../contracts.js";
10
+ /** The media type of bytes nothing says more about. */
11
+ export declare const DEFAULT_CONTENT_TYPE = "application/octet-stream";
12
+ /** Images the model reads as images. */
13
+ export declare const MODEL_IMAGE_TYPES: readonly string[];
14
+ /** The type part of a `Content-Type` value, lowercased, without parameters. */
15
+ export declare function essence(contentType: string): string;
16
+ /** A declared `Content-Type` as stored, or undefined when it is not a media type. */
17
+ export declare function normalizeContentType(value: string | undefined): string | undefined;
18
+ /** The media type a file name implies, or `application/octet-stream`. */
19
+ export declare function contentTypeFor(name: string): string;
20
+ export declare function isModelImage(contentType: string): boolean;
21
+ /** Files the model reads as text: `text/*`, JSON, XML, YAML and their `+json`/`+xml` kin. */
22
+ export declare function isText(contentType: string): boolean;
23
+ /** The usual extension of a media type, for a name the Runtime gives a file; undefined if none. */
24
+ export declare function extensionFor(contentType: string): string | undefined;
25
+ /** Word, Excel and PowerPoint documents, old and Open XML. */
26
+ export declare function isOffice(contentType: string): boolean;
27
+ /** The model input a file of `contentType` is, or undefined for a type no model reads. */
28
+ export declare function modelInputOf(contentType: string): ModelInput | undefined;
29
+ /** An input, in a sentence: "PDFs", "Office documents"; "files of this type" for none. */
30
+ export declare function inputLabel(input: ModelInput | undefined): string;