@ryuhq/sdk 0.1.14 → 0.2.2

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 (105) hide show
  1. package/README.md +69 -7
  2. package/dist/action.cjs +839 -0
  3. package/dist/action.d.cts +88 -0
  4. package/dist/action.d.ts +88 -0
  5. package/dist/action.js +8 -0
  6. package/dist/agent-plugin.cjs +46 -0
  7. package/dist/agent-plugin.d.cts +43 -33
  8. package/dist/agent-plugin.d.ts +43 -33
  9. package/dist/agent-plugin.js +1 -1
  10. package/dist/agent.cjs +16 -0
  11. package/dist/agent.d.cts +377 -1
  12. package/dist/agent.d.ts +377 -1
  13. package/dist/agent.js +4 -2
  14. package/dist/app-B0Z9Ew_R.d.cts +141 -0
  15. package/dist/app-C-BDJwfG.d.ts +141 -0
  16. package/dist/builder.cjs +1194 -0
  17. package/dist/builder.d.cts +217 -0
  18. package/dist/builder.d.ts +217 -0
  19. package/dist/builder.js +29 -0
  20. package/dist/chunk-4TPUZDTI.js +94 -0
  21. package/dist/chunk-BC3A7HMO.js +164 -0
  22. package/dist/chunk-FZSFZOIN.js +200 -0
  23. package/dist/{chunk-ODFEUVPW.js → chunk-HACAGK65.js} +1 -18
  24. package/dist/chunk-HLKJZAFK.js +361 -0
  25. package/dist/chunk-IKEDLLFY.js +19 -0
  26. package/dist/{chunk-G6FLVEC4.js → chunk-JX6DDRXV.js} +46 -0
  27. package/dist/{chunk-AO2KJRDD.js → chunk-NZKVOSC2.js} +192 -3
  28. package/dist/chunk-QYFUNJOH.js +83 -0
  29. package/dist/chunk-SN2QBJUF.js +148 -0
  30. package/dist/chunk-TLDPEGC7.js +21 -0
  31. package/dist/chunk-TXSHHZF2.js +0 -0
  32. package/dist/chunk-VLIRNNAE.js +154 -0
  33. package/dist/{chunk-MTUBUPIV.js → chunk-Z57QDDJR.js} +8 -227
  34. package/dist/chunk-ZTJWBRUL.js +282 -0
  35. package/dist/cli.cjs +347 -18
  36. package/dist/cli.js +128 -23
  37. package/dist/client-D5U6ssPc.d.cts +84 -0
  38. package/dist/client-D5U6ssPc.d.ts +84 -0
  39. package/dist/index.cjs +810 -86
  40. package/dist/index.d.cts +19 -634
  41. package/dist/index.d.ts +19 -634
  42. package/dist/index.js +82 -699
  43. package/dist/manifest.cjs +200 -4
  44. package/dist/manifest.d.cts +260 -5
  45. package/dist/manifest.d.ts +260 -5
  46. package/dist/manifest.js +15 -1
  47. package/dist/mcp/client.cjs +180 -0
  48. package/dist/mcp/client.d.cts +49 -0
  49. package/dist/mcp/client.d.ts +49 -0
  50. package/dist/mcp/client.js +10 -0
  51. package/dist/mcp/server.cjs +370 -0
  52. package/dist/mcp/server.d.cts +127 -0
  53. package/dist/mcp/server.d.ts +127 -0
  54. package/dist/mcp/server.js +9 -0
  55. package/dist/mcp.cjs +376 -0
  56. package/dist/mcp.d.cts +2 -0
  57. package/dist/mcp.d.ts +2 -0
  58. package/dist/mcp.js +17 -0
  59. package/dist/model.cjs +141 -0
  60. package/dist/model.d.cts +33 -0
  61. package/dist/model.d.ts +33 -0
  62. package/dist/model.js +18 -0
  63. package/dist/plugin.cjs +46 -0
  64. package/dist/plugin.d.cts +215 -0
  65. package/dist/plugin.d.ts +215 -0
  66. package/dist/plugin.js +8 -0
  67. package/dist/runnable.cjs +1438 -0
  68. package/dist/runnable.d.cts +274 -0
  69. package/dist/runnable.d.ts +274 -0
  70. package/dist/runnable.js +34 -0
  71. package/dist/{index-B6SkaAjJ.d.ts → tool-AjkdFvhE.d.ts} +88 -461
  72. package/dist/{index-BvAB5eMk.d.cts → tool-CgzW92O_.d.cts} +88 -461
  73. package/package.json +48 -3
  74. package/src/agent/loop.test.ts +4 -4
  75. package/src/agent/tools.ts +3 -3
  76. package/src/agent-plugin.test.ts +58 -0
  77. package/src/agent-plugin.ts +109 -36
  78. package/src/builder.ts +9 -0
  79. package/src/cli/dev.test.ts +26 -47
  80. package/src/cli/dev.ts +10 -2
  81. package/src/cli-security.test.ts +109 -0
  82. package/src/cli.ts +141 -25
  83. package/src/contracts-lockstep.test.ts +16 -2
  84. package/src/exports-lockstep.test.ts +93 -0
  85. package/src/generated/plugin-manifest.ts +322 -29
  86. package/src/index.ts +53 -0
  87. package/src/manifest-schema.test.ts +30 -1
  88. package/src/manifest.fixtures.test.ts +22 -6
  89. package/src/manifest.test.ts +165 -10
  90. package/src/manifest.ts +454 -188
  91. package/src/mcp/index.ts +18 -0
  92. package/src/mcp/server.ts +2 -1
  93. package/src/model/index.ts +22 -0
  94. package/src/plugin/ryu-plugin.ts +82 -0
  95. package/src/runnable/action.test.ts +128 -0
  96. package/src/runnable/action.ts +202 -0
  97. package/src/runnable/app.test.ts +2 -0
  98. package/src/runnable/app.ts +50 -14
  99. package/src/runnable/index.ts +20 -3
  100. package/src/runnable/primitives.test.ts +34 -0
  101. package/src/runnable/primitives.ts +116 -0
  102. package/src/runnable/runnable-types.ts +3 -0
  103. package/src/runnable/tool.ts +36 -5
  104. package/src/runnable/turn-hook.ts +8 -3
  105. package/src/slash-command.test.ts +69 -0
