maplibre-gl-geoagent 0.4.3 → 0.4.4
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/{GeoAgentControl-wFkbhvbu.cjs → GeoAgentControl-BYfsQsUU.cjs} +88 -11
- package/dist/{GeoAgentControl-wFkbhvbu.cjs.map → GeoAgentControl-BYfsQsUU.cjs.map} +1 -1
- package/dist/{GeoAgentControl-D02UP5lT.js → GeoAgentControl-CNQpbA-X.js} +88 -11
- package/dist/{GeoAgentControl-D02UP5lT.js.map → GeoAgentControl-CNQpbA-X.js.map} +1 -1
- package/dist/{anthropic-S2hd2NQm.cjs → anthropic-0HkAVdzd.cjs} +2 -2
- package/dist/{anthropic-S2hd2NQm.cjs.map → anthropic-0HkAVdzd.cjs.map} +1 -1
- package/dist/{anthropic-CqhQTvtC.js → anthropic-BwVcgri0.js} +2 -2
- package/dist/{anthropic-CqhQTvtC.js.map → anthropic-BwVcgri0.js.map} +1 -1
- package/dist/{browser-DT7siLDs.js → browser-1SkgqVpl.js} +2 -2
- package/dist/{browser-DT7siLDs.js.map → browser-1SkgqVpl.js.map} +1 -1
- package/dist/{browser-wX4BKxTA.cjs → browser-BtM59MC_.cjs} +2 -2
- package/dist/{browser-wX4BKxTA.cjs.map → browser-BtM59MC_.cjs.map} +1 -1
- package/dist/{index-CvWJMktS.js → index-A1swYU5S.js} +2 -2
- package/dist/{index-CvWJMktS.js.map → index-A1swYU5S.js.map} +1 -1
- package/dist/{index-9Vl-_b39.cjs → index-BNkHglHv.cjs} +2 -2
- package/dist/{index-9Vl-_b39.cjs.map → index-BNkHglHv.cjs.map} +1 -1
- package/dist/{index-B70XIdgV.cjs → index-BoF3kFnA.cjs} +2 -2
- package/dist/{index-B70XIdgV.cjs.map → index-BoF3kFnA.cjs.map} +1 -1
- package/dist/{index-R5s1nbgn.cjs → index-D6NOZFBl.cjs} +2 -2
- package/dist/{index-R5s1nbgn.cjs.map → index-D6NOZFBl.cjs.map} +1 -1
- package/dist/{index-ITGaM0CV.js → index-Dvgf4Wa_.js} +2 -2
- package/dist/{index-ITGaM0CV.js.map → index-Dvgf4Wa_.js.map} +1 -1
- package/dist/{index-_-KavWih.js → index-NrFXGjTQ.js} +2 -2
- package/dist/{index-_-KavWih.js.map → index-NrFXGjTQ.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/maplibre-gl-geoagent.css +5 -0
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +1 -1
- package/dist/types/lib/core/GeoAgentControl.d.ts +18 -0
- package/dist/types/lib/core/GeoAgentControl.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3519,7 +3519,7 @@ class HttpProtocol extends SerdeContext {
|
|
|
3519
3519
|
});
|
|
3520
3520
|
}
|
|
3521
3521
|
async loadEventStreamCapability() {
|
|
3522
|
-
const { EventStreamSerde } = await Promise.resolve().then(() => require("./index-
|
|
3522
|
+
const { EventStreamSerde } = await Promise.resolve().then(() => require("./index-BNkHglHv.cjs"));
|
|
3523
3523
|
return new EventStreamSerde({
|
|
3524
3524
|
marshaller: this.getEventStreamMarshaller(),
|
|
3525
3525
|
serializer: this.serializer,
|
|
@@ -42665,7 +42665,7 @@ class EarthEngineService {
|
|
|
42665
42665
|
}
|
|
42666
42666
|
async loadEe() {
|
|
42667
42667
|
if (!this.eePromise) {
|
|
42668
|
-
this.eePromise = Promise.resolve().then(() => require("./browser-
|
|
42668
|
+
this.eePromise = Promise.resolve().then(() => require("./browser-BtM59MC_.cjs")).then((n) => n.browser).then((module2) => {
|
|
42669
42669
|
const imported = "default" in module2 ? module2.default : module2;
|
|
42670
42670
|
const ee = imported;
|
|
42671
42671
|
const scope2 = globalThis;
|
|
@@ -45919,6 +45919,9 @@ ${code2}
|
|
|
45919
45919
|
}
|
|
45920
45920
|
const DEFAULT_PROVIDER = "openai-responses";
|
|
45921
45921
|
const DEFAULT_STORAGE_PREFIX = "geoagent.maplibre";
|
|
45922
|
+
const STATUS_READY = "Ready";
|
|
45923
|
+
const STATUS_SETUP = "Setup required";
|
|
45924
|
+
const IDLE_STATUS_LABELS = /* @__PURE__ */ new Set([STATUS_READY, STATUS_SETUP]);
|
|
45922
45925
|
const BASE_PROVIDER_CONFIGS = {
|
|
45923
45926
|
"openai-responses": {
|
|
45924
45927
|
id: "openai-responses",
|
|
@@ -46083,8 +46086,8 @@ class GeoAgentControl {
|
|
|
46083
46086
|
});
|
|
46084
46087
|
this.setupEventListeners();
|
|
46085
46088
|
this.loadProviderSettings();
|
|
46086
|
-
this.
|
|
46087
|
-
this.appendLog("system",
|
|
46089
|
+
this.applyIdleStatus(true);
|
|
46090
|
+
this.appendLog("system", this.readyLogMessage());
|
|
46088
46091
|
this.updateControls();
|
|
46089
46092
|
if (!this.state.collapsed) {
|
|
46090
46093
|
this.panel.classList.add("expanded");
|
|
@@ -46781,6 +46784,68 @@ class GeoAgentControl {
|
|
|
46781
46784
|
this.ui.status.textContent = text2;
|
|
46782
46785
|
this.ui.status.className = `geoagent-status ${kind}`.trim();
|
|
46783
46786
|
}
|
|
46787
|
+
/**
|
|
46788
|
+
* Whether the agent has everything it needs to run a prompt for the current
|
|
46789
|
+
* provider: an API key, a model id, and (for Bedrock) a region.
|
|
46790
|
+
*/
|
|
46791
|
+
isConfigured() {
|
|
46792
|
+
if (!this.ui) {
|
|
46793
|
+
return false;
|
|
46794
|
+
}
|
|
46795
|
+
if (!this.ui.apiKeyInput.value.trim() || !this.ui.modelIdInput.value.trim()) {
|
|
46796
|
+
return false;
|
|
46797
|
+
}
|
|
46798
|
+
if (this.state.providerId === "bedrock" && !this.ui.bedrockRegionInput.value.trim()) {
|
|
46799
|
+
return false;
|
|
46800
|
+
}
|
|
46801
|
+
return true;
|
|
46802
|
+
}
|
|
46803
|
+
/**
|
|
46804
|
+
* Human-readable, comma-separated list of the configuration fields that are
|
|
46805
|
+
* still missing for the current provider (empty when fully configured).
|
|
46806
|
+
*/
|
|
46807
|
+
missingConfigSummary() {
|
|
46808
|
+
if (!this.ui) {
|
|
46809
|
+
return "";
|
|
46810
|
+
}
|
|
46811
|
+
const missing = [];
|
|
46812
|
+
if (!this.ui.apiKeyInput.value.trim()) {
|
|
46813
|
+
missing.push(this.currentProviderConfig().keyLabel);
|
|
46814
|
+
}
|
|
46815
|
+
if (!this.ui.modelIdInput.value.trim()) {
|
|
46816
|
+
missing.push("model");
|
|
46817
|
+
}
|
|
46818
|
+
if (this.state.providerId === "bedrock" && !this.ui.bedrockRegionInput.value.trim()) {
|
|
46819
|
+
missing.push("region");
|
|
46820
|
+
}
|
|
46821
|
+
return missing.join(", ");
|
|
46822
|
+
}
|
|
46823
|
+
readyLogMessage() {
|
|
46824
|
+
if (this.isConfigured()) {
|
|
46825
|
+
return "Browser-only Strands MapLibre agent ready.";
|
|
46826
|
+
}
|
|
46827
|
+
const missing = this.missingConfigSummary();
|
|
46828
|
+
return missing ? `Browser-only Strands MapLibre agent loaded. Add your ${missing} to start.` : "Browser-only Strands MapLibre agent loaded.";
|
|
46829
|
+
}
|
|
46830
|
+
/**
|
|
46831
|
+
* Refresh the idle status badge so it reflects whether the agent has the
|
|
46832
|
+
* credentials it needs. Transient run statuses (Running, Cancelled, Error,
|
|
46833
|
+
* Copied) are left untouched unless `force` is set, so this can be called
|
|
46834
|
+
* from updateControls() on every keystroke without clobbering them.
|
|
46835
|
+
*/
|
|
46836
|
+
applyIdleStatus(force = false) {
|
|
46837
|
+
if (!this.ui || this.state.busy && !force) {
|
|
46838
|
+
return;
|
|
46839
|
+
}
|
|
46840
|
+
if (!force && !IDLE_STATUS_LABELS.has(this.ui.status.textContent ?? "")) {
|
|
46841
|
+
return;
|
|
46842
|
+
}
|
|
46843
|
+
if (this.isConfigured()) {
|
|
46844
|
+
this.setStatus(STATUS_READY, "connected");
|
|
46845
|
+
} else {
|
|
46846
|
+
this.setStatus(STATUS_SETUP, "setup");
|
|
46847
|
+
}
|
|
46848
|
+
}
|
|
46784
46849
|
appendLog(role, text2, markdown = text2) {
|
|
46785
46850
|
if (!this.ui) {
|
|
46786
46851
|
throw new Error("GeoAgent control UI is not mounted.");
|
|
@@ -46857,16 +46922,24 @@ ${markdown.trim()}`;
|
|
|
46857
46922
|
textarea.remove();
|
|
46858
46923
|
}
|
|
46859
46924
|
this.setStatus("Copied", "connected");
|
|
46860
|
-
window.setTimeout(() => this.
|
|
46925
|
+
window.setTimeout(() => this.applyIdleStatus(true), 1200);
|
|
46861
46926
|
}
|
|
46862
46927
|
updateControls() {
|
|
46863
46928
|
if (!this.ui) {
|
|
46864
46929
|
return;
|
|
46865
46930
|
}
|
|
46866
|
-
|
|
46931
|
+
const configured = this.isConfigured();
|
|
46932
|
+
this.ui.sendButton.disabled = this.state.busy || !this.ui.prompt.value.trim() || !configured;
|
|
46933
|
+
if (configured) {
|
|
46934
|
+
this.ui.sendButton.removeAttribute("title");
|
|
46935
|
+
} else {
|
|
46936
|
+
const missing = this.missingConfigSummary();
|
|
46937
|
+
this.ui.sendButton.title = missing ? `Add your ${missing} to send a prompt.` : "Configuration required to send a prompt.";
|
|
46938
|
+
}
|
|
46867
46939
|
this.ui.cancelButton.disabled = !this.state.busy || this.cancelRequested;
|
|
46868
46940
|
this.ui.clearButton.disabled = this.state.busy;
|
|
46869
46941
|
this.ui.copyButton.disabled = this.ui.log.childElementCount === 0;
|
|
46942
|
+
this.applyIdleStatus();
|
|
46870
46943
|
}
|
|
46871
46944
|
invalidateAgent() {
|
|
46872
46945
|
this.agent = null;
|
|
@@ -46886,7 +46959,7 @@ ${markdown.trim()}`;
|
|
|
46886
46959
|
}
|
|
46887
46960
|
async createProviderModel(providerId, modelId, apiKey, bedrockRegion) {
|
|
46888
46961
|
if (providerId === "openai-responses" || providerId === "openai-chat") {
|
|
46889
|
-
const { OpenAIModel } = await Promise.resolve().then(() => require("./index-
|
|
46962
|
+
const { OpenAIModel } = await Promise.resolve().then(() => require("./index-BoF3kFnA.cjs"));
|
|
46890
46963
|
return new OpenAIModel({
|
|
46891
46964
|
api: providerId === "openai-responses" ? "responses" : "chat",
|
|
46892
46965
|
modelId,
|
|
@@ -46897,7 +46970,7 @@ ${markdown.trim()}`;
|
|
|
46897
46970
|
});
|
|
46898
46971
|
}
|
|
46899
46972
|
if (providerId === "anthropic") {
|
|
46900
|
-
const { AnthropicModel } = await Promise.resolve().then(() => require("./anthropic-
|
|
46973
|
+
const { AnthropicModel } = await Promise.resolve().then(() => require("./anthropic-0HkAVdzd.cjs"));
|
|
46901
46974
|
return new AnthropicModel({
|
|
46902
46975
|
modelId,
|
|
46903
46976
|
apiKey,
|
|
@@ -46907,7 +46980,7 @@ ${markdown.trim()}`;
|
|
|
46907
46980
|
});
|
|
46908
46981
|
}
|
|
46909
46982
|
if (providerId === "google") {
|
|
46910
|
-
const { GoogleModel } = await Promise.resolve().then(() => require("./index-
|
|
46983
|
+
const { GoogleModel } = await Promise.resolve().then(() => require("./index-D6NOZFBl.cjs"));
|
|
46911
46984
|
return new GoogleModel({
|
|
46912
46985
|
modelId,
|
|
46913
46986
|
apiKey
|
|
@@ -47033,7 +47106,11 @@ ${BROWSER_MAPLIBRE_CODE_SYSTEM_PROMPT}` : BROWSER_MAPLIBRE_SYSTEM_PROMPT;
|
|
|
47033
47106
|
} else {
|
|
47034
47107
|
this.appendAssistantLog(answer);
|
|
47035
47108
|
}
|
|
47036
|
-
|
|
47109
|
+
if (abortController.signal.aborted) {
|
|
47110
|
+
this.setStatus("Cancelled", "connected");
|
|
47111
|
+
} else {
|
|
47112
|
+
this.applyIdleStatus(true);
|
|
47113
|
+
}
|
|
47037
47114
|
} catch (error) {
|
|
47038
47115
|
const message = error instanceof Error ? error.message : String(error);
|
|
47039
47116
|
if (abortController.signal.aborted) {
|
|
@@ -47127,4 +47204,4 @@ exports.toJsonValue = toJsonValue;
|
|
|
47127
47204
|
exports.toMimeType = toMimeType;
|
|
47128
47205
|
exports.toUtf8 = toUtf8;
|
|
47129
47206
|
exports.warnOnce = warnOnce;
|
|
47130
|
-
//# sourceMappingURL=GeoAgentControl-
|
|
47207
|
+
//# sourceMappingURL=GeoAgentControl-BYfsQsUU.cjs.map
|