@ryuhq/sdk 0.2.0 → 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 (66) hide show
  1. package/README.md +51 -2
  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.d.cts +1 -1
  7. package/dist/agent-plugin.d.ts +1 -1
  8. package/dist/agent.cjs +7 -0
  9. package/dist/agent.d.cts +1 -1
  10. package/dist/agent.d.ts +1 -1
  11. package/dist/agent.js +2 -2
  12. package/dist/{app-DNaGmLVf.d.cts → app-B0Z9Ew_R.d.cts} +18 -6
  13. package/dist/{app-Bkw7LlCK.d.ts → app-C-BDJwfG.d.ts} +18 -6
  14. package/dist/builder.cjs +110 -11
  15. package/dist/builder.d.cts +7 -2
  16. package/dist/builder.d.ts +7 -2
  17. package/dist/builder.js +4 -3
  18. package/dist/chunk-4TPUZDTI.js +94 -0
  19. package/dist/{chunk-T5676WL2.js → chunk-BC3A7HMO.js} +1 -77
  20. package/dist/{chunk-IOLP5FFE.js → chunk-HLKJZAFK.js} +9 -2
  21. package/dist/{chunk-IEUQ3CDG.js → chunk-NZKVOSC2.js} +71 -5
  22. package/dist/chunk-QYFUNJOH.js +83 -0
  23. package/dist/{chunk-W3KPP4WN.js → chunk-SN2QBJUF.js} +20 -7
  24. package/dist/{chunk-ULSVL7EC.js → chunk-Z57QDDJR.js} +1 -1
  25. package/dist/{chunk-A3RGEPDG.js → chunk-ZTJWBRUL.js} +32 -0
  26. package/dist/cli.cjs +93 -8
  27. package/dist/cli.js +33 -8
  28. package/dist/index.cjs +297 -87
  29. package/dist/index.d.cts +10 -9
  30. package/dist/index.d.ts +10 -9
  31. package/dist/index.js +34 -19
  32. package/dist/manifest.cjs +76 -6
  33. package/dist/manifest.d.cts +157 -5
  34. package/dist/manifest.d.ts +157 -5
  35. package/dist/manifest.js +9 -1
  36. package/dist/mcp/server.d.cts +2 -1
  37. package/dist/mcp/server.d.ts +2 -1
  38. package/dist/runnable.cjs +279 -71
  39. package/dist/runnable.d.cts +6 -3
  40. package/dist/runnable.d.ts +6 -3
  41. package/dist/runnable.js +11 -5
  42. package/dist/{tool-DSx2bFx8.d.ts → tool-AjkdFvhE.d.ts} +54 -4
  43. package/dist/{tool-u-VR0fLF.d.cts → tool-CgzW92O_.d.cts} +54 -4
  44. package/package.json +12 -3
  45. package/src/agent-plugin.ts +1 -1
  46. package/src/builder.ts +9 -0
  47. package/src/cli-security.test.ts +109 -0
  48. package/src/cli.ts +43 -10
  49. package/src/contracts-lockstep.test.ts +16 -2
  50. package/src/exports-lockstep.test.ts +1 -0
  51. package/src/generated/plugin-manifest.ts +82 -5
  52. package/src/index.ts +18 -0
  53. package/src/manifest.fixtures.test.ts +9 -3
  54. package/src/manifest.test.ts +69 -0
  55. package/src/manifest.ts +137 -18
  56. package/src/mcp/server.ts +2 -1
  57. package/src/runnable/action.test.ts +128 -0
  58. package/src/runnable/action.ts +202 -0
  59. package/src/runnable/app.ts +45 -12
  60. package/src/runnable/index.ts +18 -3
  61. package/src/runnable/primitives.test.ts +34 -0
  62. package/src/runnable/primitives.ts +59 -0
  63. package/src/runnable/runnable-types.ts +3 -0
  64. package/src/runnable/tool.ts +35 -4
  65. package/src/runnable/turn-hook.ts +4 -2
  66. package/src/slash-command.test.ts +69 -0
@@ -217,10 +217,80 @@ declare const ToolAppConfigSchema: z.ZodObject<{
217
217
  invoked: z.ZodOptional<z.ZodString>;
218
218
  }, z.core.$strip>;
219
219
  type ToolAppConfig = z.infer<typeof ToolAppConfigSchema>;
