@elisym/cli 0.21.0 → 0.21.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.
- package/dist/index.js +63 -20
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -242,6 +242,7 @@ async function verifyKeyDeep(apiKey, model, signal) {
|
|
|
242
242
|
return {
|
|
243
243
|
ok: false,
|
|
244
244
|
reason: "unavailable",
|
|
245
|
+
status: response.status,
|
|
245
246
|
error: `HTTP ${response.status}: ${body.slice(0, 200)}`
|
|
246
247
|
};
|
|
247
248
|
} catch (error) {
|
|
@@ -490,6 +491,7 @@ function createOpenAICompatibleProvider(config) {
|
|
|
490
491
|
return {
|
|
491
492
|
ok: false,
|
|
492
493
|
reason: "unavailable",
|
|
494
|
+
status: response.status,
|
|
493
495
|
error: `HTTP ${response.status}: ${body.slice(0, 200)}`
|
|
494
496
|
};
|
|
495
497
|
} catch (error) {
|
|
@@ -790,6 +792,7 @@ async function verifyKeyDeep2(apiKey, model, signal) {
|
|
|
790
792
|
return {
|
|
791
793
|
ok: false,
|
|
792
794
|
reason: "unavailable",
|
|
795
|
+
status: response.status,
|
|
793
796
|
error: `HTTP ${response.status}: ${body.slice(0, 200)}`
|
|
794
797
|
};
|
|
795
798
|
} catch (error) {
|
|
@@ -2818,6 +2821,8 @@ var AgentRuntime = class {
|
|
|
2818
2821
|
}
|
|
2819
2822
|
const deadlineMs = this.config.paymentTimeoutSecs * 1e3;
|
|
2820
2823
|
const sigPathTimeoutMs = Math.min(deadlineMs, SIG_PATH_TIMEOUT_MS);
|
|
2824
|
+
let sigOutcome;
|
|
2825
|
+
let refOutcome;
|
|
2821
2826
|
let result;
|
|
2822
2827
|
try {
|
|
2823
2828
|
result = await new Promise((resolve3, reject) => {
|
|
@@ -2850,6 +2855,7 @@ var AgentRuntime = class {
|
|
|
2850
2855
|
return;
|
|
2851
2856
|
}
|
|
2852
2857
|
if (!sig) {
|
|
2858
|
+
sigOutcome = { gotSignature: false };
|
|
2853
2859
|
lose({ verified: false }, "sig path: no payment-completed feedback");
|
|
2854
2860
|
return;
|
|
2855
2861
|
}
|
|
@@ -2862,33 +2868,32 @@ var AgentRuntime = class {
|
|
|
2862
2868
|
win(verified);
|
|
2863
2869
|
} else {
|
|
2864
2870
|
const reason = verified.error ?? "unknown";
|
|
2871
|
+
sigOutcome = { gotSignature: true, error: reason };
|
|
2865
2872
|
lose(verified, `sig path: not verified (${reason})`);
|
|
2866
2873
|
}
|
|
2867
2874
|
} catch (err) {
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
);
|
|
2875
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2876
|
+
sigOutcome = { gotSignature: true, error: message };
|
|
2877
|
+
lose({ verified: false }, `sig path error: ${message}`);
|
|
2872
2878
|
}
|
|
2873
|
-
}).catch(
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
);
|
|
2879
|
+
}).catch((err) => {
|
|
2880
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2881
|
+
sigOutcome = { gotSignature: false, error: message };
|
|
2882
|
+
lose({ verified: false }, `sig path error: ${message}`);
|
|
2883
|
+
});
|
|
2879
2884
|
payment.verifyPayment(rpc, request, protocolConfig).then((verified) => {
|
|
2880
2885
|
if (verified.verified) {
|
|
2881
2886
|
win(verified);
|
|
2882
2887
|
} else {
|
|
2883
2888
|
const reason = verified.error ?? "unknown";
|
|
2889
|
+
refOutcome = { error: reason };
|
|
2884
2890
|
lose(verified, `ref path: not verified (${reason})`);
|
|
2885
2891
|
}
|
|
2886
|
-
}).catch(
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
);
|
|
2892
|
+
}).catch((err) => {
|
|
2893
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2894
|
+
refOutcome = { error: message };
|
|
2895
|
+
lose({ verified: false }, `ref path error: ${message}`);
|
|
2896
|
+
});
|
|
2892
2897
|
const deadline = setTimeout(() => {
|
|
2893
2898
|
if (settled) {
|
|
2894
2899
|
return;
|
|
@@ -2929,9 +2934,18 @@ var AgentRuntime = class {
|
|
|
2929
2934
|
if (result.verified) {
|
|
2930
2935
|
return { netAmount, paymentRequest: requestJson };
|
|
2931
2936
|
}
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2937
|
+
const refDefinitiveNoPay = refOutcome?.error === "No matching transaction found for reference key";
|
|
2938
|
+
const sigGotSignature = sigOutcome?.gotSignature === true;
|
|
2939
|
+
const customerAbandoned = !sigGotSignature && refDefinitiveNoPay;
|
|
2940
|
+
if (customerAbandoned) {
|
|
2941
|
+
log(
|
|
2942
|
+
`[${job.jobId.slice(0, 8)}] Payment not received; on-chain scan found no matching transaction - job abandoned by customer.`
|
|
2943
|
+
);
|
|
2944
|
+
} else {
|
|
2945
|
+
log(
|
|
2946
|
+
`[${job.jobId.slice(0, 8)}] WARNING: Payment verification timed out. Customer may have paid on-chain. Check address ${this.config.solanaAddress} manually.`
|
|
2947
|
+
);
|
|
2948
|
+
}
|
|
2935
2949
|
await this.transport.sendFeedback(job, { type: "error", message: "payment timeout" }).catch(() => {
|
|
2936
2950
|
});
|
|
2937
2951
|
throw new Error("Payment timeout");
|
|
@@ -3963,6 +3977,7 @@ async function cmdStart(nameArg, options = {}) {
|
|
|
3963
3977
|
(skill) => skill.mode !== "llm" && skill.llmOverride?.provider && skill.llmOverride?.model
|
|
3964
3978
|
);
|
|
3965
3979
|
const monitorPairs = /* @__PURE__ */ new Map();
|
|
3980
|
+
const retiredModels = /* @__PURE__ */ new Set();
|
|
3966
3981
|
const triplesByKey = /* @__PURE__ */ new Map();
|
|
3967
3982
|
const dependentSkillsByProvider = /* @__PURE__ */ new Map();
|
|
3968
3983
|
let agentDefaultCacheKey;
|
|
@@ -4059,7 +4074,10 @@ async function cmdStart(nameArg, options = {}) {
|
|
|
4059
4074
|
model: pair.model,
|
|
4060
4075
|
verifyFn
|
|
4061
4076
|
});
|
|
4062
|
-
|
|
4077
|
+
const modelRetired = !verification.ok && verification.reason === "unavailable" && verification.status === 404;
|
|
4078
|
+
if (!modelRetired) {
|
|
4079
|
+
healthMonitor.seed(pair.provider, pair.model, verification);
|
|
4080
|
+
}
|
|
4063
4081
|
if (verification.ok) {
|
|
4064
4082
|
console.log("ok");
|
|
4065
4083
|
} else if (verification.reason === "invalid") {
|
|
@@ -4081,6 +4099,13 @@ async function cmdStart(nameArg, options = {}) {
|
|
|
4081
4099
|
`
|
|
4082
4100
|
);
|
|
4083
4101
|
process.exit(1);
|
|
4102
|
+
} else if (verification.status === 404) {
|
|
4103
|
+
console.log("retired");
|
|
4104
|
+
console.error(
|
|
4105
|
+
` ! ${pair.provider} model "${pair.model}" no longer exists (HTTP 404). Update its model: in the SKILL.md / elisym.yaml. Skills using it will not be advertised.
|
|
4106
|
+
`
|
|
4107
|
+
);
|
|
4108
|
+
retiredModels.add(`${pair.provider}::${pair.model}`);
|
|
4084
4109
|
} else {
|
|
4085
4110
|
console.log("unavailable");
|
|
4086
4111
|
console.warn(
|
|
@@ -4271,8 +4296,26 @@ async function cmdStart(nameArg, options = {}) {
|
|
|
4271
4296
|
} : void 0
|
|
4272
4297
|
};
|
|
4273
4298
|
}
|
|
4299
|
+
function retiredModelKeyForSkill(skill) {
|
|
4300
|
+
if (skill.resolvedTriple) {
|
|
4301
|
+
return `${skill.resolvedTriple.provider}::${skill.resolvedTriple.model}`;
|
|
4302
|
+
}
|
|
4303
|
+
if (skill.llmOverride?.provider && skill.llmOverride?.model) {
|
|
4304
|
+
return `${skill.llmOverride.provider}::${skill.llmOverride.model}`;
|
|
4305
|
+
}
|
|
4306
|
+
return void 0;
|
|
4307
|
+
}
|
|
4274
4308
|
let cardsPublished = 0;
|
|
4275
4309
|
for (const skill of allSkills) {
|
|
4310
|
+
const modelKey = retiredModelKeyForSkill(skill);
|
|
4311
|
+
if (modelKey && retiredModels.has(modelKey)) {
|
|
4312
|
+
console.warn(` ! Not advertising "${skill.name}" - its model was retired (HTTP 404).`);
|
|
4313
|
+
logger.warn(
|
|
4314
|
+
{ event: "publish_skipped_retired", kind: 31990, skill: skill.name, model: modelKey },
|
|
4315
|
+
"capability not advertised - model retired"
|
|
4316
|
+
);
|
|
4317
|
+
continue;
|
|
4318
|
+
}
|
|
4276
4319
|
try {
|
|
4277
4320
|
await client.discovery.publishCapability(identity, buildCard(skill), kinds);
|
|
4278
4321
|
cardsPublished += 1;
|