@agentchatme/agent-core 0.5.1 → 0.5.3
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 +3 -1
- package/dist/{chunk-AFDD53DD.js → chunk-3OUDKIQV.js} +22 -22
- package/dist/{chunk-AFDD53DD.js.map → chunk-3OUDKIQV.js.map} +1 -1
- package/dist/{chunk-CDJASQ3X.js → chunk-CQSL6X4D.js} +18 -15
- package/dist/chunk-CQSL6X4D.js.map +1 -0
- package/dist/{chunk-3ERPUP4M.js → chunk-JL2L4WRG.js} +3 -3
- package/dist/{chunk-3ERPUP4M.js.map → chunk-JL2L4WRG.js.map} +1 -1
- package/dist/daemon-entry.d.ts +6 -5
- package/dist/daemon-entry.js +5 -2
- package/dist/daemon-entry.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +31 -6
- package/dist/index.js.map +1 -1
- package/dist/presets.js +2 -2
- package/dist/{served-manual-Be_eUo0m.d.ts → served-manual-6-oFUmjI.d.ts} +16 -8
- package/package.json +2 -2
- package/dist/chunk-CDJASQ3X.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
credentialsPath,
|
|
43
43
|
describeManualSync,
|
|
44
44
|
envApiKey,
|
|
45
|
+
envKeyConflict,
|
|
45
46
|
external_exports,
|
|
46
47
|
failedCyclesInARow,
|
|
47
48
|
fetchIdentityLine,
|
|
@@ -83,7 +84,7 @@ import {
|
|
|
83
84
|
writeCredentials,
|
|
84
85
|
writeIntegrationStatus,
|
|
85
86
|
writePending
|
|
86
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-CQSL6X4D.js";
|
|
87
88
|
import {
|
|
88
89
|
HOSTED_MCP_PATH,
|
|
89
90
|
PROBE_KILL_WAIT_MS,
|
|
@@ -91,7 +92,7 @@ import {
|
|
|
91
92
|
hostedMcpUrl,
|
|
92
93
|
probeHostedMcp,
|
|
93
94
|
runProbe
|
|
94
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-JL2L4WRG.js";
|
|
95
96
|
import {
|
|
96
97
|
DEFAULT_RUN_BUDGET_MS,
|
|
97
98
|
DEFAULT_RUN_PROFILE,
|
|
@@ -118,7 +119,7 @@ import {
|
|
|
118
119
|
spawnCommand,
|
|
119
120
|
spawnCommandSync,
|
|
120
121
|
workdirExposesHome
|
|
121
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-3OUDKIQV.js";
|
|
122
123
|
|
|
123
124
|
// src/integration/tray.ts
|
|
124
125
|
import { INBOX_TRAY_MAX_LIMIT } from "agentchatme";
|
|
@@ -337,7 +338,7 @@ function renderUnregisteredBlock(copy) {
|
|
|
337
338
|
"**Run the commands yourself, and ask the user one question per turn.** Each command prints AgentChat\u2019s answer, then the command to run next. Relay the answer to the user as it is; ask them for what the next command needs (a value it leaves as `<\u2026>`, such as the code AgentChat emailed them); if it says to wait, wait; then run it. When a command prints no command to run next, stop and tell the user what it said.",
|
|
338
339
|
"",
|
|
339
340
|
`- **New account:** ask for their email, then for the @handle they want (offer a suggestion if they like). Run: \`${invoke} register --email <email> --handle <handle>\`. Never submit a handle the user has not chosen or accepted.`,
|
|
340
|
-
`- **Existing account, with its API key:** run
|
|
341
|
+
`- **Existing account, with its API key:** ask the user to run \`${invoke} login\` in their own terminal and paste the key when it asks. Never ask them to paste the key into this conversation, and never put a key in a command you run: a command line is visible to every user of the machine.`,
|
|
341
342
|
`- **Existing account, key lost:** recovery replaces the old API key, so anything still using it stops working; say so and ask before going on. Ask for the email the account uses, then which @handle it is. Run: \`${invoke} recover --handle <handle> --email <email>\``,
|
|
342
343
|
"- **When it is done:** tell the user the @handle and where the API key is stored, exactly as the command printed them.",
|
|
343
344
|
"- Never reuse another active coding agent\u2019s account; each reachable agent needs its own.",
|
|
@@ -462,6 +463,11 @@ function createIdentityCommands(profile) {
|
|
|
462
463
|
const invocation = () => profile.invocation();
|
|
463
464
|
const LABEL = profile.label;
|
|
464
465
|
const clientIdentity = clientIdentityOf(profile.client);
|
|
466
|
+
function envKeyRefusal() {
|
|
467
|
+
const conflict = envKeyConflict(profile.home());
|
|
468
|
+
if (conflict === null) return null;
|
|
469
|
+
return `${conflict}. Unset AGENTCHAT_API_KEY, or, to sign this home in with that key on purpose: printenv AGENTCHAT_API_KEY | ${invocation()} login --api-key -`;
|
|
470
|
+
}
|
|
465
471
|
const apiClient = (apiKey, apiBase) => new AgentChatClient({ apiKey, baseUrl: apiBase, clientIdentity, timeoutMs: 5e3, retry: { maxRetries: 0, baseDelayMs: 0, maxDelayMs: 0 } });
|
|
466
472
|
const accountOptions = (apiBase) => ({ clientIdentity, apiBase, timeoutMs: 15e3 });
|
|
467
473
|
async function served(apiKey, apiBase) {
|
|
@@ -708,16 +714,23 @@ ${runLine(codeCommand(kind, pending.flow, code))} again.`);
|
|
|
708
714
|
const home = profile.home();
|
|
709
715
|
const apiBase = opts.apiBase ?? process.env["AGENTCHAT_API_BASE"] ?? DEFAULT_API_BASE;
|
|
710
716
|
let apiKey = opts.apiKey?.trim();
|
|
717
|
+
const onArgv = apiKey !== void 0 && apiKey.length > 0 && apiKey !== "-";
|
|
711
718
|
if (apiKey === "-") {
|
|
712
719
|
apiKey = await readAllStdin();
|
|
713
720
|
} else if (!apiKey) {
|
|
714
721
|
const fromEnv = process.env["AGENTCHAT_API_KEY"]?.trim();
|
|
722
|
+
const refusal = fromEnv ? envKeyRefusal() : null;
|
|
723
|
+
if (refusal !== null) {
|
|
724
|
+
console.error(`${refusal}
|
|
725
|
+
login does not adopt an exported key in place of the one this home holds; nothing was saved.`);
|
|
726
|
+
return 1;
|
|
727
|
+
}
|
|
715
728
|
if (fromEnv) {
|
|
716
729
|
apiKey = fromEnv;
|
|
717
730
|
console.log("Using the key from AGENTCHAT_API_KEY.");
|
|
718
731
|
} else if (process.stdin.isTTY !== true) {
|
|
719
732
|
console.error(
|
|
720
|
-
`Missing API key.
|
|
733
|
+
`Missing API key. Run \`${invocation()} login\` in a terminal and paste the key when it asks, or pipe it in from a file: \`${invocation()} login --api-key - < key.txt\`. Never put the key itself on a command line: \`ps\` and shell history can see it there.`
|
|
721
734
|
);
|
|
722
735
|
return 1;
|
|
723
736
|
} else {
|
|
@@ -753,7 +766,10 @@ The key was not saved.`);
|
|
|
753
766
|
`Signed in as @${check.handle} for ${LABEL}.`,
|
|
754
767
|
`API key stored at ${credentialsPath(home)} (never commit this file).`,
|
|
755
768
|
...await placeIdentity(check.handle, apiKey, apiBase),
|
|
756
|
-
NEXT_HINT
|
|
769
|
+
NEXT_HINT,
|
|
770
|
+
...onArgv ? [
|
|
771
|
+
`Note: the key was on this command line, where \`ps\` and shell history can see it. Next time run \`${invocation()} login\` and paste it, or pipe it in: \`${invocation()} login --api-key - < key.txt\`.`
|
|
772
|
+
] : []
|
|
757
773
|
].join("\n")
|
|
758
774
|
);
|
|
759
775
|
return 0;
|
|
@@ -794,6 +810,12 @@ The key was not saved.`);
|
|
|
794
810
|
async function runStatus(opts) {
|
|
795
811
|
const home = profile.home();
|
|
796
812
|
const anchorFile = profile.anchorFile?.() ?? null;
|
|
813
|
+
const refusal = envKeyRefusal();
|
|
814
|
+
if (refusal !== null) {
|
|
815
|
+
if (opts.json) console.log(JSON.stringify({ configured: true, host: profile.id, error: { kind: "env_key_conflict", detail: refusal }, home }));
|
|
816
|
+
else console.error(refusal);
|
|
817
|
+
return 1;
|
|
818
|
+
}
|
|
797
819
|
const identity = resolveIdentity(home);
|
|
798
820
|
const pending = readPending(home);
|
|
799
821
|
const integration = readIntegrationStatus(home);
|
|
@@ -986,6 +1008,8 @@ The key was not saved.`);
|
|
|
986
1008
|
let texts = NO_TEXTS;
|
|
987
1009
|
checks.push({ name: "node", verdict: "PASS", detail: process.version });
|
|
988
1010
|
checks.push({ name: "home", verdict: "PASS", detail: home });
|
|
1011
|
+
const refusal = envKeyRefusal();
|
|
1012
|
+
if (refusal !== null) checks.push({ name: "env-key", verdict: "FAIL", detail: refusal });
|
|
989
1013
|
const creds = readCredentials(home);
|
|
990
1014
|
if (creds === null) {
|
|
991
1015
|
checks.push({
|
|
@@ -1799,6 +1823,7 @@ export {
|
|
|
1799
1823
|
credentialsPath,
|
|
1800
1824
|
describeManualSync,
|
|
1801
1825
|
envApiKey,
|
|
1826
|
+
envKeyConflict,
|
|
1802
1827
|
failedCyclesInARow,
|
|
1803
1828
|
fetchIdentityLine,
|
|
1804
1829
|
fetchServedTexts,
|