@finchtech/cli 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/finch.js +163 -11
  2. package/package.json +1 -1
package/dist/finch.js CHANGED
@@ -28055,6 +28055,58 @@ var init_agent_service = __esm({
28055
28055
  }
28056
28056
  });
28057
28057
 
28058
+ // ../../packages/deployment-manifest/src/chains/legacy-skill-indexer.json
28059
+ var legacy_skill_indexer_default;
28060
+ var init_legacy_skill_indexer = __esm({
28061
+ "../../packages/deployment-manifest/src/chains/legacy-skill-indexer.json"() {
28062
+ legacy_skill_indexer_default = {
28063
+ schemaVersion: 1,
28064
+ service: "legacy_skill_indexer",
28065
+ chains: {
28066
+ "1": {
28067
+ tailRpcUrls: ["https://eth.drpc.org", "https://ethereum.reth.rs/rpc"],
28068
+ backfillRpcUrls: ["https://eth.drpc.org", "https://ethereum.reth.rs/rpc"],
28069
+ archiveStateRpcUrls: ["https://eth.drpc.org", "https://ethereum.reth.rs/rpc"]
28070
+ },
28071
+ "10": {
28072
+ tailRpcUrls: ["https://optimism.drpc.org", "https://optimism.gateway.tenderly.co"],
28073
+ backfillRpcUrls: ["https://optimism.drpc.org", "https://optimism.gateway.tenderly.co"],
28074
+ archiveStateRpcUrls: ["https://optimism.drpc.org", "https://optimism.gateway.tenderly.co"]
28075
+ },
28076
+ "56": {
28077
+ tailRpcUrls: [
28078
+ "https://0.48.club",
28079
+ "https://bsc.rpc.blxrbdn.com",
28080
+ "https://bsc-mainnet.public.blastapi.io"
28081
+ ],
28082
+ backfillRpcUrls: [
28083
+ "https://bsc.rpc.blxrbdn.com",
28084
+ "https://0.48.club",
28085
+ "https://bsc-mainnet.public.blastapi.io"
28086
+ ],
28087
+ archiveStateRpcUrls: [
28088
+ "https://bsc-mainnet.public.blastapi.io",
28089
+ "https://api.zan.top/bsc-mainnet"
28090
+ ]
28091
+ },
28092
+ "8453": {
28093
+ tailRpcUrls: ["https://mainnet.base.org", "https://base.gateway.tenderly.co"],
28094
+ backfillRpcUrls: ["https://mainnet.base.org", "https://base.gateway.tenderly.co"],
28095
+ archiveStateRpcUrls: ["https://mainnet.base.org", "https://base.gateway.tenderly.co"]
28096
+ },
28097
+ "42161": {
28098
+ tailRpcUrls: ["https://arb1.arbitrum.io/rpc", "https://arbitrum.gateway.tenderly.co"],
28099
+ backfillRpcUrls: ["https://arb1.arbitrum.io/rpc", "https://arbitrum.gateway.tenderly.co"],
28100
+ archiveStateRpcUrls: [
28101
+ "https://arbitrum.gateway.tenderly.co",
28102
+ "https://arbitrum-one.public.blastapi.io"
28103
+ ]
28104
+ }
28105
+ }
28106
+ };
28107
+ }
28108
+ });
28109
+
28058
28110
  // ../../packages/deployment-manifest/src/chains/skill-protocol.json
28059
28111
  var skill_protocol_default;
28060
28112
  var init_skill_protocol = __esm({
@@ -28465,13 +28517,14 @@ function getSkillProtocolDeployment(environment3, chainId) {
28465
28517
  maxLogBlockRange: value.network.maxLogBlockRange ?? DEFAULT_LOG_BLOCK_RANGE
28466
28518
  });
28467
28519
  }
