@nylorun/core 0.6.0-beta → 0.8.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 +66 -0
- package/dist/compatibility.d.ts +13 -2
- package/dist/compatibility.js +19 -1
- package/dist/contracts.d.ts +247 -0
- package/dist/contracts.js +353 -4
- package/dist/define.d.ts +10 -2
- package/dist/define.js +5 -1
- package/dist/definition/assemble.js +7 -0
- package/dist/definition/builder.d.ts +122 -16
- package/dist/definition/builder.js +354 -53
- package/dist/definition/capability.d.ts +55 -0
- package/dist/definition/capability.js +104 -0
- package/dist/definition/delegate.d.ts +25 -4
- package/dist/definition/delegate.js +34 -6
- package/dist/definition/flow/compile.d.ts +25 -0
- package/dist/definition/flow/compile.js +302 -0
- package/dist/definition/flow/from.d.ts +11 -0
- package/dist/definition/flow/from.js +78 -0
- package/dist/definition/flow/index.d.ts +11 -0
- package/dist/definition/flow/index.js +11 -0
- package/dist/definition/flow/paths.d.ts +60 -0
- package/dist/definition/flow/paths.js +90 -0
- package/dist/definition/flow/spec.d.ts +66 -0
- package/dist/definition/flow/spec.js +130 -0
- package/dist/definition/flow/types.d.ts +159 -0
- package/dist/definition/flow/types.js +1 -0
- package/dist/definition/from.js +5 -1
- package/dist/definition/helpers.d.ts +1 -16
- package/dist/definition/helpers.js +1 -30
- package/dist/definition/mcp.d.ts +37 -0
- package/dist/definition/mcp.js +81 -0
- package/dist/definition/sandbox.d.ts +29 -0
- package/dist/definition/sandbox.js +93 -0
- package/dist/definition/workflow/loop.js +2 -2
- package/dist/definition/workflow/runnable.d.ts +13 -1
- package/dist/definition/workflow/runnable.js +11 -7
- package/dist/types/manifest.d.ts +4 -2
- package/dist/types/workflow.d.ts +72 -3
- package/dist/utils/deprecate.d.ts +3 -0
- package/dist/utils/deprecate.js +25 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# @nylorun/core
|
|
2
2
|
|
|
3
|
+
## 0.8.0-beta
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e537a82: **One `Agent` builder: named methods and flow agents.** Every capability has its own method, and deterministic workflows are written on the same builder. ReAct agent manifests are unchanged: the new syntax compiles to exactly what the old syntax produced.
|
|
8
|
+
|
|
9
|
+
- ReAct agents: `.instructions()`, `.tools()`, `.subagents()`, `.mcp()` (a server's `name` defaults to its key; calls merge), `.skills()`, `.plugin()`, `.capability()`, `.sandbox()`, `.beforeTurn()`, `.beforeModel()`, `.afterModel()`, `.afterTurn()`, `.output()`. `capability({ id })` returns a builder with the same methods.
|
|
10
|
+
- Flow agents: `.step()`, `.switch({ ...cases, default }, { on })`, `.parallel()`, `.map()` (runs over its input), `.loop(body, { verify, max | decide })`, plus `.input()`, `.output()`, `.sandbox()`, `flow()` for nested sequences and `.withId()`. Functions receive `{ input, results, flowInput }`, typed from each step's output schema. A flow agent compiles to a workflow manifest (v2, see the flow-manifest-v2 changeset).
|
|
11
|
+
- Build diagnostics: `agent.mixed-body`, `flow.no-model`, `agent.single-value`, `flow.empty`, `loop.max-required`, `loop.invalid-max`, `mcp.duplicate-server`, `delegation.flow-unsupported`.
|
|
12
|
+
- `sandbox()` and `mcp()` move to `@nylorun/core/define` (still exported from `@nylorun/agents`).
|
|
13
|
+
- Deprecated, warning once each: options-form `instructions`/`tools`/`outputSchema` (`NYLORUN_DEP_AGENT_OPTIONS`), `.use(capability)` (`NYLORUN_DEP_USE`), `.before()`/`.after()` (`NYLORUN_DEP_HOOKS`), and `capability({ tools, instructions, … })` (`NYLORUN_DEP_CAPABILITY_OPTIONS`). See MIGRATION.md.
|
|
14
|
+
|
|
15
|
+
- 5278b4e: **Flow agents on workflow manifest v2.** A flow agent compiles to `workflowSchemaVersion: 2` and runs on the new `flow-2` engine; v1 workflows (`Chain`, `Switch`, `Parallel`, `Map`, `Loop`) keep running on `flow-1`, so in-flight runs finish as they began.
|
|
16
|
+
|
|
17
|
+
- **Manifest (core).** Any node may carry `id` and `input`; there are no slots. `chain` and `parallel` are bare collections, a Map is `{ map: { each } }` over its input, and a Loop has `max?` and `decide?`. The header adds `name`, `description`, `metadata`, `inputSchema` and `outputSchema`, and `agents` embeds every agent the flow runs, so one manifest hash covers the whole flow. `Agent.from(json, { nodes, agents })` rebuilds a flow agent. Path and key helpers (`leafPath`, `stageKey`, `forEachFlowNode`, `embeddedAgent`, …) are exported from `@nylorun/core/define`.
|
|
18
|
+
- **Paths (harness).** Linked agent sessions are named by the agent: its id, `[i]` per Map item, and a nested flow agent's id in front. Control stages add nothing, so wrapping a step in a Loop keeps its session. Functions are bound under stage keys (`route:on`, `@1.default.1:input`) and all receive `{ input, results, flowInput }`; `flowInput` works inside nested `flow()`. A Loop without `decide` retries with the verifier's feedback up to `max` and then fails with `loop.exhausted`. Nested flow agents run inline.
|
|
19
|
+
- **Runtime.** Leaves of a v2 workflow resolve from its embedded `agents` (with the workflow's plugin roots, keyed `<agent>/<capability>`) instead of the registry. `loop.iteration` is emitted only for a Loop's own agent turns.
|
|
20
|
+
- **Agents SDK.** `saveAgent(flowAgent)` PUTs one document; application mode registers the flow's executor with its manifest hash. An executor leaves `fn`, `verify` and tool actions of a v2 flow unclaimed when they belong to another manifest hash, because stage keys can shift between deploys; it reports each skipped action once through `onError`.
|
|
21
|
+
- **Studio.** Draws v2 manifests: agents and tools at their session paths, control stages at their stage keys, nested flow agents inline, and lights a Map's agent from its item sessions.
|
|
22
|
+
- Build diagnostics: `flow.duplicate-leaf`, `flow.duplicate-id`, `flow.agent-conflict`, `flow.v1-workflow`, `loop.invalid-verify`, `workflow.flow-agent-child`. Also fixes v1 flows passing an agent step's output to the next step still wrapped in the runtime's turn marker.
|
|
23
|
+
|
|
24
|
+
- 426fd27: **Flow agents as subagents.** `.subagents(flowAgent)` lets a ReAct agent delegate to a flow agent. The flow's workflow manifest v2 is inlined in the delegating tool (`ToolManifest.agent` may be a workflow manifest), so it is saved with the parent and served by the parent's executor, plugin roots included (`<flow>/<agent>/<capability>`).
|
|
25
|
+
|
|
26
|
+
- **Engine (harness).** A call to a flow subagent is one durable `agent` effect (`role: "delegate"`) between the delegation's start and settle points; the flow's output is the tool result, and a failed flow is a failed tool result. Local `run()` refuses flow subagents, which need the Runtime.
|
|
27
|
+
- **Runtime.** The effect starts a linked flow session from the parent's pinned manifest, fresh per call, and settles when the flow's turn ends. Cancelling any session now cascades to the linked sessions it started, not only a workflow's.
|
|
28
|
+
- **Core.** `delegation.flow-unsupported` now only reports a workflow built with `Chain`, `Switch`, `Parallel`, `Map` or `Loop`. New helpers: `flowDelegatesOf`, `flowDelegateManifest`, `isFlowDelegate`; `delegatesOf` lists only the ReAct agents run in-process.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- 8cda500: **Workflow functions and tool steps reach the executor.** Several workflow nodes asked the executor for a key that core never registered, so the executor never found the function and the turn waited forever.
|
|
33
|
+
|
|
34
|
+
- A Map's `over` and a slot's `input` now use the keys core registers (`<path>/over`, `<path>/input`), as Switch's `on` already did.
|
|
35
|
+
- A slot `input` that wraps a Map or Switch gets its own effect id, so it no longer collides with the `over` or `on` effect on the same path.
|
|
36
|
+
- A slot `id` that renames a nested workflow now renames the keys inside it too.
|
|
37
|
+
- A verifier slot's `input` is keyed under the verifier's path (`<loop>/<part>/input`).
|
|
38
|
+
- A tool step passes its output to the next step, not the `{ kind: "completed", output }` outcome around it. A denied tool call fails the flow with `tool.denied`.
|
|
39
|
+
|
|
40
|
+
## 0.7.0-beta
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- a322696: **Derived principals** (optional Host feature `derived-principals`): a client that holds the admin key no longer needs to store an application key.
|
|
45
|
+
|
|
46
|
+
- `admin.createTenant({ name, principals: ["babai"] })` registers each named principal by the hash of its derived key, and `admin.deriveTenantKey(tenantId, principalId)` (or `deriveTenantKey(adminKey, tenantId, principalId)`) recomputes the key when needed.
|
|
47
|
+
- `POST /v1/admin/tenants` accepts `derivedPrincipals: [{ id, credentialHash }]`. Ids match `^[a-z][a-z0-9-]{0,31}$` and `studio` is reserved; duplicate ids or credentials answer `400`. A retried create must name the same principals.
|
|
48
|
+
- `createTenant` with `principals` throws `incompatible_host` before sending anything to a Host without the feature.
|
|
49
|
+
|
|
50
|
+
- 844bff3: **Act for a person: `Nylorun-Subject` and `Nylorun-Scopes`.** An app server that holds the Tenant key can name the person each request is for, and the Runtime enforces it (optional Host feature `subject-headers`).
|
|
51
|
+
|
|
52
|
+
- `client.as(subject, { scopes })` in `@nylorun/agents` sends both headers on every call, event streams included. Scopes: `agents:read`, `agents:write`, `sessions:own`, `vaults:own`, `tenant:settings`; default `["sessions:own"]`.
|
|
53
|
+
- The Runtime limits a subject to the routes its scopes allow (`403 scope_required`) and to its own sessions and vaults: another owner's session, vault or sandbox is the same `404` as a missing one, including `PUT` on its session id (was `409`). Reset, config seed, executors, actions and the sandbox tool routes are open to no subject. Only application keys may send the headers.
|
|
54
|
+
- The AG-UI handler calls the Runtime as each person and requires `subject-headers`; new optional `scopes` option. The host's `session()` parameters can no longer replace a session's id, agent or owner.
|
|
55
|
+
- Core exports `SUBJECT_HEADER`, `SCOPES_HEADER`, `SUBJECT_SCOPES` and `parseSubjectHeaders`. Postgres Tenant schemas migrate to version 2 (an indexed session owner column).
|
|
56
|
+
|
|
57
|
+
Requests without `Nylorun-Subject` are unchanged.
|
|
58
|
+
|
|
59
|
+
- a322696: **The session log now carries what a chat UI shows** (optional Host feature `transcript-events`).
|
|
60
|
+
|
|
61
|
+
- `message.assistant` for each completed model step: `{ invocationId, text, toolCalls: [{ callId, name, input }], agent? }`.
|
|
62
|
+
- `tool.completed` for an MCP or sandbox tool: `{ invocationId, callId, capabilityId, toolName, output }`, or `error: { code, message }` for a tool error.
|
|
63
|
+
- Tool `action.pending` and `action.completed` events, and `delegation.started` / `delegation.completed`, carry the model's `callId` (and `invocationId` on actions).
|
|
64
|
+
- Events are written in the transaction that completes the effect, so a replay writes none.
|
|
65
|
+
- `@nylorun/core/contracts` adds payload schemas and `parseTranscriptEvent(event)`; `LiveEvent.payload` stays `unknown`.
|
|
66
|
+
|
|
67
|
+
Fix: a tool with both `approval` and an `output` schema now pauses for approval. The Runtime validated its `interaction-required` result against the output schema and failed the tool with `tool.invalid-output`; `denied`, `interaction-required` and `deferred` results are no longer validated.
|
|
68
|
+
|
|
3
69
|
## 0.6.0-beta
|
|
4
70
|
|
|
5
71
|
### Minor Changes
|
package/dist/compatibility.d.ts
CHANGED
|
@@ -6,8 +6,13 @@ export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
|
|
|
6
6
|
* Host features no client requires: a client that uses one checks the Host's `/health`
|
|
7
7
|
* for it first. `tenant-fixture-model`: `PUT /v1/tenant/config/seed` accepts
|
|
8
8
|
* `fixtureModel: true` (the Tenant's model calls use the Runtime's fixture model).
|
|
9
|
+
* `transcript-events`: the log carries `message.assistant` and `tool.completed`, and
|
|
10
|
+
* tool `action.*` events carry `callId` and `invocationId`. `derived-principals`:
|
|
11
|
+
* `POST /v1/admin/tenants` accepts `derivedPrincipals`. `subject-headers`: an application
|
|
12
|
+
* principal may act for a subject with `Nylorun-Subject` and `Nylorun-Scopes`, and the Runtime
|
|
13
|
+
* enforces the scopes and the subject's ownership of sessions and vaults.
|
|
9
14
|
*/
|
|
10
|
-
export declare const OPTIONAL_HOST_FEATURES: readonly ["tenant-fixture-model"];
|
|
15
|
+
export declare const OPTIONAL_HOST_FEATURES: readonly ["tenant-fixture-model", "transcript-events", "derived-principals", "subject-headers"];
|
|
11
16
|
export type OptionalHostFeature = (typeof OPTIONAL_HOST_FEATURES)[number];
|
|
12
17
|
export interface ProtocolRange {
|
|
13
18
|
min: number;
|
|
@@ -18,10 +23,16 @@ export declare const HOST_PROTOCOL: ProtocolRange;
|
|
|
18
23
|
export declare const DEFINITION_SCHEMA_VERSION = 2;
|
|
19
24
|
export declare const TENANT_HEADER = "Nylorun-Tenant";
|
|
20
25
|
export declare const PROTOCOL_HEADER = "Nylorun-Protocol";
|
|
21
|
-
|
|
26
|
+
/** The subject an application principal acts for (Host feature `subject-headers`). */
|
|
27
|
+
export declare const SUBJECT_HEADER = "Nylorun-Subject";
|
|
28
|
+
/** The space-separated scopes of that subject; required with `Nylorun-Subject`. */
|
|
29
|
+
export declare const SCOPES_HEADER = "Nylorun-Scopes";
|
|
30
|
+
export declare const ERROR_CODES: readonly ["not_found", "protocol_unsupported", "host_rejected", "origin_rejected", "unsupported_media_type", "tenant_conflict", "active_work", "connection_missing", "incompatible_host", "subject_invalid", "scope_required"];
|
|
22
31
|
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
23
32
|
export declare const TENANT_ID_PATTERN: RegExp;
|
|
24
33
|
export declare const PRINCIPAL_ID_PATTERN: RegExp;
|
|
34
|
+
/** A derived principal's id names its client, e.g. `babai`; `studio` is reserved. */
|
|
35
|
+
export declare const DERIVED_PRINCIPAL_ID_PATTERN: RegExp;
|
|
25
36
|
export declare function isTenantId(value: unknown): value is string;
|
|
26
37
|
export declare function isPrincipalId(value: unknown): value is string;
|
|
27
38
|
/**
|
package/dist/compatibility.js
CHANGED
|
@@ -9,8 +9,18 @@ export const PROTOCOL_FEATURES = [
|
|
|
9
9
|
* Host features no client requires: a client that uses one checks the Host's `/health`
|
|
10
10
|
* for it first. `tenant-fixture-model`: `PUT /v1/tenant/config/seed` accepts
|
|
11
11
|
* `fixtureModel: true` (the Tenant's model calls use the Runtime's fixture model).
|
|
12
|
+
* `transcript-events`: the log carries `message.assistant` and `tool.completed`, and
|
|
13
|
+
* tool `action.*` events carry `callId` and `invocationId`. `derived-principals`:
|
|
14
|
+
* `POST /v1/admin/tenants` accepts `derivedPrincipals`. `subject-headers`: an application
|
|
15
|
+
* principal may act for a subject with `Nylorun-Subject` and `Nylorun-Scopes`, and the Runtime
|
|
16
|
+
* enforces the scopes and the subject's ownership of sessions and vaults.
|
|
12
17
|
*/
|
|
13
|
-
export const OPTIONAL_HOST_FEATURES = [
|
|
18
|
+
export const OPTIONAL_HOST_FEATURES = [
|
|
19
|
+
"tenant-fixture-model",
|
|
20
|
+
"transcript-events",
|
|
21
|
+
"derived-principals",
|
|
22
|
+
"subject-headers",
|
|
23
|
+
];
|
|
14
24
|
export const HOST_PROTOCOL = {
|
|
15
25
|
min: 2,
|
|
16
26
|
max: 2,
|
|
@@ -19,6 +29,10 @@ export const HOST_PROTOCOL = {
|
|
|
19
29
|
export const DEFINITION_SCHEMA_VERSION = 2;
|
|
20
30
|
export const TENANT_HEADER = "Nylorun-Tenant";
|
|
21
31
|
export const PROTOCOL_HEADER = "Nylorun-Protocol";
|
|
32
|
+
/** The subject an application principal acts for (Host feature `subject-headers`). */
|
|
33
|
+
export const SUBJECT_HEADER = "Nylorun-Subject";
|
|
34
|
+
/** The space-separated scopes of that subject; required with `Nylorun-Subject`. */
|
|
35
|
+
export const SCOPES_HEADER = "Nylorun-Scopes";
|
|
22
36
|
export const ERROR_CODES = [
|
|
23
37
|
"not_found",
|
|
24
38
|
"protocol_unsupported",
|
|
@@ -29,11 +43,15 @@ export const ERROR_CODES = [
|
|
|
29
43
|
"active_work",
|
|
30
44
|
"connection_missing",
|
|
31
45
|
"incompatible_host",
|
|
46
|
+
"subject_invalid",
|
|
47
|
+
"scope_required",
|
|
32
48
|
];
|
|
33
49
|
/** Crockford Base32 alphabet (lowercase); excludes i, l, o, u. */
|
|
34
50
|
const CROCKFORD = "0123456789abcdefghjkmnpqrstvwxyz";
|
|
35
51
|
export const TENANT_ID_PATTERN = /^tn_[0-9a-hjkmnp-tv-z]{26}$/;
|
|
36
52
|
export const PRINCIPAL_ID_PATTERN = /^pr_[0-9a-hjkmnp-tv-z]{26}$/;
|
|
53
|
+
/** A derived principal's id names its client, e.g. `babai`; `studio` is reserved. */
|
|
54
|
+
export const DERIVED_PRINCIPAL_ID_PATTERN = /^[a-z][a-z0-9-]{0,31}$/;
|
|
37
55
|
export function isTenantId(value) {
|
|
38
56
|
return typeof value === "string" && TENANT_ID_PATTERN.test(value);
|
|
39
57
|
}
|
package/dist/contracts.d.ts
CHANGED
|
@@ -314,6 +314,8 @@ export declare const RejectedResponseSchema: z.ZodObject<{
|
|
|
314
314
|
not_found: "not_found";
|
|
315
315
|
origin_rejected: "origin_rejected";
|
|
316
316
|
protocol_unsupported: "protocol_unsupported";
|
|
317
|
+
scope_required: "scope_required";
|
|
318
|
+
subject_invalid: "subject_invalid";
|
|
317
319
|
tenant_conflict: "tenant_conflict";
|
|
318
320
|
unsupported_media_type: "unsupported_media_type";
|
|
319
321
|
}>;
|
|
@@ -492,6 +494,228 @@ export declare const ActionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
492
494
|
key: z.ZodString;
|
|
493
495
|
}, z.core.$strict>]>;
|
|
494
496
|
export type Action = z.infer<typeof ActionSchema>;
|
|
497
|
+
/** `message.assistant`: one completed model step. `invocationId` is the model call's. */
|
|
498
|
+
export declare const AssistantMessagePayloadSchema: z.ZodObject<{
|
|
499
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
500
|
+
id: z.ZodString;
|
|
501
|
+
path: z.ZodString;
|
|
502
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
503
|
+
}, z.core.$loose>>;
|
|
504
|
+
invocationId: z.ZodString;
|
|
505
|
+
text: z.ZodString;
|
|
506
|
+
toolCalls: z.ZodArray<z.ZodObject<{
|
|
507
|
+
callId: z.ZodString;
|
|
508
|
+
name: z.ZodString;
|
|
509
|
+
input: z.ZodUnknown;
|
|
510
|
+
}, z.core.$loose>>;
|
|
511
|
+
}, z.core.$loose>;
|
|
512
|
+
/** `tool.completed`: an MCP or sandbox tool the Runtime ran. `error` for a tool error. */
|
|
513
|
+
export declare const ToolCompletedPayloadSchema: z.ZodObject<{
|
|
514
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
515
|
+
id: z.ZodString;
|
|
516
|
+
path: z.ZodString;
|
|
517
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
518
|
+
}, z.core.$loose>>;
|
|
519
|
+
callId: z.ZodString;
|
|
520
|
+
invocationId: z.ZodString;
|
|
521
|
+
capabilityId: z.ZodString;
|
|
522
|
+
toolName: z.ZodString;
|
|
523
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
524
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
525
|
+
code: z.ZodString;
|
|
526
|
+
message: z.ZodString;
|
|
527
|
+
}, z.core.$loose>>;
|
|
528
|
+
}, z.core.$loose>;
|
|
529
|
+
export declare const ActionPendingPayloadSchema: z.ZodObject<{
|
|
530
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
531
|
+
id: z.ZodString;
|
|
532
|
+
path: z.ZodString;
|
|
533
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
534
|
+
}, z.core.$loose>>;
|
|
535
|
+
actionId: z.ZodString;
|
|
536
|
+
kind: z.ZodString;
|
|
537
|
+
toolName: z.ZodOptional<z.ZodString>;
|
|
538
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
539
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
540
|
+
input: z.ZodUnknown;
|
|
541
|
+
}, z.core.$loose>;
|
|
542
|
+
export declare const ActionCompletedPayloadSchema: z.ZodObject<{
|
|
543
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
544
|
+
id: z.ZodString;
|
|
545
|
+
path: z.ZodString;
|
|
546
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
547
|
+
}, z.core.$loose>>;
|
|
548
|
+
actionId: z.ZodString;
|
|
549
|
+
kind: z.ZodString;
|
|
550
|
+
toolName: z.ZodOptional<z.ZodString>;
|
|
551
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
552
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
553
|
+
result: z.ZodUnknown;
|
|
554
|
+
}, z.core.$loose>;
|
|
555
|
+
export declare const ActionUncertainPayloadSchema: z.ZodObject<{
|
|
556
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
557
|
+
id: z.ZodString;
|
|
558
|
+
path: z.ZodString;
|
|
559
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
560
|
+
}, z.core.$loose>>;
|
|
561
|
+
actionId: z.ZodString;
|
|
562
|
+
}, z.core.$loose>;
|
|
563
|
+
export declare const EffectUncertainPayloadSchema: z.ZodObject<{
|
|
564
|
+
effectId: z.ZodString;
|
|
565
|
+
message: z.ZodOptional<z.ZodString>;
|
|
566
|
+
}, z.core.$loose>;
|
|
567
|
+
export declare const TurnCompletedPayloadSchema: z.ZodObject<{
|
|
568
|
+
output: z.ZodUnknown;
|
|
569
|
+
}, z.core.$loose>;
|
|
570
|
+
export declare const TurnPausedPayloadSchema: z.ZodObject<{
|
|
571
|
+
interactions: z.ZodArray<z.ZodObject<{
|
|
572
|
+
invocationId: z.ZodString;
|
|
573
|
+
interaction: z.ZodObject<{
|
|
574
|
+
id: z.ZodString;
|
|
575
|
+
kind: z.ZodString;
|
|
576
|
+
}, z.core.$loose>;
|
|
577
|
+
status: z.ZodOptional<z.ZodString>;
|
|
578
|
+
}, z.core.$loose>>;
|
|
579
|
+
}, z.core.$loose>;
|
|
580
|
+
/** Either `{ error: { code, message } }` or, when a segment threw, `{ message }`. */
|
|
581
|
+
export declare const TurnFailedPayloadSchema: z.ZodObject<{
|
|
582
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
583
|
+
code: z.ZodOptional<z.ZodString>;
|
|
584
|
+
message: z.ZodOptional<z.ZodString>;
|
|
585
|
+
}, z.core.$loose>>;
|
|
586
|
+
message: z.ZodOptional<z.ZodString>;
|
|
587
|
+
}, z.core.$loose>;
|
|
588
|
+
export declare const TurnCancelledPayloadSchema: z.ZodObject<{
|
|
589
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
590
|
+
}, z.core.$loose>;
|
|
591
|
+
/** Lifecycle of an agent used as a tool. `agent.delegationId` is the parent call's invocation. */
|
|
592
|
+
export declare const DelegationPayloadSchema: z.ZodObject<{
|
|
593
|
+
agent: z.ZodObject<{
|
|
594
|
+
id: z.ZodString;
|
|
595
|
+
path: z.ZodString;
|
|
596
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
597
|
+
}, z.core.$loose>;
|
|
598
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
599
|
+
}, z.core.$loose>;
|
|
600
|
+
declare const TRANSCRIPT_PAYLOADS: {
|
|
601
|
+
readonly "message.assistant": z.ZodObject<{
|
|
602
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
603
|
+
id: z.ZodString;
|
|
604
|
+
path: z.ZodString;
|
|
605
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
606
|
+
}, z.core.$loose>>;
|
|
607
|
+
invocationId: z.ZodString;
|
|
608
|
+
text: z.ZodString;
|
|
609
|
+
toolCalls: z.ZodArray<z.ZodObject<{
|
|
610
|
+
callId: z.ZodString;
|
|
611
|
+
name: z.ZodString;
|
|
612
|
+
input: z.ZodUnknown;
|
|
613
|
+
}, z.core.$loose>>;
|
|
614
|
+
}, z.core.$loose>;
|
|
615
|
+
readonly "tool.completed": z.ZodObject<{
|
|
616
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
617
|
+
id: z.ZodString;
|
|
618
|
+
path: z.ZodString;
|
|
619
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
620
|
+
}, z.core.$loose>>;
|
|
621
|
+
callId: z.ZodString;
|
|
622
|
+
invocationId: z.ZodString;
|
|
623
|
+
capabilityId: z.ZodString;
|
|
624
|
+
toolName: z.ZodString;
|
|
625
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
626
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
627
|
+
code: z.ZodString;
|
|
628
|
+
message: z.ZodString;
|
|
629
|
+
}, z.core.$loose>>;
|
|
630
|
+
}, z.core.$loose>;
|
|
631
|
+
readonly "action.pending": z.ZodObject<{
|
|
632
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
633
|
+
id: z.ZodString;
|
|
634
|
+
path: z.ZodString;
|
|
635
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
636
|
+
}, z.core.$loose>>;
|
|
637
|
+
actionId: z.ZodString;
|
|
638
|
+
kind: z.ZodString;
|
|
639
|
+
toolName: z.ZodOptional<z.ZodString>;
|
|
640
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
641
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
642
|
+
input: z.ZodUnknown;
|
|
643
|
+
}, z.core.$loose>;
|
|
644
|
+
readonly "action.completed": z.ZodObject<{
|
|
645
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
646
|
+
id: z.ZodString;
|
|
647
|
+
path: z.ZodString;
|
|
648
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
649
|
+
}, z.core.$loose>>;
|
|
650
|
+
actionId: z.ZodString;
|
|
651
|
+
kind: z.ZodString;
|
|
652
|
+
toolName: z.ZodOptional<z.ZodString>;
|
|
653
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
654
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
655
|
+
result: z.ZodUnknown;
|
|
656
|
+
}, z.core.$loose>;
|
|
657
|
+
readonly "action.uncertain": z.ZodObject<{
|
|
658
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
659
|
+
id: z.ZodString;
|
|
660
|
+
path: z.ZodString;
|
|
661
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
662
|
+
}, z.core.$loose>>;
|
|
663
|
+
actionId: z.ZodString;
|
|
664
|
+
}, z.core.$loose>;
|
|
665
|
+
readonly "effect.uncertain": z.ZodObject<{
|
|
666
|
+
effectId: z.ZodString;
|
|
667
|
+
message: z.ZodOptional<z.ZodString>;
|
|
668
|
+
}, z.core.$loose>;
|
|
669
|
+
readonly "turn.completed": z.ZodObject<{
|
|
670
|
+
output: z.ZodUnknown;
|
|
671
|
+
}, z.core.$loose>;
|
|
672
|
+
readonly "turn.paused": z.ZodObject<{
|
|
673
|
+
interactions: z.ZodArray<z.ZodObject<{
|
|
674
|
+
invocationId: z.ZodString;
|
|
675
|
+
interaction: z.ZodObject<{
|
|
676
|
+
id: z.ZodString;
|
|
677
|
+
kind: z.ZodString;
|
|
678
|
+
}, z.core.$loose>;
|
|
679
|
+
status: z.ZodOptional<z.ZodString>;
|
|
680
|
+
}, z.core.$loose>>;
|
|
681
|
+
}, z.core.$loose>;
|
|
682
|
+
readonly "turn.failed": z.ZodObject<{
|
|
683
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
684
|
+
code: z.ZodOptional<z.ZodString>;
|
|
685
|
+
message: z.ZodOptional<z.ZodString>;
|
|
686
|
+
}, z.core.$loose>>;
|
|
687
|
+
message: z.ZodOptional<z.ZodString>;
|
|
688
|
+
}, z.core.$loose>;
|
|
689
|
+
readonly "turn.cancelled": z.ZodObject<{
|
|
690
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
691
|
+
}, z.core.$loose>;
|
|
692
|
+
readonly "delegation.started": z.ZodObject<{
|
|
693
|
+
agent: z.ZodObject<{
|
|
694
|
+
id: z.ZodString;
|
|
695
|
+
path: z.ZodString;
|
|
696
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
697
|
+
}, z.core.$loose>;
|
|
698
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
699
|
+
}, z.core.$loose>;
|
|
700
|
+
readonly "delegation.completed": z.ZodObject<{
|
|
701
|
+
agent: z.ZodObject<{
|
|
702
|
+
id: z.ZodString;
|
|
703
|
+
path: z.ZodString;
|
|
704
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
705
|
+
}, z.core.$loose>;
|
|
706
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
707
|
+
}, z.core.$loose>;
|
|
708
|
+
};
|
|
709
|
+
export type TranscriptEventType = keyof typeof TRANSCRIPT_PAYLOADS;
|
|
710
|
+
export declare const TRANSCRIPT_EVENT_TYPES: readonly TranscriptEventType[];
|
|
711
|
+
export type TranscriptEvent = {
|
|
712
|
+
[K in TranscriptEventType]: Omit<LiveEvent, "type" | "payload"> & {
|
|
713
|
+
type: K;
|
|
714
|
+
payload: z.infer<(typeof TRANSCRIPT_PAYLOADS)[K]>;
|
|
715
|
+
};
|
|
716
|
+
}[TranscriptEventType];
|
|
717
|
+
/** Types a transcript event's payload; `undefined` for other types or a malformed payload. */
|
|
718
|
+
export declare function parseTranscriptEvent(event: LiveEvent): TranscriptEvent | undefined;
|
|
495
719
|
export declare const ActionClaimRequestSchema: z.ZodObject<{
|
|
496
720
|
requestId: z.ZodString;
|
|
497
721
|
implementationVersion: z.ZodString;
|
|
@@ -758,6 +982,10 @@ export declare const CreateTenantRequestSchema: z.ZodObject<{
|
|
|
758
982
|
credentialHash: z.ZodString;
|
|
759
983
|
idempotencyKey: z.ZodString;
|
|
760
984
|
studioCredentialHash: z.ZodOptional<z.ZodString>;
|
|
985
|
+
derivedPrincipals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
986
|
+
id: z.ZodString;
|
|
987
|
+
credentialHash: z.ZodString;
|
|
988
|
+
}, z.core.$strict>>>;
|
|
761
989
|
}, z.core.$strict>;
|
|
762
990
|
export type CreateTenantRequest = z.infer<typeof CreateTenantRequestSchema>;
|
|
763
991
|
export declare const AdminTenantSchema: z.ZodObject<{
|
|
@@ -1043,3 +1271,22 @@ export declare const ResetTenantRequestSchema: z.ZodObject<{
|
|
|
1043
1271
|
}>;
|
|
1044
1272
|
}, z.core.$strict>;
|
|
1045
1273
|
export type ResetTenantRequest = z.infer<typeof ResetTenantRequestSchema>;
|
|
1274
|
+
/**
|
|
1275
|
+
* Acting for a subject (Host feature `subject-headers`): what an application principal may
|
|
1276
|
+
* narrow a request to. `sessions:own` and `vaults:own` reach only the subject's own sessions
|
|
1277
|
+
* and vaults; the others reach Tenant-wide resources.
|
|
1278
|
+
*/
|
|
1279
|
+
export declare const SUBJECT_SCOPES: readonly ["agents:read", "agents:write", "sessions:own", "vaults:own", "tenant:settings"];
|
|
1280
|
+
export type SubjectScope = (typeof SUBJECT_SCOPES)[number];
|
|
1281
|
+
/**
|
|
1282
|
+
* Validates `Nylorun-Subject` and `Nylorun-Scopes`. Returns the subject and its scopes, or a
|
|
1283
|
+
* message naming what is wrong. Scopes are required: the Runtime never grants a default.
|
|
1284
|
+
*/
|
|
1285
|
+
export declare function parseSubjectHeaders(subject: string, scopes: string | undefined): {
|
|
1286
|
+
ok: true;
|
|
1287
|
+
subject: string;
|
|
1288
|
+
scopes: ReadonlySet<SubjectScope>;
|
|
1289
|
+
} | {
|
|
1290
|
+
ok: false;
|
|
1291
|
+
message: string;
|
|
1292
|
+
};
|