@nylorun/agents 0.13.0-beta → 0.16.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 (50) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/README.md +220 -235
  3. package/dist/access.d.ts +6 -97
  4. package/dist/access.js +1 -103
  5. package/dist/ag-ui/handler.d.ts +3 -6
  6. package/dist/ag-ui/handler.js +2 -2
  7. package/dist/artifacts.d.ts +1 -1
  8. package/dist/files.d.ts +31 -0
  9. package/dist/files.js +60 -0
  10. package/dist/http.d.ts +6 -13
  11. package/dist/http.js +4 -16
  12. package/dist/index.d.ts +8 -16
  13. package/dist/index.js +4 -7
  14. package/dist/plugins/load.d.ts +3 -2
  15. package/dist/plugins/load.js +40 -100
  16. package/dist/plugins/plugin.d.ts +6 -1
  17. package/dist/plugins/plugin.js +20 -7
  18. package/dist/reads.d.ts +17 -0
  19. package/dist/reads.js +17 -0
  20. package/dist/sandboxes.d.ts +29 -0
  21. package/dist/sandboxes.js +10 -1
  22. package/dist/session-client.d.ts +94 -112
  23. package/dist/session-client.js +80 -107
  24. package/dist/skills/index.d.ts +1 -1
  25. package/dist/skills/load.d.ts +14 -3
  26. package/dist/skills/load.js +50 -32
  27. package/dist/skills/skills.d.ts +6 -4
  28. package/dist/skills/skills.js +17 -10
  29. package/dist/sse.js +1 -1
  30. package/dist/studio-embed.d.ts +1 -1
  31. package/dist/studio-embed.js +1 -1
  32. package/package.json +3 -7
  33. package/dist/action-handler.d.ts +0 -63
  34. package/dist/action-handler.js +0 -279
  35. package/dist/browser.d.ts +0 -104
  36. package/dist/browser.js +0 -281
  37. package/dist/delivery-token.d.ts +0 -62
  38. package/dist/delivery-token.js +0 -159
  39. package/dist/execute-action.d.ts +0 -16
  40. package/dist/execute-action.js +0 -288
  41. package/dist/plugins/launch.d.ts +0 -17
  42. package/dist/plugins/launch.js +0 -71
  43. package/dist/sandbox/client.d.ts +0 -63
  44. package/dist/sandbox/client.js +0 -29
  45. package/dist/sandbox/index.d.ts +0 -2
  46. package/dist/sandbox/index.js +0 -1
  47. package/dist/served-definitions.d.ts +0 -20
  48. package/dist/served-definitions.js +0 -100
  49. package/dist/token-endpoint.d.ts +0 -23
  50. package/dist/token-endpoint.js +0 -30
package/dist/access.d.ts CHANGED
@@ -1,105 +1,14 @@
1
1
  /**
2
- * Subject tokens and access management for app servers (Host feature `subject-tokens`), on the
3
- * application key. `client.tokens.create` mints a short-lived token for one signed-in person;
4
- * `client.access` manages the policy that decides what each role may do, the signing keys and
5
- * revocations. Each call checks the Host feature before sending anything.
2
+ * The Tenant's public keys, which verify the tokens it signs (capability links, run tokens).
3
+ * Listing, rotating and revoking signing keys is the Management API's (`admin.signingKeys` in
4
+ * `@nylorun/admin`, protocol 8).
6
5
  */
