@thatopen/services 0.29.0 → 0.29.1

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/dist/cli.js CHANGED
@@ -33678,6 +33678,9 @@ function projectIdFrom(input) {
33678
33678
  if (/^[0-9a-f]{24}$/i.test(trimmed)) return trimmed;
33679
33679
  return trimmed.match(/projects?\/([0-9a-f]{24})/i)?.[1] ?? null;
33680
33680
  }
33681
+ function appIdFrom(input) {
33682
+ return input.trim().match(/apps\/([0-9a-f]{24})/i)?.[1];
33683
+ }
33681
33684
  class ChannelConnection {
33682
33685
  constructor(credentials) {
33683
33686
  this.credentials = credentials;
@@ -33838,12 +33841,12 @@ async function startMcpServer() {
33838
33841
  );
33839
33842
  server.tool(
33840
33843
  "send-app-command",
33841
- "Sends a command to a running That Open app through the platform channel and returns its reply. The app must be open in a browser tab and listening (apps scaffolded by `thatopen create` handle `ping` and `get-loaded-models` out of the box; apps declare their own commands in src/setups/channel.ts). While the user iterates with `thatopen serve`, omit app_id — the dev channel is keyed to the account; pass it once the app is published. `delivered: 0` means no tab of the app has the channel joined, usually because the app is simply not open — ask the user to open or reload the app tab.",
33844
+ "Sends a command to a running That Open app through the platform channel and returns its reply. To USE an app the person has open (rather than build one), pass the URL of their app tab as `project` and send `help` first: the app answers with its own commands and how to use them, and that is the manual to follow. The app must be open in a browser tab and listening (apps scaffolded by `thatopen create` handle `ping` and `get-loaded-models` out of the box; apps declare their own commands in src/setups/channel.ts). While the user iterates with `thatopen serve`, omit app_id — the dev channel is keyed to the account; pass it once the app is published. `delivered: 0` means no tab of the app has the channel joined, usually because the app is simply not open — ask the user to open or reload the app tab.",
33842
33845
  {
33843
- project: stringType().describe("The project id (24 hex characters), or the project's dashboard URL."),
33846
+ project: stringType().describe("The project id (24 hex characters), or the dashboard URL of the app tab: a URL with `/apps/<id>` gives the app_id too."),
33844
33847
  command: stringType().describe('The command name the app handles, e.g. "ping" or "get-loaded-models".'),
33845
33848
  payload: unknownType().optional().describe("JSON payload for the command, if it takes one."),
33846
- app_id: stringType().regex(/^[0-9a-f]{24}$/i).optional().describe("The published app's id. Omit while the app runs under `thatopen serve`."),
33849
+ app_id: stringType().regex(/^[0-9a-f]{24}$/i).optional().describe("The published app's id. Omit while the app runs under `thatopen serve`, or when `project` is a URL that carries it."),
33847
33850
  wait_for_reply: booleanType().optional().describe("Default true. Set false for fire-and-forget notifications."),
33848
33851
  timeout_ms: numberType().int().min(1e3).max(MAX_REPLY_TIMEOUT_MS).optional().describe(`How long to wait for the app's reply. Default ${DEFAULT_REPLY_TIMEOUT_MS}.`)
33849
33852
  },
@@ -33856,7 +33859,7 @@ async function startMcpServer() {
33856
33859
  }
33857
33860
  const result = await connect2().send({
33858
33861
  projectId,
33859
- appId: args.app_id,
33862
+ appId: args.app_id ?? appIdFrom(args.project),
33860
33863
  type: args.command,
33861
33864
  payload: args.payload,
33862
33865
  waitForReply: args.wait_for_reply !== false,