@ryuhq/sdk 0.0.5
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.
- package/LICENSE +179 -0
- package/README.md +31 -0
- package/dist/agent.cjs +761 -0
- package/dist/agent.d.cts +3 -0
- package/dist/agent.d.ts +3 -0
- package/dist/agent.js +23 -0
- package/dist/chunk-GXHL5CO7.js +353 -0
- package/dist/chunk-KPKMMGVC.js +671 -0
- package/dist/chunk-ODFEUVPW.js +100 -0
- package/dist/cli.cjs +858 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +454 -0
- package/dist/index-CEbS1SlS.d.cts +988 -0
- package/dist/index-DAxq7Y0R.d.ts +988 -0
- package/dist/index.cjs +1900 -0
- package/dist/index.d.cts +759 -0
- package/dist/index.d.ts +759 -0
- package/dist/index.js +771 -0
- package/dist/manifest.cjs +399 -0
- package/dist/manifest.d.cts +355 -0
- package/dist/manifest.d.ts +355 -0
- package/dist/manifest.js +38 -0
- package/package.json +56 -0
- package/src/agent/agent.ts +208 -0
- package/src/agent/index.ts +51 -0
- package/src/agent/loop.test.ts +261 -0
- package/src/agent/loop.ts +259 -0
- package/src/agent/model-call.ts +190 -0
- package/src/agent/query.ts +40 -0
- package/src/agent/tools.ts +295 -0
- package/src/builder.ts +473 -0
- package/src/cli/dev.test.ts +178 -0
- package/src/cli/dev.ts +425 -0
- package/src/cli.ts +390 -0
- package/src/contracts-lockstep.test.ts +77 -0
- package/src/generated/plugin-manifest.ts +1121 -0
- package/src/index.ts +141 -0
- package/src/manifest.test.ts +610 -0
- package/src/manifest.ts +589 -0
- package/src/mcp/bridge.test.ts +196 -0
- package/src/mcp/client.ts +253 -0
- package/src/mcp/fixture-server.ts +23 -0
- package/src/mcp/server.ts +351 -0
- package/src/model/client.test.ts +107 -0
- package/src/model/client.ts +179 -0
- package/src/model/gateway.ts +41 -0
- package/src/plugin/ryu-plugin.ts +191 -0
- package/src/runnable/agent.ts +338 -0
- package/src/runnable/app.ts +233 -0
- package/src/runnable/index.ts +61 -0
- package/src/runnable/primitives-hostapi.test.ts +73 -0
- package/src/runnable/primitives.test.ts +286 -0
- package/src/runnable/primitives.ts +610 -0
- package/src/runnable/runnable-types.ts +113 -0
- package/src/runnable/runnable.test.ts +397 -0
- package/src/runnable/skill.ts +60 -0
- package/src/runnable/tool.ts +260 -0
- package/src/runnable/turn-hook.test.ts +81 -0
- package/src/runnable/turn-hook.ts +191 -0
- package/src/runnable/workflow.ts +76 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/manifest.ts
|
|
21
|
+
var manifest_exports = {};
|
|
22
|
+
__export(manifest_exports, {
|
|
23
|
+
AppDependencySchema: () => AppDependencySchema,
|
|
24
|
+
CapabilityReqSchema: () => CapabilityReqSchema,
|
|
25
|
+
CompanionSurfaceSchema: () => CompanionSurfaceSchema,
|
|
26
|
+
ContributesSchema: () => ContributesSchema,
|
|
27
|
+
PluginManifestSchema: () => PluginManifestSchema,
|
|
28
|
+
RequiresSchema: () => RequiresSchema,
|
|
29
|
+
RunnableKindSchema: () => RunnableKindSchema,
|
|
30
|
+
RunnableMetaSchema: () => RunnableMetaSchema,
|
|
31
|
+
SetupStepSchema: () => SetupStepSchema,
|
|
32
|
+
SurfaceSchema: () => SurfaceSchema,
|
|
33
|
+
ToolAppConfigSchema: () => ToolAppConfigSchema,
|
|
34
|
+
TurnHookContributionSchema: () => TurnHookContributionSchema,
|
|
35
|
+
WidgetContributionSchema: () => WidgetContributionSchema,
|
|
36
|
+
coreManifestJsonSchema: () => coreManifestJsonSchema,
|
|
37
|
+
labelImpersonatesSystemChrome: () => labelImpersonatesSystemChrome,
|
|
38
|
+
validateManifestStrict: () => validateManifestStrict,
|
|
39
|
+
validatePluginId: () => validatePluginId
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(manifest_exports);
|
|
42
|
+
|
|
43
|
+
// ../../node_modules/.bun/tsup@8.5.1+7a7b737fa55947b7/node_modules/tsup/assets/cjs_shims.js
|
|
44
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
45
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
46
|
+
|
|
47
|
+
// src/manifest.ts
|
|
48
|
+
var import_node_module = require("module");
|
|
49
|
+
var import_zod = require("zod");
|
|
50
|
+
var cachedNative = null;
|
|
51
|
+
var nativeLoadError = null;
|
|
52
|
+
function loadNative() {
|
|
53
|
+
if (cachedNative) {
|
|
54
|
+
return cachedNative;
|
|
55
|
+
}
|
|
56
|
+
if (nativeLoadError) {
|
|
57
|
+
throw nativeLoadError;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const req = (0, import_node_module.createRequire)(importMetaUrl);
|
|
61
|
+
cachedNative = req("@ryuhq/sdk-native");
|
|
62
|
+
return cachedNative;
|
|
63
|
+
} catch (cause) {
|
|
64
|
+
nativeLoadError = new Error(
|
|
65
|
+
"@ryuhq/sdk-native (the Rust-cored napi addon) is not available; Core-strict manifest validation requires it. Build/install the addon, or use PluginManifestSchema (pure-JS zod) for authoring-time validation.",
|
|
66
|
+
{ cause }
|
|
67
|
+
);
|
|
68
|
+
throw nativeLoadError;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
var RunnableKindSchema = import_zod.z.enum([
|
|
72
|
+
"agent",
|
|
73
|
+
"workflow",
|
|
74
|
+
"tool",
|
|
75
|
+
"skill",
|
|
76
|
+
// A companion surface (in-desktop panel). Added so a packable plugin can
|
|
77
|
+
// declare a companion runnable that flows through Core's existing Companion
|
|
78
|
+
// handler → app_contrib → `GET /api/plugins/contributions` → the desktop
|
|
79
|
+
// `/plugin/<id>` route. Its `config.ui_entry` (see `CompanionRunnableConfigSchema`)
|
|
80
|
+
// is what `ryu pack` bundles into `ui_code`.
|
|
81
|
+
"companion"
|
|
82
|
+
]);
|
|
83
|
+
var RunnableMetaSchema = import_zod.z.object({
|
|
84
|
+
/** Stable unique identifier (e.g. `"agent-researcher"`). */
|
|
85
|
+
id: import_zod.z.string().min(1),
|
|
86
|
+
/** Human-readable display name. */
|
|
87
|
+
name: import_zod.z.string().min(1),
|
|
88
|
+
/** Which kind of runnable this entry describes. */
|
|
89
|
+
kind: RunnableKindSchema,
|
|
90
|
+
/**
|
|
91
|
+
* Optional per-kind config blob. Mirrors Core's `RunnableEntry.config`
|
|
92
|
+
* (`Option<serde_json::Value>`) so a manifest authored here round-trips
|
|
93
|
+
* through Core-strict validation. Left opaque (a record) at this authoring
|
|
94
|
+
* layer; the per-kind shape is enforced by Core's `validate_runnable`.
|
|
95
|
+
*
|
|
96
|
+
* For a `companion` runnable, `config.ui_entry` names the plugin's UI entry
|
|
97
|
+
* module (relative to the manifest dir). `ryu pack` bundles that entry into
|
|
98
|
+
* the emitted `ui_code`; Core's `CompanionConfig.ui_entry` is the lockstep
|
|
99
|
+
* field so a packed companion validates.
|
|
100
|
+
*/
|
|
101
|
+
config: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional()
|
|
102
|
+
});
|
|
103
|
+
function labelImpersonatesSystemChrome(label) {
|
|
104
|
+
const lower = label.toLowerCase();
|
|
105
|
+
return lower.includes("ryu") || lower.includes("system");
|
|
106
|
+
}
|
|
107
|
+
var CompanionSurfaceSchema = import_zod.z.object({
|
|
108
|
+
/** Display label for the companion panel tab or tooltip. Anti-impersonation:
|
|
109
|
+
* may not pose as first-party Ryu/system chrome (see
|
|
110
|
+
* {@link labelImpersonatesSystemChrome}). */
|
|
111
|
+
label: import_zod.z.string().min(1).refine((value) => !labelImpersonatesSystemChrome(value), {
|
|
112
|
+
message: "companion label must not impersonate system chrome (must not contain 'ryu' or 'system')"
|
|
113
|
+
}),
|
|
114
|
+
/** Icon identifier resolved by the desktop shell. */
|
|
115
|
+
icon: import_zod.z.string().optional(),
|
|
116
|
+
/** Keyboard shortcut string (e.g. `"ctrl+shift+r"`). */
|
|
117
|
+
shortcut: import_zod.z.string().optional()
|
|
118
|
+
});
|
|
119
|
+
var TurnHookContributionSchema = import_zod.z.object({
|
|
120
|
+
/** Stable id for this hook (unique within the plugin). */
|
|
121
|
+
id: import_zod.z.string().min(1),
|
|
122
|
+
/** Turn boundary this fires on. Today only `"post_assistant_turn"`. */
|
|
123
|
+
on: import_zod.z.string().min(1).default("post_assistant_turn"),
|
|
124
|
+
/** The JS hook body executed in the sandbox (returns a directive). */
|
|
125
|
+
code: import_zod.z.string().min(1)
|
|
126
|
+
});
|
|
127
|
+
var DEFAULT_WIDGET_MIME = "text/html+skybridge";
|
|
128
|
+
var DEFAULT_WIDGET_DISPLAY_MODE = "inline";
|
|
129
|
+
var WidgetContributionSchema = import_zod.z.object({
|
|
130
|
+
/** The fully-qualified tool id whose result renders this widget. */
|
|
131
|
+
tool_id: import_zod.z.string().min(1),
|
|
132
|
+
/** `ui://widget/<slug>.html` — the widget resource uri. */
|
|
133
|
+
uri: import_zod.z.string().min(1),
|
|
134
|
+
/** Source entry (e.g. `src/apps/checklist/index.tsx`) for `ryu pack`. */
|
|
135
|
+
ui_entry: import_zod.z.string().optional(),
|
|
136
|
+
/** Widget MIME dialect (default `text/html+skybridge`). */
|
|
137
|
+
mime: import_zod.z.string().default(DEFAULT_WIDGET_MIME),
|
|
138
|
+
/** Default display mode (`inline` | `fullscreen` | `pip`). */
|
|
139
|
+
default_display_mode: import_zod.z.string().default(DEFAULT_WIDGET_DISPLAY_MODE)
|
|
140
|
+
});
|
|
141
|
+
var ToolAppConfigSchema = import_zod.z.object({
|
|
142
|
+
/** MCP tool slug this runnable wraps — the fully-qualified `<server>__<name>` id. */
|
|
143
|
+
slug: import_zod.z.string().min(1),
|
|
144
|
+
/** The tool description the model reads when choosing it. Carried here because a
|
|
145
|
+
* packed app's manifest is the only channel (there is no `generated.rs`); Core's
|
|
146
|
+
* app-tool synthesis reads it back onto the `RegistryTool`. */
|
|
147
|
+
description: import_zod.z.string(),
|
|
148
|
+
/** JSON Schema for the tool's arguments (used for validation + the LLM tool
|
|
149
|
+
* surface). Snake_case to match `widget_accessible`. Absent = no arguments. */
|
|
150
|
+
input_schema: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional(),
|
|
151
|
+
/** True when calling this tool renders the app's widget (carries the template). */
|
|
152
|
+
widget: import_zod.z.boolean().default(false),
|
|
153
|
+
/** True when a mounted widget may `callTool` this tool (a companion), or when a
|
|
154
|
+
* render tool's widget may call any companion the app declares. */
|
|
155
|
+
widget_accessible: import_zod.z.boolean().default(false),
|
|
156
|
+
/** Optional status label shown while the render tool runs. */
|
|
157
|
+
invoking: import_zod.z.string().optional(),
|
|
158
|
+
/** Optional status label shown when the render tool finishes. */
|
|
159
|
+
invoked: import_zod.z.string().optional()
|
|
160
|
+
});
|
|
161
|
+
var ContributesSchema = import_zod.z.object({
|
|
162
|
+
turn_hooks: import_zod.z.array(TurnHookContributionSchema).default([]),
|
|
163
|
+
composer_controls: import_zod.z.array(import_zod.z.record(import_zod.z.string(), import_zod.z.unknown())).default([]),
|
|
164
|
+
settings_tabs: import_zod.z.array(import_zod.z.record(import_zod.z.string(), import_zod.z.unknown())).default([]),
|
|
165
|
+
slash_commands: import_zod.z.array(import_zod.z.record(import_zod.z.string(), import_zod.z.unknown())).default([]),
|
|
166
|
+
/** App widgets (Ryu Apps). Each binds a render tool id to its
|
|
167
|
+
* `ui://widget/<slug>.html` template. Mirrors the Rust-side
|
|
168
|
+
* `Contributes.widgets` field, without which the CLI's zod parse would strip
|
|
169
|
+
* every widget an app authored here declares. */
|
|
170
|
+
widgets: import_zod.z.array(WidgetContributionSchema).default([])
|
|
171
|
+
});
|
|
172
|
+
var SetupStepSchema = import_zod.z.object({
|
|
173
|
+
/** Card heading (e.g. the companion app name). */
|
|
174
|
+
title: import_zod.z.string().optional(),
|
|
175
|
+
/** Instruction body shown under the title. */
|
|
176
|
+
description: import_zod.z.string().optional(),
|
|
177
|
+
/** Label for the optional action button. */
|
|
178
|
+
actionLabel: import_zod.z.string().optional(),
|
|
179
|
+
/** URL the action button opens (validated server-side on publish). */
|
|
180
|
+
actionUrl: import_zod.z.string().optional()
|
|
181
|
+
});
|
|
182
|
+
var AppDependencySchema = import_zod.z.object({
|
|
183
|
+
/** The `id` of the plugin this one depends on. */
|
|
184
|
+
id: import_zod.z.string().min(1, "dependency id is required"),
|
|
185
|
+
/** Optional MINIMUM version the dependency must satisfy (`"1.2.0"` = `">=1.2.0"`). */
|
|
186
|
+
min_version: import_zod.z.string().min(1).optional()
|
|
187
|
+
});
|
|
188
|
+
var CapabilityReqSchema = import_zod.z.object({
|
|
189
|
+
/** Capability name (e.g. `"rag"`, `"memory"`, `"tts"`). Matched against a
|
|
190
|
+
* provider's `provides[].capability`. */
|
|
191
|
+
capability: import_zod.z.string().min(1, "capability name is required"),
|
|
192
|
+
/** Optional MINIMUM capability version the bound provider must satisfy
|
|
193
|
+
* (`"1.2.0"` = `">=1.2.0"`). Absent = any version. */
|
|
194
|
+
min_version: import_zod.z.string().min(1).optional()
|
|
195
|
+
});
|
|
196
|
+
var RequiresSchema = import_zod.z.object({
|
|
197
|
+
/** Other plugins that must be installed + enabled before this one enables. */
|
|
198
|
+
apps: import_zod.z.array(AppDependencySchema).default([]),
|
|
199
|
+
/**
|
|
200
|
+
* Abstract capability edges the broker resolves to a bound provider at
|
|
201
|
+
* enable time. Mirrors `Requires::capabilities` in
|
|
202
|
+
* `crates/ryu-kernel-contracts` — an `apps` edge names a specific plugin; a
|
|
203
|
+
* `capabilities` edge names a capability and lets the binding registry choose
|
|
204
|
+
* the provider. Each is lowered to an app-id graph edge once bound, so the
|
|
205
|
+
* enable/disable/cycle machinery is shared. Empty for the common case.
|
|
206
|
+
*/
|
|
207
|
+
capabilities: import_zod.z.array(CapabilityReqSchema).default([]),
|
|
208
|
+
/**
|
|
209
|
+
* Permission grants implied by the dependencies. Declaration only — the
|
|
210
|
+
* Gateway remains the sole authority on what a grant *allows*, and Core's
|
|
211
|
+
* dependency graph resolves `apps` only.
|
|
212
|
+
*/
|
|
213
|
+
grants: import_zod.z.array(import_zod.z.string()).default([])
|
|
214
|
+
});
|
|
215
|
+
var SurfaceSchema = import_zod.z.enum([
|
|
216
|
+
/** The Ryu Gateway. */
|
|
217
|
+
"gateway",
|
|
218
|
+
/** A headless Core node (no UI). */
|
|
219
|
+
"core",
|
|
220
|
+
/** The Tauri desktop app. */
|
|
221
|
+
"desktop",
|
|
222
|
+
/** The Electron dynamic-island companion. */
|
|
223
|
+
"island",
|
|
224
|
+
/** The Expo/React-Native mobile app. */
|
|
225
|
+
"mobile",
|
|
226
|
+
/** The browser extension. */
|
|
227
|
+
"extension",
|
|
228
|
+
/** The Next.js web app. */
|
|
229
|
+
"web",
|
|
230
|
+
/** The terminal client. */
|
|
231
|
+
"cli"
|
|
232
|
+
]);
|
|
233
|
+
var PluginManifestSchema = import_zod.z.object({
|
|
234
|
+
/** Reverse-domain unique identifier (e.g. `"com.example.my-plugin"`). */
|
|
235
|
+
id: import_zod.z.string().min(1, "id is required"),
|
|
236
|
+
/** Human-readable display name shown in the plugin store / launcher. */
|
|
237
|
+
name: import_zod.z.string().min(1, "name is required"),
|
|
238
|
+
/**
|
|
239
|
+
* Semver version string (e.g. `"1.0.0"`). Core's loader rejects any manifest
|
|
240
|
+
* whose version is not valid semver; the regex here enforces the same rule at
|
|
241
|
+
* SDK-build time.
|
|
242
|
+
*/
|
|
243
|
+
version: import_zod.z.string().regex(
|
|
244
|
+
/^\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?$/,
|
|
245
|
+
"version must be a valid semver string (e.g. 1.0.0)"
|
|
246
|
+
),
|
|
247
|
+
/**
|
|
248
|
+
* Lower-case hex `sha256(utf8_bytes(ui_code))` binding the plugin's bundled
|
|
249
|
+
* sandboxed-UI code to this manifest. `ryu pack` / `ryu publish` compute it and
|
|
250
|
+
* write it here BEFORE the manifest is signed, so the hash rides INSIDE the
|
|
251
|
+
* Gateway-signed surface while the `ui_code` blob rides OUTSIDE it as payload;
|
|
252
|
+
* Core's install path recomputes the hash over the fetched code and rejects a
|
|
253
|
+
* mismatch fail-closed. Absent for a manifest-only plugin (no bundled UI).
|
|
254
|
+
* Mirrors Core's `PluginManifest.ui_code_sha256`.
|
|
255
|
+
*/
|
|
256
|
+
ui_code_sha256: import_zod.z.string().nullish(),
|
|
257
|
+
/** The Runnables this plugin bundles. */
|
|
258
|
+
runnables: import_zod.z.array(RunnableMetaSchema).default([]),
|
|
259
|
+
/**
|
|
260
|
+
* Permission grants this plugin declares it needs (e.g. `"mcp:web_search"`).
|
|
261
|
+
* Declarations only — grant enforcement is the Gateway's responsibility.
|
|
262
|
+
*/
|
|
263
|
+
permission_grants: import_zod.z.array(import_zod.z.string()).default([]),
|
|
264
|
+
/**
|
|
265
|
+
* Optional Companion surface (an in-desktop overlay or sidebar panel).
|
|
266
|
+
* Absent when the plugin has no Companion surface.
|
|
267
|
+
*/
|
|
268
|
+
companion: CompanionSurfaceSchema.optional(),
|
|
269
|
+
/**
|
|
270
|
+
* VS-Code-style activation events (`"*"`, `"onStartup"`, `"onChat"`,
|
|
271
|
+
* `"onCommand:<id>"`). Empty = eager. Turn-hook plugins are driven by their
|
|
272
|
+
* enabled flag, so `["*"]` is the usual value.
|
|
273
|
+
*/
|
|
274
|
+
activation_events: import_zod.z.array(import_zod.z.string()).default([]),
|
|
275
|
+
/**
|
|
276
|
+
* Contribution points: server-side turn hooks + declarative UI widgets.
|
|
277
|
+
* Absent for a plugin that contributes nothing here.
|
|
278
|
+
*/
|
|
279
|
+
contributes: ContributesSchema.optional(),
|
|
280
|
+
/**
|
|
281
|
+
* **Plugin-to-plugin dependencies** — the other plugins this one needs. Core
|
|
282
|
+
* resolves them into a topological enable order (dependencies enable first;
|
|
283
|
+
* disabling one is refused while an enabled dependent needs it).
|
|
284
|
+
*
|
|
285
|
+
* Absent = **no dependencies**, the backward-compatible default. Kept
|
|
286
|
+
* `.optional()` (never defaulted) so a manifest that declares none serialises
|
|
287
|
+
* with no `requires` key at all, exactly like Core's
|
|
288
|
+
* `#[serde(skip_serializing_if = "Option::is_none")]`.
|
|
289
|
+
*/
|
|
290
|
+
requires: RequiresSchema.optional(),
|
|
291
|
+
/**
|
|
292
|
+
* Host surfaces this plugin runs on. **Empty or absent = runs on EVERY
|
|
293
|
+
* surface** — the backward-compatible default, which must never be read as
|
|
294
|
+
* "runs nowhere". Core filters only when the list is explicitly non-empty, and
|
|
295
|
+
* only at the read boundary (`GET /api/plugins`, keyed on `x-ryu-surface`), so
|
|
296
|
+
* an unsupported-target plugin stays installable and inspectable.
|
|
297
|
+
*/
|
|
298
|
+
targets: import_zod.z.array(SurfaceSchema).default([]),
|
|
299
|
+
/**
|
|
300
|
+
* Optional per-item AFFILIATE terms: the commission paid to a referrer when a
|
|
301
|
+
* referred user buys this (paid) item. `value` is basis points for `percent`
|
|
302
|
+
* (2000 = 20%) or minor units (cents) for `flat`. Absent (or `enabled:false`)
|
|
303
|
+
* falls back to the seller org owner's default affiliate terms. This is the
|
|
304
|
+
* authoring surface for the marketplace publish body's `affiliate` field (the
|
|
305
|
+
* server re-validates it); it only takes effect on a paid item.
|
|
306
|
+
*/
|
|
307
|
+
affiliate: import_zod.z.object({
|
|
308
|
+
enabled: import_zod.z.boolean().default(false),
|
|
309
|
+
rule: import_zod.z.object({
|
|
310
|
+
type: import_zod.z.enum(["percent", "flat"]),
|
|
311
|
+
value: import_zod.z.number().nonnegative(),
|
|
312
|
+
recurring: import_zod.z.boolean().default(false),
|
|
313
|
+
durationMonths: import_zod.z.number().int().positive().nullish(),
|
|
314
|
+
fundedBy: import_zod.z.enum(["platform", "seller"]).default("platform")
|
|
315
|
+
}).optional()
|
|
316
|
+
}).optional(),
|
|
317
|
+
// ── Rich listing metadata (Phase 1.5) ──────────────────────────────────────
|
|
318
|
+
// Optional store-listing fields a plugin author declares so the marketplace
|
|
319
|
+
// detail dialog renders a richer App-Store-style preview. Field names align
|
|
320
|
+
// with the Claude `.claude-plugin/marketplace.json` plugin-entry standard where
|
|
321
|
+
// one exists (`author`, `homepage`, `keywords`, `category`, `license`); the
|
|
322
|
+
// rest are Ryu extensions. `ryu publish` forwards these FLAT into the publish
|
|
323
|
+
// body (not inside the signed manifest blob) so the control plane stores them.
|
|
324
|
+
// All optional + additive: a manifest omitting them still validates.
|
|
325
|
+
/** Longer plain/markdown description shown in the detail dialog. */
|
|
326
|
+
description: import_zod.z.string().optional(),
|
|
327
|
+
/** Short one-line pitch shown under the name (Ryu extension). */
|
|
328
|
+
tagline: import_zod.z.string().optional(),
|
|
329
|
+
/**
|
|
330
|
+
* Publisher identity. A bare string OR a Claude-style object; `ryu publish`
|
|
331
|
+
* resolves it to the display `developer` (`author.name` when an object).
|
|
332
|
+
*/
|
|
333
|
+
author: import_zod.z.union([
|
|
334
|
+
import_zod.z.string(),
|
|
335
|
+
import_zod.z.object({
|
|
336
|
+
name: import_zod.z.string(),
|
|
337
|
+
email: import_zod.z.string().optional(),
|
|
338
|
+
url: import_zod.z.string().optional()
|
|
339
|
+
})
|
|
340
|
+
]).optional(),
|
|
341
|
+
/** Project/marketing homepage — maps to the listing `website` (Claude field). */
|
|
342
|
+
homepage: import_zod.z.string().optional(),
|
|
343
|
+
/** Free-text search keywords (Claude field). */
|
|
344
|
+
keywords: import_zod.z.array(import_zod.z.string()).optional(),
|
|
345
|
+
/** Taxonomy category beyond the runnable kinds (Claude field). */
|
|
346
|
+
category: import_zod.z.string().optional(),
|
|
347
|
+
/** SPDX-ish license identifier (Claude field). */
|
|
348
|
+
license: import_zod.z.string().optional(),
|
|
349
|
+
/** Square logo/icon URL for the listing card + detail header. */
|
|
350
|
+
iconUrl: import_zod.z.string().optional(),
|
|
351
|
+
/** Ordered App-Store-style screenshot gallery URLs (Ryu extension). */
|
|
352
|
+
screenshots: import_zod.z.array(import_zod.z.string()).optional(),
|
|
353
|
+
/** Privacy policy URL surfaced on detail (Ryu extension). */
|
|
354
|
+
privacyPolicyUrl: import_zod.z.string().optional(),
|
|
355
|
+
/** Terms-of-service URL surfaced on detail (Ryu extension). */
|
|
356
|
+
termsOfServiceUrl: import_zod.z.string().optional(),
|
|
357
|
+
/**
|
|
358
|
+
* Human-readable capability strings (Ryu extension). When omitted the control
|
|
359
|
+
* plane derives a default from `permission_grants`, so declaring this is only
|
|
360
|
+
* needed to override the derived labels.
|
|
361
|
+
*/
|
|
362
|
+
capabilities: import_zod.z.array(import_zod.z.string()).optional(),
|
|
363
|
+
/** Example prompt chips shown on detail (Ryu extension). */
|
|
364
|
+
examplePrompts: import_zod.z.array(import_zod.z.string()).optional(),
|
|
365
|
+
/**
|
|
366
|
+
* Optional companion/config card (Ryu extension): a single setup step or an
|
|
367
|
+
* array of steps guiding the user through post-install configuration.
|
|
368
|
+
*/
|
|
369
|
+
setup: import_zod.z.union([SetupStepSchema, import_zod.z.array(SetupStepSchema)]).optional()
|
|
370
|
+
});
|
|
371
|
+
function validatePluginId(id) {
|
|
372
|
+
loadNative().validatePluginId(id);
|
|
373
|
+
}
|
|
374
|
+
function validateManifestStrict(manifestJson) {
|
|
375
|
+
return loadNative().parseAndValidateManifest(manifestJson);
|
|
376
|
+
}
|
|
377
|
+
function coreManifestJsonSchema() {
|
|
378
|
+
return JSON.parse(loadNative().pluginManifestJsonSchema());
|
|
379
|
+
}
|
|
380
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
381
|
+
0 && (module.exports = {
|
|
382
|
+
AppDependencySchema,
|
|
383
|
+
CapabilityReqSchema,
|
|
384
|
+
CompanionSurfaceSchema,
|
|
385
|
+
ContributesSchema,
|
|
386
|
+
PluginManifestSchema,
|
|
387
|
+
RequiresSchema,
|
|
388
|
+
RunnableKindSchema,
|
|
389
|
+
RunnableMetaSchema,
|
|
390
|
+
SetupStepSchema,
|
|
391
|
+
SurfaceSchema,
|
|
392
|
+
ToolAppConfigSchema,
|
|
393
|
+
TurnHookContributionSchema,
|
|
394
|
+
WidgetContributionSchema,
|
|
395
|
+
coreManifestJsonSchema,
|
|
396
|
+
labelImpersonatesSystemChrome,
|
|
397
|
+
validateManifestStrict,
|
|
398
|
+
validatePluginId
|
|
399
|
+
});
|