nylorun 0.15.1-beta → 0.17.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 (46) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/README.md +136 -74
  3. package/dist/cli.js +31 -12
  4. package/dist/client/agent-manifests.d.ts +4 -0
  5. package/dist/client/agent-manifests.js +100 -0
  6. package/dist/client/agents.d.ts +1 -3
  7. package/dist/client/agents.js +459 -117
  8. package/dist/client/apply.d.ts +7 -0
  9. package/dist/client/apply.js +99 -0
  10. package/dist/client/artifacts.js +3 -3
  11. package/dist/client/doctor.d.ts +1 -1
  12. package/dist/client/doctor.js +2 -2
  13. package/dist/client/io.d.ts +2 -0
  14. package/dist/client/io.js +11 -0
  15. package/dist/client/mcp.d.ts +5 -3
  16. package/dist/client/mcp.js +28 -25
  17. package/dist/client/migrate.d.ts +4 -0
  18. package/dist/client/migrate.js +140 -0
  19. package/dist/client/model/pi-ai.d.ts +1 -1
  20. package/dist/client/model/pi-ai.js +1 -1
  21. package/dist/client/models.d.ts +5 -2
  22. package/dist/client/models.js +17 -8
  23. package/dist/client/runtime.js +3 -3
  24. package/dist/client/sessions.js +29 -18
  25. package/dist/client/settings.d.ts +5 -5
  26. package/dist/client/settings.js +38 -18
  27. package/dist/client/tenant.d.ts +1 -1
  28. package/dist/client/tenant.js +10 -7
  29. package/dist/project/seed.js +2 -1
  30. package/dist/sandbox/commands.js +10 -8
  31. package/dist/sandbox/kubectl.js +2 -1
  32. package/dist/sandbox/manifests.js +3 -2
  33. package/dist/sandbox/probe.js +9 -7
  34. package/dist/stack/commands.js +12 -11
  35. package/dist/stack/compose-file.d.ts +3 -0
  36. package/dist/stack/compose-file.js +32 -36
  37. package/dist/stack/operator-keys.js +7 -6
  38. package/dist/stack/ports.js +2 -1
  39. package/dist/stack/studio-login.js +2 -1
  40. package/dist/tuning.d.ts +90 -0
  41. package/dist/tuning.js +143 -0
  42. package/package.json +9 -9
  43. package/dist/client/environment-manifests.d.ts +0 -10
  44. package/dist/client/environment-manifests.js +0 -173
  45. package/dist/client/environments.d.ts +0 -4
  46. package/dist/client/environments.js +0 -295
package/dist/cli.js CHANGED
@@ -12,14 +12,24 @@ ${stackUsage}
12
12
  doctor sandbox [--tenant <name>] [--json]
13
13
  the sandbox backend the Tenant's Host offers
14
14
 
15
+ Agent manifests:
16
+ apply [<dir>...] [--dry-run] [--if-match <n>]
17
+ save the agent manifest each folder's agent.manifest.json
18
+ describes, with the files it names (Runtime API)
19
+ migrate v8 <agent.json> [--runtime <environment-manifest.json>] [--out <dir>]
20
+ write the three manifest files from an agent manifest v7
21
+ and an environment manifest v1 (reads no Runtime)
22
+
15
23
  Groups, each with its own --help:
16
- agents list | get | save the Tenant's agents (Runtime API, an application key)
24
+ agent-manifests list | get | versions | rm
25
+ the Tenant's agent manifests (Runtime API)
26
+ agents list | get | put | fork | stop | reset | rm | snapshot | restore
27
+ versions | delete-version | events | secrets
28
+ the Tenant's Agents, made from saved manifests; sessions
29
+ run on them (Runtime API)
17
30
  sessions list | create | get | send | approve | respond | cancel | watch | history
18
31
  usage | calls | trace | exec
19
32
  the Tenant's sessions (Runtime API)
20
- environments list | get | put | fork | stop | reset | delete | snapshot | restore
21
- versions | delete-version | events | secrets | manifests
22
- the Tenant's Environments (Runtime API)
23
33
  artifacts list | get | upload | download | tree | diff | zip | link | rm
24
34
  the Tenant's file artifacts (Runtime API)
25
35
  tenant reset | keys | signing-keys | models | usage | calls | budgets | tool-policy |
@@ -32,7 +42,8 @@ A command acts on the local Tenant --tenant names, else the linked project's, el
32
42
  project) the default Tenant; NYLORUN_HOME sets its Host root (default
33
43
  ~/.nylorun/tenants/<name>). Without --tenant, NYLORUN_RUNTIME_URL names a remote installation:
34
44
  with NYLORUN_MANAGEMENT_KEY for status, doctor sandbox and tenant; with NYLORUN_SERVER_KEY, or an
