@nylorun/core 0.1.1-beta → 0.3.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.3.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - b8d822a: Studio Model Settings lists multiple vault-stored providers, adds credentials through a sheet, and switches the active provider/model via Runtime host vault APIs.
8
+ - b8d822a: Let a running Runtime learn its executors instead of receiving them all at startup.
9
+ `PUT /v1/executors` registers or rotates scoped executor credentials with the application
10
+ credential, `DELETE /v1/executors/:agentId` removes one, and `GET /v1/executors` lists them
11
+ without disclosing secrets. Registrations persist in SQLite with the token hashed at rest and
12
+ are restored on the next start; scopes supplied through `NYLORUN_EXECUTORS_JSON` still apply
13
+ to that process, take precedence for their agent, and are never written to the database. An
14
+ unchanged registration is idempotent and keeps open streams, while a rotation ends the
15
+ replaced token's work stream and stops it authorizing. Unauthenticated `/health` now also
16
+ reports the Runtime version, a non-reversible scope digest of the database path, and the
17
+ process id; all three are optional in the contract so an older host still parses. Token
18
+ hashing is adequate only because these credentials are high-entropy values minted by the
19
+ host; it is not a password derivation.
20
+ - b8d822a: Add `sandbox()`: one `.use(sandbox())` gives an agent Runtime-executed `bash`, `read`, `write`, `edit`, `grep` and `glob` tools on an isolated machine with a persistent `/workspace`. The Runtime selects a microsandbox microVM where available, otherwise an in-process virtual shell, enforces deny-by-default egress presets, owns sandbox lifecycle, and reports its choice through `GET /v1/host/sandbox`, the `nylorun dev` banner and `nylorun doctor sandbox`.
21
+ - b8d822a: Breaking beta: replace `beforeModelCall` / `afterModelCall` with scoped hooks. Register `before("turn" | "step", fn)` and `after("step" | "turn", fn)` on the agent, or `before: { turn, step }` / `after: { step, turn }` on a capability. `before("turn")` runs once per turn and its `Patch` applies to every model call in the turn; the new `after("turn")` returns a `TurnDecision` for the final answer. `after` hooks take one argument and receive `attempt`, and `retry` now retries instead of failing the run. The manifest moves to `manifestSchemaVersion: 4` with `capabilities[].hooks`, and `BeforeModelCallFn`, `AfterModelCallFn` and the `beforeModelCall` / `afterModelCall` action kinds are removed. Every capability registered at a hook point now runs in one `hook` executor action, an expired hook claim is offered again instead of becoming uncertain, and the durable engine version is `hosted-2`. Hook toggles now hide a capability's tools, or one tool of a multi-tool capability, instead of having no effect or failing. Studio lists each capability's hooks with how often they run and labels hook actions. See MIGRATION.md.
22
+
23
+ ## 0.2.0-beta
24
+
25
+ ### Minor Changes
26
+
27
+ - 3a88f51: Ship Agent-Plugins (`plugin()` / `loadPlugin`), Skills (`load_skill` / skill resources), Runtime MCP pool + vault credentials, and manifest v3 capability fields. Validate completed tool `output` against the tool output schema so ordinary tools with `outputSchema` no longer false-fail as `tool.invalid-output`.
28
+
3
29
  ## 0.1.1-beta
4
30
 
5
31
  ### Patch Changes
@@ -10,15 +10,140 @@ export declare const PutAgentRequestSchema: z.ZodObject<{
10
10
  requestId: z.ZodString;
11
11
  manifest: z.ZodType<AgentManifest, unknown, z.core.$ZodTypeInternals<AgentManifest, unknown>>;
12
12
  implementationVersion: z.ZodString;
13
+ pluginRoots: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
13
14
  }, z.core.$strict>;
14
15
  export type PutAgentRequest = z.infer<typeof PutAgentRequestSchema>;
