@ramme-io/devkit 0.3.2 → 0.5.0

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.
@@ -42,6 +42,7 @@ var RammeApiError = class extends Error {
42
42
  this.code = code;
43
43
  }
44
44
  };
45
+ var NO_LIBRARY = "This server keeps no saved apps \u2014 ramme.io does. Send the app to a board instead.";
45
46
  var HINTS = {
46
47
  NOT_SIGNED_IN: "No working token. Make one on ramme.io under Settings \u2192 Access tokens (or use the one your own server printed), then run `ramme login` or set RAMME_TOKEN.",
47
48
  TOKEN_SCOPE: "",
@@ -86,9 +87,32 @@ var createClient = (options) => {
86
87
  },
87
88
  send: async (deviceId, document) => await call("POST", "/api/device/send", { deviceId, document }),
88
89
  rename: async (deviceId, label) => await call("PATCH", "/api/device/claim", { deviceId, label }),
89
- change: async (deviceId, change) => await call("POST", "/api/device/shelf", { deviceId, ...change })
90
+ change: async (deviceId, change) => await call("POST", "/api/device/shelf", { deviceId, ...change }),
91
+ savedApps: async () => (await library(() => call("GET", "/api/account/apps"))).apps,
92
+ savedApp: async (id) => (await library(() => call("GET", `/api/account/apps?id=${encodeURIComponent(id)}`))).app,
93
+ saveApp: async (document) => await library(() => call("PUT", "/api/account/apps", { document })),
94
+ deleteApp: async (id) => {
95
+ await library(() => call("DELETE", `/api/account/apps?id=${encodeURIComponent(id)}`));
96
+ }
90
97
  };
91
98
  };
