@elisym/mcp 0.12.0 → 0.13.0
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 +18 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { LIMITS, DEFAULT_KIND_OFFSET, SolanaPaymentStrategy, makeCensor, DEFAULT_REDACT_PATHS, validateAgentName, RELAYS, toDTag, formatAssetAmount, estimateNetworkBaseline, formatSol as formatSol$1, USDC_SOLANA_DEVNET, estimateSolFeeLamports, formatFeeBreakdown, resolveAssetFromPaymentRequest as resolveAssetFromPaymentRequest$1, parseAssetAmount, ElisymIdentity, ElisymClient, NATIVE_SOL, resolveKnownAsset, formatNetworkBaseline, getProtocolProgramId, getProtocolConfig, assetKey, assetByKey, KNOWN_ASSETS } from '@elisym/sdk';
|
|
2
|
+
import { LIMITS, DEFAULT_KIND_OFFSET, SolanaPaymentStrategy, makeCensor, DEFAULT_REDACT_PATHS, validateAgentName, RELAYS, toDTag, JobWaitTimeoutError, formatAssetAmount, estimateNetworkBaseline, formatSol as formatSol$1, USDC_SOLANA_DEVNET, estimateSolFeeLamports, formatFeeBreakdown, resolveAssetFromPaymentRequest as resolveAssetFromPaymentRequest$1, parseAssetAmount, ElisymIdentity, ElisymClient, NATIVE_SOL, resolveKnownAsset, formatNetworkBaseline, getProtocolProgramId, getProtocolConfig, assetKey, assetByKey, KNOWN_ASSETS } from '@elisym/sdk';
|
|
3
3
|
import { listAgents, createAgentDir, writeYamlInitial, writeExampleSkillTemplate, writeSecrets, resolveAgent, loadAgent, globalConfigPath, writeYaml, writeFileAtomic as writeFileAtomic$1 } from '@elisym/sdk/agent-store';
|
|
4
4
|
import { loadGlobalConfig, writeGlobalConfig } from '@elisym/sdk/node';
|
|
5
5
|
import { getBase58Encoder, getBase58Decoder, generateKeyPairSigner, createSolanaRpc, address, createSolanaRpcSubscriptions, sendAndConfirmTransactionFactory, getSignatureFromTransaction, pipe, createTransactionMessage, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash, appendTransactionMessageInstructions, signTransactionMessageWithSigners, createKeyPairSignerFromBytes, isAddress } from '@solana/kit';
|
|
@@ -1536,9 +1536,6 @@ function buildJobCompletionTip(jobId, providerNpub) {
|
|
|
1536
1536
|
|
|
1537
1537
|
Tip: rate this provider with submit_feedback (job_event_id="${jobId}", rating="positive"|"negative"), or save them with add_contact (npub="${providerNpub}").`;
|
|
1538
1538
|
}
|
|
1539
|
-
function classifyJobFailure(message) {
|
|
1540
|
-
return /timed out/i.test(message) ? "timeout" : "failed";
|
|
1541
|
-
}
|
|
1542
1539
|
function pendingJobResult(jobId, paymentSig, submittedAt, warningBlock) {
|
|
1543
1540
|
const elapsedSecs = Math.round((Date.now() - submittedAt) / 1e3);
|
|
1544
1541
|
return textResult(
|
|
@@ -1803,6 +1800,9 @@ ${sanitized.text}`);
|
|
|
1803
1800
|
onFeedback: payHandler.onFeedback,
|
|
1804
1801
|
onError(error) {
|
|
1805
1802
|
reject(new Error(`Job error: ${error}`));
|
|
1803
|
+
},
|
|
1804
|
+
onTimeout(timeoutMs) {
|
|
1805
|
+
reject(new JobWaitTimeoutError(timeoutMs));
|
|
1806
1806
|
}
|
|
1807
1807
|
},
|
|
1808
1808
|
timeoutMs: params.timeoutMs,
|
|
@@ -1831,8 +1831,9 @@ ${sanitized.text}`);
|
|
|
1831
1831
|
${result}${tip}`);
|
|
1832
1832
|
} catch (e) {
|
|
1833
1833
|
const msg = e instanceof Error ? e.message : String(e);
|
|
1834
|
-
const
|
|
1835
|
-
const
|
|
1834
|
+
const isTimeout = e instanceof JobWaitTimeoutError;
|
|
1835
|
+
const failure = isTimeout ? "timeout" : "failed";
|
|
1836
|
+
const pending = isTimeout && paymentSig !== void 0;
|
|
1836
1837
|
await recordJobOutcome(agent, {
|
|
1837
1838
|
jobEventId: jobId,
|
|
1838
1839
|
capability: params.dTag,
|
|
@@ -1893,10 +1894,7 @@ function awaitJobResult(agent, options, fn, safetyTimeoutMs) {
|
|
|
1893
1894
|
const resolvedOptions = fn({ resolve: safeResolve, reject: safeReject });
|
|
1894
1895
|
closeFn = agent.client.marketplace.subscribeToJobUpdates(resolvedOptions);
|
|
1895
1896
|
if (safetyTimeoutMs) {
|
|
1896
|
-
safetyTimer = setTimeout(
|
|
1897
|
-
() => safeReject(new Error("Subscription timed out (safety fallback).")),
|
|
1898
|
-
safetyTimeoutMs
|
|
1899
|
-
);
|
|
1897
|
+
safetyTimer = setTimeout(() => safeReject(new JobWaitTimeoutError()), safetyTimeoutMs);
|
|
1900
1898
|
}
|
|
1901
1899
|
});
|
|
1902
1900
|
}
|
|
@@ -1967,6 +1965,9 @@ var customerTools = [
|
|
|
1967
1965
|
},
|
|
1968
1966
|
onError(error) {
|
|
1969
1967
|
reject(new Error(`Job error: ${error}`));
|
|
1968
|
+
},
|
|
1969
|
+
onTimeout(timeoutMs) {
|
|
1970
|
+
reject(new JobWaitTimeoutError(timeoutMs));
|
|
1970
1971
|
}
|
|
1971
1972
|
},
|
|
1972
1973
|
timeoutMs: timeout,
|
|
@@ -1978,7 +1979,7 @@ var customerTools = [
|
|
|
1978
1979
|
);
|
|
1979
1980
|
} catch (e) {
|
|
1980
1981
|
const msg = e instanceof Error ? e.message : String(e);
|
|
1981
|
-
if (
|
|
1982
|
+
if (e instanceof JobWaitTimeoutError) {
|
|
1982
1983
|
return textResult(
|
|
1983
1984
|
`event_id="${input.job_event_id}": result not ready yet (nothing within ${timeout / 1e3}s). This is NOT an error - the provider may still be working. Retry get_job_result later (optionally widen lookback_secs); results persist on the relays.`
|
|
1984
1985
|
);
|
|
@@ -2302,6 +2303,9 @@ ${sanitized.text}`
|
|
|
2302
2303
|
onFeedback: payHandler.onFeedback,
|
|
2303
2304
|
onError(error) {
|
|
2304
2305
|
reject(new Error(`Job error: ${error}`));
|
|
2306
|
+
},
|
|
2307
|
+
onTimeout(timeoutMs) {
|
|
2308
|
+
reject(new JobWaitTimeoutError(timeoutMs));
|
|
2305
2309
|
}
|
|
2306
2310
|
},
|
|
2307
2311
|
timeoutMs: timeout,
|
|
@@ -2330,8 +2334,9 @@ ${sanitized.text}`
|
|
|
2330
2334
|
${result}${tip}`);
|
|
2331
2335
|
} catch (e) {
|
|
2332
2336
|
const msg = e instanceof Error ? e.message : String(e);
|
|
2333
|
-
const
|
|
2334
|
-
const
|
|
2337
|
+
const isTimeout = e instanceof JobWaitTimeoutError;
|
|
2338
|
+
const failure = isTimeout ? "timeout" : "failed";
|
|
2339
|
+
const pending = isTimeout && paymentSig !== void 0;
|
|
2335
2340
|
await recordJobOutcome(agent, {
|
|
2336
2341
|
jobEventId: jobId,
|
|
2337
2342
|
capability: dTag,
|