@finchtech/cli 0.3.9 → 0.4.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/README.md +20 -4
- package/THIRD_PARTY_LICENSES.txt +23 -0
- package/dist/finch.js +2123 -751
- package/package.json +8 -6
package/dist/finch.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as createBundleRequire } from 'node:module'; const require = createBundleRequire(import.meta.url);
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
|
|
10
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
+
}) : x2)(function(x2) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x2 + '" is not supported');
|
|
14
|
+
});
|
|
8
15
|
var __esm = (fn, res, err2) => function __init() {
|
|
9
16
|
if (err2) throw err2[0];
|
|
10
17
|
try {
|
|
@@ -13,7 +20,7 @@ var __esm = (fn, res, err2) => function __init() {
|
|
|
13
20
|
throw err2 = [e], e;
|
|
14
21
|
}
|
|
15
22
|
};
|
|
16
|
-
var __commonJS = (cb, mod2) => function
|
|
23
|
+
var __commonJS = (cb, mod2) => function __require2() {
|
|
17
24
|
try {
|
|
18
25
|
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
|
|
19
26
|
} catch (e) {
|
|
@@ -3315,8 +3322,8 @@ var require_utils = __commonJS({
|
|
|
3315
3322
|
var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
|
|
3316
3323
|
var HOST_DELIM_RE = /[@/?#:]/g;
|
|
3317
3324
|
var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
3318
|
-
function reescapeHostDelimiters(host,
|
|
3319
|
-
const re =
|
|
3325
|
+
function reescapeHostDelimiters(host, isIP2) {
|
|
3326
|
+
const re = isIP2 ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
|
|
3320
3327
|
re.lastIndex = 0;
|
|
3321
3328
|
return host.replace(re, (ch) => HOST_DELIMS[ch]);
|
|
3322
3329
|
}
|
|
@@ -3805,7 +3812,7 @@ var require_fast_uri = __commonJS({
|
|
|
3805
3812
|
fragment: void 0
|
|
3806
3813
|
};
|
|
3807
3814
|
let malformedAuthorityOrPort = false;
|
|
3808
|
-
let
|
|
3815
|
+
let isIP2 = false;
|
|
3809
3816
|
if (options.reference === "suffix") {
|
|
3810
3817
|
if (options.scheme) {
|
|
3811
3818
|
uri = options.scheme + ":" + uri;
|
|
@@ -3854,9 +3861,9 @@ var require_fast_uri = __commonJS({
|
|
|
3854
3861
|
if (ipv4result === false) {
|
|
3855
3862
|
const ipv6result = normalizeIPv6(parsed2.host);
|
|
3856
3863
|
parsed2.host = ipv6result.host.toLowerCase();
|
|
3857
|
-
|
|
3864
|
+
isIP2 = ipv6result.isIPV6;
|
|
3858
3865
|
} else {
|
|
3859
|
-
|
|
3866
|
+
isIP2 = true;
|
|
3860
3867
|
}
|
|
3861
3868
|
}
|
|
3862
3869
|
if (parsed2.scheme === void 0 && parsed2.userinfo === void 0 && parsed2.host === void 0 && parsed2.port === void 0 && parsed2.query === void 0 && !parsed2.path) {
|
|
@@ -3873,7 +3880,7 @@ var require_fast_uri = __commonJS({
|
|
|
3873
3880
|
}
|
|
3874
3881
|
const schemeHandler = getSchemeHandler(options.scheme || parsed2.scheme);
|
|
3875
3882
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
3876
|
-
if (parsed2.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) &&
|
|
3883
|
+
if (parsed2.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP2 === false && nonSimpleDomain(parsed2.host)) {
|
|
3877
3884
|
try {
|
|
3878
3885
|
parsed2.host = new URL("http://" + parsed2.host).hostname;
|
|
3879
3886
|
} catch (e) {
|
|
@@ -3887,7 +3894,7 @@ var require_fast_uri = __commonJS({
|
|
|
3887
3894
|
parsed2.scheme = unescape(parsed2.scheme);
|
|
3888
3895
|
}
|
|
3889
3896
|
if (parsed2.host !== void 0) {
|
|
3890
|
-
parsed2.host = reescapeHostDelimiters(unescape(parsed2.host),
|
|
3897
|
+
parsed2.host = reescapeHostDelimiters(unescape(parsed2.host), isIP2);
|
|
3891
3898
|
}
|
|
3892
3899
|
}
|
|
3893
3900
|
if (parsed2.path) {
|
|
@@ -6606,6 +6613,66 @@ var require_ajv = __commonJS({
|
|
|
6606
6613
|
}
|
|
6607
6614
|
});
|
|
6608
6615
|
|
|
6616
|
+
// package.json
|
|
6617
|
+
var package_default;
|
|
6618
|
+
var init_package = __esm({
|
|
6619
|
+
"package.json"() {
|
|
6620
|
+
package_default = {
|
|
6621
|
+
name: "@finchtech/cli",
|
|
6622
|
+
version: "0.4.1",
|
|
6623
|
+
description: "Finch Agent CLI for wallet-owned marketplace and MCP workflows.",
|
|
6624
|
+
type: "module",
|
|
6625
|
+
bin: {
|
|
6626
|
+
finch: "dist/finch.js",
|
|
6627
|
+
finchtech: "dist/finch.js"
|
|
6628
|
+
},
|
|
6629
|
+
files: [
|
|
6630
|
+
"dist/finch.js",
|
|
6631
|
+
"README.md",
|
|
6632
|
+
"THIRD_PARTY_LICENSES.txt"
|
|
6633
|
+
],
|
|
6634
|
+
engines: {
|
|
6635
|
+
node: ">=20"
|
|
6636
|
+
},
|
|
6637
|
+
publishConfig: {
|
|
6638
|
+
access: "public"
|
|
6639
|
+
},
|
|
6640
|
+
repository: {
|
|
6641
|
+
type: "git",
|
|
6642
|
+
url: "git+https://github.com/FinchipAI/Finch-Site.git",
|
|
6643
|
+
directory: "apps/cli"
|
|
6644
|
+
},
|
|
6645
|
+
homepage: "https://www.finchtech.ai",
|
|
6646
|
+
scripts: {
|
|
6647
|
+
build: `esbuild src/bootstrap.ts --bundle --platform=node --format=esm --target=node20 --outfile=dist/finch.js --banner:js="import { createRequire as createBundleRequire } from 'node:module'; const require = createBundleRequire(import.meta.url);"`,
|
|
6648
|
+
check: "pnpm lint && pnpm typecheck && pnpm test && pnpm build",
|
|
6649
|
+
lint: "eslint src vitest.config.ts eslint.config.mjs",
|
|
6650
|
+
prepack: "pnpm build",
|
|
6651
|
+
test: "vitest run",
|
|
6652
|
+
typecheck: "tsc --noEmit"
|
|
6653
|
+
},
|
|
6654
|
+
devDependencies: {
|
|
6655
|
+
"@eslint/js": "9.39.2",
|
|
6656
|
+
"@finch/agent-market-contracts": "workspace:*",
|
|
6657
|
+
"@finch/deployment-manifest": "workspace:*",
|
|
6658
|
+
"@finch/skill-content": "workspace:*",
|
|
6659
|
+
"@finch/skill-market-contracts": "workspace:*",
|
|
6660
|
+
"@finch/task-market-contracts": "workspace:*",
|
|
6661
|
+
"@types/cross-spawn": "6.0.6",
|
|
6662
|
+
"@types/node": "20.19.30",
|
|
6663
|
+
ajv: "8.20.0",
|
|
6664
|
+
"cross-spawn": "7.0.6",
|
|
6665
|
+
esbuild: "0.28.2",
|
|
6666
|
+
eslint: "9.39.2",
|
|
6667
|
+
typescript: "5.9.3",
|
|
6668
|
+
"typescript-eslint": "8.67.0",
|
|
6669
|
+
viem: "2.55.15",
|
|
6670
|
+
vitest: "4.1.10"
|
|
6671
|
+
}
|
|
6672
|
+
};
|
|
6673
|
+
}
|
|
6674
|
+
});
|
|
6675
|
+
|
|
6609
6676
|
// src/state.ts
|
|
6610
6677
|
import { execFile } from "node:child_process";
|
|
6611
6678
|
import { constants } from "node:fs";
|
|
@@ -7086,7 +7153,7 @@ function localFailureMessage(error51) {
|
|
|
7086
7153
|
}
|
|
7087
7154
|
return "Command input does not match the expected schema. Check finch help for this command.";
|
|
7088
7155
|
}
|
|
7089
|
-
var CliAuthorityError, CliProductionUnavailableError, BrowserOpenError, PUBLIC_RECOVERY_COMMAND, CliRecoveryBlockedError, CliSkillSourceError, CliSkillPresentationStaleError, CliSkillRecoveryUncertainError, CliSkillPublicationError;
|
|
7156
|
+
var CliAuthorityError, CliProductionUnavailableError, BrowserOpenError, MCP_AUTHORIZATION_FLOW_GUIDANCE, McpAuthorizationFlowError, PUBLIC_RECOVERY_COMMAND, CliRecoveryBlockedError, CliSkillSourceError, CliSkillPresentationStaleError, CliSkillRecoveryUncertainError, CliSkillPublicationError;
|
|
7090
7157
|
var init_cli_error = __esm({
|
|
7091
7158
|
"src/cli-error.ts"() {
|
|
7092
7159
|
"use strict";
|
|
@@ -7112,6 +7179,30 @@ var init_cli_error = __esm({
|
|
|
7112
7179
|
this.name = "BrowserOpenError";
|
|
7113
7180
|
}
|
|
7114
7181
|
};
|
|
7182
|
+
MCP_AUTHORIZATION_FLOW_GUIDANCE = Object.freeze({
|
|
7183
|
+
login_command_not_started: "The login command after -- could not be started. Check that the MCP client is installed and the command is correct, or use finch mcp authorize --stdin with the URL its native login prints.",
|
|
7184
|
+
request_url_not_found: "The login command did not print a Finch authorization URL in time and was stopped; its callback listener is gone. Start the MCP client native login again, keep it running, and pass the new URL to finch mcp authorize --stdin, or run the command shown on the Finch authorization page.",
|
|
7185
|
+
second_authorization_request: "The login command started a second authorization request, which was not approved and the command was stopped. Start the MCP client native login again.",
|
|
7186
|
+
login_command_failed: "The authorization was approved, but the login command exited unsuccessfully. Read its output above, then start the MCP client native login again.",
|
|
7187
|
+
login_command_timeout: "The authorization was approved and the callback delivered, but the login command did not exit in time and was stopped. Check the MCP client connection; if it is not authorized, start its native login again.",
|
|
7188
|
+
callback_rejected: "The authorization was approved, but the MCP client callback rejected it. Start the MCP client native login again.",
|
|
7189
|
+
callback_delivery_unknown: "The authorization was approved, but whether the MCP client received the callback is unknown. Check the MCP client connection before starting its native login again.",
|
|
7190
|
+
callback_unreachable: "The authorization was approved, but no MCP client callback listener was reachable on this machine. Keep the MCP client native login running on the same machine as Finch CLI and try again.",
|
|
7191
|
+
stdin_invalid: "Pass exactly one Finch authorization URL on standard input, for example printf '%s' '<URL>' | finch mcp authorize --stdin."
|
|
7192
|
+
});
|
|
7193
|
+
McpAuthorizationFlowError = class extends Error {
|
|
7194
|
+
constructor(reason, detail = {}, options) {
|
|
7195
|
+
super("MCP_AUTHORIZATION_FLOW_FAILED", options);
|
|
7196
|
+
this.reason = reason;
|
|
7197
|
+
this.detail = detail;
|
|
7198
|
+
this.name = "McpAuthorizationFlowError";
|
|
7199
|
+
this.guidance = MCP_AUTHORIZATION_FLOW_GUIDANCE[reason];
|
|
7200
|
+
}
|
|
7201
|
+
reason;
|
|
7202
|
+
detail;
|
|
7203
|
+
code = "MCP_AUTHORIZATION_FLOW_FAILED";
|
|
7204
|
+
guidance;
|
|
7205
|
+
};
|
|
7115
7206
|
PUBLIC_RECOVERY_COMMAND = /^(?:finch purchase (?:submit|recover-approval) [0-9a-f-]+(?: --transaction-hash 0x[0-9a-f]{64})?|finch task recover [0-9a-f-]+ (?:publish|award|reclaim)|finch skill recover (?:publication|intent) [0-9a-f]{64})$/u;
|
|
7116
7207
|
CliRecoveryBlockedError = class extends Error {
|
|
7117
7208
|
code = "CLI_RECOVERY_BLOCKED";
|
|
@@ -11352,7 +11443,7 @@ async function buildSkillRoot(input) {
|
|
|
11352
11443
|
if (contentKey !== null) encrypted[file2.path] = { ciphertext: cid.toString(), plaintextHash: await sha256Hex(file2.content) };
|
|
11353
11444
|
}
|
|
11354
11445
|
if (!md) throw new RangeError("SkillRoot primary document is missing.");
|
|
11355
|
-
const
|
|
11446
|
+
const manifest5 = jsonBytes({
|
|
11356
11447
|
schemaVersion: "1.0",
|
|
11357
11448
|
name: input.name,
|
|
11358
11449
|
skillVersion: String(input.version),
|
|
@@ -11361,7 +11452,7 @@ async function buildSkillRoot(input) {
|
|
|
11361
11452
|
});
|
|
11362
11453
|
const root = {
|
|
11363
11454
|
md,
|
|
11364
|
-
manifest: await put(
|
|
11455
|
+
manifest: await put(manifest5),
|
|
11365
11456
|
entry: { ...md, profile: ENTRY_PROFILE },
|
|
11366
11457
|
...Object.keys(files).length ? { files } : {},
|
|
11367
11458
|
...input.previousHash === void 0 ? {} : { prev: hashCID(input.previousHash, 113) }
|
|
@@ -11375,7 +11466,7 @@ async function buildSkillRoot(input) {
|
|
|
11375
11466
|
const proof = {
|
|
11376
11467
|
scheme: SKILL_ROOT_SCHEME,
|
|
11377
11468
|
root: toBase64(rootBytes),
|
|
11378
|
-
manifest: toBase64(
|
|
11469
|
+
manifest: toBase64(manifest5),
|
|
11379
11470
|
...confidentiality === void 0 ? {} : { confidentiality: toBase64(confidentiality) }
|
|
11380
11471
|
};
|
|
11381
11472
|
const packageHash = await sha256Hex(rootBytes);
|
|
@@ -11412,8 +11503,8 @@ async function verifySkillRootProof(proof, packageHash, version6, previousHash)
|
|
|
11412
11503
|
const paths = Object.keys(refs);
|
|
11413
11504
|
if (paths.length > MAX_SKILL_IMPORT_FILES || paths.some((name) => paths.some((other) => other.startsWith(`${name}/`)))) throw new RangeError("SkillRoot file paths exceed limits or conflict.");
|
|
11414
11505
|
if (!refs[executable.path]?.equals(executable.cid)) throw new RangeError("SkillRoot entrypoint is outside the committed files.");
|
|
11415
|
-
const
|
|
11416
|
-
if (
|
|
11506
|
+
const manifest5 = await authenticatedJSON(proof.manifest, CID.asCID(root.manifest));
|
|
11507
|
+
if (manifest5.schemaVersion !== "1.0" || typeof manifest5.name !== "string" || typeof manifest5.summary !== "string" || manifest5.skillVersion !== String(version6) || manifest5.entrypoint !== executable.path) throw new RangeError("Invalid SkillRoot manifest.");
|
|
11417
11508
|
const hashes = /* @__PURE__ */ Object.create(null);
|
|
11418
11509
|
if (root.confidentiality === void 0) {
|
|
11419
11510
|
if (proof.confidentiality !== void 0) throw new RangeError("Public SkillRoot declares encrypted transport.");
|
|
@@ -11436,8 +11527,8 @@ async function verifySkillRootProof(proof, packageHash, version6, previousHash)
|
|
|
11436
11527
|
mdHash: hashes[md.path],
|
|
11437
11528
|
primaryPath: md.path,
|
|
11438
11529
|
plaintext: root.confidentiality === void 0,
|
|
11439
|
-
name:
|
|
11440
|
-
summary:
|
|
11530
|
+
name: manifest5.name,
|
|
11531
|
+
summary: manifest5.summary,
|
|
11441
11532
|
fileHashes: hashes
|
|
11442
11533
|
};
|
|
11443
11534
|
}
|
|
@@ -11690,8 +11781,8 @@ function buildManifest(entries, presentation, documents) {
|
|
|
11690
11781
|
...normalizedDocuments === void 0 ? {} : { documents: normalizedDocuments }
|
|
11691
11782
|
};
|
|
11692
11783
|
}
|
|
11693
|
-
function serializeManifest(
|
|
11694
|
-
return new TextEncoder().encode(JSON.stringify(
|
|
11784
|
+
function serializeManifest(manifest5) {
|
|
11785
|
+
return new TextEncoder().encode(JSON.stringify(manifest5));
|
|
11695
11786
|
}
|
|
11696
11787
|
function parseManifest(bytes) {
|
|
11697
11788
|
let value;
|
|
@@ -11713,14 +11804,14 @@ function parseManifest(bytes) {
|
|
|
11713
11804
|
return null;
|
|
11714
11805
|
}
|
|
11715
11806
|
}
|
|
11716
|
-
function packageForVersion(
|
|
11717
|
-
return
|
|
11807
|
+
function packageForVersion(manifest5, version6) {
|
|
11808
|
+
return manifest5.versions.find((entry2) => entry2.version === version6) ?? null;
|
|
11718
11809
|
}
|
|
11719
|
-
function withVersion(
|
|
11720
|
-
return buildManifest([...
|
|
11810
|
+
function withVersion(manifest5, entry2) {
|
|
11811
|
+
return buildManifest([...manifest5?.versions ?? [], entry2], manifest5?.presentation, manifest5?.documents);
|
|
11721
11812
|
}
|
|
11722
|
-
function withPresentation(
|
|
11723
|
-
return buildManifest(
|
|
11813
|
+
function withPresentation(manifest5, presentation) {
|
|
11814
|
+
return buildManifest(manifest5.versions, presentation, manifest5.documents);
|
|
11724
11815
|
}
|
|
11725
11816
|
var MAX_SKILL_MANIFEST_BYTES, SKILL_MANIFEST_SCHEME, SKILL_DETAIL_KINDS, DETAIL_MEDIA_TYPES, DETAIL_HASH, DETAIL_ASSET_PATH, DETAIL_IPFS_URI, DETAIL_STORAGE_URI, DETAIL_BUCKET_BY_KIND, DETAIL_MEDIA_HOST;
|
|
11726
11817
|
var init_manifest = __esm({
|
|
@@ -11852,7 +11943,7 @@ function strictObjectSchema(properties, required4 = Object.keys(properties)) {
|
|
|
11852
11943
|
additionalProperties: false
|
|
11853
11944
|
});
|
|
11854
11945
|
}
|
|
11855
|
-
var AGENT_MARKET_API_VERSION, MAX_HTTP_ARTIFACT_BYTES, MAX_MCP_ARTIFACT_BYTES, MAX_CLI_CREDENTIAL_BYTES, integrationFamilyValues, canonicalUuidPattern, canonicalUuidSchema, positiveRevisionSchema, nonNegativeGenerationSchema, positiveIntegerStringSchema, hex32Schema, evmAddressSchema, evmAddressInputSchema, canonicalSecondTimestampSchema, IDEMPOTENCY_KEY_PATTERN, UUID_PATTERN, emptyStrictObjectSchema, idempotencyHeaderSchema;
|
|
11946
|
+
var AGENT_MARKET_API_VERSION, MAX_HTTP_ARTIFACT_BYTES, MAX_MCP_ARTIFACT_BYTES, MAX_CLI_CREDENTIAL_BYTES, integrationFamilyValues, canonicalUuidPattern, canonicalUuidSchema, positiveRevisionSchema, nonNegativeGenerationSchema, positiveIntegerStringSchema, hex32Schema, evmAddressSchema, evmAddressInputSchema, canonicalSecondTimestampSchema, IDEMPOTENCY_KEY_PATTERN, UUID_PATTERN, emptyStrictObjectSchema, jsonValueTypesSchema, idempotencyHeaderSchema;
|
|
11856
11947
|
var init_common2 = __esm({
|
|
11857
11948
|
"../../packages/agent-market-contracts/src/v1/common.ts"() {
|
|
11858
11949
|
"use strict";
|
|
@@ -11903,6 +11994,16 @@ var init_common2 = __esm({
|
|
|
11903
11994
|
IDEMPOTENCY_KEY_PATTERN = /^[\x21-\x7e]{1,160}$/u;
|
|
11904
11995
|
UUID_PATTERN = new RegExp(canonicalUuidPattern, "u");
|
|
11905
11996
|
emptyStrictObjectSchema = strictObjectSchema({}, []);
|
|
11997
|
+
jsonValueTypesSchema = Object.freeze({
|
|
11998
|
+
anyOf: Object.freeze([
|
|
11999
|
+
Object.freeze({ type: "object", additionalProperties: true }),
|
|
12000
|
+
Object.freeze({ type: "array", items: true }),
|
|
12001
|
+
Object.freeze({ type: "string" }),
|
|
12002
|
+
Object.freeze({ type: "number" }),
|
|
12003
|
+
Object.freeze({ type: "boolean" }),
|
|
12004
|
+
Object.freeze({ type: "null" })
|
|
12005
|
+
])
|
|
12006
|
+
});
|
|
11906
12007
|
idempotencyHeaderSchema = Object.freeze({
|
|
11907
12008
|
type: "string",
|
|
11908
12009
|
minLength: 1,
|
|
@@ -12571,7 +12672,7 @@ function decodeAgentCliMcpAuthorizationRequest(requestToken) {
|
|
|
12571
12672
|
}
|
|
12572
12673
|
return requestUrl;
|
|
12573
12674
|
}
|
|
12574
|
-
var booleanSchema, timestampSchema, agentCliMcpAuthorizationRequestTokenPrefix, agentCliMcpAuthorizationRequestMaximumUrlBytes, agentCliMcpAuthorizationRequestMaximumPayloadCharacters, base64UrlAlphabet, AGENT_CLI_MCP_AUTHORIZATION_REQUEST_TOKEN, LOCAL_SIGNING_ABANDON_CONTRACT, localSigningAbandonReceiptSchema, authorizationBase, browserAuthorizationBase, signingStatusSchema, agentCliSigningIntentSchema, browserPublicationSigningIntentSchema, browserPurchaseSigningIntentSchema, agentCliSigningApproveRequestSchema, agentCliSigningDenyRequestSchema, agentCliSigningDecisionResponseSchema, agentCliCredentialClaimSchema, agentCliCredentialSetupSchema, agentCliCredentialFulfillmentReceiptSchema, CLI_AGENTON_CREDENTIAL_MATERIAL_DOWNLOAD_CONTRACT, AGENT_CLI_V1_HTTP_OPERATIONS, AGENT_CLI_OUTPUT_CONTRACT, agentCliErrorEnvelopeSchema, cliHttpErrorCodes, agentCliLocalErrorCodes, nullableCliStringSchema, cliLocalErrorEnvelopeSchema, AGENT_CLI_RECOVERY_CONTRACT;
|
|
12675
|
+
var booleanSchema, timestampSchema, agentCliMcpAuthorizationRequestTokenPrefix, agentCliMcpAuthorizationRequestMaximumUrlBytes, agentCliMcpAuthorizationRequestMaximumPayloadCharacters, base64UrlAlphabet, AGENT_CLI_MCP_AUTHORIZATION_REQUEST_TOKEN, AGENT_CLI_MCP_AUTHORIZATION_CLIENT, LOCAL_SIGNING_ABANDON_CONTRACT, localSigningAbandonReceiptSchema, authorizationBase, browserAuthorizationBase, signingStatusSchema, agentCliSigningIntentSchema, browserPublicationSigningIntentSchema, browserPurchaseSigningIntentSchema, agentCliSigningApproveRequestSchema, agentCliSigningDenyRequestSchema, agentCliSigningDecisionResponseSchema, agentCliCredentialClaimSchema, agentCliCredentialSetupSchema, agentCliCredentialFulfillmentReceiptSchema, CLI_AGENTON_CREDENTIAL_MATERIAL_DOWNLOAD_CONTRACT, AGENT_CLI_V1_HTTP_OPERATIONS, AGENT_CLI_OUTPUT_CONTRACT, agentCliErrorEnvelopeSchema, cliHttpErrorCodes, agentCliLocalErrorCodes, nullableCliStringSchema, cliLocalErrorEnvelopeSchema, AGENT_CLI_RECOVERY_CONTRACT;
|
|
12575
12676
|
var init_agent_cli = __esm({
|
|
12576
12677
|
"../../packages/agent-market-contracts/src/v1/agent-cli.ts"() {
|
|
12577
12678
|
"use strict";
|
|
@@ -12593,6 +12694,11 @@ var init_agent_cli = __esm({
|
|
|
12593
12694
|
maximumUrlBytes: agentCliMcpAuthorizationRequestMaximumUrlBytes,
|
|
12594
12695
|
shellMetacharacters: false
|
|
12595
12696
|
});
|
|
12697
|
+
AGENT_CLI_MCP_AUTHORIZATION_CLIENT = Object.freeze({
|
|
12698
|
+
versionHeader: "x-finch-cli-version",
|
|
12699
|
+
minimumVersion: "0.4.0",
|
|
12700
|
+
packageName: "@finchtech/cli"
|
|
12701
|
+
});
|
|
12596
12702
|
LOCAL_SIGNING_ABANDON_CONTRACT = Object.freeze({
|
|
12597
12703
|
transport: "local_only",
|
|
12598
12704
|
networkCalls: 0,
|
|
@@ -12821,7 +12927,8 @@ var init_agent_cli = __esm({
|
|
|
12821
12927
|
agentCliLocalErrorCodes = Object.freeze([
|
|
12822
12928
|
...agentMarketErrorCodes,
|
|
12823
12929
|
...cliHttpErrorCodes,
|
|
12824
|
-
"BROWSER_OPEN_FAILED"
|
|
12930
|
+
"BROWSER_OPEN_FAILED",
|
|
12931
|
+
"MCP_AUTHORIZATION_FLOW_FAILED"
|
|
12825
12932
|
]);
|
|
12826
12933
|
nullableCliStringSchema = { type: ["string", "null"] };
|
|
12827
12934
|
cliLocalErrorEnvelopeSchema = strictObjectSchema({
|
|
@@ -13636,6 +13743,137 @@ var init_artifacts = __esm({
|
|
|
13636
13743
|
}
|
|
13637
13744
|
});
|
|
13638
13745
|
|
|
13746
|
+
// ../../packages/agent-market-contracts/src/v1/transfers.ts
|
|
13747
|
+
function handoff(method2, body) {
|
|
13748
|
+
return strictObjectSchema({
|
|
13749
|
+
method: { const: method2, description: `HTTP method for the transfer (${method2}).` },
|
|
13750
|
+
url: { type: "string", minLength: 1, maxLength: 2048, description: "Absolute URL to send the transfer request to." },
|
|
13751
|
+
headers: headerMapSchema,
|
|
13752
|
+
body: { const: body, description: "What the request body must be." }
|
|
13753
|
+
});
|
|
13754
|
+
}
|
|
13755
|
+
var described, nullSchema, nonNegativeIntegerStringSchema, headerMapSchema, MAX_INPUT_ARTIFACT_IDS, inputArtifactIdsSchema, prepareInputArtifactRequestSchema, prepareInputArtifactResponseSchema, artifactDownloadLinkResponseSchema, prepareAvatarUploadResponseSchema, buyerRunStatusFilterValues, buyerRunModeFilterValues, buyerRunsQuerySchema, buyerRunSchema, buyerRunsResponseSchema;
|
|
13756
|
+
var init_transfers = __esm({
|
|
13757
|
+
"../../packages/agent-market-contracts/src/v1/transfers.ts"() {
|
|
13758
|
+
"use strict";
|
|
13759
|
+
init_common2();
|
|
13760
|
+
described = (schema5, description) => Object.freeze({ ...schema5, description });
|
|
13761
|
+
nullSchema = Object.freeze({ type: "null" });
|
|
13762
|
+
nonNegativeIntegerStringSchema = Object.freeze({ type: "string", pattern: "^(0|[1-9][0-9]*)$" });
|
|
13763
|
+
headerMapSchema = Object.freeze({
|
|
13764
|
+
type: "object",
|
|
13765
|
+
additionalProperties: { type: "string", minLength: 1, maxLength: 2048 },
|
|
13766
|
+
description: "Send exactly these HTTP headers. Authorization carries a single-purpose transfer capability, not your Finch credential; treat it as a secret and do not log or repeat it."
|
|
13767
|
+
});
|
|
13768
|
+
MAX_INPUT_ARTIFACT_IDS = 32;
|
|
13769
|
+
inputArtifactIdsSchema = Object.freeze({
|
|
13770
|
+
type: "array",
|
|
13771
|
+
minItems: 1,
|
|
13772
|
+
maxItems: MAX_INPUT_ARTIFACT_IDS,
|
|
13773
|
+
uniqueItems: true,
|
|
13774
|
+
items: canonicalUuidSchema,
|
|
13775
|
+
description: "Input files for an Offer that accepts files: artifactIds from agent_market_buyer_input_artifact_prepare whose bytes you uploaded. Finch appends them after your content, as the website does."
|
|
13776
|
+
});
|
|
13777
|
+
prepareInputArtifactRequestSchema = strictObjectSchema({
|
|
13778
|
+
mediaType: {
|
|
13779
|
+
type: "string",
|
|
13780
|
+
minLength: 3,
|
|
13781
|
+
maxLength: 160,
|
|
13782
|
+
pattern: "^[a-z0-9][a-z0-9!#$&^_.+-]*/[a-z0-9][a-z0-9!#$&^_.+-]*$",
|
|
13783
|
+
description: "Media type of the file, for example application/pdf or image/png. Finch checks it against the file bytes."
|
|
13784
|
+
},
|
|
13785
|
+
filename: {
|
|
13786
|
+
type: "string",
|
|
13787
|
+
minLength: 1,
|
|
13788
|
+
maxLength: 200,
|
|
13789
|
+
pattern: "^(?!\\.{1,2}$)(?!.*[\\\\/\\u0000-\\u001f\\u007f]).+$",
|
|
13790
|
+
description: "File name shown to the Agent, without a directory."
|
|
13791
|
+
},
|
|
13792
|
+
byteLength: {
|
|
13793
|
+
type: "integer",
|
|
13794
|
+
minimum: 1,
|
|
13795
|
+
maximum: MAX_HTTP_ARTIFACT_BYTES,
|
|
13796
|
+
description: "Exact size of the file in bytes; the Offer may allow less."
|
|
13797
|
+
}
|
|
13798
|
+
});
|
|
13799
|
+
prepareInputArtifactResponseSchema = strictObjectSchema({
|
|
13800
|
+
artifactId: described(canonicalUuidSchema, "The input file; pass it in inputArtifactIds after the upload succeeds."),
|
|
13801
|
+
expiresAt: described(canonicalSecondTimestampSchema, "Upload before this time; afterwards prepare again."),
|
|
13802
|
+
upload: Object.freeze({
|
|
13803
|
+
...handoff("POST", "the raw file bytes"),
|
|
13804
|
+
description: "Upload the file bytes once with this HTTP request (for example curl --data-binary @file with every header)."
|
|
13805
|
+
})
|
|
13806
|
+
});
|
|
13807
|
+
artifactDownloadLinkResponseSchema = strictObjectSchema({
|
|
13808
|
+
artifactId: described(canonicalUuidSchema, "The file this link downloads."),
|
|
13809
|
+
expiresAt: described(canonicalSecondTimestampSchema, "The link works until this time; afterwards create another."),
|
|
13810
|
+
download: Object.freeze({
|
|
13811
|
+
...handoff("GET", "empty"),
|
|
13812
|
+
description: "Download the file bytes with this HTTP request (for example curl -o file with every header)."
|
|
13813
|
+
})
|
|
13814
|
+
});
|
|
13815
|
+
prepareAvatarUploadResponseSchema = strictObjectSchema({
|
|
13816
|
+
expiresAt: described(canonicalSecondTimestampSchema, "Upload before this time; the link works once."),
|
|
13817
|
+
upload: Object.freeze({
|
|
13818
|
+
...handoff("POST", "multipart/form-data with the avatar file in the form field named file"),
|
|
13819
|
+
description: 'Upload the avatar once with this HTTP request (for example curl -F file=@avatar.mp4 with every header). The response is {"uri","mediaType"}; use the uri as the Agent avatar.'
|
|
13820
|
+
}),
|
|
13821
|
+
accepted: Object.freeze({
|
|
13822
|
+
...strictObjectSchema({
|
|
13823
|
+
mediaTypes: { type: "array", items: { type: "string" }, description: "Accepted image and video types." },
|
|
13824
|
+
maxImageBytes: described(positiveIntegerStringSchema, "Largest accepted image, in bytes."),
|
|
13825
|
+
maxVideoBytes: described(positiveIntegerStringSchema, "Largest accepted video, in bytes.")
|
|
13826
|
+
}),
|
|
13827
|
+
description: "What the upload accepts."
|
|
13828
|
+
})
|
|
13829
|
+
});
|
|
13830
|
+
buyerRunStatusFilterValues = Object.freeze(["all", "active", "input_required", "completed", "failed"]);
|
|
13831
|
+
buyerRunModeFilterValues = Object.freeze(["all", "conversation_turn", "task", "generation", "direct_api"]);
|
|
13832
|
+
buyerRunsQuerySchema = strictObjectSchema({
|
|
13833
|
+
status: { enum: buyerRunStatusFilterValues, default: "all", description: "Only runs in this state group." },
|
|
13834
|
+
mode: { enum: buyerRunModeFilterValues, default: "all", description: "Only runs of this interaction mode." },
|
|
13835
|
+
cursorCreatedAt: { type: "string", format: "date-time", maxLength: 40, description: "nextCursor.createdAt from the previous page." },
|
|
13836
|
+
cursorInvocationId: described(canonicalUuidSchema, "nextCursor.invocationId from the previous page."),
|
|
13837
|
+
limit: { type: "integer", minimum: 1, maximum: 100, default: 20, description: "Runs per page." }
|
|
13838
|
+
}, []);
|
|
13839
|
+
buyerRunSchema = strictObjectSchema({
|
|
13840
|
+
invocationId: described(canonicalUuidSchema, "Read a conversation or Direct call with agent_market_buyer_invocation_get."),
|
|
13841
|
+
serviceVersionId: described(canonicalUuidSchema, "The Agent version that ran."),
|
|
13842
|
+
agentName: { type: "string", minLength: 1, maxLength: 200, description: "Agent display name." },
|
|
13843
|
+
offerId: { anyOf: [canonicalUuidSchema, nullSchema], description: "AgentOn Offer, or null for a Direct call." },
|
|
13844
|
+
offerName: { anyOf: [{ type: "string", minLength: 1, maxLength: 200 }, nullSchema], description: "Offer display name." },
|
|
13845
|
+
interactionMode: { enum: ["conversation_turn", "task", "generation", "direct_api"], description: "How the run interacts." },
|
|
13846
|
+
status: {
|
|
13847
|
+
enum: ["awaiting_dispatch", "dispatching", "submitted", "working", "input_required", "completed", "failed", "canceled", "expired"],
|
|
13848
|
+
description: "Current run state."
|
|
13849
|
+
},
|
|
13850
|
+
conversationId: { anyOf: [canonicalUuidSchema, nullSchema], description: "Conversation of a P1 run; pass it to start the next turn." },
|
|
13851
|
+
taskId: { anyOf: [canonicalUuidSchema, nullSchema], description: "Task of a P2/P3 run; read it with agent_market_buyer_task_get." },
|
|
13852
|
+
requestSummary: { type: "string", minLength: 1, maxLength: 500, description: "Short summary of what was asked." },
|
|
13853
|
+
resultSummary: { anyOf: [{ type: "string", maxLength: 500 }, nullSchema], description: "Short summary of the result so far." },
|
|
13854
|
+
fundingSource: {
|
|
13855
|
+
anyOf: [{ enum: ["merchant_self_test", "administrator_test", "sponsored", "promotion", "paid"] }, nullSchema],
|
|
13856
|
+
description: "The allowance the run reserved."
|
|
13857
|
+
},
|
|
13858
|
+
reservedCallRightUnits: described(nonNegativeIntegerStringSchema, "Call-right units the run reserved."),
|
|
13859
|
+
artifactCount: { type: "integer", minimum: 0, description: "Output files the run published." },
|
|
13860
|
+
createdAt: { type: "string", format: "date-time", description: "When the run started." },
|
|
13861
|
+
updatedAt: { type: "string", format: "date-time", description: "When the run last changed." },
|
|
13862
|
+
completedAt: { anyOf: [{ type: "string", format: "date-time" }, nullSchema], description: "When the run finished, if it did." }
|
|
13863
|
+
});
|
|
13864
|
+
buyerRunsResponseSchema = strictObjectSchema({
|
|
13865
|
+
items: { type: "array", maxItems: 100, items: buyerRunSchema, description: "Runs of this account, newest first." },
|
|
13866
|
+
nextCursor: {
|
|
13867
|
+
anyOf: [strictObjectSchema({
|
|
13868
|
+
createdAt: { type: "string", format: "date-time", description: "Pass as cursorCreatedAt." },
|
|
13869
|
+
invocationId: described(canonicalUuidSchema, "Pass as cursorInvocationId.")
|
|
13870
|
+
}), nullSchema],
|
|
13871
|
+
description: "Cursor for the next page, or null at the end."
|
|
13872
|
+
}
|
|
13873
|
+
});
|
|
13874
|
+
}
|
|
13875
|
+
});
|
|
13876
|
+
|
|
13639
13877
|
// ../../packages/agent-market-contracts/src/v1/buyer.ts
|
|
13640
13878
|
function supplementalQuestionMetadata(maxTextLength) {
|
|
13641
13879
|
return {
|
|
@@ -13652,30 +13890,51 @@ function supplementalQuestionMetadata(maxTextLength) {
|
|
|
13652
13890
|
}
|
|
13653
13891
|
};
|
|
13654
13892
|
}
|
|
13655
|
-
function
|
|
13656
|
-
return
|
|
13893
|
+
function taskMutationReceiptProperties(status) {
|
|
13894
|
+
return {
|
|
13657
13895
|
operationId: canonicalUuidSchema,
|
|
13658
13896
|
taskId: canonicalUuidSchema,
|
|
13659
13897
|
status: { const: status },
|
|
13660
13898
|
taskRevision: positiveRevisionSchema,
|
|
13661
13899
|
etag: taskStrongEtagSchema,
|
|
13662
13900
|
replayed: booleanSchema2
|
|
13663
|
-
}
|
|
13901
|
+
};
|
|
13902
|
+
}
|
|
13903
|
+
function taskMutationReceipt(status) {
|
|
13904
|
+
return strictObjectSchema(taskMutationReceiptProperties(status));
|
|
13664
13905
|
}
|
|
13665
|
-
var booleanSchema2, jsonValueSchema,
|
|
13906
|
+
var booleanSchema2, jsonValueSchema, nullSchema2, agentOnInitialInputSchema, agentOnFollowUpContentSchema, feeBpsCapSchema, createPurchaseIntentRequestSchema, purchaseIntentAcceptedSchema, PURCHASE_FEE_DECISION_CONTRACT, feeSnapshotCommon, purchaseFeeDecisionSnapshotSchema, PURCHASE_LIFECYCLE_CONTRACT, FINANCIAL_AUTHORIZATION_CONTRACT, nonNegativeIntegerStringSchema2, callRightPurchaseBatchSchema, callRightsListResponseSchema, CALL_RIGHTS_PAGE_CONTRACT, CALL_FUNDING_SOURCES, fundingSourceSchema, callEligibilityQuerySchema, described2, callEligibilityResponseSchema, invocationStartRequestSchema, invocationContinueRequestSchema, runtimeHandoffStateSchema, p1InvocationReceiptProperties, p1InvocationReceiptSchema, p1InvocationAcceptedSchema, directInvocationAcceptedSchema, supplementalQuestionOptionSchema, p1QuestionSchema, p1QuestionsSchema, p1AwaitingCompletionQuestionsSchema, taskQuestionSchema, taskQuestionsSchema, closedPublicFailureSchema, timeoutFailureSchema, invocationCommon, p1InvocationResponseSchema, directInvocationCommon, directPublicFailureSchema, directInvocationResponseSchema, DIRECT_INVOCATION_READ_CONTRACT, invocationResponseSchema, createTaskRequestSchema, TASK_QUANTITY_AUTHORITY_CONTRACT, taskCreateReceiptProperties, taskCreateReceiptSchema, taskCreateAcceptedSchema, taskStrongEtagSchema, taskInputReceiptSchema, taskInputAcceptedSchema, taskCommon, buyerOutputArtifactSchema, buyerOutputArtifactsSchema, taskResponseSchema, BUYER_AGENTON_RECOVERY_CONTRACT, appendTaskInputRequestSchema, directInvocationRequestSchema, TASK_COMPLETED_CANONICALIZATION;
|
|
13666
13907
|
var init_buyer = __esm({
|
|
13667
13908
|
"../../packages/agent-market-contracts/src/v1/buyer.ts"() {
|
|
13668
13909
|
"use strict";
|
|
13669
13910
|
init_common2();
|
|
13911
|
+
init_transfers();
|
|
13670
13912
|
booleanSchema2 = Object.freeze({ type: "boolean" });
|
|
13671
13913
|
jsonValueSchema = Object.freeze({
|
|
13914
|
+
...jsonValueTypesSchema,
|
|
13672
13915
|
description: "Native JSON value; pass objects and arrays directly, never as JSON-encoded strings. finch-canonical-binary64-v1; at most 65536 UTF-8 bytes, depth 64, and 10000 nodes.",
|
|
13673
13916
|
"x-finch-canonical-json-codec": "finch-canonical-binary64-v1",
|
|
13674
13917
|
"x-finch-max-utf8-bytes": 65536,
|
|
13675
13918
|
"x-finch-max-depth": 64,
|
|
13676
13919
|
"x-finch-max-nodes": 1e4
|
|
13677
13920
|
});
|
|
13678
|
-
|
|
13921
|
+
nullSchema2 = Object.freeze({ type: "null" });
|
|
13922
|
+
agentOnInitialInputSchema = Object.freeze({
|
|
13923
|
+
...jsonValueSchema,
|
|
13924
|
+
description: 'JSON value matching the published inputSchema of the selected Offer. For a content-array schema send {"content":[{"type":"text","text":"..."}]}; for a schema without declared properties send the prompt as a string; otherwise send the structured value the schema describes. Finch validates it against that schema and converts it to Provider content the same way the Finch website does. ' + jsonValueSchema.description
|
|
13925
|
+
});
|
|
13926
|
+
agentOnFollowUpContentSchema = Object.freeze({
|
|
13927
|
+
type: "array",
|
|
13928
|
+
minItems: 1,
|
|
13929
|
+
maxItems: 100,
|
|
13930
|
+
description: "Follow-up content parts sent to the Provider in order. Use text parts for answers and JSON parts for structured data.",
|
|
13931
|
+
items: Object.freeze({
|
|
13932
|
+
oneOf: Object.freeze([
|
|
13933
|
+
strictObjectSchema({ type: Object.freeze({ const: "text" }), text: Object.freeze({ type: "string", minLength: 1, maxLength: 1e4 }) }),
|
|
13934
|
+
strictObjectSchema({ type: Object.freeze({ const: "json" }), json: jsonValueSchema })
|
|
13935
|
+
])
|
|
13936
|
+
})
|
|
13937
|
+
});
|
|
13679
13938
|
feeBpsCapSchema = Object.freeze({ type: "integer", minimum: 0, maximum: 1e4 });
|
|
13680
13939
|
createPurchaseIntentRequestSchema = strictObjectSchema({
|
|
13681
13940
|
units: positiveIntegerStringSchema,
|
|
@@ -13769,18 +14028,18 @@ var init_buyer = __esm({
|
|
|
13769
14028
|
configHashEncoding: "0x_64_lowercase_hex",
|
|
13770
14029
|
mismatchWrites: 0
|
|
13771
14030
|
});
|
|
13772
|
-
|
|
14031
|
+
nonNegativeIntegerStringSchema2 = Object.freeze({ type: "string", pattern: "^(0|[1-9][0-9]*)$" });
|
|
13773
14032
|
callRightPurchaseBatchSchema = strictObjectSchema({
|
|
13774
14033
|
purchaseBatchId: canonicalUuidSchema,
|
|
13775
14034
|
purchasedUnits: positiveIntegerStringSchema,
|
|
13776
|
-
availableUnits:
|
|
13777
|
-
reservedUnits:
|
|
13778
|
-
earningPendingUnits:
|
|
14035
|
+
availableUnits: nonNegativeIntegerStringSchema2,
|
|
14036
|
+
reservedUnits: nonNegativeIntegerStringSchema2,
|
|
14037
|
+
earningPendingUnits: nonNegativeIntegerStringSchema2,
|
|
13779
14038
|
purchasedAt: canonicalSecondTimestampSchema
|
|
13780
14039
|
});
|
|
13781
14040
|
callRightsListResponseSchema = strictObjectSchema({
|
|
13782
14041
|
items: { type: "array", maxItems: 100, items: callRightPurchaseBatchSchema },
|
|
13783
|
-
nextCursor: { anyOf: [canonicalUuidSchema,
|
|
14042
|
+
nextCursor: { anyOf: [canonicalUuidSchema, nullSchema2] }
|
|
13784
14043
|
});
|
|
13785
14044
|
CALL_RIGHTS_PAGE_CONTRACT = Object.freeze({
|
|
13786
14045
|
cursor: "exclusive_purchase_batch_uuid",
|
|
@@ -13789,17 +14048,77 @@ var init_buyer = __esm({
|
|
|
13789
14048
|
cursorAuthority: "same_actor_account_environment_and_requested_version",
|
|
13790
14049
|
invalidOrForeignCursorError: "AGENT_MARKET_RESOURCE_NOT_FOUND"
|
|
13791
14050
|
});
|
|
14051
|
+
CALL_FUNDING_SOURCES = Object.freeze([
|
|
14052
|
+
"merchant_self_test",
|
|
14053
|
+
"administrator_test",
|
|
14054
|
+
"sponsored",
|
|
14055
|
+
"promotion",
|
|
14056
|
+
"paid"
|
|
14057
|
+
]);
|
|
14058
|
+
fundingSourceSchema = Object.freeze({
|
|
14059
|
+
anyOf: [{ enum: CALL_FUNDING_SOURCES }, nullSchema2],
|
|
14060
|
+
description: "The allowance this call reserved: merchant_self_test (owner test of a contract-tested Agent, free), promotion (free promotional operation), paid (purchased Call Rights), or administrator_test/sponsored (Finch-funded). A failed call releases what it reserved."
|
|
14061
|
+
});
|
|
14062
|
+
callEligibilityQuerySchema = strictObjectSchema({
|
|
14063
|
+
offerId: { ...canonicalUuidSchema, description: "AgentOn offer to check. Pass either offerId or versionId, not both." },
|
|
14064
|
+
versionId: { ...canonicalUuidSchema, description: "Direct API service version to check. Pass either offerId or versionId, not both." },
|
|
14065
|
+
quantity: {
|
|
14066
|
+
type: "integer",
|
|
14067
|
+
minimum: 1,
|
|
14068
|
+
maximum: 2147483647,
|
|
14069
|
+
default: 1,
|
|
14070
|
+
description: "Units of work for a generation offer; 1 for conversation, task, and Direct calls."
|
|
14071
|
+
}
|
|
14072
|
+
}, []);
|
|
14073
|
+
described2 = (schema5, description) => Object.freeze({ ...schema5, description });
|
|
14074
|
+
callEligibilityResponseSchema = strictObjectSchema({
|
|
14075
|
+
serviceVersionId: described2(canonicalUuidSchema, "Service version the call would run on."),
|
|
14076
|
+
offerId: { anyOf: [canonicalUuidSchema, nullSchema2], description: "The checked AgentOn offer, or null for a Direct API version." },
|
|
14077
|
+
quantity: { type: "integer", minimum: 1, maximum: 2147483647, description: "The checked quantity." },
|
|
14078
|
+
requiredUnits: described2(positiveIntegerStringSchema, "Call-right units a paid call would reserve, as a decimal integer string."),
|
|
14079
|
+
fundingSource: {
|
|
14080
|
+
enum: ["merchant_self_test", "promotion", "paid", "insufficient"],
|
|
14081
|
+
description: "What the next call would use: merchant_self_test and promotion are free; paid consumes requiredUnits purchased call rights; insufficient means call rights must be purchased first."
|
|
14082
|
+
},
|
|
14083
|
+
merchantSelfTest: described2(booleanSchema2, "True when the caller owns this contract-tested agent, so calls are a free owner self-test."),
|
|
14084
|
+
promotion: {
|
|
14085
|
+
anyOf: [strictObjectSchema({
|
|
14086
|
+
availableOperations: described2(nonNegativeIntegerStringSchema2, "Free calls usable now: the lower of personalRemaining and dailyRemaining."),
|
|
14087
|
+
personalRemaining: described2(nonNegativeIntegerStringSchema2, "Free calls left for this account in the promotion."),
|
|
14088
|
+
expiresAt: described2(canonicalSecondTimestampSchema, "When the promotion ends."),
|
|
14089
|
+
dailyRemaining: { anyOf: [nonNegativeIntegerStringSchema2, nullSchema2], description: "Free calls left today for this agent across all buyers, or null when there is no daily limit." },
|
|
14090
|
+
dailyResetsAt: { anyOf: [canonicalSecondTimestampSchema, nullSchema2], description: "When the daily limit resets, or null when there is no daily limit." }
|
|
14091
|
+
}), nullSchema2],
|
|
14092
|
+
description: "The active free promotion for this agent, or null when there is none."
|
|
14093
|
+
},
|
|
14094
|
+
paid: Object.freeze({
|
|
14095
|
+
...strictObjectSchema({
|
|
14096
|
+
availableUnits: described2(nonNegativeIntegerStringSchema2, "Purchased call-right units available now."),
|
|
14097
|
+
reservedUnits: described2(nonNegativeIntegerStringSchema2, "Purchased call-right units held by calls still running.")
|
|
14098
|
+
}),
|
|
14099
|
+
description: "Purchased call rights for this service version."
|
|
14100
|
+
})
|
|
14101
|
+
});
|
|
13792
14102
|
invocationStartRequestSchema = strictObjectSchema({
|
|
13793
|
-
content:
|
|
13794
|
-
taskCompleted: booleanSchema2
|
|
14103
|
+
content: agentOnInitialInputSchema,
|
|
14104
|
+
taskCompleted: booleanSchema2,
|
|
14105
|
+
inputArtifactIds: inputArtifactIdsSchema,
|
|
14106
|
+
conversationId: {
|
|
14107
|
+
...canonicalUuidSchema,
|
|
14108
|
+
description: "Start the next paid turn of this earlier conversation (from a previous invocation) instead of a new conversation. Its last turn must be finished, and it must be with the same Agent."
|
|
14109
|
+
}
|
|
13795
14110
|
}, ["content"]);
|
|
13796
14111
|
invocationContinueRequestSchema = strictObjectSchema({
|
|
13797
14112
|
conversationId: canonicalUuidSchema,
|
|
13798
14113
|
expectedTurnId: canonicalUuidSchema,
|
|
13799
|
-
content:
|
|
14114
|
+
content: agentOnFollowUpContentSchema,
|
|
13800
14115
|
taskCompleted: booleanSchema2
|
|
13801
14116
|
}, ["conversationId", "expectedTurnId", "content"]);
|
|
13802
|
-
|
|
14117
|
+
runtimeHandoffStateSchema = Object.freeze({
|
|
14118
|
+
enum: Object.freeze(["acknowledged", "uncertain"]),
|
|
14119
|
+
description: "acknowledged: the runtime received the work. uncertain: the work is accepted and durable, but runtime receipt was not confirmed; Finch retries delivery automatically, so read it by its identifiers and do not resubmit with a new Idempotency-Key."
|
|
14120
|
+
});
|
|
14121
|
+
p1InvocationReceiptProperties = {
|
|
13803
14122
|
operationId: {
|
|
13804
14123
|
...canonicalUuidSchema,
|
|
13805
14124
|
description: "Durable admission identity; recover its current P1 resource identity with agent_market_operation_get."
|
|
@@ -13812,6 +14131,11 @@ var init_buyer = __esm({
|
|
|
13812
14131
|
turnId: canonicalUuidSchema,
|
|
13813
14132
|
status: { const: "awaiting_dispatch" },
|
|
13814
14133
|
replayed: booleanSchema2
|
|
14134
|
+
};
|
|
14135
|
+
p1InvocationReceiptSchema = strictObjectSchema(p1InvocationReceiptProperties);
|
|
14136
|
+
p1InvocationAcceptedSchema = strictObjectSchema({
|
|
14137
|
+
...p1InvocationReceiptProperties,
|
|
14138
|
+
handoffState: runtimeHandoffStateSchema
|
|
13815
14139
|
});
|
|
13816
14140
|
directInvocationAcceptedSchema = strictObjectSchema({
|
|
13817
14141
|
operationId: canonicalUuidSchema,
|
|
@@ -13858,12 +14182,12 @@ var init_buyer = __esm({
|
|
|
13858
14182
|
strictObjectSchema({ code: { const: "AGENT_MARKET_RUNTIME_REJECTED" }, message: { const: "The runtime rejected the request." } }),
|
|
13859
14183
|
strictObjectSchema({ code: { const: "AGENT_MARKET_RUNTIME_UNAVAILABLE" }, message: { const: "The runtime is temporarily unavailable." } }),
|
|
13860
14184
|
strictObjectSchema({ code: { const: "AGENT_MARKET_RUNTIME_TIMEOUT" }, message: { const: "The runtime did not complete before the deadline." } }),
|
|
13861
|
-
strictObjectSchema({ code: { const: "AGENT_MARKET_INTERNAL_ERROR" }, message:
|
|
14185
|
+
strictObjectSchema({ code: { const: "AGENT_MARKET_INTERNAL_ERROR" }, message: nullSchema2 })
|
|
13862
14186
|
]
|
|
13863
14187
|
});
|
|
13864
14188
|
timeoutFailureSchema = strictObjectSchema({
|
|
13865
14189
|
code: { const: "AGENT_MARKET_RUNTIME_TIMEOUT" },
|
|
13866
|
-
message:
|
|
14190
|
+
message: nullSchema2
|
|
13867
14191
|
});
|
|
13868
14192
|
invocationCommon = {
|
|
13869
14193
|
operationId: canonicalUuidSchema,
|
|
@@ -13871,15 +14195,16 @@ var init_buyer = __esm({
|
|
|
13871
14195
|
conversationId: canonicalUuidSchema,
|
|
13872
14196
|
currentTurnId: canonicalUuidSchema,
|
|
13873
14197
|
createdAt: canonicalSecondTimestampSchema,
|
|
13874
|
-
updatedAt: canonicalSecondTimestampSchema
|
|
14198
|
+
updatedAt: canonicalSecondTimestampSchema,
|
|
14199
|
+
fundingSource: fundingSourceSchema
|
|
13875
14200
|
};
|
|
13876
14201
|
p1InvocationResponseSchema = Object.freeze({
|
|
13877
14202
|
oneOf: [
|
|
13878
14203
|
...["awaiting_dispatch", "dispatching"].map((status) => strictObjectSchema({
|
|
13879
14204
|
...invocationCommon,
|
|
13880
14205
|
status: { const: status },
|
|
13881
|
-
output:
|
|
13882
|
-
error:
|
|
14206
|
+
output: nullSchema2,
|
|
14207
|
+
error: nullSchema2
|
|
13883
14208
|
})),
|
|
13884
14209
|
strictObjectSchema({
|
|
13885
14210
|
...invocationCommon,
|
|
@@ -13893,18 +14218,18 @@ var init_buyer = __esm({
|
|
|
13893
14218
|
})
|
|
13894
14219
|
]
|
|
13895
14220
|
}),
|
|
13896
|
-
error:
|
|
14221
|
+
error: nullSchema2
|
|
13897
14222
|
}),
|
|
13898
14223
|
strictObjectSchema({
|
|
13899
14224
|
...invocationCommon,
|
|
13900
14225
|
status: { const: "completed" },
|
|
13901
14226
|
output: jsonValueSchema,
|
|
13902
|
-
error:
|
|
14227
|
+
error: nullSchema2
|
|
13903
14228
|
}),
|
|
13904
14229
|
strictObjectSchema({
|
|
13905
14230
|
...invocationCommon,
|
|
13906
14231
|
status: { const: "failed" },
|
|
13907
|
-
output:
|
|
14232
|
+
output: nullSchema2,
|
|
13908
14233
|
error: closedPublicFailureSchema
|
|
13909
14234
|
})
|
|
13910
14235
|
]
|
|
@@ -13913,7 +14238,8 @@ var init_buyer = __esm({
|
|
|
13913
14238
|
operationId: canonicalUuidSchema,
|
|
13914
14239
|
invocationId: canonicalUuidSchema,
|
|
13915
14240
|
createdAt: canonicalSecondTimestampSchema,
|
|
13916
|
-
updatedAt: canonicalSecondTimestampSchema
|
|
14241
|
+
updatedAt: canonicalSecondTimestampSchema,
|
|
14242
|
+
fundingSource: fundingSourceSchema
|
|
13917
14243
|
};
|
|
13918
14244
|
directPublicFailureSchema = Object.freeze({
|
|
13919
14245
|
oneOf: [
|
|
@@ -13925,7 +14251,7 @@ var init_buyer = __esm({
|
|
|
13925
14251
|
code: { const: "AGENT_MARKET_RUNTIME_UNAVAILABLE" },
|
|
13926
14252
|
message: { const: "The runtime is temporarily unavailable." }
|
|
13927
14253
|
}),
|
|
13928
|
-
strictObjectSchema({ code: { const: "AGENT_MARKET_INTERNAL_ERROR" }, message:
|
|
14254
|
+
strictObjectSchema({ code: { const: "AGENT_MARKET_INTERNAL_ERROR" }, message: nullSchema2 })
|
|
13929
14255
|
]
|
|
13930
14256
|
});
|
|
13931
14257
|
directInvocationResponseSchema = Object.freeze({
|
|
@@ -13933,19 +14259,19 @@ var init_buyer = __esm({
|
|
|
13933
14259
|
...["awaiting_dispatch", "dispatching"].map((status) => strictObjectSchema({
|
|
13934
14260
|
...directInvocationCommon,
|
|
13935
14261
|
status: { const: status },
|
|
13936
|
-
output:
|
|
13937
|
-
error:
|
|
14262
|
+
output: nullSchema2,
|
|
14263
|
+
error: nullSchema2
|
|
13938
14264
|
})),
|
|
13939
14265
|
strictObjectSchema({
|
|
13940
14266
|
...directInvocationCommon,
|
|
13941
14267
|
status: { const: "completed" },
|
|
13942
14268
|
output: jsonValueSchema,
|
|
13943
|
-
error:
|
|
14269
|
+
error: nullSchema2
|
|
13944
14270
|
}),
|
|
13945
14271
|
strictObjectSchema({
|
|
13946
14272
|
...directInvocationCommon,
|
|
13947
14273
|
status: { const: "failed" },
|
|
13948
|
-
output:
|
|
14274
|
+
output: nullSchema2,
|
|
13949
14275
|
error: directPublicFailureSchema
|
|
13950
14276
|
})
|
|
13951
14277
|
]
|
|
@@ -13989,7 +14315,8 @@ var init_buyer = __esm({
|
|
|
13989
14315
|
});
|
|
13990
14316
|
createTaskRequestSchema = strictObjectSchema({
|
|
13991
14317
|
quantity: { type: "integer", minimum: 1, maximum: 2147483647 },
|
|
13992
|
-
content:
|
|
14318
|
+
content: agentOnInitialInputSchema,
|
|
14319
|
+
inputArtifactIds: inputArtifactIdsSchema
|
|
13993
14320
|
}, ["quantity", "content"]);
|
|
13994
14321
|
TASK_QUANTITY_AUTHORITY_CONTRACT = Object.freeze({
|
|
13995
14322
|
transport: "positive_int32",
|
|
@@ -13999,7 +14326,7 @@ var init_buyer = __esm({
|
|
|
13999
14326
|
p3BoundsAuthority: "database_offer_and_artifact_business_rules",
|
|
14000
14327
|
transportDoesNotApplyGlobal100Cap: true
|
|
14001
14328
|
});
|
|
14002
|
-
|
|
14329
|
+
taskCreateReceiptProperties = {
|
|
14003
14330
|
operationId: {
|
|
14004
14331
|
...canonicalUuidSchema,
|
|
14005
14332
|
description: "Durable admission identity; recover its current P2/P3 resource identity with agent_market_operation_get."
|
|
@@ -14010,6 +14337,11 @@ var init_buyer = __esm({
|
|
|
14010
14337
|
},
|
|
14011
14338
|
status: { const: "submitted" },
|
|
14012
14339
|
replayed: booleanSchema2
|
|
14340
|
+
};
|
|
14341
|
+
taskCreateReceiptSchema = strictObjectSchema(taskCreateReceiptProperties);
|
|
14342
|
+
taskCreateAcceptedSchema = strictObjectSchema({
|
|
14343
|
+
...taskCreateReceiptProperties,
|
|
14344
|
+
handoffState: runtimeHandoffStateSchema
|
|
14013
14345
|
});
|
|
14014
14346
|
taskStrongEtagSchema = Object.freeze({
|
|
14015
14347
|
type: "string",
|
|
@@ -14017,15 +14349,19 @@ var init_buyer = __esm({
|
|
|
14017
14349
|
"x-finch-resource-id-field": "taskId",
|
|
14018
14350
|
"x-finch-revision-field": "taskRevision"
|
|
14019
14351
|
});
|
|
14020
|
-
|
|
14021
|
-
|
|
14352
|
+
taskInputReceiptSchema = taskMutationReceipt("working");
|
|
14353
|
+
taskInputAcceptedSchema = strictObjectSchema({
|
|
14354
|
+
...taskMutationReceiptProperties("working"),
|
|
14355
|
+
handoffState: runtimeHandoffStateSchema
|
|
14356
|
+
});
|
|
14022
14357
|
taskCommon = {
|
|
14023
14358
|
operationId: canonicalUuidSchema,
|
|
14024
14359
|
taskId: canonicalUuidSchema,
|
|
14025
14360
|
taskRevision: positiveRevisionSchema,
|
|
14026
14361
|
etag: taskStrongEtagSchema,
|
|
14027
14362
|
createdAt: canonicalSecondTimestampSchema,
|
|
14028
|
-
updatedAt: canonicalSecondTimestampSchema
|
|
14363
|
+
updatedAt: canonicalSecondTimestampSchema,
|
|
14364
|
+
fundingSource: fundingSourceSchema
|
|
14029
14365
|
};
|
|
14030
14366
|
buyerOutputArtifactSchema = strictObjectSchema({
|
|
14031
14367
|
artifactId: canonicalUuidSchema,
|
|
@@ -14055,38 +14391,38 @@ var init_buyer = __esm({
|
|
|
14055
14391
|
...["submitted", "working"].map((status) => strictObjectSchema({
|
|
14056
14392
|
...taskCommon,
|
|
14057
14393
|
status: { const: status },
|
|
14058
|
-
output:
|
|
14059
|
-
error:
|
|
14394
|
+
output: nullSchema2,
|
|
14395
|
+
error: nullSchema2
|
|
14060
14396
|
})),
|
|
14061
14397
|
strictObjectSchema({
|
|
14062
14398
|
...taskCommon,
|
|
14063
14399
|
status: { const: "input_required" },
|
|
14064
14400
|
output: strictObjectSchema({ questions: taskQuestionsSchema }),
|
|
14065
|
-
error:
|
|
14401
|
+
error: nullSchema2
|
|
14066
14402
|
}),
|
|
14067
14403
|
strictObjectSchema({
|
|
14068
14404
|
...taskCommon,
|
|
14069
14405
|
status: { const: "completed" },
|
|
14070
14406
|
output: jsonValueSchema,
|
|
14071
14407
|
artifacts: buyerOutputArtifactsSchema,
|
|
14072
|
-
error:
|
|
14408
|
+
error: nullSchema2
|
|
14073
14409
|
}),
|
|
14074
14410
|
strictObjectSchema({
|
|
14075
14411
|
...taskCommon,
|
|
14076
14412
|
status: { const: "failed" },
|
|
14077
|
-
output:
|
|
14413
|
+
output: nullSchema2,
|
|
14078
14414
|
error: closedPublicFailureSchema
|
|
14079
14415
|
}),
|
|
14080
14416
|
strictObjectSchema({
|
|
14081
14417
|
...taskCommon,
|
|
14082
14418
|
status: { const: "canceled" },
|
|
14083
|
-
output:
|
|
14084
|
-
error:
|
|
14419
|
+
output: nullSchema2,
|
|
14420
|
+
error: nullSchema2
|
|
14085
14421
|
}),
|
|
14086
14422
|
strictObjectSchema({
|
|
14087
14423
|
...taskCommon,
|
|
14088
14424
|
status: { const: "expired" },
|
|
14089
|
-
output:
|
|
14425
|
+
output: nullSchema2,
|
|
14090
14426
|
error: timeoutFailureSchema
|
|
14091
14427
|
})
|
|
14092
14428
|
]
|
|
@@ -14105,8 +14441,7 @@ var init_buyer = __esm({
|
|
|
14105
14441
|
p1ContinueOperationIdIsGenericRecovery: true,
|
|
14106
14442
|
missingOrForeignOperationError: "AGENT_MARKET_OPERATION_NOT_FOUND"
|
|
14107
14443
|
});
|
|
14108
|
-
appendTaskInputRequestSchema = strictObjectSchema({ content:
|
|
14109
|
-
cancelTaskRequestSchema = strictObjectSchema({});
|
|
14444
|
+
appendTaskInputRequestSchema = strictObjectSchema({ content: agentOnFollowUpContentSchema });
|
|
14110
14445
|
directInvocationRequestSchema = strictObjectSchema({ input: jsonValueSchema });
|
|
14111
14446
|
TASK_COMPLETED_CANONICALIZATION = Object.freeze({
|
|
14112
14447
|
omitted: true,
|
|
@@ -14122,10 +14457,10 @@ function notRunStage(kind) {
|
|
|
14122
14457
|
return strictObjectSchema({
|
|
14123
14458
|
kind: { const: kind },
|
|
14124
14459
|
status: { const: "not_run" },
|
|
14125
|
-
httpStatus:
|
|
14126
|
-
resultCode:
|
|
14127
|
-
deliveryOutcome:
|
|
14128
|
-
latencyMs:
|
|
14460
|
+
httpStatus: nullSchema3,
|
|
14461
|
+
resultCode: nullSchema3,
|
|
14462
|
+
deliveryOutcome: nullSchema3,
|
|
14463
|
+
latencyMs: nullSchema3
|
|
14129
14464
|
});
|
|
14130
14465
|
}
|
|
14131
14466
|
function successfulStage(kind, httpStatus) {
|
|
@@ -14133,8 +14468,8 @@ function successfulStage(kind, httpStatus) {
|
|
|
14133
14468
|
kind: { const: kind },
|
|
14134
14469
|
status: { const: "success" },
|
|
14135
14470
|
httpStatus,
|
|
14136
|
-
resultCode:
|
|
14137
|
-
deliveryOutcome:
|
|
14471
|
+
resultCode: nullSchema3,
|
|
14472
|
+
deliveryOutcome: nullSchema3,
|
|
14138
14473
|
latencyMs: boundedLatencySchema
|
|
14139
14474
|
});
|
|
14140
14475
|
}
|
|
@@ -14142,9 +14477,9 @@ function terminalStage(kind, status, resultCodes) {
|
|
|
14142
14477
|
return strictObjectSchema({
|
|
14143
14478
|
kind: { const: kind },
|
|
14144
14479
|
status: { const: status },
|
|
14145
|
-
httpStatus: { anyOf: [boundedHttpStatusSchema,
|
|
14480
|
+
httpStatus: { anyOf: [boundedHttpStatusSchema, nullSchema3] },
|
|
14146
14481
|
resultCode: { type: "string", enum: resultCodes },
|
|
14147
|
-
deliveryOutcome: status === "uncertain" ? { const: "unknown" } : { anyOf: [{ const: "not_sent" },
|
|
14482
|
+
deliveryOutcome: status === "uncertain" ? { const: "unknown" } : { anyOf: [{ const: "not_sent" }, nullSchema3] },
|
|
14148
14483
|
latencyMs: boundedLatencySchema
|
|
14149
14484
|
});
|
|
14150
14485
|
}
|
|
@@ -14172,11 +14507,11 @@ function systemTerminalVariant(status, reason, preparingAt, executingAt, history
|
|
|
14172
14507
|
preparingAt,
|
|
14173
14508
|
executingAt,
|
|
14174
14509
|
completedAt: timestampSchema2,
|
|
14175
|
-
suiteResult:
|
|
14510
|
+
suiteResult: nullSchema3,
|
|
14176
14511
|
...history
|
|
14177
14512
|
});
|
|
14178
14513
|
}
|
|
14179
|
-
var DIRECT_CONNECTION_TEST_SUITE_ID, DIRECT_CONNECTION_TEST_SUITE_VERSION, DIRECT_CONNECTION_TEST_STAGE_KINDS, DIRECT_CONNECTION_TEST_STAGE_STATUSES, DIRECT_CONNECTION_TEST_MAX_LATENCY_MS, DIRECT_CONNECTION_TEST_AGGREGATE_FAILURE_CODES, CONNECTION_TEST_SYSTEM_FAILED_REASONS, CONNECTION_TEST_SYSTEM_UNCERTAIN_REASONS, CONNECTION_TEST_SYSTEM_TERMINAL_REASONS, CONNECTION_TEST_SYSTEM_TERMINAL_REASON_TO_PUBLIC_FAILURE_CODE, CONNECTION_TEST_SYSTEM_TERMINAL_CONTRACT, DIRECT_CONNECTION_TEST_TRANSPORT_RESULT_CODES, DIRECT_CONNECTION_TEST_HEALTH_RESULT_CODES, DIRECT_CONNECTION_TEST_PREFLIGHT_RESULT_CODES, DIRECT_CONNECTION_TEST_INVOCATION_RESULT_CODES, DIRECT_CONNECTION_TEST_INTERNAL_RESULT_CODES,
|
|
14514
|
+
var DIRECT_CONNECTION_TEST_SUITE_ID, DIRECT_CONNECTION_TEST_SUITE_VERSION, DIRECT_CONNECTION_TEST_STAGE_KINDS, DIRECT_CONNECTION_TEST_STAGE_STATUSES, DIRECT_CONNECTION_TEST_MAX_LATENCY_MS, DIRECT_CONNECTION_TEST_AGGREGATE_FAILURE_CODES, CONNECTION_TEST_SYSTEM_FAILED_REASONS, CONNECTION_TEST_SYSTEM_UNCERTAIN_REASONS, CONNECTION_TEST_SYSTEM_TERMINAL_REASONS, CONNECTION_TEST_SYSTEM_TERMINAL_REASON_TO_PUBLIC_FAILURE_CODE, CONNECTION_TEST_SYSTEM_TERMINAL_CONTRACT, DIRECT_CONNECTION_TEST_TRANSPORT_RESULT_CODES, DIRECT_CONNECTION_TEST_HEALTH_RESULT_CODES, DIRECT_CONNECTION_TEST_PREFLIGHT_RESULT_CODES, DIRECT_CONNECTION_TEST_INVOCATION_RESULT_CODES, DIRECT_CONNECTION_TEST_INTERNAL_RESULT_CODES, nullSchema3, boundedHttpStatusSchema, successfulHttpStatusSchema, boundedLatencySchema, healthSuccessSchema, healthFailedSchema, healthUncertainSchema, preflightNotRunSchema, preflightSkippedSchema, preflightSuccessSchema, preflightFailedSchema, preflightUncertainSchema, invocationNotRunSchema, invocationSuccessSchema, invocationFailedSchema, invocationUncertainSchema, directConnectionTestHealthStageSchema, directConnectionTestPreflightStageSchema, directConnectionTestInvocationStageSchema, internalResult, onlineInternalResultSchema, failedInternalResultSchemas, uncertainInternalResultSchemas, directConnectionTestInternalResultSchema, DIRECT_CONNECTION_TEST_DIAGNOSTIC_CODES, directConnectionTestDiagnostics, directConnectionTestDiagnosticsResponseSchema, timestampSchema2, systemHealthNotRunMarkerSchema, systemPreflightNotRunMarkerSchema, systemPreflightSkippedMarkerSchema, systemInvocationNotRunMarkerSchema, systemNoPriorFailedHistorySchema, systemHealthPriorFailedHistorySchema, systemPreflightSuccessPriorFailedHistorySchema, systemPreflightSkippedPriorFailedHistorySchema, systemReceiptMissingHistorySchemas, systemFailedReasonSchema, systemFailedHistorySchemas, connectionTestSystemTerminalSchema, PLACEHOLDER_STRINGS, DIRECT_CONNECTION_TEST_SUITE_CONTRACT, AGENTON_CONNECTION_TEST_SUITE_CONTRACT, CONNECTION_TEST_STORAGE_STATE_TO_PUBLIC_STATUS, CONNECTION_TEST_INTERNAL_FAILURE_TO_PUBLIC_FAILURE, OPERATION_STORAGE_KIND_TO_PUBLIC_KIND, CONNECTION_TEST_PUBLIC_PROJECTION_CONTRACT;
|
|
14180
14515
|
var init_direct_connection_test = __esm({
|
|
14181
14516
|
"../../packages/agent-market-contracts/src/v1/direct-connection-test.ts"() {
|
|
14182
14517
|
"use strict";
|
|
@@ -14288,7 +14623,7 @@ var init_direct_connection_test = __esm({
|
|
|
14288
14623
|
"network_unavailable",
|
|
14289
14624
|
"network_failure"
|
|
14290
14625
|
]);
|
|
14291
|
-
|
|
14626
|
+
nullSchema3 = { type: "null" };
|
|
14292
14627
|
boundedHttpStatusSchema = { type: "integer", minimum: 100, maximum: 599 };
|
|
14293
14628
|
successfulHttpStatusSchema = { type: "integer", minimum: 200, maximum: 299 };
|
|
14294
14629
|
boundedLatencySchema = {
|
|
@@ -14311,10 +14646,10 @@ var init_direct_connection_test = __esm({
|
|
|
14311
14646
|
preflightSkippedSchema = strictObjectSchema({
|
|
14312
14647
|
kind: { const: "preflight" },
|
|
14313
14648
|
status: { const: "skipped" },
|
|
14314
|
-
httpStatus:
|
|
14315
|
-
resultCode:
|
|
14316
|
-
deliveryOutcome:
|
|
14317
|
-
latencyMs:
|
|
14649
|
+
httpStatus: nullSchema3,
|
|
14650
|
+
resultCode: nullSchema3,
|
|
14651
|
+
deliveryOutcome: nullSchema3,
|
|
14652
|
+
latencyMs: nullSchema3
|
|
14318
14653
|
});
|
|
14319
14654
|
preflightSuccessSchema = successfulStage("preflight", successfulHttpStatusSchema);
|
|
14320
14655
|
preflightFailedSchema = terminalStage(
|
|
@@ -14364,7 +14699,7 @@ var init_direct_connection_test = __esm({
|
|
|
14364
14699
|
});
|
|
14365
14700
|
internalResult = (status, failureCode, health, preflight, invocation) => strictObjectSchema({
|
|
14366
14701
|
status: { const: status },
|
|
14367
|
-
failureCode: failureCode === null ?
|
|
14702
|
+
failureCode: failureCode === null ? nullSchema3 : { const: failureCode },
|
|
14368
14703
|
health,
|
|
14369
14704
|
preflight,
|
|
14370
14705
|
invocation
|
|
@@ -14436,29 +14771,29 @@ var init_direct_connection_test = __esm({
|
|
|
14436
14771
|
});
|
|
14437
14772
|
directConnectionTestDiagnosticsResponseSchema = Object.freeze({
|
|
14438
14773
|
oneOf: [
|
|
14439
|
-
directConnectionTestDiagnostics("authorized",
|
|
14440
|
-
directConnectionTestDiagnostics("executing",
|
|
14774
|
+
directConnectionTestDiagnostics("authorized", nullSchema3, nullSchema3),
|
|
14775
|
+
directConnectionTestDiagnostics("executing", nullSchema3, nullSchema3),
|
|
14441
14776
|
directConnectionTestDiagnostics(
|
|
14442
14777
|
"succeeded",
|
|
14443
|
-
|
|
14778
|
+
nullSchema3,
|
|
14444
14779
|
onlineInternalResultSchema
|
|
14445
14780
|
),
|
|
14446
|
-
directConnectionTestDiagnostics("failed",
|
|
14781
|
+
directConnectionTestDiagnostics("failed", nullSchema3, { oneOf: failedInternalResultSchemas }),
|
|
14447
14782
|
directConnectionTestDiagnostics("failed", {
|
|
14448
14783
|
type: "string",
|
|
14449
14784
|
enum: DIRECT_CONNECTION_TEST_DIAGNOSTIC_CODES.filter(
|
|
14450
14785
|
(code) => code !== "EXECUTION_RESULT_MISSING"
|
|
14451
14786
|
)
|
|
14452
|
-
},
|
|
14787
|
+
}, nullSchema3),
|
|
14453
14788
|
directConnectionTestDiagnostics(
|
|
14454
14789
|
"uncertain",
|
|
14455
|
-
|
|
14790
|
+
nullSchema3,
|
|
14456
14791
|
{ oneOf: uncertainInternalResultSchemas }
|
|
14457
14792
|
),
|
|
14458
14793
|
directConnectionTestDiagnostics(
|
|
14459
14794
|
"uncertain",
|
|
14460
14795
|
{ const: "EXECUTION_RESULT_MISSING" },
|
|
14461
|
-
|
|
14796
|
+
nullSchema3
|
|
14462
14797
|
)
|
|
14463
14798
|
]
|
|
14464
14799
|
});
|
|
@@ -14481,7 +14816,7 @@ var init_direct_connection_test = __esm({
|
|
|
14481
14816
|
});
|
|
14482
14817
|
systemNoPriorFailedHistorySchema = {
|
|
14483
14818
|
priorCompletedStages: exactStageTuple([]),
|
|
14484
|
-
activeStage:
|
|
14819
|
+
activeStage: nullSchema3,
|
|
14485
14820
|
remainingStages: exactStageTuple([
|
|
14486
14821
|
systemHealthNotRunMarkerSchema,
|
|
14487
14822
|
{ oneOf: [systemPreflightNotRunMarkerSchema, systemPreflightSkippedMarkerSchema] },
|
|
@@ -14490,7 +14825,7 @@ var init_direct_connection_test = __esm({
|
|
|
14490
14825
|
};
|
|
14491
14826
|
systemHealthPriorFailedHistorySchema = {
|
|
14492
14827
|
priorCompletedStages: exactStageTuple([healthSuccessSchema]),
|
|
14493
|
-
activeStage:
|
|
14828
|
+
activeStage: nullSchema3,
|
|
14494
14829
|
remainingStages: exactStageTuple([
|
|
14495
14830
|
systemPreflightNotRunMarkerSchema,
|
|
14496
14831
|
systemInvocationNotRunMarkerSchema
|
|
@@ -14498,12 +14833,12 @@ var init_direct_connection_test = __esm({
|
|
|
14498
14833
|
};
|
|
14499
14834
|
systemPreflightSuccessPriorFailedHistorySchema = {
|
|
14500
14835
|
priorCompletedStages: exactStageTuple([healthSuccessSchema, preflightSuccessSchema]),
|
|
14501
|
-
activeStage:
|
|
14836
|
+
activeStage: nullSchema3,
|
|
14502
14837
|
remainingStages: exactStageTuple([systemInvocationNotRunMarkerSchema])
|
|
14503
14838
|
};
|
|
14504
14839
|
systemPreflightSkippedPriorFailedHistorySchema = {
|
|
14505
14840
|
priorCompletedStages: exactStageTuple([healthSuccessSchema, preflightSkippedSchema]),
|
|
14506
|
-
activeStage:
|
|
14841
|
+
activeStage: nullSchema3,
|
|
14507
14842
|
remainingStages: exactStageTuple([systemInvocationNotRunMarkerSchema])
|
|
14508
14843
|
};
|
|
14509
14844
|
systemReceiptMissingHistorySchemas = [
|
|
@@ -14545,15 +14880,15 @@ var init_direct_connection_test = __esm({
|
|
|
14545
14880
|
systemTerminalVariant(
|
|
14546
14881
|
"failed",
|
|
14547
14882
|
systemFailedReasonSchema,
|
|
14548
|
-
|
|
14549
|
-
|
|
14883
|
+
nullSchema3,
|
|
14884
|
+
nullSchema3,
|
|
14550
14885
|
systemNoPriorFailedHistorySchema
|
|
14551
14886
|
),
|
|
14552
14887
|
systemTerminalVariant(
|
|
14553
14888
|
"failed",
|
|
14554
14889
|
systemFailedReasonSchema,
|
|
14555
14890
|
timestampSchema2,
|
|
14556
|
-
|
|
14891
|
+
nullSchema3,
|
|
14557
14892
|
systemNoPriorFailedHistorySchema
|
|
14558
14893
|
),
|
|
14559
14894
|
...systemFailedHistorySchemas.map((history) => systemTerminalVariant(
|
|
@@ -15238,17 +15573,17 @@ var init_localization = __esm({
|
|
|
15238
15573
|
function signedStatusVariants(kind, denialCode, executionFailureCode, successResult, extra = {}) {
|
|
15239
15574
|
const base3 = (status) => ({ ...signedBase(kind, status), ...extra });
|
|
15240
15575
|
return [
|
|
15241
|
-
strictObjectSchema({ ...base3("awaiting_signature"), authorizedAt:
|
|
15242
|
-
strictObjectSchema({ ...base3("authorized"), authorizedAt: timestampSchema3, executingAt:
|
|
15243
|
-
strictObjectSchema({ ...base3("executing"), authorizedAt: timestampSchema3, executingAt: timestampSchema3, deniedAt:
|
|
15244
|
-
strictObjectSchema({ ...base3("succeeded"), authorizedAt: timestampSchema3, executingAt: timestampSchema3, deniedAt:
|
|
15245
|
-
strictObjectSchema({ ...base3("failed"), authorizedAt:
|
|
15246
|
-
strictObjectSchema({ ...base3("failed"), authorizedAt: timestampSchema3, executingAt:
|
|
15247
|
-
strictObjectSchema({ ...base3("failed"), authorizedAt: timestampSchema3, executingAt: timestampSchema3, deniedAt:
|
|
15248
|
-
strictObjectSchema({ ...base3("denied"), authorizedAt:
|
|
15576
|
+
strictObjectSchema({ ...base3("awaiting_signature"), authorizedAt: nullSchema4, executingAt: nullSchema4, deniedAt: nullSchema4, completedAt: nullSchema4, failureCode: nullSchema4, result: nullSchema4 }),
|
|
15577
|
+
strictObjectSchema({ ...base3("authorized"), authorizedAt: timestampSchema3, executingAt: nullSchema4, deniedAt: nullSchema4, completedAt: nullSchema4, failureCode: nullSchema4, result: nullSchema4 }),
|
|
15578
|
+
strictObjectSchema({ ...base3("executing"), authorizedAt: timestampSchema3, executingAt: timestampSchema3, deniedAt: nullSchema4, completedAt: nullSchema4, failureCode: nullSchema4, result: nullSchema4 }),
|
|
15579
|
+
strictObjectSchema({ ...base3("succeeded"), authorizedAt: timestampSchema3, executingAt: timestampSchema3, deniedAt: nullSchema4, completedAt: timestampSchema3, failureCode: nullSchema4, result: successResult }),
|
|
15580
|
+
strictObjectSchema({ ...base3("failed"), authorizedAt: nullSchema4, executingAt: nullSchema4, deniedAt: nullSchema4, completedAt: timestampSchema3, failureCode: { const: executionFailureCode }, result: nullSchema4 }),
|
|
15581
|
+
strictObjectSchema({ ...base3("failed"), authorizedAt: timestampSchema3, executingAt: nullSchema4, deniedAt: nullSchema4, completedAt: timestampSchema3, failureCode: { const: executionFailureCode }, result: nullSchema4 }),
|
|
15582
|
+
strictObjectSchema({ ...base3("failed"), authorizedAt: timestampSchema3, executingAt: timestampSchema3, deniedAt: nullSchema4, completedAt: timestampSchema3, failureCode: { const: executionFailureCode }, result: nullSchema4 }),
|
|
15583
|
+
strictObjectSchema({ ...base3("denied"), authorizedAt: nullSchema4, executingAt: nullSchema4, deniedAt: timestampSchema3, completedAt: timestampSchema3, failureCode: { const: denialCode }, result: nullSchema4 })
|
|
15249
15584
|
];
|
|
15250
15585
|
}
|
|
15251
|
-
var jsonValueSchema2, jsonSchemaDocumentSchema, nullableRevisionSchema3, nullableUuidSchema2, httpsUrlSchema, agentMarketIpfsUriSchema, nullableIpfsUriSchema, avatarMediaTypeSchema, artifactCountPolicySchema, artifactBatchContractSchema, integrationOptionsResponseSchema, createAgentWithInitialVersionRequestSchema, agentResponseSchema, agentListItemSchema, agentListResponseSchema, agentOnAuditOfferSchema, agentOnAuditReportResponseSchema, versionResponseSchema, replaceVersionAvailabilityRequestSchema, refundCampaignSummarySchema, versionAvailabilityResponseSchema, createAdditionalVersionRequestSchema, beginVersionDraftRequestSchema, beginVersionDraftResponseSchema, abandonVersionDraftRequestSchema, catalogChildRevisionStatusValues, ABANDON_VERSION_DRAFT_CHILD_STATUS_CONTRACT, abandonVersionDraftResponseSchema, agentOnRuntimeRequestSchema, directRuntimeRequestSchema, replaceRuntimeRequestSchema, runtimeResponseSchema, replaceAgentOnRailRequestSchema, agentOnRailResponseSchema, agentOnOfferModeValues, offerConfigurationProperties, createOfferRequestSchema, replaceOfferRequestSchema, offerResponseSchema, offerListResponseSchema, replaceDirectContractRequestSchema, directContractResponseSchema, createCredentialSetupRequestSchema, CREDENTIAL_SETUP_TTL_CONTRACT, credentialSetupBase, agentOnMaterialDownloadActionSchema, directMaterialFulfillmentActionSchema, requiresLocalActionSchema, credentialSetupResponseSchema, AGENTON_PLATFORM_ISSUED_CREDENTIAL_CONTRACT, agentOnConnectionTargetSchema, directConnectionTargetSchema, createConnectionTestRequestSchema, createPublishIntentRequestSchema, createOfferRetirementIntentRequestSchema, publicationIntentResponseSchema, OPERATION_STATUS_CONTRACT, timestampSchema3,
|
|
15586
|
+
var jsonValueSchema2, jsonSchemaDocumentSchema, nullableRevisionSchema3, nullableUuidSchema2, httpsUrlSchema, agentMarketIpfsUriSchema, nullableIpfsUriSchema, avatarMediaTypeSchema, artifactCountPolicySchema, artifactBatchContractSchema, integrationOptionsResponseSchema, createAgentWithInitialVersionRequestSchema, agentResponseSchema, agentListItemSchema, agentListResponseSchema, agentOnAuditOfferSchema, agentOnAuditReportResponseSchema, versionResponseSchema, replaceVersionAvailabilityRequestSchema, refundCampaignSummarySchema, versionAvailabilityResponseSchema, createAdditionalVersionRequestSchema, beginVersionDraftRequestSchema, beginVersionDraftResponseSchema, abandonVersionDraftRequestSchema, catalogChildRevisionStatusValues, ABANDON_VERSION_DRAFT_CHILD_STATUS_CONTRACT, abandonVersionDraftResponseSchema, agentOnRuntimeRequestSchema, directRuntimeRequestSchema, replaceRuntimeRequestSchema, runtimeResponseSchema, replaceAgentOnRailRequestSchema, agentOnRailResponseSchema, agentOnOfferModeValues, offerConfigurationProperties, createOfferRequestSchema, replaceOfferRequestSchema, offerResponseSchema, offerListResponseSchema, replaceDirectContractRequestSchema, directContractResponseSchema, createCredentialSetupRequestSchema, CREDENTIAL_SETUP_TTL_CONTRACT, credentialSetupBase, agentOnMaterialDownloadActionSchema, directMaterialFulfillmentActionSchema, requiresLocalActionSchema, credentialSetupResponseSchema, AGENTON_PLATFORM_ISSUED_CREDENTIAL_CONTRACT, agentOnConnectionTargetSchema, directConnectionTargetSchema, createConnectionTestRequestSchema, createPublishIntentRequestSchema, createOfferRetirementIntentRequestSchema, publicationIntentResponseSchema, OPERATION_STATUS_CONTRACT, timestampSchema3, nullSchema4, signedBase, publicationOperationResultSchema, localPurchaseOperationResultSchema, localPurchaseChildrenSchema, publicationOperationVariants, localPurchaseOperationVariants, signedOperationResponseSchema, connectionBase, connectionTestResultSchema, connectionOperationVariants, connectionTestOperationResponseSchema, buyerOperationFailureSchema, p1OperationBase, p1OperationVariants, agentOnTaskOperationBase, agentOnTaskOperationVariants, operationResponseSchema, connectionTestAcceptedResponseSchema;
|
|
15252
15587
|
var init_merchant = __esm({
|
|
15253
15588
|
"../../packages/agent-market-contracts/src/v1/merchant.ts"() {
|
|
15254
15589
|
"use strict";
|
|
@@ -15257,16 +15592,7 @@ var init_merchant = __esm({
|
|
|
15257
15592
|
init_validation_input();
|
|
15258
15593
|
init_display();
|
|
15259
15594
|
init_actions();
|
|
15260
|
-
jsonValueSchema2 =
|
|
15261
|
-
anyOf: Object.freeze([
|
|
15262
|
-
Object.freeze({ type: "object", additionalProperties: true }),
|
|
15263
|
-
Object.freeze({ type: "array", items: true }),
|
|
15264
|
-
Object.freeze({ type: "string" }),
|
|
15265
|
-
Object.freeze({ type: "number" }),
|
|
15266
|
-
Object.freeze({ type: "boolean" }),
|
|
15267
|
-
Object.freeze({ type: "null" })
|
|
15268
|
-
])
|
|
15269
|
-
});
|
|
15595
|
+
jsonValueSchema2 = jsonValueTypesSchema;
|
|
15270
15596
|
jsonSchemaDocumentSchema = { type: ["object", "boolean"] };
|
|
15271
15597
|
nullableRevisionSchema3 = { anyOf: [positiveRevisionSchema, { type: "null" }] };
|
|
15272
15598
|
nullableUuidSchema2 = { anyOf: [canonicalUuidSchema, { type: "null" }] };
|
|
@@ -15623,7 +15949,7 @@ var init_merchant = __esm({
|
|
|
15623
15949
|
agenton_task: Object.freeze(["submitted", "working", "input_required", "completed", "failed", "canceled", "expired"])
|
|
15624
15950
|
});
|
|
15625
15951
|
timestampSchema3 = { type: "string", format: "date-time" };
|
|
15626
|
-
|
|
15952
|
+
nullSchema4 = { type: "null" };
|
|
15627
15953
|
signedBase = (kind, status) => ({
|
|
15628
15954
|
operationId: canonicalUuidSchema,
|
|
15629
15955
|
kind: { const: kind },
|
|
@@ -15633,7 +15959,7 @@ var init_merchant = __esm({
|
|
|
15633
15959
|
});
|
|
15634
15960
|
publicationOperationResultSchema = strictObjectSchema({
|
|
15635
15961
|
serviceVersionId: canonicalUuidSchema,
|
|
15636
|
-
publicationGeneration: { anyOf: [nonNegativeGenerationSchema,
|
|
15962
|
+
publicationGeneration: { anyOf: [nonNegativeGenerationSchema, nullSchema4] },
|
|
15637
15963
|
activeVersionRevision: positiveRevisionSchema
|
|
15638
15964
|
});
|
|
15639
15965
|
localPurchaseOperationResultSchema = strictObjectSchema({
|
|
@@ -15674,13 +16000,13 @@ var init_merchant = __esm({
|
|
|
15674
16000
|
passed: { const: true }
|
|
15675
16001
|
});
|
|
15676
16002
|
connectionOperationVariants = [
|
|
15677
|
-
strictObjectSchema({ ...connectionBase("authorized"), preparingAt:
|
|
15678
|
-
strictObjectSchema({ ...connectionBase("executing"), preparingAt: timestampSchema3, executingAt: timestampSchema3, completedAt:
|
|
15679
|
-
strictObjectSchema({ ...connectionBase("succeeded"), preparingAt: timestampSchema3, executingAt: timestampSchema3, completedAt: timestampSchema3, failureCode:
|
|
15680
|
-
strictObjectSchema({ ...connectionBase("failed"), preparingAt:
|
|
15681
|
-
strictObjectSchema({ ...connectionBase("failed"), preparingAt: timestampSchema3, executingAt:
|
|
15682
|
-
strictObjectSchema({ ...connectionBase("failed"), preparingAt: timestampSchema3, executingAt: timestampSchema3, completedAt: timestampSchema3, failureCode: { const: "CONNECTION_TEST_FAILED" }, result:
|
|
15683
|
-
strictObjectSchema({ ...connectionBase("uncertain"), preparingAt: timestampSchema3, executingAt: timestampSchema3, completedAt: timestampSchema3, failureCode: { const: "CONNECTION_TEST_UNCERTAIN" }, result:
|
|
16003
|
+
strictObjectSchema({ ...connectionBase("authorized"), preparingAt: nullSchema4, executingAt: nullSchema4, completedAt: nullSchema4, failureCode: nullSchema4, result: nullSchema4 }),
|
|
16004
|
+
strictObjectSchema({ ...connectionBase("executing"), preparingAt: timestampSchema3, executingAt: timestampSchema3, completedAt: nullSchema4, failureCode: nullSchema4, result: nullSchema4 }),
|
|
16005
|
+
strictObjectSchema({ ...connectionBase("succeeded"), preparingAt: timestampSchema3, executingAt: timestampSchema3, completedAt: timestampSchema3, failureCode: nullSchema4, result: connectionTestResultSchema }),
|
|
16006
|
+
strictObjectSchema({ ...connectionBase("failed"), preparingAt: nullSchema4, executingAt: nullSchema4, completedAt: timestampSchema3, failureCode: { const: "CONNECTION_TEST_FAILED" }, result: nullSchema4 }),
|
|
16007
|
+
strictObjectSchema({ ...connectionBase("failed"), preparingAt: timestampSchema3, executingAt: nullSchema4, completedAt: timestampSchema3, failureCode: { const: "CONNECTION_TEST_FAILED" }, result: nullSchema4 }),
|
|
16008
|
+
strictObjectSchema({ ...connectionBase("failed"), preparingAt: timestampSchema3, executingAt: timestampSchema3, completedAt: timestampSchema3, failureCode: { const: "CONNECTION_TEST_FAILED" }, result: nullSchema4 }),
|
|
16009
|
+
strictObjectSchema({ ...connectionBase("uncertain"), preparingAt: timestampSchema3, executingAt: timestampSchema3, completedAt: timestampSchema3, failureCode: { const: "CONNECTION_TEST_UNCERTAIN" }, result: nullSchema4 })
|
|
15684
16010
|
];
|
|
15685
16011
|
connectionTestOperationResponseSchema = Object.freeze({
|
|
15686
16012
|
oneOf: connectionOperationVariants,
|
|
@@ -15705,13 +16031,13 @@ var init_merchant = __esm({
|
|
|
15705
16031
|
p1OperationVariants = [
|
|
15706
16032
|
...["awaiting_dispatch", "dispatching", "input_required"].map((status) => strictObjectSchema({
|
|
15707
16033
|
...p1OperationBase(status),
|
|
15708
|
-
completedAt:
|
|
15709
|
-
failureCode:
|
|
16034
|
+
completedAt: nullSchema4,
|
|
16035
|
+
failureCode: nullSchema4
|
|
15710
16036
|
})),
|
|
15711
16037
|
strictObjectSchema({
|
|
15712
16038
|
...p1OperationBase("completed"),
|
|
15713
16039
|
completedAt: timestampSchema3,
|
|
15714
|
-
failureCode:
|
|
16040
|
+
failureCode: nullSchema4
|
|
15715
16041
|
}),
|
|
15716
16042
|
strictObjectSchema({
|
|
15717
16043
|
...p1OperationBase("failed"),
|
|
@@ -15731,13 +16057,13 @@ var init_merchant = __esm({
|
|
|
15731
16057
|
agentOnTaskOperationVariants = [
|
|
15732
16058
|
...["submitted", "working", "input_required"].map((status) => strictObjectSchema({
|
|
15733
16059
|
...agentOnTaskOperationBase(status),
|
|
15734
|
-
completedAt:
|
|
15735
|
-
failureCode:
|
|
16060
|
+
completedAt: nullSchema4,
|
|
16061
|
+
failureCode: nullSchema4
|
|
15736
16062
|
})),
|
|
15737
16063
|
strictObjectSchema({
|
|
15738
16064
|
...agentOnTaskOperationBase("completed"),
|
|
15739
16065
|
completedAt: timestampSchema3,
|
|
15740
|
-
failureCode:
|
|
16066
|
+
failureCode: nullSchema4
|
|
15741
16067
|
}),
|
|
15742
16068
|
strictObjectSchema({
|
|
15743
16069
|
...agentOnTaskOperationBase("failed"),
|
|
@@ -15747,7 +16073,7 @@ var init_merchant = __esm({
|
|
|
15747
16073
|
strictObjectSchema({
|
|
15748
16074
|
...agentOnTaskOperationBase("canceled"),
|
|
15749
16075
|
completedAt: timestampSchema3,
|
|
15750
|
-
failureCode:
|
|
16076
|
+
failureCode: nullSchema4
|
|
15751
16077
|
}),
|
|
15752
16078
|
strictObjectSchema({
|
|
15753
16079
|
...agentOnTaskOperationBase("expired"),
|
|
@@ -15771,7 +16097,7 @@ var init_merchant = __esm({
|
|
|
15771
16097
|
status: { const: "authorized" },
|
|
15772
16098
|
attempt: positiveRevisionSchema,
|
|
15773
16099
|
generation: positiveRevisionSchema,
|
|
15774
|
-
preparingAt:
|
|
16100
|
+
preparingAt: nullSchema4
|
|
15775
16101
|
});
|
|
15776
16102
|
}
|
|
15777
16103
|
});
|
|
@@ -16105,7 +16431,7 @@ function pageSchema(schema5) {
|
|
|
16105
16431
|
services: { ...properties.services, items: publicCatalogWireServiceSchema }
|
|
16106
16432
|
} };
|
|
16107
16433
|
}
|
|
16108
|
-
var descriptions,
|
|
16434
|
+
var descriptions, described3, catalogChainIdSchema, summaryProperties, publicCatalogWireServiceSchema, publicCatalogWireListResponseSchema, publicCatalogWireSearchResponseSchema, publicCatalogWireDetailResponseSchema;
|
|
16109
16435
|
var init_public_catalog_wire = __esm({
|
|
16110
16436
|
"../../packages/agent-market-contracts/src/v1/public-catalog-wire.ts"() {
|
|
16111
16437
|
"use strict";
|
|
@@ -16134,13 +16460,13 @@ var init_public_catalog_wire = __esm({
|
|
|
16134
16460
|
bytes: "Size of the report file in bytes, up to 20 MiB.",
|
|
16135
16461
|
uploadedAt: "Upload timestamp recorded for the audit report."
|
|
16136
16462
|
};
|
|
16137
|
-
|
|
16463
|
+
described3 = describeSummary(publicBuyerServiceSchema).properties;
|
|
16138
16464
|
catalogChainIdSchema = Object.freeze({
|
|
16139
16465
|
type: "integer",
|
|
16140
16466
|
minimum: 1,
|
|
16141
16467
|
description: "EVM chain ID for this service's payments. Currently 8453 (Base mainnet) in production and 84532 (Base Sepolia) in test."
|
|
16142
16468
|
});
|
|
16143
|
-
summaryProperties = Object.fromEntries(Object.entries(
|
|
16469
|
+
summaryProperties = Object.fromEntries(Object.entries(described3).filter(([name]) => name !== "versionRevision" && name !== "runtimeConfigHash"));
|
|
16144
16470
|
publicCatalogWireServiceSchema = {
|
|
16145
16471
|
...strictObjectSchema({ ...summaryProperties, chainId: catalogChainIdSchema }),
|
|
16146
16472
|
description: "Public catalog summary for one agent service."
|
|
@@ -16154,7 +16480,7 @@ var init_public_catalog_wire = __esm({
|
|
|
16154
16480
|
properties: {
|
|
16155
16481
|
...variant.properties,
|
|
16156
16482
|
chainId: catalogChainIdSchema,
|
|
16157
|
-
paymentToken:
|
|
16483
|
+
paymentToken: described3.paymentToken
|
|
16158
16484
|
},
|
|
16159
16485
|
required: [...variant.required, "chainId"]
|
|
16160
16486
|
}))
|
|
@@ -16223,6 +16549,7 @@ var init_operations = __esm({
|
|
|
16223
16549
|
"use strict";
|
|
16224
16550
|
init_localization();
|
|
16225
16551
|
init_artifacts();
|
|
16552
|
+
init_transfers();
|
|
16226
16553
|
init_agent_cli();
|
|
16227
16554
|
init_buyer();
|
|
16228
16555
|
init_testnet_purchase_v1();
|
|
@@ -16705,6 +17032,18 @@ var init_operations = __esm({
|
|
|
16705
17032
|
integrationFamilies: families.active,
|
|
16706
17033
|
writes: false
|
|
16707
17034
|
}),
|
|
17035
|
+
"buyer_call_eligibility.get": operation({
|
|
17036
|
+
id: "buyer_call_eligibility.get",
|
|
17037
|
+
requiredScope: "agent_market:buyer:read",
|
|
17038
|
+
http: http("get", "/api/v1/agent-market/buyer/call-eligibility", 200, {
|
|
17039
|
+
querySchema: callEligibilityQuerySchema,
|
|
17040
|
+
responseSchema: callEligibilityResponseSchema
|
|
17041
|
+
}),
|
|
17042
|
+
mcp: { name: "agent_market_buyer_call_eligibility_get" },
|
|
17043
|
+
cli: null,
|
|
17044
|
+
integrationFamilies: families.active,
|
|
17045
|
+
writes: false
|
|
17046
|
+
}),
|
|
16708
17047
|
"buyer_p1_invocations.create": operation({
|
|
16709
17048
|
id: "buyer_p1_invocations.create",
|
|
16710
17049
|
requiredScope: "agent_market:buyer:invoke",
|
|
@@ -16797,21 +17136,17 @@ var init_operations = __esm({
|
|
|
16797
17136
|
integrationFamilies: families.agenton,
|
|
16798
17137
|
writes: true
|
|
16799
17138
|
}),
|
|
16800
|
-
"
|
|
16801
|
-
id: "
|
|
16802
|
-
requiredScope: "agent_market:buyer:
|
|
16803
|
-
http: http("
|
|
16804
|
-
|
|
16805
|
-
responseSchema:
|
|
16806
|
-
idempotencyRequired: true,
|
|
16807
|
-
ifMatchRequired: true,
|
|
16808
|
-
ifMatchResourceKind: "task",
|
|
16809
|
-
etagReturned: true
|
|
17139
|
+
"buyer_runs.list": operation({
|
|
17140
|
+
id: "buyer_runs.list",
|
|
17141
|
+
requiredScope: "agent_market:buyer:read",
|
|
17142
|
+
http: http("get", "/api/v1/agent-market/buyer/runs", 200, {
|
|
17143
|
+
querySchema: buyerRunsQuerySchema,
|
|
17144
|
+
responseSchema: buyerRunsResponseSchema
|
|
16810
17145
|
}),
|
|
16811
|
-
mcp: { name: "
|
|
17146
|
+
mcp: { name: "agent_market_buyer_runs_list" },
|
|
16812
17147
|
cli: null,
|
|
16813
|
-
integrationFamilies: families.
|
|
16814
|
-
writes:
|
|
17148
|
+
integrationFamilies: families.active,
|
|
17149
|
+
writes: false
|
|
16815
17150
|
}),
|
|
16816
17151
|
"buyer_direct_invocations.create": operation({
|
|
16817
17152
|
id: "buyer_direct_invocations.create",
|
|
@@ -16826,31 +17161,17 @@ var init_operations = __esm({
|
|
|
16826
17161
|
integrationFamilies: families.direct,
|
|
16827
17162
|
writes: true
|
|
16828
17163
|
}),
|
|
16829
|
-
"
|
|
16830
|
-
id: "
|
|
17164
|
+
"buyer_input_artifacts.prepare": operation({
|
|
17165
|
+
id: "buyer_input_artifacts.prepare",
|
|
16831
17166
|
requiredScope: "agent_market:buyer:invoke",
|
|
16832
|
-
http: http("
|
|
16833
|
-
|
|
16834
|
-
|
|
16835
|
-
"Content-Length": positiveIntegerStringSchema,
|
|
16836
|
-
"X-Finch-Content-SHA256": hex32Schema
|
|
16837
|
-
},
|
|
17167
|
+
http: http("post", "/api/v1/agent-market/buyer/offers/{offerId}/input-artifacts", 201, {
|
|
17168
|
+
requestSchema: prepareInputArtifactRequestSchema,
|
|
17169
|
+
responseSchema: prepareInputArtifactResponseSchema,
|
|
16838
17170
|
idempotencyRequired: true
|
|
16839
17171
|
}),
|
|
16840
|
-
mcp: {
|
|
16841
|
-
name: "agent_market_buyer_artifact_upload_base64",
|
|
16842
|
-
sensitiveContentFields: [MCP_ARTIFACT_BASE64_CONTRACT.field],
|
|
16843
|
-
sensitive_content: true,
|
|
16844
|
-
echoSensitiveContent: false,
|
|
16845
|
-
logSensitiveContent: false,
|
|
16846
|
-
compositeInputProperties: {
|
|
16847
|
-
expectedByteLength: positiveIntegerStringSchema,
|
|
16848
|
-
contentSha256: hex32Schema
|
|
16849
|
-
},
|
|
16850
|
-
compositeInputRequired: ["expectedByteLength", "contentSha256"]
|
|
16851
|
-
},
|
|
17172
|
+
mcp: { name: "agent_market_buyer_input_artifact_prepare" },
|
|
16852
17173
|
cli: null,
|
|
16853
|
-
integrationFamilies: families.
|
|
17174
|
+
integrationFamilies: families.agenton,
|
|
16854
17175
|
writes: true
|
|
16855
17176
|
}),
|
|
16856
17177
|
"buyer_artifacts.download": operation({
|
|
@@ -16870,36 +17191,24 @@ var init_operations = __esm({
|
|
|
16870
17191
|
integrationFamilies: families.active,
|
|
16871
17192
|
writes: false
|
|
16872
17193
|
}),
|
|
16873
|
-
"
|
|
16874
|
-
id: "
|
|
16875
|
-
requiredScope: "agent_market:
|
|
16876
|
-
http: http("
|
|
16877
|
-
|
|
16878
|
-
idempotencyRequired: true
|
|
17194
|
+
"buyer_artifact_download_links.create": operation({
|
|
17195
|
+
id: "buyer_artifact_download_links.create",
|
|
17196
|
+
requiredScope: "agent_market:buyer:read",
|
|
17197
|
+
http: http("post", "/api/v1/agent-market/buyer/artifacts/{artifactId}/download-links", 201, {
|
|
17198
|
+
responseSchema: artifactDownloadLinkResponseSchema
|
|
16879
17199
|
}),
|
|
16880
|
-
mcp: {
|
|
16881
|
-
name: "agent_market_artifact_upload_base64",
|
|
16882
|
-
sensitiveContentFields: [MCP_ARTIFACT_BASE64_CONTRACT.field],
|
|
16883
|
-
sensitive_content: true,
|
|
16884
|
-
echoSensitiveContent: false,
|
|
16885
|
-
logSensitiveContent: false
|
|
16886
|
-
},
|
|
17200
|
+
mcp: { name: "agent_market_buyer_artifact_download_link_create" },
|
|
16887
17201
|
cli: null,
|
|
16888
|
-
|
|
17202
|
+
integrationFamilies: families.active,
|
|
17203
|
+
writes: false
|
|
16889
17204
|
}),
|
|
16890
|
-
"
|
|
16891
|
-
id: "
|
|
16892
|
-
requiredScope: "agent_market:merchant:
|
|
16893
|
-
http: http("
|
|
16894
|
-
|
|
17205
|
+
"merchant_avatar_uploads.prepare": operation({
|
|
17206
|
+
id: "merchant_avatar_uploads.prepare",
|
|
17207
|
+
requiredScope: "agent_market:merchant:write",
|
|
17208
|
+
http: http("post", "/api/v1/agent-market/merchant/avatar-uploads", 201, {
|
|
17209
|
+
responseSchema: prepareAvatarUploadResponseSchema
|
|
16895
17210
|
}),
|
|
16896
|
-
mcp: {
|
|
16897
|
-
name: "agent_market_artifact_download_base64",
|
|
16898
|
-
sensitiveContentFields: [MCP_ARTIFACT_BASE64_CONTRACT.field],
|
|
16899
|
-
sensitive_content: true,
|
|
16900
|
-
echoSensitiveContent: false,
|
|
16901
|
-
logSensitiveContent: false
|
|
16902
|
-
},
|
|
17211
|
+
mcp: { name: "agent_market_merchant_avatar_upload_prepare" },
|
|
16903
17212
|
cli: null,
|
|
16904
17213
|
writes: false
|
|
16905
17214
|
}),
|
|
@@ -16989,25 +17298,19 @@ var init_operations = __esm({
|
|
|
16989
17298
|
"merchant_credential_setups.create": "merchant_credential_setups.create",
|
|
16990
17299
|
"merchant_connection_tests.create": "connection_test",
|
|
16991
17300
|
"merchant_publish_intents.create": "publish",
|
|
16992
|
-
"artifacts.upload": "artifacts.upload",
|
|
16993
17301
|
"buyer_purchase_intents.create": "local_purchase",
|
|
16994
17302
|
"buyer_p1_invocations.create": "buyer_p1_invocations.create",
|
|
16995
17303
|
"buyer_p1_invocations.continue": "buyer_p1_invocations.continue",
|
|
16996
17304
|
"buyer_tasks.create": "buyer_tasks.create",
|
|
16997
17305
|
"buyer_tasks.input": "buyer_tasks.input",
|
|
16998
|
-
"buyer_tasks.cancel": "buyer_tasks.cancel",
|
|
16999
17306
|
"buyer_direct_invocations.create": "buyer_direct_invocations.create",
|
|
17000
|
-
"
|
|
17307
|
+
"buyer_input_artifacts.prepare": "buyer_input_artifacts.prepare",
|
|
17001
17308
|
"signing_intents.approve": "signing_approve",
|
|
17002
17309
|
"signing_intents.deny": "signing_deny",
|
|
17003
17310
|
"credential_setups.claim": "credential_claim",
|
|
17004
17311
|
"credential_setups.fulfill": "credential_fulfill"
|
|
17005
17312
|
});
|
|
17006
17313
|
fingerprintSemanticOverrides = Object.freeze({
|
|
17007
|
-
"artifacts.upload": Object.freeze({
|
|
17008
|
-
properties: Object.freeze({ byteLength: positiveIntegerStringSchema, contentSha256: hex32Schema }),
|
|
17009
|
-
required: Object.freeze(["byteLength", "contentSha256"])
|
|
17010
|
-
}),
|
|
17011
17314
|
"credential_setups.claim": Object.freeze({ properties: Object.freeze({}), required: Object.freeze([]) }),
|
|
17012
17315
|
"credential_setups.fulfill": Object.freeze({
|
|
17013
17316
|
variants: Object.freeze([
|
|
@@ -17574,6 +17877,7 @@ var init_v1 = __esm({
|
|
|
17574
17877
|
init_public_catalog_wire();
|
|
17575
17878
|
init_snapshot();
|
|
17576
17879
|
init_testnet_purchase_v1();
|
|
17880
|
+
init_transfers();
|
|
17577
17881
|
init_validation_input();
|
|
17578
17882
|
init_localization();
|
|
17579
17883
|
}
|
|
@@ -32943,80 +33247,92 @@ var init_agent_service = __esm({
|
|
|
32943
33247
|
deployments: {
|
|
32944
33248
|
test: {
|
|
32945
33249
|
enabled: true,
|
|
32946
|
-
|
|
32947
|
-
|
|
32948
|
-
|
|
32949
|
-
|
|
32950
|
-
|
|
32951
|
-
|
|
32952
|
-
|
|
32953
|
-
|
|
32954
|
-
|
|
32955
|
-
|
|
32956
|
-
|
|
32957
|
-
|
|
32958
|
-
|
|
32959
|
-
|
|
32960
|
-
|
|
32961
|
-
|
|
32962
|
-
|
|
32963
|
-
|
|
32964
|
-
|
|
32965
|
-
|
|
32966
|
-
|
|
32967
|
-
|
|
32968
|
-
|
|
32969
|
-
|
|
32970
|
-
|
|
32971
|
-
|
|
32972
|
-
|
|
32973
|
-
|
|
32974
|
-
|
|
32975
|
-
|
|
32976
|
-
|
|
32977
|
-
|
|
32978
|
-
|
|
32979
|
-
|
|
33250
|
+
defaultChainId: 84532,
|
|
33251
|
+
chains: {
|
|
33252
|
+
"84532": {
|
|
33253
|
+
enabled: true,
|
|
33254
|
+
network: {
|
|
33255
|
+
chainId: 84532,
|
|
33256
|
+
name: "Base Sepolia",
|
|
33257
|
+
explorerUrl: "https://sepolia.basescan.org",
|
|
33258
|
+
defaultRpcUrls: [
|
|
33259
|
+
"https://sepolia.base.org",
|
|
33260
|
+
"https://base-sepolia-rpc.publicnode.com"
|
|
33261
|
+
]
|
|
33262
|
+
},
|
|
33263
|
+
sourceRepository: "FinchipAI/Finch-Agent-Service-Protocol",
|
|
33264
|
+
sourceCommit: "c3066da940945f9bf48d4770a7f89a1e42676771",
|
|
33265
|
+
contracts: {
|
|
33266
|
+
protocol: "0xad9041b2299ffcf01f98cbdb8c053bfad7396d90",
|
|
33267
|
+
vault: "0xd57b21072200c15273617bd13f1e53c9cfacb5fb",
|
|
33268
|
+
vaultImplementation: "0x61669707dcdcd976df19d095bda4a05728e240e0",
|
|
33269
|
+
vaultProxyAdmin: "0xd9d11f658af6f0a056b77b8268f7b2dc840d0b8a",
|
|
33270
|
+
paymentToken: "0x036cbd53842c5426634e7929541ec2318f3dcf7e"
|
|
33271
|
+
},
|
|
33272
|
+
authority: {
|
|
33273
|
+
admin: "0xe2c7b4967df7a83c13e5f504c4f58dbc5a8fd60c",
|
|
33274
|
+
treasury: "0xe2c7b4967df7a83c13e5f504c4f58dbc5a8fd60c",
|
|
33275
|
+
settlementAttestor: "0xe77ec989158829fe2182868d442a8170c9e4e337",
|
|
33276
|
+
refundAttestor: "0xe77ec989158829fe2182868d442a8170c9e4e337",
|
|
33277
|
+
freezeKeeper: "0xe2c7b4967df7a83c13e5f504c4f58dbc5a8fd60c"
|
|
33278
|
+
},
|
|
33279
|
+
deployment: {
|
|
33280
|
+
firstBlock: "45675409",
|
|
33281
|
+
completedBlock: "45675424",
|
|
33282
|
+
confirmations: 2,
|
|
33283
|
+
deploymentHash: "0x974663ec798a69cc5f98f119dcbdd091235424d7ac519cdb878fa0ed8d556c6d"
|
|
33284
|
+
},
|
|
33285
|
+
policy: {
|
|
33286
|
+
paymentTokenSymbol: "USDC",
|
|
33287
|
+
paymentTokenDecimals: 6
|
|
33288
|
+
}
|
|
33289
|
+
}
|
|
32980
33290
|
}
|
|
32981
33291
|
},
|
|
32982
33292
|
production: {
|
|
32983
33293
|
enabled: true,
|
|
32984
|
-
|
|
32985
|
-
|
|
32986
|
-
|
|
32987
|
-
|
|
32988
|
-
|
|
32989
|
-
|
|
32990
|
-
|
|
32991
|
-
|
|
32992
|
-
|
|
32993
|
-
|
|
32994
|
-
|
|
32995
|
-
|
|
32996
|
-
|
|
32997
|
-
|
|
32998
|
-
|
|
32999
|
-
|
|
33000
|
-
|
|
33001
|
-
|
|
33002
|
-
|
|
33003
|
-
|
|
33004
|
-
|
|
33005
|
-
|
|
33006
|
-
|
|
33007
|
-
|
|
33008
|
-
|
|
33009
|
-
|
|
33010
|
-
|
|
33011
|
-
|
|
33012
|
-
|
|
33013
|
-
|
|
33014
|
-
|
|
33015
|
-
|
|
33016
|
-
|
|
33017
|
-
|
|
33018
|
-
|
|
33019
|
-
|
|
33294
|
+
defaultChainId: 8453,
|
|
33295
|
+
chains: {
|
|
33296
|
+
"8453": {
|
|
33297
|
+
enabled: true,
|
|
33298
|
+
network: {
|
|
33299
|
+
chainId: 8453,
|
|
33300
|
+
name: "Base",
|
|
33301
|
+
explorerUrl: "https://basescan.org",
|
|
33302
|
+
defaultRpcUrls: [
|
|
33303
|
+
"https://mainnet.base.org",
|
|
33304
|
+
"https://base.drpc.org"
|
|
33305
|
+
]
|
|
33306
|
+
},
|
|
33307
|
+
sourceRepository: "FinchipAI/Finch-Agent-Service-Protocol",
|
|
33308
|
+
sourceCommit: "baf5341d0f14ac43960c13915535d6e466a6c156",
|
|
33309
|
+
contracts: {
|
|
33310
|
+
protocol: "0xe6eca38efc29613cde82d38484620092eaab079d",
|
|
33311
|
+
protocolImplementation: "0x092d79bb2941d53b378b329f8785452c134a84c1",
|
|
33312
|
+
protocolProxyAdmin: "0xc4a54503f3782ebd1e319a104e56e2b4744aa4c0",
|
|
33313
|
+
vault: "0xd2e55cfac96a620f374e581cf43ed522adef4604",
|
|
33314
|
+
vaultImplementation: "0x6e36a58f464d419039808b4fd297419224feafa0",
|
|
33315
|
+
vaultProxyAdmin: "0xd81dbdd22d7ce06a80a310462094c0eede4554fd",
|
|
33316
|
+
paymentToken: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
|
|
33317
|
+
},
|
|
33318
|
+
authority: {
|
|
33319
|
+
admin: "0x4fcb985a020dc1dd8a5dfc4adf4606eac4f68075",
|
|
33320
|
+
treasury: "0xc664d467ad91aead3711a140b57fb0e70faeb978",
|
|
33321
|
+
settlementAttestor: "0x1dc1ccc1ebdcdd6c57a8c22776883b45c6824cf6",
|
|
33322
|
+
refundAttestor: "0x1dc1ccc1ebdcdd6c57a8c22776883b45c6824cf6",
|
|
33323
|
+
freezeKeeper: "0x1dc1ccc1ebdcdd6c57a8c22776883b45c6824cf6"
|
|
33324
|
+
},
|
|
33325
|
+
deployment: {
|
|
33326
|
+
firstBlock: "50636410",
|
|
33327
|
+
completedBlock: "50636427",
|
|
33328
|
+
confirmations: 2,
|
|
33329
|
+
deploymentHash: "0x65b6fa11fdf0ad8f20f4f4fedac8986d4b19657e0816fac7238ae94ff0ccd518"
|
|
33330
|
+
},
|
|
33331
|
+
policy: {
|
|
33332
|
+
paymentTokenSymbol: "USDC",
|
|
33333
|
+
paymentTokenDecimals: 6
|
|
33334
|
+
}
|
|
33335
|
+
}
|
|
33020
33336
|
}
|
|
33021
33337
|
}
|
|
33022
33338
|
}
|
|
@@ -33097,7 +33413,8 @@ var init_skill_protocol = __esm({
|
|
|
33097
33413
|
defaultRpcUrls: [
|
|
33098
33414
|
"https://sepolia.base.org",
|
|
33099
33415
|
"https://base-sepolia-rpc.publicnode.com"
|
|
33100
|
-
]
|
|
33416
|
+
],
|
|
33417
|
+
maxLogBlockRange: 1e3
|
|
33101
33418
|
},
|
|
33102
33419
|
sourceRepository: "FinchipAI/finchip-protocol",
|
|
33103
33420
|
sourceCommit: "2944849eabf1f1a8f5ccfd03c2f92502487002db",
|
|
@@ -33270,6 +33587,34 @@ var init_skill_protocol = __esm({
|
|
|
33270
33587
|
factoryFirstBlock: "498556878",
|
|
33271
33588
|
confirmations: 2
|
|
33272
33589
|
}
|
|
33590
|
+
},
|
|
33591
|
+
"43114": {
|
|
33592
|
+
enabled: true,
|
|
33593
|
+
network: {
|
|
33594
|
+
chainId: 43114,
|
|
33595
|
+
name: "Avalanche C-Chain",
|
|
33596
|
+
explorerUrl: "https://snowtrace.io",
|
|
33597
|
+
defaultRpcUrls: [
|
|
33598
|
+
"https://api.avax.network/ext/bc/C/rpc",
|
|
33599
|
+
"https://avalanche-c-chain-rpc.publicnode.com"
|
|
33600
|
+
]
|
|
33601
|
+
},
|
|
33602
|
+
sourceRepository: "FinchipAI/finchip-protocol",
|
|
33603
|
+
sourceCommit: "61982867d271ea9ebf0730b1a650bee1b9894642",
|
|
33604
|
+
abiSourceCommit: "61982867d271ea9ebf0730b1a650bee1b9894642",
|
|
33605
|
+
contracts: {
|
|
33606
|
+
skillToken: "0xcb19ea4fa56c3fc0c03892ec4b76e546572ba2b8",
|
|
33607
|
+
revenueRight: "0x0f9b050b69cd0361ab3baed1adff4a7faa709fbc",
|
|
33608
|
+
skillInstance: "0x1a111ef24408805b76913e03d6765a9be3313c6e",
|
|
33609
|
+
skillFactory: "0x6f75930c9631c77d88e979ad98a209fb896e9764",
|
|
33610
|
+
skillMarket: "0x200e39cb510a36a5b6d26efba61993af0aab70cf",
|
|
33611
|
+
feeRouter: "0xe520cd670add2f8813e3c76bd69a033c5cfa5b92"
|
|
33612
|
+
},
|
|
33613
|
+
deployment: {
|
|
33614
|
+
firstBlock: "96438446",
|
|
33615
|
+
factoryFirstBlock: "96438471",
|
|
33616
|
+
confirmations: 2
|
|
33617
|
+
}
|
|
33273
33618
|
}
|
|
33274
33619
|
}
|
|
33275
33620
|
}
|
|
@@ -33288,81 +33633,93 @@ var init_task_protocol = __esm({
|
|
|
33288
33633
|
deployments: {
|
|
33289
33634
|
test: {
|
|
33290
33635
|
enabled: true,
|
|
33291
|
-
|
|
33292
|
-
|
|
33293
|
-
|
|
33294
|
-
|
|
33295
|
-
|
|
33296
|
-
|
|
33297
|
-
|
|
33298
|
-
|
|
33299
|
-
|
|
33300
|
-
|
|
33301
|
-
|
|
33302
|
-
|
|
33303
|
-
|
|
33304
|
-
|
|
33305
|
-
|
|
33306
|
-
|
|
33307
|
-
|
|
33308
|
-
|
|
33309
|
-
|
|
33310
|
-
|
|
33311
|
-
|
|
33312
|
-
|
|
33313
|
-
|
|
33314
|
-
|
|
33315
|
-
|
|
33316
|
-
|
|
33317
|
-
|
|
33318
|
-
|
|
33319
|
-
|
|
33320
|
-
|
|
33321
|
-
|
|
33322
|
-
|
|
33323
|
-
|
|
33324
|
-
|
|
33325
|
-
|
|
33636
|
+
defaultChainId: 84532,
|
|
33637
|
+
chains: {
|
|
33638
|
+
"84532": {
|
|
33639
|
+
enabled: true,
|
|
33640
|
+
network: {
|
|
33641
|
+
chainId: 84532,
|
|
33642
|
+
name: "Base Sepolia",
|
|
33643
|
+
explorerUrl: "https://sepolia.basescan.org",
|
|
33644
|
+
defaultRpcUrls: [
|
|
33645
|
+
"https://sepolia.base.org",
|
|
33646
|
+
"https://base-sepolia-rpc.publicnode.com"
|
|
33647
|
+
]
|
|
33648
|
+
},
|
|
33649
|
+
sourceRepository: "FinchipAI/Finch-Task-Protocol",
|
|
33650
|
+
sourceCommit: "ae220fa6866c95330472ea7aa50a1d46260231c8",
|
|
33651
|
+
abiSourceCommit: "c4491b8fe85a09840c5873bc6ac142c580febd32",
|
|
33652
|
+
vaultSourceCommit: "c4491b8fe85a09840c5873bc6ac142c580febd32",
|
|
33653
|
+
contracts: {
|
|
33654
|
+
protocol: "0x233f2cb1d7b46c4e2422336b4430b556b53b8749",
|
|
33655
|
+
vault: "0x0a4fa1147b46cef51e5c8775ecbb6324e229a94d",
|
|
33656
|
+
vaultImplementation: "0x344e84544e52601a83260ba48b0215ad0c28c1cf",
|
|
33657
|
+
vaultProxyAdmin: "0xdddaa163dc4789150db52e7c89f3001f11ff2c12",
|
|
33658
|
+
paymentToken: "0x036cbd53842c5426634e7929541ec2318f3dcf7e"
|
|
33659
|
+
},
|
|
33660
|
+
authority: {
|
|
33661
|
+
admin: "0xc93c26eeac4aeb8d6c756e5d55a67baa9f83992c",
|
|
33662
|
+
treasury: "0xc93c26eeac4aeb8d6c756e5d55a67baa9f83992c",
|
|
33663
|
+
awardAttestor: "0xc3322f290d00270fde207600eb064fc7852ac122",
|
|
33664
|
+
creditGranter: "0x6f49129455e6edafe1e4c37045bc1bbe6906ea3b",
|
|
33665
|
+
freezeKeeper: "0xfb6739091592b38cbca76dfab5dab739b39accb8"
|
|
33666
|
+
},
|
|
33667
|
+
deployment: {
|
|
33668
|
+
firstBlock: "45763543",
|
|
33669
|
+
completedBlock: "45763543",
|
|
33670
|
+
confirmations: 1
|
|
33671
|
+
},
|
|
33672
|
+
policy: {
|
|
33673
|
+
paymentTokenSymbol: "USDC",
|
|
33674
|
+
paymentTokenDecimals: 6
|
|
33675
|
+
}
|
|
33676
|
+
}
|
|
33326
33677
|
}
|
|
33327
33678
|
},
|
|
33328
33679
|
production: {
|
|
33329
33680
|
enabled: true,
|
|
33330
|
-
|
|
33331
|
-
|
|
33332
|
-
|
|
33333
|
-
|
|
33334
|
-
|
|
33335
|
-
|
|
33336
|
-
|
|
33337
|
-
|
|
33338
|
-
|
|
33339
|
-
|
|
33340
|
-
|
|
33341
|
-
|
|
33342
|
-
|
|
33343
|
-
|
|
33344
|
-
|
|
33345
|
-
|
|
33346
|
-
|
|
33347
|
-
|
|
33348
|
-
|
|
33349
|
-
|
|
33350
|
-
|
|
33351
|
-
|
|
33352
|
-
|
|
33353
|
-
|
|
33354
|
-
|
|
33355
|
-
|
|
33356
|
-
|
|
33357
|
-
|
|
33358
|
-
|
|
33359
|
-
|
|
33360
|
-
|
|
33361
|
-
|
|
33362
|
-
|
|
33363
|
-
|
|
33364
|
-
|
|
33365
|
-
|
|
33681
|
+
defaultChainId: 8453,
|
|
33682
|
+
chains: {
|
|
33683
|
+
"8453": {
|
|
33684
|
+
enabled: true,
|
|
33685
|
+
network: {
|
|
33686
|
+
chainId: 8453,
|
|
33687
|
+
name: "Base",
|
|
33688
|
+
explorerUrl: "https://basescan.org",
|
|
33689
|
+
defaultRpcUrls: [
|
|
33690
|
+
"https://mainnet.base.org",
|
|
33691
|
+
"https://base.drpc.org"
|
|
33692
|
+
]
|
|
33693
|
+
},
|
|
33694
|
+
sourceRepository: "FinchipAI/Finch-Task-Protocol",
|
|
33695
|
+
sourceCommit: "456624f9a46af94d39a77dc60955f51695607fbb",
|
|
33696
|
+
abiSourceCommit: "c4491b8fe85a09840c5873bc6ac142c580febd32",
|
|
33697
|
+
contracts: {
|
|
33698
|
+
protocol: "0x5e80c59c8d369b3b36f2e809fcc99e1ee67d4eb0",
|
|
33699
|
+
protocolImplementation: "0x75e2485205a222a6a43470093a99a0330b41104c",
|
|
33700
|
+
protocolProxyAdmin: "0x081e42d65da9c7a82bd31de942b01a5b9584b743",
|
|
33701
|
+
vault: "0xddbf3b1d7df7e2ba1655b4895d228a1bed8a1f99",
|
|
33702
|
+
vaultImplementation: "0xd0d882588228db944b599eb7eabf841343644ae5",
|
|
33703
|
+
vaultProxyAdmin: "0x6e90e5a4ed8a1e4db13fac9606c5867c4e48a896",
|
|
33704
|
+
paymentToken: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
|
|
33705
|
+
},
|
|
33706
|
+
authority: {
|
|
33707
|
+
admin: "0x4fcb985a020dc1dd8a5dfc4adf4606eac4f68075",
|
|
33708
|
+
treasury: "0xc664d467ad91aead3711a140b57fb0e70faeb978",
|
|
33709
|
+
awardAttestor: "0x1dc1ccc1ebdcdd6c57a8c22776883b45c6824cf6",
|
|
33710
|
+
creditGranter: "0x1cf667f5d7075cab21fcc0497c469e7fe492b394",
|
|
33711
|
+
freezeKeeper: "0x1dc1ccc1ebdcdd6c57a8c22776883b45c6824cf6"
|
|
33712
|
+
},
|
|
33713
|
+
deployment: {
|
|
33714
|
+
firstBlock: "50517972",
|
|
33715
|
+
completedBlock: "50518702",
|
|
33716
|
+
confirmations: 2
|
|
33717
|
+
},
|
|
33718
|
+
policy: {
|
|
33719
|
+
paymentTokenSymbol: "USDC",
|
|
33720
|
+
paymentTokenDecimals: 6
|
|
33721
|
+
}
|
|
33722
|
+
}
|
|
33366
33723
|
}
|
|
33367
33724
|
}
|
|
33368
33725
|
}
|
|
@@ -33386,6 +33743,21 @@ function parseTypedRegistry(schema5, value) {
|
|
|
33386
33743
|
}
|
|
33387
33744
|
return parsed2.data;
|
|
33388
33745
|
}
|
|
33746
|
+
function clientDeploymentsByChain(protocol, deployments) {
|
|
33747
|
+
const byChain = {};
|
|
33748
|
+
for (const environment3 of ["test", "production"]) {
|
|
33749
|
+
const deployment = deployments[environment3];
|
|
33750
|
+
if (!deployment.enabled || !deployment.chains) continue;
|
|
33751
|
+
for (const key of Object.keys(deployment.chains)) {
|
|
33752
|
+
const chainId = Number(key);
|
|
33753
|
+
if (byChain[chainId]) {
|
|
33754
|
+
throw new DeploymentManifestError(`${protocol} lists chain ${chainId} in both test and production.`);
|
|
33755
|
+
}
|
|
33756
|
+
byChain[chainId] = environment3;
|
|
33757
|
+
}
|
|
33758
|
+
}
|
|
33759
|
+
return Object.freeze(byChain);
|
|
33760
|
+
}
|
|
33389
33761
|
function activeDeployment(protocol, deployments, environment3) {
|
|
33390
33762
|
if (environment3 === "local") {
|
|
33391
33763
|
throw new DeploymentManifestError(
|
|
@@ -33398,15 +33770,27 @@ function activeDeployment(protocol, deployments, environment3) {
|
|
|
33398
33770
|
}
|
|
33399
33771
|
return deployment;
|
|
33400
33772
|
}
|
|
33773
|
+
function chainOf(protocol, deployments, environment3, chainId) {
|
|
33774
|
+
const selected = chainId ?? deployments.defaultChainId;
|
|
33775
|
+
const value = deployments.chains[String(selected)];
|
|
33776
|
+
if (!value) {
|
|
33777
|
+
throw new DeploymentManifestError(
|
|
33778
|
+
`${protocol} is not deployed to chain ${selected} in ${environment3}. Deployed: ${Object.keys(deployments.chains).join(", ")}.`
|
|
33779
|
+
);
|
|
33780
|
+
}
|
|
33781
|
+
return value;
|
|
33782
|
+
}
|
|
33783
|
+
function sortedChainIds(chains) {
|
|
33784
|
+
return Object.freeze(Object.keys(chains).map(Number).sort((left, right) => left - right));
|
|
33785
|
+
}
|
|
33401
33786
|
function isTaskProtocolDeploymentEnabled(environment3) {
|
|
33402
33787
|
return environment3 !== "local" && taskRegistry.deployments[environment3].enabled;
|
|
33403
33788
|
}
|
|
33404
|
-
function
|
|
33405
|
-
|
|
33406
|
-
|
|
33407
|
-
|
|
33408
|
-
|
|
33409
|
-
);
|
|
33789
|
+
function agentEnvironment(environment3) {
|
|
33790
|
+
return activeDeployment(agentRegistry.protocol, agentRegistry.deployments, environment3);
|
|
33791
|
+
}
|
|
33792
|
+
function getAgentServiceDeployment(environment3, chainId) {
|
|
33793
|
+
const value = chainOf(agentRegistry.protocol, agentEnvironment(environment3), environment3, chainId);
|
|
33410
33794
|
return Object.freeze({
|
|
33411
33795
|
chainId: value.network.chainId,
|
|
33412
33796
|
networkName: value.network.name,
|
|
@@ -33432,16 +33816,13 @@ function getAgentServiceDeployment(environment3) {
|
|
|
33432
33816
|
function getAgentServiceDeploymentByChainId(chainId) {
|
|
33433
33817
|
const selected = AGENT_CLIENT_DEPLOYMENT_BY_CHAIN[chainId];
|
|
33434
33818
|
if (!selected) throw new DeploymentManifestError(`agent_service_v0 has no reviewed custody authority for chain ${chainId}.`);
|
|
33435
|
-
|
|
33436
|
-
if (deployment.chainId !== chainId) throw new DeploymentManifestError(`agent_service_v0 custody catalogue is stale for chain ${chainId}.`);
|
|
33437
|
-
return deployment;
|
|
33819
|
+
return getAgentServiceDeployment(selected, chainId);
|
|
33438
33820
|
}
|
|
33439
|
-
function
|
|
33440
|
-
|
|
33441
|
-
|
|
33442
|
-
|
|
33443
|
-
|
|
33444
|
-
);
|
|
33821
|
+
function taskEnvironment(environment3) {
|
|
33822
|
+
return activeDeployment(taskRegistry.protocol, taskRegistry.deployments, environment3);
|
|
33823
|
+
}
|
|
33824
|
+
function getTaskProtocolDeployment(environment3, chainId) {
|
|
33825
|
+
const value = chainOf(taskRegistry.protocol, taskEnvironment(environment3), environment3, chainId);
|
|
33445
33826
|
return Object.freeze({
|
|
33446
33827
|
chainId: value.network.chainId,
|
|
33447
33828
|
protocolAddress: value.contracts.protocol,
|
|
@@ -33467,9 +33848,7 @@ function getTaskProtocolDeployment(environment3) {
|
|
|
33467
33848
|
function getTaskProtocolDeploymentByChainId(chainId) {
|
|
33468
33849
|
const selected = TASK_CLIENT_DEPLOYMENT_BY_CHAIN[chainId];
|
|
33469
33850
|
if (!selected) throw new DeploymentManifestError(`task_protocol_v0 has no reviewed custody authority for chain ${chainId}.`);
|
|
33470
|
-
|
|
33471
|
-
if (deployment.chainId !== chainId) throw new DeploymentManifestError(`task_protocol_v0 custody catalogue is stale for chain ${chainId}.`);
|
|
33472
|
-
return deployment;
|
|
33851
|
+
return getTaskProtocolDeployment(selected, chainId);
|
|
33473
33852
|
}
|
|
33474
33853
|
function skillEnvironment(environment3) {
|
|
33475
33854
|
return activeDeployment(
|
|
@@ -33479,22 +33858,13 @@ function skillEnvironment(environment3) {
|
|
|
33479
33858
|
);
|
|
33480
33859
|
}
|
|
33481
33860
|
function getSkillProtocolChainIds(environment3) {
|
|
33482
|
-
return
|
|
33483
|
-
Object.keys(skillEnvironment(environment3).chains).map(Number).sort((a, b) => a - b)
|
|
33484
|
-
);
|
|
33861
|
+
return sortedChainIds(skillEnvironment(environment3).chains);
|
|
33485
33862
|
}
|
|
33486
33863
|
function getSkillProtocolDefaultChainId(environment3) {
|
|
33487
33864
|
return skillEnvironment(environment3).defaultChainId;
|
|
33488
33865
|
}
|
|
33489
33866
|
function getSkillProtocolDeployment(environment3, chainId) {
|
|
33490
|
-
const
|
|
33491
|
-
const selected = chainId ?? deployments.defaultChainId;
|
|
33492
|
-
const value = deployments.chains[String(selected)];
|
|
33493
|
-
if (!value) {
|
|
33494
|
-
throw new DeploymentManifestError(
|
|
33495
|
-
`${skillRegistry.protocol} is not deployed to chain ${selected} in ${environment3}. Deployed: ${Object.keys(deployments.chains).join(", ")}.`
|
|
33496
|
-
);
|
|
33497
|
-
}
|
|
33867
|
+
const value = chainOf(skillRegistry.protocol, skillEnvironment(environment3), environment3, chainId);
|
|
33498
33868
|
return Object.freeze({
|
|
33499
33869
|
chainId: value.network.chainId,
|
|
33500
33870
|
explorerUrl: value.network.explorerUrl,
|
|
@@ -33522,7 +33892,35 @@ function getSkillProtocolDeploymentByChainId(chainId) {
|
|
|
33522
33892
|
function getAllSkillProtocolChainIds() {
|
|
33523
33893
|
return Object.freeze(Object.keys(SKILL_CLIENT_DEPLOYMENT_BY_CHAIN).map(Number).sort((left, right) => left - right));
|
|
33524
33894
|
}
|
|
33525
|
-
|
|
33895
|
+
function reviewedNetworks(environment3) {
|
|
33896
|
+
const selected = environment3 === "local" ? "test" : environment3;
|
|
33897
|
+
const byChain = /* @__PURE__ */ new Map();
|
|
33898
|
+
const sources = [skillRegistry.deployments[selected], taskRegistry.deployments[selected], agentRegistry.deployments[selected]];
|
|
33899
|
+
for (const deployment of sources) {
|
|
33900
|
+
if (!deployment.enabled) continue;
|
|
33901
|
+
for (const entry2 of Object.values(deployment.chains)) {
|
|
33902
|
+
const { chainId, name, explorerUrl, defaultRpcUrls } = entry2.network;
|
|
33903
|
+
const known = byChain.get(chainId);
|
|
33904
|
+
if (!known) {
|
|
33905
|
+
byChain.set(chainId, { name, explorerUrl, urls: [...defaultRpcUrls] });
|
|
33906
|
+
continue;
|
|
33907
|
+
}
|
|
33908
|
+
if (known.explorerUrl !== explorerUrl) {
|
|
33909
|
+
throw new DeploymentManifestError(
|
|
33910
|
+
`Chain ${chainId} has two explorers in ${selected}: ${known.explorerUrl} and ${explorerUrl}.`
|
|
33911
|
+
);
|
|
33912
|
+
}
|
|
33913
|
+
for (const url2 of defaultRpcUrls) if (!known.urls.includes(url2)) known.urls.push(url2);
|
|
33914
|
+
}
|
|
33915
|
+
}
|
|
33916
|
+
return new Map([...byChain].map(([chainId, value]) => [chainId, Object.freeze({
|
|
33917
|
+
chainId,
|
|
33918
|
+
name: value.name,
|
|
33919
|
+
explorerUrl: value.explorerUrl,
|
|
33920
|
+
defaultRpcUrls: Object.freeze([...value.urls])
|
|
33921
|
+
})]));
|
|
33922
|
+
}
|
|
33923
|
+
var canonicalAddressSchema, hashSchema, commitSchema, positiveDecimalSchema, DEFAULT_LOG_BLOCK_RANGE, DEFAULT_CONCURRENT_REQUESTS, networkSchema, publicRpcUrlsSchema, legacySkillIndexerChainSchema, legacySkillIndexerRegistrySchema, sourceSchema, disabledDeploymentSchema, deploymentsShape, agentActiveSchema, taskActiveSchema, skillActiveSchema, multiChainEnvironmentSchema, agentEnvironmentSchema, taskEnvironmentSchema, skillEnvironmentSchema, agentRegistrySchema, taskRegistrySchema, skillRegistrySchema, registrySchema, agentRegistry, taskRegistry, skillRegistry, legacySkillIndexerRegistry, AGENT_CLIENT_DEPLOYMENT_BY_CHAIN, TASK_CLIENT_DEPLOYMENT_BY_CHAIN, SKILL_CLIENT_DEPLOYMENT_BY_CHAIN, REVIEWED_NETWORKS;
|
|
33526
33924
|
var init_chains = __esm({
|
|
33527
33925
|
"../../packages/deployment-manifest/src/chains/index.ts"() {
|
|
33528
33926
|
"use strict";
|
|
@@ -33730,31 +34128,20 @@ var init_chains = __esm({
|
|
|
33730
34128
|
context.addIssue({ code: "custom", message: "firstBlock must not exceed factoryFirstBlock." });
|
|
33731
34129
|
}
|
|
33732
34130
|
});
|
|
33733
|
-
|
|
33734
|
-
schemaVersion: external_exports.literal(1),
|
|
33735
|
-
protocol: external_exports.literal("agent_service_v0"),
|
|
33736
|
-
deployments: deploymentsShape(agentActiveSchema)
|
|
33737
|
-
});
|
|
33738
|
-
taskRegistrySchema = external_exports.strictObject({
|
|
33739
|
-
schemaVersion: external_exports.literal(1),
|
|
33740
|
-
protocol: external_exports.literal("task_protocol_v0"),
|
|
33741
|
-
deployments: deploymentsShape(taskActiveSchema)
|
|
33742
|
-
});
|
|
33743
|
-
skillEnvironmentSchema = external_exports.strictObject({
|
|
34131
|
+
multiChainEnvironmentSchema = (label, chain) => external_exports.strictObject({
|
|
33744
34132
|
enabled: external_exports.literal(true),
|
|
33745
|
-
/** Where publishing lands, and what an unqualified read resolves against. */
|
|
33746
34133
|
defaultChainId: external_exports.number().int().positive(),
|
|
33747
|
-
chains: external_exports.record(external_exports.string().regex(/^[1-9][0-9]*$/u),
|
|
34134
|
+
chains: external_exports.record(external_exports.string().regex(/^[1-9][0-9]*$/u), chain)
|
|
33748
34135
|
}).superRefine((value, context) => {
|
|
33749
34136
|
const ids = Object.keys(value.chains);
|
|
33750
34137
|
if (ids.length === 0) {
|
|
33751
|
-
context.addIssue({ code: "custom", message:
|
|
34138
|
+
context.addIssue({ code: "custom", message: `An enabled ${label} environment must list at least one chain.` });
|
|
33752
34139
|
}
|
|
33753
|
-
for (const [key,
|
|
33754
|
-
if (Number(key) !==
|
|
34140
|
+
for (const [key, entry2] of Object.entries(value.chains)) {
|
|
34141
|
+
if (Number(key) !== entry2.network.chainId) {
|
|
33755
34142
|
context.addIssue({
|
|
33756
34143
|
code: "custom",
|
|
33757
|
-
message:
|
|
34144
|
+
message: `${label} chain key ${key} does not match its network.chainId ${entry2.network.chainId}.`
|
|
33758
34145
|
});
|
|
33759
34146
|
}
|
|
33760
34147
|
}
|
|
@@ -33765,6 +34152,19 @@ var init_chains = __esm({
|
|
|
33765
34152
|
});
|
|
33766
34153
|
}
|
|
33767
34154
|
});
|
|
34155
|
+
agentEnvironmentSchema = multiChainEnvironmentSchema("Agent Service", agentActiveSchema);
|
|
34156
|
+
taskEnvironmentSchema = multiChainEnvironmentSchema("Task", taskActiveSchema);
|
|
34157
|
+
skillEnvironmentSchema = multiChainEnvironmentSchema("Skill", skillActiveSchema);
|
|
34158
|
+
agentRegistrySchema = external_exports.strictObject({
|
|
34159
|
+
schemaVersion: external_exports.literal(1),
|
|
34160
|
+
protocol: external_exports.literal("agent_service_v0"),
|
|
34161
|
+
deployments: deploymentsShape(agentEnvironmentSchema)
|
|
34162
|
+
});
|
|
34163
|
+
taskRegistrySchema = external_exports.strictObject({
|
|
34164
|
+
schemaVersion: external_exports.literal(1),
|
|
34165
|
+
protocol: external_exports.literal("task_protocol_v0"),
|
|
34166
|
+
deployments: deploymentsShape(taskEnvironmentSchema)
|
|
34167
|
+
});
|
|
33768
34168
|
skillRegistrySchema = external_exports.strictObject({
|
|
33769
34169
|
schemaVersion: external_exports.literal(1),
|
|
33770
34170
|
protocol: external_exports.literal("skill_protocol_v3"),
|
|
@@ -33782,22 +34182,21 @@ var init_chains = __esm({
|
|
|
33782
34182
|
legacySkillIndexerRegistrySchema,
|
|
33783
34183
|
legacy_skill_indexer_default
|
|
33784
34184
|
);
|
|
33785
|
-
AGENT_CLIENT_DEPLOYMENT_BY_CHAIN =
|
|
33786
|
-
|
|
33787
|
-
84532: "test"
|
|
33788
|
-
});
|
|
33789
|
-
TASK_CLIENT_DEPLOYMENT_BY_CHAIN = Object.freeze({
|
|
33790
|
-
8453: "production",
|
|
33791
|
-
84532: "test"
|
|
33792
|
-
});
|
|
34185
|
+
AGENT_CLIENT_DEPLOYMENT_BY_CHAIN = clientDeploymentsByChain(agentRegistry.protocol, agentRegistry.deployments);
|
|
34186
|
+
TASK_CLIENT_DEPLOYMENT_BY_CHAIN = clientDeploymentsByChain(taskRegistry.protocol, taskRegistry.deployments);
|
|
33793
34187
|
SKILL_CLIENT_DEPLOYMENT_BY_CHAIN = Object.freeze({
|
|
33794
34188
|
1: "production",
|
|
33795
34189
|
10: "production",
|
|
33796
34190
|
56: "production",
|
|
33797
34191
|
8453: "production",
|
|
33798
34192
|
42161: "production",
|
|
34193
|
+
43114: "production",
|
|
33799
34194
|
84532: "test"
|
|
33800
34195
|
});
|
|
34196
|
+
REVIEWED_NETWORKS = Object.freeze({
|
|
34197
|
+
test: reviewedNetworks("test"),
|
|
34198
|
+
production: reviewedNetworks("production")
|
|
34199
|
+
});
|
|
33801
34200
|
}
|
|
33802
34201
|
});
|
|
33803
34202
|
|
|
@@ -33942,12 +34341,15 @@ var internal_apps_default;
|
|
|
33942
34341
|
var init_internal_apps = __esm({
|
|
33943
34342
|
"../../packages/deployment-manifest/src/platform/internal-apps.json"() {
|
|
33944
34343
|
internal_apps_default = {
|
|
33945
|
-
schemaVersion:
|
|
34344
|
+
schemaVersion: 2,
|
|
33946
34345
|
kind: "internal_apps",
|
|
33947
34346
|
environments: {
|
|
33948
34347
|
local: {
|
|
33949
34348
|
data: {
|
|
33950
|
-
sessionTtlSeconds: 28800
|
|
34349
|
+
sessionTtlSeconds: 28800,
|
|
34350
|
+
queryAgentEnabled: true,
|
|
34351
|
+
aiBaseUrl: "https://api.tokenrouter.com/v1",
|
|
34352
|
+
aiModel: "xiaomi/mimo-v2.6-flash"
|
|
33951
34353
|
},
|
|
33952
34354
|
ops: {
|
|
33953
34355
|
sessionTtlSeconds: 28800,
|
|
@@ -33956,7 +34358,10 @@ var init_internal_apps = __esm({
|
|
|
33956
34358
|
},
|
|
33957
34359
|
test: {
|
|
33958
34360
|
data: {
|
|
33959
|
-
sessionTtlSeconds: 28800
|
|
34361
|
+
sessionTtlSeconds: 28800,
|
|
34362
|
+
queryAgentEnabled: true,
|
|
34363
|
+
aiBaseUrl: "https://api.tokenrouter.com/v1",
|
|
34364
|
+
aiModel: "xiaomi/mimo-v2.6-flash"
|
|
33960
34365
|
},
|
|
33961
34366
|
ops: {
|
|
33962
34367
|
sessionTtlSeconds: 28800,
|
|
@@ -33965,7 +34370,10 @@ var init_internal_apps = __esm({
|
|
|
33965
34370
|
},
|
|
33966
34371
|
production: {
|
|
33967
34372
|
data: {
|
|
33968
|
-
sessionTtlSeconds: 28800
|
|
34373
|
+
sessionTtlSeconds: 28800,
|
|
34374
|
+
queryAgentEnabled: false,
|
|
34375
|
+
aiBaseUrl: "https://api.tokenrouter.com/v1",
|
|
34376
|
+
aiModel: "xiaomi/mimo-v2.6-flash"
|
|
33969
34377
|
},
|
|
33970
34378
|
ops: {
|
|
33971
34379
|
sessionTtlSeconds: 28800,
|
|
@@ -34044,6 +34452,15 @@ var init_skill_delivery = __esm({
|
|
|
34044
34452
|
pkpId: "0xdf87a5d625926cedc0ad0ef74888adb643936f25",
|
|
34045
34453
|
groupId: 1
|
|
34046
34454
|
}
|
|
34455
|
+
},
|
|
34456
|
+
"43114": {
|
|
34457
|
+
chainId: 43114,
|
|
34458
|
+
chainTag: "avalanche",
|
|
34459
|
+
lit: {
|
|
34460
|
+
provider: "chipotle",
|
|
34461
|
+
pkpId: "0xdf87a5d625926cedc0ad0ef74888adb643936f25",
|
|
34462
|
+
groupId: 1
|
|
34463
|
+
}
|
|
34047
34464
|
}
|
|
34048
34465
|
}
|
|
34049
34466
|
}
|
|
@@ -34207,6 +34624,31 @@ var init_merchant_avatar_video2 = __esm({
|
|
|
34207
34624
|
}
|
|
34208
34625
|
});
|
|
34209
34626
|
|
|
34627
|
+
// ../../packages/deployment-manifest/src/platform/generator.json
|
|
34628
|
+
var generator_default;
|
|
34629
|
+
var init_generator = __esm({
|
|
34630
|
+
"../../packages/deployment-manifest/src/platform/generator.json"() {
|
|
34631
|
+
generator_default = {
|
|
34632
|
+
schemaVersion: 1,
|
|
34633
|
+
kind: "generator",
|
|
34634
|
+
provider: { endpoint: "https://api.tokenrouter.com/v1", model: "openai/gpt-6-luna" },
|
|
34635
|
+
environments: { local: { enabled: true }, test: { enabled: true }, production: { enabled: false } }
|
|
34636
|
+
};
|
|
34637
|
+
}
|
|
34638
|
+
});
|
|
34639
|
+
|
|
34640
|
+
// ../../packages/deployment-manifest/src/platform/generator.ts
|
|
34641
|
+
var policy3, manifest4;
|
|
34642
|
+
var init_generator2 = __esm({
|
|
34643
|
+
"../../packages/deployment-manifest/src/platform/generator.ts"() {
|
|
34644
|
+
"use strict";
|
|
34645
|
+
init_zod();
|
|
34646
|
+
init_generator();
|
|
34647
|
+
policy3 = external_exports.strictObject({ enabled: external_exports.boolean() });
|
|
34648
|
+
manifest4 = external_exports.strictObject({ schemaVersion: external_exports.literal(1), kind: external_exports.literal("generator"), provider: external_exports.strictObject({ endpoint: external_exports.literal("https://api.tokenrouter.com/v1"), model: external_exports.literal("openai/gpt-6-luna") }), environments: external_exports.strictObject({ local: policy3, test: policy3, production: policy3 }) }).parse(generator_default);
|
|
34649
|
+
}
|
|
34650
|
+
});
|
|
34651
|
+
|
|
34210
34652
|
// ../../packages/deployment-manifest/src/platform/index.ts
|
|
34211
34653
|
function parseManifest2(label, schema5, value) {
|
|
34212
34654
|
const parsed2 = schema5.safeParse(value);
|
|
@@ -34244,7 +34686,7 @@ function getSkillDeliveryDeployment(environment3, chainId) {
|
|
|
34244
34686
|
});
|
|
34245
34687
|
}
|
|
34246
34688
|
function getSkillDeliveryDeploymentByChainId(chainId) {
|
|
34247
|
-
const environment3 = chainId === 84532 ? "test" : [1, 10, 56, 8453, 42161].includes(chainId) ? "production" : void 0;
|
|
34689
|
+
const environment3 = chainId === 84532 ? "test" : [1, 10, 56, 8453, 42161, 43114].includes(chainId) ? "production" : void 0;
|
|
34248
34690
|
if (!environment3) throw new DeploymentManifestError(`Skill delivery has no reviewed binding for chain ${chainId}.`);
|
|
34249
34691
|
return getSkillDeliveryDeployment(environment3, chainId);
|
|
34250
34692
|
}
|
|
@@ -34264,18 +34706,26 @@ var init_platform = __esm({
|
|
|
34264
34706
|
init_task_platform();
|
|
34265
34707
|
init_agenton_payout2();
|
|
34266
34708
|
init_merchant_avatar_video2();
|
|
34709
|
+
init_generator2();
|
|
34267
34710
|
internalAppSchema = external_exports.strictObject({
|
|
34268
34711
|
sessionTtlSeconds: external_exports.number().int().min(60).max(24 * 60 * 60)
|
|
34269
34712
|
});
|
|
34270
34713
|
internalAppsEnvironmentSchema = external_exports.strictObject({
|
|
34271
|
-
data: internalAppSchema
|
|
34714
|
+
data: internalAppSchema.extend({
|
|
34715
|
+
queryAgentEnabled: external_exports.boolean(),
|
|
34716
|
+
aiBaseUrl: external_exports.url().refine((value) => {
|
|
34717
|
+
const url2 = new URL(value);
|
|
34718
|
+
return url2.protocol === "https:" && !url2.username && !url2.password && !url2.search && !url2.hash;
|
|
34719
|
+
}, "The AI base URL must be HTTPS without credentials, query or fragment."),
|
|
34720
|
+
aiModel: external_exports.string().trim().min(1).max(200)
|
|
34721
|
+
}),
|
|
34272
34722
|
ops: internalAppSchema.extend({ webOrigin: external_exports.url().refine((value) => {
|
|
34273
34723
|
const url2 = new URL(value);
|
|
34274
34724
|
return url2.origin === value && (url2.protocol === "https:" || value === "http://localhost:3000");
|
|
34275
34725
|
}, "An exact reviewed Web origin is required.") })
|
|
34276
34726
|
});
|
|
34277
34727
|
internalAppsManifestSchema = external_exports.strictObject({
|
|
34278
|
-
schemaVersion: external_exports.literal(
|
|
34728
|
+
schemaVersion: external_exports.literal(2),
|
|
34279
34729
|
kind: external_exports.literal("internal_apps"),
|
|
34280
34730
|
environments: external_exports.strictObject({
|
|
34281
34731
|
local: internalAppsEnvironmentSchema,
|
|
@@ -34325,7 +34775,7 @@ var init_platform = __esm({
|
|
|
34325
34775
|
});
|
|
34326
34776
|
skillDeliveryBindingSchema = external_exports.strictObject({
|
|
34327
34777
|
chainId: external_exports.number().int().positive(),
|
|
34328
|
-
chainTag: external_exports.enum(["base", "baseSepolia", "ethereum", "optimism", "bsc", "arbitrum"]),
|
|
34778
|
+
chainTag: external_exports.enum(["base", "baseSepolia", "ethereum", "optimism", "bsc", "arbitrum", "avalanche"]),
|
|
34329
34779
|
lit: external_exports.strictObject({
|
|
34330
34780
|
provider: external_exports.literal("chipotle"),
|
|
34331
34781
|
pkpId: external_exports.string().min(1).max(512),
|
|
@@ -42339,44 +42789,44 @@ var init_formatter = __esm({
|
|
|
42339
42789
|
});
|
|
42340
42790
|
|
|
42341
42791
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/utils/formatters/transactionRequest.js
|
|
42342
|
-
function formatTransactionRequest(
|
|
42792
|
+
function formatTransactionRequest(request2, _) {
|
|
42343
42793
|
const rpcRequest = {};
|
|
42344
|
-
if (typeof
|
|
42345
|
-
rpcRequest.authorizationList = formatAuthorizationList(
|
|
42346
|
-
if (typeof
|
|
42347
|
-
rpcRequest.accessList =
|
|
42348
|
-
if (typeof
|
|
42349
|
-
rpcRequest.blobVersionedHashes =
|
|
42350
|
-
if (typeof
|
|
42351
|
-
if (typeof
|
|
42352
|
-
rpcRequest.blobs =
|
|
42794
|
+
if (typeof request2.authorizationList !== "undefined")
|
|
42795
|
+
rpcRequest.authorizationList = formatAuthorizationList(request2.authorizationList);
|
|
42796
|
+
if (typeof request2.accessList !== "undefined")
|
|
42797
|
+
rpcRequest.accessList = request2.accessList;
|
|
42798
|
+
if (typeof request2.blobVersionedHashes !== "undefined")
|
|
42799
|
+
rpcRequest.blobVersionedHashes = request2.blobVersionedHashes;
|
|
42800
|
+
if (typeof request2.blobs !== "undefined") {
|
|
42801
|
+
if (typeof request2.blobs[0] !== "string")
|
|
42802
|
+
rpcRequest.blobs = request2.blobs.map((x2) => bytesToHex(x2));
|
|
42353
42803
|
else
|
|
42354
|
-
rpcRequest.blobs =
|
|
42355
|
-
}
|
|
42356
|
-
if (typeof
|
|
42357
|
-
rpcRequest.data =
|
|
42358
|
-
if (
|
|
42359
|
-
rpcRequest.from =
|
|
42360
|
-
if (typeof
|
|
42361
|
-
rpcRequest.from =
|
|
42362
|
-
if (typeof
|
|
42363
|
-
rpcRequest.gas = numberToHex(
|
|
42364
|
-
if (typeof
|
|
42365
|
-
rpcRequest.gasPrice = numberToHex(
|
|
42366
|
-
if (typeof
|
|
42367
|
-
rpcRequest.maxFeePerBlobGas = numberToHex(
|
|
42368
|
-
if (typeof
|
|
42369
|
-
rpcRequest.maxFeePerGas = numberToHex(
|
|
42370
|
-
if (typeof
|
|
42371
|
-
rpcRequest.maxPriorityFeePerGas = numberToHex(
|
|
42372
|
-
if (typeof
|
|
42373
|
-
rpcRequest.nonce = numberToHex(
|
|
42374
|
-
if (typeof
|
|
42375
|
-
rpcRequest.to =
|
|
42376
|
-
if (typeof
|
|
42377
|
-
rpcRequest.type = rpcTransactionType[
|
|
42378
|
-
if (typeof
|
|
42379
|
-
rpcRequest.value = numberToHex(
|
|
42804
|
+
rpcRequest.blobs = request2.blobs;
|
|
42805
|
+
}
|
|
42806
|
+
if (typeof request2.data !== "undefined")
|
|
42807
|
+
rpcRequest.data = request2.data;
|
|
42808
|
+
if (request2.account)
|
|
42809
|
+
rpcRequest.from = request2.account.address;
|
|
42810
|
+
if (typeof request2.from !== "undefined")
|
|
42811
|
+
rpcRequest.from = request2.from;
|
|
42812
|
+
if (typeof request2.gas !== "undefined")
|
|
42813
|
+
rpcRequest.gas = numberToHex(request2.gas);
|
|
42814
|
+
if (typeof request2.gasPrice !== "undefined")
|
|
42815
|
+
rpcRequest.gasPrice = numberToHex(request2.gasPrice);
|
|
42816
|
+
if (typeof request2.maxFeePerBlobGas !== "undefined")
|
|
42817
|
+
rpcRequest.maxFeePerBlobGas = numberToHex(request2.maxFeePerBlobGas);
|
|
42818
|
+
if (typeof request2.maxFeePerGas !== "undefined")
|
|
42819
|
+
rpcRequest.maxFeePerGas = numberToHex(request2.maxFeePerGas);
|
|
42820
|
+
if (typeof request2.maxPriorityFeePerGas !== "undefined")
|
|
42821
|
+
rpcRequest.maxPriorityFeePerGas = numberToHex(request2.maxPriorityFeePerGas);
|
|
42822
|
+
if (typeof request2.nonce !== "undefined")
|
|
42823
|
+
rpcRequest.nonce = numberToHex(request2.nonce);
|
|
42824
|
+
if (typeof request2.to !== "undefined")
|
|
42825
|
+
rpcRequest.to = request2.to;
|
|
42826
|
+
if (typeof request2.type !== "undefined")
|
|
42827
|
+
rpcRequest.type = rpcTransactionType[request2.type];
|
|
42828
|
+
if (typeof request2.value !== "undefined")
|
|
42829
|
+
rpcRequest.value = numberToHex(request2.value);
|
|
42380
42830
|
return rpcRequest;
|
|
42381
42831
|
}
|
|
42382
42832
|
function formatAuthorizationList(authorizationList) {
|
|
@@ -42798,7 +43248,7 @@ async function estimateMaxPriorityFeePerGas(client, args) {
|
|
|
42798
43248
|
return internal_estimateMaxPriorityFeePerGas(client, args);
|
|
42799
43249
|
}
|
|
42800
43250
|
async function internal_estimateMaxPriorityFeePerGas(client, args) {
|
|
42801
|
-
const { block: block_, chain = client.chain, request } = args || {};
|
|
43251
|
+
const { block: block_, chain = client.chain, request: request2 } = args || {};
|
|
42802
43252
|
try {
|
|
42803
43253
|
const maxPriorityFeePerGas = chain?.fees?.maxPriorityFeePerGas ?? chain?.fees?.defaultPriorityFee;
|
|
42804
43254
|
if (typeof maxPriorityFeePerGas === "function") {
|
|
@@ -42806,7 +43256,7 @@ async function internal_estimateMaxPriorityFeePerGas(client, args) {
|
|
|
42806
43256
|
const maxPriorityFeePerGas_ = await maxPriorityFeePerGas({
|
|
42807
43257
|
block,
|
|
42808
43258
|
client,
|
|
42809
|
-
request
|
|
43259
|
+
request: request2
|
|
42810
43260
|
});
|
|
42811
43261
|
if (maxPriorityFeePerGas_ === null)
|
|
42812
43262
|
throw new Error();
|
|
@@ -42846,13 +43296,13 @@ async function estimateFeesPerGas(client, args) {
|
|
|
42846
43296
|
return internal_estimateFeesPerGas(client, args);
|
|
42847
43297
|
}
|
|
42848
43298
|
async function internal_estimateFeesPerGas(client, args) {
|
|
42849
|
-
const { block: block_, chain = client.chain, request, type = "eip1559" } = args || {};
|
|
43299
|
+
const { block: block_, chain = client.chain, request: request2, type = "eip1559" } = args || {};
|
|
42850
43300
|
const baseFeeMultiplier = await (async () => {
|
|
42851
43301
|
if (typeof chain?.fees?.baseFeeMultiplier === "function")
|
|
42852
43302
|
return chain.fees.baseFeeMultiplier({
|
|
42853
43303
|
block: block_,
|
|
42854
43304
|
client,
|
|
42855
|
-
request
|
|
43305
|
+
request: request2
|
|
42856
43306
|
});
|
|
42857
43307
|
return chain?.fees?.baseFeeMultiplier ?? 1.2;
|
|
42858
43308
|
})();
|
|
@@ -42867,7 +43317,7 @@ async function internal_estimateFeesPerGas(client, args) {
|
|
|
42867
43317
|
block: block_,
|
|
42868
43318
|
client,
|
|
42869
43319
|
multiply,
|
|
42870
|
-
request,
|
|
43320
|
+
request: request2,
|
|
42871
43321
|
type
|
|
42872
43322
|
});
|
|
42873
43323
|
if (fees !== null)
|
|
@@ -42876,19 +43326,19 @@ async function internal_estimateFeesPerGas(client, args) {
|
|
|
42876
43326
|
if (type === "eip1559") {
|
|
42877
43327
|
if (typeof block.baseFeePerGas !== "bigint")
|
|
42878
43328
|
throw new Eip1559FeesNotSupportedError();
|
|
42879
|
-
const maxPriorityFeePerGas = typeof
|
|
43329
|
+
const maxPriorityFeePerGas = typeof request2?.maxPriorityFeePerGas === "bigint" ? request2.maxPriorityFeePerGas : await internal_estimateMaxPriorityFeePerGas(client, {
|
|
42880
43330
|
block,
|
|
42881
43331
|
chain,
|
|
42882
|
-
request
|
|
43332
|
+
request: request2
|
|
42883
43333
|
});
|
|
42884
43334
|
const baseFeePerGas = multiply(block.baseFeePerGas);
|
|
42885
|
-
const maxFeePerGas =
|
|
43335
|
+
const maxFeePerGas = request2?.maxFeePerGas ?? baseFeePerGas + maxPriorityFeePerGas;
|
|
42886
43336
|
return {
|
|
42887
43337
|
maxFeePerGas,
|
|
42888
43338
|
maxPriorityFeePerGas
|
|
42889
43339
|
};
|
|
42890
43340
|
}
|
|
42891
|
-
const gasPrice =
|
|
43341
|
+
const gasPrice = request2?.gasPrice ?? multiply(await getAction(client, getGasPrice, "getGasPrice")({}));
|
|
42892
43342
|
return {
|
|
42893
43343
|
gasPrice
|
|
42894
43344
|
};
|
|
@@ -43253,7 +43703,7 @@ async function fillTransaction(client, parameters) {
|
|
|
43253
43703
|
assertRequest(parameters);
|
|
43254
43704
|
const chainFormat = chain?.formatters?.transactionRequest?.format;
|
|
43255
43705
|
const format3 = chainFormat || formatTransactionRequest;
|
|
43256
|
-
const
|
|
43706
|
+
const request2 = format3({
|
|
43257
43707
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
43258
43708
|
...extract(rest, { format: chainFormat }),
|
|
43259
43709
|
account: account ? parseAccount(account) : void 0,
|
|
@@ -43275,7 +43725,7 @@ async function fillTransaction(client, parameters) {
|
|
|
43275
43725
|
try {
|
|
43276
43726
|
const response = await client.request({
|
|
43277
43727
|
method: "eth_fillTransaction",
|
|
43278
|
-
params: [
|
|
43728
|
+
params: [request2]
|
|
43279
43729
|
});
|
|
43280
43730
|
const format4 = chain?.formatters?.transaction?.format || formatTransaction;
|
|
43281
43731
|
const transaction2 = format4(response.tx);
|
|
@@ -43324,7 +43774,7 @@ async function fillTransaction(client, parameters) {
|
|
|
43324
43774
|
return {
|
|
43325
43775
|
raw: response.raw,
|
|
43326
43776
|
transaction: {
|
|
43327
|
-
from:
|
|
43777
|
+
from: request2.from,
|
|
43328
43778
|
...transaction2
|
|
43329
43779
|
},
|
|
43330
43780
|
...response.capabilities ? { capabilities: response.capabilities } : {}
|
|
@@ -43353,10 +43803,10 @@ var init_fillTransaction = __esm({
|
|
|
43353
43803
|
|
|
43354
43804
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/actions/wallet/prepareTransactionRequest.js
|
|
43355
43805
|
async function prepareTransactionRequest(client, args) {
|
|
43356
|
-
let
|
|
43357
|
-
|
|
43358
|
-
|
|
43359
|
-
const { account: account_, chain = client.chain, nonceManager, parameters } =
|
|
43806
|
+
let request2 = args;
|
|
43807
|
+
request2.account ??= client.account;
|
|
43808
|
+
request2.parameters ??= defaultParameters;
|
|
43809
|
+
const { account: account_, chain = client.chain, nonceManager, parameters } = request2;
|
|
43360
43810
|
const prepareTransactionRequest2 = (() => {
|
|
43361
43811
|
if (typeof chain?.prepareTransactionRequest === "function")
|
|
43362
43812
|
return {
|
|
@@ -43374,8 +43824,8 @@ async function prepareTransactionRequest(client, args) {
|
|
|
43374
43824
|
async function getChainId2() {
|
|
43375
43825
|
if (chainId)
|
|
43376
43826
|
return chainId;
|
|
43377
|
-
if (typeof
|
|
43378
|
-
return
|
|
43827
|
+
if (typeof request2.chainId !== "undefined")
|
|
43828
|
+
return request2.chainId;
|
|
43379
43829
|
if (chain)
|
|
43380
43830
|
return chain.id;
|
|
43381
43831
|
const chainId_ = await getAction(client, getChainId, "getChainId")({});
|
|
@@ -43383,14 +43833,14 @@ async function prepareTransactionRequest(client, args) {
|
|
|
43383
43833
|
return chainId;
|
|
43384
43834
|
}
|
|
43385
43835
|
let account = account_ ? parseAccount(account_) : account_;
|
|
43386
|
-
let nonce =
|
|
43836
|
+
let nonce = request2.nonce;
|
|
43387
43837
|
if (prepareTransactionRequest2?.fn && prepareTransactionRequest2.runAt?.includes("beforeFillTransaction")) {
|
|
43388
|
-
|
|
43838
|
+
request2 = await prepareTransactionRequest2.fn({ ...request2, chain }, {
|
|
43389
43839
|
client,
|
|
43390
43840
|
phase: "beforeFillTransaction"
|
|
43391
43841
|
});
|
|
43392
|
-
nonce ??=
|
|
43393
|
-
const sender =
|
|
43842
|
+
nonce ??= request2.nonce;
|
|
43843
|
+
const sender = request2.account ?? request2.from;
|
|
43394
43844
|
account = sender ? parseAccount(sender) : void 0;
|
|
43395
43845
|
}
|
|
43396
43846
|
if (parameters.includes("nonce") && typeof nonce === "undefined" && account && nonceManager) {
|
|
@@ -43402,44 +43852,44 @@ async function prepareTransactionRequest(client, args) {
|
|
|
43402
43852
|
});
|
|
43403
43853
|
}
|
|
43404
43854
|
const attemptFill = (() => {
|
|
43405
|
-
if ((parameters.includes("blobVersionedHashes") || parameters.includes("sidecars")) &&
|
|
43855
|
+
if ((parameters.includes("blobVersionedHashes") || parameters.includes("sidecars")) && request2.kzg && request2.blobs)
|
|
43406
43856
|
return false;
|
|
43407
|
-
if (parameters.length > 0 && "feePayer" in
|
|
43857
|
+
if (parameters.length > 0 && "feePayer" in request2 && request2.feePayer && !("feePayerSignature" in request2 && request2.feePayerSignature))
|
|
43408
43858
|
return true;
|
|
43409
43859
|
if (supportsFillTransaction.get(client.uid) === false)
|
|
43410
43860
|
return false;
|
|
43411
43861
|
const shouldAttempt = ["fees", "gas"].some((parameter) => parameters.includes(parameter));
|
|
43412
43862
|
if (!shouldAttempt)
|
|
43413
43863
|
return false;
|
|
43414
|
-
if (parameters.includes("chainId") && typeof
|
|
43864
|
+
if (parameters.includes("chainId") && typeof request2.chainId !== "number")
|
|
43415
43865
|
return true;
|
|
43416
43866
|
if (parameters.includes("nonce") && typeof nonce !== "number")
|
|
43417
43867
|
return true;
|
|
43418
|
-
if (parameters.includes("fees") && typeof
|
|
43868
|
+
if (parameters.includes("fees") && typeof request2.gasPrice !== "bigint" && (typeof request2.maxFeePerGas !== "bigint" || typeof request2.maxPriorityFeePerGas !== "bigint"))
|
|
43419
43869
|
return true;
|
|
43420
|
-
if (parameters.includes("gas") && typeof
|
|
43870
|
+
if (parameters.includes("gas") && typeof request2.gas !== "bigint")
|
|
43421
43871
|
return true;
|
|
43422
43872
|
return false;
|
|
43423
43873
|
})();
|
|
43424
|
-
const fillResult = attemptFill ? await getAction(client, fillTransaction, "fillTransaction")({ ...
|
|
43874
|
+
const fillResult = attemptFill ? await getAction(client, fillTransaction, "fillTransaction")({ ...request2, nonce }).then((result2) => {
|
|
43425
43875
|
const { chainId: chainId2, from: from16, gas: gas2, gasPrice, nonce: nonce2, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, type: type2, ...rest } = result2.transaction;
|
|
43426
43876
|
const feeToken = "feeToken" in rest ? rest.feeToken : void 0;
|
|
43427
43877
|
const hasFilledFeePayerSignature = "feePayerSignature" in rest && rest.feePayerSignature !== null && typeof rest.feePayerSignature !== "undefined";
|
|
43428
|
-
const shouldUseFilledFeeToken = typeof feeToken !== "undefined" && feeToken !== null && (!("feeToken" in
|
|
43878
|
+
const shouldUseFilledFeeToken = typeof feeToken !== "undefined" && feeToken !== null && (!("feeToken" in request2) || hasFilledFeePayerSignature);
|
|
43429
43879
|
supportsFillTransaction.set(client.uid, true);
|
|
43430
43880
|
return {
|
|
43431
|
-
...
|
|
43881
|
+
...request2,
|
|
43432
43882
|
...from16 ? { from: from16 } : {},
|
|
43433
|
-
...type2 && !
|
|
43883
|
+
...type2 && !request2.type ? { type: type2 } : {},
|
|
43434
43884
|
...typeof chainId2 !== "undefined" ? { chainId: chainId2 } : {},
|
|
43435
43885
|
...typeof gas2 !== "undefined" ? { gas: gas2 } : {},
|
|
43436
43886
|
...typeof gasPrice !== "undefined" ? { gasPrice } : {},
|
|
43437
43887
|
...typeof nonce2 !== "undefined" ? { nonce: nonce2 } : {},
|
|
43438
|
-
...typeof maxFeePerBlobGas !== "undefined" &&
|
|
43439
|
-
...typeof maxFeePerGas !== "undefined" &&
|
|
43440
|
-
...typeof maxPriorityFeePerGas !== "undefined" &&
|
|
43888
|
+
...typeof maxFeePerBlobGas !== "undefined" && request2.type !== "legacy" && request2.type !== "eip2930" ? { maxFeePerBlobGas } : {},
|
|
43889
|
+
...typeof maxFeePerGas !== "undefined" && request2.type !== "legacy" && request2.type !== "eip2930" ? { maxFeePerGas } : {},
|
|
43890
|
+
...typeof maxPriorityFeePerGas !== "undefined" && request2.type !== "legacy" && request2.type !== "eip2930" ? { maxPriorityFeePerGas } : {},
|
|
43441
43891
|
..."nonceKey" in rest && typeof rest.nonceKey !== "undefined" ? { nonceKey: rest.nonceKey } : {},
|
|
43442
|
-
..."keyAuthorization" in rest && typeof rest.keyAuthorization !== "undefined" && rest.keyAuthorization !== null && !("keyAuthorization" in
|
|
43892
|
+
..."keyAuthorization" in rest && typeof rest.keyAuthorization !== "undefined" && rest.keyAuthorization !== null && !("keyAuthorization" in request2) ? { keyAuthorization: rest.keyAuthorization } : {},
|
|
43443
43893
|
..."feePayerSignature" in rest && typeof rest.feePayerSignature !== "undefined" && rest.feePayerSignature !== null ? { feePayerSignature: rest.feePayerSignature } : {},
|
|
43444
43894
|
...shouldUseFilledFeeToken ? { feeToken } : {},
|
|
43445
43895
|
...result2.capabilities ? { _capabilities: result2.capabilities } : {}
|
|
@@ -43447,7 +43897,7 @@ async function prepareTransactionRequest(client, args) {
|
|
|
43447
43897
|
}).catch((e) => {
|
|
43448
43898
|
const error51 = e;
|
|
43449
43899
|
if (error51.name !== "TransactionExecutionError")
|
|
43450
|
-
return
|
|
43900
|
+
return request2;
|
|
43451
43901
|
const executionReverted = error51.walk?.((e2) => {
|
|
43452
43902
|
const error52 = e2;
|
|
43453
43903
|
return error52.name === "ExecutionRevertedError";
|
|
@@ -43460,17 +43910,17 @@ async function prepareTransactionRequest(client, args) {
|
|
|
43460
43910
|
});
|
|
43461
43911
|
if (unsupported)
|
|
43462
43912
|
supportsFillTransaction.set(client.uid, false);
|
|
43463
|
-
return
|
|
43464
|
-
}) :
|
|
43913
|
+
return request2;
|
|
43914
|
+
}) : request2;
|
|
43465
43915
|
nonce ??= fillResult.nonce;
|
|
43466
|
-
|
|
43916
|
+
request2 = {
|
|
43467
43917
|
...fillResult,
|
|
43468
43918
|
...account ? { from: account?.address } : {},
|
|
43469
43919
|
...typeof nonce !== "undefined" ? { nonce } : {}
|
|
43470
43920
|
};
|
|
43471
|
-
const { blobs, gas, kzg, type } =
|
|
43921
|
+
const { blobs, gas, kzg, type } = request2;
|
|
43472
43922
|
if (prepareTransactionRequest2?.fn && prepareTransactionRequest2.runAt?.includes("beforeFillParameters")) {
|
|
43473
|
-
|
|
43923
|
+
request2 = await prepareTransactionRequest2.fn({ ...request2, chain }, {
|
|
43474
43924
|
client,
|
|
43475
43925
|
phase: "beforeFillParameters"
|
|
43476
43926
|
});
|
|
@@ -43483,7 +43933,7 @@ async function prepareTransactionRequest(client, args) {
|
|
|
43483
43933
|
return block;
|
|
43484
43934
|
}
|
|
43485
43935
|
if (parameters.includes("nonce") && typeof nonce === "undefined" && account && !nonceManager)
|
|
43486
|
-
|
|
43936
|
+
request2.nonce = await getAction(client, getTransactionCount, "getTransactionCount")({
|
|
43487
43937
|
address: account.address,
|
|
43488
43938
|
blockTag: "pending"
|
|
43489
43939
|
});
|
|
@@ -43494,7 +43944,7 @@ async function prepareTransactionRequest(client, args) {
|
|
|
43494
43944
|
commitments,
|
|
43495
43945
|
to: "hex"
|
|
43496
43946
|
});
|
|
43497
|
-
|
|
43947
|
+
request2.blobVersionedHashes = versionedHashes;
|
|
43498
43948
|
}
|
|
43499
43949
|
if (parameters.includes("sidecars")) {
|
|
43500
43950
|
const proofs = blobsToProofs({ blobs, commitments, kzg });
|
|
@@ -43504,14 +43954,14 @@ async function prepareTransactionRequest(client, args) {
|
|
|
43504
43954
|
proofs,
|
|
43505
43955
|
to: "hex"
|
|
43506
43956
|
});
|
|
43507
|
-
|
|
43957
|
+
request2.sidecars = sidecars;
|
|
43508
43958
|
}
|
|
43509
43959
|
}
|
|
43510
43960
|
if (parameters.includes("chainId"))
|
|
43511
|
-
|
|
43961
|
+
request2.chainId = await getChainId2();
|
|
43512
43962
|
if ((parameters.includes("fees") || parameters.includes("type")) && typeof type === "undefined") {
|
|
43513
43963
|
try {
|
|
43514
|
-
|
|
43964
|
+
request2.type = getTransactionType(request2);
|
|
43515
43965
|
} catch {
|
|
43516
43966
|
let isEip1559Network = eip1559NetworkCache.get(client.uid);
|
|
43517
43967
|
if (typeof isEip1559Network === "undefined") {
|
|
@@ -43519,54 +43969,54 @@ async function prepareTransactionRequest(client, args) {
|
|
|
43519
43969
|
isEip1559Network = typeof block2?.baseFeePerGas === "bigint";
|
|
43520
43970
|
eip1559NetworkCache.set(client.uid, isEip1559Network);
|
|
43521
43971
|
}
|
|
43522
|
-
|
|
43972
|
+
request2.type = isEip1559Network ? "eip1559" : "legacy";
|
|
43523
43973
|
}
|
|
43524
43974
|
}
|
|
43525
43975
|
if (parameters.includes("fees")) {
|
|
43526
|
-
if (
|
|
43527
|
-
if (typeof
|
|
43976
|
+
if (request2.type !== "legacy" && request2.type !== "eip2930") {
|
|
43977
|
+
if (typeof request2.maxFeePerGas === "undefined" || typeof request2.maxPriorityFeePerGas === "undefined") {
|
|
43528
43978
|
const block2 = await getBlock2();
|
|
43529
43979
|
const { maxFeePerGas, maxPriorityFeePerGas } = await internal_estimateFeesPerGas(client, {
|
|
43530
43980
|
block: block2,
|
|
43531
43981
|
chain,
|
|
43532
|
-
request
|
|
43982
|
+
request: request2
|
|
43533
43983
|
});
|
|
43534
|
-
if (typeof
|
|
43984
|
+
if (typeof request2.maxPriorityFeePerGas === "undefined" && request2.maxFeePerGas && request2.maxFeePerGas < maxPriorityFeePerGas)
|
|
43535
43985
|
throw new MaxFeePerGasTooLowError({
|
|
43536
43986
|
maxPriorityFeePerGas
|
|
43537
43987
|
});
|
|
43538
|
-
|
|
43539
|
-
|
|
43988
|
+
request2.maxPriorityFeePerGas = maxPriorityFeePerGas;
|
|
43989
|
+
request2.maxFeePerGas = maxFeePerGas;
|
|
43540
43990
|
}
|
|
43541
43991
|
} else {
|
|
43542
|
-
if (typeof
|
|
43992
|
+
if (typeof request2.maxFeePerGas !== "undefined" || typeof request2.maxPriorityFeePerGas !== "undefined")
|
|
43543
43993
|
throw new Eip1559FeesNotSupportedError();
|
|
43544
|
-
if (typeof
|
|
43994
|
+
if (typeof request2.gasPrice === "undefined") {
|
|
43545
43995
|
const block2 = await getBlock2();
|
|
43546
43996
|
const { gasPrice: gasPrice_ } = await internal_estimateFeesPerGas(client, {
|
|
43547
43997
|
block: block2,
|
|
43548
43998
|
chain,
|
|
43549
|
-
request,
|
|
43999
|
+
request: request2,
|
|
43550
44000
|
type: "legacy"
|
|
43551
44001
|
});
|
|
43552
|
-
|
|
44002
|
+
request2.gasPrice = gasPrice_;
|
|
43553
44003
|
}
|
|
43554
44004
|
}
|
|
43555
44005
|
}
|
|
43556
44006
|
if (parameters.includes("gas") && typeof gas === "undefined")
|
|
43557
|
-
|
|
43558
|
-
...
|
|
44007
|
+
request2.gas = await getAction(client, estimateGas, "estimateGas")({
|
|
44008
|
+
...request2,
|
|
43559
44009
|
account,
|
|
43560
44010
|
prepare: account?.type === "local" ? [] : ["blobVersionedHashes"]
|
|
43561
44011
|
});
|
|
43562
44012
|
if (prepareTransactionRequest2?.fn && prepareTransactionRequest2.runAt?.includes("afterFillParameters"))
|
|
43563
|
-
|
|
44013
|
+
request2 = await prepareTransactionRequest2.fn({ ...request2, chain }, {
|
|
43564
44014
|
client,
|
|
43565
44015
|
phase: "afterFillParameters"
|
|
43566
44016
|
});
|
|
43567
|
-
assertRequest(
|
|
43568
|
-
delete
|
|
43569
|
-
return
|
|
44017
|
+
assertRequest(request2);
|
|
44018
|
+
delete request2.parameters;
|
|
44019
|
+
return request2;
|
|
43570
44020
|
}
|
|
43571
44021
|
var defaultParameters, eip1559NetworkCache, supportsFillTransaction;
|
|
43572
44022
|
var init_prepareTransactionRequest = __esm({
|
|
@@ -43636,7 +44086,7 @@ async function estimateGas(client, args) {
|
|
|
43636
44086
|
assertRequest(args);
|
|
43637
44087
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
43638
44088
|
const format3 = chainFormat || formatTransactionRequest;
|
|
43639
|
-
const
|
|
44089
|
+
const request2 = format3({
|
|
43640
44090
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
43641
44091
|
...extract(rest, { format: chainFormat }),
|
|
43642
44092
|
account,
|
|
@@ -43656,10 +44106,10 @@ async function estimateGas(client, args) {
|
|
|
43656
44106
|
return BigInt(await client.request({
|
|
43657
44107
|
method: "eth_estimateGas",
|
|
43658
44108
|
params: rpcStateOverride ? [
|
|
43659
|
-
|
|
44109
|
+
request2,
|
|
43660
44110
|
block ?? client.experimental_blockTag ?? "latest",
|
|
43661
44111
|
rpcStateOverride
|
|
43662
|
-
] : block ? [
|
|
44112
|
+
] : block ? [request2, block] : [request2]
|
|
43663
44113
|
}));
|
|
43664
44114
|
} catch (err2) {
|
|
43665
44115
|
throw getEstimateGasError(err2, {
|
|
@@ -43686,7 +44136,7 @@ var init_estimateGas2 = __esm({
|
|
|
43686
44136
|
|
|
43687
44137
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/actions/public/estimateContractGas.js
|
|
43688
44138
|
async function estimateContractGas(client, parameters) {
|
|
43689
|
-
const { abi: abi2, address: address2, args, functionName, dataSuffix = typeof client.dataSuffix === "string" ? client.dataSuffix : client.dataSuffix?.value, ...
|
|
44139
|
+
const { abi: abi2, address: address2, args, functionName, dataSuffix = typeof client.dataSuffix === "string" ? client.dataSuffix : client.dataSuffix?.value, ...request2 } = parameters;
|
|
43690
44140
|
const data = encodeFunctionData({
|
|
43691
44141
|
abi: abi2,
|
|
43692
44142
|
args,
|
|
@@ -43696,11 +44146,11 @@ async function estimateContractGas(client, parameters) {
|
|
|
43696
44146
|
const gas = await getAction(client, estimateGas, "estimateGas")({
|
|
43697
44147
|
data: `${data}${dataSuffix ? dataSuffix.replace("0x", "") : ""}`,
|
|
43698
44148
|
to: address2,
|
|
43699
|
-
...
|
|
44149
|
+
...request2
|
|
43700
44150
|
});
|
|
43701
44151
|
return gas;
|
|
43702
44152
|
} catch (error51) {
|
|
43703
|
-
const account =
|
|
44153
|
+
const account = request2.account ? parseAccount(request2.account) : void 0;
|
|
43704
44154
|
throw getContractError(error51, {
|
|
43705
44155
|
abi: abi2,
|
|
43706
44156
|
address: address2,
|
|
@@ -45970,7 +46420,7 @@ async function call(client, args) {
|
|
|
45970
46420
|
const rpcStateOverride = serializeStateOverride(stateOverride);
|
|
45971
46421
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
45972
46422
|
const format3 = chainFormat || formatTransactionRequest;
|
|
45973
|
-
const
|
|
46423
|
+
const request2 = format3({
|
|
45974
46424
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
45975
46425
|
...extract(rest, { format: chainFormat }),
|
|
45976
46426
|
accessList,
|
|
@@ -45987,7 +46437,7 @@ async function call(client, args) {
|
|
|
45987
46437
|
to: deploylessCall ? void 0 : to,
|
|
45988
46438
|
value
|
|
45989
46439
|
}, "call");
|
|
45990
|
-
if (batch && shouldPerformMulticall({ request }) && !rpcBlockOverrides && blockHash === void 0) {
|
|
46440
|
+
if (batch && shouldPerformMulticall({ request: request2 }) && !rpcBlockOverrides && blockHash === void 0) {
|
|
45991
46441
|
try {
|
|
45992
46442
|
const { deployless = false } = typeof client.batch?.multicall === "object" ? client.batch.multicall : {};
|
|
45993
46443
|
const multicallAddress = getMulticallAddress(client, {
|
|
@@ -45996,7 +46446,7 @@ async function call(client, args) {
|
|
|
45996
46446
|
});
|
|
45997
46447
|
if (!multicallAddress || !hasStateOverrideForAddress(rpcStateOverride, multicallAddress))
|
|
45998
46448
|
return await scheduleMulticall(client, {
|
|
45999
|
-
...
|
|
46449
|
+
...request2,
|
|
46000
46450
|
blockHash,
|
|
46001
46451
|
blockNumber: blockNumber2,
|
|
46002
46452
|
blockTag,
|
|
@@ -46012,7 +46462,7 @@ async function call(client, args) {
|
|
|
46012
46462
|
}
|
|
46013
46463
|
const params = (() => {
|
|
46014
46464
|
const base3 = [
|
|
46015
|
-
|
|
46465
|
+
request2,
|
|
46016
46466
|
block
|
|
46017
46467
|
];
|
|
46018
46468
|
if (rpcStateOverride && rpcBlockOverrides)
|
|
@@ -46050,8 +46500,8 @@ async function call(client, args) {
|
|
|
46050
46500
|
});
|
|
46051
46501
|
}
|
|
46052
46502
|
}
|
|
46053
|
-
function shouldPerformMulticall({ request }) {
|
|
46054
|
-
const { data, to, ...request_ } =
|
|
46503
|
+
function shouldPerformMulticall({ request: request2 }) {
|
|
46504
|
+
const { data, to, ...request_ } = request2;
|
|
46055
46505
|
if (!data)
|
|
46056
46506
|
return false;
|
|
46057
46507
|
if (data.startsWith(aggregate3Signature))
|
|
@@ -46095,10 +46545,10 @@ async function scheduleMulticall(client, args) {
|
|
|
46095
46545
|
return size5 > batchSize * 2;
|
|
46096
46546
|
},
|
|
46097
46547
|
fn: async (requests) => {
|
|
46098
|
-
const calls = requests.map((
|
|
46548
|
+
const calls = requests.map((request2) => ({
|
|
46099
46549
|
allowFailure: true,
|
|
46100
|
-
callData:
|
|
46101
|
-
target:
|
|
46550
|
+
callData: request2.data,
|
|
46551
|
+
target: request2.to
|
|
46102
46552
|
}));
|
|
46103
46553
|
const calldata = encodeFunctionData({
|
|
46104
46554
|
abi: multicall3Abi,
|
|
@@ -46790,7 +47240,7 @@ async function sendTransaction(client, parameters) {
|
|
|
46790
47240
|
}
|
|
46791
47241
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
46792
47242
|
const format3 = chainFormat || formatTransactionRequest;
|
|
46793
|
-
const
|
|
47243
|
+
const request2 = format3({
|
|
46794
47244
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
46795
47245
|
...extract(rest, { format: chainFormat }),
|
|
46796
47246
|
accessList,
|
|
@@ -46814,7 +47264,7 @@ async function sendTransaction(client, parameters) {
|
|
|
46814
47264
|
try {
|
|
46815
47265
|
return await client.request({
|
|
46816
47266
|
method: method2,
|
|
46817
|
-
params: [
|
|
47267
|
+
params: [request2]
|
|
46818
47268
|
}, { retryCount: 0 });
|
|
46819
47269
|
} catch (e) {
|
|
46820
47270
|
if (isWalletNamespaceSupported === false)
|
|
@@ -46823,7 +47273,7 @@ async function sendTransaction(client, parameters) {
|
|
|
46823
47273
|
if (error51.name === "InvalidInputRpcError" || error51.name === "InvalidParamsRpcError" || error51.name === "MethodNotFoundRpcError" || error51.name === "MethodNotSupportedRpcError") {
|
|
46824
47274
|
return await client.request({
|
|
46825
47275
|
method: "wallet_sendTransaction",
|
|
46826
|
-
params: [
|
|
47276
|
+
params: [request2]
|
|
46827
47277
|
}, { retryCount: 0 }).then((hash5) => {
|
|
46828
47278
|
supportsWalletNamespace.set(client.uid, true);
|
|
46829
47279
|
return hash5;
|
|
@@ -46863,7 +47313,7 @@ async function sendTransaction(client, parameters) {
|
|
|
46863
47313
|
}
|
|
46864
47314
|
};
|
|
46865
47315
|
})();
|
|
46866
|
-
const
|
|
47316
|
+
const request2 = await getAction(client, prepareTransactionRequest, "prepareTransactionRequest")({
|
|
46867
47317
|
account,
|
|
46868
47318
|
accessList,
|
|
46869
47319
|
authorizationList,
|
|
@@ -46884,7 +47334,7 @@ async function sendTransaction(client, parameters) {
|
|
|
46884
47334
|
to
|
|
46885
47335
|
});
|
|
46886
47336
|
const serializer = chain?.serializers?.transaction;
|
|
46887
|
-
const serializedTransaction = await account.signTransaction(
|
|
47337
|
+
const serializedTransaction = await account.signTransaction(request2, {
|
|
46888
47338
|
serializer
|
|
46889
47339
|
});
|
|
46890
47340
|
return await getAction(client, sendRawTransaction, "sendRawTransaction")({
|
|
@@ -46951,7 +47401,7 @@ var init_writeContract = __esm({
|
|
|
46951
47401
|
init_sendTransaction();
|
|
46952
47402
|
(function(writeContract2) {
|
|
46953
47403
|
async function internal(client, actionFn, name, parameters) {
|
|
46954
|
-
const { abi: abi2, account: account_ = client.account, address: address2, args, functionName, ...
|
|
47404
|
+
const { abi: abi2, account: account_ = client.account, address: address2, args, functionName, ...request2 } = parameters;
|
|
46955
47405
|
if (typeof account_ === "undefined")
|
|
46956
47406
|
throw new AccountNotFoundError({
|
|
46957
47407
|
docsPath: "/docs/contract/writeContract"
|
|
@@ -46967,7 +47417,7 @@ var init_writeContract = __esm({
|
|
|
46967
47417
|
data,
|
|
46968
47418
|
to: address2,
|
|
46969
47419
|
account,
|
|
46970
|
-
...
|
|
47420
|
+
...request2
|
|
46971
47421
|
});
|
|
46972
47422
|
} catch (error51) {
|
|
46973
47423
|
throw getContractError(error51, {
|
|
@@ -47393,7 +47843,7 @@ function createClient(parameters) {
|
|
|
47393
47843
|
const pollingInterval = parameters.pollingInterval ?? defaultPollingInterval;
|
|
47394
47844
|
const cacheTime = parameters.cacheTime ?? pollingInterval;
|
|
47395
47845
|
const account = parameters.account ? parseAccount(parameters.account) : void 0;
|
|
47396
|
-
const { config: config2, request, value } = parameters.transport({
|
|
47846
|
+
const { config: config2, request: request2, value } = parameters.transport({
|
|
47397
47847
|
account,
|
|
47398
47848
|
chain,
|
|
47399
47849
|
pollingInterval
|
|
@@ -47409,7 +47859,7 @@ function createClient(parameters) {
|
|
|
47409
47859
|
key,
|
|
47410
47860
|
name,
|
|
47411
47861
|
pollingInterval,
|
|
47412
|
-
request,
|
|
47862
|
+
request: request2,
|
|
47413
47863
|
tokens,
|
|
47414
47864
|
transport,
|
|
47415
47865
|
type,
|
|
@@ -48144,7 +48594,7 @@ async function createAccessList(client, args) {
|
|
|
48144
48594
|
const block = blockNumberHex || blockTag;
|
|
48145
48595
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
48146
48596
|
const format3 = chainFormat || formatTransactionRequest;
|
|
48147
|
-
const
|
|
48597
|
+
const request2 = format3({
|
|
48148
48598
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
48149
48599
|
...extract(rest, { format: chainFormat }),
|
|
48150
48600
|
account,
|
|
@@ -48160,7 +48610,7 @@ async function createAccessList(client, args) {
|
|
|
48160
48610
|
}, "createAccessList");
|
|
48161
48611
|
const response = await client.request({
|
|
48162
48612
|
method: "eth_createAccessList",
|
|
48163
|
-
params: [
|
|
48613
|
+
params: [request2, block]
|
|
48164
48614
|
});
|
|
48165
48615
|
if (response.error)
|
|
48166
48616
|
throw new BaseError2(response.error, { details: response.error });
|
|
@@ -48937,7 +49387,7 @@ var init_withDedupe = __esm({
|
|
|
48937
49387
|
});
|
|
48938
49388
|
|
|
48939
49389
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/utils/buildRequest.js
|
|
48940
|
-
function buildRequest(
|
|
49390
|
+
function buildRequest(request2, options = {}) {
|
|
48941
49391
|
return async (args, overrideOptions = {}) => {
|
|
48942
49392
|
const { dedupe = false, methods, retryDelay = 150, retryCount = 3, signal, uid: uid2 } = {
|
|
48943
49393
|
...options,
|
|
@@ -48957,7 +49407,7 @@ function buildRequest(request, options = {}) {
|
|
|
48957
49407
|
const requestId = dedupe ? hashString(`${uid2}.${stringify(args)}`) : void 0;
|
|
48958
49408
|
return withDedupe(() => withRetry(async () => {
|
|
48959
49409
|
try {
|
|
48960
|
-
return await
|
|
49410
|
+
return await request2(args, signal ? { signal } : void 0);
|
|
48961
49411
|
} catch (err_) {
|
|
48962
49412
|
if (signal?.aborted)
|
|
48963
49413
|
throw getAbortError(signal);
|
|
@@ -49243,8 +49693,8 @@ function getHttpRpcClient(url_, options = {}) {
|
|
|
49243
49693
|
method: method2 || "POST",
|
|
49244
49694
|
signal: signal_ || (timeout > 0 ? signal : null)
|
|
49245
49695
|
};
|
|
49246
|
-
const
|
|
49247
|
-
const args = await onRequest?.(
|
|
49696
|
+
const request2 = new Request(url2, init);
|
|
49697
|
+
const args = await onRequest?.(request2, init) ?? { ...init, url: url2 };
|
|
49248
49698
|
const response2 = await fetchFn(args.url ?? url2, args);
|
|
49249
49699
|
return response2;
|
|
49250
49700
|
}, {
|
|
@@ -51803,14 +52253,14 @@ async function simulateBlocks(client, parameters) {
|
|
|
51803
52253
|
const call2 = call_;
|
|
51804
52254
|
const account = call2.account ? parseAccount(call2.account) : void 0;
|
|
51805
52255
|
const data = call2.abi ? encodeFunctionData(call2) : call2.data;
|
|
51806
|
-
const
|
|
52256
|
+
const request2 = {
|
|
51807
52257
|
...call2,
|
|
51808
52258
|
account,
|
|
51809
52259
|
data: call2.dataSuffix ? concat2([data || "0x", call2.dataSuffix]) : data,
|
|
51810
52260
|
from: call2.from ?? account?.address
|
|
51811
52261
|
};
|
|
51812
|
-
assertRequest(
|
|
51813
|
-
return formatTransactionRequest(
|
|
52262
|
+
assertRequest(request2);
|
|
52263
|
+
return formatTransactionRequest(request2);
|
|
51814
52264
|
});
|
|
51815
52265
|
const stateOverrides = block2.stateOverrides ? serializeStateOverride(block2.stateOverrides) : void 0;
|
|
51816
52266
|
blockStateCalls.push({
|
|
@@ -53882,7 +54332,7 @@ async function sendTransactionSync(client, parameters) {
|
|
|
53882
54332
|
}
|
|
53883
54333
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
53884
54334
|
const format3 = chainFormat || formatTransactionRequest;
|
|
53885
|
-
const
|
|
54335
|
+
const request2 = format3({
|
|
53886
54336
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
53887
54337
|
...extract(rest, { format: chainFormat }),
|
|
53888
54338
|
accessList,
|
|
@@ -53907,7 +54357,7 @@ async function sendTransactionSync(client, parameters) {
|
|
|
53907
54357
|
try {
|
|
53908
54358
|
return await client.request({
|
|
53909
54359
|
method: method2,
|
|
53910
|
-
params: [
|
|
54360
|
+
params: [request2]
|
|
53911
54361
|
}, { retryCount: 0 });
|
|
53912
54362
|
} catch (e) {
|
|
53913
54363
|
if (isWalletNamespaceSupported === false)
|
|
@@ -53916,7 +54366,7 @@ async function sendTransactionSync(client, parameters) {
|
|
|
53916
54366
|
if (error51.name === "InvalidInputRpcError" || error51.name === "InvalidParamsRpcError" || error51.name === "MethodNotFoundRpcError" || error51.name === "MethodNotSupportedRpcError") {
|
|
53917
54367
|
return await client.request({
|
|
53918
54368
|
method: "wallet_sendTransaction",
|
|
53919
|
-
params: [
|
|
54369
|
+
params: [request2]
|
|
53920
54370
|
}, { retryCount: 0 }).then((hash6) => {
|
|
53921
54371
|
supportsWalletNamespace2.set(client.uid, true);
|
|
53922
54372
|
return hash6;
|
|
@@ -53966,7 +54416,7 @@ async function sendTransactionSync(client, parameters) {
|
|
|
53966
54416
|
}
|
|
53967
54417
|
};
|
|
53968
54418
|
})();
|
|
53969
|
-
const
|
|
54419
|
+
const request2 = await getAction(client, prepareTransactionRequest, "prepareTransactionRequest")({
|
|
53970
54420
|
account,
|
|
53971
54421
|
accessList,
|
|
53972
54422
|
authorizationList,
|
|
@@ -53987,7 +54437,7 @@ async function sendTransactionSync(client, parameters) {
|
|
|
53987
54437
|
to
|
|
53988
54438
|
});
|
|
53989
54439
|
const serializer = chain?.serializers?.transaction;
|
|
53990
|
-
const serializedTransaction = await account.signTransaction(
|
|
54440
|
+
const serializedTransaction = await account.signTransaction(request2, {
|
|
53991
54441
|
serializer
|
|
53992
54442
|
});
|
|
53993
54443
|
return await getAction(client, sendRawTransactionSync, "sendRawTransactionSync")({
|
|
@@ -54524,11 +54974,11 @@ var init_addChain = __esm({
|
|
|
54524
54974
|
|
|
54525
54975
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/actions/wallet/deployContract.js
|
|
54526
54976
|
function deployContract(walletClient, parameters) {
|
|
54527
|
-
const { abi: abi2, args, bytecode, ...
|
|
54977
|
+
const { abi: abi2, args, bytecode, ...request2 } = parameters;
|
|
54528
54978
|
const calldata = encodeDeployData({ abi: abi2, args, bytecode });
|
|
54529
54979
|
return sendTransaction(walletClient, {
|
|
54530
|
-
...
|
|
54531
|
-
...
|
|
54980
|
+
...request2,
|
|
54981
|
+
...request2.authorizationList ? { to: null } : {},
|
|
54532
54982
|
data: calldata
|
|
54533
54983
|
});
|
|
54534
54984
|
}
|
|
@@ -54951,20 +55401,20 @@ var init_createWalletClient = __esm({
|
|
|
54951
55401
|
});
|
|
54952
55402
|
|
|
54953
55403
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/clients/transports/createTransport.js
|
|
54954
|
-
function createTransport({ key, methods, name, request, retryCount = 3, retryDelay = 150, timeout, type }, value) {
|
|
55404
|
+
function createTransport({ key, methods, name, request: request2, retryCount = 3, retryDelay = 150, timeout, type }, value) {
|
|
54955
55405
|
const uid2 = uid();
|
|
54956
55406
|
return {
|
|
54957
55407
|
config: {
|
|
54958
55408
|
key,
|
|
54959
55409
|
methods,
|
|
54960
55410
|
name,
|
|
54961
|
-
request,
|
|
55411
|
+
request: request2,
|
|
54962
55412
|
retryCount,
|
|
54963
55413
|
retryDelay,
|
|
54964
55414
|
timeout,
|
|
54965
55415
|
type
|
|
54966
55416
|
},
|
|
54967
|
-
request: buildRequest(
|
|
55417
|
+
request: buildRequest(request2, { methods, retryCount, retryDelay, uid: uid2 }),
|
|
54968
55418
|
value
|
|
54969
55419
|
};
|
|
54970
55420
|
}
|
|
@@ -55350,6 +55800,7 @@ var init_api2 = __esm({
|
|
|
55350
55800
|
"src/api.ts"() {
|
|
55351
55801
|
"use strict";
|
|
55352
55802
|
import_ajv = __toESM(require_ajv(), 1);
|
|
55803
|
+
init_package();
|
|
55353
55804
|
init_cli_error();
|
|
55354
55805
|
init_src2();
|
|
55355
55806
|
init_v1();
|
|
@@ -55554,6 +56005,23 @@ var init_api2 = __esm({
|
|
|
55554
56005
|
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", null, { cause });
|
|
55555
56006
|
}
|
|
55556
56007
|
}
|
|
56008
|
+
async authorizationServerMetadata() {
|
|
56009
|
+
const authorizationResponse = await this.publicFetch("/.well-known/oauth-authorization-server");
|
|
56010
|
+
if (authorizationResponse.status !== 200) {
|
|
56011
|
+
await authorizationResponse.body?.cancel().catch(() => void 0);
|
|
56012
|
+
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", authorizationResponse.status);
|
|
56013
|
+
}
|
|
56014
|
+
const authorization = jsonObject(await readBoundedJson(authorizationResponse));
|
|
56015
|
+
if (authorization.issuer !== this.origin || authorization.authorization_endpoint !== `${this.origin}/oauth/authorize` || !sameOriginEndpoint(authorization.token_endpoint, this.origin) || !sameOriginEndpoint(authorization.registration_endpoint, this.origin) || !includesCapabilities(authorization.response_types_supported, ["code"]) || !includesCapabilities(authorization.grant_types_supported, ["authorization_code", "refresh_token"]) || !includesCapabilities(authorization.token_endpoint_auth_methods_supported, ["none"]) || !includesCapabilities(authorization.code_challenge_methods_supported, ["S256"]) || !["boolean", "undefined"].includes(typeof authorization.authorization_response_iss_parameter_supported)) {
|
|
56016
|
+
throw new CliHttpError("CLI_RESPONSE_INVALID", authorizationResponse.status);
|
|
56017
|
+
}
|
|
56018
|
+
return authorization;
|
|
56019
|
+
}
|
|
56020
|
+
/** The issuer every authorization response must carry as `iss` (RFC 9207), or null when none is advertised. */
|
|
56021
|
+
async authorizationResponseIssuer() {
|
|
56022
|
+
const metadata = await this.authorizationServerMetadata();
|
|
56023
|
+
return metadata.authorization_response_iss_parameter_supported === true ? this.origin : null;
|
|
56024
|
+
}
|
|
55557
56025
|
async inspectRemoteMcp() {
|
|
55558
56026
|
const mcpUrl = `${this.origin}/mcp`;
|
|
55559
56027
|
const compatibilityManifestUrl = `${this.origin}/mcp/client-compatibility.json`;
|
|
@@ -55580,15 +56048,7 @@ var init_api2 = __esm({
|
|
|
55580
56048
|
if (resource.resource !== resourceMetadataAuthority.resource || !includesCapabilities(resource.authorization_servers, [this.origin])) {
|
|
55581
56049
|
throw new CliHttpError("CLI_RESPONSE_INVALID", resourceResponse.status);
|
|
55582
56050
|
}
|
|
55583
|
-
|
|
55584
|
-
if (authorizationResponse.status !== 200) {
|
|
55585
|
-
await authorizationResponse.body?.cancel().catch(() => void 0);
|
|
55586
|
-
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", authorizationResponse.status);
|
|
55587
|
-
}
|
|
55588
|
-
const authorization = jsonObject(await readBoundedJson(authorizationResponse));
|
|
55589
|
-
if (authorization.issuer !== this.origin || authorization.authorization_endpoint !== `${this.origin}/oauth/authorize` || !sameOriginEndpoint(authorization.token_endpoint, this.origin) || !sameOriginEndpoint(authorization.registration_endpoint, this.origin) || !includesCapabilities(authorization.response_types_supported, ["code"]) || !includesCapabilities(authorization.grant_types_supported, ["authorization_code", "refresh_token"]) || !includesCapabilities(authorization.token_endpoint_auth_methods_supported, ["none"]) || !includesCapabilities(authorization.code_challenge_methods_supported, ["S256"])) {
|
|
55590
|
-
throw new CliHttpError("CLI_RESPONSE_INVALID", authorizationResponse.status);
|
|
55591
|
-
}
|
|
56051
|
+
await this.authorizationServerMetadata();
|
|
55592
56052
|
return Object.freeze({
|
|
55593
56053
|
url: mcpUrl,
|
|
55594
56054
|
transport: "streamable_http",
|
|
@@ -55924,7 +56384,8 @@ var init_api2 = __esm({
|
|
|
55924
56384
|
errorContract: "oauth",
|
|
55925
56385
|
responseSchema: oauthAuthorizationResponseSchema,
|
|
55926
56386
|
bearer,
|
|
55927
|
-
body: {}
|
|
56387
|
+
body: {},
|
|
56388
|
+
headers: { [AGENT_CLI_MCP_AUTHORIZATION_CLIENT.versionHeader]: package_default.version }
|
|
55928
56389
|
});
|
|
55929
56390
|
}
|
|
55930
56391
|
createChallenge(input) {
|
|
@@ -56645,6 +57106,84 @@ var init_skill_buyer_intent_journal = __esm({
|
|
|
56645
57106
|
}
|
|
56646
57107
|
});
|
|
56647
57108
|
|
|
57109
|
+
// src/loopback-callback.ts
|
|
57110
|
+
import { lookup } from "node:dns/promises";
|
|
57111
|
+
import { request } from "node:http";
|
|
57112
|
+
import { isIP } from "node:net";
|
|
57113
|
+
function isLoopbackHttpUrl(url2) {
|
|
57114
|
+
return url2.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname);
|
|
57115
|
+
}
|
|
57116
|
+
function isLoopbackAddress(address2) {
|
|
57117
|
+
return address2 === "::1" || /^127\./u.test(address2);
|
|
57118
|
+
}
|
|
57119
|
+
function attempt(url2, address2, port) {
|
|
57120
|
+
return new Promise((resolve4, reject5) => {
|
|
57121
|
+
let connected = false;
|
|
57122
|
+
const outgoing = request({
|
|
57123
|
+
host: address2,
|
|
57124
|
+
port,
|
|
57125
|
+
method: "GET",
|
|
57126
|
+
path: `${url2.pathname}${url2.search}`,
|
|
57127
|
+
family: isIP(address2),
|
|
57128
|
+
headers: { host: url2.host, connection: "close" },
|
|
57129
|
+
timeout: DELIVERY_TIMEOUT_MILLISECONDS
|
|
57130
|
+
}, (response) => {
|
|
57131
|
+
let received = 0;
|
|
57132
|
+
response.on("data", (chunk) => {
|
|
57133
|
+
received += chunk.byteLength;
|
|
57134
|
+
if (received > MAXIMUM_RESPONSE_BYTES) response.destroy();
|
|
57135
|
+
});
|
|
57136
|
+
response.on("close", () => {
|
|
57137
|
+
const status = response.statusCode ?? 0;
|
|
57138
|
+
if (status >= 200 && status < 400) resolve4("delivered");
|
|
57139
|
+
else reject5(new McpAuthorizationFlowError("callback_rejected", { callbackStatus: status }));
|
|
57140
|
+
});
|
|
57141
|
+
});
|
|
57142
|
+
outgoing.on("socket", (socket) => {
|
|
57143
|
+
socket.once("connect", () => {
|
|
57144
|
+
connected = true;
|
|
57145
|
+
});
|
|
57146
|
+
});
|
|
57147
|
+
outgoing.on("timeout", () => outgoing.destroy(new Error("timeout")));
|
|
57148
|
+
outgoing.on("error", (cause) => {
|
|
57149
|
+
if (!connected) resolve4("not_connected");
|
|
57150
|
+
else reject5(new McpAuthorizationFlowError("callback_delivery_unknown", {}, { cause }));
|
|
57151
|
+
});
|
|
57152
|
+
outgoing.end();
|
|
57153
|
+
});
|
|
57154
|
+
}
|
|
57155
|
+
var DELIVERY_TIMEOUT_MILLISECONDS, MAXIMUM_RESPONSE_BYTES, LoopbackCallbackDelivery;
|
|
57156
|
+
var init_loopback_callback = __esm({
|
|
57157
|
+
"src/loopback-callback.ts"() {
|
|
57158
|
+
"use strict";
|
|
57159
|
+
init_cli_error();
|
|
57160
|
+
DELIVERY_TIMEOUT_MILLISECONDS = 15e3;
|
|
57161
|
+
MAXIMUM_RESPONSE_BYTES = 65536;
|
|
57162
|
+
LoopbackCallbackDelivery = class {
|
|
57163
|
+
constructor(resolve4 = async (hostname3) => (await lookup(hostname3, { all: true, verbatim: true })).map((entry2) => entry2.address), send = attempt) {
|
|
57164
|
+
this.resolve = resolve4;
|
|
57165
|
+
this.send = send;
|
|
57166
|
+
}
|
|
57167
|
+
resolve;
|
|
57168
|
+
send;
|
|
57169
|
+
async deliver(callbackUrl) {
|
|
57170
|
+
const url2 = new URL(callbackUrl);
|
|
57171
|
+
if (!isLoopbackHttpUrl(url2)) throw new TypeError("OAuth callback is not a loopback HTTP address.");
|
|
57172
|
+
const addresses = url2.hostname === "localhost" ? await this.resolve("localhost") : [url2.hostname === "[::1]" ? "::1" : url2.hostname];
|
|
57173
|
+
const loopback = addresses.filter(isLoopbackAddress);
|
|
57174
|
+
if (loopback.length === 0 || loopback.length !== addresses.length) {
|
|
57175
|
+
throw new McpAuthorizationFlowError("callback_unreachable");
|
|
57176
|
+
}
|
|
57177
|
+
const port = url2.port === "" ? 80 : Number(url2.port);
|
|
57178
|
+
for (const address2 of loopback) {
|
|
57179
|
+
if (await this.send(url2, address2, port) === "delivered") return;
|
|
57180
|
+
}
|
|
57181
|
+
throw new McpAuthorizationFlowError("callback_unreachable");
|
|
57182
|
+
}
|
|
57183
|
+
};
|
|
57184
|
+
}
|
|
57185
|
+
});
|
|
57186
|
+
|
|
56648
57187
|
// src/application.ts
|
|
56649
57188
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
56650
57189
|
import { open as open2 } from "node:fs/promises";
|
|
@@ -56913,7 +57452,7 @@ function parseTaskRecoveryJournal(value, expected) {
|
|
|
56913
57452
|
idempotencyKey: journal.idempotencyKey
|
|
56914
57453
|
});
|
|
56915
57454
|
}
|
|
56916
|
-
var FinchCliApplication;
|
|
57455
|
+
var MAXIMUM_STDIN_AUTHORIZATION_BYTES, FinchCliApplication;
|
|
56917
57456
|
var init_application = __esm({
|
|
56918
57457
|
"src/application.ts"() {
|
|
56919
57458
|
"use strict";
|
|
@@ -56927,6 +57466,8 @@ var init_application = __esm({
|
|
|
56927
57466
|
init_state();
|
|
56928
57467
|
init_skill_buyer_intent_journal();
|
|
56929
57468
|
init_cli_error();
|
|
57469
|
+
init_loopback_callback();
|
|
57470
|
+
MAXIMUM_STDIN_AUTHORIZATION_BYTES = 4098;
|
|
56930
57471
|
FinchCliApplication = class {
|
|
56931
57472
|
api;
|
|
56932
57473
|
state;
|
|
@@ -56940,6 +57481,9 @@ var init_application = __esm({
|
|
|
56940
57481
|
skillIntentSender;
|
|
56941
57482
|
skillLocalFlow;
|
|
56942
57483
|
browserLauncher;
|
|
57484
|
+
callbackDelivery;
|
|
57485
|
+
mcpLoginProcess;
|
|
57486
|
+
stdin;
|
|
56943
57487
|
constructor(dependencies) {
|
|
56944
57488
|
this.api = dependencies.api;
|
|
56945
57489
|
this.state = dependencies.state;
|
|
@@ -56953,6 +57497,9 @@ var init_application = __esm({
|
|
|
56953
57497
|
this.skillIntentSender = dependencies.skillIntentSender;
|
|
56954
57498
|
this.skillLocalFlow = dependencies.skillLocalFlow;
|
|
56955
57499
|
this.browserLauncher = dependencies.browserLauncher;
|
|
57500
|
+
this.callbackDelivery = dependencies.callbackDelivery;
|
|
57501
|
+
this.mcpLoginProcess = dependencies.mcpLoginProcess;
|
|
57502
|
+
this.stdin = dependencies.stdin;
|
|
56956
57503
|
}
|
|
56957
57504
|
async authorizedProfile() {
|
|
56958
57505
|
return this.activeProfile ?? await required2(this.state.readProfile, "state.readProfile").call(this.state);
|
|
@@ -57155,8 +57702,8 @@ var init_application = __esm({
|
|
|
57155
57702
|
const handoffId = this.randomUuid();
|
|
57156
57703
|
const token = this.randomBearer();
|
|
57157
57704
|
const tokenCommitment = `0x${createHash2("sha256").update(token, "utf8").digest("hex")}`;
|
|
57158
|
-
const
|
|
57159
|
-
const response = input.requestId === void 0 ? await required2(this.api.createBrowserHandoff, "api.createBrowserHandoff").call(this.api,
|
|
57705
|
+
const request2 = { handoffId, tokenCommitment };
|
|
57706
|
+
const response = input.requestId === void 0 ? await required2(this.api.createBrowserHandoff, "api.createBrowserHandoff").call(this.api, request2, input.session.rawBearer) : await required2(this.api.bindBrowserHandoff, "api.bindBrowserHandoff").call(this.api, { ...request2, requestId: input.requestId }, input.session.rawBearer);
|
|
57160
57707
|
const bound = asObject(response, "Browser handoff");
|
|
57161
57708
|
if (bound.accountId !== input.session.accountId || bound.environment !== input.session.environment || String(bound.walletAddress).toLowerCase() !== input.session.walletAddress.toLowerCase()) {
|
|
57162
57709
|
throw new CliAuthorityError();
|
|
@@ -57188,19 +57735,45 @@ var init_application = __esm({
|
|
|
57188
57735
|
const authority = await this.verifiedAgentCliAuthority();
|
|
57189
57736
|
return this.openBrowserHandoff({ ...authority, requestId: match[1] });
|
|
57190
57737
|
}
|
|
57738
|
+
/** Layer 3: the shell-safe request token shown on the Finch authorization page. */
|
|
57191
57739
|
async authorizeMcp(requestToken) {
|
|
57740
|
+
return this.authorizeMcpRequest(decodeAgentCliMcpAuthorizationRequest(requestToken));
|
|
57741
|
+
}
|
|
57742
|
+
/** Layer 2: one raw authorization URL on standard input, which argv cannot carry intact on Windows. */
|
|
57743
|
+
async authorizeMcpFromStdin() {
|
|
57744
|
+
const input = await required2(this.stdin, "stdin").readAll(MAXIMUM_STDIN_AUTHORIZATION_BYTES);
|
|
57745
|
+
const requestUrl = input.replace(/\r?\n$/u, "");
|
|
57746
|
+
if (requestUrl.length === 0 || /\s/u.test(requestUrl)) {
|
|
57747
|
+
throw new McpAuthorizationFlowError("stdin_invalid");
|
|
57748
|
+
}
|
|
57749
|
+
return this.authorizeMcpRequest(requestUrl);
|
|
57750
|
+
}
|
|
57751
|
+
/** Layer 1: run the MCP client's own login command and approve the URL it prints. */
|
|
57752
|
+
async connectMcp(command) {
|
|
57753
|
+
const profile = await this.authorizedProfile();
|
|
57754
|
+
await this.verifiedAgentCliAuthority();
|
|
57755
|
+
const session = required2(this.mcpLoginProcess, "MCP login process").start(command, profile.origin);
|
|
57756
|
+
try {
|
|
57757
|
+
const requestUrl = await session.authorizationUrl();
|
|
57758
|
+
const result2 = await this.authorizeMcpRequest(requestUrl, (code) => session.redact(code));
|
|
57759
|
+
await session.waitForExit();
|
|
57760
|
+
return Object.freeze({ ...result2, loginCommandExitCode: 0 });
|
|
57761
|
+
} finally {
|
|
57762
|
+
session.close();
|
|
57763
|
+
}
|
|
57764
|
+
}
|
|
57765
|
+
async authorizeMcpRequest(requestUrl, onAuthorizationCode) {
|
|
57192
57766
|
const profile = await this.authorizedProfile();
|
|
57193
|
-
|
|
57194
|
-
let request;
|
|
57767
|
+
let request2;
|
|
57195
57768
|
try {
|
|
57196
|
-
|
|
57769
|
+
request2 = new URL(requestUrl);
|
|
57197
57770
|
} catch {
|
|
57198
57771
|
throw new TypeError("MCP OAuth request URL is invalid.");
|
|
57199
57772
|
}
|
|
57200
|
-
const redirectValues =
|
|
57201
|
-
const stateValues =
|
|
57202
|
-
const scopeValues =
|
|
57203
|
-
if (
|
|
57773
|
+
const redirectValues = request2.searchParams.getAll("redirect_uri");
|
|
57774
|
+
const stateValues = request2.searchParams.getAll("state");
|
|
57775
|
+
const scopeValues = request2.searchParams.getAll("scope");
|
|
57776
|
+
if (request2.origin !== profile.origin || request2.pathname !== "/oauth/authorize" || request2.username !== "" || request2.password !== "" || request2.hash !== "" || requestUrl !== `${profile.origin}${request2.pathname}${request2.search}` || redirectValues.length !== 1 || stateValues.length > 1 || scopeValues.length > 1) {
|
|
57204
57777
|
throw new TypeError("MCP OAuth request URL does not match the active profile authority.");
|
|
57205
57778
|
}
|
|
57206
57779
|
let registeredRedirect;
|
|
@@ -57209,11 +57782,12 @@ var init_application = __esm({
|
|
|
57209
57782
|
} catch {
|
|
57210
57783
|
throw new TypeError("MCP OAuth redirect URI is invalid.");
|
|
57211
57784
|
}
|
|
57212
|
-
if (registeredRedirect.username !== "" || registeredRedirect.password !== "" || registeredRedirect.hash !== "") {
|
|
57785
|
+
if (registeredRedirect.username !== "" || registeredRedirect.password !== "" || registeredRedirect.hash !== "" || registeredRedirect.protocol !== "https:" && !isLoopbackHttpUrl(registeredRedirect)) {
|
|
57213
57786
|
throw new TypeError("MCP OAuth redirect URI is invalid.");
|
|
57214
57787
|
}
|
|
57215
57788
|
const authority = await this.verifiedAgentCliAuthority();
|
|
57216
|
-
const
|
|
57789
|
+
const expectedIssuer = await required2(this.api.authorizationResponseIssuer, "api.authorizationResponseIssuer").call(this.api);
|
|
57790
|
+
const response = asObject(await required2(this.api.authorizeMcp, "api.authorizeMcp").call(this.api, `${request2.pathname}${request2.search}`, authority.session.rawBearer), "MCP authorization");
|
|
57217
57791
|
if (response.authorized !== true || response.accountId !== authority.session.accountId || String(response.walletAddress).toLowerCase() !== authority.walletAddress || typeof response.clientName !== "string" || response.clientName.length < 1 || response.clientName.length > 128 || !Array.isArray(response.scopes) || response.scopes.some((scope) => typeof scope !== "string" || scope.length < 1) || typeof response.callbackUrl !== "string") {
|
|
57218
57792
|
throw new CliAuthorityError();
|
|
57219
57793
|
}
|
|
@@ -57232,23 +57806,33 @@ var init_application = __esm({
|
|
|
57232
57806
|
if (codes.length !== 1 || codes[0].length < 1 || callback.searchParams.has("error")) {
|
|
57233
57807
|
throw new TypeError("MCP OAuth callback is invalid.");
|
|
57234
57808
|
}
|
|
57809
|
+
onAuthorizationCode?.(codes[0]);
|
|
57235
57810
|
const expectedCallback = new URL(registeredRedirect.href);
|
|
57236
57811
|
expectedCallback.searchParams.set("code", codes[0]);
|
|
57237
57812
|
if (stateValues.length === 1) expectedCallback.searchParams.set("state", stateValues[0]);
|
|
57813
|
+
if (expectedIssuer !== null) expectedCallback.searchParams.set("iss", expectedIssuer);
|
|
57238
57814
|
const expectedParameters = new URLSearchParams(expectedCallback.search);
|
|
57239
57815
|
const callbackParameters = new URLSearchParams(callback.search);
|
|
57240
57816
|
expectedParameters.sort();
|
|
57241
57817
|
callbackParameters.sort();
|
|
57242
57818
|
if (callback.origin !== registeredRedirect.origin || callback.pathname !== registeredRedirect.pathname || callback.protocol !== registeredRedirect.protocol || callback.username !== "" || callback.password !== "" || callback.hash !== "" || callbackParameters.toString() !== expectedParameters.toString()) {
|
|
57243
|
-
throw new TypeError("MCP OAuth callback does not match the registered redirect and
|
|
57819
|
+
throw new TypeError("MCP OAuth callback does not match the registered redirect, state, and issuer.");
|
|
57820
|
+
}
|
|
57821
|
+
let callbackDelivery;
|
|
57822
|
+
if (isLoopbackHttpUrl(callback)) {
|
|
57823
|
+
await required2(this.callbackDelivery, "callback delivery").deliver(callback.href);
|
|
57824
|
+
callbackDelivery = "loopback_http";
|
|
57825
|
+
} else {
|
|
57826
|
+
await required2(this.browserLauncher, "browser launcher").open(callback.href);
|
|
57827
|
+
callbackDelivery = "browser";
|
|
57244
57828
|
}
|
|
57245
|
-
await required2(this.browserLauncher, "browser launcher").open(callback.href);
|
|
57246
57829
|
return Object.freeze({
|
|
57247
57830
|
authorized: true,
|
|
57248
57831
|
clientName: response.clientName,
|
|
57249
57832
|
walletAddress: authority.walletAddress,
|
|
57250
57833
|
environment: authority.session.environment,
|
|
57251
|
-
scopes: Object.freeze([...returnedScopes])
|
|
57834
|
+
scopes: Object.freeze([...returnedScopes]),
|
|
57835
|
+
callbackDelivery
|
|
57252
57836
|
});
|
|
57253
57837
|
}
|
|
57254
57838
|
async createWallet() {
|
|
@@ -58299,66 +58883,13 @@ var init_application = __esm({
|
|
|
58299
58883
|
}
|
|
58300
58884
|
});
|
|
58301
58885
|
|
|
58302
|
-
// package.json
|
|
58303
|
-
var package_default;
|
|
58304
|
-
var init_package = __esm({
|
|
58305
|
-
"package.json"() {
|
|
58306
|
-
package_default = {
|
|
58307
|
-
name: "@finchtech/cli",
|
|
58308
|
-
version: "0.3.9",
|
|
58309
|
-
description: "Finch Agent CLI for wallet-owned marketplace and MCP workflows.",
|
|
58310
|
-
type: "module",
|
|
58311
|
-
bin: {
|
|
58312
|
-
finch: "dist/finch.js",
|
|
58313
|
-
finchtech: "dist/finch.js"
|
|
58314
|
-
},
|
|
58315
|
-
files: [
|
|
58316
|
-
"dist/finch.js",
|
|
58317
|
-
"README.md",
|
|
58318
|
-
"THIRD_PARTY_LICENSES.txt"
|
|
58319
|
-
],
|
|
58320
|
-
engines: {
|
|
58321
|
-
node: ">=20"
|
|
58322
|
-
},
|
|
58323
|
-
publishConfig: {
|
|
58324
|
-
access: "public"
|
|
58325
|
-
},
|
|
58326
|
-
repository: {
|
|
58327
|
-
type: "git",
|
|
58328
|
-
url: "git+https://github.com/FinchipAI/Finch-Site.git",
|
|
58329
|
-
directory: "apps/cli"
|
|
58330
|
-
},
|
|
58331
|
-
homepage: "https://www.finchtech.ai",
|
|
58332
|
-
scripts: {
|
|
58333
|
-
build: 'esbuild src/bootstrap.ts --bundle --platform=node --format=esm --target=node20 --outfile=dist/finch.js --banner:js="#!/usr/bin/env node"',
|
|
58334
|
-
check: "pnpm lint && pnpm typecheck && pnpm test && pnpm build",
|
|
58335
|
-
lint: "eslint src vitest.config.ts eslint.config.mjs",
|
|
58336
|
-
prepack: "pnpm build",
|
|
58337
|
-
test: "vitest run",
|
|
58338
|
-
typecheck: "tsc --noEmit"
|
|
58339
|
-
},
|
|
58340
|
-
devDependencies: {
|
|
58341
|
-
"@finch/agent-market-contracts": "workspace:*",
|
|
58342
|
-
"@finch/deployment-manifest": "workspace:*",
|
|
58343
|
-
"@finch/skill-content": "workspace:*",
|
|
58344
|
-
"@finch/skill-market-contracts": "workspace:*",
|
|
58345
|
-
"@finch/task-market-contracts": "workspace:*",
|
|
58346
|
-
"@eslint/js": "9.39.2",
|
|
58347
|
-
"@types/node": "20.19.30",
|
|
58348
|
-
ajv: "8.20.0",
|
|
58349
|
-
esbuild: "0.28.2",
|
|
58350
|
-
eslint: "9.39.2",
|
|
58351
|
-
typescript: "5.9.3",
|
|
58352
|
-
"typescript-eslint": "8.67.0",
|
|
58353
|
-
viem: "2.55.15",
|
|
58354
|
-
vitest: "4.1.10"
|
|
58355
|
-
}
|
|
58356
|
-
};
|
|
58357
|
-
}
|
|
58358
|
-
});
|
|
58359
|
-
|
|
58360
58886
|
// src/command-router.ts
|
|
58361
|
-
function
|
|
58887
|
+
function finchOwnArguments(arguments_) {
|
|
58888
|
+
const separator = arguments_.indexOf("--");
|
|
58889
|
+
return separator < 0 ? arguments_ : arguments_.slice(0, separator);
|
|
58890
|
+
}
|
|
58891
|
+
function helpTopic(allArguments) {
|
|
58892
|
+
const arguments_ = finchOwnArguments(allArguments);
|
|
58362
58893
|
if (arguments_[0] === "help" && arguments_.length > 1) return arguments_.slice(1).join(" ");
|
|
58363
58894
|
if (arguments_.length > 1 && arguments_.at(-1) === "--help" && arguments_.filter((argument) => argument === "--help").length === 1) {
|
|
58364
58895
|
return arguments_.slice(0, -1).join(" ");
|
|
@@ -58482,7 +59013,13 @@ async function routeCommand(arguments_, application) {
|
|
|
58482
59013
|
if (first === "mcp" && second === "doctor" && arguments_.length === 2) {
|
|
58483
59014
|
return result("mcp.doctor", await method(application.doctorMcp, "mcp doctor").call(application));
|
|
58484
59015
|
}
|
|
58485
|
-
if (first === "mcp" && second === "
|
|
59016
|
+
if (first === "mcp" && second === "connect" && third === "--" && arguments_.length > 3) {
|
|
59017
|
+
return result("mcp.connect", await method(application.connectMcp, "mcp connect").call(application, Object.freeze(arguments_.slice(3))));
|
|
59018
|
+
}
|
|
59019
|
+
if (first === "mcp" && second === "authorize" && arguments_.length === 3 && third === "--stdin") {
|
|
59020
|
+
return result("mcp.authorize", await method(application.authorizeMcpFromStdin, "mcp authorize").call(application));
|
|
59021
|
+
}
|
|
59022
|
+
if (first === "mcp" && second === "authorize" && arguments_.length === 3 && third !== void 0 && !third.startsWith("--")) {
|
|
58486
59023
|
return result("mcp.authorize", await method(application.authorizeMcp, "mcp authorize").call(application, third));
|
|
58487
59024
|
}
|
|
58488
59025
|
if (first === "mcp" && second === "grant" && third === "create") {
|
|
@@ -58805,6 +59342,7 @@ var init_command_router = __esm({
|
|
|
58805
59342
|
"site open",
|
|
58806
59343
|
"site login",
|
|
58807
59344
|
"mcp doctor",
|
|
59345
|
+
"mcp connect",
|
|
58808
59346
|
"mcp authorize",
|
|
58809
59347
|
"mcp grant create",
|
|
58810
59348
|
"mcp grant show",
|
|
@@ -58871,7 +59409,8 @@ var init_command_router = __esm({
|
|
|
58871
59409
|
"site open": "finch site open",
|
|
58872
59410
|
"site login": "finch site login <REQUEST_URL>",
|
|
58873
59411
|
"mcp doctor": "finch mcp doctor",
|
|
58874
|
-
"mcp
|
|
59412
|
+
"mcp connect": "finch mcp connect -- <MCP_CLIENT_LOGIN_COMMAND...>",
|
|
59413
|
+
"mcp authorize": "finch mcp authorize --stdin | finch mcp authorize <REQUEST_TOKEN>",
|
|
58875
59414
|
"mcp grant create": "finch mcp grant create --scopes <CSV> --expires-at <ISO-8601>",
|
|
58876
59415
|
"mcp grant show": "finch mcp grant show <GRANT_ID>",
|
|
58877
59416
|
"mcp grant revoke": "finch mcp grant revoke <GRANT_ID>",
|
|
@@ -58927,6 +59466,735 @@ var init_command_router = __esm({
|
|
|
58927
59466
|
}
|
|
58928
59467
|
});
|
|
58929
59468
|
|
|
59469
|
+
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
59470
|
+
var require_windows = __commonJS({
|
|
59471
|
+
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
|
|
59472
|
+
module.exports = isexe;
|
|
59473
|
+
isexe.sync = sync;
|
|
59474
|
+
var fs = __require("fs");
|
|
59475
|
+
function checkPathExt(path2, options) {
|
|
59476
|
+
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
59477
|
+
if (!pathext) {
|
|
59478
|
+
return true;
|
|
59479
|
+
}
|
|
59480
|
+
pathext = pathext.split(";");
|
|
59481
|
+
if (pathext.indexOf("") !== -1) {
|
|
59482
|
+
return true;
|
|
59483
|
+
}
|
|
59484
|
+
for (var i2 = 0; i2 < pathext.length; i2++) {
|
|
59485
|
+
var p = pathext[i2].toLowerCase();
|
|
59486
|
+
if (p && path2.substr(-p.length).toLowerCase() === p) {
|
|
59487
|
+
return true;
|
|
59488
|
+
}
|
|
59489
|
+
}
|
|
59490
|
+
return false;
|
|
59491
|
+
}
|
|
59492
|
+
function checkStat(stat, path2, options) {
|
|
59493
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
59494
|
+
return false;
|
|
59495
|
+
}
|
|
59496
|
+
return checkPathExt(path2, options);
|
|
59497
|
+
}
|
|
59498
|
+
function isexe(path2, options, cb) {
|
|
59499
|
+
fs.stat(path2, function(er, stat) {
|
|
59500
|
+
cb(er, er ? false : checkStat(stat, path2, options));
|
|
59501
|
+
});
|
|
59502
|
+
}
|
|
59503
|
+
function sync(path2, options) {
|
|
59504
|
+
return checkStat(fs.statSync(path2), path2, options);
|
|
59505
|
+
}
|
|
59506
|
+
}
|
|
59507
|
+
});
|
|
59508
|
+
|
|
59509
|
+
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
59510
|
+
var require_mode = __commonJS({
|
|
59511
|
+
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
|
|
59512
|
+
module.exports = isexe;
|
|
59513
|
+
isexe.sync = sync;
|
|
59514
|
+
var fs = __require("fs");
|
|
59515
|
+
function isexe(path2, options, cb) {
|
|
59516
|
+
fs.stat(path2, function(er, stat) {
|
|
59517
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
59518
|
+
});
|
|
59519
|
+
}
|
|
59520
|
+
function sync(path2, options) {
|
|
59521
|
+
return checkStat(fs.statSync(path2), options);
|
|
59522
|
+
}
|
|
59523
|
+
function checkStat(stat, options) {
|
|
59524
|
+
return stat.isFile() && checkMode(stat, options);
|
|
59525
|
+
}
|
|
59526
|
+
function checkMode(stat, options) {
|
|
59527
|
+
var mod2 = stat.mode;
|
|
59528
|
+
var uid2 = stat.uid;
|
|
59529
|
+
var gid = stat.gid;
|
|
59530
|
+
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
59531
|
+
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
59532
|
+
var u = parseInt("100", 8);
|
|
59533
|
+
var g = parseInt("010", 8);
|
|
59534
|
+
var o = parseInt("001", 8);
|
|
59535
|
+
var ug = u | g;
|
|
59536
|
+
var ret = mod2 & o || mod2 & g && gid === myGid || mod2 & u && uid2 === myUid || mod2 & ug && myUid === 0;
|
|
59537
|
+
return ret;
|
|
59538
|
+
}
|
|
59539
|
+
}
|
|
59540
|
+
});
|
|
59541
|
+
|
|
59542
|
+
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
59543
|
+
var require_isexe = __commonJS({
|
|
59544
|
+
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
|
|
59545
|
+
var fs = __require("fs");
|
|
59546
|
+
var core;
|
|
59547
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
59548
|
+
core = require_windows();
|
|
59549
|
+
} else {
|
|
59550
|
+
core = require_mode();
|
|
59551
|
+
}
|
|
59552
|
+
module.exports = isexe;
|
|
59553
|
+
isexe.sync = sync;
|
|
59554
|
+
function isexe(path2, options, cb) {
|
|
59555
|
+
if (typeof options === "function") {
|
|
59556
|
+
cb = options;
|
|
59557
|
+
options = {};
|
|
59558
|
+
}
|
|
59559
|
+
if (!cb) {
|
|
59560
|
+
if (typeof Promise !== "function") {
|
|
59561
|
+
throw new TypeError("callback not provided");
|
|
59562
|
+
}
|
|
59563
|
+
return new Promise(function(resolve4, reject5) {
|
|
59564
|
+
isexe(path2, options || {}, function(er, is2) {
|
|
59565
|
+
if (er) {
|
|
59566
|
+
reject5(er);
|
|
59567
|
+
} else {
|
|
59568
|
+
resolve4(is2);
|
|
59569
|
+
}
|
|
59570
|
+
});
|
|
59571
|
+
});
|
|
59572
|
+
}
|
|
59573
|
+
core(path2, options || {}, function(er, is2) {
|
|
59574
|
+
if (er) {
|
|
59575
|
+
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
59576
|
+
er = null;
|
|
59577
|
+
is2 = false;
|
|
59578
|
+
}
|
|
59579
|
+
}
|
|
59580
|
+
cb(er, is2);
|
|
59581
|
+
});
|
|
59582
|
+
}
|
|
59583
|
+
function sync(path2, options) {
|
|
59584
|
+
try {
|
|
59585
|
+
return core.sync(path2, options || {});
|
|
59586
|
+
} catch (er) {
|
|
59587
|
+
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
59588
|
+
return false;
|
|
59589
|
+
} else {
|
|
59590
|
+
throw er;
|
|
59591
|
+
}
|
|
59592
|
+
}
|
|
59593
|
+
}
|
|
59594
|
+
}
|
|
59595
|
+
});
|
|
59596
|
+
|
|
59597
|
+
// ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
59598
|
+
var require_which = __commonJS({
|
|
59599
|
+
"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
|
|
59600
|
+
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
59601
|
+
var path2 = __require("path");
|
|
59602
|
+
var COLON = isWindows ? ";" : ":";
|
|
59603
|
+
var isexe = require_isexe();
|
|
59604
|
+
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
59605
|
+
var getPathInfo = (cmd, opt) => {
|
|
59606
|
+
const colon = opt.colon || COLON;
|
|
59607
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
59608
|
+
// windows always checks the cwd first
|
|
59609
|
+
...isWindows ? [process.cwd()] : [],
|
|
59610
|
+
...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
59611
|
+
"").split(colon)
|
|
59612
|
+
];
|
|
59613
|
+
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
59614
|
+
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
59615
|
+
if (isWindows) {
|
|
59616
|
+
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
|
59617
|
+
pathExt.unshift("");
|
|
59618
|
+
}
|
|
59619
|
+
return {
|
|
59620
|
+
pathEnv,
|
|
59621
|
+
pathExt,
|
|
59622
|
+
pathExtExe
|
|
59623
|
+
};
|
|
59624
|
+
};
|
|
59625
|
+
var which = (cmd, opt, cb) => {
|
|
59626
|
+
if (typeof opt === "function") {
|
|
59627
|
+
cb = opt;
|
|
59628
|
+
opt = {};
|
|
59629
|
+
}
|
|
59630
|
+
if (!opt)
|
|
59631
|
+
opt = {};
|
|
59632
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
59633
|
+
const found = [];
|
|
59634
|
+
const step = (i2) => new Promise((resolve4, reject5) => {
|
|
59635
|
+
if (i2 === pathEnv.length)
|
|
59636
|
+
return opt.all && found.length ? resolve4(found) : reject5(getNotFoundError(cmd));
|
|
59637
|
+
const ppRaw = pathEnv[i2];
|
|
59638
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
59639
|
+
const pCmd = path2.join(pathPart, cmd);
|
|
59640
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
59641
|
+
resolve4(subStep(p, i2, 0));
|
|
59642
|
+
});
|
|
59643
|
+
const subStep = (p, i2, ii) => new Promise((resolve4, reject5) => {
|
|
59644
|
+
if (ii === pathExt.length)
|
|
59645
|
+
return resolve4(step(i2 + 1));
|
|
59646
|
+
const ext = pathExt[ii];
|
|
59647
|
+
isexe(p + ext, { pathExt: pathExtExe }, (er, is2) => {
|
|
59648
|
+
if (!er && is2) {
|
|
59649
|
+
if (opt.all)
|
|
59650
|
+
found.push(p + ext);
|
|
59651
|
+
else
|
|
59652
|
+
return resolve4(p + ext);
|
|
59653
|
+
}
|
|
59654
|
+
return resolve4(subStep(p, i2, ii + 1));
|
|
59655
|
+
});
|
|
59656
|
+
});
|
|
59657
|
+
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
59658
|
+
};
|
|
59659
|
+
var whichSync = (cmd, opt) => {
|
|
59660
|
+
opt = opt || {};
|
|
59661
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
59662
|
+
const found = [];
|
|
59663
|
+
for (let i2 = 0; i2 < pathEnv.length; i2++) {
|
|
59664
|
+
const ppRaw = pathEnv[i2];
|
|
59665
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
59666
|
+
const pCmd = path2.join(pathPart, cmd);
|
|
59667
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
59668
|
+
for (let j = 0; j < pathExt.length; j++) {
|
|
59669
|
+
const cur = p + pathExt[j];
|
|
59670
|
+
try {
|
|
59671
|
+
const is2 = isexe.sync(cur, { pathExt: pathExtExe });
|
|
59672
|
+
if (is2) {
|
|
59673
|
+
if (opt.all)
|
|
59674
|
+
found.push(cur);
|
|
59675
|
+
else
|
|
59676
|
+
return cur;
|
|
59677
|
+
}
|
|
59678
|
+
} catch (ex) {
|
|
59679
|
+
}
|
|
59680
|
+
}
|
|
59681
|
+
}
|
|
59682
|
+
if (opt.all && found.length)
|
|
59683
|
+
return found;
|
|
59684
|
+
if (opt.nothrow)
|
|
59685
|
+
return null;
|
|
59686
|
+
throw getNotFoundError(cmd);
|
|
59687
|
+
};
|
|
59688
|
+
module.exports = which;
|
|
59689
|
+
which.sync = whichSync;
|
|
59690
|
+
}
|
|
59691
|
+
});
|
|
59692
|
+
|
|
59693
|
+
// ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
59694
|
+
var require_path_key = __commonJS({
|
|
59695
|
+
"../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module) {
|
|
59696
|
+
"use strict";
|
|
59697
|
+
var pathKey = (options = {}) => {
|
|
59698
|
+
const environment3 = options.env || process.env;
|
|
59699
|
+
const platform = options.platform || process.platform;
|
|
59700
|
+
if (platform !== "win32") {
|
|
59701
|
+
return "PATH";
|
|
59702
|
+
}
|
|
59703
|
+
return Object.keys(environment3).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
59704
|
+
};
|
|
59705
|
+
module.exports = pathKey;
|
|
59706
|
+
module.exports.default = pathKey;
|
|
59707
|
+
}
|
|
59708
|
+
});
|
|
59709
|
+
|
|
59710
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
59711
|
+
var require_resolveCommand = __commonJS({
|
|
59712
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
59713
|
+
"use strict";
|
|
59714
|
+
var path2 = __require("path");
|
|
59715
|
+
var which = require_which();
|
|
59716
|
+
var getPathKey = require_path_key();
|
|
59717
|
+
function resolveCommandAttempt(parsed2, withoutPathExt) {
|
|
59718
|
+
const env = parsed2.options.env || process.env;
|
|
59719
|
+
const cwd = process.cwd();
|
|
59720
|
+
const hasCustomCwd = parsed2.options.cwd != null;
|
|
59721
|
+
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
59722
|
+
if (shouldSwitchCwd) {
|
|
59723
|
+
try {
|
|
59724
|
+
process.chdir(parsed2.options.cwd);
|
|
59725
|
+
} catch (err2) {
|
|
59726
|
+
}
|
|
59727
|
+
}
|
|
59728
|
+
let resolved;
|
|
59729
|
+
try {
|
|
59730
|
+
resolved = which.sync(parsed2.command, {
|
|
59731
|
+
path: env[getPathKey({ env })],
|
|
59732
|
+
pathExt: withoutPathExt ? path2.delimiter : void 0
|
|
59733
|
+
});
|
|
59734
|
+
} catch (e) {
|
|
59735
|
+
} finally {
|
|
59736
|
+
if (shouldSwitchCwd) {
|
|
59737
|
+
process.chdir(cwd);
|
|
59738
|
+
}
|
|
59739
|
+
}
|
|
59740
|
+
if (resolved) {
|
|
59741
|
+
resolved = path2.resolve(hasCustomCwd ? parsed2.options.cwd : "", resolved);
|
|
59742
|
+
}
|
|
59743
|
+
return resolved;
|
|
59744
|
+
}
|
|
59745
|
+
function resolveCommand(parsed2) {
|
|
59746
|
+
return resolveCommandAttempt(parsed2) || resolveCommandAttempt(parsed2, true);
|
|
59747
|
+
}
|
|
59748
|
+
module.exports = resolveCommand;
|
|
59749
|
+
}
|
|
59750
|
+
});
|
|
59751
|
+
|
|
59752
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
59753
|
+
var require_escape = __commonJS({
|
|
59754
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
|
|
59755
|
+
"use strict";
|
|
59756
|
+
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
59757
|
+
function escapeCommand(arg) {
|
|
59758
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
59759
|
+
return arg;
|
|
59760
|
+
}
|
|
59761
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
59762
|
+
arg = `${arg}`;
|
|
59763
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
|
|
59764
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
59765
|
+
arg = `"${arg}"`;
|
|
59766
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
59767
|
+
if (doubleEscapeMetaChars) {
|
|
59768
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
59769
|
+
}
|
|
59770
|
+
return arg;
|
|
59771
|
+
}
|
|
59772
|
+
module.exports.command = escapeCommand;
|
|
59773
|
+
module.exports.argument = escapeArgument;
|
|
59774
|
+
}
|
|
59775
|
+
});
|
|
59776
|
+
|
|
59777
|
+
// ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
59778
|
+
var require_shebang_regex = __commonJS({
|
|
59779
|
+
"../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module) {
|
|
59780
|
+
"use strict";
|
|
59781
|
+
module.exports = /^#!(.*)/;
|
|
59782
|
+
}
|
|
59783
|
+
});
|
|
59784
|
+
|
|
59785
|
+
// ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
59786
|
+
var require_shebang_command = __commonJS({
|
|
59787
|
+
"../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module) {
|
|
59788
|
+
"use strict";
|
|
59789
|
+
var shebangRegex = require_shebang_regex();
|
|
59790
|
+
module.exports = (string5 = "") => {
|
|
59791
|
+
const match = string5.match(shebangRegex);
|
|
59792
|
+
if (!match) {
|
|
59793
|
+
return null;
|
|
59794
|
+
}
|
|
59795
|
+
const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
59796
|
+
const binary = path2.split("/").pop();
|
|
59797
|
+
if (binary === "env") {
|
|
59798
|
+
return argument;
|
|
59799
|
+
}
|
|
59800
|
+
return argument ? `${binary} ${argument}` : binary;
|
|
59801
|
+
};
|
|
59802
|
+
}
|
|
59803
|
+
});
|
|
59804
|
+
|
|
59805
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
59806
|
+
var require_readShebang = __commonJS({
|
|
59807
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
59808
|
+
"use strict";
|
|
59809
|
+
var fs = __require("fs");
|
|
59810
|
+
var shebangCommand = require_shebang_command();
|
|
59811
|
+
function readShebang(command) {
|
|
59812
|
+
const size5 = 150;
|
|
59813
|
+
const buffer3 = Buffer.alloc(size5);
|
|
59814
|
+
let fd2;
|
|
59815
|
+
try {
|
|
59816
|
+
fd2 = fs.openSync(command, "r");
|
|
59817
|
+
fs.readSync(fd2, buffer3, 0, size5, 0);
|
|
59818
|
+
fs.closeSync(fd2);
|
|
59819
|
+
} catch (e) {
|
|
59820
|
+
}
|
|
59821
|
+
return shebangCommand(buffer3.toString());
|
|
59822
|
+
}
|
|
59823
|
+
module.exports = readShebang;
|
|
59824
|
+
}
|
|
59825
|
+
});
|
|
59826
|
+
|
|
59827
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
59828
|
+
var require_parse = __commonJS({
|
|
59829
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
59830
|
+
"use strict";
|
|
59831
|
+
var path2 = __require("path");
|
|
59832
|
+
var resolveCommand = require_resolveCommand();
|
|
59833
|
+
var escape2 = require_escape();
|
|
59834
|
+
var readShebang = require_readShebang();
|
|
59835
|
+
var isWin = process.platform === "win32";
|
|
59836
|
+
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
59837
|
+
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
59838
|
+
function detectShebang(parsed2) {
|
|
59839
|
+
parsed2.file = resolveCommand(parsed2);
|
|
59840
|
+
const shebang = parsed2.file && readShebang(parsed2.file);
|
|
59841
|
+
if (shebang) {
|
|
59842
|
+
parsed2.args.unshift(parsed2.file);
|
|
59843
|
+
parsed2.command = shebang;
|
|
59844
|
+
return resolveCommand(parsed2);
|
|
59845
|
+
}
|
|
59846
|
+
return parsed2.file;
|
|
59847
|
+
}
|
|
59848
|
+
function parseNonShell(parsed2) {
|
|
59849
|
+
if (!isWin) {
|
|
59850
|
+
return parsed2;
|
|
59851
|
+
}
|
|
59852
|
+
const commandFile = detectShebang(parsed2);
|
|
59853
|
+
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
59854
|
+
if (parsed2.options.forceShell || needsShell) {
|
|
59855
|
+
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
59856
|
+
parsed2.command = path2.normalize(parsed2.command);
|
|
59857
|
+
parsed2.command = escape2.command(parsed2.command);
|
|
59858
|
+
parsed2.args = parsed2.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
59859
|
+
const shellCommand = [parsed2.command].concat(parsed2.args).join(" ");
|
|
59860
|
+
parsed2.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
59861
|
+
parsed2.command = process.env.comspec || "cmd.exe";
|
|
59862
|
+
parsed2.options.windowsVerbatimArguments = true;
|
|
59863
|
+
}
|
|
59864
|
+
return parsed2;
|
|
59865
|
+
}
|
|
59866
|
+
function parse4(command, args, options) {
|
|
59867
|
+
if (args && !Array.isArray(args)) {
|
|
59868
|
+
options = args;
|
|
59869
|
+
args = null;
|
|
59870
|
+
}
|
|
59871
|
+
args = args ? args.slice(0) : [];
|
|
59872
|
+
options = Object.assign({}, options);
|
|
59873
|
+
const parsed2 = {
|
|
59874
|
+
command,
|
|
59875
|
+
args,
|
|
59876
|
+
options,
|
|
59877
|
+
file: void 0,
|
|
59878
|
+
original: {
|
|
59879
|
+
command,
|
|
59880
|
+
args
|
|
59881
|
+
}
|
|
59882
|
+
};
|
|
59883
|
+
return options.shell ? parsed2 : parseNonShell(parsed2);
|
|
59884
|
+
}
|
|
59885
|
+
module.exports = parse4;
|
|
59886
|
+
}
|
|
59887
|
+
});
|
|
59888
|
+
|
|
59889
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
59890
|
+
var require_enoent = __commonJS({
|
|
59891
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module) {
|
|
59892
|
+
"use strict";
|
|
59893
|
+
var isWin = process.platform === "win32";
|
|
59894
|
+
function notFoundError(original, syscall) {
|
|
59895
|
+
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
59896
|
+
code: "ENOENT",
|
|
59897
|
+
errno: "ENOENT",
|
|
59898
|
+
syscall: `${syscall} ${original.command}`,
|
|
59899
|
+
path: original.command,
|
|
59900
|
+
spawnargs: original.args
|
|
59901
|
+
});
|
|
59902
|
+
}
|
|
59903
|
+
function hookChildProcess(cp, parsed2) {
|
|
59904
|
+
if (!isWin) {
|
|
59905
|
+
return;
|
|
59906
|
+
}
|
|
59907
|
+
const originalEmit = cp.emit;
|
|
59908
|
+
cp.emit = function(name, arg1) {
|
|
59909
|
+
if (name === "exit") {
|
|
59910
|
+
const err2 = verifyENOENT(arg1, parsed2);
|
|
59911
|
+
if (err2) {
|
|
59912
|
+
return originalEmit.call(cp, "error", err2);
|
|
59913
|
+
}
|
|
59914
|
+
}
|
|
59915
|
+
return originalEmit.apply(cp, arguments);
|
|
59916
|
+
};
|
|
59917
|
+
}
|
|
59918
|
+
function verifyENOENT(status, parsed2) {
|
|
59919
|
+
if (isWin && status === 1 && !parsed2.file) {
|
|
59920
|
+
return notFoundError(parsed2.original, "spawn");
|
|
59921
|
+
}
|
|
59922
|
+
return null;
|
|
59923
|
+
}
|
|
59924
|
+
function verifyENOENTSync(status, parsed2) {
|
|
59925
|
+
if (isWin && status === 1 && !parsed2.file) {
|
|
59926
|
+
return notFoundError(parsed2.original, "spawnSync");
|
|
59927
|
+
}
|
|
59928
|
+
return null;
|
|
59929
|
+
}
|
|
59930
|
+
module.exports = {
|
|
59931
|
+
hookChildProcess,
|
|
59932
|
+
verifyENOENT,
|
|
59933
|
+
verifyENOENTSync,
|
|
59934
|
+
notFoundError
|
|
59935
|
+
};
|
|
59936
|
+
}
|
|
59937
|
+
});
|
|
59938
|
+
|
|
59939
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
|
|
59940
|
+
var require_cross_spawn = __commonJS({
|
|
59941
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module) {
|
|
59942
|
+
"use strict";
|
|
59943
|
+
var cp = __require("child_process");
|
|
59944
|
+
var parse4 = require_parse();
|
|
59945
|
+
var enoent = require_enoent();
|
|
59946
|
+
function spawn2(command, args, options) {
|
|
59947
|
+
const parsed2 = parse4(command, args, options);
|
|
59948
|
+
const spawned = cp.spawn(parsed2.command, parsed2.args, parsed2.options);
|
|
59949
|
+
enoent.hookChildProcess(spawned, parsed2);
|
|
59950
|
+
return spawned;
|
|
59951
|
+
}
|
|
59952
|
+
function spawnSync2(command, args, options) {
|
|
59953
|
+
const parsed2 = parse4(command, args, options);
|
|
59954
|
+
const result2 = cp.spawnSync(parsed2.command, parsed2.args, parsed2.options);
|
|
59955
|
+
result2.error = result2.error || enoent.verifyENOENTSync(result2.status, parsed2);
|
|
59956
|
+
return result2;
|
|
59957
|
+
}
|
|
59958
|
+
module.exports = spawn2;
|
|
59959
|
+
module.exports.spawn = spawn2;
|
|
59960
|
+
module.exports.sync = spawnSync2;
|
|
59961
|
+
module.exports._parse = parse4;
|
|
59962
|
+
module.exports._enoent = enoent;
|
|
59963
|
+
}
|
|
59964
|
+
});
|
|
59965
|
+
|
|
59966
|
+
// src/authorization-url-scanner.ts
|
|
59967
|
+
function escapeRegExp(value) {
|
|
59968
|
+
return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
59969
|
+
}
|
|
59970
|
+
var MAXIMUM_BUFFERED_LINE_CHARACTERS, URL_CHARACTERS, OSC8_HYPERLINK, ESCAPE_SEQUENCE, AuthorizationUrlScanner;
|
|
59971
|
+
var init_authorization_url_scanner = __esm({
|
|
59972
|
+
"src/authorization-url-scanner.ts"() {
|
|
59973
|
+
"use strict";
|
|
59974
|
+
MAXIMUM_BUFFERED_LINE_CHARACTERS = 16384;
|
|
59975
|
+
URL_CHARACTERS = '[^\\s"<>`{}|\\\\^]+';
|
|
59976
|
+
OSC8_HYPERLINK = /\u001b\]8;[^;\u0007\u001b]*;([^\u0007\u001b]*)(?:\u0007|\u001b\\)/gu;
|
|
59977
|
+
ESCAPE_SEQUENCE = /\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)|\u001b\[[0-?]*[ -/]*[@-~]|\u001b[@-_]/gu;
|
|
59978
|
+
AuthorizationUrlScanner = class {
|
|
59979
|
+
pattern;
|
|
59980
|
+
buffers = /* @__PURE__ */ new Map();
|
|
59981
|
+
seen = /* @__PURE__ */ new Set();
|
|
59982
|
+
constructor(origin2) {
|
|
59983
|
+
this.pattern = new RegExp(`${escapeRegExp(`${origin2}/oauth/authorize?`)}${URL_CHARACTERS}`, "gu");
|
|
59984
|
+
}
|
|
59985
|
+
/**
|
|
59986
|
+
* Adds one chunk of one stream. Returns the complete lines it closed, for forwarding, and every
|
|
59987
|
+
* authorization URL those lines introduced that was not seen before on any stream.
|
|
59988
|
+
*/
|
|
59989
|
+
feed(stream, chunk) {
|
|
59990
|
+
const buffered = `${this.buffers.get(stream) ?? ""}${chunk}`;
|
|
59991
|
+
const parts = buffered.split(/\r\n|\n|\r/u);
|
|
59992
|
+
let remainder = parts.pop();
|
|
59993
|
+
if (remainder.length > MAXIMUM_BUFFERED_LINE_CHARACTERS) {
|
|
59994
|
+
parts.push(remainder);
|
|
59995
|
+
remainder = "";
|
|
59996
|
+
}
|
|
59997
|
+
this.buffers.set(stream, remainder);
|
|
59998
|
+
return this.scan(parts);
|
|
59999
|
+
}
|
|
60000
|
+
/** Closes one stream, treating any unterminated text as its final line. */
|
|
60001
|
+
end(stream) {
|
|
60002
|
+
const remainder = this.buffers.get(stream) ?? "";
|
|
60003
|
+
this.buffers.delete(stream);
|
|
60004
|
+
return this.scan(remainder === "" ? [] : [remainder]);
|
|
60005
|
+
}
|
|
60006
|
+
scan(lines) {
|
|
60007
|
+
const urls = [];
|
|
60008
|
+
for (const line of lines) {
|
|
60009
|
+
const hyperlinkTargets = [...line.matchAll(OSC8_HYPERLINK)].map((match) => match[1]);
|
|
60010
|
+
const visible = line.replace(ESCAPE_SEQUENCE, "");
|
|
60011
|
+
for (const text3 of [...hyperlinkTargets, visible]) {
|
|
60012
|
+
for (const match of text3.matchAll(this.pattern)) {
|
|
60013
|
+
const url2 = match[0];
|
|
60014
|
+
if (!this.seen.has(url2)) {
|
|
60015
|
+
this.seen.add(url2);
|
|
60016
|
+
urls.push(url2);
|
|
60017
|
+
}
|
|
60018
|
+
}
|
|
60019
|
+
}
|
|
60020
|
+
}
|
|
60021
|
+
return Object.freeze({ lines: Object.freeze([...lines]), urls: Object.freeze(urls) });
|
|
60022
|
+
}
|
|
60023
|
+
};
|
|
60024
|
+
}
|
|
60025
|
+
});
|
|
60026
|
+
|
|
60027
|
+
// src/mcp-login-process.ts
|
|
60028
|
+
import { spawn as spawnSync } from "node:child_process";
|
|
60029
|
+
function terminate(child) {
|
|
60030
|
+
if (child.exitCode !== null || child.signalCode !== null || child.pid === void 0) return;
|
|
60031
|
+
if (process.platform === "win32") {
|
|
60032
|
+
spawnSync("taskkill", ["/pid", String(child.pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
|
|
60033
|
+
} else {
|
|
60034
|
+
child.kill("SIGTERM");
|
|
60035
|
+
}
|
|
60036
|
+
}
|
|
60037
|
+
var import_cross_spawn, AUTHORIZATION_URL_TIMEOUT_MILLISECONDS, LOGIN_EXIT_TIMEOUT_MILLISECONDS, spawnLoginCommand, InstalledMcpLoginSession, InstalledMcpLoginProcess;
|
|
60038
|
+
var init_mcp_login_process = __esm({
|
|
60039
|
+
"src/mcp-login-process.ts"() {
|
|
60040
|
+
"use strict";
|
|
60041
|
+
import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
60042
|
+
init_authorization_url_scanner();
|
|
60043
|
+
init_cli_error();
|
|
60044
|
+
AUTHORIZATION_URL_TIMEOUT_MILLISECONDS = 12e4;
|
|
60045
|
+
LOGIN_EXIT_TIMEOUT_MILLISECONDS = 6e4;
|
|
60046
|
+
spawnLoginCommand = (command, arguments_) => (0, import_cross_spawn.default)(command, [...arguments_], {
|
|
60047
|
+
// stdin stays an open pipe that is never written: clients that also accept a pasted callback
|
|
60048
|
+
// treat end-of-input as a failed login.
|
|
60049
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
60050
|
+
windowsHide: true
|
|
60051
|
+
});
|
|
60052
|
+
InstalledMcpLoginSession = class {
|
|
60053
|
+
constructor(child, origin2, diagnostics, timeouts) {
|
|
60054
|
+
this.child = child;
|
|
60055
|
+
this.diagnostics = diagnostics;
|
|
60056
|
+
this.timeouts = timeouts;
|
|
60057
|
+
this.scanner = new AuthorizationUrlScanner(origin2);
|
|
60058
|
+
this.firstUrlPromise = new Promise((resolve4, reject5) => {
|
|
60059
|
+
this.firstUrl = resolve4;
|
|
60060
|
+
this.firstUrlFailed = reject5;
|
|
60061
|
+
});
|
|
60062
|
+
this.firstUrlPromise.catch(() => void 0);
|
|
60063
|
+
for (const [name, stream] of [["stdout", child.stdout], ["stderr", child.stderr]]) {
|
|
60064
|
+
stream?.setEncoding("utf8");
|
|
60065
|
+
stream?.on("data", (chunk) => this.accept(this.scanner.feed(name, chunk)));
|
|
60066
|
+
stream?.on("end", () => this.accept(this.scanner.end(name)));
|
|
60067
|
+
}
|
|
60068
|
+
this.exited = new Promise((resolve4) => {
|
|
60069
|
+
child.once("error", (cause) => {
|
|
60070
|
+
this.firstUrlFailed?.(new McpAuthorizationFlowError("login_command_not_started", {}, { cause }));
|
|
60071
|
+
resolve4(-1);
|
|
60072
|
+
});
|
|
60073
|
+
child.once("close", (code) => resolve4(code ?? -1));
|
|
60074
|
+
});
|
|
60075
|
+
void this.exited.then((code) => this.firstUrlFailed?.(new McpAuthorizationFlowError(
|
|
60076
|
+
"request_url_not_found",
|
|
60077
|
+
{ loginCommandExitCode: code }
|
|
60078
|
+
)));
|
|
60079
|
+
}
|
|
60080
|
+
child;
|
|
60081
|
+
diagnostics;
|
|
60082
|
+
timeouts;
|
|
60083
|
+
scanner;
|
|
60084
|
+
secrets = [];
|
|
60085
|
+
exited;
|
|
60086
|
+
firstUrl;
|
|
60087
|
+
firstUrlFailed;
|
|
60088
|
+
firstUrlPromise;
|
|
60089
|
+
authorizationUrlCount = 0;
|
|
60090
|
+
accept(scan) {
|
|
60091
|
+
for (const line of scan.lines) {
|
|
60092
|
+
this.diagnostics(`${this.secrets.reduce((text3, secret) => text3.split(secret).join("[REDACTED]"), line)}
|
|
60093
|
+
`);
|
|
60094
|
+
}
|
|
60095
|
+
for (const url2 of scan.urls) {
|
|
60096
|
+
this.authorizationUrlCount += 1;
|
|
60097
|
+
if (this.authorizationUrlCount === 1) this.firstUrl?.(url2);
|
|
60098
|
+
}
|
|
60099
|
+
}
|
|
60100
|
+
async authorizationUrl() {
|
|
60101
|
+
let timer;
|
|
60102
|
+
const timeout = new Promise((_resolve, reject5) => {
|
|
60103
|
+
timer = setTimeout(
|
|
60104
|
+
() => reject5(new McpAuthorizationFlowError("request_url_not_found")),
|
|
60105
|
+
this.timeouts.authorizationUrl
|
|
60106
|
+
);
|
|
60107
|
+
});
|
|
60108
|
+
try {
|
|
60109
|
+
return await Promise.race([this.firstUrlPromise, timeout]);
|
|
60110
|
+
} finally {
|
|
60111
|
+
clearTimeout(timer);
|
|
60112
|
+
}
|
|
60113
|
+
}
|
|
60114
|
+
redact(secret) {
|
|
60115
|
+
if (secret.length > 0) this.secrets.push(secret);
|
|
60116
|
+
}
|
|
60117
|
+
async waitForExit() {
|
|
60118
|
+
let timer;
|
|
60119
|
+
const timeout = new Promise((resolve4) => {
|
|
60120
|
+
timer = setTimeout(() => resolve4("timeout"), this.timeouts.exit);
|
|
60121
|
+
});
|
|
60122
|
+
try {
|
|
60123
|
+
const code = await Promise.race([this.exited, timeout]);
|
|
60124
|
+
if (this.authorizationUrlCount > 1) {
|
|
60125
|
+
throw new McpAuthorizationFlowError("second_authorization_request");
|
|
60126
|
+
}
|
|
60127
|
+
if (code === "timeout") throw new McpAuthorizationFlowError("login_command_timeout");
|
|
60128
|
+
if (code !== 0) throw new McpAuthorizationFlowError("login_command_failed", { loginCommandExitCode: code });
|
|
60129
|
+
return code;
|
|
60130
|
+
} finally {
|
|
60131
|
+
clearTimeout(timer);
|
|
60132
|
+
}
|
|
60133
|
+
}
|
|
60134
|
+
close() {
|
|
60135
|
+
terminate(this.child);
|
|
60136
|
+
this.child.stdin?.end();
|
|
60137
|
+
}
|
|
60138
|
+
};
|
|
60139
|
+
InstalledMcpLoginProcess = class {
|
|
60140
|
+
constructor(spawn2 = spawnLoginCommand, diagnostics = (text3) => {
|
|
60141
|
+
process.stderr.write(text3);
|
|
60142
|
+
}, timeouts = {
|
|
60143
|
+
authorizationUrl: AUTHORIZATION_URL_TIMEOUT_MILLISECONDS,
|
|
60144
|
+
exit: LOGIN_EXIT_TIMEOUT_MILLISECONDS
|
|
60145
|
+
}) {
|
|
60146
|
+
this.spawn = spawn2;
|
|
60147
|
+
this.diagnostics = diagnostics;
|
|
60148
|
+
this.timeouts = timeouts;
|
|
60149
|
+
}
|
|
60150
|
+
spawn;
|
|
60151
|
+
diagnostics;
|
|
60152
|
+
timeouts;
|
|
60153
|
+
start(command, origin2) {
|
|
60154
|
+
const [executable, ...arguments_] = command;
|
|
60155
|
+
if (executable === void 0 || executable.length === 0) {
|
|
60156
|
+
throw new TypeError("finch mcp connect requires an MCP client login command after --.");
|
|
60157
|
+
}
|
|
60158
|
+
return new InstalledMcpLoginSession(this.spawn(executable, arguments_), origin2, this.diagnostics, this.timeouts);
|
|
60159
|
+
}
|
|
60160
|
+
};
|
|
60161
|
+
}
|
|
60162
|
+
});
|
|
60163
|
+
|
|
60164
|
+
// src/stdin-reader.ts
|
|
60165
|
+
var ProcessStdinReader;
|
|
60166
|
+
var init_stdin_reader = __esm({
|
|
60167
|
+
"src/stdin-reader.ts"() {
|
|
60168
|
+
"use strict";
|
|
60169
|
+
init_cli_error();
|
|
60170
|
+
ProcessStdinReader = class {
|
|
60171
|
+
constructor(input = process.stdin) {
|
|
60172
|
+
this.input = input;
|
|
60173
|
+
}
|
|
60174
|
+
input;
|
|
60175
|
+
async readAll(maximumBytes) {
|
|
60176
|
+
if (this.input.isTTY === true) throw new McpAuthorizationFlowError("stdin_invalid");
|
|
60177
|
+
const chunks = [];
|
|
60178
|
+
let total = 0;
|
|
60179
|
+
for await (const chunk of this.input) {
|
|
60180
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk), "utf8");
|
|
60181
|
+
total += bytes.byteLength;
|
|
60182
|
+
if (total > maximumBytes) {
|
|
60183
|
+
this.input.destroy();
|
|
60184
|
+
throw new McpAuthorizationFlowError("stdin_invalid");
|
|
60185
|
+
}
|
|
60186
|
+
chunks.push(bytes);
|
|
60187
|
+
}
|
|
60188
|
+
try {
|
|
60189
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks));
|
|
60190
|
+
} catch (cause) {
|
|
60191
|
+
throw new McpAuthorizationFlowError("stdin_invalid", {}, { cause });
|
|
60192
|
+
}
|
|
60193
|
+
}
|
|
60194
|
+
};
|
|
60195
|
+
}
|
|
60196
|
+
});
|
|
60197
|
+
|
|
58930
60198
|
// src/recovery-inventory.ts
|
|
58931
60199
|
function object3(value, name) {
|
|
58932
60200
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -60113,6 +61381,40 @@ var init_arbitrum = __esm({
|
|
|
60113
61381
|
}
|
|
60114
61382
|
});
|
|
60115
61383
|
|
|
61384
|
+
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/chains/definitions/avalanche.js
|
|
61385
|
+
var avalanche;
|
|
61386
|
+
var init_avalanche = __esm({
|
|
61387
|
+
"../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/chains/definitions/avalanche.js"() {
|
|
61388
|
+
init_defineChain();
|
|
61389
|
+
avalanche = /* @__PURE__ */ defineChain({
|
|
61390
|
+
id: 43114,
|
|
61391
|
+
name: "Avalanche",
|
|
61392
|
+
blockTime: 1700,
|
|
61393
|
+
nativeCurrency: {
|
|
61394
|
+
decimals: 18,
|
|
61395
|
+
name: "Avalanche",
|
|
61396
|
+
symbol: "AVAX"
|
|
61397
|
+
},
|
|
61398
|
+
rpcUrls: {
|
|
61399
|
+
default: { http: ["https://api.avax.network/ext/bc/C/rpc"] }
|
|
61400
|
+
},
|
|
61401
|
+
blockExplorers: {
|
|
61402
|
+
default: {
|
|
61403
|
+
name: "SnowTrace",
|
|
61404
|
+
url: "https://snowtrace.io",
|
|
61405
|
+
apiUrl: "https://api.snowtrace.io"
|
|
61406
|
+
}
|
|
61407
|
+
},
|
|
61408
|
+
contracts: {
|
|
61409
|
+
multicall3: {
|
|
61410
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
61411
|
+
blockCreated: 11907934
|
|
61412
|
+
}
|
|
61413
|
+
}
|
|
61414
|
+
});
|
|
61415
|
+
}
|
|
61416
|
+
});
|
|
61417
|
+
|
|
60116
61418
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/chains/definitions/base.js
|
|
60117
61419
|
var sourceId, base2, basePreconf;
|
|
60118
61420
|
var init_base3 = __esm({
|
|
@@ -60283,6 +61585,37 @@ var init_bsc = __esm({
|
|
|
60283
61585
|
}
|
|
60284
61586
|
});
|
|
60285
61587
|
|
|
61588
|
+
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/chains/definitions/injective.js
|
|
61589
|
+
var injective;
|
|
61590
|
+
var init_injective = __esm({
|
|
61591
|
+
"../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/chains/definitions/injective.js"() {
|
|
61592
|
+
init_defineChain();
|
|
61593
|
+
injective = /* @__PURE__ */ defineChain({
|
|
61594
|
+
id: 1776,
|
|
61595
|
+
name: "Injective",
|
|
61596
|
+
nativeCurrency: {
|
|
61597
|
+
decimals: 18,
|
|
61598
|
+
name: "Injective",
|
|
61599
|
+
symbol: "INJ"
|
|
61600
|
+
},
|
|
61601
|
+
rpcUrls: {
|
|
61602
|
+
default: {
|
|
61603
|
+
http: ["https://sentry.evm-rpc.injective.network"],
|
|
61604
|
+
webSocket: ["wss://sentry.evm-ws.injective.network"]
|
|
61605
|
+
}
|
|
61606
|
+
},
|
|
61607
|
+
blockExplorers: {
|
|
61608
|
+
default: {
|
|
61609
|
+
name: "Injective Explorer",
|
|
61610
|
+
url: "https://blockscout.injective.network",
|
|
61611
|
+
apiUrl: "https://blockscout.injective.network/api"
|
|
61612
|
+
}
|
|
61613
|
+
},
|
|
61614
|
+
testnet: false
|
|
61615
|
+
});
|
|
61616
|
+
}
|
|
61617
|
+
});
|
|
61618
|
+
|
|
60286
61619
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/chains/definitions/mainnet.js
|
|
60287
61620
|
var mainnet;
|
|
60288
61621
|
var init_mainnet = __esm({
|
|
@@ -60379,14 +61712,33 @@ var init_optimism = __esm({
|
|
|
60379
61712
|
var init_chains2 = __esm({
|
|
60380
61713
|
"../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/chains/index.js"() {
|
|
60381
61714
|
init_arbitrum();
|
|
61715
|
+
init_avalanche();
|
|
60382
61716
|
init_base3();
|
|
60383
61717
|
init_baseSepolia();
|
|
60384
61718
|
init_bsc();
|
|
61719
|
+
init_injective();
|
|
60385
61720
|
init_mainnet();
|
|
60386
61721
|
init_optimism();
|
|
60387
61722
|
}
|
|
60388
61723
|
});
|
|
60389
61724
|
|
|
61725
|
+
// src/custody-chains.ts
|
|
61726
|
+
function custodyViemChain(chainId, purpose) {
|
|
61727
|
+
const chain = CUSTODY_CHAINS.get(chainId);
|
|
61728
|
+
if (!chain) throw new TypeError(`${purpose} custody has no reviewed viem chain for ${chainId}.`);
|
|
61729
|
+
return chain;
|
|
61730
|
+
}
|
|
61731
|
+
var CUSTODY_CHAINS;
|
|
61732
|
+
var init_custody_chains = __esm({
|
|
61733
|
+
"src/custody-chains.ts"() {
|
|
61734
|
+
"use strict";
|
|
61735
|
+
init_chains2();
|
|
61736
|
+
CUSTODY_CHAINS = new Map(
|
|
61737
|
+
[base2, injective, baseSepolia].map((chain) => [chain.id, chain])
|
|
61738
|
+
);
|
|
61739
|
+
}
|
|
61740
|
+
});
|
|
61741
|
+
|
|
60390
61742
|
// src/purchase-sender.ts
|
|
60391
61743
|
function parseRpcUrl(value) {
|
|
60392
61744
|
const parsed2 = new URL(value);
|
|
@@ -60430,20 +61782,18 @@ function assertCanonicalPlanTransactions(input) {
|
|
|
60430
61782
|
}
|
|
60431
61783
|
})();
|
|
60432
61784
|
if (decoded.functionName !== "purchase") throw new TypeError("Agent purchase method is invalid.");
|
|
60433
|
-
const
|
|
61785
|
+
const request2 = decoded.args[0];
|
|
60434
61786
|
const deadline = Date.parse(input.confirmationDeadlineAt);
|
|
60435
|
-
if (!Number.isSafeInteger(deadline) || deadline <= Date.now() ||
|
|
61787
|
+
if (!Number.isSafeInteger(deadline) || deadline <= Date.now() || request2.purchaseId !== uuidBytes32(input.operationId) || request2.payToken.toLowerCase() !== token || request2.unitPrice * request2.units !== amount || request2.validUntil !== BigInt(Math.floor(deadline / 1e3))) {
|
|
60436
61788
|
throw new TypeError("Agent purchase arguments do not match the frozen plan.");
|
|
60437
61789
|
}
|
|
60438
|
-
const purchase = encodeFunctionData({ abi: agentPurchaseAbi, functionName: "purchase", args: [
|
|
61790
|
+
const purchase = encodeFunctionData({ abi: agentPurchaseAbi, functionName: "purchase", args: [request2] });
|
|
60439
61791
|
if (input.approval.data !== approval || input.revokeApproval.data !== revoke || input.purchase.data !== purchase) {
|
|
60440
61792
|
throw new TypeError("Agent purchase calldata is not canonical for the frozen plan.");
|
|
60441
61793
|
}
|
|
60442
61794
|
}
|
|
60443
61795
|
function planChain(chainId) {
|
|
60444
|
-
|
|
60445
|
-
if (chainId === baseSepolia.id) return baseSepolia;
|
|
60446
|
-
throw new TypeError(`Agent custody has no reviewed viem chain for ${chainId}.`);
|
|
61796
|
+
return custodyViemChain(chainId, "Agent");
|
|
60447
61797
|
}
|
|
60448
61798
|
function viemRpcFactory(rpcUrl, chainId, confirmations) {
|
|
60449
61799
|
const chain = planChain(chainId);
|
|
@@ -60563,7 +61913,7 @@ var init_purchase_sender = __esm({
|
|
|
60563
61913
|
"use strict";
|
|
60564
61914
|
init_esm2();
|
|
60565
61915
|
init_accounts();
|
|
60566
|
-
|
|
61916
|
+
init_custody_chains();
|
|
60567
61917
|
erc20ApproveAbi = [{
|
|
60568
61918
|
type: "function",
|
|
60569
61919
|
name: "approve",
|
|
@@ -60731,9 +62081,7 @@ function uint16(value, name) {
|
|
|
60731
62081
|
return Number(value);
|
|
60732
62082
|
}
|
|
60733
62083
|
function planChain2(chainId) {
|
|
60734
|
-
|
|
60735
|
-
if (chainId === baseSepolia.id) return baseSepolia;
|
|
60736
|
-
throw new TypeError(`Task custody has no reviewed viem chain for ${chainId}.`);
|
|
62084
|
+
return custodyViemChain(chainId, "Task");
|
|
60737
62085
|
}
|
|
60738
62086
|
function viemFactory(rpcUrl, chainId, confirmations) {
|
|
60739
62087
|
const chain = planChain2(chainId);
|
|
@@ -60871,7 +62219,7 @@ var init_task_protocol_sender = __esm({
|
|
|
60871
62219
|
"use strict";
|
|
60872
62220
|
init_esm2();
|
|
60873
62221
|
init_accounts();
|
|
60874
|
-
|
|
62222
|
+
init_custody_chains();
|
|
60875
62223
|
init_chains();
|
|
60876
62224
|
erc20Abi2 = parseAbi([
|
|
60877
62225
|
"function allowance(address owner, address spender) view returns (uint256)",
|
|
@@ -60925,12 +62273,12 @@ var init_task_protocol_sender = __esm({
|
|
|
60925
62273
|
const preparation = record5(input.preparation, "Task pool preparation");
|
|
60926
62274
|
assertSigningAuthority2(preparation, input.walletAddress, input.accountId);
|
|
60927
62275
|
const deployment = taskDeployment(preparation.chainId);
|
|
60928
|
-
const { vault, token, amount, request } = poolAuthority(preparation, input.taskId, deployment);
|
|
62276
|
+
const { vault, token, amount, request: request2 } = poolAuthority(preparation, input.taskId, deployment);
|
|
60929
62277
|
const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
|
|
60930
62278
|
const owner = canonicalAddress(input.walletAddress, "Task wallet");
|
|
60931
62279
|
const credit = await rpc.readCreditBalance(vault, owner, token);
|
|
60932
62280
|
if (credit >= amount) {
|
|
60933
|
-
const data = encodeFunctionData({ abi: taskVaultAbi, functionName: "createPool", args: [
|
|
62281
|
+
const data = encodeFunctionData({ abi: taskVaultAbi, functionName: "createPool", args: [request2] });
|
|
60934
62282
|
await rpc.simulateTransaction({ to: vault, data, value: 0n });
|
|
60935
62283
|
const hash5 = await rpc.sendTransaction({ to: vault, data, value: 0n });
|
|
60936
62284
|
await input.onBroadcast?.({ transactionHash: hash5 });
|
|
@@ -60944,7 +62292,7 @@ var init_task_protocol_sender = __esm({
|
|
|
60944
62292
|
const createPool = encodeFunctionData({
|
|
60945
62293
|
abi: taskVaultAbi,
|
|
60946
62294
|
functionName: "depositAndCreatePool",
|
|
60947
|
-
args: [
|
|
62295
|
+
args: [request2, depositAmount]
|
|
60948
62296
|
});
|
|
60949
62297
|
const allowance = await rpc.readAllowance(token, owner, vault);
|
|
60950
62298
|
if (allowance < depositAmount) {
|
|
@@ -61105,18 +62453,18 @@ function textValue(value, name, allowEmpty = false) {
|
|
|
61105
62453
|
return value;
|
|
61106
62454
|
}
|
|
61107
62455
|
function resolveSkillViemChain(chainId) {
|
|
61108
|
-
const chain = [mainnet, optimism, bsc, base2, arbitrum, baseSepolia].find((candidate) => candidate.id === chainId);
|
|
62456
|
+
const chain = [mainnet, optimism, bsc, base2, arbitrum, avalanche, baseSepolia].find((candidate) => candidate.id === chainId);
|
|
61109
62457
|
if (chain !== void 0) return chain;
|
|
61110
62458
|
throw new TypeError(`Unsupported Skill chain ${String(chainId)}.`);
|
|
61111
62459
|
}
|
|
61112
|
-
function expectedCall(kind,
|
|
61113
|
-
const skillId = () => unsigned2(
|
|
62460
|
+
function expectedCall(kind, request2, deployment) {
|
|
62461
|
+
const skillId = () => unsigned2(request2.skillId, "Skill id", true);
|
|
61114
62462
|
if (kind === "purchase") {
|
|
61115
|
-
const quantity = unsigned2(
|
|
61116
|
-
const unitPrice = unsigned2(
|
|
62463
|
+
const quantity = unsigned2(request2.quantity, "Skill quantity", true);
|
|
62464
|
+
const unitPrice = unsigned2(request2.unitPrice, "Skill unit price");
|
|
61117
62465
|
return {
|
|
61118
62466
|
to: getAddress(deployment.skillInstanceAddress),
|
|
61119
|
-
data: encodeFunctionData({ abi: instanceAbi, functionName: "purchase", args: [skillId(), version5(
|
|
62467
|
+
data: encodeFunctionData({ abi: instanceAbi, functionName: "purchase", args: [skillId(), version5(request2.version, "Skill version"), quantity] }),
|
|
61120
62468
|
value: unitPrice * quantity
|
|
61121
62469
|
};
|
|
61122
62470
|
}
|
|
@@ -61124,43 +62472,43 @@ function expectedCall(kind, request, deployment) {
|
|
|
61124
62472
|
to: getAddress(deployment.skillInstanceAddress),
|
|
61125
62473
|
data: encodeFunctionData({ abi: instanceAbi, functionName: "convert", args: [
|
|
61126
62474
|
skillId(),
|
|
61127
|
-
version5(
|
|
61128
|
-
version5(
|
|
61129
|
-
unsigned2(
|
|
62475
|
+
version5(request2.fromVersion, "Source version"),
|
|
62476
|
+
version5(request2.toVersion, "Target version"),
|
|
62477
|
+
unsigned2(request2.quantity, "Skill quantity", true)
|
|
61130
62478
|
] }),
|
|
61131
62479
|
value: 0n
|
|
61132
62480
|
};
|
|
61133
62481
|
throw new TypeError("Skill intent kind is invalid.");
|
|
61134
62482
|
}
|
|
61135
|
-
function expectedPreparedCall(action,
|
|
61136
|
-
const skillId = () => unsigned2(
|
|
62483
|
+
function expectedPreparedCall(action, request2, deployment) {
|
|
62484
|
+
const skillId = () => unsigned2(request2.skillId, "Skill id", true);
|
|
61137
62485
|
if (action === "createSkill") {
|
|
61138
|
-
if (typeof
|
|
62486
|
+
if (typeof request2.plaintext !== "boolean" || !Number.isInteger(request2.royaltyBPS) || Number(request2.royaltyBPS) < 0 || Number(request2.royaltyBPS) > 1e3) throw new TypeError("Skill create request is invalid.");
|
|
61139
62487
|
return {
|
|
61140
62488
|
to: getAddress(deployment.skillFactoryAddress),
|
|
61141
62489
|
value: 0n,
|
|
61142
62490
|
data: encodeFunctionData({ abi: factoryAbi, functionName: "createSkill", args: [{
|
|
61143
|
-
mdHash: hash4(
|
|
61144
|
-
packageHash: hash4(
|
|
61145
|
-
packageURI: textValue(
|
|
61146
|
-
slug: textValue(
|
|
61147
|
-
name: textValue(
|
|
61148
|
-
category: textValue(
|
|
61149
|
-
licenseTypeName: textValue(
|
|
61150
|
-
imageURI: textValue(
|
|
61151
|
-
plaintext:
|
|
61152
|
-
unitPrice: unsigned2(
|
|
61153
|
-
maxSupply: unsigned2(
|
|
61154
|
-
royaltyBPS: BigInt(Number(
|
|
61155
|
-
usageLimit: unsigned2(
|
|
62491
|
+
mdHash: hash4(request2.mdHash, "Skill primary-document hash"),
|
|
62492
|
+
packageHash: hash4(request2.packageHash, "Skill package hash"),
|
|
62493
|
+
packageURI: textValue(request2.packageURI, "Skill package URI"),
|
|
62494
|
+
slug: textValue(request2.slug, "Skill slug"),
|
|
62495
|
+
name: textValue(request2.name, "Skill name"),
|
|
62496
|
+
category: textValue(request2.category, "Skill category", true),
|
|
62497
|
+
licenseTypeName: textValue(request2.licenseTypeName, "Skill license", true),
|
|
62498
|
+
imageURI: textValue(request2.imageURI, "Skill image URI", true),
|
|
62499
|
+
plaintext: request2.plaintext,
|
|
62500
|
+
unitPrice: unsigned2(request2.unitPrice, "Skill unit price"),
|
|
62501
|
+
maxSupply: unsigned2(request2.maxSupply, "Skill max supply"),
|
|
62502
|
+
royaltyBPS: BigInt(Number(request2.royaltyBPS)),
|
|
62503
|
+
usageLimit: unsigned2(request2.usageLimit, "Skill usage limit")
|
|
61156
62504
|
}] })
|
|
61157
62505
|
};
|
|
61158
62506
|
}
|
|
61159
|
-
if (action === "updateSkill") return { to: getAddress(deployment.skillTokenAddress), value: 0n, data: encodeFunctionData({ abi: tokenAbi, functionName: "updateSkill", args: [skillId(), hash4(
|
|
61160
|
-
if (action === "setSkillURI") return { to: getAddress(deployment.skillTokenAddress), value: 0n, data: encodeFunctionData({ abi: tokenAbi, functionName: "setSkillURI", args: [skillId(), textValue(
|
|
61161
|
-
if (action === "setUnitPrice") return { to: getAddress(deployment.revenueRightAddress), value: 0n, data: encodeFunctionData({ abi: revenueAbi, functionName: "setUnitPrice", args: [skillId(), unsigned2(
|
|
61162
|
-
if (action === "setMaxSupply") return { to: getAddress(deployment.revenueRightAddress), value: 0n, data: encodeFunctionData({ abi: revenueAbi, functionName: "setMaxSupply", args: [skillId(), unsigned2(
|
|
61163
|
-
if (action === "setLitData") return { to: getAddress(deployment.skillInstanceAddress), value: 0n, data: encodeFunctionData({ abi: instanceAbi, functionName: "setLitData", args: [skillId(), version5(
|
|
62507
|
+
if (action === "updateSkill") return { to: getAddress(deployment.skillTokenAddress), value: 0n, data: encodeFunctionData({ abi: tokenAbi, functionName: "updateSkill", args: [skillId(), hash4(request2.mdHash, "Skill primary-document hash"), hash4(request2.packageHash, "Skill package hash")] }) };
|
|
62508
|
+
if (action === "setSkillURI") return { to: getAddress(deployment.skillTokenAddress), value: 0n, data: encodeFunctionData({ abi: tokenAbi, functionName: "setSkillURI", args: [skillId(), textValue(request2.packageURI, "Skill package URI")] }) };
|
|
62509
|
+
if (action === "setUnitPrice") return { to: getAddress(deployment.revenueRightAddress), value: 0n, data: encodeFunctionData({ abi: revenueAbi, functionName: "setUnitPrice", args: [skillId(), unsigned2(request2.unitPrice, "Skill unit price")] }) };
|
|
62510
|
+
if (action === "setMaxSupply") return { to: getAddress(deployment.revenueRightAddress), value: 0n, data: encodeFunctionData({ abi: revenueAbi, functionName: "setMaxSupply", args: [skillId(), unsigned2(request2.maxSupply, "Skill max supply")] }) };
|
|
62511
|
+
if (action === "setLitData") return { to: getAddress(deployment.skillInstanceAddress), value: 0n, data: encodeFunctionData({ abi: instanceAbi, functionName: "setLitData", args: [skillId(), version5(request2.version, "Skill version"), textValue(request2.ciphertext, "Skill ciphertext"), textValue(request2.scheme, "Skill envelope scheme"), textValue(request2.chain, "Skill chain tag")] }) };
|
|
61164
62512
|
throw new TypeError("Skill prepared action is invalid.");
|
|
61165
62513
|
}
|
|
61166
62514
|
function assertIntentMatches(raw, expected, chainId) {
|
|
@@ -61271,9 +62619,9 @@ var init_skill_intent_sender = __esm({
|
|
|
61271
62619
|
if (typeof input.intent.walletAddress !== "string" || input.intent.walletAddress.toLowerCase() !== input.walletAddress.toLowerCase()) {
|
|
61272
62620
|
throw new TypeError("Skill intent wallet does not match the active CLI wallet.");
|
|
61273
62621
|
}
|
|
61274
|
-
const
|
|
61275
|
-
if (
|
|
61276
|
-
const expected = expectedCall(input.expectedKind,
|
|
62622
|
+
const request2 = record6(input.intent.request, "Skill intent request");
|
|
62623
|
+
if (request2.chainId !== deployment.chainId) throw new TypeError("Skill intent request chain is invalid.");
|
|
62624
|
+
const expected = expectedCall(input.expectedKind, request2, deployment);
|
|
61277
62625
|
assertIntentMatches(
|
|
61278
62626
|
input.intent,
|
|
61279
62627
|
expected,
|
|
@@ -61312,10 +62660,10 @@ var init_skill_intent_sender = __esm({
|
|
|
61312
62660
|
return Object.freeze({ transactionHash: transactionHash3, blockNumber: actual.blockNumber.toString() });
|
|
61313
62661
|
}
|
|
61314
62662
|
async submitPrepared(input) {
|
|
61315
|
-
const
|
|
61316
|
-
const deployment = this.authority(
|
|
62663
|
+
const request2 = record6(input.request, "Skill prepared request");
|
|
62664
|
+
const deployment = this.authority(request2.chainId);
|
|
61317
62665
|
if (input.intent.chainId !== deployment.chainId) throw new TypeError("Skill prepared intent chain is invalid.");
|
|
61318
|
-
const expected = expectedPreparedCall(input.action,
|
|
62666
|
+
const expected = expectedPreparedCall(input.action, request2, deployment);
|
|
61319
62667
|
assertIntentMatches(input.intent, expected, deployment.chainId);
|
|
61320
62668
|
const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
|
|
61321
62669
|
await rpc.simulateTransaction(expected);
|
|
@@ -61326,9 +62674,9 @@ var init_skill_intent_sender = __esm({
|
|
|
61326
62674
|
return Object.freeze({ transactionHash: transactionHash3, blockNumber: receipt.blockNumber.toString() });
|
|
61327
62675
|
}
|
|
61328
62676
|
async verifyPrepared(input) {
|
|
61329
|
-
const
|
|
61330
|
-
const deployment = this.authority(
|
|
61331
|
-
const expected = expectedPreparedCall(input.action,
|
|
62677
|
+
const request2 = record6(input.request, "Skill prepared request");
|
|
62678
|
+
const deployment = this.authority(request2.chainId);
|
|
62679
|
+
const expected = expectedPreparedCall(input.action, request2, deployment);
|
|
61332
62680
|
const rpc = await this.rpc(input.privateKey, input.walletAddress, deployment);
|
|
61333
62681
|
const transactionHash3 = hash4(input.transactionHash, "Skill recovery transaction hash");
|
|
61334
62682
|
const exactTransaction2 = (actual2) => actual2.from.toLowerCase() === input.walletAddress && actual2.to?.toLowerCase() === expected.to.toLowerCase() && actual2.data === expected.data && actual2.value === expected.value;
|
|
@@ -61490,26 +62838,26 @@ function publishPlan(value, context) {
|
|
|
61490
62838
|
exact2(plan, ["kind", "sourceCommit", "chainId", "walletAddress", "signingAuthority", "request", "localAction"], "Skill publish plan");
|
|
61491
62839
|
const chainId = assertAuthority(plan, "publish", context.walletAddress);
|
|
61492
62840
|
assertLocalAction(plan.localAction, "skill publish-submit");
|
|
61493
|
-
const
|
|
61494
|
-
exact2(
|
|
61495
|
-
if (
|
|
61496
|
-
string4(
|
|
61497
|
-
string4(
|
|
61498
|
-
string4(
|
|
61499
|
-
string4(
|
|
61500
|
-
if (typeof
|
|
62841
|
+
const request2 = object5(plan.request, "Skill publish request");
|
|
62842
|
+
exact2(request2, ["chainId", "slug", "name", "category", "licenseTypeName", "imageURI", "sourceKind", "contentMode", "unitPrice", "maxSupply", "royaltyBPS", "usageLimit", ...Object.hasOwn(request2, "summary") ? ["summary"] : []], "Skill publish request");
|
|
62843
|
+
if (request2.chainId !== chainId) throw new TypeError("Skill publish request chain is invalid.");
|
|
62844
|
+
string4(request2.slug, "Skill slug");
|
|
62845
|
+
string4(request2.name, "Skill name");
|
|
62846
|
+
string4(request2.category, "Skill category");
|
|
62847
|
+
string4(request2.licenseTypeName, "Skill license");
|
|
62848
|
+
if (typeof request2.imageURI !== "string") {
|
|
61501
62849
|
throw new TypeError("Skill publish metadata is invalid.");
|
|
61502
62850
|
}
|
|
61503
|
-
if (Object.hasOwn(
|
|
61504
|
-
sourceKind(
|
|
61505
|
-
contentMode(
|
|
61506
|
-
string4(
|
|
61507
|
-
string4(
|
|
61508
|
-
string4(
|
|
61509
|
-
if (!Number.isInteger(
|
|
62851
|
+
if (Object.hasOwn(request2, "summary") && (typeof request2.summary !== "string" || request2.summary.length > 500)) throw new TypeError("Skill summary is invalid.");
|
|
62852
|
+
sourceKind(request2.sourceKind);
|
|
62853
|
+
contentMode(request2.contentMode);
|
|
62854
|
+
string4(request2.unitPrice, "Skill unitPrice", DECIMAL);
|
|
62855
|
+
string4(request2.maxSupply, "Skill maxSupply", DECIMAL);
|
|
62856
|
+
string4(request2.usageLimit, "Skill usageLimit", DECIMAL);
|
|
62857
|
+
if (!Number.isInteger(request2.royaltyBPS) || Number(request2.royaltyBPS) < 0 || Number(request2.royaltyBPS) > 1e3) throw new TypeError("Skill royaltyBPS is invalid.");
|
|
61510
62858
|
return {
|
|
61511
62859
|
chainId,
|
|
61512
|
-
request,
|
|
62860
|
+
request: request2,
|
|
61513
62861
|
signingAuthority: assertPublicationAuthority(signingAuthority(plan.signingAuthority, context.walletAddress), context)
|
|
61514
62862
|
};
|
|
61515
62863
|
}
|
|
@@ -61519,18 +62867,18 @@ function versionPlan(value, context) {
|
|
|
61519
62867
|
const chainId = assertAuthority(plan, "version", context.walletAddress);
|
|
61520
62868
|
const skillId = string4(plan.skillId, "Skill id", /^[1-9][0-9]*$/u);
|
|
61521
62869
|
assertLocalAction(plan.localAction, "skill version-submit", skillId);
|
|
61522
|
-
const
|
|
62870
|
+
const request2 = { chainId, skillId, sourceKind: sourceKind(plan.sourceKind), contentMode: contentMode(plan.contentMode) };
|
|
61523
62871
|
const currentVersion = integer2(plan.currentVersion, "Current version");
|
|
61524
62872
|
const nextVersion = integer2(plan.nextVersion, "Next version");
|
|
61525
62873
|
if (nextVersion !== currentVersion + 1) throw new TypeError("Skill version plan does not advance exactly one version.");
|
|
61526
62874
|
return {
|
|
61527
62875
|
chainId,
|
|
61528
|
-
request,
|
|
62876
|
+
request: request2,
|
|
61529
62877
|
currentVersion,
|
|
61530
62878
|
nextVersion,
|
|
61531
62879
|
currentPackageURI: string4(plan.currentManifestURI, "Current manifest URI", IPFS),
|
|
61532
|
-
sourceKind:
|
|
61533
|
-
contentMode:
|
|
62880
|
+
sourceKind: request2.sourceKind,
|
|
62881
|
+
contentMode: request2.contentMode,
|
|
61534
62882
|
signingAuthority: assertPublicationAuthority(signingAuthority(plan.signingAuthority, context.walletAddress), context)
|
|
61535
62883
|
};
|
|
61536
62884
|
}
|
|
@@ -61538,13 +62886,13 @@ function managePlan(value, walletAddress2, kind) {
|
|
|
61538
62886
|
const plan = object5(value, `Skill ${kind} plan`);
|
|
61539
62887
|
exact2(plan, ["kind", "sourceCommit", "chainId", "to", "data", "value", "summary", "walletAddress", "signingAuthority", "request"], `Skill ${kind} plan`);
|
|
61540
62888
|
const chainId = assertAuthority(plan, kind === "price" ? "set_unit_price" : "set_max_supply", walletAddress2);
|
|
61541
|
-
const
|
|
62889
|
+
const request2 = object5(plan.request, `Skill ${kind} request`);
|
|
61542
62890
|
const field = kind === "price" ? "unitPrice" : "maxSupply";
|
|
61543
|
-
exact2(
|
|
61544
|
-
if (
|
|
61545
|
-
string4(
|
|
61546
|
-
string4(
|
|
61547
|
-
return { chainId, request, intent: intent({
|
|
62891
|
+
exact2(request2, ["chainId", "skillId", field], `Skill ${kind} request`);
|
|
62892
|
+
if (request2.chainId !== chainId) throw new TypeError(`Skill ${kind} request chain is invalid.`);
|
|
62893
|
+
string4(request2.skillId, "Skill id", /^[1-9][0-9]*$/u);
|
|
62894
|
+
string4(request2[field], `Skill ${field}`, DECIMAL);
|
|
62895
|
+
return { chainId, request: request2, intent: intent({
|
|
61548
62896
|
chainId: plan.chainId,
|
|
61549
62897
|
to: plan.to,
|
|
61550
62898
|
data: plan.data,
|
|
@@ -61644,11 +62992,11 @@ function recoveryReceipt(value, name) {
|
|
|
61644
62992
|
});
|
|
61645
62993
|
}
|
|
61646
62994
|
function recoveryRequest(value, action, name, chainId) {
|
|
61647
|
-
const
|
|
61648
|
-
if (
|
|
62995
|
+
const request2 = object5(value, name);
|
|
62996
|
+
if (request2.action !== action || request2.chainId !== void 0 && request2.chainId !== chainId) {
|
|
61649
62997
|
throw new TypeError(`${name} authority is invalid.`);
|
|
61650
62998
|
}
|
|
61651
|
-
return { ...
|
|
62999
|
+
return { ...request2, chainId };
|
|
61652
63000
|
}
|
|
61653
63001
|
function canonical2(value) {
|
|
61654
63002
|
if (Array.isArray(value)) return `[${value.map(canonical2).join(",")}]`;
|
|
@@ -61814,12 +63162,12 @@ var init_skill_local_flow = __esm({
|
|
|
61814
63162
|
async recoverPublication(fingerprint2, context) {
|
|
61815
63163
|
return this.publication((progress) => this.recoverWithProgress(fingerprint2, context, progress));
|
|
61816
63164
|
}
|
|
61817
|
-
async send(context, action,
|
|
63165
|
+
async send(context, action, request2, prepared, authority, onBroadcast) {
|
|
61818
63166
|
return required3(this.sender.submitPrepared, "Skill prepared-intent sender").call(this.sender, {
|
|
61819
63167
|
privateKey: context.privateKey,
|
|
61820
63168
|
walletAddress: context.walletAddress,
|
|
61821
63169
|
action,
|
|
61822
|
-
request,
|
|
63170
|
+
request: request2,
|
|
61823
63171
|
intent: authority === void 0 ? intent(prepared, context.walletAddress) : legacyIntent(prepared, context.walletAddress, authority),
|
|
61824
63172
|
onBroadcast
|
|
61825
63173
|
});
|
|
@@ -61952,14 +63300,14 @@ var init_skill_local_flow = __esm({
|
|
|
61952
63300
|
};
|
|
61953
63301
|
}
|
|
61954
63302
|
async settle(read2, name) {
|
|
61955
|
-
for (let
|
|
63303
|
+
for (let attempt2 = 0; attempt2 < 60; attempt2 += 1) {
|
|
61956
63304
|
if (await read2()) return;
|
|
61957
63305
|
await this.pause();
|
|
61958
63306
|
}
|
|
61959
63307
|
throw new TypeError(`${name} transaction confirmed but the settled chain read did not advance.`);
|
|
61960
63308
|
}
|
|
61961
|
-
async verify(context, action,
|
|
61962
|
-
return required3(this.sender.verifyPrepared, "Skill transaction verifier").call(this.sender, { privateKey: context.privateKey, walletAddress: context.walletAddress, action, request, ...receipt });
|
|
63309
|
+
async verify(context, action, request2, receipt) {
|
|
63310
|
+
return required3(this.sender.verifyPrepared, "Skill transaction verifier").call(this.sender, { privateKey: context.privateKey, walletAddress: context.walletAddress, action, request: request2, ...receipt });
|
|
61963
63311
|
}
|
|
61964
63312
|
async save(fingerprint2, journal) {
|
|
61965
63313
|
await required3(this.recovery, "Skill publication recovery").saveSkillPublicationRecovery(fingerprint2, journal);
|
|
@@ -61967,14 +63315,14 @@ var init_skill_local_flow = __esm({
|
|
|
61967
63315
|
async project(chainId, transactionHash3, bearer) {
|
|
61968
63316
|
await this.api.confirmSkillProjection?.(chainId, transactionHash3, bearer);
|
|
61969
63317
|
}
|
|
61970
|
-
async stage(progress, context, fingerprint2, journal, stage, action,
|
|
63318
|
+
async stage(progress, context, fingerprint2, journal, stage, action, request2, prepare) {
|
|
61971
63319
|
progress.journal = journal;
|
|
61972
63320
|
progress.fingerprint = fingerprint2;
|
|
61973
63321
|
progress.journalSaved = true;
|
|
61974
63322
|
progress.phase = "transaction";
|
|
61975
63323
|
const existing = journal.receipts[stage];
|
|
61976
63324
|
if (existing !== null) {
|
|
61977
|
-
journal.receipts[stage] = await this.verify(context, action,
|
|
63325
|
+
journal.receipts[stage] = await this.verify(context, action, request2, existing);
|
|
61978
63326
|
if (journal.pendingStage === stage) journal.pendingStage = null;
|
|
61979
63327
|
await this.save(fingerprint2, journal);
|
|
61980
63328
|
progress.uncertain = false;
|
|
@@ -62004,7 +63352,7 @@ var init_skill_local_flow = __esm({
|
|
|
62004
63352
|
journal.receipts[stage] = await this.send(
|
|
62005
63353
|
context,
|
|
62006
63354
|
action,
|
|
62007
|
-
|
|
63355
|
+
request2,
|
|
62008
63356
|
prepared,
|
|
62009
63357
|
journal.signingAuthority,
|
|
62010
63358
|
async ({ transactionHash: transactionHash3 }) => {
|
|
@@ -62178,7 +63526,7 @@ var init_skill_local_flow = __esm({
|
|
|
62178
63526
|
}
|
|
62179
63527
|
async publishWithProgress(path2, planValue, context, progress) {
|
|
62180
63528
|
const plan = publishPlan(planValue, context);
|
|
62181
|
-
const
|
|
63529
|
+
const request2 = plan.request;
|
|
62182
63530
|
const fingerprint2 = recoveryFingerprint2("publish", planValue, context.walletAddress);
|
|
62183
63531
|
const store = required3(this.recovery, "Skill publication recovery");
|
|
62184
63532
|
progress.phase = "recovery";
|
|
@@ -62190,8 +63538,8 @@ var init_skill_local_flow = __esm({
|
|
|
62190
63538
|
}
|
|
62191
63539
|
progress.phase = "source";
|
|
62192
63540
|
const selected = await readPublishablePath(path2);
|
|
62193
|
-
const expectedSourceKind = sourceKind(
|
|
62194
|
-
const mode = contentMode(
|
|
63541
|
+
const expectedSourceKind = sourceKind(request2.sourceKind);
|
|
63542
|
+
const mode = contentMode(request2.contentMode);
|
|
62195
63543
|
if (selected.sourceKind !== expectedSourceKind) throw new TypeError(`Skill plan requires a ${expectedSourceKind} source.`);
|
|
62196
63544
|
progress.phase = "packaging";
|
|
62197
63545
|
const packaged = await this.package(selected.files, prior === null ? mode : "plaintext", selected.excluded);
|
|
@@ -62206,14 +63554,14 @@ var init_skill_local_flow = __esm({
|
|
|
62206
63554
|
files: selected.files,
|
|
62207
63555
|
archive: packaged.archive,
|
|
62208
63556
|
version: 1,
|
|
62209
|
-
name: String(
|
|
62210
|
-
summary:
|
|
63557
|
+
name: String(request2.name),
|
|
63558
|
+
summary: request2.summary === void 0 ? "" : String(request2.summary),
|
|
62211
63559
|
pinBundle: async (bytes) => {
|
|
62212
63560
|
publishedBytes = bytes;
|
|
62213
63561
|
progress.phase = "upload";
|
|
62214
63562
|
return this.upload({
|
|
62215
63563
|
bytes,
|
|
62216
|
-
filename: `${
|
|
63564
|
+
filename: `${request2.slug}.skillroot.zip`,
|
|
62217
63565
|
bearer: context.bearer,
|
|
62218
63566
|
objectKind: "package",
|
|
62219
63567
|
sourceKind: "file",
|
|
@@ -62224,12 +63572,12 @@ var init_skill_local_flow = __esm({
|
|
|
62224
63572
|
const packageURI = entry2.packageURI;
|
|
62225
63573
|
const manifestURI = await this.upload({
|
|
62226
63574
|
bytes: serializeManifest(buildManifest([entry2])),
|
|
62227
|
-
filename: `${
|
|
63575
|
+
filename: `${request2.slug}.versions.json`,
|
|
62228
63576
|
bearer: context.bearer,
|
|
62229
63577
|
objectKind: "manifest"
|
|
62230
63578
|
});
|
|
62231
63579
|
const chainMetadata = Object.fromEntries(
|
|
62232
|
-
Object.entries(
|
|
63580
|
+
Object.entries(request2).filter(([key]) => key !== "sourceKind" && key !== "contentMode" && key !== "summary")
|
|
62233
63581
|
);
|
|
62234
63582
|
const createRequest = {
|
|
62235
63583
|
action: "createSkill",
|
|
@@ -62282,11 +63630,11 @@ var init_skill_local_flow = __esm({
|
|
|
62282
63630
|
skillId = await required3(this.api.resolveSkillId, "Skill resolve API").call(
|
|
62283
63631
|
this.api,
|
|
62284
63632
|
journal.chainId,
|
|
62285
|
-
String(
|
|
63633
|
+
String(request2.slug),
|
|
62286
63634
|
context.bearer
|
|
62287
63635
|
);
|
|
62288
63636
|
return skillId !== null;
|
|
62289
|
-
}, `Skill ${
|
|
63637
|
+
}, `Skill ${request2.slug} publication`);
|
|
62290
63638
|
if (skillId === null) throw new TypeError("Published Skill slug did not resolve.");
|
|
62291
63639
|
if (journal.skillId !== null && journal.skillId !== skillId) throw new TypeError("Skill publication recovery resolved a different Skill id.");
|
|
62292
63640
|
journal.skillId = skillId;
|
|
@@ -62504,15 +63852,15 @@ var init_skill_local_flow = __esm({
|
|
|
62504
63852
|
bearer: context.bearer,
|
|
62505
63853
|
objectKind: "manifest"
|
|
62506
63854
|
});
|
|
62507
|
-
const
|
|
63855
|
+
const request2 = { action: "setSkillURI", chainId: plan.chainId, skillId: plan.skillId, packageURI: manifestURI };
|
|
62508
63856
|
progress.phase = "intent";
|
|
62509
|
-
const prepared = await required3(this.api.requestSkillIntent, "Skill intent API").call(this.api,
|
|
63857
|
+
const prepared = await required3(this.api.requestSkillIntent, "Skill intent API").call(this.api, request2, context.bearer);
|
|
62510
63858
|
progress.phase = "transaction";
|
|
62511
63859
|
progress.uncertain = true;
|
|
62512
63860
|
const submission = await this.send(
|
|
62513
63861
|
context,
|
|
62514
63862
|
"setSkillURI",
|
|
62515
|
-
|
|
63863
|
+
request2,
|
|
62516
63864
|
prepared,
|
|
62517
63865
|
plan.signingAuthority,
|
|
62518
63866
|
async ({ transactionHash: transactionHash3 }) => {
|
|
@@ -62558,12 +63906,12 @@ var init_skill_local_flow = __esm({
|
|
|
62558
63906
|
const plan = deliveryPlan(planValue, context);
|
|
62559
63907
|
if (!context) throw new TypeError("Sign in with Finch CLI before downloading Skills.");
|
|
62560
63908
|
const located = await this.fetchDeliveryContent(plan.packageURI, context?.bearer);
|
|
62561
|
-
const
|
|
63909
|
+
const manifest5 = parseManifest(located);
|
|
62562
63910
|
let stored = located;
|
|
62563
63911
|
const expectedHash = plan.packageHash;
|
|
62564
|
-
const root =
|
|
62565
|
-
if (
|
|
62566
|
-
const entry2 = packageForVersion(
|
|
63912
|
+
const root = manifest5 === null ? void 0 : packageForVersion(manifest5, plan.version)?.skillRoot;
|
|
63913
|
+
if (manifest5 !== null) {
|
|
63914
|
+
const entry2 = packageForVersion(manifest5, plan.version);
|
|
62567
63915
|
if (entry2 === null) throw new TypeError(`Skill manifest does not list version ${plan.version}.`);
|
|
62568
63916
|
if (entry2.packageHash.toLowerCase() !== plan.packageHash.toLowerCase()) throw new TypeError("Skill manifest package hash does not match chain authority.");
|
|
62569
63917
|
stored = await this.fetchDeliveryContent(entry2.packageURI, context?.bearer);
|
|
@@ -62647,12 +63995,14 @@ async function resolveInstalledProfile(readProfile) {
|
|
|
62647
63995
|
throw cause;
|
|
62648
63996
|
}
|
|
62649
63997
|
}
|
|
62650
|
-
function commandNeedsHttp(
|
|
63998
|
+
function commandNeedsHttp(allArguments) {
|
|
63999
|
+
const arguments_ = finchOwnArguments(allArguments);
|
|
62651
64000
|
if (arguments_.length === 0 || arguments_.length === 1 && ["--help", "help", "--version"].includes(arguments_[0]) || arguments_[0] === "help" && arguments_.length > 1 || arguments_.length > 1 && arguments_.at(-1) === "--help" && arguments_.filter((argument) => argument === "--help").length === 1) return false;
|
|
62652
64001
|
return (arguments_[0] !== "wallet" || arguments_[1] === "use") && !(arguments_.length === 2 && arguments_[0] === "logout" && arguments_[1] === "--local");
|
|
62653
64002
|
}
|
|
62654
64003
|
async function runInstalledCli(arguments_, environment3 = process.env, authorities = {}) {
|
|
62655
|
-
const
|
|
64004
|
+
const own = finchOwnArguments(arguments_);
|
|
64005
|
+
const profileFree = own.length === 0 || own.length === 1 && ["--help", "help", "--version"].includes(own[0]) || own[0] === "help" && own.length > 1 || own.length > 1 && own.at(-1) === "--help" && own.filter((argument) => argument === "--help").length === 1;
|
|
62656
64006
|
if (profileFree) return routeCommand(arguments_, {});
|
|
62657
64007
|
const home = resolveFinchtechHome(environment3);
|
|
62658
64008
|
const state = new LocalCliState(home);
|
|
@@ -62679,7 +64029,10 @@ async function runInstalledCli(arguments_, environment3 = process.env, authoriti
|
|
|
62679
64029
|
taskProtocolSender: new InstalledTaskProtocolSender(),
|
|
62680
64030
|
skillIntentSender,
|
|
62681
64031
|
skillLocalFlow: profile === void 0 || skillIntentSender === void 0 ? void 0 : new SkillLocalFlow(api, skillIntentSender, signer, void 0, void 0, state),
|
|
62682
|
-
browserLauncher: new InstalledBrowserLauncher()
|
|
64032
|
+
browserLauncher: new InstalledBrowserLauncher(),
|
|
64033
|
+
callbackDelivery: new LoopbackCallbackDelivery(),
|
|
64034
|
+
mcpLoginProcess: new InstalledMcpLoginProcess(),
|
|
64035
|
+
stdin: new ProcessStdinReader()
|
|
62683
64036
|
});
|
|
62684
64037
|
return routeCommand(arguments_, application);
|
|
62685
64038
|
}
|
|
@@ -62689,6 +64042,9 @@ var init_main = __esm({
|
|
|
62689
64042
|
init_api2();
|
|
62690
64043
|
init_application();
|
|
62691
64044
|
init_command_router();
|
|
64045
|
+
init_loopback_callback();
|
|
64046
|
+
init_mcp_login_process();
|
|
64047
|
+
init_stdin_reader();
|
|
62692
64048
|
init_local_state();
|
|
62693
64049
|
init_state();
|
|
62694
64050
|
init_signing();
|
|
@@ -62852,6 +64208,22 @@ function emitCliOutcome(outcome, sinks) {
|
|
|
62852
64208
|
`);
|
|
62853
64209
|
return AGENT_CLI_OUTPUT_CONTRACT.exitCodes.remoteOrProviderUnavailable;
|
|
62854
64210
|
}
|
|
64211
|
+
if (outcome instanceof McpAuthorizationFlowError) {
|
|
64212
|
+
sinks.stdout(`${JSON.stringify({ error: {
|
|
64213
|
+
code: outcome.code,
|
|
64214
|
+
message: outcome.guidance,
|
|
64215
|
+
reasonCode: null,
|
|
64216
|
+
retryable: false,
|
|
64217
|
+
nextAction: "none",
|
|
64218
|
+
state: JSON.stringify({ reason: outcome.reason, ...outcome.detail }),
|
|
64219
|
+
operationId: null,
|
|
64220
|
+
currentRevision: null,
|
|
64221
|
+
currentEtag: null,
|
|
64222
|
+
traceId: null
|
|
64223
|
+
} })}
|
|
64224
|
+
`);
|
|
64225
|
+
return AGENT_CLI_OUTPUT_CONTRACT.exitCodes.conflictOrPrecondition;
|
|
64226
|
+
}
|
|
62855
64227
|
if (outcome instanceof CliHttpError && outcome.envelope !== null && outcome.status !== null) {
|
|
62856
64228
|
sinks.stdout(`${JSON.stringify(outcome.envelope)}
|
|
62857
64229
|
`);
|