@agentchatme/agent-core 0.5.2 → 0.6.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/README.md +35 -7
- package/dist/{chunk-AFDD53DD.js → chunk-AVLI55C5.js} +50 -26
- package/dist/chunk-AVLI55C5.js.map +1 -0
- package/dist/{chunk-CDJASQ3X.js → chunk-EDB33Z22.js} +25 -20
- package/dist/chunk-EDB33Z22.js.map +1 -0
- package/dist/{chunk-WDHXWAWF.js → chunk-QUANHUVW.js} +3 -3
- package/dist/{chunk-WDHXWAWF.js.map → chunk-QUANHUVW.js.map} +1 -1
- package/dist/daemon-entry.d.ts +9 -8
- package/dist/daemon-entry.js +7 -2
- package/dist/daemon-entry.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +39 -6
- package/dist/index.js.map +1 -1
- package/dist/presets.d.ts +118 -24
- package/dist/presets.js +202 -46
- package/dist/presets.js.map +1 -1
- package/dist/{runner-DYVqz_9P.d.ts → runner-C9kZD3KH.d.ts} +34 -4
- package/dist/{served-manual-Be_eUo0m.d.ts → served-manual-CawJYdzJ.d.ts} +18 -8
- package/package.json +1 -1
- package/dist/chunk-AFDD53DD.js.map +0 -1
- package/dist/chunk-CDJASQ3X.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { I as IntegrationClient, H as HostProfile, c as Lease, L as LeaseOptions, d as LeaseAttempt, e as LeaseHolder } from './served-manual-
|
|
2
|
-
export { C as CheckManualOptions, f as Credentials, D as DEFAULT_API_BASE, g as DoctorCheck, h as DoctorContext, F as FAILED_CYCLE_OUTCOMES, i as INTEGRATION_STATUS_FILE, j as IntegrationCycle, k as IntegrationLastRun, b as IntegrationRunsFailing, l as IntegrationStandby, a as IntegrationStatus, m as IntegrationUnservable, n as LEASE_RENEW_MS, o as LEASE_STALE_MS, p as LEGACY_STATUS_FILE, q as MANUAL_FETCH_TIMEOUT_MS, r as MANUAL_MAX_BYTES, s as MANUAL_MAX_REDIRECTS, t as ManualCheck, u as ManualCheckState, M as ManualFetch, v as ManualSyncResult, w as ManualSyncState, P as PendingRegistration, x as PendingSignup, R as REPEATED_FAILED_CYCLES, y as ResolveIdentityOptions, z as ResolvedIdentity, A as SOCKET_STATES, B as ServedManual, S as SocketState, E as StatusContext, G as SyncManualOptions, T as TextsStatus, V as Verdict, J as acquireLease, K as anchorLabelOf, N as bootedAt, O as checkManual, Q as clearCredentials, U as clearIntegrationStatus, W as clearPending, X as clientHeadersOf, Y as clientIdentityOf, Z as clientNameOf, _ as credentialsPath, $ as describeManualSync, a0 as envApiKey, a1 as
|
|
1
|
+
import { I as IntegrationClient, H as HostProfile, c as Lease, L as LeaseOptions, d as LeaseAttempt, e as LeaseHolder } from './served-manual-CawJYdzJ.js';
|
|
2
|
+
export { C as CheckManualOptions, f as Credentials, D as DEFAULT_API_BASE, g as DoctorCheck, h as DoctorContext, F as FAILED_CYCLE_OUTCOMES, i as INTEGRATION_STATUS_FILE, j as IntegrationCycle, k as IntegrationLastRun, b as IntegrationRunsFailing, l as IntegrationStandby, a as IntegrationStatus, m as IntegrationUnservable, n as LEASE_RENEW_MS, o as LEASE_STALE_MS, p as LEGACY_STATUS_FILE, q as MANUAL_FETCH_TIMEOUT_MS, r as MANUAL_MAX_BYTES, s as MANUAL_MAX_REDIRECTS, t as ManualCheck, u as ManualCheckState, M as ManualFetch, v as ManualSyncResult, w as ManualSyncState, P as PendingRegistration, x as PendingSignup, R as REPEATED_FAILED_CYCLES, y as ResolveIdentityOptions, z as ResolvedIdentity, A as SOCKET_STATES, B as ServedManual, S as SocketState, E as StatusContext, G as SyncManualOptions, T as TextsStatus, V as Verdict, J as acquireLease, K as anchorLabelOf, N as bootedAt, O as checkManual, Q as clearCredentials, U as clearIntegrationStatus, W as clearPending, X as clientHeadersOf, Y as clientIdentityOf, Z as clientNameOf, _ as credentialsPath, $ as describeManualSync, a0 as envApiKey, a1 as envKeyConflict, a2 as failedCyclesInARow, a3 as formatIntegrationStatus, a4 as fromKitResult, a5 as holderLive, a6 as integrationStatusAge, a7 as integrationStatusPath, a8 as leaseHolder, a9 as parseLease, aa as pendingPath, ab as pidAlive, ac as readCredentials, ad as readIntegrationStatus, ae as readManualVersion, af as readPending, ag as resetLeaseObservations, ah as resolveIdentity, ai as statePath, aj as syncManual, ak as writeCredentials, al as writeIntegrationStatus, am as writePending } from './served-manual-CawJYdzJ.js';
|
|
3
3
|
import { AgentChatClient, Texts, TextsRuntime, integration } from 'agentchatme';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
export { D as DEFAULT_RUN_BUDGET_MS, k as DEFAULT_RUN_PROFILE, I as INTEGRATION_ENV, l as INTEGRATION_ENV_LEGACY, m as INTEGRATION_ENV_LEGACY_REMOVAL, P as PEER_RUN_WARNING, n as RUN_BUDGET_ENV, o as RUN_PROFILES, p as RUN_PROFILE_ENV, d as RunKind, c as RunOutcome, e as RunOutcomeState, f as RunPreflight, q as RunPreflightOptions, a as RunProfile, g as RunRequest, b as RunRunner, h as RunWake, i as RunnerFactory, j as RunnerIdentity, R as RunnerSource, r as
|
|
5
|
+
export { D as DEFAULT_RUN_BUDGET_MS, k as DEFAULT_RUN_PROFILE, F as FALLBACK_RUN_PROFILE, I as INTEGRATION_ENV, l as INTEGRATION_ENV_LEGACY, m as INTEGRATION_ENV_LEGACY_REMOVAL, O as OWN_RUN_WARNING, P as PEER_RUN_WARNING, n as RUN_BUDGET_ENV, o as RUN_PROFILES, p as RUN_PROFILE_ENV, d as RunKind, c as RunOutcome, e as RunOutcomeState, f as RunPreflight, q as RunPreflightOptions, a as RunProfile, g as RunRequest, b as RunRunner, h as RunWake, i as RunnerFactory, j as RunnerIdentity, R as RunnerSource, r as describeRunProfile, s as integrationDisabled, t as integrationDisabledBy, u as isRunProfile, v as isRunnerFactory, w as ownProfileLine, x as resolveRunBudgetMs, y as resolveRunProfile, z as runProfileWarning, A as workdirExposesHome } from './runner-C9kZD3KH.js';
|
|
6
6
|
import { spawn, spawnSync } from 'node:child_process';
|
|
7
7
|
|
|
8
8
|
/** Published package version, kept in lockstep with package.json by tests. */
|
|
9
|
-
declare const VERSION = "0.
|
|
9
|
+
declare const VERSION = "0.6.0";
|
|
10
10
|
|
|
11
11
|
type TrayClient = Pick<AgentChatClient, 'inbox'>;
|
|
12
12
|
interface TraySummary {
|
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-EDB33Z22.js";
|
|
87
88
|
import {
|
|
88
89
|
HOSTED_MCP_PATH,
|
|
89
90
|
PROBE_KILL_WAIT_MS,
|
|
@@ -91,13 +92,15 @@ import {
|
|
|
91
92
|
hostedMcpUrl,
|
|
92
93
|
probeHostedMcp,
|
|
93
94
|
runProbe
|
|
94
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-QUANHUVW.js";
|
|
95
96
|
import {
|
|
96
97
|
DEFAULT_RUN_BUDGET_MS,
|
|
97
98
|
DEFAULT_RUN_PROFILE,
|
|
99
|
+
FALLBACK_RUN_PROFILE,
|
|
98
100
|
INTEGRATION_ENV,
|
|
99
101
|
INTEGRATION_ENV_LEGACY,
|
|
100
102
|
INTEGRATION_ENV_LEGACY_REMOVAL,
|
|
103
|
+
OWN_RUN_WARNING,
|
|
101
104
|
PEER_RUN_WARNING,
|
|
102
105
|
RUN_BUDGET_ENV,
|
|
103
106
|
RUN_PROFILES,
|
|
@@ -107,10 +110,12 @@ import {
|
|
|
107
110
|
clientHeadersOf,
|
|
108
111
|
clientIdentityOf,
|
|
109
112
|
clientNameOf,
|
|
113
|
+
describeRunProfile,
|
|
110
114
|
integrationDisabled,
|
|
111
115
|
integrationDisabledBy,
|
|
112
116
|
isRunProfile,
|
|
113
117
|
log,
|
|
118
|
+
ownProfileLine,
|
|
114
119
|
readJsonFile,
|
|
115
120
|
resolveRunBudgetMs,
|
|
116
121
|
resolveRunProfile,
|
|
@@ -118,7 +123,7 @@ import {
|
|
|
118
123
|
spawnCommand,
|
|
119
124
|
spawnCommandSync,
|
|
120
125
|
workdirExposesHome
|
|
121
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-AVLI55C5.js";
|
|
122
127
|
|
|
123
128
|
// src/integration/tray.ts
|
|
124
129
|
import { INBOX_TRAY_MAX_LIMIT } from "agentchatme";
|
|
@@ -337,7 +342,7 @@ function renderUnregisteredBlock(copy) {
|
|
|
337
342
|
"**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
343
|
"",
|
|
339
344
|
`- **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
|
|
345
|
+
`- **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
346
|
`- **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
347
|
"- **When it is done:** tell the user the @handle and where the API key is stored, exactly as the command printed them.",
|
|
343
348
|
"- Never reuse another active coding agent\u2019s account; each reachable agent needs its own.",
|
|
@@ -462,6 +467,11 @@ function createIdentityCommands(profile) {
|
|
|
462
467
|
const invocation = () => profile.invocation();
|
|
463
468
|
const LABEL = profile.label;
|
|
464
469
|
const clientIdentity = clientIdentityOf(profile.client);
|
|
470
|
+
function envKeyRefusal() {
|
|
471
|
+
const conflict = envKeyConflict(profile.home());
|
|
472
|
+
if (conflict === null) return null;
|
|
473
|
+
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 -`;
|
|
474
|
+
}
|
|
465
475
|
const apiClient = (apiKey, apiBase) => new AgentChatClient({ apiKey, baseUrl: apiBase, clientIdentity, timeoutMs: 5e3, retry: { maxRetries: 0, baseDelayMs: 0, maxDelayMs: 0 } });
|
|
466
476
|
const accountOptions = (apiBase) => ({ clientIdentity, apiBase, timeoutMs: 15e3 });
|
|
467
477
|
async function served(apiKey, apiBase) {
|
|
@@ -708,16 +718,23 @@ ${runLine(codeCommand(kind, pending.flow, code))} again.`);
|
|
|
708
718
|
const home = profile.home();
|
|
709
719
|
const apiBase = opts.apiBase ?? process.env["AGENTCHAT_API_BASE"] ?? DEFAULT_API_BASE;
|
|
710
720
|
let apiKey = opts.apiKey?.trim();
|
|
721
|
+
const onArgv = apiKey !== void 0 && apiKey.length > 0 && apiKey !== "-";
|
|
711
722
|
if (apiKey === "-") {
|
|
712
723
|
apiKey = await readAllStdin();
|
|
713
724
|
} else if (!apiKey) {
|
|
714
725
|
const fromEnv = process.env["AGENTCHAT_API_KEY"]?.trim();
|
|
726
|
+
const refusal = fromEnv ? envKeyRefusal() : null;
|
|
727
|
+
if (refusal !== null) {
|
|
728
|
+
console.error(`${refusal}
|
|
729
|
+
login does not adopt an exported key in place of the one this home holds; nothing was saved.`);
|
|
730
|
+
return 1;
|
|
731
|
+
}
|
|
715
732
|
if (fromEnv) {
|
|
716
733
|
apiKey = fromEnv;
|
|
717
734
|
console.log("Using the key from AGENTCHAT_API_KEY.");
|
|
718
735
|
} else if (process.stdin.isTTY !== true) {
|
|
719
736
|
console.error(
|
|
720
|
-
`Missing API key.
|
|
737
|
+
`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
738
|
);
|
|
722
739
|
return 1;
|
|
723
740
|
} else {
|
|
@@ -753,7 +770,10 @@ The key was not saved.`);
|
|
|
753
770
|
`Signed in as @${check.handle} for ${LABEL}.`,
|
|
754
771
|
`API key stored at ${credentialsPath(home)} (never commit this file).`,
|
|
755
772
|
...await placeIdentity(check.handle, apiKey, apiBase),
|
|
756
|
-
NEXT_HINT
|
|
773
|
+
NEXT_HINT,
|
|
774
|
+
...onArgv ? [
|
|
775
|
+
`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\`.`
|
|
776
|
+
] : []
|
|
757
777
|
].join("\n")
|
|
758
778
|
);
|
|
759
779
|
return 0;
|
|
@@ -794,6 +814,12 @@ The key was not saved.`);
|
|
|
794
814
|
async function runStatus(opts) {
|
|
795
815
|
const home = profile.home();
|
|
796
816
|
const anchorFile = profile.anchorFile?.() ?? null;
|
|
817
|
+
const refusal = envKeyRefusal();
|
|
818
|
+
if (refusal !== null) {
|
|
819
|
+
if (opts.json) console.log(JSON.stringify({ configured: true, host: profile.id, error: { kind: "env_key_conflict", detail: refusal }, home }));
|
|
820
|
+
else console.error(refusal);
|
|
821
|
+
return 1;
|
|
822
|
+
}
|
|
797
823
|
const identity = resolveIdentity(home);
|
|
798
824
|
const pending = readPending(home);
|
|
799
825
|
const integration = readIntegrationStatus(home);
|
|
@@ -986,6 +1012,8 @@ The key was not saved.`);
|
|
|
986
1012
|
let texts = NO_TEXTS;
|
|
987
1013
|
checks.push({ name: "node", verdict: "PASS", detail: process.version });
|
|
988
1014
|
checks.push({ name: "home", verdict: "PASS", detail: home });
|
|
1015
|
+
const refusal = envKeyRefusal();
|
|
1016
|
+
if (refusal !== null) checks.push({ name: "env-key", verdict: "FAIL", detail: refusal });
|
|
989
1017
|
const creds = readCredentials(home);
|
|
990
1018
|
if (creds === null) {
|
|
991
1019
|
checks.push({
|
|
@@ -1741,6 +1769,7 @@ export {
|
|
|
1741
1769
|
DEFAULT_RUN_BUDGET_MS,
|
|
1742
1770
|
DEFAULT_RUN_PROFILE,
|
|
1743
1771
|
FAILED_CYCLE_OUTCOMES,
|
|
1772
|
+
FALLBACK_RUN_PROFILE,
|
|
1744
1773
|
HEARTBEAT_FILE,
|
|
1745
1774
|
HOSTED_MCP_PATH,
|
|
1746
1775
|
INTEGRATION_ENV,
|
|
@@ -1757,6 +1786,7 @@ export {
|
|
|
1757
1786
|
MANUAL_MAX_REDIRECTS,
|
|
1758
1787
|
MANUAL_SKILL_NAME,
|
|
1759
1788
|
MANUAL_URL,
|
|
1789
|
+
OWN_RUN_WARNING,
|
|
1760
1790
|
PEER_RUN_WARNING,
|
|
1761
1791
|
PROBE_KILL_WAIT_MS,
|
|
1762
1792
|
REPEATED_FAILED_CYCLES,
|
|
@@ -1798,7 +1828,9 @@ export {
|
|
|
1798
1828
|
createIdentityCommands,
|
|
1799
1829
|
credentialsPath,
|
|
1800
1830
|
describeManualSync,
|
|
1831
|
+
describeRunProfile,
|
|
1801
1832
|
envApiKey,
|
|
1833
|
+
envKeyConflict,
|
|
1802
1834
|
failedCyclesInARow,
|
|
1803
1835
|
fetchIdentityLine,
|
|
1804
1836
|
fetchServedTexts,
|
|
@@ -1829,6 +1861,7 @@ export {
|
|
|
1829
1861
|
markStandby,
|
|
1830
1862
|
normalizeHandle,
|
|
1831
1863
|
offerDeclined,
|
|
1864
|
+
ownProfileLine,
|
|
1832
1865
|
parseLease,
|
|
1833
1866
|
parseServiceHome,
|
|
1834
1867
|
pendingPath,
|