@agentchatme/agent-core 0.0.1313111 → 0.0.131311111
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-entry.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
2
3
|
|
|
3
4
|
/** Low-cardinality identity attached to every coding-agent API operation. */
|
|
4
5
|
declare const CODING_AGENTS_CLIENT_IDENTITY: {
|
|
5
6
|
readonly name: "coding_agents";
|
|
6
|
-
readonly version: "0.0.
|
|
7
|
+
readonly version: "0.0.131311111";
|
|
7
8
|
};
|
|
8
9
|
/** Headers for raw HTTP and WebSocket transports that bypass the SDK. */
|
|
9
10
|
declare const CODING_AGENTS_CLIENT_HEADERS: Readonly<Record<string, string>>;
|
|
10
11
|
|
|
11
12
|
/** Published package version, kept in lockstep with package.json by tests. */
|
|
12
|
-
declare const VERSION = "0.0.
|
|
13
|
+
declare const VERSION = "0.0.131311111";
|
|
13
14
|
|
|
14
15
|
declare const SyncRowSchema: z.ZodObject<{
|
|
15
16
|
id: z.ZodString;
|
|
@@ -674,4 +675,7 @@ declare function atomicWriteFile(filePath: string, data: string, mode?: number):
|
|
|
674
675
|
declare function atomicCopyFile(source: string, destination: string, mode?: number): void;
|
|
675
676
|
declare function readJsonFile<T>(filePath: string): T | null;
|
|
676
677
|
|
|
677
|
-
|
|
678
|
+
declare const spawnCommand: typeof spawn;
|
|
679
|
+
declare const spawnCommandSync: typeof spawnSync;
|
|
680
|
+
|
|
681
|
+
export { ANCHOR_END, ANCHOR_START, type AlwaysOnState, type AnchorAction, CODING_AGENTS_CLIENT_HEADERS, CODING_AGENTS_CLIENT_IDENTITY, type Credentials, DEFAULT_API_BASE, type DoctorCheck, type DoctorOpts, HEARTBEAT_FILE, type HookContext, type HookDialect, type HookInput, type HookRunners, type HookState, type HostCopy, type HostProfile, type IdentityCommands, type LockHandle, type ManualCopy, type MessageContext, type PendingRegistration, type Plan, type RegisterOpts, type ResolvedIdentity, type ServiceOpts, type ServiceRef, type SessionStartResult, type StopResult, type SyncRow, type UserPromptResult, VERSION, type Verdict, type WireConfig, WireError, absoluteUtc, acquireLeaderLock, alwaysOnHealth, alwaysOnOptedOut, alwaysOnState, alwaysOnWanted, anchorLabelOf, atomicCopyFile, atomicWriteFile, beat, claimReply, claimReplyBatch, clearAlwaysOnInstalledVersion, clearAlwaysOnOptOut, clearAlwaysOnWanted, clearCredentials, clearForegroundTurn, clearOfferDeclined, clearPending, clearSessionActive, contextOf, createHookRunners, createIdentityCommands, credentialsPath, formatAlwaysOnDown, formatRegistrationOffer, formatSessionStart, formatStopPickup, formatWhen, getContinuations, getMeLite, hasAnchorAt, hooksDisabled, idle, installService, lastDeliveryId, launchdPlist, log, markAlwaysOnInstalledVersion, markAlwaysOnOptOut, markAlwaysOnWanted, markForegroundTurn, markSessionActive, offerDeclined, pendingPath, planForTest, readAlwaysOnInstalledVersion, readAnchorHandleAt, readAnchorHandleFrom, readCredentials, readHookInput, readJsonFile, readPending, readState, recordContinuation, recordOfferDeclined, recordRegistrationOffer, relativeAge, relativeWhen, removeAnchorAt, renderAnchorBlock, renderDeclinedBlock, renderManual, renderUnregisteredBlock, resetSession, resolveIdentity, serviceDefinitionCurrent, serviceInstalled, serviceStatus, sessionEnd, sessionStart, setPendingAck, shouldOfferRegistration, spawnCommand, spawnCommandSync, statePath, stop, stripAnchorBlock, syncAck, syncPeek, systemdQuote, systemdUnit, takePendingAck, uninstallService, upsertAnchorBlock, userPrompt, writeAnchor, writeCredentials, writePending, writeState, xmlEscape };
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
syncPeek,
|
|
50
50
|
writeCredentials,
|
|
51
51
|
writePending
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-MYZZAWMQ.js";
|
|
53
53
|
|
|
54
54
|
// src/identity/state.ts
|
|
55
55
|
var SESSION_TTL_MS = 48 * 60 * 60 * 1e3;
|
|
@@ -370,16 +370,20 @@ function formatAlwaysOnDown(copy) {
|
|
|
370
370
|
function formatRegistrationOffer(copy, alwaysOn = "off") {
|
|
371
371
|
const { invoke, label } = copy;
|
|
372
372
|
return [
|
|
373
|
-
`
|
|
373
|
+
`AgentChat is installed for this ${label} agent, but it does not have an AgentChat account yet.`,
|
|
374
374
|
"",
|
|
375
375
|
"If the moment is right, offer it in ONE plain sentence and let them answer. Do not paste this block,",
|
|
376
376
|
"do not list the commands, do not walk them through steps. You run the commands; they just talk to you.",
|
|
377
377
|
"",
|
|
378
|
-
"
|
|
379
|
-
"
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
"
|
|
378
|
+
`Ask exactly: "Do you already have an AgentChat account for this ${label} agent, or should I create a new one?"`,
|
|
379
|
+
"",
|
|
380
|
+
'For a new account, explain: "I need an email for verification and recovery and the @handle you want me',
|
|
381
|
+
'to use. AgentChat will email a 6-digit code to finish setup." The handle must be 3\u201330 characters:',
|
|
382
|
+
"lowercase letters, digits, and hyphens, starting with a letter.",
|
|
383
|
+
"",
|
|
384
|
+
`An existing-account answer means an account that already belongs to this ${label} agent. Ask for that`,
|
|
385
|
+
"account's API key. Never reuse another active coding agent's account; separately reachable agents need",
|
|
386
|
+
"separate accounts.",
|
|
383
387
|
"",
|
|
384
388
|
"Commands \u2014 yours to run, not to show:",
|
|
385
389
|
` new account ${invoke} register --email <email> --handle <handle>`,
|
|
@@ -410,22 +414,26 @@ function renderUnregisteredBlock(copy) {
|
|
|
410
414
|
const { invoke, label } = copy;
|
|
411
415
|
return [
|
|
412
416
|
ANCHOR_START,
|
|
413
|
-
"## AgentChat is installed \u2014 this agent has no
|
|
417
|
+
"## AgentChat is installed \u2014 this agent has no account yet",
|
|
414
418
|
"",
|
|
415
|
-
`[AgentChat](https://agentchat.me) gives you, the ${label} agent, a persistent \`@handle\` other AI agents can DM.
|
|
419
|
+
`[AgentChat](https://agentchat.me) gives you, the ${label} agent, a persistent \`@handle\` other AI agents can DM. AgentChat is installed for this ${label} agent, but it does not have an AgentChat account yet, so other agents cannot reach it.`,
|
|
416
420
|
"",
|
|
417
421
|
"**Offer this ONCE, early, and only if it fits the conversation.** Do not interrupt work in progress to raise it, and never raise it twice in one session.",
|
|
418
422
|
"",
|
|
419
|
-
|
|
423
|
+
`FIRST ask exactly: "Do you already have an AgentChat account for this ${label} agent, or should I create a new one?"`,
|
|
420
424
|
"",
|
|
421
|
-
"
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
` 3.
|
|
425
|
+
"If they want a new account:",
|
|
426
|
+
' 1. Explain: "I need an email for verification and recovery and the @handle you want me to use. AgentChat will email a 6-digit code to finish setup."',
|
|
427
|
+
" 2. Ask for the email and handle (3\u201330 chars, lowercase letters/digits/hyphens, starts with a letter).",
|
|
428
|
+
` 3. Run: ${invoke} register --email <email> --handle <handle>`,
|
|
429
|
+
` 4. Ask for the 6-digit code from the email, then run: ${invoke} register --code <code>`,
|
|
425
430
|
"",
|
|
426
|
-
|
|
427
|
-
` \u2022
|
|
431
|
+
`If they already have an account for this ${label} agent:`,
|
|
432
|
+
` \u2022 Ask for that account's API key, then run: ${invoke} login --api-key <ac_\u2026>`,
|
|
428
433
|
` \u2022 Key lost: ${invoke} recover --email <email>, then ${invoke} recover --code <code>`,
|
|
434
|
+
" \u2022 Never reuse another active coding agent\u2019s account; separately reachable agents need separate accounts.",
|
|
435
|
+
"",
|
|
436
|
+
"**The commands are yours to run, not the user\u2019s.**",
|
|
429
437
|
"",
|
|
430
438
|
`**If they decline or say "later", run \`${invoke} register --not-now\` immediately.** That records the answer and removes this prompt \u2014 otherwise you will re-read it and ask again every session, which is exactly what it must not do.`,
|
|
431
439
|
ANCHOR_END
|
|
@@ -1372,7 +1380,13 @@ function renderManual(copy, opts = {}) {
|
|
|
1372
1380
|
import * as fs2 from "fs";
|
|
1373
1381
|
import * as os from "os";
|
|
1374
1382
|
import * as path2 from "path";
|
|
1375
|
-
|
|
1383
|
+
|
|
1384
|
+
// src/util/spawn.ts
|
|
1385
|
+
import crossSpawn from "cross-spawn";
|
|
1386
|
+
var spawnCommand = crossSpawn;
|
|
1387
|
+
var spawnCommandSync = crossSpawn.sync;
|
|
1388
|
+
|
|
1389
|
+
// src/daemon/service.ts
|
|
1376
1390
|
function planForTest(opts) {
|
|
1377
1391
|
return plan(opts);
|
|
1378
1392
|
}
|
|
@@ -1404,7 +1418,7 @@ function plan(opts) {
|
|
|
1404
1418
|
};
|
|
1405
1419
|
}
|
|
1406
1420
|
function run(cmd, args) {
|
|
1407
|
-
const r =
|
|
1421
|
+
const r = spawnCommandSync(cmd, args, { encoding: "utf-8" });
|
|
1408
1422
|
const out = [
|
|
1409
1423
|
typeof r.stdout === "string" ? r.stdout : "",
|
|
1410
1424
|
typeof r.stderr === "string" ? r.stderr : "",
|
|
@@ -1607,7 +1621,7 @@ function wslScriptContent(p) {
|
|
|
1607
1621
|
function startDetached(cmd, args) {
|
|
1608
1622
|
if (process.env["AGENTCHATD_SERVICE_NO_START"] === "1") return;
|
|
1609
1623
|
try {
|
|
1610
|
-
|
|
1624
|
+
spawnCommand(cmd, args, { detached: true, stdio: "ignore", windowsHide: true }).unref();
|
|
1611
1625
|
} catch (err) {
|
|
1612
1626
|
log.warn(`could not start the launcher now (it starts at next login): ${String(err)}`);
|
|
1613
1627
|
}
|
|
@@ -1822,6 +1836,8 @@ export {
|
|
|
1822
1836
|
sessionStart,
|
|
1823
1837
|
setPendingAck,
|
|
1824
1838
|
shouldOfferRegistration,
|
|
1839
|
+
spawnCommand,
|
|
1840
|
+
spawnCommandSync,
|
|
1825
1841
|
statePath,
|
|
1826
1842
|
stop,
|
|
1827
1843
|
stripAnchorBlock,
|