@nylorun/core 0.23.0-beta → 0.24.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.
@@ -150,6 +150,32 @@ const harnessLimits = {
150
150
  * longest `reason` or `matches` expression.
151
151
  * - `modelBudgets`: the most model budgets the Tenant sets.
152
152
  *
153
+ * Triggers (track T4, D74; checked when a manifest is saved, and when a trigger fires):
154
+ * - `triggersPerAgent`: the most triggers one agent manifest declares.
155
+ * - `triggerMinIntervalMs`: the shortest gap between two runs of one schedule (cron is minute
156
+ * grained, so at least a minute), checked over its next fires at save.
157
+ * - `triggerRunsPerHour`: the most runs one Agent's triggers start or queue in any hour; later
158
+ * ones are skipped (`rate_limited`). The guard against an Agent triggering itself.
159
+ * - `triggerJitterPercent`, `triggerJitterMaxMs`: how far each schedule's fixed offset may move
160
+ * its runs, as a part of its interval and at most.
161
+ * - `triggerPromptChars`: the longest prompt one trigger holds.
162
+ * - `triggerRunRetentionMs`: how long runs are kept; they dedupe repeated fires, so at least a day.
163
+ * - `wakeMaxAheadMs`: how far ahead `schedule_wake` may book a session's next turn (D77); at least
164
+ * `triggerMinIntervalMs` ahead too. A long wait is armed in steps, so it has no timer ceiling.
165
+ * - `wakeNoteChars`: the longest note a booked wake carries to its turn.
166
+ * - `webhookBodyBytes`: the largest delivery a webhook endpoint reads, before it verifies it
167
+ * (`413` past it); the payload goes into the turn's message, one record entry.
168
+ *
169
+ * Memory (track T5, D72; checked on every write):
170
+ * - `memoryBytes`: the largest memory, in UTF-8 bytes.
171
+ * - `memoriesPerAgent`: the most memories one Agent holds.
172
+ * - `memoryIndexLines`, `memoryIndexBytes`: the most lines and UTF-8 bytes of the index a session
173
+ * pins at its start (`turn.start.memory.index`); the newest memories come first.
174
+ *
175
+ * Sessions:
176
+ * - `sessionQueuedMessages`: the most messages one session's queue holds while its turn runs or
177
+ * waits (protocol 17); one more is `429 queue_full`.
178
+ *
153
179
  * Flows (`workflows.md` §13):
154
180
  * - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
155
181
  * - `flowMapItems`: the most items one map stage may fan out to (`map.too-many-items` past it).
@@ -203,6 +229,21 @@ export const RuntimeLimitsSchema = z
203
229
  toolRuleFieldChars: z.number().int().positive(),
204
230
  toolRuleTextChars: z.number().int().positive(),
205
231
  modelBudgets: z.number().int().positive(),
232
+ triggersPerAgent: z.number().int().positive(),
233
+ triggerMinIntervalMs: z.number().int().positive(),
234
+ triggerRunsPerHour: z.number().int().positive(),
235
+ triggerJitterPercent: z.number().int().nonnegative(),
236
+ triggerJitterMaxMs: z.number().int().nonnegative(),
237
+ triggerPromptChars: z.number().int().positive(),
238
+ triggerRunRetentionMs: z.number().int().positive(),
239
+ webhookBodyBytes: z.number().int().positive(),
240
+ wakeMaxAheadMs: z.number().int().positive(),
241
+ wakeNoteChars: z.number().int().positive(),
242
+ memoryBytes: z.number().int().positive(),
243
+ memoriesPerAgent: z.number().int().positive(),
244
+ memoryIndexLines: z.number().int().positive(),
245
+ memoryIndexBytes: z.number().int().positive(),
246
+ sessionQueuedMessages: z.number().int().positive(),
206
247
  flowConcurrency: z.number().int().positive(),
207
248
  flowMapItems: z.number().int().positive(),
208
249
  flowLoopIterations: z.number().int().positive(),
@@ -374,6 +415,37 @@ export const RUNTIME_LIMIT_CEILINGS = {
374
415
  toolRuleFieldChars: inRequestText("a selector"),
375
416
  toolRuleTextChars: inRequestText("a text"),
376
417
  modelBudgets: inRequest("budgets", { scope: "tenant" }),
418
+ triggersPerAgent: inRequest("triggers", { a: { at: "2026-01-01T00:00:00Z", session: "a", prompt: "a" } }),
419
+ triggerMinIntervalMs: counted("milliseconds", "the gap is reckoned from the clock"),
420
+ triggerRunsPerHour: counted("runs", "runs are counted"),
421
+ triggerJitterPercent: {
422
+ value: 50,
423
+ unit: "percent",
424
+ why: "an offset past half the interval could move a run past the next one",
425
+ },
426
+ triggerJitterMaxMs: timer("the offset is waited"),
427
+ triggerPromptChars: quoted("the prompt"),
428
+ triggerRunRetentionMs: counted("milliseconds", "the age is reckoned from the clock"),
429
+ wakeMaxAheadMs: counted("milliseconds", "the time is reckoned from the clock"),
430
+ wakeNoteChars: quoted("the note"),
431
+ memoryBytes: {
432
+ value: HARNESS_MAX_PAYLOAD / 2,
433
+ unit: "bytes",
434
+ why: `a memory reaches a harness in one Harness API frame (${HARNESS_MAX_PAYLOAD} bytes), as JSON, whose escapes may double it`,
435
+ },
436
+ memoriesPerAgent: counted("entries", "memories are counted"),
437
+ memoryIndexLines: counted("entries", "the lines are counted"),
438
+ memoryIndexBytes: {
439
+ value: HARNESS_MAX_PAYLOAD / 4,
440
+ unit: "bytes",
441
+ why: `the index crosses in turn.start, one Harness API frame (${HARNESS_MAX_PAYLOAD} bytes), beside the harness's state and the rest`,
442
+ },
443
+ webhookBodyBytes: {
444
+ value: recordEntryCeiling,
445
+ unit: "bytes",
446
+ why: `the payload goes into one record entry, which holds at most ${recordEntryCeiling} bytes`,
447
+ },
448
+ sessionQueuedMessages: counted("entries", "queued messages are counted"),
377
449
  flowConcurrency: counted("effects", "running effects are counted"),
378
450
  flowMapItems: counted("entries", "items are counted"),
379
451
  flowLoopIterations: counted("iterations", "iterations are counted"),
@@ -437,6 +509,21 @@ export const RUNTIME_LIMIT_DEFAULTS = Object.freeze({
437
509
  toolRuleFieldChars: 200,
438
510
  toolRuleTextChars: 500,
439
511
  modelBudgets: 100,
512
+ triggersPerAgent: 20,
513
+ triggerMinIntervalMs: 60_000,
514
+ triggerRunsPerHour: 60,
515
+ triggerJitterPercent: 10,
516
+ triggerJitterMaxMs: 300_000,
517
+ triggerPromptChars: 8_000,
518
+ triggerRunRetentionMs: 30 * 24 * 3_600_000,
519
+ webhookBodyBytes: 256 * 1024,
520
+ wakeMaxAheadMs: 30 * 24 * 3_600_000,
521
+ wakeNoteChars: 2_000,
522
+ memoryBytes: 100 * 1024,
523
+ memoriesPerAgent: 10_000,
524
+ memoryIndexLines: 200,
525
+ memoryIndexBytes: 25 * 1024,
526
+ sessionQueuedMessages: 100,
440
527
  flowConcurrency: 8,
441
528
  flowMapItems: 1_000,
442
529
  flowLoopIterations: 100,
@@ -453,9 +540,25 @@ export function runtimeLimitsOf(set) {
453
540
  }
454
541
  return limits;
455
542
  }
456
- /** Why `set` cannot be put: each limit above its ceiling, naming the ceiling and its dependency. */
543
+ /**
544
+ * Limits with a floor, which no setting may go under, and why: a schedule's cron is minute
545
+ * grained, and runs dedupe repeated fires for as long as the execution's own dedupe lasts (a day).
546
+ */
547
+ export const RUNTIME_LIMIT_FLOORS = {
548
+ triggerMinIntervalMs: { value: 60_000, why: "cron fires at most once a minute" },
549
+ triggerRunRetentionMs: {
550
+ value: 24 * 3_600_000,
551
+ why: "a run row dedupes a repeated fire or delivery, which Durable Session Execution may send again for a day",
552
+ },
553
+ };
554
+ /** Why `set` cannot be put: each limit above its ceiling or under its floor, naming why. */
457
555
  export function runtimeLimitIssues(set) {
458
556
  const issues = [];
557
+ for (const [name, floor] of Object.entries(RUNTIME_LIMIT_FLOORS)) {
558
+ const asked = set?.[name];
559
+ if (asked !== undefined && asked < floor.value)
560
+ issues.push(`limits.${name} asks for ${asked}; its floor is ${floor.value}: ${floor.why}.`);
561
+ }
459
562
  for (const name of Object.keys(RUNTIME_LIMIT_CEILINGS)) {
460
563
  const asked = set?.[name];
461
564
  const ceiling = RUNTIME_LIMIT_CEILINGS[name];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/core",
3
- "version": "0.23.0-beta",
3
+ "version": "0.24.0-beta",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Shared agent definitions and wire contracts",
@@ -33,9 +33,9 @@
33
33
  "@noble/hashes": "^2.4.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/node": "^26.6.4",
36
+ "@types/node": "^26.6.5",
37
37
  "typescript": "npm:@typescript/typescript6@^6.0.2",
38
- "vitest": "^5.0.2"
38
+ "vitest": "^5.0.4"
39
39
  },
40
40
  "exports": {
41
41
  ".": {
@@ -72,10 +72,11 @@
72
72
  "import": "./dist/manifest-schemas.js"
73
73
  },
74
74
  "./schemas/agent-manifest.json": "./dist/schemas/agent-manifest.schema.json",
75
- "./schemas/environment-manifest.json": "./dist/schemas/environment-manifest.schema.json"
75
+ "./schemas/harness-manifest.json": "./dist/schemas/harness-manifest.schema.json",
76
+ "./schemas/runtime-manifest.json": "./dist/schemas/runtime-manifest.schema.json"
76
77
  },
77
78
  "peerDependencies": {
78
- "zod": "^4.6.5"
79
+ "zod": "^4.6.7"
79
80
  },
80
81
  "sideEffects": false
81
82
  }