@elisym/mcp 0.15.6 → 0.15.8
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 +19 -7
- 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, JobWaitTimeoutError, decodeJobPayload, utf8ByteLength, formatAssetAmount, estimateNetworkBaseline, formatSol as formatSol$1, USDC_SOLANA_DEVNET, estimateSolFeeLamports, formatFeeBreakdown, resolveAssetFromPaymentRequest as resolveAssetFromPaymentRequest$1, parseAssetAmount, ElisymIdentity, ElisymClient, NATIVE_SOL, resolveKnownAsset, getProtocolProgramId, getProtocolConfig, assetKey, assetByKey, formatNetworkBaseline, KNOWN_ASSETS } from '@elisym/sdk';
|
|
2
|
+
import { LIMITS, DEFAULT_KIND_OFFSET, SolanaPaymentStrategy, makeCensor, DEFAULT_REDACT_PATHS, validateAgentName, RELAYS, toDTag, JobWaitTimeoutError, attachmentsOf, decodeJobPayload, utf8ByteLength, formatAssetAmount, estimateNetworkBaseline, formatSol as formatSol$1, USDC_SOLANA_DEVNET, estimateSolFeeLamports, formatFeeBreakdown, resolveAssetFromPaymentRequest as resolveAssetFromPaymentRequest$1, parseAssetAmount, ElisymIdentity, ElisymClient, NATIVE_SOL, resolveKnownAsset, getProtocolProgramId, getProtocolConfig, assetKey, assetByKey, formatNetworkBaseline, 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 { createIrohTransport, 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';
|
|
@@ -2192,6 +2192,9 @@ var GetJobResultSchema = z.object({
|
|
|
2192
2192
|
var FetchJobFileSchema = z.object({
|
|
2193
2193
|
job_event_id: z.string(),
|
|
2194
2194
|
output_path: z.string().min(1).max(4096).describe("Local path to write the downloaded result file to."),
|
|
2195
|
+
attachment_index: z.number().int().min(0).default(0).describe(
|
|
2196
|
+
"Which file to download when the result has MULTIPLE files (0-based; default 0). The download message reports the total count so you can fetch the others."
|
|
2197
|
+
),
|
|
2195
2198
|
allow_outside_cwd: z.boolean().default(false).describe(
|
|
2196
2199
|
"Allow writing outside the MCP server working directory. Off by default: the bytes come from an untrusted provider, so writes are confined to the working directory subtree (and never to a secret/auto-run path) unless this is set."
|
|
2197
2200
|
),
|
|
@@ -2872,17 +2875,18 @@ ${result}`);
|
|
|
2872
2875
|
return errorResult(error instanceof Error ? error.message : String(error));
|
|
2873
2876
|
}
|
|
2874
2877
|
const agent = ctx.active();
|
|
2875
|
-
|
|
2878
|
+
const index = input.attachment_index;
|
|
2879
|
+
let attachments = [];
|
|
2876
2880
|
if (agent.agentDir !== void 0) {
|
|
2877
2881
|
const entry = await findCustomerJob(agent.agentDir, input.job_event_id);
|
|
2878
2882
|
if (entry?.attachmentJson !== void 0) {
|
|
2879
2883
|
try {
|
|
2880
|
-
|
|
2884
|
+
attachments = [JSON.parse(entry.attachmentJson)];
|
|
2881
2885
|
} catch {
|
|
2882
2886
|
}
|
|
2883
2887
|
}
|
|
2884
2888
|
}
|
|
2885
|
-
if (
|
|
2889
|
+
if (attachments.length === 0 || index >= attachments.length) {
|
|
2886
2890
|
try {
|
|
2887
2891
|
const results = await agent.client.marketplace.queryJobResults(
|
|
2888
2892
|
agent.identity,
|
|
@@ -2891,7 +2895,7 @@ ${result}`);
|
|
|
2891
2895
|
);
|
|
2892
2896
|
const resultEntry = results.get(input.job_event_id);
|
|
2893
2897
|
if (resultEntry !== void 0 && !resultEntry.decryptionFailed) {
|
|
2894
|
-
|
|
2898
|
+
attachments = attachmentsOf(decodeJobPayload(resultEntry.content));
|
|
2895
2899
|
}
|
|
2896
2900
|
} catch (error) {
|
|
2897
2901
|
logger.warn(
|
|
@@ -2900,11 +2904,17 @@ ${result}`);
|
|
|
2900
2904
|
);
|
|
2901
2905
|
}
|
|
2902
2906
|
}
|
|
2903
|
-
if (
|
|
2907
|
+
if (attachments.length === 0) {
|
|
2904
2908
|
return errorResult(
|
|
2905
2909
|
`No file result found for event_id="${input.job_event_id}". It may be a text result, not yet delivered, or expired from the relays.`
|
|
2906
2910
|
);
|
|
2907
2911
|
}
|
|
2912
|
+
const attachment = attachments[index];
|
|
2913
|
+
if (attachment === void 0) {
|
|
2914
|
+
return errorResult(
|
|
2915
|
+
`attachment_index ${index} is out of range - this result has ${attachments.length} file(s) (valid indexes 0-${attachments.length - 1}).`
|
|
2916
|
+
);
|
|
2917
|
+
}
|
|
2908
2918
|
const irohTransport = attachment.transports.find((transport) => transport.kind === "iroh");
|
|
2909
2919
|
if (irohTransport === void 0) {
|
|
2910
2920
|
return errorResult("Result attachment has no supported transport (iroh).");
|
|
@@ -2927,7 +2937,8 @@ ${result}`);
|
|
|
2927
2937
|
}).catch(() => {
|
|
2928
2938
|
});
|
|
2929
2939
|
}
|
|
2930
|
-
|
|
2940
|
+
const more = attachments.length > 1 ? ` (file ${index + 1} of ${attachments.length}; fetch others with attachment_index=0..${attachments.length - 1})` : "";
|
|
2941
|
+
return textResult(`Downloaded result file "${attachment.name}" to ${outputPath}${more}.`);
|
|
2931
2942
|
}
|
|
2932
2943
|
}),
|
|
2933
2944
|
defineTool({
|
|
@@ -3811,6 +3822,7 @@ var discoveryTools = [
|
|
|
3811
3822
|
// gate anything - it just tells the caller a file input is expected.
|
|
3812
3823
|
// Already length-bounded by parseCapabilityEvent.
|
|
3813
3824
|
...card.inputMime ? { input_mime: card.inputMime } : {},
|
|
3825
|
+
...card.inputText ? { input_text: card.inputText } : {},
|
|
3814
3826
|
...card.outputMime ? { output_mime: card.outputMime } : {}
|
|
3815
3827
|
};
|
|
3816
3828
|
}),
|