@t2000/cli 9.14.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  MAX_JOB_USDC,
8
8
  T2000,
9
9
  clearLimits,
10
- fetchOffering,
10
+ fetchService,
11
11
  formatUsd,
12
12
  generateKeypair,
13
13
  getAddress,
@@ -28,7 +28,7 @@ import {
28
28
  verifyJobForSeller,
29
29
  verifyReceipt,
30
30
  walletExists
31
- } from "./chunk-W2YJBW55.js";
31
+ } from "./chunk-45A36TR5.js";
32
32
  import "./chunk-634W6JCI.js";
33
33
  import "./chunk-BHQGGFE6.js";
34
34
  import "./chunk-GCC33SG5.js";
@@ -22281,7 +22281,7 @@ async function runEstimate(url, opts) {
22281
22281
  let req = accepts.find((a) => a.scheme === "exact" && a.network?.startsWith("sui:")) ?? accepts[0];
22282
22282
  let dialect = "x402";
22283
22283
  if (!req) {
22284
- const { parseMppSuiChallenge } = await import("./dist-XPUF4ETZ.js");
22284
+ const { parseMppSuiChallenge } = await import("./dist-6UOQ3CIE.js");
22285
22285
  const challenge = await parseMppSuiChallenge(response);
22286
22286
  if (!challenge) {
22287
22287
  throw new Error(
@@ -23373,7 +23373,7 @@ function registerMcpStart(parent) {
23373
23373
  parent.command("start", { isDefault: true }).description("Start MCP server (stdio transport \u2014 for AI client integration)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
23374
23374
  let mod;
23375
23375
  try {
23376
- mod = await import("./dist-ST4GSMNB.js");
23376
+ mod = await import("./dist-GRR5N77K.js");
23377
23377
  } catch {
23378
23378
  console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
23379
23379
  process.exit(1);
@@ -24219,7 +24219,7 @@ Subcommands:
24219
24219
  const agent = await withAgent({ keyPath: opts.key });
24220
24220
  const address = agent.address();
24221
24221
  const target = opts.remove ? "" : endpoint;
24222
- const prepRes = await fetch(`${base}/agent/service/prepare`, {
24222
+ const prepRes = await fetch(`${base}/agent/endpoint/prepare`, {
24223
24223
  method: "POST",
24224
24224
  headers: { "Content-Type": "application/json" },
24225
24225
  body: JSON.stringify({ address, endpoint: target })
@@ -24237,7 +24237,7 @@ ${detail}` : msg);
24237
24237
  }
24238
24238
  const bytes = new Uint8Array(Buffer.from(prep.txBytes, "base64"));
24239
24239
  const { signature } = await agent.keypair.signTransaction(bytes);
24240
- const sub = await fetchJson2(`${base}/agent/service/submit`, {
24240
+ const sub = await fetchJson2(`${base}/agent/endpoint/submit`, {
24241
24241
  method: "POST",
24242
24242
  body: { nonce: prep.nonce, address, signature }
24243
24243
  });
@@ -24518,7 +24518,7 @@ var import_picocolors15 = __toESM(require_picocolors(), 1);
24518
24518
  import { createHash } from "crypto";
24519
24519
  import { readFile as readFile3 } from "fs/promises";
24520
24520
 
24521
- // src/lib/offerings.ts
24521
+ // src/lib/services.ts
24522
24522
  async function fetchJson3(url, init) {
24523
24523
  const res = await fetch(url, {
24524
24524
  method: init?.method ?? "GET",
@@ -24643,7 +24643,7 @@ Buying a SERVICE (t2 ACP) \u2014 price + terms come from the listing:
24643
24643
  seller $ t2 job spec 0xJOB (read the buyer's requirements)
24644
24644
  `
24645
24645
  );
24646
- group.command("create").argument("[amount]", `USDC to escrow (max ${MAX_JOB_USDC}; omit when buying a --service)`).argument("[seller]", "The seller's Sui address (omit when buying a --service)").description("Create + fund an escrow job in one transaction (buyer)").option("--spec <file-or-text>", "Job spec \u2014 a file path or inline text (hashed on-chain), or a 0x\u2026 hash").option("--agent <address>", "Buy a service: the seller's agent address").option("--service <slug>", "The service slug (see t2 browse / t2 service list <agent>)").option("--offering <slug>", "Alias for --service (compat)").option("--requirements <file-or-json-or-text>", "Your requirements for the service (what the seller asked for)").option("--deadline <duration>", "Time the seller has to deliver (e.g. 30m, 24h, 7d)", "24h").option("--review <duration>", "Your accept/reject window after delivery", "24h").option("--split <bps>", "Your share in bps if you reject (0\u201310000)", String(DEFAULT_REJECT_SPLIT_BPS)).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE5})`).action(
24646
+ group.command("create").argument("[amount]", `USDC to escrow (max ${MAX_JOB_USDC}; omit when buying a --service)`).argument("[seller]", "The seller's Sui address (omit when buying a --service)").description("Create + fund an escrow job in one transaction (buyer)").option("--spec <file-or-text>", "Job spec \u2014 a file path or inline text (hashed on-chain), or a 0x\u2026 hash").option("--agent <address>", "Buy a service: the seller's agent address").option("--service <slug>", "The service slug (see t2 browse / t2 service list <agent>)").option("--requirements <file-or-json-or-text>", "Your requirements for the service (what the seller asked for)").option("--deadline <duration>", "Time the seller has to deliver (e.g. 30m, 24h, 7d)", "24h").option("--review <duration>", "Your accept/reject window after delivery", "24h").option("--split <bps>", "Your share in bps if you reject (0\u201310000)", String(DEFAULT_REJECT_SPLIT_BPS)).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE5})`).action(
24647
24647
  async (amountArg, sellerArg, opts) => {
24648
24648
  try {
24649
24649
  const base = opts.api ?? DEFAULT_API_BASE5;
@@ -24653,8 +24653,8 @@ Buying a SERVICE (t2 ACP) \u2014 price + terms come from the listing:
24653
24653
  let deliverByMs;
24654
24654
  let reviewWindowMs;
24655
24655
  let rejectSplitBps;
24656
- let offeringSlug;
24657
- const serviceSlugOpt = opts.service ?? opts.offering;
24656
+ let serviceSlug;
24657
+ const serviceSlugOpt = opts.service;
24658
24658
  if (serviceSlugOpt || opts.agent) {
24659
24659
  if (!(serviceSlugOpt && opts.agent)) {
24660
24660
  throw new Error("--agent and --service go together.");
@@ -24665,8 +24665,8 @@ Buying a SERVICE (t2 ACP) \u2014 price + terms come from the listing:
24665
24665
  );
24666
24666
  }
24667
24667
  const sellerAgent = validateAddress(opts.agent);
24668
- const offering = await fetchOffering(base, sellerAgent, serviceSlugOpt);
24669
- offeringSlug = offering.slug;
24668
+ const service = await fetchService(base, sellerAgent, serviceSlugOpt);
24669
+ serviceSlug = service.slug;
24670
24670
  let requirements = null;
24671
24671
  if (opts.requirements) {
24672
24672
  let text = opts.requirements;
@@ -24680,37 +24680,37 @@ Buying a SERVICE (t2 ACP) \u2014 price + terms come from the listing:
24680
24680
  requirements = text.trim();
24681
24681
  }
24682
24682
  }
24683
- if (offering.requirements != null && requirements == null) {
24684
- const want = typeof offering.requirements === "string" ? offering.requirements : `JSON matching: ${JSON.stringify(offering.requirements)}`;
24683
+ if (service.requirements != null && requirements == null) {
24684
+ const want = typeof service.requirements === "string" ? service.requirements : `JSON matching: ${JSON.stringify(service.requirements)}`;
24685
24685
  throw new Error(
24686
24686
  `This service needs --requirements. The seller asks for: ${want}`
24687
24687
  );
24688
24688
  }
24689
- if (offering.requirements != null && typeof offering.requirements === "object" && (typeof requirements !== "object" || requirements === null)) {
24689
+ if (service.requirements != null && typeof service.requirements === "object" && (typeof requirements !== "object" || requirements === null)) {
24690
24690
  throw new Error(
24691
- `This service expects JSON requirements matching: ${JSON.stringify(offering.requirements)}`
24691
+ `This service expects JSON requirements matching: ${JSON.stringify(service.requirements)}`
24692
24692
  );
24693
24693
  }
24694
24694
  const buyer = (await withAgent({ keyPath: opts.key })).address();
24695
24695
  const spec = JSON.stringify({
24696
24696
  type: "t2-acp-job-spec@1",
24697
- offering: {
24698
- agent: offering.agent,
24699
- slug: offering.slug,
24700
- name: offering.name,
24701
- priceUsdc: offering.priceUsdc,
24702
- deliverable: offering.deliverable
24697
+ service: {
24698
+ agent: service.agent,
24699
+ slug: service.slug,
24700
+ name: service.name,
24701
+ priceUsdc: service.priceUsdc,
24702
+ deliverable: service.deliverable
24703
24703
  },
24704
24704
  requirements,
24705
24705
  buyer,
24706
24706
  createdAtMs: Date.now()
24707
24707
  });
24708
24708
  specHash = `0x${await putJobSpec(base, spec)}`;
24709
- amountUsdc = offering.priceUsdc;
24710
- seller = offering.agent;
24711
- deliverByMs = Date.now() + offering.slaMinutes * 6e4;
24712
- reviewWindowMs = offering.reviewWindowMinutes * 6e4;
24713
- rejectSplitBps = offering.rejectSplitBps;
24709
+ amountUsdc = service.priceUsdc;
24710
+ seller = service.agent;
24711
+ deliverByMs = Date.now() + service.slaMinutes * 6e4;
24712
+ reviewWindowMs = service.reviewWindowMinutes * 6e4;
24713
+ rejectSplitBps = service.rejectSplitBps;
24714
24714
  } else {
24715
24715
  if (!(amountArg && sellerArg)) {
24716
24716
  throw new Error(
@@ -24752,11 +24752,11 @@ Buying a SERVICE (t2 ACP) \u2014 price + terms come from the listing:
24752
24752
  }
24753
24753
  }
24754
24754
  if (isJsonMode()) {
24755
- printJson({ jobId, digest, buyer: address, seller, amountUsdc, specHash, deliverByMs, reviewWindowMs, rejectSplitBps, ...offeringSlug ? { offering: offeringSlug } : {} });
24755
+ printJson({ jobId, digest, buyer: address, seller, amountUsdc, specHash, deliverByMs, reviewWindowMs, rejectSplitBps, ...serviceSlug ? { service: serviceSlug } : {} });
24756
24756
  return;
24757
24757
  }
24758
24758
  printBlank();
24759
- printSuccess(`Escrowed $${amountUsdc.toFixed(2)} USDC \u2192 job for ${truncateAddress(seller)}${offeringSlug ? ` (service: ${offeringSlug})` : ""}`);
24759
+ printSuccess(`Escrowed $${amountUsdc.toFixed(2)} USDC \u2192 job for ${truncateAddress(seller)}${serviceSlug ? ` (service: ${serviceSlug})` : ""}`);
24760
24760
  if (jobId) printKeyValue("Job", jobId);
24761
24761
  printKeyValue("Spec hash", specHash);
24762
24762
  printKeyValue("Deliver by", new Date(deliverByMs).toISOString());
@@ -25014,12 +25014,12 @@ Buying a SERVICE (t2 ACP) \u2014 price + terms come from the listing:
25014
25014
  });
25015
25015
  }
25016
25016
 
25017
- // src/commands/offering.ts
25017
+ // src/commands/service.ts
25018
25018
  var import_picocolors16 = __toESM(require_picocolors(), 1);
25019
25019
  import { createHash as createHash2 } from "crypto";
25020
25020
  import { readFile as readFile4 } from "fs/promises";
25021
25021
  var DEFAULT_API_BASE6 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
25022
- async function signedOfferingAction(opts) {
25022
+ async function signedServiceAction(opts) {
25023
25023
  const agent = await withAgent({ keyPath: opts.keyPath });
25024
25024
  const address = agent.address();
25025
25025
  const challenge = await fetchJson3(`${opts.base}/agent/challenge`, {
@@ -25032,10 +25032,10 @@ async function signedOfferingAction(opts) {
25032
25032
  }
25033
25033
  const payloadHash = createHash2("sha256").update(JSON.stringify(opts.payload), "utf8").digest("hex");
25034
25034
  const message = new TextEncoder().encode(
25035
- `t2000-agent-offering:${nonce}:${payloadHash}`
25035
+ `t2000-agent-service:${nonce}:${payloadHash}`
25036
25036
  );
25037
25037
  const { signature } = await agent.keypair.signPersonalMessage(message);
25038
- const response = await fetchJson3(`${opts.base}/agent/offering`, {
25038
+ const response = await fetchJson3(`${opts.base}/agent/service`, {
25039
25039
  method: "POST",
25040
25040
  body: {
25041
25041
  address,
@@ -25070,7 +25070,7 @@ function formatSla(minutes) {
25070
25070
  if (minutes % 60 === 0) return `${minutes / 60}h`;
25071
25071
  return `${minutes}m`;
25072
25072
  }
25073
- function printOffering(o) {
25073
+ function printService(o) {
25074
25074
  const flag = o.retired ? import_picocolors16.default.dim(" (retired)") : "";
25075
25075
  printLine(`${import_picocolors16.default.bold(o.name)} ${import_picocolors16.default.dim(`\xB7 ${o.slug}`)}${flag}`);
25076
25076
  printKeyValue("Price", `$${o.priceUsdc.toFixed(2)} USDC`);
@@ -25091,8 +25091,8 @@ function printOffering(o) {
25091
25091
  `t2 job create --agent ${o.agent} --service ${o.slug}`
25092
25092
  );
25093
25093
  }
25094
- function registerOffering(program3) {
25095
- const group = program3.command("service").alias("offering").description(
25094
+ function registerService(program3) {
25095
+ const group = program3.command("service").description(
25096
25096
  "Sell deliverable work \u2014 list what you do, at what price, on what SLA (t2 ACP)"
25097
25097
  ).addHelpText(
25098
25098
  "after",
@@ -25137,7 +25137,7 @@ Examples:
25137
25137
  deliverable: opts.deliverable.trim()
25138
25138
  };
25139
25139
  const base = opts.api ?? DEFAULT_API_BASE6;
25140
- const { address } = await signedOfferingAction({
25140
+ const { address } = await signedServiceAction({
25141
25141
  base,
25142
25142
  keyPath: opts.key,
25143
25143
  action: "upsert",
@@ -25153,7 +25153,7 @@ Examples:
25153
25153
  printKeyValue("Storefront", `https://agents.t2000.ai/${address}`);
25154
25154
  printKeyValue("Buyers run", `t2 job create --agent ${address} --service ${slug}`);
25155
25155
  printBlank();
25156
- printInfo("Watch for incoming jobs with: t2 job watch <jobId> (buyers hand you the job id)");
25156
+ printInfo("Watch for incoming jobs with: t2 job watch --mine");
25157
25157
  printBlank();
25158
25158
  } catch (error) {
25159
25159
  handleError(error);
@@ -25165,11 +25165,11 @@ Examples:
25165
25165
  const base = opts.api ?? DEFAULT_API_BASE6;
25166
25166
  const agent = agentArg ? validateAddress(agentArg) : (await withAgent({ keyPath: opts.key })).address();
25167
25167
  const json = await fetchJson3(
25168
- `${base}/offerings?agent=${encodeURIComponent(agent)}`
25168
+ `${base}/services?agent=${encodeURIComponent(agent)}`
25169
25169
  );
25170
- const rows = json.offerings ?? [];
25170
+ const rows = json.services ?? [];
25171
25171
  if (isJsonMode()) {
25172
- printJson({ agent, offerings: rows });
25172
+ printJson({ agent, services: rows });
25173
25173
  return;
25174
25174
  }
25175
25175
  printBlank();
@@ -25179,7 +25179,7 @@ Examples:
25179
25179
  return;
25180
25180
  }
25181
25181
  for (const o of rows) {
25182
- printOffering(o);
25182
+ printService(o);
25183
25183
  printBlank();
25184
25184
  }
25185
25185
  } catch (error) {
@@ -25189,7 +25189,7 @@ Examples:
25189
25189
  group.command("retire").argument("<slug>", "The service slug to retire").description("Take a service off the board (funded jobs still settle on-chain)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE6})`).action(async (slug, opts) => {
25190
25190
  try {
25191
25191
  const base = opts.api ?? DEFAULT_API_BASE6;
25192
- const { address } = await signedOfferingAction({
25192
+ const { address } = await signedServiceAction({
25193
25193
  base,
25194
25194
  keyPath: opts.key,
25195
25195
  action: "retire",
@@ -25212,10 +25212,10 @@ function registerBrowse(program3) {
25212
25212
  try {
25213
25213
  const base = opts.api ?? DEFAULT_API_BASE6;
25214
25214
  const params = query ? `?q=${encodeURIComponent(query)}` : "";
25215
- const json = await fetchJson3(`${base}/offerings${params}`);
25216
- const rows = json.offerings ?? [];
25215
+ const json = await fetchJson3(`${base}/services${params}`);
25216
+ const rows = json.services ?? [];
25217
25217
  if (isJsonMode()) {
25218
- printJson({ query: query ?? null, total: json.total ?? rows.length, offerings: rows });
25218
+ printJson({ query: query ?? null, total: json.total ?? rows.length, services: rows });
25219
25219
  return;
25220
25220
  }
25221
25221
  printBlank();
@@ -25225,7 +25225,7 @@ function registerBrowse(program3) {
25225
25225
  return;
25226
25226
  }
25227
25227
  for (const o of rows) {
25228
- printOffering(o);
25228
+ printService(o);
25229
25229
  printBlank();
25230
25230
  }
25231
25231
  } catch (error) {
@@ -25283,7 +25283,7 @@ Examples:
25283
25283
  registerAgents(program3);
25284
25284
  registerCheck(program3);
25285
25285
  registerJob(program3);
25286
- registerOffering(program3);
25286
+ registerService(program3);
25287
25287
  registerBrowse(program3);
25288
25288
  return program3;
25289
25289
  }