@lucid-agents/taskmarket 1.14.0 → 1.14.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.js +176 -9
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1879,6 +1879,13 @@ var API_ERROR_REASONS = [
|
|
|
1879
1879
|
* seen, so the fee is not returned by this path.
|
|
1880
1880
|
*/
|
|
1881
1881
|
"payment_payer_mismatch",
|
|
1882
|
+
/** The request named a chain this backend does not serve. Nothing was read or charged. */
|
|
1883
|
+
"chain_not_served",
|
|
1884
|
+
/**
|
|
1885
|
+
* The request named two different chains, for example a `chainId` input and a payment for
|
|
1886
|
+
* another network. Refused before any payment was verified, so nothing was charged.
|
|
1887
|
+
*/
|
|
1888
|
+
"chain_conflict",
|
|
1882
1889
|
/**
|
|
1883
1890
|
* The error carries no more specific classification. Present so that every error has a
|
|
1884
1891
|
* reason field and a client's switch is total; not a licence to leave one here.
|
|
@@ -5656,6 +5663,9 @@ var SWARM_CHAINS = Object.freeze({
|
|
|
5656
5663
|
standingPilotConsentVersion: "swarm-testnet-standing-pilot-v1"
|
|
5657
5664
|
})
|
|
5658
5665
|
});
|
|
5666
|
+
function isSwarmChainId(value) {
|
|
5667
|
+
return value === 8453 || value === 84532;
|
|
5668
|
+
}
|
|
5659
5669
|
|
|
5660
5670
|
// ../../packages/shared/dist/schemas/swarm-wallet.schemas.js
|
|
5661
5671
|
import { z as z44 } from "zod";
|
|
@@ -7677,6 +7687,163 @@ var MemoryMaintenanceEnvironmentSchema = z65.object({
|
|
|
7677
7687
|
PROJECT_BACKUP_KEEP_SNAPSHOTS: z65.coerce.number().int().min(1).max(1e3).default(PROJECT_BACKUP_KEEP_SNAPSHOTS)
|
|
7678
7688
|
});
|
|
7679
7689
|
|
|
7690
|
+
// ../../packages/shared/dist/chains/registry.js
|
|
7691
|
+
import { base, baseSepolia, foundry, tempo, tempoModerato } from "viem/chains";
|
|
7692
|
+
var ERC8004_MAINNET = {
|
|
7693
|
+
identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
|
|
7694
|
+
reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63"
|
|
7695
|
+
};
|
|
7696
|
+
var ERC8004_TESTNET = {
|
|
7697
|
+
identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e",
|
|
7698
|
+
reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713"
|
|
7699
|
+
};
|
|
7700
|
+
var OUSD = "0x20c0000000000000000000006a37da5c996874be";
|
|
7701
|
+
var PATH_USD = "0x20c0000000000000000000000000000000000000";
|
|
7702
|
+
var TEMPO_PROTOCOL = {
|
|
7703
|
+
feeManager: "0xfeEC000000000000000000000000000000000000",
|
|
7704
|
+
tip403Registry: "0x403c000000000000000000000000000000000000",
|
|
7705
|
+
receivePolicyGuard: "0xB10C000000000000000000000000000000000000",
|
|
7706
|
+
stablecoinDex: "0xDEc0000000000000000000000000000000000000"
|
|
7707
|
+
};
|
|
7708
|
+
var baseFeatures = (chainId) => ({
|
|
7709
|
+
swarmWallets: isSwarmChainId(chainId),
|
|
7710
|
+
catalog: true,
|
|
7711
|
+
cctpFunding: true,
|
|
7712
|
+
relayFunding: chainId === 8453,
|
|
7713
|
+
dreamsRewards: true,
|
|
7714
|
+
receivePolicies: false
|
|
7715
|
+
});
|
|
7716
|
+
var TEMPO_FEATURES = {
|
|
7717
|
+
swarmWallets: false,
|
|
7718
|
+
catalog: false,
|
|
7719
|
+
cctpFunding: false,
|
|
7720
|
+
relayFunding: false,
|
|
7721
|
+
dreamsRewards: false,
|
|
7722
|
+
receivePolicies: true
|
|
7723
|
+
};
|
|
7724
|
+
var tempoPayment = {
|
|
7725
|
+
token: OUSD,
|
|
7726
|
+
symbol: "OUSD",
|
|
7727
|
+
decimals: 6,
|
|
7728
|
+
domain: { name: "OpenUSD", version: "1" },
|
|
7729
|
+
method: "mpp-tempo"
|
|
7730
|
+
};
|
|
7731
|
+
var tempoFees = { kind: "tip20", token: OUSD, fallbackToken: PATH_USD };
|
|
7732
|
+
function deepFreeze(value) {
|
|
7733
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
7734
|
+
if (key === "viemChain")
|
|
7735
|
+
continue;
|
|
7736
|
+
if (nested && typeof nested === "object" && !Object.isFrozen(nested))
|
|
7737
|
+
deepFreeze(nested);
|
|
7738
|
+
}
|
|
7739
|
+
return Object.freeze(value);
|
|
7740
|
+
}
|
|
7741
|
+
function freeze(chain) {
|
|
7742
|
+
return deepFreeze(chain);
|
|
7743
|
+
}
|
|
7744
|
+
var TASKMARKET_CHAINS = Object.freeze({
|
|
7745
|
+
8453: freeze({
|
|
7746
|
+
chainId: 8453,
|
|
7747
|
+
caip2: "eip155:8453",
|
|
7748
|
+
name: "Base",
|
|
7749
|
+
testnet: false,
|
|
7750
|
+
viemChain: base,
|
|
7751
|
+
publicRpcUrl: SWARM_CHAINS[8453].publicRpcUrl,
|
|
7752
|
+
explorerUrl: SWARM_CHAINS[8453].explorerUrl,
|
|
7753
|
+
payment: {
|
|
7754
|
+
token: SWARM_CHAINS[8453].usdc,
|
|
7755
|
+
symbol: "USDC",
|
|
7756
|
+
decimals: 6,
|
|
7757
|
+
domain: { name: SWARM_CHAINS[8453].usdcDomainName, version: "2" },
|
|
7758
|
+
method: "eip3009"
|
|
7759
|
+
},
|
|
7760
|
+
fees: { kind: "native" },
|
|
7761
|
+
indexer: { head: "latest", logRangeBlocks: 1e4 },
|
|
7762
|
+
erc8004: { ...ERC8004_MAINNET },
|
|
7763
|
+
features: baseFeatures(8453)
|
|
7764
|
+
}),
|
|
7765
|
+
84532: freeze({
|
|
7766
|
+
chainId: 84532,
|
|
7767
|
+
caip2: "eip155:84532",
|
|
7768
|
+
name: "Base Sepolia",
|
|
7769
|
+
testnet: true,
|
|
7770
|
+
viemChain: baseSepolia,
|
|
7771
|
+
publicRpcUrl: SWARM_CHAINS[84532].publicRpcUrl,
|
|
7772
|
+
explorerUrl: SWARM_CHAINS[84532].explorerUrl,
|
|
7773
|
+
payment: {
|
|
7774
|
+
token: SWARM_CHAINS[84532].usdc,
|
|
7775
|
+
symbol: "USDC",
|
|
7776
|
+
decimals: 6,
|
|
7777
|
+
domain: { name: SWARM_CHAINS[84532].usdcDomainName, version: "2" },
|
|
7778
|
+
method: "eip3009"
|
|
7779
|
+
},
|
|
7780
|
+
fees: { kind: "native" },
|
|
7781
|
+
indexer: { head: "latest", logRangeBlocks: 1e4 },
|
|
7782
|
+
erc8004: { ...ERC8004_TESTNET },
|
|
7783
|
+
features: baseFeatures(84532)
|
|
7784
|
+
}),
|
|
7785
|
+
4217: freeze({
|
|
7786
|
+
chainId: 4217,
|
|
7787
|
+
caip2: "eip155:4217",
|
|
7788
|
+
name: "Tempo",
|
|
7789
|
+
testnet: false,
|
|
7790
|
+
viemChain: tempo,
|
|
7791
|
+
publicRpcUrl: tempo.rpcUrls.default.http[0],
|
|
7792
|
+
explorerUrl: "https://explore.tempo.xyz",
|
|
7793
|
+
payment: { ...tempoPayment, domain: { ...tempoPayment.domain } },
|
|
7794
|
+
fees: { ...tempoFees },
|
|
7795
|
+
// Tempo finality is deterministic and fast; until the provider's eth_getLogs limit is
|
|
7796
|
+
// measured (#907), keep the same range as Base.
|
|
7797
|
+
indexer: { head: "finalized", logRangeBlocks: 1e4 },
|
|
7798
|
+
erc8004: { ...ERC8004_MAINNET },
|
|
7799
|
+
features: { ...TEMPO_FEATURES },
|
|
7800
|
+
tempo: { ...TEMPO_PROTOCOL, paymentTokenPolicyId: 2 }
|
|
7801
|
+
}),
|
|
7802
|
+
42431: freeze({
|
|
7803
|
+
chainId: 42431,
|
|
7804
|
+
caip2: "eip155:42431",
|
|
7805
|
+
name: "Tempo Moderato",
|
|
7806
|
+
testnet: true,
|
|
7807
|
+
viemChain: tempoModerato,
|
|
7808
|
+
publicRpcUrl: tempoModerato.rpcUrls.default.http[0],
|
|
7809
|
+
explorerUrl: "https://explore.testnet.tempo.xyz",
|
|
7810
|
+
payment: { ...tempoPayment, domain: { ...tempoPayment.domain } },
|
|
7811
|
+
fees: { ...tempoFees },
|
|
7812
|
+
indexer: { head: "finalized", logRangeBlocks: 1e4 },
|
|
7813
|
+
erc8004: { ...ERC8004_TESTNET },
|
|
7814
|
+
features: { ...TEMPO_FEATURES },
|
|
7815
|
+
tempo: { ...TEMPO_PROTOCOL, paymentTokenPolicyId: 1 }
|
|
7816
|
+
}),
|
|
7817
|
+
31337: freeze({
|
|
7818
|
+
chainId: 31337,
|
|
7819
|
+
caip2: "eip155:31337",
|
|
7820
|
+
name: "Local",
|
|
7821
|
+
testnet: true,
|
|
7822
|
+
viemChain: foundry,
|
|
7823
|
+
publicRpcUrl: "http://127.0.0.1:8545",
|
|
7824
|
+
explorerUrl: "",
|
|
7825
|
+
// The local mock token is deployed per run; its address comes from the environment.
|
|
7826
|
+
payment: {
|
|
7827
|
+
token: void 0,
|
|
7828
|
+
symbol: "USDC",
|
|
7829
|
+
decimals: 6,
|
|
7830
|
+
domain: { name: "USD Coin", version: "2" },
|
|
7831
|
+
method: "eip3009"
|
|
7832
|
+
},
|
|
7833
|
+
fees: { kind: "native" },
|
|
7834
|
+
indexer: { head: "latest", logRangeBlocks: 1e4 },
|
|
7835
|
+
erc8004: void 0,
|
|
7836
|
+
features: {
|
|
7837
|
+
swarmWallets: false,
|
|
7838
|
+
catalog: false,
|
|
7839
|
+
cctpFunding: false,
|
|
7840
|
+
relayFunding: false,
|
|
7841
|
+
dreamsRewards: true,
|
|
7842
|
+
receivePolicies: false
|
|
7843
|
+
}
|
|
7844
|
+
})
|
|
7845
|
+
});
|
|
7846
|
+
|
|
7680
7847
|
// src/commands/init.ts
|
|
7681
7848
|
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
7682
7849
|
|
|
@@ -8100,8 +8267,8 @@ import { createInterface } from "readline/promises";
|
|
|
8100
8267
|
import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
8101
8268
|
import { toHex } from "viem";
|
|
8102
8269
|
async function fetchDeviceKey(deviceId, apiToken, keyServerUrl) {
|
|
8103
|
-
const
|
|
8104
|
-
const res = await fetch(`${
|
|
8270
|
+
const base2 = keyServerUrl ?? API_URL;
|
|
8271
|
+
const res = await fetch(`${base2}/api/devices/${deviceId}/key`, {
|
|
8105
8272
|
method: "POST",
|
|
8106
8273
|
headers: { "Content-Type": "application/json" },
|
|
8107
8274
|
body: JSON.stringify({ deviceId, apiToken })
|
|
@@ -8308,9 +8475,9 @@ legalCommand.addCommand(acceptCommand);
|
|
|
8308
8475
|
function sanitizeEmailUsername(agentId, suffix) {
|
|
8309
8476
|
const maxBase = 30 - 1 - suffix.length;
|
|
8310
8477
|
if (maxBase < 2) return null;
|
|
8311
|
-
const
|
|
8312
|
-
if (
|
|
8313
|
-
const candidate = `${
|
|
8478
|
+
const base2 = agentId.toLowerCase().replace(/[^a-z0-9]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "").slice(0, maxBase).replace(/-+$/, "");
|
|
8479
|
+
if (base2.length < 2) return null;
|
|
8480
|
+
const candidate = `${base2}-${suffix}`;
|
|
8314
8481
|
return /^[a-z0-9][a-z0-9-]{1,28}[a-z0-9]$/.test(candidate) ? candidate : null;
|
|
8315
8482
|
}
|
|
8316
8483
|
async function tryRegisterEmail(deviceId, apiToken, username, explicit) {
|
|
@@ -10749,8 +10916,8 @@ function sleep(ms) {
|
|
|
10749
10916
|
async function runStreamWithReconnect(options) {
|
|
10750
10917
|
const maxReconnectAttempts = options.maxReconnectAttempts ?? Number.POSITIVE_INFINITY;
|
|
10751
10918
|
const backoffMs = options.backoffMs ?? ((attempt) => {
|
|
10752
|
-
const
|
|
10753
|
-
return
|
|
10919
|
+
const base2 = Math.min(3e4, 250 * 2 ** attempt);
|
|
10920
|
+
return base2 * (0.5 + Math.random() * 0.5);
|
|
10754
10921
|
});
|
|
10755
10922
|
let reconnectAttempt = 0;
|
|
10756
10923
|
while (!options.shouldStop()) {
|
|
@@ -10934,9 +11101,9 @@ function parseRetryAttempts() {
|
|
|
10934
11101
|
return Math.floor(parsed);
|
|
10935
11102
|
}
|
|
10936
11103
|
function sendBackoffMs(attempt) {
|
|
10937
|
-
const
|
|
11104
|
+
const base2 = DEFAULT_SEND_RETRY_BASE_DELAY_MS * 2 ** Math.max(attempt - 1, 0);
|
|
10938
11105
|
const jitter = Math.floor(Math.random() * DEFAULT_SEND_RETRY_BASE_DELAY_MS);
|
|
10939
|
-
return Math.min(DEFAULT_SEND_RETRY_MAX_DELAY_MS,
|
|
11106
|
+
return Math.min(DEFAULT_SEND_RETRY_MAX_DELAY_MS, base2 + jitter);
|
|
10940
11107
|
}
|
|
10941
11108
|
async function withRetry(operation, maxAttempts) {
|
|
10942
11109
|
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucid-agents/taskmarket",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"taskmarket": "./dist/index.js"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@x402/fetch": "2.21.0",
|
|
13
13
|
"@xmtp/node-sdk": "^2.0.0",
|
|
14
14
|
"commander": "^12.0.0",
|
|
15
|
-
"viem": "^2.
|
|
15
|
+
"viem": "^2.57.4",
|
|
16
16
|
"yaml": "2.8.1",
|
|
17
17
|
"zod": "^3.24.2"
|
|
18
18
|
},
|