220
+ /** One selectable value for a plugin/app slash-command argument. */
221
+ declare const SlashCommandOptionSchema: z.ZodObject<{
222
+ description: z.ZodOptional<z.ZodString>;
223
+ label: z.ZodString;
224
+ value: z.ZodString;
225
+ }, z.core.$loose>;
226
+ type SlashCommandOption = z.infer<typeof SlashCommandOptionSchema>;
227
+ /** A registered free-form option shown alongside an argument's choices. */
228
+ declare const SlashCommandCustomOptionSchema: z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
229
+ description: z.ZodOptional<z.ZodString>;
230
+ label: z.ZodOptional<z.ZodString>;
231
+ }, z.core.$loose>]>;
232
+ type SlashCommandCustomOption = z.infer<typeof SlashCommandCustomOptionSchema>;
233
+ /** One sequential argument in a plugin/app slash command. */
234
+ declare const SlashCommandArgumentSchema: z.ZodObject<{
235
+ allow_custom: z.ZodOptional<z.ZodBoolean>;
236
+ custom: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
237
+ description: z.ZodOptional<z.ZodString>;
238
+ label: z.ZodOptional<z.ZodString>;
239
+ }, z.core.$loose>]>>;
240
+ description: z.ZodOptional<z.ZodString>;
241
+ name: z.ZodString;
242
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
243
+ description: z.ZodOptional<z.ZodString>;
244
+ label: z.ZodString;
245
+ value: z.ZodString;
246
+ }, z.core.$loose>>>;
247
+ }, z.core.$loose>;
248
+ type SlashCommandArgument = z.infer<typeof SlashCommandArgumentSchema>;
249
+ /**
250
+ * A command registered by a plugin or Ryu App. `args` is the preferred key;
251
+ * `parameters` is accepted as a readable alias for hand-authored manifests.
252
+ * Each argument's options are plugin-owned, so the shell never needs a closed
253
+ * enum for app-specific values.
254
+ */
255
+ declare const SlashCommandContributionSchema: z.ZodObject<{
256
+ args: z.ZodOptional<z.ZodArray<z.ZodObject<{
257
+ allow_custom: z.ZodOptional<z.ZodBoolean>;
258
+ custom: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
259
+ description: z.ZodOptional<z.ZodString>;
260
+ label: z.ZodOptional<z.ZodString>;
261
+ }, z.core.$loose>]>>;
262
+ description: z.ZodOptional<z.ZodString>;
263
+ name: z.ZodString;
264
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
265
+ description: z.ZodOptional<z.ZodString>;
266
+ label: z.ZodString;
267
+ value: z.ZodString;
268
+ }, z.core.$loose>>>;
269
+ }, z.core.$loose>>>;
270
+ body: z.ZodOptional<z.ZodString>;
271
+ command: z.ZodString;
272
+ description: z.ZodOptional<z.ZodString>;
273
+ id: z.ZodOptional<z.ZodString>;
274
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
275
+ allow_custom: z.ZodOptional<z.ZodBoolean>;
276
+ custom: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
277
+ description: z.ZodOptional<z.ZodString>;
278
+ label: z.ZodOptional<z.ZodString>;
279
+ }, z.core.$loose>]>>;
280
+ description: z.ZodOptional<z.ZodString>;
281
+ name: z.ZodString;
282
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
283
+ description: z.ZodOptional<z.ZodString>;
284
+ label: z.ZodString;
285
+ value: z.ZodString;
286
+ }, z.core.$loose>>>;
287
+ }, z.core.$loose>>>;
288
+ }, z.core.$loose>;
289
+ type SlashCommandContribution = z.infer<typeof SlashCommandContributionSchema>;
220
290
  /**
221
291
  * The `contributes` block. Mirrors `Contributes` in
222
292
  * `apps/core/src/plugin_manifest/mod.rs`. The declarative UI surfaces
223
- * (`composer_controls` / `chat_features` / `settings_tabs` / `slash_commands`) are passed verbatim
293
+ * (`composer_controls` / `chat_features` / `settings_tabs`) are passed verbatim
224
294
  * to the desktop renderer, so they are typed loosely here (records).
225
295
  */
