commonswarm 0.1.65 → 0.1.66
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/cswarm.cjs +6 -3
- package/package.json +1 -1
package/cswarm.cjs
CHANGED
|
@@ -3771,11 +3771,14 @@ function parseAgentConnection(raw) {
|
|
|
3771
3771
|
try {
|
|
3772
3772
|
value = JSON.parse(raw);
|
|
3773
3773
|
} catch {
|
|
3774
|
-
throw new AgentSetupError("connection_invalid", "The connection file is not valid JSON.
|
|
3774
|
+
throw new AgentSetupError("connection_invalid", raw.includes("\\_") || /^\s*```/.test(raw) ? "The connection file appears to contain Markdown formatting. Use \u2018Use a setup file\u2019 in CommonSwarm and run setup with that file. Do not edit credentials or paste them into chat." : "The connection file is not valid JSON. Use \u2018Use a setup file\u2019 in CommonSwarm and run setup with that file. Do not paste its contents into chat.");
|
|
3775
3775
|
}
|
|
3776
3776
|
if (!value || Array.isArray(value) || typeof value !== "object" || value.version !== AGENT_CONNECTION_VERSION || Object.keys(value).length !== AGENT_CONNECTION_FIELDS.length || AGENT_CONNECTION_FIELDS.some((key2) => !Object.hasOwn(value, key2)) || typeof value.url !== "string" || typeof value.anon_key !== "string" || typeof value.workspace_id !== "string" || !ONBOARDING_UUID.test(value.workspace_id) || typeof value.principal_id !== "string" || !ONBOARDING_UUID.test(value.principal_id) || !value.credential || typeof value.credential !== "object" || Array.isArray(value.credential)) {
|
|
3777
3777
|
throw new AgentSetupError("connection_invalid", `Expected connection version ${AGENT_CONNECTION_VERSION} with fields: ${AGENT_CONNECTION_FIELDS.join(", ")}. Save the supplied file unchanged.`);
|
|
3778
3778
|
}
|
|
3779
|
+
if (/^\s*\[[\s\S]*\]\(/.test(value.url)) {
|
|
3780
|
+
throw new AgentSetupError("connection_target_invalid", "The connection URL appears to be a Markdown link. Use \u2018Use a setup file\u2019 in CommonSwarm and run setup with that file. Do not edit credentials or paste them into chat.");
|
|
3781
|
+
}
|
|
3779
3782
|
const target2 = checkedTarget(value.url, value.anon_key);
|
|
3780
3783
|
const agent = parseAgentCredentialInput(JSON.stringify(value.credential), { kind: "stdin" });
|
|
3781
3784
|
if (!agent.durable || agent.principalId !== value.principal_id.toLowerCase()) {
|
|
@@ -63066,8 +63069,8 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
63066
63069
|
]);
|
|
63067
63070
|
var UUID_RE25 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
63068
63071
|
function packageVersion() {
|
|
63069
|
-
if ("0.1.
|
|
63070
|
-
return "0.1.
|
|
63072
|
+
if ("0.1.66".length > 0) {
|
|
63073
|
+
return "0.1.66";
|
|
63071
63074
|
}
|
|
63072
63075
|
try {
|
|
63073
63076
|
const value = JSON.parse(
|