@omniharmonic/openspace-cli 0.1.15 → 0.1.16

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/bin.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire as __osCreateRequire } from "node:module"; const require
3
3
  import {
4
4
  processIo,
5
5
  run
6
- } from "./chunk-PBN36VUE.js";
6
+ } from "./chunk-JDVCOOGD.js";
7
7
  import "./chunk-YAPLQ4OA.js";
8
8
  import "./chunk-GMKHKHUR.js";
9
9
  import "./chunk-26AZCID5.js";
@@ -45274,13 +45274,24 @@ var ToolContext = class {
45274
45274
  const allowed = await this.allowedSites();
45275
45275
  if (input) {
45276
45276
  if (allowed.includes(input)) return input;
45277
+ const wanted = input.trim().toLowerCase();
45278
+ const named = (await this.store.listSites()).filter(
45279
+ (s2) => allowed.includes(s2.id) && s2.title.trim().toLowerCase() === wanted
45280
+ );
45281
+ if (named.length === 1 && named[0]) return named[0].id;
45282
+ const explained = await this.store.explainUnreachable?.(input);
45283
+ if (explained) throw explained;
45277
45284
  throw new ToolError(
45278
45285
  `This connection can't reach site "${input}". Sites available: ${allowed.join(", ") || "none"}.`,
45279
45286
  "forbidden"
45280
45287
  );
45281
45288
  }
45282
45289
  if (allowed.length === 1) return allowed[0];
45283
- if (!allowed.length) throw new ToolError("This connection has no sites.", "forbidden");
45290
+ if (!allowed.length) {
45291
+ const explained = await this.store.explainUnreachable?.(void 0);
45292
+ if (explained) throw explained;
45293
+ throw new ToolError("This connection has no sites.", "forbidden");
45294
+ }
45284
45295
  throw new ToolError(
45285
45296
  `Several sites are available; pass "site" (one of: ${allowed.join(", ")}).`,
45286
45297
  "invalid_arguments"
@@ -45815,11 +45826,11 @@ ${ITERATION_GUIDANCE}
45815
45826
  Do at most five passes, and after each pass say in one line what you changed and what you saw in the screenshot. Stop when design_check shows no errors and the page reads clearly on desktop and mobile.`
45816
45827
  }
45817
45828
  ];
45818
- function getPrompt(name, args = {}) {
45819
- const p = PROMPTS.find((x) => x.name === name);
45829
+ function getPrompt(name, args = {}, prompts = PROMPTS) {
45830
+ const p = prompts.find((x) => x.name === name);
45820
45831
  if (!p)
45821
45832
  throw new ToolError(
45822
- `Unknown prompt "${name}". Prompts: ${PROMPTS.map((x) => x.name).join(", ")}.`,
45833
+ `Unknown prompt "${name}". Prompts: ${prompts.map((x) => x.name).join(", ")}.`,
45823
45834
  "not_found"
45824
45835
  );
45825
45836
  const missing = p.arguments.filter((x) => x.required && !args[x.name]?.trim()).map((x) => x.name);
@@ -48895,14 +48906,21 @@ var OpenSpaceMcpServer = class {
48895
48906
  this.initialized = Boolean(options.assumeInitialized);
48896
48907
  for (const t of ALL_TOOLS) this.tools.set(t.name, t);
48897
48908
  for (const t of options.tools ?? []) this.tools.set(t.name, t);
48909
+ const extra = options.prompts ?? [];
48910
+ this.prompts = [...PROMPTS.filter((p) => !extra.some((e) => e.name === p.name)), ...extra];
48898
48911
  }
48899
48912
  options;
48900
48913
  ctx;
48901
48914
  tools = /* @__PURE__ */ new Map();
48915
+ prompts;
48902
48916
  clientName;
48903
48917
  initialized;
48904
48918
  protocolVersion;
48905
48919
  closed = false;
48920
+ /** Prompts served by this instance. */
48921
+ promptList() {
48922
+ return [...this.prompts];
48923
+ }
48906
48924
  /** Tool definitions served by this instance. */
48907
48925
  toolList() {
48908
48926
  return [...this.tools.values()];
@@ -49024,7 +49042,7 @@ var OpenSpaceMcpServer = class {
49024
49042
  }
49025
49043
  case "prompts/list":
49026
49044
  return {
49027
- prompts: PROMPTS.map((p) => ({
49045
+ prompts: this.prompts.map((p) => ({
49028
49046
  name: p.name,
49029
49047
  title: p.title,
49030
49048
  description: p.description,
@@ -49035,7 +49053,7 @@ var OpenSpaceMcpServer = class {
49035
49053
  if (typeof params.name !== "string")
49036
49054
  throw new RpcError(ErrorCode.InvalidParams, "name is required");
49037
49055
  const args = isRecord5(params.arguments) ? Object.fromEntries(Object.entries(params.arguments).map(([k, v]) => [k, String(v)])) : {};
49038
- return getPrompt(params.name, args);
49056
+ return getPrompt(params.name, args, this.prompts);
49039
49057
  }
49040
49058
  case "completion/complete":
49041
49059
  return { completion: { values: [], hasMore: false } };
@@ -49063,7 +49081,7 @@ var OpenSpaceMcpServer = class {
49063
49081
  logging: {}
49064
49082
  },
49065
49083
  serverInfo: { name: SERVER_NAME, title: "OpenSpace", version: SERVER_VERSION },
49066
- instructions: SERVER_INSTRUCTIONS
49084
+ instructions: this.options.instructions ?? SERVER_INSTRUCTIONS
49067
49085
  };
49068
49086
  }
49069
49087
  /** Name the client reported in `initialize`. */
@@ -62231,4 +62249,4 @@ export {
62231
62249
  createProgram,
62232
62250
  run
62233
62251
  };
62234
- //# sourceMappingURL=chunk-PBN36VUE.js.map
62252
+ //# sourceMappingURL=chunk-JDVCOOGD.js.map