35
- identity provider's token in NYLORUN_TOKEN, for agents, sessions, environments and artifacts.
45
+ identity provider's token in NYLORUN_TOKEN, for apply, agent-manifests, agents, sessions and
46
+ artifacts.
36
47
  The Runtime API groups act for a person with --as <subject> [--scope <scope>]...`;
37
48
  const localUsage = `nylorun local <command>
38
49
 
@@ -54,7 +65,8 @@ const MOVED = {
54
65
  ls: "nylorun ls moved: nylorun local ls",
55
66
  delete: "nylorun delete moved: nylorun local delete",
56
67
  telemetry: "nylorun telemetry moved: nylorun local telemetry",
57
- reset: "nylorun reset moved: nylorun local reset deletes a local Tenant's volumes; nylorun tenant reset clears its sessions or Environments through the Management API",
68
+ reset: "nylorun reset moved: nylorun local reset deletes a local Tenant's volumes; nylorun tenant reset clears its sessions or Agents through the Management API",
69
+ environments: "nylorun environments is nylorun agents in protocol 16: Environments are Agents, made from saved agent manifests (nylorun apply). Environment manifests are the runtime section of an agent manifest (nylorun migrate v8).",
58
70
  key: "nylorun key moved: nylorun tenant keys put|list|rm",
59
71
  keys: "nylorun keys is nylorun tenant keys put|list|rm",
60
72
  mcp: "nylorun mcp moved: nylorun tenant mcp inspect <url>",
@@ -66,10 +78,10 @@ const MOVED = {
66
78
  runtime: "nylorun runtime was removed: the local Runtime runs in Docker Compose. Use nylorun up|down|status and nylorun local logs.",
67
79
  };
68
80
  const SANDBOX_MOVED = {
69
- ls: "nylorun sandbox ls moved: nylorun environments list",
70
- list: "nylorun sandbox ls moved: nylorun environments list",
71
- rm: "nylorun sandbox rm moved: nylorun environments delete <id>",
72
- delete: "nylorun sandbox rm moved: nylorun environments delete <id>",
81
+ ls: "nylorun sandbox ls moved: nylorun agents list",
82
+ list: "nylorun sandbox ls moved: nylorun agents list",
83
+ rm: "nylorun sandbox rm moved: nylorun agents rm <id>",
84
+ delete: "nylorun sandbox rm moved: nylorun agents rm <id>",
73
85
  };
74
86
  const LOCAL_UI_REMOVED = "--local-ui was removed: Studio runs in its own container. Run nylorun studio.";
75
87
  const usageError = (message) => new CliError(message, 2);
@@ -150,11 +162,18 @@ async function main() {
150
162
  process.exitCode = await tenantCommand(defaultStackDeps(env), args);
151
163
  return;
152
164
  }
153
- if (command === "agents" || command === "sessions" || command === "environments" || command === "artifacts") {
165
+ if (command === "apply" ||
166
+ command === "migrate" ||
167
+ command === "agent-manifests" ||
168
+ command === "agents" ||
169
+ command === "sessions" ||
170
+ command === "artifacts") {
154
171
  const group = {
172
+ apply: async () => (await import("./client/apply.js")).applyCommand,
173
+ migrate: async () => (await import("./client/migrate.js")).migrateCommand,
174
+ "agent-manifests": async () => (await import("./client/agent-manifests.js")).agentManifestsCommand,
155
175
  agents: async () => (await import("./client/agents.js")).agentsCommand,
156
176
  sessions: async () => (await import("./client/sessions.js")).sessionsCommand,
157
- environments: async () => (await import("./client/environments.js")).environmentsCommand,
158
177
  artifacts: async () => (await import("./client/artifacts.js")).artifactsCommand,
159
178
  }[command];
160
179
  process.exitCode = await (await group())(defaultStackDeps(env), args);
@@ -0,0 +1,4 @@
1
+ import type { StackDeps } from "../stack/commands.js";
2
+ export declare const agentManifestsUsage: string;
3
+ /** `nylorun agent-manifests <command> ...` */
4
+ export declare function agentManifestsCommand(deps: StackDeps, args: readonly string[]): Promise<number>;
@@ -0,0 +1,100 @@
1
+ import { parseAgentManifestRef } from "@nylorun/core/contracts";
2
+ import { parseFlags, positional, printJson, printTable, runtimeCall, runtimeClient, runtimeFlagsUsage, usageError, } from "./runtime.js";
3
+ export const agentManifestsUsage = `nylorun agent-manifests <command>
4
+
5
+ The Tenant's agent manifests, through the Runtime API with an application key (or
6
+ NYLORUN_TOKEN). Save one with nylorun apply <dir>.
7
+
8
+ list [--json] each manifest's latest version: its runtime kind, harness
9
+ and the Agents made from it
10
+ get <name>[@<n>] a manifest's latest version (or version n), as JSON
11
+ versions <name> its versions, with the Agents made from each
12
+ rm <name> delete every version (refused while an Agent was made
13
+ from one)
14
+
15
+ ${runtimeFlagsUsage}`;
16
+ /** The harness that runs a manifest's loop, as the list prints it. */
17
+ function harnessOf(view) {
18
+ const { harness } = view.manifest;
19
+ const id = harness.id ?? "nylorun";
20
+ return "kind" in harness && harness.kind === "workflow" ? `${id} (flow)` : id;
21
+ }
22
+ async function list(deps, args) {
23
+ const usage = "nylorun agent-manifests list [--json]";
24
+ const flags = parseFlags(args, { booleans: ["--json"] }, usage);
25
+ positional(flags, 0, usage);
26
+ const { client, connection } = await runtimeClient(deps, flags);
27
+ const manifests = await runtimeCall(() => client.agentManifests.list());
28
+ if (flags.booleans.has("--json")) {
29
+ printJson(deps, manifests);
30
+ return 0;
31
+ }
32
+ if (manifests.length === 0)
33
+ deps.out(`No agent manifests on ${connection.label}. Save one with nylorun apply <dir>.`);
34
+ else
35
+ printTable(deps, [
36
+ ["NAME", "VERSION", "KIND", "HARNESS", "AGENTS"],
37
+ ...manifests.map((view) => [
38
+ view.name,
39
+ String(view.version),
40
+ view.manifest.runtime?.kind ?? "none",
41
+ harnessOf(view),
42
+ String(view.agents),
43
+ ]),
44
+ ]);
45
+ return 0;
46
+ }
47
+ async function get(deps, args) {
48
+ const usage = "nylorun agent-manifests get <name>[@<n>]";
49
+ const flags = parseFlags(args, {}, usage);
50
+ const [ref] = positional(flags, 1, usage);
51
+ const parsed = parseAgentManifestRef(ref);
52
+ if (!parsed)
53
+ throw usageError(`${ref} is not an agent manifest's name, or name@version such as triage@3.`);
54
+ const { client } = await runtimeClient(deps, flags);
55
+ printJson(deps, await runtimeCall(() => client.agentManifests.get(parsed.name, parsed.version)));
56
+ return 0;
57
+ }
58
+ async function versions(deps, args) {
59
+ const usage = "nylorun agent-manifests versions <name>";
60
+ const flags = parseFlags(args, {}, usage);
61
+ const [name] = positional(flags, 1, usage);
62
+ const { client } = await runtimeClient(deps, flags);
63
+ printJson(deps, await runtimeCall(() => client.agentManifests.versions(name)));
64
+ return 0;
65
+ }
66
+ async function remove(deps, args) {
67
+ const usage = "nylorun agent-manifests rm <name>";
68
+ const flags = parseFlags(args, {}, usage);
69
+ const [name] = positional(flags, 1, usage);
70
+ const { client, connection } = await runtimeClient(deps, flags);
71
+ const deleted = await runtimeCall(() => client.agentManifests.delete(name));
72
+ if (!deleted.deleted) {
73
+ deps.err(`No agent manifest ${name} on ${connection.label}.`);
74
+ return 1;
75
+ }
76
+ deps.out(`Deleted agent manifest ${name}: every version.`);
77
+ return 0;
78
+ }
79
+ const COMMANDS = {
80
+ list,
81
+ ls: list,
82
+ get,
83
+ versions,
84
+ rm: remove,
85
+ delete: remove,
86
+ };
87
+ /** `nylorun agent-manifests <command> ...` */
88
+ export async function agentManifestsCommand(deps, args) {
89
+ const [sub, ...rest] = args;
90
+ if (sub === "--help" || sub === "-h") {
91
+ deps.out(agentManifestsUsage);
92
+ return 0;
93
+ }
94
+ if (sub === "save")
95
+ throw usageError("Save an agent manifest with nylorun apply <dir>: it composes agent.manifest.json and the files it names.");
96
+ const command = sub !== undefined && Object.hasOwn(COMMANDS, sub) ? COMMANDS[sub] : undefined;
97
+ if (!command)
98
+ throw usageError(sub ? `Unknown agent-manifests command ${sub}.\n${agentManifestsUsage}` : agentManifestsUsage);
99
+ return command(deps, rest);
100
+ }
@@ -1,6 +1,4 @@
1
1
  import type { StackDeps } from "../stack/commands.js";
2
2
  export declare const agentsUsage: string;
3
- /** Every `sha256:<hex>` a manifest names under a `files` map, with where it names it. */
4
- export declare function namedFiles(manifest: unknown): Map<string, string>;
5
- /** `nylorun agents <list|get|save> ...` */
3
+ /** `nylorun agents <command> ...` */
6
4
  export declare function agentsCommand(deps: StackDeps, args: readonly string[]): Promise<number>;