maplibre-gl-geoagent 0.4.1 → 0.4.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 (33) hide show
  1. package/README.md +19 -0
  2. package/dist/{GeoAgentControl-CfSj1n01.js → GeoAgentControl-CM-lWHhd.js} +10 -7
  3. package/dist/{GeoAgentControl-CfSj1n01.js.map → GeoAgentControl-CM-lWHhd.js.map} +1 -1
  4. package/dist/{GeoAgentControl-Cc0HuUPf.cjs → GeoAgentControl-NjhimZRg.cjs} +10 -7
  5. package/dist/{GeoAgentControl-Cc0HuUPf.cjs.map → GeoAgentControl-NjhimZRg.cjs.map} +1 -1
  6. package/dist/{anthropic-BfFYVXzE.cjs → anthropic-poATb89G.cjs} +2 -2
  7. package/dist/{anthropic-BfFYVXzE.cjs.map → anthropic-poATb89G.cjs.map} +1 -1
  8. package/dist/{anthropic-BVBhgJNP.js → anthropic-qn30x05g.js} +2 -2
  9. package/dist/{anthropic-BVBhgJNP.js.map → anthropic-qn30x05g.js.map} +1 -1
  10. package/dist/{browser-D437ICBx.js → browser-CRRVT6sN.js} +2 -2
  11. package/dist/{browser-D437ICBx.js.map → browser-CRRVT6sN.js.map} +1 -1
  12. package/dist/{browser-BtMWNaZj.cjs → browser-DfKdZvWC.cjs} +2 -2
  13. package/dist/{browser-BtMWNaZj.cjs.map → browser-DfKdZvWC.cjs.map} +1 -1
  14. package/dist/{index-DaOfppi1.cjs → index-BHJHkcUd.cjs} +2 -2
  15. package/dist/{index-DaOfppi1.cjs.map → index-BHJHkcUd.cjs.map} +1 -1
  16. package/dist/{index-CeL5qxhv.js → index-CCdoSNb8.js} +2 -2
  17. package/dist/{index-CeL5qxhv.js.map → index-CCdoSNb8.js.map} +1 -1
  18. package/dist/{index-DumDV1aY.cjs → index-D8NXbhES.cjs} +2 -2
  19. package/dist/{index-DumDV1aY.cjs.map → index-D8NXbhES.cjs.map} +1 -1
  20. package/dist/{index-CVvcPs8z.js → index-DMcVy720.js} +2 -2
  21. package/dist/{index-CVvcPs8z.js.map → index-DMcVy720.js.map} +1 -1
  22. package/dist/{index-DGr_aIvw.cjs → index-DUXFjmo_.cjs} +2 -2
  23. package/dist/{index-DGr_aIvw.cjs.map → index-DUXFjmo_.cjs.map} +1 -1
  24. package/dist/{index-D0hzZEUn.js → index-nbt2E_lW.js} +2 -2
  25. package/dist/{index-D0hzZEUn.js.map → index-nbt2E_lW.js.map} +1 -1
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.mjs +1 -1
  28. package/dist/react.cjs +1 -1
  29. package/dist/react.mjs +1 -1
  30. package/dist/types/lib/core/GeoAgentControl.d.ts.map +1 -1
  31. package/dist/types/lib/core/types.d.ts +6 -0
  32. package/dist/types/lib/core/types.d.ts.map +1 -1
  33. package/package.json +1 -1
package/README.md CHANGED
@@ -131,6 +131,7 @@ Converse model ID, and set the AWS region. The default Bedrock model is
131
131
  | `defaultProvider` | `GeoAgentProviderId` | `'openai-responses'` |
132
132
  | `defaultModel` | `string \| Partial<Record<GeoAgentProviderId, string>>` | provider default |
133
133
  | `storagePrefix` | `string` | `'geoagent.maplibre'` |
134
+ | `apiKeys` | `Partial<Record<GeoAgentProviderId, string>>` | `undefined` |
134
135
  | `allowCodeExecutionDefault` | `boolean` | `true` |
135
136
  | `allowDestructiveToolsDefault` | `boolean` | `true` |
136
137
  | `showPermissionToggles` | `boolean` | `false` |
@@ -183,6 +184,24 @@ are sent directly from the page to the selected model provider. Use this for
183
184
  local development, trusted internal apps, or apps that intentionally expose a
184
185
  browser-compatible credential path.
185
186
 
187
+ Host applications can prefill the panel with initial API keys:
188
+
189
+ ```typescript
190
+ new GeoAgentControl({
191
+ apiKeys: {
192
+ "openai-responses": "OPENAI_API_KEY_VALUE",
193
+ "openai-chat": "OPENAI_API_KEY_VALUE",
194
+ anthropic: "ANTHROPIC_API_KEY_VALUE",
195
+ google: "GOOGLE_API_KEY_VALUE",
196
+ bedrock: "AWS_BEARER_TOKEN_BEDROCK_VALUE",
197
+ },
198
+ });
199
+ ```
200
+
201
+ Saved `sessionStorage` values take precedence over `apiKeys`. Initial keys are
202
+ kept in browser memory and are not written to storage unless the user edits the
203
+ API key field.
204
+
186
205
  For Amazon Bedrock, this browser-only control uses Bedrock API-key bearer-token