@@ -0,0 +1,88 @@
1
+ import { Surface, PluginManifest } from './manifest.cjs';
2
+ import { SdkRunnable } from './mcp/server.cjs';
3
+ import { k as RunnableContext, o as ToolSchema, T as ToolRunnable } from './tool-CgzW92O_.cjs';
4
+ import 'zod';
5
+ import './mcp/client.cjs';
6
+ import './client-D5U6ssPc.cjs';
7
+
8
+ /**
9
+ * Canonical Ryu Action authoring API.
10
+ *
11
+ * An Action is the semantic contract for a business operation: one description,
12
+ * input schema, output schema, implementation, and effect declaration. It lowers
13
+ * to Ryu's existing governed `inline_deno` Tool backend, so this adds a coherent
14
+ * authoring seam without introducing a second Core execution runtime.
15
+ */
16
+
17
+ /** The two effects Core can enforce from tool annotations. */
18
+ type ActionEffect = "mutate" | "read";
19
+ /** MCP-compatible effect hints plus any future provider-neutral boolean hints. */
20
+ interface ActionAnnotations {
21
+ destructiveHint?: boolean;
22
+ idempotentHint?: boolean;
23
+ openWorldHint?: boolean;
24
+ readOnlyHint?: boolean;
25
+ [key: string]: boolean | undefined;
26
+ }
27
+ /** Options for defining a canonical Action. */
28
+ interface ActionOptions<TInput extends Record<string, unknown>, TOutput> {
29
+ /** Additional MCP-compatible effect hints. */
30
+ annotations?: ActionAnnotations;
31
+ /** Description the agent reads when deciding whether to call the action. */
32
+ description: string;
33
+ /** Explicit effect used by read-only and approval enforcement. */
34
+ effect: ActionEffect;
35
+ /** Stable action id, also used as the generated Core tool slug. */
36
+ id: string;
37
+ /** Human-readable action name. */
38
+ name: string;
39
+ /** Require human approval even when global smart mode would not classify it. */
40
+ needsApproval?: boolean;
41
+ /** JSON Schema for the structured action result. */
42
+ outputSchema?: Record<string, unknown>;
43
+ /** The one implementation used by local callers and the packaged tool body. */
44
+ run(input: TInput, ctx: RunnableContext): Promise<TOutput>;
45
+ /** JSON Schema for all action inputs. */
46
+ schema: ToolSchema;
47
+ }
48
+ /** Options for lowering one Action into a standalone Ryu plugin manifest. */
49
+ interface ActionManifestOptions {
50
+ /** Plugin activation events; defaults to eager activation. */
51
+ activationEvents?: readonly string[];
52
+ /** Extra Gateway grants required by the action body. */
53
+ grants?: readonly string[];
54
+ /** Reverse-domain plugin id (for example `com.acme.support`). */
55
+ id: string;
56
+ /** Display name; defaults to the Action name. */
57
+ name?: string;
58
+ /** Host surfaces this plugin targets. */
59
+ targets?: readonly Surface[];
60
+ /** Plugin semver. */
61
+ version: string;
62
+ }
63
+ /** A ToolRunnable with Action semantics and manifest/MCP adapters. */
64
+ interface ActionRunnable<TInput extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown> extends ToolRunnable<TInput, TOutput> {
65
+ /** Discriminates this semantic contract from an ordinary ToolRunnable. */
66
+ readonly action: true;
67
+ /** Effect hints lowered into Core's existing tool metadata. */
68
+ readonly annotations: ActionAnnotations;
69
+ /** Required action description. */
70
+ readonly description: string;
71
+ /** Declared effect. */
72
+ readonly effect: ActionEffect;
73
+ /** Whether Core must queue approval before execution. */
74
+ readonly needsApproval: boolean;
75
+ /** Structured result schema, when the action returns one. */
76
+ readonly outputSchema?: Record<string, unknown>;
77
+ /** Lower this Action to a validated, installable plugin manifest. */
78
+ toManifest(options: ActionManifestOptions): PluginManifest;
79
+ /** Adapt this Action to the SDK MCP server using the same implementation. */
80
+ toMcpTool(context: RunnableContext): SdkRunnable;
81
+ }
82
+ /**
83
+ * Define one business operation that can be run locally, packaged as a Core
84
+ * tool, or registered on an SDK MCP server without rewriting its implementation.
85
+ */
86
+ declare function defineAction<TInput extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown>(options: ActionOptions<TInput, TOutput>): ActionRunnable<TInput, TOutput>;
87
+
88
+ export { type ActionAnnotations, type ActionEffect, type ActionManifestOptions, type ActionOptions, type ActionRunnable, defineAction };
@@ -0,0 +1,88 @@
1
+ import { Surface, PluginManifest } from './manifest.js';
2
+ import { SdkRunnable } from './mcp/server.js';
3
+ import { k as RunnableContext, o as ToolSchema, T as ToolRunnable } from './tool-AjkdFvhE.js';
4
+ import 'zod';
5
+ import './mcp/client.js';
6
+ import './client-D5U6ssPc.js';
7
+
8
+ /**
9
+ * Canonical Ryu Action authoring API.
10
+ *
11
+ * An Action is the semantic contract for a business operation: one description,
12
+ * input schema, output schema, implementation, and effect declaration. It lowers
13
+ * to Ryu's existing governed `inline_deno` Tool backend, so this adds a coherent
14
+ * authoring seam without introducing a second Core execution runtime.
15
+ */
16
+
17
+ /** The two effects Core can enforce from tool annotations. */
18
+ type ActionEffect = "mutate" | "read";
19
+ /** MCP-compatible effect hints plus any future provider-neutral boolean hints. */
20
+ interface ActionAnnotations {
21
+ destructiveHint?: boolean;
22
+ idempotentHint?: boolean;
23
+ openWorldHint?: boolean;
24
+ readOnlyHint?: boolean;
25
+ [key: string]: boolean | undefined;
26
+ }
27
+ /** Options for defining a canonical Action. */
28
+ interface ActionOptions<TInput extends Record<string, unknown>, TOutput> {
29
+ /** Additional MCP-compatible effect hints. */
30
+ annotations?: ActionAnnotations;
31
+ /** Description the agent reads when deciding whether to call the action. */
32
+ description: string;
33
+ /** Explicit effect used by read-only and approval enforcement. */
34
+ effect: ActionEffect;
35
+ /** Stable action id, also used as the generated Core tool slug. */
36
+ id: string;
37
+ /** Human-readable action name. */
38
+ name: string;
39
+ /** Require human approval even when global smart mode would not classify it. */
40
+ needsApproval?: boolean;
41
+ /** JSON Schema for the structured action result. */
42
+ outputSchema?: Record<string, unknown>;
43
+ /** The one implementation used by local callers and the packaged tool body. */
44
+ run(input: TInput, ctx: RunnableContext): Promise<TOutput>;
45
+ /** JSON Schema for all action inputs. */
46
+ schema: ToolSchema;
47
+ }
48
+ /** Options for lowering one Action into a standalone Ryu plugin manifest. */
49
+ interface ActionManifestOptions {
50
+ /** Plugin activation events; defaults to eager activation. */
51
+ activationEvents?: readonly string[];
52
+ /** Extra Gateway grants required by the action body. */
53
+ grants?: readonly string[];
54
+ /** Reverse-domain plugin id (for example `com.acme.support`). */
55
+ id: string;
56
+ /** Display name; defaults to the Action name. */
57
+ name?: string;
58
+ /** Host surfaces this plugin targets. */
59
+ targets?: readonly Surface[];
60
+ /** Plugin semver. */
61
+ version: string;
62
+ }
63
+ /** A ToolRunnable with Action semantics and manifest/MCP adapters. */
64
+ interface ActionRunnable<TInput extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown> extends ToolRunnable<TInput, TOutput> {
65
+ /** Discriminates this semantic contract from an ordinary ToolRunnable. */
66
+ readonly action: true;
67
+ /** Effect hints lowered into Core's existing tool metadata. */
68
+ readonly annotations: ActionAnnotations;
69
+ /** Required action description. */
70
+ readonly description: string;
71
+ /** Declared effect. */
72
+ readonly effect: ActionEffect;
73
+ /** Whether Core must queue approval before execution. */
74
+ readonly needsApproval: boolean;
75
+ /** Structured result schema, when the action returns one. */
76
+ readonly outputSchema?: Record<string, unknown>;
77
+ /** Lower this Action to a validated, installable plugin manifest. */
78
+ toManifest(options: ActionManifestOptions): PluginManifest;
79
+ /** Adapt this Action to the SDK MCP server using the same implementation. */
80
+ toMcpTool(context: RunnableContext): SdkRunnable;
81
+ }
82
+ /**
83
+ * Define one business operation that can be run locally, packaged as a Core
84
+ * tool, or registered on an SDK MCP server without rewriting its implementation.
85
+ */
86
+ declare function defineAction<TInput extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown>(options: ActionOptions<TInput, TOutput>): ActionRunnable<TInput, TOutput>;
87
+
88
+ export { type ActionAnnotations, type ActionEffect, type ActionManifestOptions, type ActionOptions, type ActionRunnable, defineAction };
package/dist/action.js ADDED
@@ -0,0 +1,8 @@
1
+ import {
2
+ defineAction
3
+ } from "./chunk-4TPUZDTI.js";
4
+ import "./chunk-QYFUNJOH.js";
5
+ import "./chunk-NZKVOSC2.js";
6
+ export {
7
+ defineAction
8
+ };
@@ -106,6 +106,21 @@ function toSpecEnv(value) {
106
106
  }
