@agentchatme/codex 0.0.1711 → 0.0.17111

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
@@ -5,7 +5,7 @@ const require=__acCreateRequire(import.meta.url);
5
5
  // src/index.ts
6
6
  import { parseArgs } from "util";
7
7
 
8
- // node_modules/.pnpm/@agentchatme+agent-core@0.0.131/node_modules/@agentchatme/agent-core/dist/chunk-XLRPNQ7G.js
8
+ // node_modules/.pnpm/@agentchatme+agent-core@0.0.1311/node_modules/@agentchatme/agent-core/dist/chunk-ER4AFPH7.js
9
9
  import * as fs2 from "fs";
10
10
  import * as path2 from "path";
11
11
  import * as fs3 from "fs";
@@ -35,6 +35,15 @@ var log = {
35
35
  info: (msg) => emit("info", msg),
36
36
  debug: (msg) => emit("debug", msg)
37
37
  };
38
+ var VERSION = "0.0.1311";
39
+ var CODING_AGENTS_CLIENT_IDENTITY = {
40
+ name: "coding_agents",
41
+ version: VERSION
42
+ };
43
+ var CODING_AGENTS_CLIENT_HEADERS = {
44
+ "X-AgentChat-Client": CODING_AGENTS_CLIENT_IDENTITY.name,
45
+ "X-AgentChat-Client-Version": CODING_AGENTS_CLIENT_IDENTITY.version
46
+ };
38
47
  function atomicWriteFile(filePath, data, mode) {
39
48
  const dir = path2.dirname(filePath);
40
49
  fs2.mkdirSync(dir, { recursive: true, mode: 448 });
@@ -4201,6 +4210,7 @@ async function request(cfg, method, pathname, body) {
4201
4210
  const res = await fetch(url, {
4202
4211
  method,
4203
4212
  headers: {
4213
+ ...CODING_AGENTS_CLIENT_HEADERS,
4204
4214
  authorization: `Bearer ${cfg.apiKey}`,
4205
4215
  ...body !== void 0 ? { "content-type": "application/json" } : {}
4206
4216
  },
@@ -4344,12 +4354,12 @@ function alwaysOnHealth(home) {
4344
4354
  return { wanted: state !== "off", healthy: state !== "down" };
4345
4355
  }
4346
4356
 
4347
- // node_modules/.pnpm/@agentchatme+agent-core@0.0.131/node_modules/@agentchatme/agent-core/dist/index.js
4357
+ // node_modules/.pnpm/@agentchatme+agent-core@0.0.1311/node_modules/@agentchatme/agent-core/dist/index.js
4348
4358
  import * as fs from "fs";
4349
4359
  import * as path from "path";
4350
4360
  import * as readline from "readline";
4351
4361
 
4352
- // node_modules/.pnpm/agentchatme@1.0.22_ws@8.21.1/node_modules/agentchatme/dist/index.js
4362
+ // node_modules/.pnpm/agentchatme@1.0.221_ws@8.21.1/node_modules/agentchatme/dist/index.js
4353
4363
  var ErrorCode = {
4354
4364
  AGENT_NOT_FOUND: "AGENT_NOT_FOUND",
4355
4365
  AGENT_SUSPENDED: "AGENT_SUSPENDED",
@@ -4555,7 +4565,7 @@ function createAgentChatError(body, status, headers) {
4555
4565
  return new AgentChatError(body, status, requestId);
4556
4566
  }
4557
4567
  }
4558
- var VERSION = "1.0.22";
4568
+ var VERSION2 = "1.0.221";
4559
4569
  function detectRuntime() {
4560
4570
  const g = globalThis;
4561
4571
  if (typeof g.Bun?.version === "string") return `bun/${g.Bun.version}`;
@@ -4569,7 +4579,7 @@ function detectRuntime() {
4569
4579
  return "unknown";
4570
4580
  }
4571
4581
  function defaultUserAgent() {
4572
- return `agentchat-ts/${VERSION} ${detectRuntime()}`;
4582
+ return `agentchat-ts/${VERSION2} ${detectRuntime()}`;
4573
4583
  }
4574
4584
  var REQUEST_ID_HEADER = "x-request-id";
4575
4585
  var DEFAULT_RETRY_POLICY = {
@@ -4888,6 +4898,16 @@ async function* paginate(fetchPage, options) {
4888
4898
  if (page.items.length === 0) return;
4889
4899
  }
4890
4900
  }
4901
+ var DEFAULT_CLIENT_IDENTITY = {
4902
+ name: "typescript_sdk",
4903
+ version: VERSION2
4904
+ };
4905
+ function clientIdentityHeaders(identity = DEFAULT_CLIENT_IDENTITY) {
4906
+ return {
4907
+ "X-AgentChat-Client": identity.name,
4908
+ ...identity.version ? { "X-AgentChat-Client-Version": identity.version } : {}
4909
+ };
4910
+ }
4891
4911
  var DEFAULT_BASE_URL = "https://api.agentchat.me";
4892
4912
  function parseBacklogWarning(header) {
4893
4913
  if (!header) return null;
@@ -4924,7 +4944,8 @@ var AgentChatClient = class _AgentChatClient {
4924
4944
  timeoutMs: options.timeoutMs,
4925
4945
  retry: options.retry,
4926
4946
  hooks: options.hooks,
4927
- fetch: options.fetch
4947
+ fetch: options.fetch,
4948
+ defaultHeaders: clientIdentityHeaders(options.clientIdentity)
4928
4949
  });
4929
4950
  this.onBacklogWarning = options.onBacklogWarning;
4930
4951
  }
@@ -4975,7 +4996,10 @@ var AgentChatClient = class _AgentChatClient {
4975
4996
  * returned `pending_id` and the OTP code.
4976
4997
  */
4977
4998
  static async register(options) {
4978
- const http = new HttpTransport({ baseUrl: options.baseUrl ?? DEFAULT_BASE_URL });
4999
+ const http = new HttpTransport({
5000
+ baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,
5001
+ defaultHeaders: clientIdentityHeaders(options.clientIdentity)
5002
+ });
4979
5003
  const res = await http.request("POST", "/v1/register", {
4980
5004
  body: {
4981
5005
  email: options.email,
@@ -4995,12 +5019,19 @@ var AgentChatClient = class _AgentChatClient {
4995
5019
  */
4996
5020
  static async verify(pendingId, code, options) {
4997
5021
  const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
4998
- const http = new HttpTransport({ baseUrl });
5022
+ const http = new HttpTransport({
5023
+ baseUrl,
5024
+ defaultHeaders: clientIdentityHeaders(options?.clientIdentity)
5025
+ });
4999
5026
  const res = await http.request("POST", "/v1/register/verify", {
5000
5027
  body: { pending_id: pendingId, code },
5001
5028
  retry: "never"
5002
5029
  });
5003
- const client = new _AgentChatClient({ apiKey: res.data.api_key, baseUrl });
5030
+ const client = new _AgentChatClient({
5031
+ apiKey: res.data.api_key,
5032
+ baseUrl,
5033
+ clientIdentity: options?.clientIdentity
5034
+ });
5004
5035
  return { agent: res.data.agent, apiKey: res.data.api_key, client };
5005
5036
  }
5006
5037
  /**
@@ -5011,7 +5042,10 @@ var AgentChatClient = class _AgentChatClient {
5011
5042
  */
5012
5043
  static async recover(email, options) {
5013
5044
  const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
5014
- const http = new HttpTransport({ baseUrl });
5045
+ const http = new HttpTransport({
5046
+ baseUrl,
5047
+ defaultHeaders: clientIdentityHeaders(options?.clientIdentity)
5048
+ });
5015
5049
  const res = await http.request(
5016
5050
  "POST",
5017
5051
  "/v1/agents/recover",
@@ -5021,13 +5055,20 @@ var AgentChatClient = class _AgentChatClient {
5021
5055
  }
5022
5056
  static async recoverVerify(pendingId, code, options) {
5023
5057
  const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
5024
- const http = new HttpTransport({ baseUrl });
5058
+ const http = new HttpTransport({
5059
+ baseUrl,
5060
+ defaultHeaders: clientIdentityHeaders(options?.clientIdentity)
5061
+ });
5025
5062
  const res = await http.request(
5026
5063
  "POST",
5027
5064
  "/v1/agents/recover/verify",
5028
5065
  { body: { pending_id: pendingId, code }, retry: "never" }
5029
5066
  );
5030
- const client = new _AgentChatClient({ apiKey: res.data.api_key, baseUrl });
5067
+ const client = new _AgentChatClient({
5068
+ apiKey: res.data.api_key,
5069
+ baseUrl,
5070
+ clientIdentity: options?.clientIdentity
5071
+ });
5031
5072
  return { handle: res.data.handle, apiKey: res.data.api_key, client };
5032
5073
  }
5033
5074
  // ─── Agent profile ────────────────────────────────────────────────────────
@@ -5632,7 +5673,7 @@ var HOUR = 60 * MIN;
5632
5673
  var DAY = 24 * HOUR;
5633
5674
  var MAX_ATTACHMENT_SIZE = 25 * 1024 * 1024;
5634
5675
 
5635
- // node_modules/.pnpm/@agentchatme+agent-core@0.0.131/node_modules/@agentchatme/agent-core/dist/index.js
5676
+ // node_modules/.pnpm/@agentchatme+agent-core@0.0.1311/node_modules/@agentchatme/agent-core/dist/index.js
5636
5677
  import * as fs22 from "fs";
5637
5678
  import * as os from "os";
5638
5679
  import * as path22 from "path";
@@ -6285,7 +6326,8 @@ function createIdentityCommands(profile2) {
6285
6326
  }
6286
6327
  try {
6287
6328
  const result = await AgentChatClient.verify(pending.pending_id, code, {
6288
- baseUrl: pending.api_base ?? apiBase
6329
+ baseUrl: pending.api_base ?? apiBase,
6330
+ clientIdentity: CODING_AGENTS_CLIENT_IDENTITY
6289
6331
  });
6290
6332
  writeCredentials(home, {
6291
6333
  api_key: result.apiKey,
@@ -6358,7 +6400,8 @@ function createIdentityCommands(profile2) {
6358
6400
  handle,
6359
6401
  ...opts.displayName ? { display_name: opts.displayName } : {},
6360
6402
  ...opts.description ? { description: opts.description } : {},
6361
- baseUrl: apiBase
6403
+ baseUrl: apiBase,
6404
+ clientIdentity: CODING_AGENTS_CLIENT_IDENTITY
6362
6405
  });
6363
6406
  writePending(home, {
6364
6407
  kind: "register",
@@ -6396,7 +6439,11 @@ function createIdentityCommands(profile2) {
6396
6439
  return 1;
6397
6440
  }
6398
6441
  try {
6399
- const client = new AgentChatClient({ apiKey, baseUrl: apiBase });
6442
+ const client = new AgentChatClient({
6443
+ apiKey,
6444
+ baseUrl: apiBase,
6445
+ clientIdentity: CODING_AGENTS_CLIENT_IDENTITY
6446
+ });
6400
6447
  const me = await client.getMe();
6401
6448
  writeCredentials(home, {
6402
6449
  api_key: apiKey,
@@ -6428,7 +6475,8 @@ function createIdentityCommands(profile2) {
6428
6475
  }
6429
6476
  try {
6430
6477
  const result = await AgentChatClient.recoverVerify(pending.pending_id, code, {
6431
- baseUrl: pending.api_base ?? apiBase
6478
+ baseUrl: pending.api_base ?? apiBase,
6479
+ clientIdentity: CODING_AGENTS_CLIENT_IDENTITY
6432
6480
  });
6433
6481
  writeCredentials(home, {
6434
6482
  api_key: result.apiKey,
@@ -6464,7 +6512,10 @@ function createIdentityCommands(profile2) {
6464
6512
  return 1;
6465
6513
  }
6466
6514
  try {
6467
- const result = await AgentChatClient.recover(email, { baseUrl: apiBase });
6515
+ const result = await AgentChatClient.recover(email, {
6516
+ baseUrl: apiBase,
6517
+ clientIdentity: CODING_AGENTS_CLIENT_IDENTITY
6518
+ });
6468
6519
  if (!result.pending_id) {
6469
6520
  console.log("If an agent is registered with that email, a recovery code was sent to it.");
6470
6521
  return 0;
@@ -6513,7 +6564,11 @@ function createIdentityCommands(profile2) {
6513
6564
  return 0;
6514
6565
  }
6515
6566
  try {
6516
- const client = new AgentChatClient({ apiKey: identity.apiKey, baseUrl: identity.apiBase });
6567
+ const client = new AgentChatClient({
6568
+ apiKey: identity.apiKey,
6569
+ baseUrl: identity.apiBase,
6570
+ clientIdentity: CODING_AGENTS_CLIENT_IDENTITY
6571
+ });
6517
6572
  const me = await client.getMe();
6518
6573
  const rows = await syncPeek({ apiKey: identity.apiKey, apiBase: identity.apiBase }, { limit: 100 });
6519
6574
  const unread = rows.length === 100 ? "100+" : String(rows.length);
@@ -6600,7 +6655,11 @@ function createIdentityCommands(profile2) {
6600
6655
  const identity = resolveIdentity(home);
6601
6656
  if (identity !== null) {
6602
6657
  try {
6603
- const client = new AgentChatClient({ apiKey: identity.apiKey, baseUrl: identity.apiBase });
6658
+ const client = new AgentChatClient({
6659
+ apiKey: identity.apiKey,
6660
+ baseUrl: identity.apiBase,
6661
+ clientIdentity: CODING_AGENTS_CLIENT_IDENTITY
6662
+ });
6604
6663
  const started = Date.now();
6605
6664
  const me = await client.getMe();
6606
6665
  const verdict = (me.status ?? "active") === "active" ? "PASS" : "WARN";
@@ -7505,10 +7564,10 @@ async function runStop() {
7505
7564
  }
7506
7565
 
7507
7566
  // src/version.ts
7508
- var VERSION2 = "0.0.1711";
7567
+ var VERSION3 = "0.0.17111";
7509
7568
 
7510
7569
  // src/index.ts
7511
- var USAGE = `agentchat-codex ${VERSION2} \u2014 AgentChat for Codex
7570
+ var USAGE = `agentchat-codex ${VERSION3} \u2014 AgentChat for Codex
7512
7571
 
7513
7572
  Usage:
7514
7573
  ${invocation()} wire Codex up
@@ -7561,7 +7620,7 @@ async function main(argv = process.argv.slice(2)) {
7561
7620
  const { values, positionals } = parsed;
7562
7621
  const [command, subcommand] = positionals;
7563
7622
  if (values.version) {
7564
- console.log(VERSION2);
7623
+ console.log(VERSION3);
7565
7624
  return 0;
7566
7625
  }
7567
7626
  if (values.help || command === "help") {