@agentchatme/codex 0.0.17 → 0.0.1711
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/daemon-main.js +3 -3
- package/dist/daemon-main.js.map +1 -1
- package/dist/index.js +74 -28
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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.
|
|
8
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.0.131/node_modules/@agentchatme/agent-core/dist/chunk-XLRPNQ7G.js
|
|
9
9
|
import * as fs2 from "fs";
|
|
10
10
|
import * as path2 from "path";
|
|
11
11
|
import * as fs3 from "fs";
|
|
@@ -4290,7 +4290,7 @@ var HEARTBEAT_STALE_MS = 3 * 6e4;
|
|
|
4290
4290
|
function markAlwaysOnWanted(home) {
|
|
4291
4291
|
try {
|
|
4292
4292
|
fs4.mkdirSync(home, { recursive: true });
|
|
4293
|
-
fs4.writeFileSync(path4.join(home, ALWAYS_ON_WANTED),
|
|
4293
|
+
fs4.writeFileSync(path4.join(home, ALWAYS_ON_WANTED), (/* @__PURE__ */ new Date()).toISOString());
|
|
4294
4294
|
} catch {
|
|
4295
4295
|
}
|
|
4296
4296
|
}
|
|
@@ -4320,22 +4320,31 @@ function clearAlwaysOnOptOut(home) {
|
|
|
4320
4320
|
function alwaysOnOptedOut(home) {
|
|
4321
4321
|
return fs4.existsSync(path4.join(home, ALWAYS_ON_OPTOUT));
|
|
4322
4322
|
}
|
|
4323
|
+
var STARTUP_GRACE_MS = 9e4;
|
|
4323
4324
|
function alwaysOnState(home) {
|
|
4324
4325
|
if (!alwaysOnWanted(home)) return "off";
|
|
4325
4326
|
if (!fs4.existsSync(path4.join(home, "credentials"))) return "idle";
|
|
4327
|
+
let beating = false;
|
|
4326
4328
|
try {
|
|
4327
4329
|
const age = Date.now() - fs4.statSync(path4.join(home, HEARTBEAT_FILE)).mtimeMs;
|
|
4328
|
-
|
|
4330
|
+
beating = age <= HEARTBEAT_STALE_MS;
|
|
4329
4331
|
} catch {
|
|
4330
|
-
|
|
4332
|
+
beating = false;
|
|
4331
4333
|
}
|
|
4334
|
+
if (beating) return "connected";
|
|
4335
|
+
try {
|
|
4336
|
+
const since = Date.now() - fs4.statSync(path4.join(home, ALWAYS_ON_WANTED)).mtimeMs;
|
|
4337
|
+
if (since <= STARTUP_GRACE_MS) return "starting";
|
|
4338
|
+
} catch {
|
|
4339
|
+
}
|
|
4340
|
+
return "down";
|
|
4332
4341
|
}
|
|
4333
4342
|
function alwaysOnHealth(home) {
|
|
4334
4343
|
const state = alwaysOnState(home);
|
|
4335
4344
|
return { wanted: state !== "off", healthy: state !== "down" };
|
|
4336
4345
|
}
|
|
4337
4346
|
|
|
4338
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.0.
|
|
4347
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.0.131/node_modules/@agentchatme/agent-core/dist/index.js
|
|
4339
4348
|
import * as fs from "fs";
|
|
4340
4349
|
import * as path from "path";
|
|
4341
4350
|
import * as readline from "readline";
|
|
@@ -5623,7 +5632,7 @@ var HOUR = 60 * MIN;
|
|
|
5623
5632
|
var DAY = 24 * HOUR;
|
|
5624
5633
|
var MAX_ATTACHMENT_SIZE = 25 * 1024 * 1024;
|
|
5625
5634
|
|
|
5626
|
-
// node_modules/.pnpm/@agentchatme+agent-core@0.0.
|
|
5635
|
+
// node_modules/.pnpm/@agentchatme+agent-core@0.0.131/node_modules/@agentchatme/agent-core/dist/index.js
|
|
5627
5636
|
import * as fs22 from "fs";
|
|
5628
5637
|
import * as os from "os";
|
|
5629
5638
|
import * as path22 from "path";
|
|
@@ -5916,29 +5925,45 @@ function formatStopPickup(handle, rows) {
|
|
|
5916
5925
|
function formatAlwaysOnDown(copy) {
|
|
5917
5926
|
return `\u26A0 Always-on is down \u2014 while you are away I won\u2019t be able to answer messages (they queue for your next session, nothing is lost). Turn it back on: \`${copy.invoke} daemon install\``;
|
|
5918
5927
|
}
|
|
5919
|
-
function formatRegistrationOffer(copy) {
|
|
5928
|
+
function formatRegistrationOffer(copy, alwaysOn = "off") {
|
|
5920
5929
|
const { invoke, label } = copy;
|
|
5921
5930
|
return [
|
|
5922
|
-
`
|
|
5931
|
+
`This ${label} agent is on AgentChat but has no handle yet \u2014 no address other agents can reach it at.`,
|
|
5923
5932
|
"",
|
|
5924
|
-
"
|
|
5925
|
-
|
|
5933
|
+
"If the moment is right, offer it in ONE plain sentence and let them answer. Do not paste this block,",
|
|
5934
|
+
"do not list the commands, do not walk them through steps. You run the commands; they just talk to you.",
|
|
5926
5935
|
"",
|
|
5927
|
-
"
|
|
5928
|
-
"
|
|
5929
|
-
|
|
5930
|
-
`
|
|
5931
|
-
"",
|
|
5932
|
-
"ALREADY have an AgentChat agent \u2014 sign in, do NOT register a second one:",
|
|
5933
|
-
` \u2022 They have its API key (ac_\u2026): ${invoke} login --api-key <ac_\u2026>`,
|
|
5934
|
-
` \u2022 They lost the key: ${invoke} recover --email <email>, then relay the emailed 6-digit code: ${invoke} recover --code <code>`,
|
|
5936
|
+
"All you need from them is an email and a handle they like (3\u201330 characters, lowercase letters, digits",
|
|
5937
|
+
"and hyphens, starting with a letter). Ask first whether they already have an AgentChat account \u2014 from",
|
|
5938
|
+
"another machine, or a Hermes or OpenClaw agent \u2014 so you sign that one in instead of creating a second.",
|
|
5939
|
+
`Either way this ${label} agent ends up with its own handle, separate from any other coding agent here,`,
|
|
5940
|
+
"which is what lets them message each other.",
|
|
5935
5941
|
"",
|
|
5942
|
+
"Commands \u2014 yours to run, not to show:",
|
|
5943
|
+
` new account ${invoke} register --email <email> --handle <handle>`,
|
|
5944
|
+
` then, with the 6-digit code they were emailed: ${invoke} register --code <code>`,
|
|
5945
|
+
` has an API key ${invoke} login --api-key <ac_\u2026>`,
|
|
5946
|
+
` lost the key ${invoke} recover --email <email>, then ${invoke} recover --code <code>`,
|
|
5936
5947
|
"",
|
|
5937
|
-
|
|
5948
|
+
alwaysOnNote(alwaysOn, invoke),
|
|
5938
5949
|
"",
|
|
5939
|
-
|
|
5950
|
+
`One ask is plenty. If they decline or change the subject, drop it \u2014 and \`${invoke} register --not-now\``,
|
|
5951
|
+
"stops it being raised in future sessions too."
|
|
5940
5952
|
].join("\n");
|
|
5941
5953
|
}
|
|
5954
|
+
function alwaysOnNote(state, invoke) {
|
|
5955
|
+
switch (state) {
|
|
5956
|
+
case "connected":
|
|
5957
|
+
return "Always-on is running: this agent answers DMs even with no session open. Nothing to switch on.";
|
|
5958
|
+
case "idle":
|
|
5959
|
+
case "starting":
|
|
5960
|
+
return "Always-on is set up and will start answering DMs on its own as soon as there is a handle. Nothing to switch on.";
|
|
5961
|
+
case "off":
|
|
5962
|
+
return "Always-on is not set up here, so DMs are only seen during a session.";
|
|
5963
|
+
case "down":
|
|
5964
|
+
return `Always-on is registered but not running \u2014 \`${invoke} daemon status\` says why. DMs are only seen during a session until it recovers.`;
|
|
5965
|
+
}
|
|
5966
|
+
}
|
|
5942
5967
|
function renderUnregisteredBlock(copy) {
|
|
5943
5968
|
const { invoke, label } = copy;
|
|
5944
5969
|
return [
|
|
@@ -6024,7 +6049,7 @@ async function sessionStart(ctx, input) {
|
|
|
6024
6049
|
if (identity === null) {
|
|
6025
6050
|
if (shouldOfferRegistration(ctx.home)) {
|
|
6026
6051
|
recordRegistrationOffer(ctx.home);
|
|
6027
|
-
return { context: formatRegistrationOffer(ctx.copy) };
|
|
6052
|
+
return { context: formatRegistrationOffer(ctx.copy, alwaysOnState(ctx.home)) };
|
|
6028
6053
|
}
|
|
6029
6054
|
return none;
|
|
6030
6055
|
}
|
|
@@ -7435,12 +7460,6 @@ function printJson(payload) {
|
|
|
7435
7460
|
process.stdout.write(JSON.stringify(payload) + "\n");
|
|
7436
7461
|
}
|
|
7437
7462
|
|
|
7438
|
-
// src/hooks.ts
|
|
7439
|
-
var { runSessionStart, runUserPrompt, runStop } = createHookRunners(
|
|
7440
|
-
() => ({ home: identityHome(), copy: hostCopy() }),
|
|
7441
|
-
{ sessionStartOutput, stopOutput, printJson }
|
|
7442
|
-
);
|
|
7443
|
-
|
|
7444
7463
|
// src/always-on.ts
|
|
7445
7464
|
function ensureAlwaysOn(opts = {}) {
|
|
7446
7465
|
const home = identityHome();
|
|
@@ -7459,8 +7478,34 @@ function removeAlwaysOn() {
|
|
|
7459
7478
|
uninstallService({ label: SERVICE_LABEL, home: identityHome() });
|
|
7460
7479
|
}
|
|
7461
7480
|
|
|
7481
|
+
// src/hooks.ts
|
|
7482
|
+
var runners = createHookRunners(
|
|
7483
|
+
() => ({ home: identityHome(), copy: hostCopy() }),
|
|
7484
|
+
{ sessionStartOutput, stopOutput, printJson }
|
|
7485
|
+
);
|
|
7486
|
+
function ensureAlwaysOnQuietly() {
|
|
7487
|
+
try {
|
|
7488
|
+
const r = ensureAlwaysOn();
|
|
7489
|
+
if (!r.ok && r.detail !== "switched off by the user") log.warn(`always-on not registered: ${r.detail}`);
|
|
7490
|
+
} catch (err) {
|
|
7491
|
+
log.warn(`always-on not registered: ${String(err)}`);
|
|
7492
|
+
}
|
|
7493
|
+
}
|
|
7494
|
+
async function runSessionStart() {
|
|
7495
|
+
ensureAlwaysOnQuietly();
|
|
7496
|
+
await runners.runSessionStart();
|
|
7497
|
+
}
|
|
7498
|
+
async function runUserPrompt() {
|
|
7499
|
+
ensureAlwaysOnQuietly();
|
|
7500
|
+
await runners.runUserPrompt();
|
|
7501
|
+
}
|
|
7502
|
+
async function runStop() {
|
|
7503
|
+
ensureAlwaysOnQuietly();
|
|
7504
|
+
await runners.runStop();
|
|
7505
|
+
}
|
|
7506
|
+
|
|
7462
7507
|
// src/version.ts
|
|
7463
|
-
var VERSION2 = "0.0.
|
|
7508
|
+
var VERSION2 = "0.0.1711";
|
|
7464
7509
|
|
|
7465
7510
|
// src/index.ts
|
|
7466
7511
|
var USAGE = `agentchat-codex ${VERSION2} \u2014 AgentChat for Codex
|
|
@@ -7639,6 +7684,7 @@ function runDaemonCmd(sub) {
|
|
|
7639
7684
|
const line = {
|
|
7640
7685
|
off: "always-on: off \u2014 this agent only answers while a session is open",
|
|
7641
7686
|
idle: "always-on: idle \u2014 running, waiting for a sign-in",
|
|
7687
|
+
starting: "always-on: starting \u2014 the service is coming online",
|
|
7642
7688
|
connected: "always-on: connected \u2713 \u2014 answering DMs with no session open",
|
|
7643
7689
|
down: "always-on: NOT running \u2014 signed in, but no daemon is connected"
|
|
7644
7690
|
}[state];
|