99
+ var library = async (run) => {
100
+ try {
101
+ return await run();
102
+ } catch (e) {
103
+ if (e instanceof RammeApiError && (e.code === "HTTP_404" || e.code === "NOT_FOUND")) throw new RammeApiError(404, "NO_LIBRARY", NO_LIBRARY);
104
+ throw e;
105
+ }
106
+ };
107
+ var resolveSavedApp = (apps, said) => {
108
+ const want = said.trim().toLowerCase();
109
+ const byId = apps.find((a) => a.id === want);
110
+ if (byId) return byId;
111
+ const named = apps.filter((a) => a.name.trim().toLowerCase() === want);
112
+ if (named.length === 1) return named[0];
113
+ if (named.length > 1) throw new RammeApiError(400, "AMBIGUOUS", `More than one saved app is called \u201C${said}\u201D: ${named.map((a) => a.id).join(", ")}. Use its id.`);
114
+ throw new RammeApiError(404, "NO_SUCH_APP", `No saved app is called that. Saved: ${apps.map((a) => `\u201C${a.name}\u201D (${a.id})`).join("; ") || "none"}.`);
115
+ };
92
116
  var resolveBoard = (boards, said) => {
93
117
  const want = said.trim();
94
118
  const byId = boards.find((b) => b.deviceId === want.toUpperCase());
@@ -135,6 +159,88 @@ ${v.issues.map((i) => ` - ${i}`).join("\n")}`;
135
159
  import { createRequire } from "module";
136
160
  import { createInterface } from "readline";
137
161
  import { APP_DOCUMENT_SYSTEM_PROMPT } from "@ramme-io/shared";
162
+
163
+ // src/approve.ts
164
+ import { randomUUID } from "crypto";
165
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
166
+
167
+ // src/approveProtocol.ts
168
+ var APPROVE = {
169
+ resourceUri: "ui://ramme/approve",
170
+ mimeType: "text/html;profile=mcp-app",
171
+ catalogId: "https://ramme.io/a2ui/catalog/v1",
172
+ surfaceId: "ramme-approve",
173
+ proposeTool: "ramme_propose_app",
174
+ approveTool: "ramme_approve_send",
175
+ /** The surface's Send button raises this action; the view answers it with approveTool. */
176
+ approveAction: "approve"
177
+ };
178
+
179
+ // src/approve.ts
180
+ var PROPOSAL_TTL_MS = 10 * 6e4;
181
+ var pending = /* @__PURE__ */ new Map();
182
+ var boardName = (b) => b.label ? `${b.label} (${b.deviceId})` : b.deviceId;
183
+ var propose = (board, document, now = Date.now()) => {
184
+ for (const [id2, p] of pending) if (p.expiresAt <= now) pending.delete(id2);
185
+ const id = randomUUID();
186
+ pending.set(id, { deviceId: board.deviceId, boardName: boardName(board), document, expiresAt: now + PROPOSAL_TTL_MS });
187
+ return id;
188
+ };
189
+ var take = (id, now = Date.now()) => {
190
+ const p = pending.get(id);
191
+ pending.delete(id);
192
+ return p && p.expiresAt > now ? p : null;
193
+ };
194
+ var proposalSurface = (proposalId, p) => [
195
+ { version: "1.0", createSurface: { surfaceId: APPROVE.surfaceId, catalogId: APPROVE.catalogId } },
196
+ {
197
+ version: "1.0",
198
+ updateComponents: {
199
+ surfaceId: APPROVE.surfaceId,
200
+ components: [
201
+ { id: "root", component: "Column", children: ["title", "preview", "target", "buttons", "status"] },
202
+ { id: "title", component: "Text", text: { "@path": "/document/name" } },
203
+ { id: "preview", component: "BoardPreview", document: { "@path": "/document" } },
204
+ { id: "target", component: "Text", text: { "@path": "/target" } },
205
+ { id: "buttons", component: "Row", children: ["send"] },
206
+ {
207
+ id: "send",
208
+ component: "Button",
209
+ variant: "primary",
210
+ child: "send_label",
211
+ action: { event: { name: APPROVE.approveAction, context: { proposalId: { "@path": "/proposalId" } } } }
212
+ },
213
+ { id: "send_label", component: "Text", text: "Send to board" },
214
+ { id: "status", component: "Text", variant: "caption", text: { "@path": "/statusText" } }
215
+ ]
216
+ }
217
+ },
218
+ dataModel(proposalId, p, "waiting")
219
+ ];
220
+ var STATUS_TEXT = {
221
+ waiting: "Nothing is sent until you tap Send.",
222
+ sending: "Sending\u2026",
223
+ sent: "Sent. It shows at the board\u2019s next check-in.",
224
+ failed: "Not sent."
225
+ };
226
+ var dataModel = (proposalId, p, status) => ({
227
+ version: "1.0",
228
+ updateDataModel: {
229
+ surfaceId: APPROVE.surfaceId,
230
+ path: "/",
231
+ value: { proposalId, document: p.document, target: `To: ${p.boardName}`, status, statusText: STATUS_TEXT[status] }
232
+ }
233
+ });
234
+ var statusUpdate = (status, detail) => ({
235
+ version: "1.0",
236
+ updateDataModel: { surfaceId: APPROVE.surfaceId, path: "/statusText", value: detail ? `${STATUS_TEXT[status]} ${detail}` : STATUS_TEXT[status] }
237
+ });
238
+ var approveHtml = () => {
239
+ const url = new URL("../dist/app/approve.html", import.meta.url);
240
+ return existsSync2(url) ? readFileSync2(url, "utf8") : null;
241
+ };
242
+
243
+ // src/mcp.ts
138
244
  var { version } = createRequire(import.meta.url)("../package.json");
139
245
  var SERVER_INFO = { name: "ramme", version };
140
246
  var PROTOCOL_VERSION = "2025-06-18";
@@ -143,9 +249,12 @@ var INSTRUCTIONS = [
143
249
  "Call ramme_app_guide first: it is the format, with its limits.",
144
250
  "Check every app with ramme_validate_app before sending it, and fix what it reports.",
145
251
  "ramme_list_boards shows the boards this token can reach; ramme_board_parts shows what one has plugged in and what its sensors last read;",
146
- "ramme_send_app sends an app to one, by id or by name; ramme_configure_board renames one, swaps its light and dark, puts one of its apps on show or sets how often they rotate.",
252
+ "ramme_send_app sends an app to one, by id or by name, written out or saved; ramme_configure_board renames one, swaps its light and dark, puts one of its apps on show or sets how often they rotate.",
253
+ "ramme_save_app keeps an app on the owner\u2019s account, under its id, so saving an edited app again replaces it; ramme_list_apps and ramme_get_app read what is saved, and ramme_delete_app removes one.",
254
+ "Save an app the owner will want again: one only sent lives on that board alone.",
147
255
  "Installing firmware and claiming or releasing a board are the owner\u2019s, on the board\u2019s page \u2014 no tool does them.",
148
- "A board picks up a new app at its next check-in: within about 30 seconds if someone is using it, 5 minutes if idle."
256
+ "A board picks up a new app at its next check-in: within about 30 seconds if someone is using it, 5 minutes if idle.",
257
+ "Where the host shows interactive cards (Claude Desktop does), prefer ramme_propose_app to ramme_send_app: it shows the owner the app as the board will draw it, and sends only when they tap Send."
149
258
  ].join(" ");
150
259
  var DOCUMENT = { type: "object", description: "The app document, as JSON \u2014 see ramme_app_guide." };
151
260
  var TOOLS = [
@@ -176,11 +285,71 @@ var TOOLS = [
176
285
  },
177
286
  {
178
287
  name: "ramme_send_app",
179
- description: "Send a validated app to one of the owner\u2019s boards, by its id (8 characters) or its name. Needs a token that can send apps.",
288
+ description: "Send an app to one of the owner\u2019s boards, by its id (8 characters) or its name: a document written out, or an app saved to the account by its id or name. Needs a token that can send apps, and to send a saved one, see saved apps.",
180
289
  inputSchema: {
181
290
  type: "object",
182
- properties: { board: { type: "string", description: "The board\u2019s id or its name." }, document: DOCUMENT },
183
- required: ["board", "document"],
291
+ properties: {
292
+ board: { type: "string", description: "The board\u2019s id or its name." },
293
+ document: DOCUMENT,
294
+ app: { type: "string", description: "Instead of document: a saved app\u2019s id or name (ramme_list_apps)." }
295
+ },
296
+ required: ["board"],
297
+ additionalProperties: false
298
+ }
299
+ },
300
+ {
301
+ name: APPROVE.proposeTool,
302
+ description: "Propose an app for one of the owner\u2019s boards, by its id or name: a document written out, or a saved app by its id or name. The owner sees a card with the app drawn as the board will draw it and sends it with one tap. Nothing is sent by this tool; it only checks the app and shows the card. Needs a token that can see and send to boards.",
303
+ inputSchema: {
304
+ type: "object",
305
+ properties: {
306
+ board: { type: "string", description: "The board\u2019s id or its name." },
307
+ document: DOCUMENT,
308
+ app: { type: "string", description: "Instead of document: a saved app\u2019s id or name (ramme_list_apps)." }
309
+ },
310
+ required: ["board"],
311
+ additionalProperties: false
312
+ },
313
+ _meta: { ui: { resourceUri: APPROVE.resourceUri, visibility: ["model", "app"] } }
314
+ },
315
+ {
316
+ name: APPROVE.approveTool,
317
+ description: "Send a proposed app, from the card the owner tapped. Only the card calls this.",
318
+ inputSchema: {
319
+ type: "object",
320
+ properties: { proposalId: { type: "string", description: "The id the proposal card carries." } },
321
+ required: ["proposalId"],
322
+ additionalProperties: false
323
+ },
324
+ _meta: { ui: { resourceUri: APPROVE.resourceUri, visibility: ["app"] } }
325
+ },
326
+ {
327
+ name: "ramme_save_app",
328
+ description: "Save a validated app to the owner\u2019s account, under its id. An app already saved with that id is replaced, so save an edited app again rather than giving it a new id. Needs a token that can save apps.",
329
+ inputSchema: { type: "object", properties: { document: DOCUMENT }, required: ["document"], additionalProperties: false }
330
+ },
331
+ {
332
+ name: "ramme_list_apps",
333
+ description: "List the apps saved to the owner\u2019s account: name, id, and when each was last saved. Needs a token that can see saved apps.",
334
+ inputSchema: { type: "object", properties: {}, additionalProperties: false }
335
+ },
336
+ {
337
+ name: "ramme_get_app",
338
+ description: "One saved app\u2019s document, by its id or name, to read or edit and save again. Needs a token that can see saved apps.",
339
+ inputSchema: {
340
+ type: "object",
341
+ properties: { app: { type: "string", description: "The saved app\u2019s id or its name." } },
342
+ required: ["app"],
343
+ additionalProperties: false
344
+ }
345
+ },
346
+ {
347
+ name: "ramme_delete_app",
348
+ description: "Delete one saved app from the owner\u2019s account, by its id or name. Boards it was sent to keep their copy. Needs a token that can save apps.",
349
+ inputSchema: {
350
+ type: "object",
351
+ properties: { app: { type: "string", description: "The saved app\u2019s id or its name." } },
352
+ required: ["app"],
184
353
  additionalProperties: false
185
354
  }
186
355
  },
@@ -250,6 +419,17 @@ var describeParts = (name, parts, now = Date.now()) => {
250
419
  return lines.join("\n");
251
420
  };
252
421
  var text = (t, isError = false) => ({ content: [{ type: "text", text: t }], ...isError ? { isError: true } : {} });
422
+ var documentFrom = async (client, args, refused) => {
423
+ if (args.document !== void 0 && args.app !== void 0) return { ok: false, message: `${refused} Give a document or a saved app, not both.` };
424
+ let document = args.document;
425
+ if (args.app !== void 0) {
426
+ const saved = resolveSavedApp(await client.savedApps(), String(args.app));
427
+ document = (await client.savedApp(saved.id)).document;
428
+ }
429
+ if (document === void 0) return { ok: false, message: `${refused} Give a document, or a saved app by its id or name.` };
430
+ const v = validateApp(document);
431
+ return v.ok ? { ok: true, document: v.document } : { ok: false, message: `${refused} ${describeValidation(v)}` };
432
+ };
253
433
  var callTool = async (client, name, args = {}) => {
254
434
  try {
255
435
  switch (name) {
@@ -269,14 +449,67 @@ var callTool = async (client, name, args = {}) => {
269
449
  return text(describeParts(`${board.label ?? "(unnamed)"} \u2014 ${board.deviceId}`, await client.parts(board.deviceId)));
270
450
  }
271
451
  case "ramme_send_app": {
272
- const v = validateApp(args.document);
273
- if (!v.ok) return text(`Not sent. ${describeValidation(v)}`, true);
452
+ const v = await documentFrom(client, args, "Not sent.");
453
+ if (!v.ok) return text(v.message, true);
274
454
  const board = resolveBoard(await client.boards(), String(args.board ?? ""));
275
455
  const sent = await client.send(board.deviceId, v.document);
276
456
  return text(
277
457
  [`Sent \u201C${v.document.name}\u201D to ${board.label ?? board.deviceId} (${board.deviceId}), revision ${sent.revision ?? "?"}. It shows at the board\u2019s next check-in.`, sent.message].filter(Boolean).join(" ")
278
458
  );
279
459
  }
460
+ case APPROVE.proposeTool: {
461
+ const v = await documentFrom(client, args, "Nothing proposed.");
462
+ if (!v.ok) return text(v.message, true);
463
+ const board = resolveBoard(await client.boards(), String(args.board ?? ""));
464
+ const proposal = { boardName: boardName(board), document: v.document };
465
+ const id = propose(board, v.document);
466
+ return {
467
+ content: [
468
+ {
469
+ type: "text",
470
+ text: `Proposed \u201C${v.document.name}\u201D for ${proposal.boardName}. The owner sees it on a card and sends it with a tap; nothing is sent until they do. Where no card shows, send it with ramme_send_app once they say so.`
471
+ }
472
+ ],
473
+ structuredContent: { a2ui: proposalSurface(id, proposal) }
474
+ };
475
+ }
476
+ case APPROVE.approveTool: {
477
+ if (!cardHosts.has(client)) return text(`No tool called ${name}.`, true);
478
+ const proposal = take(String(args.proposalId ?? ""));
479
+ if (!proposal) {
480
+ return { ...text("Not sent. That card has expired or was already used; ask for the app again.", true), structuredContent: { a2ui: [statusUpdate("failed", "This card has expired or was already used.")] } };
481
+ }
482
+ try {
483
+ const sent = await client.send(proposal.deviceId, proposal.document);
484
+ return {
485
+ ...text(`Sent \u201C${proposal.document.name}\u201D to ${proposal.boardName}, revision ${sent.revision ?? "?"}. It shows at the board\u2019s next check-in.`),
486
+ structuredContent: { a2ui: [statusUpdate("sent")] }
487
+ };
488
+ } catch (e) {
489
+ const why = e instanceof RammeApiError ? `${e.message} (${e.code})` : e.message;
490
+ return { ...text(`Not sent. ${why}`, true), structuredContent: { a2ui: [statusUpdate("failed", why)] } };
491
+ }
492
+ }
493
+ case "ramme_save_app": {
494
+ const v = validateApp(args.document);
495
+ if (!v.ok) return text(`Not saved. ${describeValidation(v)}`, true);
496
+ const saved = await client.saveApp(v.document);
497
+ return text(`${saved.replaced ? "Saved over" : "Saved"} \u201C${saved.app.name}\u201D (${saved.app.id}) on the account. Send it with ramme_send_app and app: "${saved.app.id}".`);
498
+ }
499
+ case "ramme_list_apps": {
500
+ const apps = await client.savedApps();
501
+ if (!apps.length) return text("No saved apps yet. Save one with ramme_save_app.");
502
+ return text(apps.map((a) => `${a.name} \u2014 ${a.id} \u2014 saved ${ago(a.updatedAt)}`).join("\n"));
503
+ }
504
+ case "ramme_get_app": {
505
+ const saved = resolveSavedApp(await client.savedApps(), String(args.app ?? ""));
506
+ return text(JSON.stringify((await client.savedApp(saved.id)).document, null, 2));
507
+ }
508
+ case "ramme_delete_app": {
509
+ const saved = resolveSavedApp(await client.savedApps(), String(args.app ?? ""));
510
+ await client.deleteApp(saved.id);
511
+ return text(`Deleted the saved app \u201C${saved.name}\u201D (${saved.id}). Boards it was sent to keep their copy.`);
512
+ }
280
513
  case "ramme_configure_board": {
281
514
  const board = resolveBoard(await client.boards(), String(args.board ?? ""));
282
515
  const plan = plannedChanges(args, await client.parts(board.deviceId));
@@ -309,6 +542,11 @@ var callTool = async (client, name, args = {}) => {
309
542
  return text(message, true);
310
543
  }
311
544
  };
545
+ var cardHosts = /* @__PURE__ */ new WeakSet();
546
+ var showsCards = (params) => {
547
+ const ui = params.capabilities?.extensions?.["io.modelcontextprotocol/ui"];
548
+ return Array.isArray(ui?.mimeTypes) && ui.mimeTypes.includes(APPROVE.mimeType);
549
+ };
312
550
  var handleMessage = async (client, message) => {
313
551
  const id = message.id;
314
552
  const method = String(message.method ?? "");
@@ -317,18 +555,27 @@ var handleMessage = async (client, message) => {
317
555
  if (id === void 0 || id === null) return null;
318
556
  switch (method) {
319
557
  case "initialize":
558
+ if (showsCards(params)) cardHosts.add(client);
559
+ else cardHosts.delete(client);
320
560
  return reply({
321
561
  protocolVersion: typeof params.protocolVersion === "string" ? params.protocolVersion : PROTOCOL_VERSION,
322
- capabilities: { tools: {} },
562
+ capabilities: { tools: {}, resources: {} },
323
563
  serverInfo: SERVER_INFO,
324
564
  instructions: INSTRUCTIONS
325
565
  });
326
566
  case "ping":
327
567
  return reply({});
328
568
  case "tools/list":
329
- return reply({ tools: TOOLS });
569
+ return reply({ tools: cardHosts.has(client) ? TOOLS : TOOLS.filter((t) => t.name !== APPROVE.approveTool) });
330
570
  case "tools/call":
331
571
  return reply(await callTool(client, String(params.name ?? ""), params.arguments ?? {}));
572
+ case "resources/list":
573
+ return reply({ resources: [{ uri: APPROVE.resourceUri, name: "Approve an app for a board", mimeType: APPROVE.mimeType }] });
574
+ case "resources/read": {
575
+ const html = params.uri === APPROVE.resourceUri ? approveHtml() : null;
576
+ if (html === null) return { jsonrpc: "2.0", id, error: { code: -32002, message: `Resource not found: ${String(params.uri)}` } };
577
+ return reply({ contents: [{ uri: APPROVE.resourceUri, mimeType: APPROVE.mimeType, text: html, _meta: { ui: { prefersBorder: true } } }] });
578
+ }
332
579
  default:
333
580
  return { jsonrpc: "2.0", id, error: { code: -32601, message: `Method not found: ${method}` } };
334
581
  }
@@ -360,6 +607,7 @@ export {
360
607
  forgetToken,
361
608
  RammeApiError,
362
609
  createClient,
610
+ resolveSavedApp,
363
611
  resolveBoard,
364
612
  ago,
365
613
  validateApp,
package/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  serveMcp,
15
15
  serverLabel,
16
16
  validateAppText
17
- } from "./chunk-IEPOKHAT.js";
17
+ } from "./chunk-NQ2K2FVH.js";
18
18
 
19
19
  // src/cli.ts
20
20
  import { readFileSync, realpathSync } from "fs";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AppDocument, DeviceFeatureState, Signal } from '@ramme-io/shared';
1
+ import { AppDocument, DeviceFeatureState, Signal, SavedAppSummary, SavedApp } from '@ramme-io/shared';
2
2
  import { Readable, Writable } from 'node:stream';
3
3
 
4
4
  /**
@@ -26,7 +26,8 @@ declare const describeValidation: (v: Validation) => string;
26
26
  /**
27
27
  * The few ramme.io routes a personal access token can reach: list your
28
28
  * boards and read one's parts and readings (`boards:read`), send one an
29
- * app (`boards:send`), and change its settings (`boards:configure`). Everything is
29
+ * app (`boards:send`), change its settings (`boards:configure`), and keep
30
+ * apps on your account (`apps:read`, `apps:write`). Everything is
30
31
  * authorised by the token; nothing here calls a model, so an agent's own keys
31
32
  * do all the generating.
32
33
  */
@@ -95,12 +96,26 @@ interface Client {
95
96
  change(deviceId: string, change: ShelfChange): Promise<{
96
97
  revision?: number;
97
98
  }>;
99
+ /** The apps saved to the account, newest change first. */
100
+ savedApps(): Promise<SavedAppSummary[]>;
101
+ savedApp(id: string): Promise<SavedApp>;
102
+ /** Saved under document.id: an app already there by that id is replaced. */
103
+ saveApp(document: AppDocument): Promise<{
104
+ app: SavedAppSummary;
105
+ replaced: boolean;
106
+ }>;
107
+ deleteApp(id: string): Promise<void>;
98
108
  }
99
109
  declare const createClient: (options: {
100
110
  base: string;
101
111
  token: string | null;
102
112
  fetch?: typeof fetch;
103
113
  }) => Client;
114
+ /**
115
+ * A saved app by its id or its name, as resolveBoard finds a board. Refuses
116
+ * an ambiguous name rather than guessing.
117
+ */
118
+ declare const resolveSavedApp: (apps: SavedAppSummary[], said: string) => SavedAppSummary;
104
119
  /**
105
120
  * A board by its id or its name, as a person or an agent would say it:
106
121
  * "A7K2M9QP", or "Kitchen shelf" in any case. Refuses an ambiguous name
@@ -171,7 +186,7 @@ declare const TOOLS: readonly [{
171
186
  };
172
187
  }, {
173
188
  readonly name: "ramme_send_app";
174
- readonly description: "Send a validated app to one of the owner’s boards, by its id (8 characters) or its name. Needs a token that can send apps.";
189
+ readonly description: "Send an app to one of the owner’s boards, by its id (8 characters) or its name: a document written out, or an app saved to the account by its id or name. Needs a token that can send apps, and to send a saved one, see saved apps.";
175
190
  readonly inputSchema: {
176
191
  readonly type: "object";
177
192
  readonly properties: {
@@ -183,8 +198,110 @@ declare const TOOLS: readonly [{
183
198
  type: string;
184
199
  description: string;
185
200
  };
201
+ readonly app: {
202
+ readonly type: "string";
203
+ readonly description: "Instead of document: a saved app’s id or name (ramme_list_apps).";
204
+ };
205
+ };
206
+ readonly required: readonly ["board"];
207
+ readonly additionalProperties: false;
208
+ };
209
+ }, {
210
+ readonly name: "ramme_propose_app";
211
+ readonly description: "Propose an app for one of the owner’s boards, by its id or name: a document written out, or a saved app by its id or name. The owner sees a card with the app drawn as the board will draw it and sends it with one tap. Nothing is sent by this tool; it only checks the app and shows the card. Needs a token that can see and send to boards.";
212
+ readonly inputSchema: {
213
+ readonly type: "object";
214
+ readonly properties: {
215
+ readonly board: {
216
+ readonly type: "string";
217
+ readonly description: "The board’s id or its name.";
218
+ };
219
+ readonly document: {
220
+ type: string;
221
+ description: string;
222
+ };
223
+ readonly app: {
224
+ readonly type: "string";
225
+ readonly description: "Instead of document: a saved app’s id or name (ramme_list_apps).";
226
+ };
227
+ };
228
+ readonly required: readonly ["board"];
229
+ readonly additionalProperties: false;
230
+ };
231
+ readonly _meta: {
232
+ readonly ui: {
233
+ readonly resourceUri: "ui://ramme/approve";
234
+ readonly visibility: readonly ["model", "app"];
235
+ };
236
+ };
237
+ }, {
238
+ readonly name: "ramme_approve_send";
239
+ readonly description: "Send a proposed app, from the card the owner tapped. Only the card calls this.";
240
+ readonly inputSchema: {
241
+ readonly type: "object";
242
+ readonly properties: {
243
+ readonly proposalId: {
244
+ readonly type: "string";
245
+ readonly description: "The id the proposal card carries.";
246
+ };
247
+ };
248
+ readonly required: readonly ["proposalId"];
249
+ readonly additionalProperties: false;
250
+ };
251
+ readonly _meta: {
252
+ readonly ui: {
253
+ readonly resourceUri: "ui://ramme/approve";
254
+ readonly visibility: readonly ["app"];
255
+ };
256
+ };
257
+ }, {
258
+ readonly name: "ramme_save_app";
259
+ readonly description: "Save a validated app to the owner’s account, under its id. An app already saved with that id is replaced, so save an edited app again rather than giving it a new id. Needs a token that can save apps.";
260
+ readonly inputSchema: {
261
+ readonly type: "object";
262
+ readonly properties: {
263
+ readonly document: {
264
+ type: string;
265
+ description: string;
266
+ };
267
+ };
268
+ readonly required: readonly ["document"];
269
+ readonly additionalProperties: false;
270
+ };
271
+ }, {
272
+ readonly name: "ramme_list_apps";
273
+ readonly description: "List the apps saved to the owner’s account: name, id, and when each was last saved. Needs a token that can see saved apps.";
274
+ readonly inputSchema: {
275
+ readonly type: "object";
276
+ readonly properties: {};
277
+ readonly additionalProperties: false;
278
+ };
279
+ }, {
280
+ readonly name: "ramme_get_app";
281
+ readonly description: "One saved app’s document, by its id or name, to read or edit and save again. Needs a token that can see saved apps.";
282
+ readonly inputSchema: {
283
+ readonly type: "object";
284
+ readonly properties: {
285
+ readonly app: {
286
+ readonly type: "string";
287
+ readonly description: "The saved app’s id or its name.";
288
+ };
289
+ };
290
+ readonly required: readonly ["app"];
291
+ readonly additionalProperties: false;
292
+ };
293
+ }, {
294
+ readonly name: "ramme_delete_app";
295
+ readonly description: "Delete one saved app from the owner’s account, by its id or name. Boards it was sent to keep their copy. Needs a token that can save apps.";
296
+ readonly inputSchema: {
297
+ readonly type: "object";
298
+ readonly properties: {
299
+ readonly app: {
300
+ readonly type: "string";
301
+ readonly description: "The saved app’s id or its name.";
302
+ };
186
303
  };
187
- readonly required: readonly ["board", "document"];
304
+ readonly required: readonly ["app"];
188
305
  readonly additionalProperties: false;
189
306
  };
190
307
  }, {
@@ -227,4 +344,4 @@ declare const handleMessage: (client: Client, message: Json) => Promise<Json | n
227
344
  /** Serve until stdin closes. */
228
345
  declare const serveMcp: (client: Client, input?: Readable, output?: Writable) => Promise<void>;
229
346
 
230
- export { type Board, type BoardShelf, type Client, DEFAULT_API, RammeApiError, SERVER_INFO, type SendResult, type ShelfChange, TOOLS, type Validation, apiBase, callTool, createClient, credentialsPath, describeValidation, findToken, forgetToken, handleMessage, resolveBoard, saveToken, serveMcp, validateApp, validateAppText };
347
+ export { type Board, type BoardShelf, type Client, DEFAULT_API, RammeApiError, SERVER_INFO, type SendResult, type ShelfChange, TOOLS, type Validation, apiBase, callTool, createClient, credentialsPath, describeValidation, findToken, forgetToken, handleMessage, resolveBoard, resolveSavedApp, saveToken, serveMcp, validateApp, validateAppText };
package/dist/index.js CHANGED
@@ -12,11 +12,12 @@ import {
12
12
  forgetToken,
13
13
  handleMessage,
14
14
  resolveBoard,
15
+ resolveSavedApp,
15
16
  saveToken,
16
17
  serveMcp,
17
18
  validateApp,
18
19
  validateAppText
19
- } from "./chunk-IEPOKHAT.js";
20
+ } from "./chunk-NQ2K2FVH.js";
20
21
  export {
21
22
  DEFAULT_API,
22
23
  RammeApiError,
@@ -31,6 +32,7 @@ export {
31
32
  forgetToken,
32
33
  handleMessage,
33
34
  resolveBoard,
35
+ resolveSavedApp,
34
36
  saveToken,
35
37
  serveMcp,
36
38
  validateApp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramme-io/devkit",
3
- "version": "0.3.2",
3
+ "version": "0.5.0",
4
4
  "description": "Make Ramme apps on your own machine with your own coding agent: validate an app, list your boards, send it to one — as a CLI or a local MCP server.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.ramme.io",
@@ -31,19 +31,32 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@ramme-io/shared": "4.4.0"
34
+ "@ramme-io/shared": "4.6.0"
35
35
  },
36
36
  "devDependencies": {
37
+ "@a2ui/markdown-it": "0.2.2",
38
+ "@a2ui/react": "0.15.0",
39
+ "@a2ui/web_core": "0.15.0",
37
40
  "@types/node": "^20.14.10",
41
+ "@types/react": "^18",
42
+ "@types/react-dom": "^18",
43
+ "@vitejs/plugin-react": "^4.3.1",
44
+ "react": "^18.2.0",
45
+ "react-dom": "^18.2.0",
38
46
  "tsup": "^8.5.1",
39
47
  "tsx": "4.21.0",
40
48
  "typescript": "^5.4.5",
41
- "vitest": "^2.1.9"
49
+ "vite": "^5.4.21",
50
+ "vite-plugin-singlefile": "2.3.4",
51
+ "vitest": "^2.1.9",
52
+ "zod": "^3.25.76",
53
+ "@ramme-io/kernel": "^8.1.6",
54
+ "@ramme-io/ui": "^5.4.0"
42
55
  },
43
56
  "scripts": {
44
- "build": "tsup src/cli.ts src/index.ts --format esm --dts --clean --target node20",
57
+ "build": "vite build -c vite.app.config.ts && tsup src/cli.ts src/index.ts --format esm --dts --target node20",
45
58
  "ramme": "tsx src/cli.ts",
46
59
  "test": "vitest run",
47
- "typecheck": "tsc --noEmit -p tsconfig.json"
60
+ "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p app/tsconfig.json"
48
61
  }
49
62
  }