226
296
  declare const ContributesSchema: z.ZodObject<{
@@ -245,7 +315,40 @@ declare const ContributesSchema: z.ZodObject<{
245
315
  composer_controls: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
246
316
  chat_features: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
247
317
  settings_tabs: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
248
- slash_commands: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
318
+ slash_commands: z.ZodDefault<z.ZodArray<z.ZodObject<{
319
+ args: z.ZodOptional<z.ZodArray<z.ZodObject<{
320
+ allow_custom: z.ZodOptional<z.ZodBoolean>;
321
+ custom: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
322
+ description: z.ZodOptional<z.ZodString>;
323
+ label: z.ZodOptional<z.ZodString>;
324
+ }, z.core.$loose>]>>;
325
+ description: z.ZodOptional<z.ZodString>;
326
+ name: z.ZodString;
327
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
328
+ description: z.ZodOptional<z.ZodString>;
329
+ label: z.ZodString;
330
+ value: z.ZodString;
331
+ }, z.core.$loose>>>;
332
+ }, z.core.$loose>>>;
333
+ body: z.ZodOptional<z.ZodString>;
334
+ command: z.ZodString;
335
+ description: z.ZodOptional<z.ZodString>;
336
+ id: z.ZodOptional<z.ZodString>;
337
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
338
+ allow_custom: z.ZodOptional<z.ZodBoolean>;
339
+ custom: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
340
+ description: z.ZodOptional<z.ZodString>;
341
+ label: z.ZodOptional<z.ZodString>;
342
+ }, z.core.$loose>]>>;
343
+ description: z.ZodOptional<z.ZodString>;
344
+ name: z.ZodString;
345
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
346
+ description: z.ZodOptional<z.ZodString>;
347
+ label: z.ZodString;
348
+ value: z.ZodString;
349
+ }, z.core.$loose>>>;
350
+ }, z.core.$loose>>>;
351
+ }, z.core.$loose>>>;
249
352
  widgets: z.ZodDefault<z.ZodArray<z.ZodObject<{
250
353
  tool_id: z.ZodString;
251
354
  uri: z.ZodString;
@@ -284,6 +387,7 @@ declare const ContributesSchema: z.ZodObject<{
284
387
  source: z.ZodOptional<z.ZodString>;
285
388
  }, z.core.$strip>>>;
286
389
  message_actions: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
390
+ selection_actions: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
287
391
  }, z.core.$strip>;
288
392
  type Contributes = z.infer<typeof ContributesSchema>;