28468
- var canonicalAddressSchema, hashSchema, commitSchema, positiveDecimalSchema, DEFAULT_LOG_BLOCK_RANGE, networkSchema, sourceSchema, disabledDeploymentSchema, deploymentsShape, agentActiveSchema, taskActiveSchema, skillActiveSchema, agentRegistrySchema, taskRegistrySchema, skillEnvironmentSchema, skillRegistrySchema, registrySchema, agentRegistry, taskRegistry, skillRegistry;
28520
+ var canonicalAddressSchema, hashSchema, commitSchema, positiveDecimalSchema, DEFAULT_LOG_BLOCK_RANGE, networkSchema, publicRpcUrlsSchema, legacySkillIndexerChainSchema, legacySkillIndexerRegistrySchema, sourceSchema, disabledDeploymentSchema, deploymentsShape, agentActiveSchema, taskActiveSchema, skillActiveSchema, agentRegistrySchema, taskRegistrySchema, skillEnvironmentSchema, skillRegistrySchema, registrySchema, agentRegistry, taskRegistry, skillRegistry, legacySkillIndexerRegistry;
28469
28521
  var init_chains = __esm({
28470
28522
  "../../packages/deployment-manifest/src/chains/index.ts"() {
28471
28523
  "use strict";
28472
28524
  init_zod();
28473
28525
  init_shared();
28474
28526
  init_agent_service();
28527
+ init_legacy_skill_indexer();
28475
28528
  init_skill_protocol();
28476
28529
  init_task_protocol();
28477
28530
  init_shared();
@@ -28488,6 +28541,23 @@ var init_chains = __esm({
28488
28541
  /** Omit where every listed endpoint serves the default window. */
28489
28542
  maxLogBlockRange: external_exports.number().int().min(1).max(DEFAULT_LOG_BLOCK_RANGE).optional()
28490
28543
  });
28544
+ publicRpcUrlsSchema = external_exports.array(
28545
+ external_exports.url().refine((value) => new URL(value).protocol === "https:")
28546
+ ).min(1).max(4);
28547
+ legacySkillIndexerChainSchema = external_exports.strictObject({
28548
+ tailRpcUrls: publicRpcUrlsSchema,
28549
+ backfillRpcUrls: publicRpcUrlsSchema,
28550
+ archiveStateRpcUrls: publicRpcUrlsSchema
28551
+ });
28552
+ legacySkillIndexerRegistrySchema = external_exports.strictObject({
28553
+ schemaVersion: external_exports.literal(1),
28554
+ service: external_exports.literal("legacy_skill_indexer"),
28555
+ chains: external_exports.record(external_exports.string().regex(/^[1-9][0-9]*$/u), legacySkillIndexerChainSchema)
28556
+ }).superRefine((value, context) => {
28557
+ if (Object.keys(value.chains).length === 0) {
28558
+ context.addIssue({ code: "custom", message: "The Legacy Skill indexer must list at least one chain." });
28559
+ }
28560
+ });
28491
28561
  sourceSchema = {
28492
28562
  sourceRepository: external_exports.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u),
28493
28563
  sourceCommit: commitSchema
@@ -28662,6 +28732,10 @@ var init_chains = __esm({
28662
28732
  agentRegistry = parseTypedRegistry(agentRegistrySchema, agent_service_default);
28663
28733
  taskRegistry = parseTypedRegistry(taskRegistrySchema, task_protocol_default);
28664
28734
  skillRegistry = parseTypedRegistry(skillRegistrySchema, skill_protocol_default);
28735
+ legacySkillIndexerRegistry = parseTypedRegistry(
28736
+ legacySkillIndexerRegistrySchema,
28737
+ legacy_skill_indexer_default
28738
+ );
28665
28739
  }
28666
28740
  });
28667
28741
 
@@ -35888,7 +35962,7 @@ function skillIntentConfirmationIdempotencyKey(chainId, transactionHash3) {
35888
35962
  }
35889
35963
  return `skill-intent-confirm:${chainId}:${transactionHash3}`;
35890
35964
  }
35891
- var versionSchema, skillChainIdSchema, skillCategorySchema, nullableSkillCategorySchema, skillSigningAuthoritySchema, skillSourceKindSchema, skillContentModeSchema, skillListRequestSchema, skillDetailRequestSchema, skillDeliveryRequestSchema, skillPurchaseIntentRequestSchema, skillConvertIntentRequestSchema, skillPublicationPrepareRequestFields, skillPublicationPrepareRequestSchema, skillVersionPrepareRequestSchema, skillSetUnitPriceIntentRequestSchema, skillSetMaxSupplyIntentRequestSchema, skillDisplayCategoryUpdateRequestSchema, skillDisplayCategoryResponseSchema, sellStatusSchema, skillProjectionSchema, skillSearchProjectionSchema, skillListResponseSchema, skillLitDataSchema, skillDeliveryFields, skillDeliveryResponseSchema, intentResponseFields, skillBuyerIntentResponseVariants, skillSetUnitPriceIntentResponseVariants, skillSetMaxSupplyIntentResponseVariants, skillIntentResponseSchema, publishLocalActionSchema, versionLocalActionSchema, skillPublicationPrepareResponseSchema, skillVersionPrepareResponseSchema, nullableText, boundedTextList, skillPresentationSchema, skillDetailResponseSchema, skillManageRequestSchema, skillManageResponseSchema, skillPresentationPrepareRequestSchema, skillPresentationPrepareResponseSchema, skillAssetPrepareRequestSchema, skillAssetPrepareResponseSchema, skillIntentConfirmRequestSchema, skillIntentConfirmResponseSchema, skillErrorEnvelopeSchema;
35965
+ var versionSchema, skillChainIdSchema, SKILL_MARKET_MAX_JSON_BODY_BYTES, SKILL_PRESENTATION_MAX_INLINE_DECODED_BYTES, skillCategorySchema, nullableSkillCategorySchema, skillSigningAuthoritySchema, skillSourceKindSchema, skillContentModeSchema, skillListRequestSchema, skillDetailRequestSchema, skillDeliveryRequestSchema, skillPurchaseIntentRequestSchema, skillConvertIntentRequestSchema, skillPublicationPrepareRequestFields, skillPublicationPrepareRequestSchema, skillVersionPrepareRequestSchema, skillSetUnitPriceIntentRequestSchema, skillSetMaxSupplyIntentRequestSchema, skillDisplayCategoryUpdateRequestSchema, skillDisplayCategoryResponseSchema, sellStatusSchema, skillProjectionSchema, skillSearchProjectionSchema, skillListResponseSchema, skillLitDataSchema, skillDeliveryFields, skillDeliveryResponseSchema, intentResponseFields, skillBuyerIntentResponseVariants, skillSetUnitPriceIntentResponseVariants, skillSetMaxSupplyIntentResponseVariants, skillIntentResponseSchema, publishLocalActionSchema, versionLocalActionSchema, skillPublicationPrepareResponseSchema, skillVersionPrepareResponseSchema, nullableText, boundedTextList, skillPresentationSchema, skillDetailResponseSchema, skillManageRequestSchema, skillDocumentObjectSummarySchema, skillDocumentSummarySchema, nullableSkillDocumentSummarySchema, skillDocumentsSummarySchema, skillManageResponseSchema, skillInlineDetailAssetSchema, skillInlineDetailReplacementSchema, skillDocumentUpdatesSchema, skillPresentationPrepareRequestSchema, skillPresentationPrepareResponseSchema, skillAssetPrepareRequestSchema, skillAssetPrepareResponseSchema, skillIntentConfirmRequestSchema, skillIntentConfirmResponseSchema, skillErrorEnvelopeSchema;
35892
35966
  var init_schemas4 = __esm({
35893
35967
  "../../packages/skill-market-contracts/src/schemas.ts"() {
35894
35968
  "use strict";
@@ -35898,6 +35972,8 @@ var init_schemas4 = __esm({
35898
35972
  init_public();
35899
35973
  versionSchema = { type: "integer", minimum: 1, maximum: 4294967295 };
35900
35974
  skillChainIdSchema = { type: "integer", enum: SKILL_V3_CHAIN_IDS };
35975
+ SKILL_MARKET_MAX_JSON_BODY_BYTES = 4e6;
35976
+ SKILL_PRESENTATION_MAX_INLINE_DECODED_BYTES = 3e6;
35901
35977
  skillCategorySchema = { type: "string", enum: SKILL_CATEGORIES };
35902
35978
  nullableSkillCategorySchema = { type: ["string", "null"], enum: [...SKILL_CATEGORIES, null] };
35903
35979
  skillSigningAuthoritySchema = strictObjectSchema3({
@@ -36177,17 +36253,55 @@ var init_schemas4 = __esm({
36177
36253
  chainId: skillChainIdSchema,
36178
36254
  skillId: positiveIntegerStringSchema2
36179
36255
  });
36256
+ skillDocumentObjectSummarySchema = strictObjectSchema3({
36257
+ hash: bytes32Schema,
36258
+ mediaType: { type: "string", minLength: 1, maxLength: 100 },
36259
+ size: { type: "integer", minimum: 1, maximum: 4194304 }
36260
+ });
36261
+ skillDocumentSummarySchema = strictObjectSchema3({
36262
+ entry: skillDocumentObjectSummarySchema,
36263
+ assets: { type: "array", maxItems: 50, items: strictObjectSchema3({
36264
+ path: { type: "string", minLength: 1, maxLength: 135 },
36265
+ ...skillDocumentObjectSummarySchema.properties
36266
+ }) }
36267
+ });
36268
+ nullableSkillDocumentSummarySchema = {
36269
+ oneOf: [{ type: "null" }, skillDocumentSummarySchema]
36270
+ };
36271
+ skillDocumentsSummarySchema = strictObjectSchema3({
36272
+ information: nullableSkillDocumentSummarySchema,
36273
+ instruction: nullableSkillDocumentSummarySchema,
36274
+ benchmark: nullableSkillDocumentSummarySchema,
36275
+ showcase: nullableSkillDocumentSummarySchema
36276
+ });
36180
36277
  skillManageResponseSchema = strictObjectSchema3({
36181
36278
  skill: skillProjectionSchema,
36182
36279
  contentMode: skillContentModeSchema,
36183
36280
  currentManifestURI: { type: "string", minLength: 1, maxLength: 2e3 },
36184
- presentation: { oneOf: [{ type: "null" }, skillPresentationSchema] }
36185
- });
36281
+ presentation: { oneOf: [{ type: "null" }, skillPresentationSchema] },
36282
+ documents: skillDocumentsSummarySchema
36283
+ });
36284
+ skillInlineDetailAssetSchema = strictObjectSchema3({
36285
+ filename: { type: "string", minLength: 1, maxLength: 128 },
36286
+ mediaType: { type: "string", minLength: 1, maxLength: 100 },
36287
+ contentBase64: { type: "string", minLength: 4, maxLength: SKILL_MARKET_MAX_JSON_BODY_BYTES }
36288
+ });
36289
+ skillInlineDetailReplacementSchema = strictObjectSchema3({
36290
+ html: { type: "string", minLength: 1, maxLength: SKILL_PRESENTATION_MAX_INLINE_DECODED_BYTES },
36291
+ assets: { type: "array", maxItems: 50, items: skillInlineDetailAssetSchema }
36292
+ });
36293
+ skillDocumentUpdatesSchema = strictObjectSchema3({
36294
+ information: { oneOf: [{ type: "null" }, skillInlineDetailReplacementSchema] },
36295
+ instruction: { oneOf: [{ type: "null" }, skillInlineDetailReplacementSchema] },
36296
+ benchmark: { oneOf: [{ type: "null" }, skillInlineDetailReplacementSchema] },
36297
+ showcase: { oneOf: [{ type: "null" }, skillInlineDetailReplacementSchema] }
36298
+ }, []);
36186
36299
  skillPresentationPrepareRequestSchema = strictObjectSchema3({
36187
36300
  chainId: skillChainIdSchema,
36188
36301
  skillId: positiveIntegerStringSchema2,
36189
- presentation: skillPresentationSchema
36190
- });
36302
+ presentation: skillPresentationSchema,
36303
+ documentUpdates: skillDocumentUpdatesSchema
36304
+ }, ["chainId", "skillId", "presentation"]);
36191
36305
  skillPresentationPrepareResponseSchema = authorityObjectSchema({
36192
36306
  kind: { const: "presentation" },
36193
36307
  walletAddress: addressSchema2,
@@ -36343,6 +36457,27 @@ function jsonObject(value) {
36343
36457
  }
36344
36458
  return value;
36345
36459
  }
36460
+ function protectedResourceMetadataAuthority(authenticate, origin, resourcePath) {
36461
+ const matches = [...authenticate.matchAll(/(?:^|[\s,])resource_metadata="([^"]+)"/gu)];
36462
+ if (!/(?:^|[\s,])Bearer(?:[\s,]|$)/iu.test(authenticate) || matches.length !== 1) {
36463
+ throw new CliHttpError("CLI_RESPONSE_INVALID", 401);
36464
+ }
36465
+ let metadata;
36466
+ try {
36467
+ metadata = new URL(matches[0]?.[1] ?? "");
36468
+ } catch (cause) {
36469
+ throw new CliHttpError("CLI_RESPONSE_INVALID", 401, { cause });
36470
+ }
36471
+ const rootPath = "/.well-known/oauth-protected-resource";
36472
+ const allowedPaths = /* @__PURE__ */ new Set([rootPath, `${rootPath}${resourcePath}`]);
36473
+ if (metadata.origin !== origin || metadata.username !== "" || metadata.password !== "" || metadata.search !== "" || metadata.hash !== "" || !allowedPaths.has(metadata.pathname)) {
36474
+ throw new CliHttpError("CLI_RESPONSE_INVALID", 401);
36475
+ }
36476
+ return Object.freeze({
36477
+ path: metadata.pathname,
36478
+ resource: metadata.pathname === rootPath ? `${origin}/` : `${origin}${resourcePath}`
36479
+ });
36480
+ }
36346
36481
  async function readBoundedJson(response, maximumBytes = 65536) {
36347
36482
  const length = response.headers.get("content-length");
36348
36483
  if (length !== null && (!/^(?:0|[1-9][0-9]*)$/u.test(length) || Number(length) > maximumBytes)) {
@@ -36599,22 +36734,28 @@ var init_api2 = __esm({
36599
36734
  }
36600
36735
  async inspectRemoteMcp() {
36601
36736
  const mcpUrl = `${this.origin}/mcp`;
36602
- const resourceMetadataUrl = `${this.origin}/.well-known/oauth-protected-resource`;
36603
36737
  const compatibilityManifestUrl = `${this.origin}/mcp/client-compatibility.json`;
36604
36738
  const challenge2 = await this.publicFetch("/mcp");
36605
36739
  const authenticate = challenge2.headers.get("www-authenticate");
36606
- if (challenge2.status !== 401 || authenticate === null || !authenticate.includes(`resource_metadata="${resourceMetadataUrl}"`)) {
36740
+ if (challenge2.status !== 401 || authenticate === null) {
36607
36741
  await challenge2.body?.cancel().catch(() => void 0);
36608
36742
  throw new CliHttpError("CLI_RESPONSE_INVALID", challenge2.status);
36609
36743
  }
36744
+ let resourceMetadataAuthority;
36745
+ try {
36746
+ resourceMetadataAuthority = protectedResourceMetadataAuthority(authenticate, this.origin, "/mcp");
36747
+ } catch (cause) {
36748
+ await challenge2.body?.cancel().catch(() => void 0);
36749
+ throw cause;
36750
+ }
36610
36751
  await challenge2.body?.cancel().catch(() => void 0);
36611
- const resourceResponse = await this.publicFetch("/.well-known/oauth-protected-resource");
36752
+ const resourceResponse = await this.publicFetch(resourceMetadataAuthority.path);
36612
36753
  if (resourceResponse.status !== 200) {
36613
36754
  await resourceResponse.body?.cancel().catch(() => void 0);
36614
36755
  throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", resourceResponse.status);
36615
36756
  }
36616
36757
  const resource = jsonObject(await readBoundedJson(resourceResponse));
36617
- if (resource.resource !== `${this.origin}/` || JSON.stringify(resource.authorization_servers) !== JSON.stringify([this.origin])) {
36758
+ if (resource.resource !== resourceMetadataAuthority.resource || JSON.stringify(resource.authorization_servers) !== JSON.stringify([this.origin])) {
36618
36759
  throw new CliHttpError("CLI_RESPONSE_INVALID", resourceResponse.status);
36619
36760
  }
36620
36761
  const authorizationResponse = await this.publicFetch("/.well-known/oauth-authorization-server");
@@ -37553,6 +37694,16 @@ var init_manifest = __esm({
37553
37694
  }
37554
37695
  });
37555
37696
 
37697
+ // ../../packages/skill-content/src/detail-documents.ts
37698
+ var init_detail_documents = __esm({
37699
+ "../../packages/skill-content/src/detail-documents.ts"() {
37700
+ "use strict";
37701
+ init_crypto();
37702
+ init_static_detail();
37703
+ init_manifest();
37704
+ }
37705
+ });
37706
+
37556
37707
  // ../../packages/skill-content/src/packaging.ts
37557
37708
  function filterPublishableFiles(files) {
37558
37709
  const included = [];
@@ -37702,6 +37853,7 @@ var init_src3 = __esm({
37702
37853
  "use strict";
37703
37854
  init_crypto();
37704
37855
  init_delivery_message();
37856
+ init_detail_documents();
37705
37857
  init_manifest();
37706
37858
  init_packaging();
37707
37859
  init_static_detail();
@@ -40348,7 +40500,7 @@ var init_package = __esm({
40348
40500
  "package.json"() {
40349
40501
  package_default = {
40350
40502
  name: "@finchtech/cli",
40351
- version: "0.2.1",
40503
+ version: "0.2.2",
40352
40504
  description: "Finch Agent CLI for wallet-owned marketplace and MCP workflows.",
40353
40505
  type: "module",
40354
40506
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finchtech/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Finch Agent CLI for wallet-owned marketplace and MCP workflows.",
5
5
  "type": "module",
6
6
  "bin": {