@elisym/sdk 0.17.0 → 0.18.1
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.cjs +27 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -1
- package/dist/llm-health.cjs +121 -1
- package/dist/llm-health.cjs.map +1 -1
- package/dist/llm-health.d.cts +70 -2
- package/dist/llm-health.d.ts +70 -2
- package/dist/llm-health.js +121 -1
- package/dist/llm-health.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -613,6 +613,44 @@ declare class ElisymClient {
|
|
|
613
613
|
close(): void;
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
+
/**
|
|
617
|
+
* Customer-facing error feedback that arrives via `subscribeToJobUpdates`'s
|
|
618
|
+
* `onError` callback can come from many places:
|
|
619
|
+
*
|
|
620
|
+
* - The runtime's stable `Agent temporarily unavailable` string when the
|
|
621
|
+
* LLM health gate refuses a job (preflight) or an in-flight skill
|
|
622
|
+
* surfaced a billing/invalid signal.
|
|
623
|
+
* - The runtime's `Internal processing error` sanitization mask for any
|
|
624
|
+
* "<Provider> API error: ..." string that leaks out of an LLM call.
|
|
625
|
+
* - Raw script-skill failures the runtime forwards as-is when the
|
|
626
|
+
* message does not contain "API" - e.g. shell scripts that reach
|
|
627
|
+
* Anthropic's `count_tokens` endpoint and exit 1 with the body in
|
|
628
|
+
* stderr instead of using the canonical exit-42 contract.
|
|
629
|
+
* - Generic transport errors (timeouts, "Provider returned an error",
|
|
630
|
+
* rate-limit refusals, payment errors).
|
|
631
|
+
*
|
|
632
|
+
* Customers don't care which path produced the error - they care whether
|
|
633
|
+
* the agent is down (try later, payment recoverable) or something else
|
|
634
|
+
* went wrong (their input, their wallet, etc). This classifier collapses
|
|
635
|
+
* the first three categories into a single `agent-unavailable` kind so
|
|
636
|
+
* the UI can render one stable message regardless of how the underlying
|
|
637
|
+
* provider chose to surface the failure.
|
|
638
|
+
*
|
|
639
|
+
* Markers are kept as a permissive superset of every billing/auth phrase
|
|
640
|
+
* the CLI and skill scripts are known to emit. Adding a new marker is
|
|
641
|
+
* always safe; removing one risks classifying a real outage as `unknown`.
|
|
642
|
+
*/
|
|
643
|
+
type JobErrorKind = 'agent-unavailable' | 'unknown';
|
|
644
|
+
/**
|
|
645
|
+
* Classify a customer-facing error string surfaced via
|
|
646
|
+
* `JobUpdateCallbacks.onError` into a stable kind the UI can branch on.
|
|
647
|
+
*
|
|
648
|
+
* Match is case-insensitive against the message text. Returns
|
|
649
|
+
* `agent-unavailable` for any known billing/auth/invalid-key signal;
|
|
650
|
+
* `unknown` for everything else (timeouts, validation errors, transport).
|
|
651
|
+
*/
|
|
652
|
+
declare function classifyJobError(message: string): JobErrorKind;
|
|
653
|
+
|
|
616
654
|
declare class SolanaPaymentStrategy implements PaymentStrategy {
|
|
617
655
|
readonly chain = "solana";
|
|
618
656
|
calculateFee(amount: number, config: ProtocolConfigInput): number;
|
|
@@ -1162,4 +1200,4 @@ declare const LIMITS: {
|
|
|
1162
1200
|
readonly MAX_CAPABILITY_LENGTH: 64;
|
|
1163
1201
|
};
|
|
1164
1202
|
|
|
1165
|
-
export { type Agent, type AggregateNetworkStatsOptions, Asset, BoundedSet, type BuildTransactionOptions, type CapabilityCard, DEFAULTS, DEFAULT_KIND_OFFSET, DEFAULT_REDACT_PATHS, DiscoveryService, ELISYM_PROTOCOL_TAG, ElisymClient, type ElisymClientConfig, type ElisymClientFullConfig, ElisymIdentity, type EstimatePriorityFeeOptions, type EstimateSolFeeOptions, type GetProtocolConfigOptions, INPUT_REDACT_PATHS, type Job, type JobStatus, type JobSubscriptionOptions, type JobUpdateCallbacks, KIND_APP_HANDLER, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT, KIND_JOB_RESULT_BASE, KIND_PING, KIND_PONG, LAMPORTS_PER_SOL, LIMITS, MarketplaceService, MediaService, type Network, type NetworkBaselineEstimate, type NetworkBaselineOptions, type NetworkStats, type NetworkStatsResult, NostrPool, type OnchainNetworkStats, PROTOCOL_PROGRAM_ID_DEVNET, type ParseOptions, type ParseResult, type ParsedPaymentRequest, type PaymentAssetRef, type PaymentInfo, type PaymentRequestData, PaymentRequestSchema, type PaymentStrategy, type PaymentValidationCode, type PaymentValidationError, type PingResult, PingService, type ProtocolCluster, type ProtocolConfig, type ProtocolConfigInput, type QuickVerifyReason, type QuickVerifyResult, RELAYS, type RankKey, SECRET_REDACT_PATHS, type Signer, type SolFeeEstimate, SolanaPaymentStrategy, type SubCloser, type SubmitJobOptions, type VerifyOptions, type VerifyResult, aggregateNetworkStats, assertExpiry, assertLamports, buildPaymentInstructions, calculateProtocolFee, clearPriorityFeeCache, clearProtocolConfigCache, clearQuickVerifyCache, compareAgentsByRank, computeRankKey, createPaymentRequestWithOnchainConfig, estimateNetworkBaseline, estimatePriorityFeeMicroLamports, estimateSolFeeLamports, formatFeeBreakdown, formatNetworkBaseline, formatSol, getNetworkStats, getProtocolConfig, getProtocolProgramId, jobRequestKind, jobResultKind, makeCensor, nip44Decrypt, nip44Encrypt, parsePaymentRequest, pickPercentileFee, timeAgo, toDTag, truncateKey, validateAgentName, validateExpiry, verifyJobPaymentQuick };
|
|
1203
|
+
export { type Agent, type AggregateNetworkStatsOptions, Asset, BoundedSet, type BuildTransactionOptions, type CapabilityCard, DEFAULTS, DEFAULT_KIND_OFFSET, DEFAULT_REDACT_PATHS, DiscoveryService, ELISYM_PROTOCOL_TAG, ElisymClient, type ElisymClientConfig, type ElisymClientFullConfig, ElisymIdentity, type EstimatePriorityFeeOptions, type EstimateSolFeeOptions, type GetProtocolConfigOptions, INPUT_REDACT_PATHS, type Job, type JobErrorKind, type JobStatus, type JobSubscriptionOptions, type JobUpdateCallbacks, KIND_APP_HANDLER, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT, KIND_JOB_RESULT_BASE, KIND_PING, KIND_PONG, LAMPORTS_PER_SOL, LIMITS, MarketplaceService, MediaService, type Network, type NetworkBaselineEstimate, type NetworkBaselineOptions, type NetworkStats, type NetworkStatsResult, NostrPool, type OnchainNetworkStats, PROTOCOL_PROGRAM_ID_DEVNET, type ParseOptions, type ParseResult, type ParsedPaymentRequest, type PaymentAssetRef, type PaymentInfo, type PaymentRequestData, PaymentRequestSchema, type PaymentStrategy, type PaymentValidationCode, type PaymentValidationError, type PingResult, PingService, type ProtocolCluster, type ProtocolConfig, type ProtocolConfigInput, type QuickVerifyReason, type QuickVerifyResult, RELAYS, type RankKey, SECRET_REDACT_PATHS, type Signer, type SolFeeEstimate, SolanaPaymentStrategy, type SubCloser, type SubmitJobOptions, type VerifyOptions, type VerifyResult, aggregateNetworkStats, assertExpiry, assertLamports, buildPaymentInstructions, calculateProtocolFee, classifyJobError, clearPriorityFeeCache, clearProtocolConfigCache, clearQuickVerifyCache, compareAgentsByRank, computeRankKey, createPaymentRequestWithOnchainConfig, estimateNetworkBaseline, estimatePriorityFeeMicroLamports, estimateSolFeeLamports, formatFeeBreakdown, formatNetworkBaseline, formatSol, getNetworkStats, getProtocolConfig, getProtocolProgramId, jobRequestKind, jobResultKind, makeCensor, nip44Decrypt, nip44Encrypt, parsePaymentRequest, pickPercentileFee, timeAgo, toDTag, truncateKey, validateAgentName, validateExpiry, verifyJobPaymentQuick };
|
package/dist/index.d.ts
CHANGED
|
@@ -613,6 +613,44 @@ declare class ElisymClient {
|
|
|
613
613
|
close(): void;
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
+
/**
|
|
617
|
+
* Customer-facing error feedback that arrives via `subscribeToJobUpdates`'s
|
|
618
|
+
* `onError` callback can come from many places:
|
|
619
|
+
*
|
|
620
|
+
* - The runtime's stable `Agent temporarily unavailable` string when the
|
|
621
|
+
* LLM health gate refuses a job (preflight) or an in-flight skill
|
|
622
|
+
* surfaced a billing/invalid signal.
|
|
623
|
+
* - The runtime's `Internal processing error` sanitization mask for any
|
|
624
|
+
* "<Provider> API error: ..." string that leaks out of an LLM call.
|
|
625
|
+
* - Raw script-skill failures the runtime forwards as-is when the
|
|
626
|
+
* message does not contain "API" - e.g. shell scripts that reach
|
|
627
|
+
* Anthropic's `count_tokens` endpoint and exit 1 with the body in
|
|
628
|
+
* stderr instead of using the canonical exit-42 contract.
|
|
629
|
+
* - Generic transport errors (timeouts, "Provider returned an error",
|
|
630
|
+
* rate-limit refusals, payment errors).
|
|
631
|
+
*
|
|
632
|
+
* Customers don't care which path produced the error - they care whether
|
|
633
|
+
* the agent is down (try later, payment recoverable) or something else
|
|
634
|
+
* went wrong (their input, their wallet, etc). This classifier collapses
|
|
635
|
+
* the first three categories into a single `agent-unavailable` kind so
|
|
636
|
+
* the UI can render one stable message regardless of how the underlying
|
|
637
|
+
* provider chose to surface the failure.
|
|
638
|
+
*
|
|
639
|
+
* Markers are kept as a permissive superset of every billing/auth phrase
|
|
640
|
+
* the CLI and skill scripts are known to emit. Adding a new marker is
|
|
641
|
+
* always safe; removing one risks classifying a real outage as `unknown`.
|
|
642
|
+
*/
|
|
643
|
+
type JobErrorKind = 'agent-unavailable' | 'unknown';
|
|
644
|
+
/**
|
|
645
|
+
* Classify a customer-facing error string surfaced via
|
|
646
|
+
* `JobUpdateCallbacks.onError` into a stable kind the UI can branch on.
|
|
647
|
+
*
|
|
648
|
+
* Match is case-insensitive against the message text. Returns
|
|
649
|
+
* `agent-unavailable` for any known billing/auth/invalid-key signal;
|
|
650
|
+
* `unknown` for everything else (timeouts, validation errors, transport).
|
|
651
|
+
*/
|
|
652
|
+
declare function classifyJobError(message: string): JobErrorKind;
|
|
653
|
+
|
|
616
654
|
declare class SolanaPaymentStrategy implements PaymentStrategy {
|
|
617
655
|
readonly chain = "solana";
|
|
618
656
|
calculateFee(amount: number, config: ProtocolConfigInput): number;
|
|
@@ -1162,4 +1200,4 @@ declare const LIMITS: {
|
|
|
1162
1200
|
readonly MAX_CAPABILITY_LENGTH: 64;
|
|
1163
1201
|
};
|
|
1164
1202
|
|
|
1165
|
-
export { type Agent, type AggregateNetworkStatsOptions, Asset, BoundedSet, type BuildTransactionOptions, type CapabilityCard, DEFAULTS, DEFAULT_KIND_OFFSET, DEFAULT_REDACT_PATHS, DiscoveryService, ELISYM_PROTOCOL_TAG, ElisymClient, type ElisymClientConfig, type ElisymClientFullConfig, ElisymIdentity, type EstimatePriorityFeeOptions, type EstimateSolFeeOptions, type GetProtocolConfigOptions, INPUT_REDACT_PATHS, type Job, type JobStatus, type JobSubscriptionOptions, type JobUpdateCallbacks, KIND_APP_HANDLER, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT, KIND_JOB_RESULT_BASE, KIND_PING, KIND_PONG, LAMPORTS_PER_SOL, LIMITS, MarketplaceService, MediaService, type Network, type NetworkBaselineEstimate, type NetworkBaselineOptions, type NetworkStats, type NetworkStatsResult, NostrPool, type OnchainNetworkStats, PROTOCOL_PROGRAM_ID_DEVNET, type ParseOptions, type ParseResult, type ParsedPaymentRequest, type PaymentAssetRef, type PaymentInfo, type PaymentRequestData, PaymentRequestSchema, type PaymentStrategy, type PaymentValidationCode, type PaymentValidationError, type PingResult, PingService, type ProtocolCluster, type ProtocolConfig, type ProtocolConfigInput, type QuickVerifyReason, type QuickVerifyResult, RELAYS, type RankKey, SECRET_REDACT_PATHS, type Signer, type SolFeeEstimate, SolanaPaymentStrategy, type SubCloser, type SubmitJobOptions, type VerifyOptions, type VerifyResult, aggregateNetworkStats, assertExpiry, assertLamports, buildPaymentInstructions, calculateProtocolFee, clearPriorityFeeCache, clearProtocolConfigCache, clearQuickVerifyCache, compareAgentsByRank, computeRankKey, createPaymentRequestWithOnchainConfig, estimateNetworkBaseline, estimatePriorityFeeMicroLamports, estimateSolFeeLamports, formatFeeBreakdown, formatNetworkBaseline, formatSol, getNetworkStats, getProtocolConfig, getProtocolProgramId, jobRequestKind, jobResultKind, makeCensor, nip44Decrypt, nip44Encrypt, parsePaymentRequest, pickPercentileFee, timeAgo, toDTag, truncateKey, validateAgentName, validateExpiry, verifyJobPaymentQuick };
|
|
1203
|
+
export { type Agent, type AggregateNetworkStatsOptions, Asset, BoundedSet, type BuildTransactionOptions, type CapabilityCard, DEFAULTS, DEFAULT_KIND_OFFSET, DEFAULT_REDACT_PATHS, DiscoveryService, ELISYM_PROTOCOL_TAG, ElisymClient, type ElisymClientConfig, type ElisymClientFullConfig, ElisymIdentity, type EstimatePriorityFeeOptions, type EstimateSolFeeOptions, type GetProtocolConfigOptions, INPUT_REDACT_PATHS, type Job, type JobErrorKind, type JobStatus, type JobSubscriptionOptions, type JobUpdateCallbacks, KIND_APP_HANDLER, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT, KIND_JOB_RESULT_BASE, KIND_PING, KIND_PONG, LAMPORTS_PER_SOL, LIMITS, MarketplaceService, MediaService, type Network, type NetworkBaselineEstimate, type NetworkBaselineOptions, type NetworkStats, type NetworkStatsResult, NostrPool, type OnchainNetworkStats, PROTOCOL_PROGRAM_ID_DEVNET, type ParseOptions, type ParseResult, type ParsedPaymentRequest, type PaymentAssetRef, type PaymentInfo, type PaymentRequestData, PaymentRequestSchema, type PaymentStrategy, type PaymentValidationCode, type PaymentValidationError, type PingResult, PingService, type ProtocolCluster, type ProtocolConfig, type ProtocolConfigInput, type QuickVerifyReason, type QuickVerifyResult, RELAYS, type RankKey, SECRET_REDACT_PATHS, type Signer, type SolFeeEstimate, SolanaPaymentStrategy, type SubCloser, type SubmitJobOptions, type VerifyOptions, type VerifyResult, aggregateNetworkStats, assertExpiry, assertLamports, buildPaymentInstructions, calculateProtocolFee, classifyJobError, clearPriorityFeeCache, clearProtocolConfigCache, clearQuickVerifyCache, compareAgentsByRank, computeRankKey, createPaymentRequestWithOnchainConfig, estimateNetworkBaseline, estimatePriorityFeeMicroLamports, estimateSolFeeLamports, formatFeeBreakdown, formatNetworkBaseline, formatSol, getNetworkStats, getProtocolConfig, getProtocolProgramId, jobRequestKind, jobResultKind, makeCensor, nip44Decrypt, nip44Encrypt, parsePaymentRequest, pickPercentileFee, timeAgo, toDTag, truncateKey, validateAgentName, validateExpiry, verifyJobPaymentQuick };
|
package/dist/index.js
CHANGED
|
@@ -3021,6 +3021,32 @@ var ElisymClient = class {
|
|
|
3021
3021
|
this.pool.close();
|
|
3022
3022
|
}
|
|
3023
3023
|
};
|
|
3024
|
+
|
|
3025
|
+
// src/services/jobErrors.ts
|
|
3026
|
+
var AGENT_UNAVAILABLE_MARKERS = [
|
|
3027
|
+
"agent temporarily unavailable",
|
|
3028
|
+
"internal processing error",
|
|
3029
|
+
"invalid x-api-key",
|
|
3030
|
+
"invalid api key",
|
|
3031
|
+
"invalid_api_key",
|
|
3032
|
+
"x-api-key",
|
|
3033
|
+
"credit balance",
|
|
3034
|
+
"billing",
|
|
3035
|
+
"insufficient",
|
|
3036
|
+
"insufficient_quota",
|
|
3037
|
+
"authentication_error",
|
|
3038
|
+
"unauthorized",
|
|
3039
|
+
"unauthenticated"
|
|
3040
|
+
];
|
|
3041
|
+
function classifyJobError(message) {
|
|
3042
|
+
const lower = message.toLowerCase();
|
|
3043
|
+
for (const marker of AGENT_UNAVAILABLE_MARKERS) {
|
|
3044
|
+
if (lower.includes(marker)) {
|
|
3045
|
+
return "agent-unavailable";
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
return "unknown";
|
|
3049
|
+
}
|
|
3024
3050
|
var DEFAULT_COMPUTE_UNIT_LIMIT2 = 2e5;
|
|
3025
3051
|
var DEFAULT_PRIORITY_FEE_PERCENTILE2 = 75;
|
|
3026
3052
|
var BASE_FEE_LAMPORTS_PER_SIGNATURE = 5000n;
|
|
@@ -3546,6 +3572,6 @@ function makeCensor() {
|
|
|
3546
3572
|
};
|
|
3547
3573
|
}
|
|
3548
3574
|
|
|
3549
|
-
export { BoundedSet, DEFAULTS, DEFAULT_KIND_OFFSET, DEFAULT_REDACT_PATHS, DiscoveryService, ELISYM_PROTOCOL_TAG, ElisymClient, ElisymIdentity, GlobalConfigSchema, INPUT_REDACT_PATHS, KIND_APP_HANDLER, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT, KIND_JOB_RESULT_BASE, KIND_PING, KIND_PONG, KNOWN_ASSETS, LAMPORTS_PER_SOL, LIMITS, MarketplaceService, MediaService, NATIVE_SOL, NostrPool, PROTOCOL_PROGRAM_ID_DEVNET, PaymentRequestSchema, PingService, RELAYS, SECRET_REDACT_PATHS, SessionSpendLimitEntrySchema, SolanaPaymentStrategy, USDC_SOLANA_DEVNET, aggregateNetworkStats, assertExpiry, assertLamports, assetByKey, assetKey, buildPaymentInstructions, calculateProtocolFee, clearPriorityFeeCache, clearProtocolConfigCache, clearQuickVerifyCache, compareAgentsByRank, computeRankKey, createPaymentRequestWithOnchainConfig, createSlidingWindowLimiter, estimateNetworkBaseline, estimatePriorityFeeMicroLamports, estimateSolFeeLamports, formatAssetAmount, formatFeeBreakdown, formatNetworkBaseline, formatSol, getNetworkStats, getProtocolConfig, getProtocolProgramId, jobRequestKind, jobResultKind, makeCensor, nip44Decrypt, nip44Encrypt, parseAssetAmount, parsePaymentRequest, pickPercentileFee, resolveAssetFromPaymentRequest, resolveKnownAsset, timeAgo, toDTag, truncateKey, validateAgentName, validateExpiry, verifyJobPaymentQuick };
|
|
3575
|
+
export { BoundedSet, DEFAULTS, DEFAULT_KIND_OFFSET, DEFAULT_REDACT_PATHS, DiscoveryService, ELISYM_PROTOCOL_TAG, ElisymClient, ElisymIdentity, GlobalConfigSchema, INPUT_REDACT_PATHS, KIND_APP_HANDLER, KIND_JOB_FEEDBACK, KIND_JOB_REQUEST, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT, KIND_JOB_RESULT_BASE, KIND_PING, KIND_PONG, KNOWN_ASSETS, LAMPORTS_PER_SOL, LIMITS, MarketplaceService, MediaService, NATIVE_SOL, NostrPool, PROTOCOL_PROGRAM_ID_DEVNET, PaymentRequestSchema, PingService, RELAYS, SECRET_REDACT_PATHS, SessionSpendLimitEntrySchema, SolanaPaymentStrategy, USDC_SOLANA_DEVNET, aggregateNetworkStats, assertExpiry, assertLamports, assetByKey, assetKey, buildPaymentInstructions, calculateProtocolFee, classifyJobError, clearPriorityFeeCache, clearProtocolConfigCache, clearQuickVerifyCache, compareAgentsByRank, computeRankKey, createPaymentRequestWithOnchainConfig, createSlidingWindowLimiter, estimateNetworkBaseline, estimatePriorityFeeMicroLamports, estimateSolFeeLamports, formatAssetAmount, formatFeeBreakdown, formatNetworkBaseline, formatSol, getNetworkStats, getProtocolConfig, getProtocolProgramId, jobRequestKind, jobResultKind, makeCensor, nip44Decrypt, nip44Encrypt, parseAssetAmount, parsePaymentRequest, pickPercentileFee, resolveAssetFromPaymentRequest, resolveKnownAsset, timeAgo, toDTag, truncateKey, validateAgentName, validateExpiry, verifyJobPaymentQuick };
|
|
3550
3576
|
//# sourceMappingURL=index.js.map
|
|
3551
3577
|
//# sourceMappingURL=index.js.map
|