@frontman-ai/astro 0.5.0 → 0.5.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/index.js CHANGED
@@ -122,7 +122,7 @@ var clientCss = "https://app.frontman.sh/frontman.css";
122
122
  var devClientJs = "http://localhost:5173/src/Main.res.mjs";
123
123
 
124
124
  // src/FrontmanAstro__Config.res.mjs
125
- var packageVersion = "0.5.0" ;
125
+ var packageVersion = "0.5.1" ;
126
126
  var host = process.env["FRONTMAN_HOST"];
127
127
  var defaultHost = host !== void 0 ? host : apiHost;
128
128
  var ensureConfig = (function(c2) {
@@ -6122,11 +6122,13 @@ function generateHTML(config) {
6122
6122
  let clientCssTag = mapOr(config.clientCssUrl, "", (url2) => `<link rel="stylesheet" href="` + url2 + `">`);
6123
6123
  let entrypointTemplate = mapOr(config.entrypointUrl, "", (url2) => `<script type="template" id="frontman-entrypoint-url">` + url2 + `</script>`);
6124
6124
  let themeClass = config.isLightTheme ? "" : "dark";
6125
- let openrouterKey = flatMap(process.env["OPENROUTER_API_KEY"], (key) => {
6125
+ let getEnvKey = (varName) => flatMap(process.env[varName], (key) => {
6126
6126
  if (key !== "") {
6127
6127
  return key;
6128
6128
  }
6129
6129
  });
6130
+ let openrouterKey = getEnvKey("OPENROUTER_API_KEY");
6131
+ let anthropicKey = getEnvKey("ANTHROPIC_API_KEY");
6130
6132
  let configObj = Object.fromEntries([
6131
6133
  [
6132
6134
  "framework",
@@ -6148,6 +6150,9 @@ function generateHTML(config) {
6148
6150
  forEach(openrouterKey, (key) => {
6149
6151
  configObj["openrouterKeyValue"] = key;
6150
6152
  });
6153
+ forEach(anthropicKey, (key) => {
6154
+ configObj["anthropicKeyValue"] = key;
6155
+ });
6151
6156
  let payload = JSON.stringify(configObj);
6152
6157
  let runtimeConfigScript = `<script>window.__frontmanRuntime=` + payload + `</script>`;
6153
6158
  return `<!DOCTYPE html>
@@ -7814,6 +7819,13 @@ async function Te(o) {
7814
7819
  }
7815
7820
  }
7816
7821
 
7822
+ // ../frontman-protocol/src/FrontmanProtocol__Types.res.mjs
7823
+ enableJson2();
7824
+ var modelSelectionSchema = schema2((s2) => ({
7825
+ provider: s2.m(string2),
7826
+ value: s2.m(string2)
7827
+ }));
7828
+
7817
7829
  // ../frontman-protocol/src/FrontmanProtocol__MCP.res.mjs
7818
7830
  enableJson2();
7819
7831
  var capabilitiesSchema = schema2((s2) => ({
@@ -7840,17 +7852,32 @@ schema2((s2) => ({
7840
7852
  name: s2.m(string2),
7841
7853
  arguments: s2.m(option2(dict2(json2)))
7842
7854
  }));
7855
+ var toolResultContentTypeSchema = union2([
7856
+ literal2("text"),
7857
+ literal2("image"),
7858
+ literal2("resource")
7859
+ ]);
7843
7860
  var toolResultContentSchema = schema2((s2) => ({
7844
- type: s2.m(string2),
7861
+ type: s2.m(toolResultContentTypeSchema),
7845
7862
  text: s2.m(string2)
7846
7863
  }));
7847
7864
  schema2((s2) => ({
7848
7865
  code: s2.m(int2),
7849
7866
  message: s2.m(string2)
7850
7867
  }));
7868
+ var callToolResultMetaSchema = schema2((s2) => ({
7869
+ model: s2.m(option2(modelSelectionSchema)),
7870
+ envApiKey: s2.m(dict2(string2))
7871
+ }));
7872
+ var emptyMeta_envApiKey = {};
7873
+ var emptyMeta = {
7874
+ model: void 0,
7875
+ envApiKey: emptyMeta_envApiKey
7876
+ };
7851
7877
  var callToolResultSchema = schema2((s2) => ({
7852
7878
  content: s2.m(array2(toolResultContentSchema)),
7853
- isError: s2.m(option2(bool2))
7879
+ isError: s2.m(option2(bool2)),
7880
+ _meta: s2.m(callToolResultMetaSchema)
7854
7881
  }));
7855
7882
  schema2((s2) => ({
7856
7883
  tools: s2.m(array2(json2))
@@ -7933,7 +7960,8 @@ async function executeTool(registry, ctx2, name15, $$arguments) {
7933
7960
  type: "text",
7934
7961
  text: result._0
7935
7962
  }],
7936
- isError: true
7963
+ isError: true,
7964
+ _meta: emptyMeta
7937
7965
  }
7938
7966
  };
7939
7967
  }
@@ -7945,7 +7973,8 @@ async function executeTool(registry, ctx2, name15, $$arguments) {
7945
7973
  type: "text",
7946
7974
  text: JSON.stringify(outputJson)
7947
7975
  }],
7948
- isError: void 0
7976
+ isError: void 0,
7977
+ _meta: emptyMeta
7949
7978
  }
7950
7979
  };
7951
7980
  } catch (raw_e) {
@@ -7973,7 +8002,8 @@ function resultToMCP(result) {
7973
8002
  type: "text",
7974
8003
  text: `Tool not found: ` + result._0
7975
8004
  }],
7976
- isError: true
8005
+ isError: true,
8006
+ _meta: emptyMeta
7977
8007
  };
7978
8008
  case "InvalidInput":
7979
8009
  return {
@@ -7981,7 +8011,8 @@ function resultToMCP(result) {
7981
8011
  type: "text",
7982
8012
  text: `Invalid input: ` + result._0
7983
8013
  }],
7984
- isError: true
8014
+ isError: true,
8015
+ _meta: emptyMeta
7985
8016
  };
7986
8017
  case "ExecutionError":
7987
8018
  return {
@@ -7989,7 +8020,8 @@ function resultToMCP(result) {
7989
8020
  type: "text",
7990
8021
  text: `Execution error: ` + result._0
7991
8022
  }],
7992
- isError: true
8023
+ isError: true,
8024
+ _meta: emptyMeta
7993
8025
  };
7994
8026
  }
7995
8027
  }
@@ -8078,7 +8110,8 @@ async function handleToolCall(registry, config, req) {
8078
8110
  let errorResult_isError2 = true;
8079
8111
  let errorResult2 = {
8080
8112
  content: errorResult_content2,
8081
- isError: errorResult_isError2
8113
+ isError: errorResult_isError2,
8114
+ _meta: emptyMeta
8082
8115
  };
8083
8116
  controller.enqueue(encoder.encode(errorEvent(errorResult2)));
8084
8117
  controller.close();
@@ -8097,7 +8130,8 @@ async function handleToolCall(registry, config, req) {
8097
8130
  let errorResult_isError = true;
8098
8131
  let errorResult = {
8099
8132
  content: errorResult_content,
8100
- isError: errorResult_isError
8133
+ isError: errorResult_isError,
8134
+ _meta: emptyMeta
8101
8135
  };
8102
8136
  let json3 = reverseConvertToJsonOrThrow2(errorResult, callToolResultSchema);
8103
8137
  return Response.json(json3, {
@@ -8205,19 +8239,19 @@ function isFrontmanRoute(pathname, basePath, method) {
8205
8239
  function getCanonicalRedirect(prefixPath, basePath) {
8206
8240
  let suffix = "/" + basePath;
8207
8241
  if (prefixPath === basePath) {
8208
- return "/" + basePath;
8242
+ return "/" + basePath + "/";
8209
8243
  }
8210
8244
  if (prefixPath.endsWith(suffix)) {
8211
8245
  let stripped = prefixPath.slice(0, prefixPath.length - suffix.length | 0);
8212
8246
  let cleanPrefix = stripped === "" ? "" : stripped;
8213
- let tmp = cleanPrefix === "" ? "/" + basePath : "/" + cleanPrefix + "/" + basePath;
8247
+ let tmp = cleanPrefix === "" ? "/" + basePath + "/" : "/" + cleanPrefix + "/" + basePath + "/";
8214
8248
  return tmp;
8215
8249
  }
8216
8250
  if (!prefixPath.startsWith(basePath + "/")) {
8217
8251
  return;
8218
8252
  }
8219
- let rest = prefixPath.slice(basePath.length + 1 | 0);
8220
- let tmp$1 = rest === "" ? "/" + basePath : "/" + rest + "/" + basePath;
8253
+ let rest = prefixPath.slice(basePath.length + 1 | 0, prefixPath.length);
8254
+ let tmp$1 = rest === "" ? "/" + basePath + "/" : "/" + rest + "/" + basePath + "/";
8221
8255
  return tmp$1;
8222
8256
  }
8223
8257
  function buildEntrypointUrl(config, requestUrl, prefixPath) {
@@ -8227,7 +8261,7 @@ function buildEntrypointUrl(config, requestUrl, prefixPath) {
8227
8261
  }
8228
8262
  let url2 = new URL(requestUrl);
8229
8263
  let origin = url2.origin;
8230
- let pagePath = prefixPath === "" ? "/" : "/" + prefixPath;
8264
+ let pagePath = prefixPath === "" ? "/" : "/" + prefixPath + "/";
8231
8265
  return origin + pagePath;
8232
8266
  }
8233
8267
  function createMiddleware(config, registry) {
@@ -8423,7 +8457,7 @@ function adaptToConnect(middleware, basePath) {
8423
8457
 
8424
8458
  // src/FrontmanAstro__Integration.res.mjs
8425
8459
  var annotationCaptureScript2 = annotationCaptureScript;
8426
- var icon = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="3"/></svg>`;
8460
+ var icon = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="90 70 230 270" fill="none"><path d="M145.925 316.925C136.175 316.925 129.242 315.517 125.125 312.7C121.008 309.667 118.517 305.875 117.65 301.325C116.783 296.558 116.35 291.792 116.35 287.025V119C116.35 107.733 118.517 100.042 122.85 95.925C127.4 91.5917 135.417 89.425 146.9 89.425H265.85C270.833 89.425 275.492 89.8583 279.825 90.725C284.375 91.5917 288.058 94.0833 290.875 98.2C293.692 102.317 295.1 109.358 295.1 119.325C295.1 129.075 293.583 136.008 290.55 140.125C287.733 144.242 284.05 146.733 279.5 147.6C274.95 148.467 270.183 148.9 265.2 148.9H175.825V177.825H235.625C240.608 177.825 245.05 178.258 248.95 179.125C253.067 179.775 256.208 181.942 258.375 185.625C260.758 189.092 261.95 195.158 261.95 203.825C261.95 212.058 260.758 217.908 258.375 221.375C255.992 224.842 252.742 226.9 248.625 227.55C244.725 228.2 240.283 228.525 235.3 228.525H175.825V287.35C175.825 292.117 175.392 296.775 174.525 301.325C173.658 305.875 171.167 309.667 167.05 312.7C162.933 315.517 155.892 316.925 145.925 316.925Z" fill="currentColor"/></svg>`;
8427
8461
  function getToolbarAppPath() {
8428
8462
  return new URL("./toolbar.js", import.meta.url).pathname;
8429
8463
  }
@@ -353,7 +353,7 @@ var clientCss = "https://app.frontman.sh/frontman.css";
353
353
  var devClientJs = "http://localhost:5173/src/Main.res.mjs";
354
354
 
355
355
  // src/FrontmanAstro__Config.res.mjs
356
- var packageVersion = "0.5.0" ;
356
+ var packageVersion = "0.5.1" ;
357
357
  var host = process.env["FRONTMAN_HOST"];
358
358
  var defaultHost = host !== void 0 ? host : apiHost;
359
359
  var ensureConfig = (function(c2) {
@@ -6122,11 +6122,13 @@ function generateHTML(config) {
6122
6122
  let clientCssTag = mapOr(config.clientCssUrl, "", (url2) => `<link rel="stylesheet" href="` + url2 + `">`);
6123
6123
  let entrypointTemplate = mapOr(config.entrypointUrl, "", (url2) => `<script type="template" id="frontman-entrypoint-url">` + url2 + `</script>`);
6124
6124
  let themeClass = config.isLightTheme ? "" : "dark";
6125
- let openrouterKey = flatMap(process.env["OPENROUTER_API_KEY"], (key) => {
6125
+ let getEnvKey = (varName) => flatMap(process.env[varName], (key) => {
6126
6126
  if (key !== "") {
6127
6127
  return key;
6128
6128
  }
6129
6129
  });
6130
+ let openrouterKey = getEnvKey("OPENROUTER_API_KEY");
6131
+ let anthropicKey = getEnvKey("ANTHROPIC_API_KEY");
6130
6132
  let configObj = Object.fromEntries([
6131
6133
  [
6132
6134
  "framework",
@@ -6148,6 +6150,9 @@ function generateHTML(config) {
6148
6150
  forEach(openrouterKey, (key) => {
6149
6151
  configObj["openrouterKeyValue"] = key;
6150
6152
  });
6153
+ forEach(anthropicKey, (key) => {
6154
+ configObj["anthropicKeyValue"] = key;
6155
+ });
6151
6156
  let payload = JSON.stringify(configObj);
6152
6157
  let runtimeConfigScript = `<script>window.__frontmanRuntime=` + payload + `</script>`;
6153
6158
  return `<!DOCTYPE html>
@@ -7814,6 +7819,13 @@ async function Te(o) {
7814
7819
  }
7815
7820
  }
7816
7821
 
7822
+ // ../frontman-protocol/src/FrontmanProtocol__Types.res.mjs
7823
+ enableJson2();
7824
+ var modelSelectionSchema = schema2((s2) => ({
7825
+ provider: s2.m(string2),
7826
+ value: s2.m(string2)
7827
+ }));
7828
+
7817
7829
  // ../frontman-protocol/src/FrontmanProtocol__MCP.res.mjs
7818
7830
  enableJson2();
7819
7831
  var capabilitiesSchema = schema2((s2) => ({
@@ -7840,17 +7852,32 @@ schema2((s2) => ({
7840
7852
  name: s2.m(string2),
7841
7853
  arguments: s2.m(option2(dict2(json2)))
7842
7854
  }));
7855
+ var toolResultContentTypeSchema = union2([
7856
+ literal2("text"),
7857
+ literal2("image"),
7858
+ literal2("resource")
7859
+ ]);
7843
7860
  var toolResultContentSchema = schema2((s2) => ({
7844
- type: s2.m(string2),
7861
+ type: s2.m(toolResultContentTypeSchema),
7845
7862
  text: s2.m(string2)
7846
7863
  }));
7847
7864
  schema2((s2) => ({
7848
7865
  code: s2.m(int2),
7849
7866
  message: s2.m(string2)
7850
7867
  }));
7868
+ var callToolResultMetaSchema = schema2((s2) => ({
7869
+ model: s2.m(option2(modelSelectionSchema)),
7870
+ envApiKey: s2.m(dict2(string2))
7871
+ }));
7872
+ var emptyMeta_envApiKey = {};
7873
+ var emptyMeta = {
7874
+ model: void 0,
7875
+ envApiKey: emptyMeta_envApiKey
7876
+ };
7851
7877
  var callToolResultSchema = schema2((s2) => ({
7852
7878
  content: s2.m(array2(toolResultContentSchema)),
7853
- isError: s2.m(option2(bool2))
7879
+ isError: s2.m(option2(bool2)),
7880
+ _meta: s2.m(callToolResultMetaSchema)
7854
7881
  }));
7855
7882
  schema2((s2) => ({
7856
7883
  tools: s2.m(array2(json2))
@@ -7933,7 +7960,8 @@ async function executeTool(registry, ctx2, name15, $$arguments) {
7933
7960
  type: "text",
7934
7961
  text: result._0
7935
7962
  }],
7936
- isError: true
7963
+ isError: true,
7964
+ _meta: emptyMeta
7937
7965
  }
7938
7966
  };
7939
7967
  }
@@ -7945,7 +7973,8 @@ async function executeTool(registry, ctx2, name15, $$arguments) {
7945
7973
  type: "text",
7946
7974
  text: JSON.stringify(outputJson)
7947
7975
  }],
7948
- isError: void 0
7976
+ isError: void 0,
7977
+ _meta: emptyMeta
7949
7978
  }
7950
7979
  };
7951
7980
  } catch (raw_e) {
@@ -7973,7 +8002,8 @@ function resultToMCP(result) {
7973
8002
  type: "text",
7974
8003
  text: `Tool not found: ` + result._0
7975
8004
  }],
7976
- isError: true
8005
+ isError: true,
8006
+ _meta: emptyMeta
7977
8007
  };
7978
8008
  case "InvalidInput":
7979
8009
  return {
@@ -7981,7 +8011,8 @@ function resultToMCP(result) {
7981
8011
  type: "text",
7982
8012
  text: `Invalid input: ` + result._0
7983
8013
  }],
7984
- isError: true
8014
+ isError: true,
8015
+ _meta: emptyMeta
7985
8016
  };
7986
8017
  case "ExecutionError":
7987
8018
  return {
@@ -7989,7 +8020,8 @@ function resultToMCP(result) {
7989
8020
  type: "text",
7990
8021
  text: `Execution error: ` + result._0
7991
8022
  }],
7992
- isError: true
8023
+ isError: true,
8024
+ _meta: emptyMeta
7993
8025
  };
7994
8026
  }
7995
8027
  }
@@ -8078,7 +8110,8 @@ async function handleToolCall(registry, config, req) {
8078
8110
  let errorResult_isError2 = true;
8079
8111
  let errorResult2 = {
8080
8112
  content: errorResult_content2,
8081
- isError: errorResult_isError2
8113
+ isError: errorResult_isError2,
8114
+ _meta: emptyMeta
8082
8115
  };
8083
8116
  controller.enqueue(encoder.encode(errorEvent(errorResult2)));
8084
8117
  controller.close();
@@ -8097,7 +8130,8 @@ async function handleToolCall(registry, config, req) {
8097
8130
  let errorResult_isError = true;
8098
8131
  let errorResult = {
8099
8132
  content: errorResult_content,
8100
- isError: errorResult_isError
8133
+ isError: errorResult_isError,
8134
+ _meta: emptyMeta
8101
8135
  };
8102
8136
  let json3 = reverseConvertToJsonOrThrow2(errorResult, callToolResultSchema);
8103
8137
  return Response.json(json3, {
@@ -8205,19 +8239,19 @@ function isFrontmanRoute(pathname, basePath, method) {
8205
8239
  function getCanonicalRedirect(prefixPath, basePath) {
8206
8240
  let suffix = "/" + basePath;
8207
8241
  if (prefixPath === basePath) {
8208
- return "/" + basePath;
8242
+ return "/" + basePath + "/";
8209
8243
  }
8210
8244
  if (prefixPath.endsWith(suffix)) {
8211
8245
  let stripped = prefixPath.slice(0, prefixPath.length - suffix.length | 0);
8212
8246
  let cleanPrefix = stripped === "" ? "" : stripped;
8213
- let tmp = cleanPrefix === "" ? "/" + basePath : "/" + cleanPrefix + "/" + basePath;
8247
+ let tmp = cleanPrefix === "" ? "/" + basePath + "/" : "/" + cleanPrefix + "/" + basePath + "/";
8214
8248
  return tmp;
8215
8249
  }
8216
8250
  if (!prefixPath.startsWith(basePath + "/")) {
8217
8251
  return;
8218
8252
  }
8219
- let rest = prefixPath.slice(basePath.length + 1 | 0);
8220
- let tmp$1 = rest === "" ? "/" + basePath : "/" + rest + "/" + basePath;
8253
+ let rest = prefixPath.slice(basePath.length + 1 | 0, prefixPath.length);
8254
+ let tmp$1 = rest === "" ? "/" + basePath + "/" : "/" + rest + "/" + basePath + "/";
8221
8255
  return tmp$1;
8222
8256
  }
8223
8257
  function buildEntrypointUrl(config, requestUrl, prefixPath) {
@@ -8227,7 +8261,7 @@ function buildEntrypointUrl(config, requestUrl, prefixPath) {
8227
8261
  }
8228
8262
  let url2 = new URL(requestUrl);
8229
8263
  let origin = url2.origin;
8230
- let pagePath = prefixPath === "" ? "/" : "/" + prefixPath;
8264
+ let pagePath = prefixPath === "" ? "/" : "/" + prefixPath + "/";
8231
8265
  return origin + pagePath;
8232
8266
  }
8233
8267
  function createMiddleware(config, registry) {
@@ -8426,7 +8460,7 @@ function frontmanPropsInjectionPlugin2(prim) {
8426
8460
  return frontmanPropsInjectionPlugin();
8427
8461
  }
8428
8462
  var annotationCaptureScript2 = annotationCaptureScript;
8429
- var icon = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="3"/></svg>`;
8463
+ var icon = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="90 70 230 270" fill="none"><path d="M145.925 316.925C136.175 316.925 129.242 315.517 125.125 312.7C121.008 309.667 118.517 305.875 117.65 301.325C116.783 296.558 116.35 291.792 116.35 287.025V119C116.35 107.733 118.517 100.042 122.85 95.925C127.4 91.5917 135.417 89.425 146.9 89.425H265.85C270.833 89.425 275.492 89.8583 279.825 90.725C284.375 91.5917 288.058 94.0833 290.875 98.2C293.692 102.317 295.1 109.358 295.1 119.325C295.1 129.075 293.583 136.008 290.55 140.125C287.733 144.242 284.05 146.733 279.5 147.6C274.95 148.467 270.183 148.9 265.2 148.9H175.825V177.825H235.625C240.608 177.825 245.05 178.258 248.95 179.125C253.067 179.775 256.208 181.942 258.375 185.625C260.758 189.092 261.95 195.158 261.95 203.825C261.95 212.058 260.758 217.908 258.375 221.375C255.992 224.842 252.742 226.9 248.625 227.55C244.725 228.2 240.283 228.525 235.3 228.525H175.825V287.35C175.825 292.117 175.392 296.775 174.525 301.325C173.658 305.875 171.167 309.667 167.05 312.7C162.933 315.517 155.892 316.925 145.925 316.925Z" fill="currentColor"/></svg>`;
8430
8464
  function getToolbarAppPath() {
8431
8465
  return new URL("./toolbar.js", import.meta.url).pathname;
8432
8466
  }
package/dist/toolbar.js CHANGED
@@ -62,9 +62,10 @@ function app_init(_canvas, app2, _server) {
62
62
  return;
63
63
  }
64
64
  let basePath = _getBasePath();
65
- let pathname = location.pathname.replace(/\/$/, "");
66
- let alreadyInFrontman = pathname === `/` + basePath || pathname.endsWith(`/` + basePath);
67
- let url = alreadyInFrontman ? pathname : pathname === "" ? `/` + basePath : pathname + `/` + basePath;
65
+ let rawPathname = location.pathname;
66
+ let pathname = rawPathname.endsWith("/") ? rawPathname : rawPathname + "/";
67
+ let alreadyInFrontman = pathname === `/` + basePath + `/` || pathname.endsWith(`/` + basePath + `/`);
68
+ let url = alreadyInFrontman ? pathname : pathname + basePath + `/`;
68
69
  window.location.assign(url);
69
70
  app2.toggleState({
70
71
  state: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontman-ai/astro",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Astro integration for Frontman",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Frontman AI",