107
107
  return Object.keys(env).length > 0 ? env : void 0;
108
108
  }
109
+ function validateRemoteUrl(name, raw) {
110
+ let parsed;
111
+ try {
112
+ parsed = new URL(raw);
113
+ } catch {
114
+ return `mcp server '${name}' remote url ${JSON.stringify(raw)} is invalid and was omitted`;
115
+ }
116
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
117
+ return `mcp server '${name}' remote url must use http or https and was omitted`;
118
+ }
119
+ if (parsed.username || parsed.password || parsed.hash) {
120
+ return `mcp server '${name}' remote url must not contain credentials or a fragment and was omitted`;
121
+ }
122
+ return void 0;
123
+ }
109
124
  function toSpecServer(name, decl) {
110
125
  const extras = {};
111
126
  const commandEnv = asString(decl.command_env);
@@ -123,6 +138,37 @@ function toSpecServer(name, decl) {
123
138
  note: `mcp server '${name}' is disabled in the native manifest and was omitted from ${AGENT_PLUGIN_MCP_FILE}`
124
139
  };
125
140
  }
141
+ const declaredType = asString(decl.type);
142
+ const remoteUrl = asString(decl.url);
143
+ const remoteType = declaredType === "sse" ? "sse" : declaredType === "streamable-http" || declaredType === "streamable_http" || declaredType === "http" || !declaredType && remoteUrl ? "streamable-http" : void 0;
144
+ if (remoteType) {
145
+ if (!remoteUrl) {
146
+ return {
147
+ extras,
148
+ note: `mcp server '${name}' has remote type '${remoteType}' but no url and was omitted`
149
+ };
150
+ }
151
+ const urlNote = validateRemoteUrl(name, remoteUrl);
152
+ if (urlNote) {
153
+ return { extras, note: urlNote };
154
+ }
155
+ const server2 = {
156
+ type: remoteType,
157
+ url: remoteUrl
158
+ };
159
+ const headers = toSpecEnv(decl.headers);
160
+ if (headers) {
161
+ server2.headers = headers;
162
+ }
163
+ const note = decl.auth ? `mcp server '${name}' uses Ryu OAuth metadata that is not portable; static headers were exported` : void 0;
164
+ return { server: server2, extras, note };
165
+ }
166
+ if (declaredType && declaredType !== "stdio") {
167
+ return {
168
+ extras,
169
+ note: `mcp server '${name}' has unsupported transport '${declaredType}' and was omitted`
170
+ };
171
+ }
126
172
  const command = asString(decl.command);