187
206
  authentication. Do not enter AWS access key IDs, secret access keys, or session
188
207
  tokens in this UI. For production Bedrock deployments, prefer a backend proxy
@@ -3518,7 +3518,7 @@ class HttpProtocol extends SerdeContext {
3518
3518
  });
3519
3519
  }
3520
3520
  async loadEventStreamCapability() {
3521
- const { EventStreamSerde } = await import("./index-CVvcPs8z.js");
3521
+ const { EventStreamSerde } = await import("./index-DMcVy720.js");
3522
3522
  return new EventStreamSerde({
3523
3523
  marshaller: this.getEventStreamMarshaller(),
3524
3524
  serializer: this.serializer,
@@ -42664,7 +42664,7 @@ class EarthEngineService {
42664
42664
  }
42665
42665
  async loadEe() {
42666
42666
  if (!this.eePromise) {
42667
- this.eePromise = import("./browser-D437ICBx.js").then((n) => n.b).then((module) => {
42667
+ this.eePromise = import("./browser-CRRVT6sN.js").then((n) => n.b).then((module) => {
42668
42668
  const imported = "default" in module ? module.default : module;
42669
42669
  const ee = imported;
42670
42670
  const scope2 = globalThis;
@@ -46043,6 +46043,7 @@ class GeoAgentControl {
46043
46043
  allowDestructiveToolsDefault: options.allowDestructiveToolsDefault ?? true,
46044
46044
  showPermissionToggles: options.showPermissionToggles ?? false,
46045
46045
  defaultModel: options.defaultModel,
46046
+ apiKeys: options.apiKeys,
46046
46047
  basemaps: options.basemaps,
46047
46048
  earthEngine: options.earthEngine
46048
46049
  };
@@ -46711,16 +46712,18 @@ class GeoAgentControl {
46711
46712
  return this.providerConfig(this.currentProviderId());
46712
46713
  }
46713
46714
  loadProviderSettings() {
46715
+ var _a3, _b3;
46714
46716
  if (!this.ui) {
46715
46717
  return;
46716
46718
  }
46717
46719
  const provider = this.currentProviderConfig();
46720
+ const initialApiKey = ((_b3 = (_a3 = this.options.apiKeys) == null ? void 0 : _a3[provider.id]) == null ? void 0 : _b3.trim()) ?? "";
46718
46721
  this.state.providerId = provider.id;
46719
46722
  this.state.modelId = storageGet(this.modelStorageKey(provider.id)) || provider.defaultModel;
46720
46723
  this.ui.providerSelect.value = provider.id;
46721
46724
  this.ui.apiKeyLabel.textContent = provider.keyLabel;
46722
46725
  this.ui.apiKeyInput.placeholder = provider.keyPlaceholder;
46723
- this.ui.apiKeyInput.value = storageGet(provider.storageKey) || "";
46726
+ this.ui.apiKeyInput.value = storageGet(provider.storageKey) || initialApiKey;
46724
46727
  this.ui.modelIdInput.value = this.state.modelId;
46725
46728
  this.ui.modelIdInput.placeholder = provider.defaultModel;
46726
46729
  this.state.bedrockRegion = this.initialBedrockRegion();
@@ -46841,7 +46844,7 @@ ${markdown.trim()}`;
46841
46844
  }
46842
46845
  async createProviderModel(providerId, modelId, apiKey, bedrockRegion) {
46843
46846
  if (providerId === "openai-responses" || providerId === "openai-chat") {
46844
- const { OpenAIModel } = await import("./index-CeL5qxhv.js");
46847
+ const { OpenAIModel } = await import("./index-CCdoSNb8.js");
46845
46848
  return new OpenAIModel({
46846
46849
  api: providerId === "openai-responses" ? "responses" : "chat",
46847
46850
  modelId,
@@ -46852,7 +46855,7 @@ ${markdown.trim()}`;
46852
46855
  });
46853
46856
  }
46854
46857
  if (providerId === "anthropic") {
46855
- const { AnthropicModel } = await import("./anthropic-BVBhgJNP.js");
46858
+ const { AnthropicModel } = await import("./anthropic-qn30x05g.js");
46856
46859
  return new AnthropicModel({
46857
46860
  modelId,
46858
46861
  apiKey,
@@ -46862,7 +46865,7 @@ ${markdown.trim()}`;
46862
46865
  });
46863
46866
  }
46864
46867
  if (providerId === "google") {
46865
- const { GoogleModel } = await import("./index-D0hzZEUn.js");
46868
+ const { GoogleModel } = await import("./index-nbt2E_lW.js");
46866
46869
  return new GoogleModel({
46867
46870
  modelId,
46868
46871
  apiKey
@@ -47087,4 +47090,4 @@ export {
47087
47090
  toJsonValue as t,
47088
47091
  warnOnce as w
47089
47092
  };
47090
- //# sourceMappingURL=GeoAgentControl-CfSj1n01.js.map
47093
+ //# sourceMappingURL=GeoAgentControl-CM-lWHhd.js.map