16
+ export declare const CredentialSelectionSchema: z.ZodObject<{
17
+ serverName: z.ZodString;
18
+ credentialId: z.ZodString;
19
+ }, z.core.$strict>;
20
+ export type CredentialSelection = z.infer<typeof CredentialSelectionSchema>;
15
21
  export declare const PutSessionRequestSchema: z.ZodObject<{
16
22
  requestId: z.ZodString;
17
23
  agentId: z.ZodString;
18
24
  ownerUserId: z.ZodString;
19
25
  info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
26
+ vaultIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
27
+ credentialSelections: z.ZodOptional<z.ZodArray<z.ZodObject<{
28
+ serverName: z.ZodString;
29
+ credentialId: z.ZodString;
30
+ }, z.core.$strict>>>;
20
31
  }, z.core.$strict>;
21
32
  export type PutSessionRequest = z.infer<typeof PutSessionRequestSchema>;
33
+ export declare const CreateVaultRequestSchema: z.ZodObject<{
34
+ requestId: z.ZodString;
35
+ idempotencyKey: z.ZodString;
36
+ name: z.ZodString;
37
+ ownerUserId: z.ZodString;
38
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
39
+ }, z.core.$strict>;
40
+ export type CreateVaultRequest = z.infer<typeof CreateVaultRequestSchema>;
41
+ export declare const CreateCredentialRequestSchema: z.ZodObject<{
42
+ requestId: z.ZodString;
43
+ idempotencyKey: z.ZodString;
44
+ name: z.ZodString;
45
+ auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
46
+ type: z.ZodLiteral<"bearer">;
47
+ url: z.ZodString;
48
+ token: z.ZodString;
49
+ }, z.core.$strict>, z.ZodObject<{
50
+ type: z.ZodLiteral<"oauth">;
51
+ url: z.ZodString;
52
+ accessToken: z.ZodString;
53
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ refresh: z.ZodOptional<z.ZodObject<{
55
+ tokenEndpoint: z.ZodString;
56
+ clientId: z.ZodString;
57
+ refreshToken: z.ZodString;
58
+ tokenEndpointAuth: z.ZodDiscriminatedUnion<[z.ZodObject<{
59
+ type: z.ZodLiteral<"none">;
60
+ }, z.core.$strict>, z.ZodObject<{
61
+ type: z.ZodLiteral<"client_secret_basic">;
62
+ clientSecret: z.ZodString;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ type: z.ZodLiteral<"client_secret_post">;
65
+ clientSecret: z.ZodString;
66
+ }, z.core.$strict>], "type">;
67
+ }, z.core.$strict>>;
68
+ }, z.core.$strict>], "type">;
69
+ }, z.core.$strict>;
70
+ export type CreateCredentialRequest = z.infer<typeof CreateCredentialRequestSchema>;
71
+ export declare const RotateCredentialRequestSchema: z.ZodObject<{
72
+ requestId: z.ZodString;
73
+ idempotencyKey: z.ZodString;
74
+ auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
75
+ type: z.ZodLiteral<"bearer">;
76
+ token: z.ZodString;
77
+ }, z.core.$strict>, z.ZodObject<{
78
+ type: z.ZodLiteral<"oauth">;
79
+ accessToken: z.ZodString;
80
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
+ }, z.core.$strict>], "type">;
82
+ }, z.core.$strict>;
83
+ export type RotateCredentialRequest = z.infer<typeof RotateCredentialRequestSchema>;
84
+ export declare const PutHostModelRequestSchema: z.ZodObject<{
85
+ requestId: z.ZodString;
86
+ idempotencyKey: z.ZodString;
87
+ provider: z.ZodString;
88
+ model: z.ZodString;
89
+ baseUrl: z.ZodOptional<z.ZodString>;
90
+ auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
91
+ type: z.ZodLiteral<"api_key">;
92
+ key: z.ZodString;
93
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
94
+ }, z.core.$strict>, z.ZodObject<{
95
+ type: z.ZodLiteral<"oauth">;
96
+ refresh: z.ZodString;
97
+ access: z.ZodString;
98
+ expires: z.ZodNumber;
99
+ }, z.core.$loose>], "type">;
100
+ }, z.core.$strict>;
101
+ export type PutHostModelRequest = z.infer<typeof PutHostModelRequestSchema>;
102
+ export type HostModelView = {
103
+ readonly configured: false;
104
+ } | {
105
+ readonly configured: true;
106
+ readonly provider: string;
107
+ readonly model: string;
108
+ readonly authType: "api_key" | "oauth";
109
+ readonly baseUrl?: string;
110
+ };
111
+ export declare const SelectHostModelRequestSchema: z.ZodObject<{
112
+ requestId: z.ZodString;
113
+ idempotencyKey: z.ZodString;
114
+ provider: z.ZodString;
115
+ model: z.ZodString;
116
+ baseUrl: z.ZodOptional<z.ZodString>;
117
+ }, z.core.$strict>;
118
+ export type SelectHostModelRequest = z.infer<typeof SelectHostModelRequestSchema>;
119
+ export type HostModelProviderInfo = {
120
+ readonly id: string;
121
+ readonly name: string;
122
+ readonly model: string;
123
+ readonly authType: "api_key" | "oauth";
124
+ readonly baseUrl?: string;
125
+ readonly lastUpdated: string;
126
+ readonly active: boolean;
127
+ };
128
+ export interface VaultInfo {
129
+ readonly id: string;
130
+ readonly name: string;
131
+ readonly ownerUserId: string;
132
+ readonly metadata?: Readonly<Record<string, string>>;
133
+ readonly createdAt: string;
134
+ }
135
+ export interface CredentialInfo {
136
+ readonly id: string;
137
+ readonly vaultId: string;
138
+ readonly name: string;
139
+ readonly type: "bearer" | "oauth";
140
+ readonly binding: {
141
+ readonly url: string;
142
+ };
143
+ readonly expiresAt?: string;
144
+ readonly createdAt: string;
145
+ readonly rotatedAt?: string;
146
+ }
22
147
  export declare const MessageEventBodySchema: z.ZodObject<{
23
148
  requestId: z.ZodString;
24
149
  idempotencyKey: z.ZodString;
@@ -151,20 +276,50 @@ export declare const RejectedResponseSchema: z.ZodObject<{
151
276
  requestId: z.ZodOptional<z.ZodString>;
152
277
  }, z.core.$strip>;
153
278
  export type RejectedResponse = z.infer<typeof RejectedResponseSchema>;
154
- export declare const ActionSchema: z.ZodObject<{
279
+ /** The hook point an action runs, and the capabilities that registered it (manifest order). */
280
+ export declare const ActionHookSchema: z.ZodObject<{
281
+ at: z.ZodEnum<{
282
+ after: "after";
283
+ before: "before";
284
+ }>;
285
+ scope: z.ZodEnum<{
286
+ step: "step";
287
+ turn: "turn";
288
+ }>;
289
+ capabilityIds: z.ZodArray<z.ZodString>;
290
+ }, z.core.$strict>;
291
+ export type ActionHook = z.infer<typeof ActionHookSchema>;
292
+ export declare const ActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
155
293
  actionId: z.ZodString;
156
294
  sessionId: z.ZodString;
157
295
  turnId: z.ZodString;
158
296
  agentId: z.ZodString;
159
297
  manifestHash: z.ZodString;
160
298
  implementationVersion: z.ZodString;
161
- kind: z.ZodEnum<{
162
- afterModelCall: "afterModelCall";
163
- beforeModelCall: "beforeModelCall";
164
- tool: "tool";
299
+ input: z.ZodUnknown;
300
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
301
+ status: z.ZodEnum<{
302
+ cancelled: "cancelled";
303
+ claimed: "claimed";
304
+ completed: "completed";
305
+ pending: "pending";
306
+ uncertain: "uncertain";
165
307
  }>;
308
+ generation: z.ZodNumber;
309
+ claimId: z.ZodNullable<z.ZodString>;
310
+ leaseExpiresAt: z.ZodNullable<z.ZodString>;
311
+ kind: z.ZodLiteral<"tool">;
166
312
  capabilityId: z.ZodString;
167
- toolName: z.ZodOptional<z.ZodString>;
313
+ toolName: z.ZodString;
314
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
315
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
316
+ }, z.core.$strip>, z.ZodObject<{
317
+ actionId: z.ZodString;
318
+ sessionId: z.ZodString;
319
+ turnId: z.ZodString;
320
+ agentId: z.ZodString;
321
+ manifestHash: z.ZodString;
322
+ implementationVersion: z.ZodString;
168
323
  input: z.ZodUnknown;
169
324
  context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
170
325
  status: z.ZodEnum<{
@@ -177,11 +332,22 @@ export declare const ActionSchema: z.ZodObject<{
177
332
  generation: z.ZodNumber;
178
333
  claimId: z.ZodNullable<z.ZodString>;
179
334
  leaseExpiresAt: z.ZodNullable<z.ZodString>;
180
- }, z.core.$strip>;
335
+ kind: z.ZodLiteral<"hook">;
336
+ hook: z.ZodObject<{
337
+ at: z.ZodEnum<{
338
+ after: "after";
339
+ before: "before";
340
+ }>;
341
+ scope: z.ZodEnum<{
342
+ step: "step";
343
+ turn: "turn";
344
+ }>;
345
+ capabilityIds: z.ZodArray<z.ZodString>;
346
+ }, z.core.$strict>;
347
+ }, z.core.$strip>], "kind">;
181
348
  export type Action = z.infer<typeof ActionSchema>;
182
349
  export declare const ActionClaimRequestSchema: z.ZodObject<{
183
350
  requestId: z.ZodString;
184
- manifestHash: z.ZodString;
185
351
  implementationVersion: z.ZodString;
186
352
  }, z.core.$strict>;
187
353
  export declare const ActionHeartbeatRequestSchema: z.ZodObject<{
@@ -190,20 +356,37 @@ export declare const ActionHeartbeatRequestSchema: z.ZodObject<{
190
356
  generation: z.ZodNumber;
191
357
  }, z.core.$strict>;
192
358
  export declare const ActionClaimResponseSchema: z.ZodObject<{
193
- action: z.ZodObject<{
359
+ action: z.ZodDiscriminatedUnion<[z.ZodObject<{
194
360
  actionId: z.ZodString;
195
361
  sessionId: z.ZodString;
196
362
  turnId: z.ZodString;
197
363
  agentId: z.ZodString;
198
364
  manifestHash: z.ZodString;
199
365
  implementationVersion: z.ZodString;
200
- kind: z.ZodEnum<{
201
- afterModelCall: "afterModelCall";
202
- beforeModelCall: "beforeModelCall";
203
- tool: "tool";
366
+ input: z.ZodUnknown;
367
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
368
+ status: z.ZodEnum<{
369
+ cancelled: "cancelled";
370
+ claimed: "claimed";
371
+ completed: "completed";
372
+ pending: "pending";
373
+ uncertain: "uncertain";
204
374
  }>;
375
+ generation: z.ZodNumber;
376
+ claimId: z.ZodNullable<z.ZodString>;
377
+ leaseExpiresAt: z.ZodNullable<z.ZodString>;
378
+ kind: z.ZodLiteral<"tool">;
205
379
  capabilityId: z.ZodString;
206
- toolName: z.ZodOptional<z.ZodString>;
380
+ toolName: z.ZodString;
381
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
382
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
383
+ }, z.core.$strip>, z.ZodObject<{
384
+ actionId: z.ZodString;
385
+ sessionId: z.ZodString;
386
+ turnId: z.ZodString;
387
+ agentId: z.ZodString;
388
+ manifestHash: z.ZodString;
389
+ implementationVersion: z.ZodString;
207
390
  input: z.ZodUnknown;
208
391
  context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
209
392
  status: z.ZodEnum<{
@@ -216,7 +399,19 @@ export declare const ActionClaimResponseSchema: z.ZodObject<{
216
399
  generation: z.ZodNumber;
217
400
  claimId: z.ZodNullable<z.ZodString>;
218
401
  leaseExpiresAt: z.ZodNullable<z.ZodString>;
219
- }, z.core.$strip>;
402
+ kind: z.ZodLiteral<"hook">;
403
+ hook: z.ZodObject<{
404
+ at: z.ZodEnum<{
405
+ after: "after";
406
+ before: "before";
407
+ }>;
408
+ scope: z.ZodEnum<{
409
+ step: "step";
410
+ turn: "turn";
411
+ }>;
412
+ capabilityIds: z.ZodArray<z.ZodString>;
413
+ }, z.core.$strict>;
414
+ }, z.core.$strip>], "kind">;
220
415
  claimId: z.ZodString;
221
416
  generation: z.ZodNumber;
222
417
  leaseExpiresAt: z.ZodString;
@@ -224,15 +419,58 @@ export declare const ActionClaimResponseSchema: z.ZodObject<{
224
419
  export type ActionClaim = z.infer<typeof ActionClaimResponseSchema>;
225
420
  export interface ExecutorScope {
226
421
  readonly agentId: string;
227
- readonly manifestHash: string;
422
+ readonly manifestHash?: string;
228
423
  readonly implementationVersion: string;
229
424
  }
230
425
  export declare const ExecutorNotificationSchema: z.ZodObject<{
231
426
  type: z.ZodLiteral<"work_available">;
232
427
  }, z.core.$strip>;
428
+ export declare const ExecutorRegistrationSchema: z.ZodObject<{
429
+ agentId: z.ZodString;
430
+ implementationVersion: z.ZodString;
431
+ manifestHash: z.ZodOptional<z.ZodString>;
432
+ token: z.ZodString;
433
+ }, z.core.$strict>;
434
+ export declare const RegisterExecutorsRequestSchema: z.ZodObject<{
435
+ executors: z.ZodArray<z.ZodObject<{
436
+ agentId: z.ZodString;
437
+ implementationVersion: z.ZodString;
438
+ manifestHash: z.ZodOptional<z.ZodString>;
439
+ token: z.ZodString;
440
+ }, z.core.$strict>>;
441
+ }, z.core.$strict>;
442
+ export declare const RegisterExecutorsResponseSchema: z.ZodObject<{
443
+ executors: z.ZodArray<z.ZodObject<{
444
+ agentId: z.ZodString;
445
+ implementationVersion: z.ZodString;
446
+ rotated: z.ZodBoolean;
447
+ }, z.core.$strip>>;
448
+ }, z.core.$strip>;
449
+ export declare const ExecutorSummarySchema: z.ZodObject<{
450
+ agentId: z.ZodString;
451
+ implementationVersion: z.ZodString;
452
+ manifestHash: z.ZodOptional<z.ZodString>;
453
+ connected: z.ZodBoolean;
454
+ updatedAt: z.ZodString;
455
+ }, z.core.$strip>;
456
+ export declare const ListExecutorsResponseSchema: z.ZodObject<{
457
+ executors: z.ZodArray<z.ZodObject<{
458
+ agentId: z.ZodString;
459
+ implementationVersion: z.ZodString;
460
+ manifestHash: z.ZodOptional<z.ZodString>;
461
+ connected: z.ZodBoolean;
462
+ updatedAt: z.ZodString;
463
+ }, z.core.$strip>>;
464
+ }, z.core.$strip>;
465
+ export type ExecutorRegistration = z.infer<typeof ExecutorRegistrationSchema>;
466
+ export type RegisterExecutorsResponse = z.infer<typeof RegisterExecutorsResponseSchema>;
467
+ export type ExecutorSummary = z.infer<typeof ExecutorSummarySchema>;
233
468
  export declare const HealthResponseSchema: z.ZodObject<{
234
469
  status: z.ZodLiteral<"ok">;
235
470
  service: z.ZodString;
471
+ version: z.ZodOptional<z.ZodString>;
472
+ scopeId: z.ZodOptional<z.ZodString>;
473
+ pid: z.ZodOptional<z.ZodNumber>;
236
474
  }, z.core.$strip>;
237
475
  export declare const ReadyResponseSchema: z.ZodObject<{
238
476
  status: z.ZodEnum<{