@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,217 @@
1
+ import { RunnableMeta, SlashCommandContribution, Surface, PluginManifest, CompanionSurface } from './manifest.cjs';
2
+ import { A as AppToolSpec } from './app-B0Z9Ew_R.cjs';
3
+ import 'zod';
4
+ import './tool-CgzW92O_.cjs';
5
+ import './client-D5U6ssPc.cjs';
6
+
7
+ /**
8
+ * Ryu SDK typed builders — one builder per RunnableKind plus a PluginBuilder that
9
+ * assembles a complete, validated `manifest.json` manifest.
10
+ *
11
+ * Each builder follows a fluent interface: construct, chain setter calls, then
12
+ * call `.build()` to get a validated result. Invalid manifests throw a
13
+ * descriptive `Error` — never a silent fallback.
14
+ *
15
+ * Engine/model fields are typed as `string` throughout. No provider union is
16
+ * used so adding a new provider never requires an SDK change.
17
+ */
18
+
19
+ /** Base builder shared by all Runnable kinds. */
20
+ declare class RunnableBuilder {
21
+ protected _id: string;
22
+ protected _name: string;
23
+ id(value: string): this;
24
+ name(value: string): this;
25
+ }
26
+ /** Builds an Agent `RunnableMeta` entry. */
27
+ declare class AgentBuilder extends RunnableBuilder {
28
+ build(): RunnableMeta;
29
+ }
30
+ /** Builds a Workflow `RunnableMeta` entry. */
31
+ declare class WorkflowBuilder extends RunnableBuilder {
32
+ build(): RunnableMeta;
33
+ }
34
+ /** Builds a Tool `RunnableMeta` entry. */
35
+ declare class ToolBuilder extends RunnableBuilder {
36
+ build(): RunnableMeta;
37
+ }
38
+ /** Builds a Skill `RunnableMeta` entry. */
39
+ declare class SkillBuilder extends RunnableBuilder {
40
+ build(): RunnableMeta;
41
+ }
42
+ /** Create an AgentBuilder. */
43
+ declare const agent: () => AgentBuilder;
44
+ /** Create a WorkflowBuilder. */
45
+ declare const workflow: () => WorkflowBuilder;
46
+ /** Create a ToolBuilder. */
47
+ declare const tool: () => ToolBuilder;
48
+ /** Create a SkillBuilder. */
49
+ declare const skill: () => SkillBuilder;
50
+ /**
51
+ * Fluent builder for a complete `manifest.json` Plugin manifest. Produces a
52
+ * validated `PluginManifest` on `.build()` or throws a descriptive `Error`
53
+ * naming the first invalid field.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * import { PluginBuilder, agent, tool } from "@ryuhq/sdk/builder"
58
+ *
59
+ * const manifest = new PluginBuilder()
60
+ * .id("com.example.my-plugin")
61
+ * .name("My Plugin")
62
+ * .version("1.0.0")
63
+ * .runnable(agent().id("agent-main").name("Main Agent").build())
64
+ * .runnable(tool().id("tool-search").name("Web Search").build())
65
+ * .grant("mcp:web_search")
66
+ * .companion({ label: "My Plugin", icon: "sparkles", shortcut: "ctrl+shift+m" })
67
+ * .build()
68
+ * ```
69
+ */
70
+ declare class PluginBuilder {
71
+ private _id;
72
+ private _name;
73
+ private _version;
74
+ private readonly _runnables;
75
+ private readonly _grants;
76
+ private _companion;
77
+ private readonly _dependencies;
78
+ private readonly _requiredCapabilities;
79
+ private readonly _requiredGrants;
80
+ private readonly _targets;
81
+ /** Set the reverse-domain app id (e.g. `"com.example.my-app"`). */
82
+ id(value: string): this;
83
+ /** Set the human-readable display name. */
84
+ name(value: string): this;
85
+ /** Set the semver version string (e.g. `"1.0.0"`). */
86
+ version(value: string): this;
87
+ /** Append a pre-built `RunnableMeta` (from any per-kind builder). */
88
+ runnable(meta: RunnableMeta): this;
89
+ /** Declare a permission grant (e.g. `"mcp:web_search"`). */
90
+ grant(permission: string): this;
91
+ /** Set an optional Companion surface descriptor. */
92
+ companion(surface: CompanionSurface): this;
93
+ /**
94
+ * Declare a **plugin-to-plugin dependency**: `id` must be installed and is
95
+ * auto-enabled (in dependency order) before this plugin enables.
96
+ *
97
+ * `minVersion` is a MINIMUM — a bare `"1.2.0"` means `">=1.2.0"`, so an
98
+ * installed `2.0.0` satisfies it (comparator syntax like `">=1.2, <2"` is
99
+ * honoured verbatim).
100
+ */
101
+ dependsOn(id: string, minVersion?: string): this;
102
+ /**
103
+ * Declare a permission grant implied by this plugin's dependencies
104
+ * (`requires.grants`). Declaration only — the Gateway remains the sole
105
+ * authority on what a grant allows. Use {@link PluginBuilder.grant} for the
106
+ * grants this plugin needs in its own right.
107
+ */
108
+ requiredGrant(permission: string): this;
109
+ /**
110
+ * Declare an abstract **capability** edge (`requires.capabilities`) the broker
111
+ * resolves to a bound provider at enable time — e.g. `requiresCapability("rag")`.
112
+ * Distinct from a specific-plugin dependency: a capability edge lets the
113
+ * binding registry choose the provider. `minVersion` is a MINIMUM (`"1.2.0"`
114
+ * = `">=1.2.0"`).
115
+ */
116
+ requiresCapability(capability: string, minVersion?: string): this;
117
+ /**
118
+ * Restrict this plugin to a host surface (`"desktop"`, `"island"`, …).
119
+ * Declaring NO target is the default and means **every** surface.
120
+ */
121
+ target(surface: Surface): this;
122
+ /**
123
+ * Validate and return the assembled `PluginManifest`. Throws an `Error` with
124
+ * the failing field name and message when validation fails.
125
+ */
126
+ build(): PluginManifest;
127
+ }
128
+ /**
129
+ * Fluent builder for a Ryu App — a `manifest.json` whose tools render interactive
130
+ * widgets inline in chat. Delegates to {@link defineApp} on `.build()`, so it
131
+ * derives the render-vs-companion split and validates through
132
+ * `PluginManifestSchema` (throwing a descriptive `Error` on bad input) exactly
133
+ * like the factory.
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * import { app } from "@ryuhq/sdk/builder"
138
+ *
139
+ * const manifest = app()
140
+ * .id("com.example.checklist")
141
+ * .title("Checklist")
142
+ * .version("1.0.0")
143
+ * .slug("checklist")
144
+ * .uiEntry("src/checklist.tsx")
145
+ * .tool({ name: "render", description: "Render a checklist", invoking: "Building…" })
146
+ * .tool({ name: "toggle", description: "Toggle an item", accessible: true })
147
+ * .build()
148
+ * ```
149
+ */
150
+ declare class AppBuilder {
151
+ private _id;
152
+ private _title;
153
+ private _version;
154
+ private _slug;
155
+ private _server;
156
+ private _displayMode;
157
+ private _mime;
158
+ private _uiEntry;
159
+ private readonly _grants;
160
+ private readonly _activationEvents;
161
+ private readonly _tools;
162
+ private readonly _dependencies;
163
+ private readonly _requiredCapabilities;
164
+ private readonly _requiredGrants;
165
+ private readonly _slashCommands;
166
+ private readonly _targets;
167
+ /** Set the reverse-domain app id (e.g. `"com.example.checklist"`). */
168
+ id(value: string): this;
169
+ /** Set the human-readable display name. */
170
+ title(value: string): this;
171
+ /** Set the semver version string (e.g. `"1.0.0"`). */
172
+ version(value: string): this;
173
+ /** Set the app slug (drives `ui://widget/<slug>.html` and the server default). */
174
+ slug(value: string): this;
175
+ /** Override the MCP server namespace for tool ids (defaults to the slug). */
176
+ server(value: string): this;
177
+ /** Set the default widget display mode (`inline` | `fullscreen` | `pip`). */
178
+ displayMode(value: string): this;
179
+ /** Override the widget MIME dialect (defaults to `text/html+skybridge`). */
180
+ mime(value: string): this;
181
+ /** Set the widget UI source entry `ryu pack` bundles into `ui_code`. */
182
+ uiEntry(value: string): this;
183
+ /** Declare a permission grant (e.g. `"mcp:web_search"`). */
184
+ grant(permission: string): this;
185
+ /** Add a VS-Code-style activation event (empty = eager `["*"]`). */
186
+ activationEvent(event: string): this;
187
+ /** Append a tool spec (render tool unless `accessible:true`). */
188
+ tool(spec: AppToolSpec): this;
189
+ /** Add a slash command and its optional sequential argument choices. */
190
+ slashCommand(command: SlashCommandContribution): this;
191
+ /**
192
+ * Declare a **plugin-to-plugin dependency** (auto-enabled, in dependency order,
193
+ * before this app). `minVersion` is a MINIMUM (`"1.2.0"` = `">=1.2.0"`).
194
+ */
195
+ dependsOn(id: string, minVersion?: string): this;
196
+ /** Declare a grant implied by this app's dependencies (`requires.grants`). */
197
+ requiredGrant(permission: string): this;
198
+ /**
199
+ * Declare an abstract **capability** edge (`requires.capabilities`) the broker
200
+ * resolves to a bound provider at enable time — e.g. `requiresCapability("rag")`.
201
+ * Distinct from a specific-plugin dependency: a capability edge lets the
202
+ * binding registry choose the provider. `minVersion` is a MINIMUM (`"1.2.0"`
203
+ * = `">=1.2.0"`).
204
+ */
205
+ requiresCapability(capability: string, minVersion?: string): this;
206
+ /** Restrict this app to a host surface. No target = every surface. */
207
+ target(surface: Surface): this;
208
+ /**
209
+ * Validate and return the assembled `PluginManifest`. Throws an `Error` naming
210
+ * the failing field when validation fails.
211
+ */
212
+ build(): PluginManifest;
213
+ }
214
+ /** Create an AppBuilder. */
215
+ declare const app: () => AppBuilder;
216
+
217
+ export { AgentBuilder, AppBuilder, PluginBuilder, SkillBuilder, ToolBuilder, WorkflowBuilder, agent, app, skill, tool, workflow };
@@ -0,0 +1,217 @@
1
+ import { RunnableMeta, SlashCommandContribution, Surface, PluginManifest, CompanionSurface } from './manifest.js';
2
+ import { A as AppToolSpec } from './app-C-BDJwfG.js';
3
+ import 'zod';
4
+ import './tool-AjkdFvhE.js';
5
+ import './client-D5U6ssPc.js';
6
+
7
+ /**
8
+ * Ryu SDK typed builders — one builder per RunnableKind plus a PluginBuilder that
9
+ * assembles a complete, validated `manifest.json` manifest.
10
+ *
11
+ * Each builder follows a fluent interface: construct, chain setter calls, then
12
+ * call `.build()` to get a validated result. Invalid manifests throw a
13
+ * descriptive `Error` — never a silent fallback.
14
+ *
15
+ * Engine/model fields are typed as `string` throughout. No provider union is
16
+ * used so adding a new provider never requires an SDK change.
17
+ */
18
+
19
+ /** Base builder shared by all Runnable kinds. */
20
+ declare class RunnableBuilder {
21
+ protected _id: string;
22
+ protected _name: string;
23
+ id(value: string): this;
24
+ name(value: string): this;
25
+ }
26
+ /** Builds an Agent `RunnableMeta` entry. */
27
+ declare class AgentBuilder extends RunnableBuilder {
28
+ build(): RunnableMeta;
29
+ }
30
+ /** Builds a Workflow `RunnableMeta` entry. */
31
+ declare class WorkflowBuilder extends RunnableBuilder {
32
+ build(): RunnableMeta;
33
+ }
34
+ /** Builds a Tool `RunnableMeta` entry. */
35
+ declare class ToolBuilder extends RunnableBuilder {
36
+ build(): RunnableMeta;
37
+ }
38
+ /** Builds a Skill `RunnableMeta` entry. */
39
+ declare class SkillBuilder extends RunnableBuilder {
40
+ build(): RunnableMeta;
41
+ }
42
+ /** Create an AgentBuilder. */
43
+ declare const agent: () => AgentBuilder;
44
+ /** Create a WorkflowBuilder. */
45
+ declare const workflow: () => WorkflowBuilder;
46
+ /** Create a ToolBuilder. */
47
+ declare const tool: () => ToolBuilder;
48
+ /** Create a SkillBuilder. */
49
+ declare const skill: () => SkillBuilder;
50
+ /**
51
+ * Fluent builder for a complete `manifest.json` Plugin manifest. Produces a
52
+ * validated `PluginManifest` on `.build()` or throws a descriptive `Error`
53
+ * naming the first invalid field.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * import { PluginBuilder, agent, tool } from "@ryuhq/sdk/builder"
58
+ *
59
+ * const manifest = new PluginBuilder()
60
+ * .id("com.example.my-plugin")
61
+ * .name("My Plugin")
62
+ * .version("1.0.0")
63
+ * .runnable(agent().id("agent-main").name("Main Agent").build())
64
+ * .runnable(tool().id("tool-search").name("Web Search").build())
65
+ * .grant("mcp:web_search")
66
+ * .companion({ label: "My Plugin", icon: "sparkles", shortcut: "ctrl+shift+m" })
67
+ * .build()
68
+ * ```
69
+ */
70
+ declare class PluginBuilder {
71
+ private _id;
72
+ private _name;
73
+ private _version;
74
+ private readonly _runnables;
75
+ private readonly _grants;
76
+ private _companion;
77
+ private readonly _dependencies;
78
+ private readonly _requiredCapabilities;
79
+ private readonly _requiredGrants;
80
+ private readonly _targets;
81
+ /** Set the reverse-domain app id (e.g. `"com.example.my-app"`). */
82
+ id(value: string): this;
83
+ /** Set the human-readable display name. */
84
+ name(value: string): this;
85
+ /** Set the semver version string (e.g. `"1.0.0"`). */
86
+ version(value: string): this;
87
+ /** Append a pre-built `RunnableMeta` (from any per-kind builder). */
88
+ runnable(meta: RunnableMeta): this;
89
+ /** Declare a permission grant (e.g. `"mcp:web_search"`). */
90
+ grant(permission: string): this;
91
+ /** Set an optional Companion surface descriptor. */
92
+ companion(surface: CompanionSurface): this;
93
+ /**
94
+ * Declare a **plugin-to-plugin dependency**: `id` must be installed and is
95
+ * auto-enabled (in dependency order) before this plugin enables.
96
+ *
97
+ * `minVersion` is a MINIMUM — a bare `"1.2.0"` means `">=1.2.0"`, so an
98
+ * installed `2.0.0` satisfies it (comparator syntax like `">=1.2, <2"` is
99
+ * honoured verbatim).
100
+ */
101
+ dependsOn(id: string, minVersion?: string): this;
102
+ /**
103
+ * Declare a permission grant implied by this plugin's dependencies
104
+ * (`requires.grants`). Declaration only — the Gateway remains the sole
105
+ * authority on what a grant allows. Use {@link PluginBuilder.grant} for the
106
+ * grants this plugin needs in its own right.
107
+ */
108
+ requiredGrant(permission: string): this;
109
+ /**
110
+ * Declare an abstract **capability** edge (`requires.capabilities`) the broker
111
+ * resolves to a bound provider at enable time — e.g. `requiresCapability("rag")`.
112
+ * Distinct from a specific-plugin dependency: a capability edge lets the
113
+ * binding registry choose the provider. `minVersion` is a MINIMUM (`"1.2.0"`
114
+ * = `">=1.2.0"`).
115
+ */
116
+ requiresCapability(capability: string, minVersion?: string): this;
117
+ /**
118
+ * Restrict this plugin to a host surface (`"desktop"`, `"island"`, …).
119
+ * Declaring NO target is the default and means **every** surface.
120
+ */
121
+ target(surface: Surface): this;
122
+ /**
123
+ * Validate and return the assembled `PluginManifest`. Throws an `Error` with
124
+ * the failing field name and message when validation fails.
125
+ */
126
+ build(): PluginManifest;
127
+ }
128
+ /**
129
+ * Fluent builder for a Ryu App — a `manifest.json` whose tools render interactive
130
+ * widgets inline in chat. Delegates to {@link defineApp} on `.build()`, so it
131
+ * derives the render-vs-companion split and validates through
132
+ * `PluginManifestSchema` (throwing a descriptive `Error` on bad input) exactly
133
+ * like the factory.
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * import { app } from "@ryuhq/sdk/builder"
138
+ *
139
+ * const manifest = app()
140
+ * .id("com.example.checklist")
141
+ * .title("Checklist")
142
+ * .version("1.0.0")
143
+ * .slug("checklist")
144
+ * .uiEntry("src/checklist.tsx")
145
+ * .tool({ name: "render", description: "Render a checklist", invoking: "Building…" })
146
+ * .tool({ name: "toggle", description: "Toggle an item", accessible: true })
147
+ * .build()
148
+ * ```
149
+ */
150
+ declare class AppBuilder {
151
+ private _id;
152
+ private _title;
153
+ private _version;
154
+ private _slug;
155
+ private _server;
156
+ private _displayMode;
157
+ private _mime;
158
+ private _uiEntry;
159
+ private readonly _grants;
160
+ private readonly _activationEvents;
161
+ private readonly _tools;
162
+ private readonly _dependencies;
163
+ private readonly _requiredCapabilities;
164
+ private readonly _requiredGrants;
165
+ private readonly _slashCommands;
166
+ private readonly _targets;
167
+ /** Set the reverse-domain app id (e.g. `"com.example.checklist"`). */
168
+ id(value: string): this;
169
+ /** Set the human-readable display name. */
170
+ title(value: string): this;
171
+ /** Set the semver version string (e.g. `"1.0.0"`). */
172
+ version(value: string): this;
173
+ /** Set the app slug (drives `ui://widget/<slug>.html` and the server default). */
174
+ slug(value: string): this;
175
+ /** Override the MCP server namespace for tool ids (defaults to the slug). */
176
+ server(value: string): this;
177
+ /** Set the default widget display mode (`inline` | `fullscreen` | `pip`). */
178
+ displayMode(value: string): this;
179
+ /** Override the widget MIME dialect (defaults to `text/html+skybridge`). */
180
+ mime(value: string): this;
181
+ /** Set the widget UI source entry `ryu pack` bundles into `ui_code`. */
182
+ uiEntry(value: string): this;
183
+ /** Declare a permission grant (e.g. `"mcp:web_search"`). */
184
+ grant(permission: string): this;
185
+ /** Add a VS-Code-style activation event (empty = eager `["*"]`). */
186
+ activationEvent(event: string): this;
187
+ /** Append a tool spec (render tool unless `accessible:true`). */
188
+ tool(spec: AppToolSpec): this;
189
+ /** Add a slash command and its optional sequential argument choices. */
190
+ slashCommand(command: SlashCommandContribution): this;
191
+ /**
192
+ * Declare a **plugin-to-plugin dependency** (auto-enabled, in dependency order,
193
+ * before this app). `minVersion` is a MINIMUM (`"1.2.0"` = `">=1.2.0"`).
194
+ */
195
+ dependsOn(id: string, minVersion?: string): this;
196
+ /** Declare a grant implied by this app's dependencies (`requires.grants`). */
197
+ requiredGrant(permission: string): this;
198
+ /**
199
+ * Declare an abstract **capability** edge (`requires.capabilities`) the broker
200
+ * resolves to a bound provider at enable time — e.g. `requiresCapability("rag")`.
201
+ * Distinct from a specific-plugin dependency: a capability edge lets the
202
+ * binding registry choose the provider. `minVersion` is a MINIMUM (`"1.2.0"`
203
+ * = `">=1.2.0"`).
204
+ */
205
+ requiresCapability(capability: string, minVersion?: string): this;
206
+ /** Restrict this app to a host surface. No target = every surface. */
207
+ target(surface: Surface): this;
208
+ /**
209
+ * Validate and return the assembled `PluginManifest`. Throws an `Error` naming
210
+ * the failing field when validation fails.
211
+ */
212
+ build(): PluginManifest;
213
+ }
214
+ /** Create an AppBuilder. */
215
+ declare const app: () => AppBuilder;
216
+
217
+ export { AgentBuilder, AppBuilder, PluginBuilder, SkillBuilder, ToolBuilder, WorkflowBuilder, agent, app, skill, tool, workflow };
@@ -0,0 +1,29 @@
1
+ import {
2
+ AgentBuilder,
3
+ AppBuilder,
4
+ PluginBuilder,
5
+ SkillBuilder,
6
+ ToolBuilder,
7
+ WorkflowBuilder,
8
+ agent,
9
+ app,
10
+ skill,
11
+ tool,
12
+ workflow
13
+ } from "./chunk-HLKJZAFK.js";
14
+ import "./chunk-SN2QBJUF.js";
15
+ import "./chunk-QYFUNJOH.js";
16
+ import "./chunk-NZKVOSC2.js";
17
+ export {
18
+ AgentBuilder,
19
+ AppBuilder,
20
+ PluginBuilder,
21
+ SkillBuilder,
22
+ ToolBuilder,
23
+ WorkflowBuilder,
24
+ agent,
25
+ app,
26
+ skill,
27
+ tool,
28
+ workflow
29
+ };
@@ -0,0 +1,94 @@
1
+ import {
2
+ defineTool,
3
+ inlineToolRunnable
4
+ } from "./chunk-QYFUNJOH.js";
5
+ import {
6
+ PluginManifestSchema
7
+ } from "./chunk-NZKVOSC2.js";
8
+
9
+ // src/runnable/action.ts
10
+ function deriveAnnotations(effect, annotations) {
11
+ const resolved = {
12
+ ...annotations,
13
+ readOnlyHint: annotations?.readOnlyHint ?? effect === "read",
14
+ destructiveHint: annotations?.destructiveHint ?? effect === "mutate"
15
+ };
16
+ if (effect === "read" && resolved.destructiveHint) {
17
+ throw new Error(
18
+ "[ryu-sdk] read actions cannot set annotations.destructiveHint=true"
19
+ );
20
+ }
21
+ if (effect === "mutate" && resolved.readOnlyHint) {
22
+ throw new Error(
23
+ "[ryu-sdk] mutate actions cannot set annotations.readOnlyHint=true"
24
+ );
25
+ }
26
+ return resolved;
27
+ }
28
+ function actionManifestEntry(action) {
29
+ const options = {
30
+ action: true,
31
+ annotations: action.annotations,
32
+ description: action.description,
33
+ needsApproval: action.needsApproval,
34
+ ...action.outputSchema ? { outputSchema: action.outputSchema } : {}
35
+ };
36
+ return inlineToolRunnable(action, options);
37
+ }
38
+ function actionToManifest(action, options) {
39
+ const grants = [.../* @__PURE__ */ new Set([...options.grants ?? [], "tool:execute"])];
40
+ const raw = {
41
+ id: options.id,
42
+ name: options.name ?? action.name,
43
+ version: options.version,
44
+ runnables: [actionManifestEntry(action)],
45
+ permission_grants: grants,
46
+ activation_events: [...options.activationEvents ?? ["*"]],
47
+ targets: [...options.targets ?? []]
48
+ };
49
+ const result = PluginManifestSchema.safeParse(raw);
50
+ if (!result.success) {
51
+ const first = result.error.issues[0];
52
+ const field = first?.path.join(".") ?? "unknown";
53
+ const message = first?.message ?? "validation failed";
54
+ throw new Error(
55
+ `[ryu-sdk] action manifest validation failed at '${field}': ${message}`
56
+ );
57
+ }
58
+ return result.data;
59
+ }
60
+ function defineAction(options) {
61
+ const annotations = deriveAnnotations(options.effect, options.annotations);
62
+ const tool = defineTool({
63
+ description: options.description,
64
+ id: options.id,
65
+ name: options.name,
66
+ run: options.run,
67
+ schema: options.schema
68
+ });
69
+ const action = {
70
+ ...tool,
71
+ action: true,
72
+ annotations,
73
+ description: options.description,
74
+ effect: options.effect,
75
+ needsApproval: options.needsApproval ?? false,
76
+ ...options.outputSchema ? { outputSchema: options.outputSchema } : {},
77
+ toManifest(manifestOptions) {
78
+ return actionToManifest(action, manifestOptions);
79
+ },
80
+ toMcpTool(context) {
81
+ return {
82
+ name: action.id,
83
+ description: action.description,
84
+ inputSchema: action.schema,
85
+ run: (input) => action.run(input, context)
86
+ };
87
+ }
88
+ };
89
+ return action;
90
+ }
91
+
92
+ export {
93
+ defineAction
94
+ };