@portel/photon 1.33.0 → 1.33.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 (65) hide show
  1. package/README.md +43 -6
  2. package/dist/auth/mcp-jwt.d.ts +59 -0
  3. package/dist/auth/mcp-jwt.d.ts.map +1 -0
  4. package/dist/auth/mcp-jwt.js +177 -0
  5. package/dist/auth/mcp-jwt.js.map +1 -0
  6. package/dist/auto-ui/beam.d.ts +1 -0
  7. package/dist/auto-ui/beam.d.ts.map +1 -1
  8. package/dist/auto-ui/beam.js +35 -1
  9. package/dist/auto-ui/beam.js.map +1 -1
  10. package/dist/auto-ui/frontend/pure-view.html +5 -2
  11. package/dist/auto-ui/playground-html.d.ts.map +1 -1
  12. package/dist/auto-ui/playground-html.js +28 -38
  13. package/dist/auto-ui/playground-html.js.map +1 -1
  14. package/dist/auto-ui/streamable-http-transport.d.ts.map +1 -1
  15. package/dist/auto-ui/streamable-http-transport.js +62 -11
  16. package/dist/auto-ui/streamable-http-transport.js.map +1 -1
  17. package/dist/beam.bundle.js +25 -17
  18. package/dist/beam.bundle.js.map +2 -2
  19. package/dist/capability-negotiator.d.ts +11 -0
  20. package/dist/capability-negotiator.d.ts.map +1 -1
  21. package/dist/capability-negotiator.js +20 -0
  22. package/dist/capability-negotiator.js.map +1 -1
  23. package/dist/cli/commands/auth.d.ts +15 -0
  24. package/dist/cli/commands/auth.d.ts.map +1 -0
  25. package/dist/cli/commands/auth.js +105 -0
  26. package/dist/cli/commands/auth.js.map +1 -0
  27. package/dist/cli/commands/host.d.ts.map +1 -1
  28. package/dist/cli/commands/host.js +9 -0
  29. package/dist/cli/commands/host.js.map +1 -1
  30. package/dist/cli/commands/run.d.ts.map +1 -1
  31. package/dist/cli/commands/run.js +3 -0
  32. package/dist/cli/commands/run.js.map +1 -1
  33. package/dist/cli/index.d.ts.map +1 -1
  34. package/dist/cli/index.js +6 -0
  35. package/dist/cli/index.js.map +1 -1
  36. package/dist/daemon/worker-dep-proxy.d.ts +17 -0
  37. package/dist/daemon/worker-dep-proxy.d.ts.map +1 -0
  38. package/dist/daemon/worker-dep-proxy.js +92 -0
  39. package/dist/daemon/worker-dep-proxy.js.map +1 -0
  40. package/dist/daemon/worker-host.js +8 -28
  41. package/dist/daemon/worker-host.js.map +1 -1
  42. package/dist/deploy/cloudflare.d.ts +2 -0
  43. package/dist/deploy/cloudflare.d.ts.map +1 -1
  44. package/dist/deploy/cloudflare.js +135 -13
  45. package/dist/deploy/cloudflare.js.map +1 -1
  46. package/dist/editor-support/docblock-tag-catalog.d.ts.map +1 -1
  47. package/dist/editor-support/docblock-tag-catalog.js +6 -0
  48. package/dist/editor-support/docblock-tag-catalog.js.map +1 -1
  49. package/dist/loader.d.ts +3 -0
  50. package/dist/loader.d.ts.map +1 -1
  51. package/dist/loader.js +49 -0
  52. package/dist/loader.js.map +1 -1
  53. package/dist/photon-doc-extractor.d.ts +1 -0
  54. package/dist/photon-doc-extractor.d.ts.map +1 -1
  55. package/dist/photon-doc-extractor.js +13 -0
  56. package/dist/photon-doc-extractor.js.map +1 -1
  57. package/dist/resource-server.d.ts +15 -0
  58. package/dist/resource-server.d.ts.map +1 -1
  59. package/dist/resource-server.js +86 -5
  60. package/dist/resource-server.js.map +1 -1
  61. package/dist/server.d.ts.map +1 -1
  62. package/dist/server.js +168 -176
  63. package/dist/server.js.map +1 -1
  64. package/package.json +1 -1
  65. package/templates/cloudflare/worker.ts.template +340 -55