289
393
  /**
@@ -434,6 +538,7 @@ declare const PluginManifestSchema: z.ZodObject<{
434
538
  id: z.ZodString;
435
539
  name: z.ZodString;
436
540
  version: z.ZodString;
541
+ stability: z.ZodOptional<z.ZodUnknown>;
437
542
  ui_code_sha256: z.ZodOptional<z.ZodNullable<z.ZodString>>;
438
543
  runnables: z.ZodDefault<z.ZodArray<z.ZodObject<{
439
544
  id: z.ZodString;
@@ -448,6 +553,17 @@ declare const PluginManifestSchema: z.ZodObject<{
448
553
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
449
554
  }, z.core.$strip>>>;
450
555
  permission_grants: z.ZodDefault<z.ZodArray<z.ZodString>>;
556
+ permissions: z.ZodOptional<z.ZodObject<{
557
+ fs: z.ZodOptional<z.ZodObject<{
558
+ read: z.ZodDefault<z.ZodArray<z.ZodString>>;
559
+ write: z.ZodDefault<z.ZodArray<z.ZodString>>;
560
+ }, z.core.$strip>>;
561
+ child_process: z.ZodOptional<z.ZodBoolean>;
562
+ run: z.ZodDefault<z.ZodArray<z.ZodString>>;
563
+ network: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
564
+ tool: z.ZodDefault<z.ZodArray<z.ZodString>>;
565
+ }, z.core.$strip>>;
566
+ permission_levels: z.ZodOptional<z.ZodUnknown>;
451
567
  mcp_servers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
452
568
  args: z.ZodDefault<z.ZodArray<z.ZodString>>;
453
569
  auth: z.ZodOptional<z.ZodObject<{
@@ -469,6 +585,7 @@ declare const PluginManifestSchema: z.ZodObject<{
469
585
  }>>;
470
586
  url: z.ZodOptional<z.ZodURL>;
471
587
  }, z.core.$strip>>>;
588
+ sidecars: z.ZodOptional<z.ZodUnknown>;
472
589
  companion: z.ZodOptional<z.ZodObject<{
473
590
  label: z.ZodString;
474
591
  icon: z.ZodOptional<z.ZodString>;
@@ -497,7 +614,40 @@ declare const PluginManifestSchema: z.ZodObject<{
497
614
  composer_controls: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
498
615
  chat_features: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
499
616
  settings_tabs: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
500
- slash_commands: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
617
+ slash_commands: z.ZodDefault<z.ZodArray<z.ZodObject<{
618
+ args: z.ZodOptional<z.ZodArray<z.ZodObject<{
619
+ allow_custom: z.ZodOptional<z.ZodBoolean>;
620
+ custom: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
621
+ description: z.ZodOptional<z.ZodString>;
622
+ label: z.ZodOptional<z.ZodString>;
623
+ }, z.core.$loose>]>>;
624
+ description: z.ZodOptional<z.ZodString>;
625
+ name: z.ZodString;
626
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
627
+ description: z.ZodOptional<z.ZodString>;
628
+ label: z.ZodString;
629
+ value: z.ZodString;
630
+ }, z.core.$loose>>>;
631
+ }, z.core.$loose>>>;
632
+ body: z.ZodOptional<z.ZodString>;
633
+ command: z.ZodString;
634
+ description: z.ZodOptional<z.ZodString>;
635
+ id: z.ZodOptional<z.ZodString>;
636
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
637
+ allow_custom: z.ZodOptional<z.ZodBoolean>;
638
+ custom: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
639
+ description: z.ZodOptional<z.ZodString>;
640
+ label: z.ZodOptional<z.ZodString>;
641
+ }, z.core.$loose>]>>;
642
+ description: z.ZodOptional<z.ZodString>;
643
+ name: z.ZodString;
644
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
645
+ description: z.ZodOptional<z.ZodString>;
646
+ label: z.ZodString;
647
+ value: z.ZodString;
648
+ }, z.core.$loose>>>;
649
+ }, z.core.$loose>>>;
650
+ }, z.core.$loose>>>;
501
651
  widgets: z.ZodDefault<z.ZodArray<z.ZodObject<{
502
652
  tool_id: z.ZodString;
503
653
  uri: z.ZodString;
@@ -536,6 +686,7 @@ declare const PluginManifestSchema: z.ZodObject<{
536
686
  source: z.ZodOptional<z.ZodString>;
537
687
  }, z.core.$strip>>>;
538
688
  message_actions: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
689
+ selection_actions: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
539
690
  }, z.core.$strip>>;
540
691
  requires: z.ZodOptional<z.ZodObject<{
541
692
  apps: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -558,6 +709,7 @@ declare const PluginManifestSchema: z.ZodObject<{
558
709
  web: "web";
559
710
  cli: "cli";
560
711
  }>>>;
712
+ surfaces: z.ZodOptional<z.ZodUnknown>;
561
713
  engines: z.ZodOptional<z.ZodObject<{
562
714
  cli: z.ZodOptional<z.ZodString>;
563
715
  desktop: z.ZodOptional<z.ZodString>;
@@ -627,7 +779,7 @@ declare const PluginManifestSchema: z.ZodObject<{
627
779
  actionLabel: z.ZodOptional<z.ZodString>;
628
780
  actionUrl: z.ZodOptional<z.ZodString>;
629
781
  }, z.core.$strip>>]>>;
630
- }, z.core.$strip>;
782
+ }, z.core.$loose>;
631
783
  type PluginManifest = z.infer<typeof PluginManifestSchema>;
632
784
  /**
633
785
  * Validate a plugin id with Core's strict reverse-domain, path-traversal-safe
@@ -646,4 +798,4 @@ declare function validateManifestStrict(manifestJson: string): string;
646
798
  */
647
799
  declare function coreManifestJsonSchema(): unknown;
648
800
 