127
173
  if (!command) {
128
174
  return {
@@ -4,7 +4,9 @@
4
4
  * The Agent Plugins Specification (https://agent-plugins.org/, TSC: Amazon,
5
5
  * Cursor, Microsoft, OpenAI, Vercel) defines a small portable floor: a plugin is
6
6
  * a directory with `plugin.json`, Agent Skills under `skills/<slug>/SKILL.md`,
7
- * and MCP servers in `mcp.json`. Nothing else is portable.
7
+ * and MCP servers in `mcp.json`. Native stdio, Streamable HTTP, and legacy SSE
8
+ * servers all have a direct portable representation; richer Ryu-only fields stay
9
+ * in the extension namespace or are reported as notes.
8
10
  *
9
11
  * ## Why this is a SECOND file, not a migration
10
12
  *
@@ -27,7 +29,7 @@
27
29
  * is deliberately NOT a copy of the whole native manifest — that would be a second
28
30
  * source of truth with a stale-copy failure mode.
29
31
  *
30
- * Both `plugins-store/*` and `apps-store/*` use this one `PluginManifest` shape, so
32
+ * Both `plugins-store/{plugins,lsp,external_plugins}/*` and `apps-store/*` use this one `PluginManifest` shape, so
31
33
  * one converter covers both stores.
32
34
  */
33
35
  /** Agent Plugins spec version this module targets. */
@@ -69,22 +71,22 @@ declare const AGENT_PLUGIN_MCP_FILE = "mcp.json";
69
71
  */
70
72
  declare function isAgentPluginManifest(value: unknown): boolean;
71
73
  /** Author object — the only three fields the spec permits (§5.4). */
72
- type AgentPluginAuthor = {
73
- name?: string;
74
+ interface AgentPluginAuthor {
74
75
  email?: string;
76
+ name?: string;
75
77
  url?: string;
76
- };
78
+ }
77
79
  /** Ryu data carried under {@link AGENT_PLUGIN_EXTENSION_NS}. */
78
- type RyuExtensionData = {
79
- /** The real scoped plugin id (`@ryu/advisor`) — unrecoverable from spec `name`. */
80
- id: string;
80
+ interface RyuExtensionData {
81
81
  /** Human display name; spec `name` is a slug, not a display string. */
82
82
  displayName: string;
83
+ /** The real scoped plugin id (`@ryu/advisor`) — unrecoverable from spec `name`. */
84
+ id: string;
83
85
  /** Per-MCP-server fields the spec's closed server variants do not allow. */
84
86
  mcp?: Record<string, RyuMcpServerExtras>;
85
- };
87
+ }
86
88
  /** Native MCP fields stripped out of the exported `mcp.json`. */
87
- type RyuMcpServerExtras = {
89
+ interface RyuMcpServerExtras {
88
90
  /** Env var that overrides `command` with an absolute path at spawn. */
89
91
  command_env?: string;
90
92
  /** Human description for our MCP listing endpoint. */
@@ -96,37 +98,43 @@ type RyuMcpServerExtras = {
96
98
  * deliberately do not.
97
99
  */
98
100
  enabled?: false;
99
- };
101
+ }
100
102
  /** A conformant `plugin.json` (§5.2). */
101
- type AgentPluginJson = {
103
+ interface AgentPluginJson {
102
104
  $schema: string;
103
- name: string;
104
- version?: string;
105
- description?: string;
106
105
  author?: AgentPluginAuthor;
106
+ description?: string;
107
+ extensions: Record<string, unknown>;
107
108
  homepage?: string;
108
- repository?: string;
109
- license?: string;
110
109
  keywords?: string[];
111
- extensions: Record<string, unknown>;
112
- };
113
- /** A stdio server entry (§7.2.1) — the only variant we export. */
114
- type AgentPluginStdioServer = {
115
- type: "stdio";
116
- command: string;
110
+ license?: string;
111
+ name: string;
112
+ repository?: string;
113
+ version?: string;
114
+ }
115
+ /** A stdio server entry (§7.2.1). */
116
+ interface AgentPluginStdioServer {
117
117
  args?: string[];
118
- env?: Record<string, string>;
118
+ command: string;
119
119
  cwd?: string;
120
- };
120
+ env?: Record<string, string>;
121
+ type: "stdio";
122
+ }
123
+ /** A remote server entry (§7.2.1). */
124
+ interface AgentPluginRemoteServer {
125
+ headers?: Record<string, string>;
126
+ type: "streamable-http" | "sse";
127
+ url: string;
128
+ }
129
+ /** Any server variant a conformant Agent Plugins client can consume. */
130
+ type AgentPluginServer = AgentPluginStdioServer | AgentPluginRemoteServer;
121
131
  /** A conformant `mcp.json` (§7.2.1). */
122
- type AgentPluginMcpJson = {
132
+ interface AgentPluginMcpJson {
123
133
  $schema: string;
124
- mcpServers: Record<string, AgentPluginStdioServer>;
125
- };
134
+ mcpServers: Record<string, AgentPluginServer>;
135
+ }
126
136
  /** What {@link toAgentPlugin} produces, plus what it had to leave behind. */
127
- type AgentPluginExport = {
128
- /** The `plugin.json` contents. */
129
- plugin: AgentPluginJson;
137
+ interface AgentPluginExport {
130
138
  /** The `mcp.json` contents, or null when the plugin exports no server. */
131
139
  mcp: AgentPluginMcpJson | null;
132
140
  /**
@@ -134,7 +142,9 @@ type AgentPluginExport = {
134
142
  * is visible at the call site instead of silent.
135
143
  */
136
144
  notes: string[];
137
- };
145
+ /** The `plugin.json` contents. */
146
+ plugin: AgentPluginJson;
147
+ }
138
148
  /**
139
149
  * Project a Ryu plugin id onto a spec-legal `name` (§5.5): 1–64 chars of
140
150
  * `a-z 0-9 - .`, alphanumeric at both ends, no `--` and no `..`.
@@ -156,4 +166,4 @@ declare function toSpecName(id: string): string;
156
166
  */
157
167
  declare function toAgentPlugin(manifest: Record<string, unknown>): AgentPluginExport;
158
168
 
159
- export { AGENT_PLUGINS_SPEC_VERSION, AGENT_PLUGIN_EXTENSION_NS, AGENT_PLUGIN_MANIFEST_FILE, AGENT_PLUGIN_MCP_FILE, AGENT_PLUGIN_MCP_SCHEMA_URL, AGENT_PLUGIN_SCHEMA_URL, type AgentPluginAuthor, type AgentPluginExport, type AgentPluginJson, type AgentPluginMcpJson, type AgentPluginStdioServer, type RyuExtensionData, type RyuMcpServerExtras, isAgentPluginManifest, toAgentPlugin, toSpecName };
169
+ export { AGENT_PLUGINS_SPEC_VERSION, AGENT_PLUGIN_EXTENSION_NS, AGENT_PLUGIN_MANIFEST_FILE, AGENT_PLUGIN_MCP_FILE, AGENT_PLUGIN_MCP_SCHEMA_URL, AGENT_PLUGIN_SCHEMA_URL, type AgentPluginAuthor, type AgentPluginExport, type AgentPluginJson, type AgentPluginMcpJson, type AgentPluginRemoteServer, type AgentPluginServer, type AgentPluginStdioServer, type RyuExtensionData, type RyuMcpServerExtras, isAgentPluginManifest, toAgentPlugin, toSpecName };
@@ -4,7 +4,9 @@
4
4
  * The Agent Plugins Specification (https://agent-plugins.org/, TSC: Amazon,
5
5
  * Cursor, Microsoft, OpenAI, Vercel) defines a small portable floor: a plugin is
6
6
  * a directory with `plugin.json`, Agent Skills under `skills/<slug>/SKILL.md`,
7
- * and MCP servers in `mcp.json`. Nothing else is portable.
7
+ * and MCP servers in `mcp.json`. Native stdio, Streamable HTTP, and legacy SSE
8
+ * servers all have a direct portable representation; richer Ryu-only fields stay
9
+ * in the extension namespace or are reported as notes.
8
10
  *
9
11
  * ## Why this is a SECOND file, not a migration
10
12
  *
@@ -27,7 +29,7 @@
27
29
  * is deliberately NOT a copy of the whole native manifest — that would be a second
28
30
  * source of truth with a stale-copy failure mode.
29
31
  *
30
- * Both `plugins-store/*` and `apps-store/*` use this one `PluginManifest` shape, so
32
+ * Both `plugins-store/{plugins,lsp,external_plugins}/*` and `apps-store/*` use this one `PluginManifest` shape, so
31
33
  * one converter covers both stores.
32
34
  */
33
35
  /** Agent Plugins spec version this module targets. */
@@ -69,22 +71,22 @@ declare const AGENT_PLUGIN_MCP_FILE = "mcp.json";
69
71
  */
70
72
  declare function isAgentPluginManifest(value: unknown): boolean;
71
73
  /** Author object — the only three fields the spec permits (§5.4). */
72
- type AgentPluginAuthor = {
73
- name?: string;
74
+ interface AgentPluginAuthor {
74
75
  email?: string;
76
+ name?: string;
75
77
  url?: string;
76
- };
78
+ }
77
79
  /** Ryu data carried under {@link AGENT_PLUGIN_EXTENSION_NS}. */
78
- type RyuExtensionData = {
79
- /** The real scoped plugin id (`@ryu/advisor`) — unrecoverable from spec `name`. */
80
- id: string;
80
+ interface RyuExtensionData {
81
81
  /** Human display name; spec `name` is a slug, not a display string. */
82
82
  displayName: string;
83
+ /** The real scoped plugin id (`@ryu/advisor`) — unrecoverable from spec `name`. */
84
+ id: string;
83
85
  /** Per-MCP-server fields the spec's closed server variants do not allow. */
84
86
  mcp?: Record<string, RyuMcpServerExtras>;
85
- };
87
+ }
86
88
  /** Native MCP fields stripped out of the exported `mcp.json`. */
87
- type RyuMcpServerExtras = {
89
+ interface RyuMcpServerExtras {
88
90
  /** Env var that overrides `command` with an absolute path at spawn. */
89
91
  command_env?: string;
90
92
  /** Human description for our MCP listing endpoint. */
@@ -96,37 +98,43 @@ type RyuMcpServerExtras = {
96
98
  * deliberately do not.
97
99
  */
98
100
  enabled?: false;
99
- };
101
+ }
100
102
  /** A conformant `plugin.json` (§5.2). */
101
- type AgentPluginJson = {
103
+ interface AgentPluginJson {
102
104
  $schema: string;
103
- name: string;
104
- version?: string;
105
- description?: string;
106
105
  author?: AgentPluginAuthor;
106
+ description?: string;
107
+ extensions: Record<string, unknown>;
107
108
  homepage?: string;
108
- repository?: string;
109
- license?: string;
110
109
  keywords?: string[];
111
- extensions: Record<string, unknown>;
112
- };
113
- /** A stdio server entry (§7.2.1) — the only variant we export. */
114
- type AgentPluginStdioServer = {
115
- type: "stdio";
116
- command: string;
110
+ license?: string;
111
+ name: string;
112
+ repository?: string;
113
+ version?: string;
114
+ }
115
+ /** A stdio server entry (§7.2.1). */
116
+ interface AgentPluginStdioServer {
117
117
  args?: string[];
118
- env?: Record<string, string>;
118
+ command: string;
119
119
  cwd?: string;
120
- };
120
+ env?: Record<string, string>;
121
+ type: "stdio";
122
+ }
123
+ /** A remote server entry (§7.2.1). */
124
+ interface AgentPluginRemoteServer {
125
+ headers?: Record<string, string>;
126
+ type: "streamable-http" | "sse";
127
+ url: string;
128
+ }
129
+ /** Any server variant a conformant Agent Plugins client can consume. */
130
+ type AgentPluginServer = AgentPluginStdioServer | AgentPluginRemoteServer;
121
131
  /** A conformant `mcp.json` (§7.2.1). */
122
- type AgentPluginMcpJson = {
132
+ interface AgentPluginMcpJson {
123
133
  $schema: string;
124
- mcpServers: Record<string, AgentPluginStdioServer>;
125
- };
134
+ mcpServers: Record<string, AgentPluginServer>;
135
+ }
126
136
  /** What {@link toAgentPlugin} produces, plus what it had to leave behind. */
127
- type AgentPluginExport = {
128
- /** The `plugin.json` contents. */
129
- plugin: AgentPluginJson;
137
+ interface AgentPluginExport {
130
138
  /** The `mcp.json` contents, or null when the plugin exports no server. */
131
139
  mcp: AgentPluginMcpJson | null;
132
140
  /**
@@ -134,7 +142,9 @@ type AgentPluginExport = {
134
142
  * is visible at the call site instead of silent.
135
143
  */
136
144
  notes: string[];
137
- };
145
+ /** The `plugin.json` contents. */
146
+ plugin: AgentPluginJson;
147
+ }
138
148
  /**
139
149
  * Project a Ryu plugin id onto a spec-legal `name` (§5.5): 1–64 chars of
140
150
  * `a-z 0-9 - .`, alphanumeric at both ends, no `--` and no `..`.
@@ -156,4 +166,4 @@ declare function toSpecName(id: string): string;
156
166
  */
157
167
  declare function toAgentPlugin(manifest: Record<string, unknown>): AgentPluginExport;
158
168
 
159
- export { AGENT_PLUGINS_SPEC_VERSION, AGENT_PLUGIN_EXTENSION_NS, AGENT_PLUGIN_MANIFEST_FILE, AGENT_PLUGIN_MCP_FILE, AGENT_PLUGIN_MCP_SCHEMA_URL, AGENT_PLUGIN_SCHEMA_URL, type AgentPluginAuthor, type AgentPluginExport, type AgentPluginJson, type AgentPluginMcpJson, type AgentPluginStdioServer, type RyuExtensionData, type RyuMcpServerExtras, isAgentPluginManifest, toAgentPlugin, toSpecName };
169
+ export { AGENT_PLUGINS_SPEC_VERSION, AGENT_PLUGIN_EXTENSION_NS, AGENT_PLUGIN_MANIFEST_FILE, AGENT_PLUGIN_MCP_FILE, AGENT_PLUGIN_MCP_SCHEMA_URL, AGENT_PLUGIN_SCHEMA_URL, type AgentPluginAuthor, type AgentPluginExport, type AgentPluginJson, type AgentPluginMcpJson, type AgentPluginRemoteServer, type AgentPluginServer, type AgentPluginStdioServer, type RyuExtensionData, type RyuMcpServerExtras, isAgentPluginManifest, toAgentPlugin, toSpecName };
@@ -8,7 +8,7 @@ import {
8
8
  isAgentPluginManifest,
9
9
  toAgentPlugin,
10
10
  toSpecName
11
- } from "./chunk-G6FLVEC4.js";
11
+ } from "./chunk-JX6DDRXV.js";
12
12
  export {
13
13
  AGENT_PLUGINS_SPEC_VERSION,
14
14
  AGENT_PLUGIN_EXTENSION_NS,
package/dist/agent.cjs CHANGED
@@ -273,6 +273,22 @@ function brokerCall(transport, cap, op, input) {
273
273
  }
274
274
  function createPrimitives(transport) {
275
275
  return {
276
+ background: {
277
+ list: (input) => transport.bridge("background.list", {
278
+ producer: input?.producer,
279
+ running_only: input?.runningOnly
280
+ }),
281
+ stop: (input) => transport.bridge("background.stop", {
282
+ process_id: input.processId
283
+ })
284
+ },
285
+ storage: {
286
+ get: (input) => transport.bridge("storage.get", input),
287
+ set: (input) => transport.bridge("storage.set", input).then(() => void 0),
288
+ delete: (input) => transport.bridge("storage.delete", input).then(() => void 0),
289
+ keys: (input) => transport.bridge("storage.keys", input ?? {}).then((value) => Array.isArray(value) ? value : []),
290
+ compareAndSet: (input) => transport.bridge("storage.compareAndSet", input)
291
+ },
276
292
  rag: {
277
293
  retrieve: (input) => brokerCall(transport, "rag", "retrieve", input),
278
294
  embed: (input) => brokerCall(transport, "rag", "embed", input),