@@ -33248,10 +33248,12 @@ var MCPClientService = class {
33248
33248
  const photonMap = /* @__PURE__ */ new Map();
33249
33249
  const externalMCPMap = /* @__PURE__ */ new Map();
33250
33250
  for (const tool of tools) {
33251
+ const dotIndex = tool.name.indexOf(".");
33251
33252
  const slashIndex = tool.name.indexOf("/");
33252
- if (slashIndex === -1) continue;
33253
- const serverName = tool.name.slice(0, slashIndex);
33254
- const methodName = tool.name.slice(slashIndex + 1);
33253
+ const separatorIndex = dotIndex !== -1 ? dotIndex : slashIndex;
33254
+ if (separatorIndex === -1) continue;
33255
+ const serverName = tool.name.slice(0, separatorIndex);
33256
+ const methodName = tool.name.slice(separatorIndex + 1);
33255
33257
  const isExternalMCP = !!tool["x-external-mcp"];
33256
33258
  if (isExternalMCP) {
33257
33259
  if (!externalMCPMap.has(serverName)) {
@@ -34718,7 +34720,7 @@ var BeamApp = class extends i4 {
34718
34720
  }
34719
34721
  if (this._mcpReady) {
34720
34722
  try {
34721
- const result = await mcpClient.callTool("maker/source", { photonPath });
34723
+ const result = await mcpClient.callTool("maker.source", { photonPath });
34722
34724
  if (result.isError) {
34723
34725
  const errorText = result.content.find((c5) => c5.type === "text")?.text || "Failed to load source";
34724
34726
  showToast(errorText, "error");
@@ -34777,7 +34779,7 @@ var BeamApp = class extends i4 {
34777
34779
  const target2 = this._autoInstance || "default";
34778
34780
  if (target2 !== this._currentInstance) {
34779
34781
  try {
34780
- await mcpClient.callTool(`${photonName}/_use`, { name: target2 });
34782
+ await mcpClient.callTool(`${photonName}._use`, { name: target2 });
34781
34783
  this._setCurrentInstance(photonName, target2);
34782
34784
  if (this._selectedMethod) {
34783
34785
  void this._handleExecute(new CustomEvent("execute", { detail: { args: {} } }));
@@ -34793,7 +34795,7 @@ var BeamApp = class extends i4 {
34793
34795
  const target = selected;
34794
34796
  if (target === this._currentInstance) return;
34795
34797
  try {
34796
- await mcpClient.callTool(`${photonName}/_use`, { name: target });
34798
+ await mcpClient.callTool(`${photonName}._use`, { name: target });
34797
34799
  this._setCurrentInstance(photonName, target);
34798
34800
  showToast(`Switched to: ${target === "default" ? "(default)" : target}`, "success");
34799
34801
  if (this._selectedMethod) {
@@ -34807,7 +34809,7 @@ var BeamApp = class extends i4 {
34807
34809
  case "create": {
34808
34810
  const name2 = detail.instance;
34809
34811
  try {
34810
- await mcpClient.callTool(`${photonName}/_use`, { name: name2 });
34812
+ await mcpClient.callTool(`${photonName}._use`, { name: name2 });
34811
34813
  this._setCurrentInstance(photonName, name2);
34812
34814
  await this._fetchInstances(photonName);
34813
34815
  showToast(`Created instance: ${name2}`, "success");
@@ -34855,7 +34857,7 @@ var BeamApp = class extends i4 {
34855
34857
  }
34856
34858
  );
34857
34859
  if (res.ok) {
34858
- await mcpClient.callTool(`${photonName}/_use`, { name: newName });
34860
+ await mcpClient.callTool(`${photonName}._use`, { name: newName });
34859
34861
  this._setCurrentInstance(photonName, newName);
34860
34862
  await this._fetchInstances(photonName);
34861
34863
  showToast(`Renamed to: ${newName}`, "success");
@@ -34883,7 +34885,7 @@ var BeamApp = class extends i4 {
34883
34885
  }
34884
34886
  );
34885
34887
  if (res.ok) {
34886
- await mcpClient.callTool(`${photonName}/_use`, { name: "default" });
34888
+ await mcpClient.callTool(`${photonName}._use`, { name: "default" });
34887
34889
  this._setCurrentInstance(photonName, "default");
34888
34890
  await this._fetchInstances(photonName);
34889
34891
  showToast(`Deleted: ${instanceToDelete}`, "success");
@@ -38169,7 +38171,7 @@ ${photon.errorMessage || "Unknown error"}</pre
38169
38171
  const saved = sessionStorage.getItem(`photon-instance:${photonName}`);
38170
38172
  if (saved && saved !== "default") {
38171
38173
  try {
38172
- await mcpClient.callTool(`${photonName}/_use`, { name: saved });
38174
+ await mcpClient.callTool(`${photonName}._use`, { name: saved });
38173
38175
  this._currentInstance = saved;
38174
38176
  } catch {
38175
38177
  sessionStorage.removeItem(`photon-instance:${photonName}`);
@@ -38224,7 +38226,7 @@ ${photon.errorMessage || "Unknown error"}</pre
38224
38226
  );
38225
38227
  if (this._instanceSelectorMode === "auto" && !hasSessionInstance && this._autoInstance && this._autoInstance !== this._currentInstance) {
38226
38228
  try {
38227
- await mcpClient.callTool(`${this._selectedPhoton.name}/_use`, {
38229
+ await mcpClient.callTool(`${this._selectedPhoton.name}._use`, {
38228
38230
  name: this._autoInstance
38229
38231
  });
38230
38232
  this._currentInstance = this._autoInstance;
@@ -38276,7 +38278,7 @@ ${photon.errorMessage || "Unknown error"}</pre
38276
38278
  const target = selected === "__auto__" ? this._autoInstance || "default" : selected;
38277
38279
  if (target === this._currentInstance) return;
38278
38280
  try {
38279
- await mcpClient.callTool(`${photonName}/_use`, { name: target });
38281
+ await mcpClient.callTool(`${photonName}._use`, { name: target });
38280
38282
  this._currentInstance = target;
38281
38283
  sessionStorage.setItem(`photon-instance:${photonName}`, target);
38282
38284
  if (this._selectedMethod) {
@@ -38296,7 +38298,7 @@ ${photon.errorMessage || "Unknown error"}</pre
38296
38298
  if (!this._selectedPhoton) return;
38297
38299
  const photonName = this._selectedPhoton.name;
38298
38300
  try {
38299
- const result = await mcpClient.callTool(`${photonName}/_use`, {});
38301
+ const result = await mcpClient.callTool(`${photonName}._use`, {});
38300
38302
  if (result && !result.isError) {
38301
38303
  const textContent = result.content?.find((c5) => c5.type === "text")?.text;
38302
38304
  if (textContent && textContent !== "Cancelled") {
@@ -39149,7 +39151,7 @@ ${photon.errorMessage || "Unknown error"}</pre
39149
39151
  this._log("info", `Invoking maker.${methodName} on ${this._selectedPhoton?.name}...`, true);
39150
39152
  if (this._mcpReady) {
39151
39153
  try {
39152
- const toolName = `maker/${methodName}`;
39154
+ const toolName = `maker.${methodName}`;
39153
39155
  const result = await mcpClient.callTool(toolName, { photonPath, ...additionalArgs });
39154
39156
  if (result.isError) {
39155
39157
  const errorText = result.content.find((c5) => c5.type === "text")?.text || "Unknown error";
@@ -52695,7 +52697,7 @@ ${footerText || pageNum ? `<div class="slide-footer"><span>${footerText || ""}</
52695
52697
  el2.removeAttribute("data-embed");
52696
52698
  if (paramsRaw) el2.setAttribute("data-args", paramsRaw);
52697
52699
  if (!el2.getAttribute("data-format")) {
52698
- const parts = embedPath.split("/");
52700
+ const parts = embedPath.split(embedPath.includes(".") ? "." : "/");
52699
52701
  if (parts.length === 2) {
52700
52702
  try {
52701
52703
  const beamApp = this.getRootNode()?.host || document.querySelector("beam-app");
@@ -52833,7 +52835,7 @@ ${footerText || pageNum ? `<div class="slide-footer"><span>${footerText || ""}</
52833
52835
  el2.setAttribute("data-args", paramsRaw);
52834
52836
  }
52835
52837
  if (!el2.getAttribute("data-format")) {
52836
- const parts = embedPath.split("/");
52838
+ const parts = embedPath.split(embedPath.includes(".") ? "." : "/");
52837
52839
  if (parts.length === 2) {
52838
52840
  try {
52839
52841
  const beamApp = this.getRootNode()?.host || document.querySelector("beam-app");
@@ -52891,7 +52893,7 @@ ${footerText || pageNum ? `<div class="slide-footer"><span>${footerText || ""}</
52891
52893
  el2.addEventListener("click", () => void invoke(), { once: false });
52892
52894
  el2.style.cursor = "pointer";
52893
52895
  }
52894
- const [embedPhoton, embedMethod] = method.split("/");
52896
+ const [embedPhoton, embedMethod] = method.split(method.includes(".") ? "." : "/");
52895
52897
  if (embedPhoton && embedMethod) {
52896
52898
  const renderHandler = (data) => {
52897
52899
  if (data?.photon === embedPhoton && data?.method === embedMethod) {
@@ -100402,6 +100404,12 @@ function buildPhotonDocblockTagCatalog(runtimeVersion) {
100402
100404
  type: "keyword"
100403
100405
  },
100404
100406
  { label: "@autorun", detail: "Auto-execute in Beam UI", apply: "@autorun", type: "keyword" },
100407
+ {
100408
+ label: "@scope",
100409
+ detail: "OAuth scopes required by this tool",
100410
+ snippetTmpl: "@scope ${1:bookings:write}",
100411
+ type: "keyword"
100412
+ },
100405
100413
  { label: "@async", detail: "Run in background", apply: "@async", type: "keyword" },
100406
100414
  {
100407
100415
  label: "@ui",