649
- export { type AppDependency, AppDependencySchema, type CapabilityReq, CapabilityReqSchema, type ChatWidgetTemplate, ChatWidgetTemplateSchema, type CompanionSurface, CompanionSurfaceSchema, type Contributes, ContributesSchema, type EnginesReq, EnginesReqSchema, type HookEventContribution, HookEventContributionSchema, type McpServerAuth, McpServerAuthSchema, type McpServerDecl, McpServerDeclSchema, type OutputStyleContribution, OutputStyleContributionSchema, type PiExtensionContribution, PiExtensionContributionSchema, type PluginManifest, PluginManifestSchema, type Requires, RequiresSchema, type RunnableKind, RunnableKindSchema, type RunnableMeta, RunnableMetaSchema, type SetupStep, SetupStepSchema, type Surface, SurfaceSchema, type ToolAppConfig, ToolAppConfigSchema, type TurnHookContribution, TurnHookContributionSchema, type WidgetContribution, WidgetContributionSchema, coreManifestJsonSchema, labelImpersonatesSystemChrome, validateManifestStrict, validatePluginId };
801
+ export { type AppDependency, AppDependencySchema, type CapabilityReq, CapabilityReqSchema, type ChatWidgetTemplate, ChatWidgetTemplateSchema, type CompanionSurface, CompanionSurfaceSchema, type Contributes, ContributesSchema, type EnginesReq, EnginesReqSchema, type HookEventContribution, HookEventContributionSchema, type McpServerAuth, McpServerAuthSchema, type McpServerDecl, McpServerDeclSchema, type OutputStyleContribution, OutputStyleContributionSchema, type PiExtensionContribution, PiExtensionContributionSchema, type PluginManifest, PluginManifestSchema, type Requires, RequiresSchema, type RunnableKind, RunnableKindSchema, type RunnableMeta, RunnableMetaSchema, type SetupStep, SetupStepSchema, type SlashCommandArgument, SlashCommandArgumentSchema, type SlashCommandContribution, SlashCommandContributionSchema, type SlashCommandCustomOption, SlashCommandCustomOptionSchema, type SlashCommandOption, SlashCommandOptionSchema, type Surface, SurfaceSchema, type ToolAppConfig, ToolAppConfigSchema, type TurnHookContribution, TurnHookContributionSchema, type WidgetContribution, WidgetContributionSchema, coreManifestJsonSchema, labelImpersonatesSystemChrome, validateManifestStrict, validatePluginId };
package/dist/manifest.js CHANGED
@@ -15,6 +15,10 @@ import {
15
15
  RunnableKindSchema,
16
16
  RunnableMetaSchema,
17
17
  SetupStepSchema,
18
+ SlashCommandArgumentSchema,
19
+ SlashCommandContributionSchema,
20
+ SlashCommandCustomOptionSchema,
21
+ SlashCommandOptionSchema,
18
22
  SurfaceSchema,
19
23
  ToolAppConfigSchema,
20
24
  TurnHookContributionSchema,
@@ -23,7 +27,7 @@ import {
23
27
  labelImpersonatesSystemChrome,
24
28
  validateManifestStrict,
25
29
  validatePluginId
26
- } from "./chunk-IEUQ3CDG.js";
30
+ } from "./chunk-NZKVOSC2.js";
27
31
  export {
28
32
  AppDependencySchema,
29
33
  CapabilityReqSchema,
@@ -41,6 +45,10 @@ export {
41
45
  RunnableKindSchema,
42
46
  RunnableMetaSchema,
43
47
  SetupStepSchema,
48
+ SlashCommandArgumentSchema,
49
+ SlashCommandContributionSchema,
50
+ SlashCommandCustomOptionSchema,
51
+ SlashCommandOptionSchema,
44
52
  SurfaceSchema,
45
53
  ToolAppConfigSchema,
46
54
  TurnHookContributionSchema,
@@ -24,7 +24,8 @@ import { McpStdioCommand } from './client.cjs';
24
24
  /** JSON Schema fragment — enough to describe a tool's input arguments. */
25
25
  interface JsonSchema {
26
26
  description?: string;
27
- properties?: Record<string, JsonSchema>;
27
+ /** Property schemas may use any JSON Schema dialect or nested shape. */
28
+ properties?: Record<string, unknown>;
28
29
  required?: string[];
29
30
  type?: string;
30
31
  [key: string]: unknown;
@@ -24,7 +24,8 @@ import { McpStdioCommand } from './client.js';
24
24
  /** JSON Schema fragment — enough to describe a tool's input arguments. */
25
25
  interface JsonSchema {
26
26
  description?: string;
27
- properties?: Record<string, JsonSchema>;
27
+ /** Property schemas may use any JSON Schema dialect or nested shape. */
28
+ properties?: Record<string, unknown>;
28
29
  required?: string[];
29
30
  type?: string;
30
31
  [key: string]: unknown;