7
- import type { AccessPolicy, CreateTokenResponse, Jwks, PublishableKey, SigningKeyView, TokenScope } from "@nylorun/core/contracts";
8
- import { type Transport } from "./http.js";
9
- export interface CreateTokenOptions {
10
- /** The person the token is for, e.g. `app:42`. */
11
- subject: string;
12
- /** A role of the Tenant's access policy. */
13
- role: string;
14
- /** Narrow the role's scopes. Default: all of the role's scopes. */
15
- scopes?: readonly TokenScope[];
16
- /** Narrow the role's agents. Default: all of the role's agents. */
17
- agents?: readonly string[];
18
- /**
19
- * The sandboxes the token reaches (its `sbx` claim): exact ids, or prefixes ending in `/*`
20
- * (`team-a/*`). Default: none (Host feature `sandboxes`).
21
- */
22
- sandboxes?: readonly string[];
23
- /** 60 to 900 seconds, at most the policy's `maxTtlSeconds`. Default: that maximum. */
24
- ttlSeconds?: number;
25
- signal?: AbortSignal;
26
- }
27
- export declare class TokensClient {
28
- private readonly transport;
29
- constructor(transport: Transport);
30
- /** Mints a subject token. Only the application key may; never acting for a subject. */
31
- create(options: CreateTokenOptions): Promise<CreateTokenResponse>;
32
- }
33
- export declare class SigningKeysClient {
34
- private readonly transport;
35
- constructor(transport: Transport);
36
- list(options?: {
37
- signal?: AbortSignal;
38
- }): Promise<SigningKeyView[]>;
39
- /**
40
- * standby → current → previous → revoked, and a new standby. Refused while the previous key
41
- * may still verify live tokens; `force` skips that and signs those tokens out.
42
- */
43
- rotate(options?: {
44
- force?: boolean;
45
- signal?: AbortSignal;
46
- }): Promise<SigningKeyView[]>;
47
- /** Revokes a previous or standby key; the current key must be rotated first. */
48
- revoke(keyId: string, options?: {
49
- signal?: AbortSignal;
50
- }): Promise<SigningKeyView>;
51
- }
52
- /**
53
- * Publishable keys (Host feature `browser-access`): shipped in a web page or an app, they name
54
- * the Tenant and the app, and list the origins a browser may use them from.
55
- */
56
- export declare class PublishableKeysClient {
57
- private readonly transport;
58
- constructor(transport: Transport);
59
- list(options?: {
60
- signal?: AbortSignal;
61
- }): Promise<PublishableKey[]>;
62
- /**
63
- * A new key. `origins` are exact origins (`https://app.example.com`) or
64
- * `http://localhost:*`; `[]` allows native apps only.
65
- */
66
- create(options: {
67
- name: string;
68
- origins: readonly string[];
69
- signal?: AbortSignal;
70
- }): Promise<PublishableKey>;
71
- /** Replaces the key's origins. */
72
- update(keyId: string, options: {
73
- origins: readonly string[];
74
- signal?: AbortSignal;
75
- }): Promise<PublishableKey>;
76
- /** Revokes the key: every request that sends it gets the opaque 404. */
77
- revoke(keyId: string, options?: {
78
- signal?: AbortSignal;
79
- }): Promise<PublishableKey>;
80
- }
6
+ import type { Jwks } from "@nylorun/core/contracts";
7
+ import type { Transport } from "./http.js";
81
8
  export declare class AccessClient {
82
9
  private readonly transport;
83
- readonly signingKeys: SigningKeysClient;
84
- readonly publishableKeys: PublishableKeysClient;
85
10
  constructor(transport: Transport);
86
- getPolicy(options?: {
87
- signal?: AbortSignal;
88
- }): Promise<AccessPolicy>;
89
- putPolicy(policy: AccessPolicy, options?: {
90
- signal?: AbortSignal;
91
- }): Promise<AccessPolicy>;
92
- /**
93
- * Ends every token minted so far for `subject` and its open streams. Running turns continue;
94
- * cancel them separately if they must stop.
95
- */
96
- revokeSubject(subject: string, options?: {
97
- signal?: AbortSignal;
98
- }): Promise<{
99
- subject: string;
100
- epoch: number;
101
- }>;
102
- /** The public keys that verify the Tenant's subject tokens. */
11
+ /** The public keys that verify the tokens the Tenant signs. */
103
12
  jwks(options?: {
104
13
  signal?: AbortSignal;
105
14
  }): Promise<Jwks>;
package/dist/access.js CHANGED
@@ -1,112 +1,10 @@
1
- import { id, segment } from "./http.js";
2
- const FEATURE = "subject-tokens";
3
- export class TokensClient {
4
- transport;
5
- constructor(transport) {
6
- this.transport = transport;
7
- }
8
- /** Mints a subject token. Only the application key may; never acting for a subject. */
9
- async create(options) {
10
- await this.transport.requireFeature(FEATURE, options.signal);
11
- return this.transport.json("/v1/tokens", "POST", {
12
- requestId: id(),
13
- subject: options.subject,
14
- role: options.role,
15
- ...(options.scopes ? { scopes: [...options.scopes] } : {}),
16
- ...(options.agents ? { agents: [...options.agents] } : {}),
17
- ...(options.sandboxes ? { sandboxes: [...options.sandboxes] } : {}),
18
- ...(options.ttlSeconds === undefined ? {} : { ttlSeconds: options.ttlSeconds }),
19
- }, options.signal);
20
- }
21
- }
22
- export class SigningKeysClient {
23
- transport;
24
- constructor(transport) {
25
- this.transport = transport;
26
- }
27
- async list(options = {}) {
28
- await this.transport.requireFeature(FEATURE, options.signal);
29
- const reply = await this.transport.json("/v1/access/signing-keys", "GET", undefined, options.signal);
30
- return reply.keys;
31
- }
32
- /**
33
- * standby → current → previous → revoked, and a new standby. Refused while the previous key
34
- * may still verify live tokens; `force` skips that and signs those tokens out.
35
- */
36
- async rotate(options = {}) {
37
- await this.transport.requireFeature(FEATURE, options.signal);
38
- const reply = await this.transport.json("/v1/access/signing-keys/rotate", "POST", { requestId: id(), ...(options.force ? { force: true } : {}) }, options.signal);
39
- return reply.keys;
40
- }
41
- /** Revokes a previous or standby key; the current key must be rotated first. */
42
- async revoke(keyId, options = {}) {
43
- await this.transport.requireFeature(FEATURE, options.signal);
44
- return this.transport.json(`/v1/access/signing-keys/${segment(keyId)}/revoke`, "POST", { requestId: id() }, options.signal);
45
- }
46
- }
47
- /**
48
- * Publishable keys (Host feature `browser-access`): shipped in a web page or an app, they name
49
- * the Tenant and the app, and list the origins a browser may use them from.
50
- */
51
- export class PublishableKeysClient {
52
- transport;
53
- constructor(transport) {
54
- this.transport = transport;
55
- }
56
- async list(options = {}) {
57
- await this.transport.requireFeature("browser-access", options.signal);
58
- const reply = await this.transport.json("/v1/access/publishable-keys", "GET", undefined, options.signal);
59
- return reply.keys;
60
- }
61
- /**
62
- * A new key. `origins` are exact origins (`https://app.example.com`) or
63
- * `http://localhost:*`; `[]` allows native apps only.
64
- */
65
- async create(options) {
66
- await this.transport.requireFeature("browser-access", options.signal);
67
- return this.transport.json("/v1/access/publishable-keys", "POST", { requestId: id(), name: options.name, origins: [...options.origins] }, options.signal);
68
- }
69
- /** Replaces the key's origins. */
70
- async update(keyId, options) {
71
- await this.transport.requireFeature("browser-access", options.signal);
72
- return this.transport.json(`/v1/access/publishable-keys/${segment(keyId)}`, "PUT", { requestId: id(), origins: [...options.origins] }, options.signal);
73
- }
74
- /** Revokes the key: every request that sends it gets the opaque 404. */
75
- async revoke(keyId, options = {}) {
76
- await this.transport.requireFeature("browser-access", options.signal);
77
- return this.transport.json(`/v1/access/publishable-keys/${segment(keyId)}`, "DELETE", undefined, options.signal);
78
- }
79
- }
80
1
  export class AccessClient {
81
2
  transport;
82
- signingKeys;
83
- publishableKeys;
84
3
  constructor(transport) {
85
4
  this.transport = transport;
86
- this.signingKeys = new SigningKeysClient(transport);
87
- this.publishableKeys = new PublishableKeysClient(transport);
88
- }
89
- async getPolicy(options = {}) {
90
- await this.transport.requireFeature(FEATURE, options.signal);
91
- const reply = await this.transport.json("/v1/access/policy", "GET", undefined, options.signal);
92
- return reply.policy;
93
- }
94
- async putPolicy(policy, options = {}) {
95
- await this.transport.requireFeature(FEATURE, options.signal);
96
- const reply = await this.transport.json("/v1/access/policy", "PUT", { requestId: id(), policy }, options.signal);
97
- return reply.policy;
98
- }
99
- /**
100
- * Ends every token minted so far for `subject` and its open streams. Running turns continue;
101
- * cancel them separately if they must stop.
102
- */
103
- async revokeSubject(subject, options = {}) {
104
- await this.transport.requireFeature(FEATURE, options.signal);
105
- return this.transport.json("/v1/access/revocations", "POST", { requestId: id(), subject }, options.signal);
106
5
  }
107
- /** The public keys that verify the Tenant's subject tokens. */
6
+ /** The public keys that verify the tokens the Tenant signs. */
108
7
  async jwks(options = {}) {
109
- await this.transport.requireFeature(FEATURE, options.signal);
110
8
  return this.transport.json("/v1/access/jwks", "GET", undefined, options.signal);
111
9
  }
112
10
  }
@@ -5,8 +5,8 @@
5
5
  * person, so the Runtime keeps one person out of another's threads and does all the protocol
6
6
  * work. The browser never sees the Tenant key, the Runtime's URL or the Tenant id.
7
7
  *
8
- * The same threads are reachable directly from a browser with a subject token: each thread is
9
- * one session per subject, agent and thread on both paths.
8
+ * The same threads are reachable directly from a browser with a trusted issuer's token (through
9
+ * the operator's proxy): each thread is one session per subject, agent and thread on both paths.
10
10
  */
11
11
  import { type SubjectScope } from "@nylorun/core/contracts";
12
12
  import type { BuiltWorkflow } from "@nylorun/core/define";
@@ -27,10 +27,7 @@ export interface AgUiHandlerOptions {
27
27
  basePath?: string;
28
28
  /** Application client. Default: `createClient()`, from the environment or the Project link. */
29
29
  client?: AgentsClient | Promise<AgentsClient>;
30
- /**
31
- * What each subject may do through this endpoint. Default `["sessions:own"]`; add
32
- * `vaults:own` if `session()` attaches the person's vaults.
33
- */
30
+ /** What each subject may do through this endpoint. Default `["sessions:own"]`. */
34
31
  scopes?: readonly SubjectScope[];
35
32
  /** Optional per-session parameters, e.g. the person's vault for connected accounts. */
36
33
  session?(subject: string, agentId: string): AgUiSessionOptions | Promise<AgUiSessionOptions>;
@@ -5,8 +5,8 @@
5
5
  * person, so the Runtime keeps one person out of another's threads and does all the protocol
6
6
  * work. The browser never sees the Tenant key, the Runtime's URL or the Tenant id.
7
7
  *
8
- * The same threads are reachable directly from a browser with a subject token: each thread is
9
- * one session per subject, agent and thread on both paths.
8
+ * The same threads are reachable directly from a browser with a trusted issuer's token (through
9
+ * the operator's proxy): each thread is one session per subject, agent and thread on both paths.
10
10
  */
11
11
  import { parseSubjectHeaders } from "@nylorun/core/contracts";
12
12
  import { createClient, } from "../client.js";
@@ -9,7 +9,7 @@
9
9
  * session's sandbox as a version of its `outputs` folder. Read one as a tree, one file by path,
10
10
  * a diff between versions or a zip.
11
11
  *
12
- * Acting for a person (`client.as`, a subject token), only the artifacts of their own sessions.
12
+ * Acting for a person (`client.as`, or a trusted issuer's token), only the artifacts of their own sessions.
13
13
  */
14
14
  import type { ArtifactDiff, ArtifactLink, ArtifactTree, ArtifactView, DeleteArtifactResponse, UploadArtifactResponse } from "@nylorun/core/contracts";
15
15
  import { type Transport } from "./http.js";
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Definition files (track R2 M4): `client.files`. A definition names the files it needs by the
3
+ * SHA-256 of their bytes (a skill's folder, `SkillManifest.files`); the Runtime holds each one
4
+ * once, uploaded with `PUT /v1/files/sha256:<hex>`, and refuses a definition naming a file it
5
+ * does not hold (`400 definition_files_missing`). `saveAgent` uploads an agent's files itself.
6
+ */
7
+ import { type DefinitionFileView } from "@nylorun/core/contracts";
8
+ import type { SkillFileSource } from "@nylorun/core/define";
9
+ import { type Transport } from "./http.js";
10
+ /** `sha256:<hex>` of `bytes`. */
11
+ export declare function definitionFileHash(bytes: Uint8Array): Promise<string>;
12
+ export declare class FilesClient {
13
+ private readonly transport;
14
+ constructor(transport: Transport);
15
+ /** Whether the Runtime holds the file `sha256` (`sha256:<hex>`) names. */
16
+ has(sha256: string, options?: {
17
+ signal?: AbortSignal;
18
+ }): Promise<boolean>;
19
+ /**
20
+ * Uploads one file, at most 10 MiB. The Runtime checks its bytes hash to `sha256` (default:
21
+ * their hash) and keeps a file it already holds as it is.
22
+ */
23
+ upload(bytes: Uint8Array, options?: {
24
+ sha256?: string;
25
+ signal?: AbortSignal;
26
+ }): Promise<DefinitionFileView>;
27
+ /** Uploads each of `files` the Runtime does not hold yet. */
28
+ ensure(files: ReadonlyMap<string, SkillFileSource>, options?: {
29
+ signal?: AbortSignal;
30
+ }): Promise<void>;
31
+ }
package/dist/files.js ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Definition files (track R2 M4): `client.files`. A definition names the files it needs by the
3
+ * SHA-256 of their bytes (a skill's folder, `SkillManifest.files`); the Runtime holds each one
4
+ * once, uploaded with `PUT /v1/files/sha256:<hex>`, and refuses a definition naming a file it
5
+ * does not hold (`400 definition_files_missing`). `saveAgent` uploads an agent's files itself.
6
+ */
7
+ import { isDefinitionFileHash, } from "@nylorun/core/contracts";
8
+ import { RuntimeError } from "./http.js";
9
+ /** `sha256:<hex>` of `bytes`. */
10
+ export async function definitionFileHash(bytes) {
11
+ const digest = new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", bytes));
12
+ return `sha256:${[...digest].map((byte) => byte.toString(16).padStart(2, "0")).join("")}`;
13
+ }
14
+ function pathOf(sha256) {
15
+ if (!isDefinitionFileHash(sha256))
16
+ throw new TypeError(`${sha256} is not a definition file's hash: sha256:<64 lowercase hex>`);
17
+ return `/v1/files/${sha256}`;
18
+ }
19
+ export class FilesClient {
20
+ transport;
21
+ constructor(transport) {
22
+ this.transport = transport;
23
+ }
24
+ /** Whether the Runtime holds the file `sha256` (`sha256:<hex>`) names. */
25
+ async has(sha256, options = {}) {
26
+ try {
27
+ await this.transport.request(pathOf(sha256), {
28
+ method: "HEAD",
29
+ ...(options.signal ? { signal: options.signal } : {}),
30
+ });
31
+ return true;
32
+ }
33
+ catch (error) {
34
+ if (error instanceof RuntimeError && error.status === 404)
35
+ return false;
36
+ throw error;
37
+ }
38
+ }
39
+ /**
40
+ * Uploads one file, at most 10 MiB. The Runtime checks its bytes hash to `sha256` (default:
41
+ * their hash) and keeps a file it already holds as it is.
42
+ */
43
+ async upload(bytes, options = {}) {
44
+ const response = await this.transport.request(pathOf(options.sha256 ?? (await definitionFileHash(bytes))), {
45
+ method: "PUT",
46
+ body: bytes,
47
+ headers: { "content-type": "application/octet-stream" },
48
+ ...(options.signal ? { signal: options.signal } : {}),
49
+ });
50
+ return (await response.json());
51
+ }
52
+ /** Uploads each of `files` the Runtime does not hold yet. */
53
+ async ensure(files, options = {}) {
54
+ for (const [sha256, source] of files) {
55
+ if (await this.has(sha256, options))
56
+ continue;
57
+ await this.upload(await source.read(), { sha256, ...options });
58
+ }
59
+ }
60
+ }
package/dist/http.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { type Compatibility, type ProtocolRange } from "@nylorun/core/compatibility";
2
2
  /**
3
- * Subject tokens for a client that holds no Tenant key (a browser or an app; Host feature
4
- * `subject-tokens`). `get` returns a current token and may fetch a new one; `invalidate`
5
- * drops the cached one after the Runtime answered `401 token_expired`.
3
+ * Bearer tokens for a client that holds no Tenant key: a trusted issuer's tokens (Host feature
4
+ * `trusted-issuers`), from the operator's identity provider. `get` returns a current token and
5
+ * may fetch a new one; `invalidate` drops the cached one after the Runtime answered
6
+ * `401 token_expired`.
6
7
  */
7
8
  export interface TokenSource {
8
9
  get(signal?: AbortSignal): Promise<string>;
@@ -16,10 +17,8 @@ export interface Destination {
16
17
  url?: string;
17
18
  key?: string;
18
19
  fetch?: typeof fetch;
19
- /** Instead of `key`: subject tokens. The client then skips the `/health` check. */
20
+ /** Instead of `key`: a trusted issuer's tokens. The client then skips the `/health` check. */
20
21
  token?: TokenSource;
21
- /** A publishable key (Host feature `browser-access`): names the app and its origins. */
22
- publishableKey?: string;
23
22
  }
24
23
  export declare function env(name: string): string | undefined;
25
24
  export declare class RuntimeError extends Error {
@@ -39,10 +38,9 @@ export declare class IncompatibleRuntimeError extends Error {
39
38
  }
40
39
  export declare class Transport {
41
40
  readonly url: string;
42
- /** The Tenant key; empty for a client that uses subject tokens. */
41
+ /** The Tenant key; empty for a client that uses issuer tokens. */
43
42
  readonly key: string;
44
43
  readonly token: TokenSource | undefined;
45
- readonly publishableKey: string | undefined;
46
44
  readonly fetcher: typeof fetch;
47
45
  /** Sent on every request, e.g. `Nylorun-Subject` and `Nylorun-Scopes` (`withHeaders`). */
48
46
  readonly headers: Readonly<Record<string, string>>;
@@ -53,11 +51,6 @@ export declare class Transport {
53
51
  * transport's compatibility check, so a copy made per request does not repeat `/health`.
54
52
  */
55
53
  withHeaders(headers: Readonly<Record<string, string>>): Transport;
56
- /**
57
- * The same destination with another bearer (a delivery token for an Action endpoint's
58
- * callbacks). Like `withHeaders`, the copy shares this transport's compatibility check.
59
- */
60
- withKey(key: string): Transport;
61
54
  /** Clears the cached Host compatibility result (used after a 426). */
62
55
  clearCompatibilityCache(): void;
63
56
  private ensureCompatible;
package/dist/http.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PROTOCOL_FEATURES, PROTOCOL_HEADER, PROTOCOL_VERSION, PUBLISHABLE_KEY_HEADER, checkCompatibility, } from "@nylorun/core/compatibility";
1
+ import { PROTOCOL_FEATURES, PROTOCOL_HEADER, PROTOCOL_VERSION, checkCompatibility, } from "@nylorun/core/compatibility";
2
2
  export function env(name) {
3
3
  return typeof process !== "undefined" ? process.env[name] : undefined;
4
4
  }
@@ -54,10 +54,9 @@ function parseProtocolRange(value) {
54
54
  }
55
55
  export class Transport {
56
56
  url;
57
- /** The Tenant key; empty for a client that uses subject tokens. */
57
+ /** The Tenant key; empty for a client that uses issuer tokens. */
58
58
  key;
59
59
  token;
60
- publishableKey;
61
60
  fetcher;
62
61
  /** Sent on every request, e.g. `Nylorun-Subject` and `Nylorun-Scopes` (`withHeaders`). */
63
62
  headers = {};
@@ -69,14 +68,13 @@ export class Transport {
69
68
  if (!url || (!token && !key))
70
69
  throw new Error("Set Runtime url and server key explicitly or via NYLORUN_RUNTIME_URL / NYLORUN_SERVER_KEY");
71
70
  if (token && options.key)
72
- throw new Error("Use a Tenant key or subject tokens, not both");
71
+ throw new Error("Use a Tenant key or issuer tokens, not both");
73
72
  const parsed = new URL(url);
74
73
  if (!["http:", "https:"].includes(parsed.protocol))
75
74
  throw new Error("Runtime requires an HTTP(S) URL");
76
75
  this.url = url.replace(/\/$/, "");
77
76
  this.key = key;
78
77
  this.token = token;
79
- this.publishableKey = options.publishableKey;
80
78
  // Browsers may not call `/health` (it refuses `Origin`); token clients rely on `426`.
81
79
  if (token)
82
80
  this.check.compatible = true;
@@ -94,14 +92,6 @@ export class Transport {
94
92
  headers: Object.freeze({ ...this.headers, ...headers }),
95
93
  });
96
94
  }
97
- /**
98
- * The same destination with another bearer (a delivery token for an Action endpoint's
99
- * callbacks). Like `withHeaders`, the copy shares this transport's compatibility check.
100
- */
101
- withKey(key) {
102
- const copy = Object.create(Transport.prototype);
103
- return Object.assign(copy, this, { key });
104
- }
105
95
  /** Clears the cached Host compatibility result (used after a 426). */
106
96
  clearCompatibilityCache() {
107
97
  this.check.compatible = false;
@@ -165,8 +155,6 @@ export class Transport {
165
155
  ? await this.token.get(init.signal ?? undefined)
166
156
  : this.key;
167
157
  headers.set("Authorization", `Bearer ${bearer}`);
168
- if (this.publishableKey)
169
- headers.set(PUBLISHABLE_KEY_HEADER, this.publishableKey);
170
158
  headers.set(PROTOCOL_HEADER, String(PROTOCOL_VERSION));
171
159
  // JSON unless the caller says otherwise (an artifact upload sends the file's type).
172
160
  if (init.body && !headers.has("content-type"))
@@ -180,7 +168,7 @@ export class Transport {
180
168
  headers: await this.authHeaders(init),
181
169
  redirect: "error",
182
170
  });
183
- // An expired or revoked subject token: get a new one and try once more.
171
+ // An expired token: get a new one and try once more.
184
172
  if (response.status === 401 && this.token && !options.retried401) {
185
173
  const body = (await response.clone().json().catch(() => undefined));
186
174
  if (body?.code === "token_expired") {
package/dist/index.d.ts CHANGED
@@ -1,23 +1,18 @@
1
- export { hashManifest, PROTOCOL_VERSION, PROTOCOL_FEATURES, HOST_PROTOCOL, DEFINITION_SCHEMA_VERSION, PROTOCOL_HEADER, SUBJECT_HEADER, SCOPES_HEADER, TENANT_ID_PATTERN, isTenantId, newTenantId, newPrincipalId, checkCompatibility, compareVersions, ERROR_CODES, } from "@nylorun/core/compatibility";
1
+ export { hashManifest, PROTOCOL_VERSION, PROTOCOL_FEATURES, HOST_PROTOCOL, DEFINITION_SCHEMA_VERSION, PROTOCOL_HEADER, SUBJECT_HEADER, SCOPES_HEADER, SESSION_ID_HEADER, TURN_ID_HEADER, AGENT_ID_HEADER, TENANT_ID_PATTERN, isTenantId, newTenantId, newPrincipalId, checkCompatibility, compareVersions, ERROR_CODES, } from "@nylorun/core/compatibility";
2
2
  export type { ProtocolFeature, ProtocolRange, Compatibility, ErrorCode, } from "@nylorun/core/compatibility";
3
3
  export { Agent, AgentBuilder } from "./builder.js";
4
- export { AgentBuildError, AgentLifecycleError, Loop, Chain, Switch, Parallel, Map, VerdictSchema, isVerdict, withInstructions, withoutTools, WorkflowBuildError, isBuiltWorkflow, capability, CapabilityBuilder, flow, tool, defineSchema, ToolError, } from "@nylorun/core/define";
5
- export type { FlowAgentBuilder, Flow, Named, StageArgs, NestedStageArgs, CapabilityIdentity, } from "@nylorun/core/define";
6
- export type { AgentOptions, AgentManifest, BuiltAgent, BuiltWorkflow, LoopOptions, LoopDecideArgs, LoopVerifyArgs, LoopDecision, ChainOptions, SwitchOptions, ParallelOptions, MapOptions, Verdict, WorkflowBinding, WorkflowManifest, ToolDefinition, ToolExecutionContext, ToolOutcome, Patch, Decision, TurnDecision, HookScope, BeforeHook, AfterHook, JsonValue, JsonObject, } from "@nylorun/core/define";
7
- export type { LiveEvent, SessionEvent, SessionEventOf, EventType, SessionCommand, Action, ActionOutcome, CredentialInfo, CredentialSelection, VaultInfo, SubjectScope, SandboxView, SandboxEvent, SandboxKind, MessagePart, ArtifactView, ArtifactVersionView, ArtifactLink, UploadArtifactResponse, ArtifactTree, ArtifactDiff, FolderEntry, } from "@nylorun/core/contracts";
4
+ export { AgentBuildError, AgentLifecycleError, VerdictSchema, isVerdict, WorkflowBuildError, isBuiltWorkflow, capability, CapabilityBuilder, flow, tool, http, defineSchema, ToolError, } from "@nylorun/core/define";
5
+ export type { FlowAgentBuilder, Flow, Named, LoopOptions, StageOptions, CapabilityIdentity, HttpTarget, } from "@nylorun/core/define";
6
+ export type { AgentOptions, AgentManifest, BuiltAgent, BuiltWorkflow, Verdict, WorkflowBinding, WorkflowManifest, ToolDefinition, ToolExecutionContext, ToolOutcome, JsonValue, JsonObject, } from "@nylorun/core/define";
7
+ export type { SessionPage, SessionListItem, SessionManifestView, HistoryPage, SessionUsageTotals, ModelCall, ModelCallsPage, SandboxPage, LiveEvent, SessionEvent, SessionEventOf, EventType, SessionCommand, CredentialInfo, CredentialSelection, VaultInfo, SubjectScope, SandboxView, SandboxEvent, SandboxKind, MessagePart, ArtifactView, ArtifactVersionView, ArtifactLink, UploadArtifactResponse, DefinitionFileView, ArtifactTree, ArtifactDiff, FolderEntry, } from "@nylorun/core/contracts";
8
8
  export { SUBJECT_SCOPES } from "@nylorun/core/contracts";
9
9
  export { AgentsClient, SessionClient, createClient } from "./client.js";
10
10
  export { ArtifactsClient } from "./artifacts.js";
11
+ export { FilesClient, definitionFileHash } from "./files.js";
11
12
  export type { ArtifactBody, ArtifactLinkWithUrl, UploadArtifactOptions, } from "./artifacts.js";
12
13
  export type { ActAsOptions, AgentSource, SessionView, CommandOptions, CreateSessionOptions, SessionSandbox, ForSessionOptions, SandboxSpec, SessionSandboxHandle, } from "./client.js";
13
14
  export { SandboxesClient } from "./client.js";
14
- export { AccessClient, PublishableKeysClient, SigningKeysClient, TokensClient, } from "./access.js";
15
- export type { CreateTokenOptions } from "./access.js";
16
- export { createTokenEndpoint } from "./token-endpoint.js";
17
- export type { TokenEndpointOptions } from "./token-endpoint.js";
18
- export { createActionHandler } from "./action-handler.js";
19
- export type { ActionHandler, ActionHandlerOptions, RegisterOptions, } from "./action-handler.js";
20
- export type { ExecuteActionOptions, ExecutableDefinition, } from "./execute-action.js";
15
+ export { AccessClient } from "./access.js";
21
16
  export { resolveConnection, ConnectionError } from "./connection.js";
22
17
  export type { ResolvedConnection } from "./connection.js";
23
18
  export { RuntimeError, IncompatibleRuntimeError } from "./http.js";
@@ -26,11 +21,8 @@ export { plugin } from "./plugins/plugin.js";
26
21
  export type { PluginCapability } from "./plugins/plugin.js";
27
22
  export { loadPlugin, PluginError } from "./plugins/load.js";
28
23
  export type { LoadedPlugin, PluginDiagnostic } from "./plugins/load.js";
29
- export { prepareStdioLaunch, expandPluginPlaceholders } from "./plugins/launch.js";
30
- export type { StdioLaunch } from "./plugins/launch.js";
31
24
  export { skills, loadSkillsFromDirectory, resolveSkillsRoot, parseSkill, SkillsError, formatSkillCatalog, SKILLS_USAGE, } from "./skills/index.js";
32
25
  export type { SkillsCapability, SkillsOptions, SkillDiagnostic, } from "./skills/index.js";
33
26
  export { mcp, McpError } from "./mcp/index.js";
34
27
  export type { McpCapability, McpOptions, McpServerSpec } from "./mcp/index.js";
35
- export type { ActionSandbox, ActionSandboxToolResult, CreateActionSandboxOptions, } from "./sandbox/index.js";
36
- export { createActionSandbox, definitionDeclaresSandbox, isActionSandboxTool, } from "./sandbox/index.js";
28
+ export type { SessionPageOptions } from "./reads.js";
package/dist/index.js CHANGED
@@ -1,19 +1,16 @@
1
1
  // Definition authoring and wire contracts are the only harness runtime imports.
2
- export { hashManifest, PROTOCOL_VERSION, PROTOCOL_FEATURES, HOST_PROTOCOL, DEFINITION_SCHEMA_VERSION, PROTOCOL_HEADER, SUBJECT_HEADER, SCOPES_HEADER, TENANT_ID_PATTERN, isTenantId, newTenantId, newPrincipalId, checkCompatibility, compareVersions, ERROR_CODES, } from "@nylorun/core/compatibility";
2
+ export { hashManifest, PROTOCOL_VERSION, PROTOCOL_FEATURES, HOST_PROTOCOL, DEFINITION_SCHEMA_VERSION, PROTOCOL_HEADER, SUBJECT_HEADER, SCOPES_HEADER, SESSION_ID_HEADER, TURN_ID_HEADER, AGENT_ID_HEADER, TENANT_ID_PATTERN, isTenantId, newTenantId, newPrincipalId, checkCompatibility, compareVersions, ERROR_CODES, } from "@nylorun/core/compatibility";
3
3
  export { Agent, AgentBuilder } from "./builder.js";
4
- export { AgentBuildError, AgentLifecycleError, Loop, Chain, Switch, Parallel, Map, VerdictSchema, isVerdict, withInstructions, withoutTools, WorkflowBuildError, isBuiltWorkflow, capability, CapabilityBuilder, flow, tool, defineSchema, ToolError, } from "@nylorun/core/define";
4
+ export { AgentBuildError, AgentLifecycleError, VerdictSchema, isVerdict, WorkflowBuildError, isBuiltWorkflow, capability, CapabilityBuilder, flow, tool, http, defineSchema, ToolError, } from "@nylorun/core/define";
5
5
  export { SUBJECT_SCOPES } from "@nylorun/core/contracts";
6
6
  export { AgentsClient, SessionClient, createClient } from "./client.js";
7
7
  export { ArtifactsClient } from "./artifacts.js";
8
+ export { FilesClient, definitionFileHash } from "./files.js";
8
9
  export { SandboxesClient } from "./client.js";
9
- export { AccessClient, PublishableKeysClient, SigningKeysClient, TokensClient, } from "./access.js";
10
- export { createTokenEndpoint } from "./token-endpoint.js";
11
- export { createActionHandler } from "./action-handler.js";
10
+ export { AccessClient } from "./access.js";
12
11
  export { resolveConnection, ConnectionError } from "./connection.js";
13
12
  export { RuntimeError, IncompatibleRuntimeError } from "./http.js";
14
13
  export { plugin } from "./plugins/plugin.js";
15
14
  export { loadPlugin, PluginError } from "./plugins/load.js";
16
- export { prepareStdioLaunch, expandPluginPlaceholders } from "./plugins/launch.js";
17
15
  export { skills, loadSkillsFromDirectory, resolveSkillsRoot, parseSkill, SkillsError, formatSkillCatalog, SKILLS_USAGE, } from "./skills/index.js";
18
16
  export { mcp, McpError } from "./mcp/index.js";
19
- export { createActionSandbox, definitionDeclaresSandbox, isActionSandboxTool, } from "./sandbox/index.js";
@@ -1,4 +1,5 @@
1
- import type { McpServerManifest, SkillRecord } from "@nylorun/core/define";
1
+ import { type McpServerManifest } from "@nylorun/core/define";
2
+ import { type LoadedSkill } from "../skills/load.js";
2
3
  export declare const PLUGIN_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
3
4
  export declare const MCP_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json";
4
5
  export interface PluginDiagnostic {
@@ -16,7 +17,7 @@ export interface LoadedPlugin {
16
17
  readonly root: string;
17
18
  readonly name: string;
18
19
  readonly description?: string;
19
- readonly skills: Readonly<Record<string, SkillRecord>>;
20
+ readonly skills: Readonly<Record<string, LoadedSkill>>;
20
21
  readonly mcpServers: Readonly<Record<string, McpServerManifest>>;
21
22
  readonly diagnostics: readonly PluginDiagnostic[];
22
23
  }