@agentchatme/agent-core 0.1.0 → 0.2.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 +54 -36
- package/dist/{chunk-I4U4A7HO.js → chunk-GXAX47O6.js} +385 -148
- package/dist/chunk-GXAX47O6.js.map +1 -0
- package/dist/daemon-entry.d.ts +165 -140
- package/dist/daemon-entry.js +534 -442
- package/dist/daemon-entry.js.map +1 -1
- package/dist/index.d.ts +62 -80
- package/dist/index.js +186 -184
- package/dist/index.js.map +1 -1
- package/dist/prompts-B0UL03Hu.d.ts +336 -0
- package/package.json +3 -3
- package/dist/chunk-I4U4A7HO.js.map +0 -1
- package/dist/status-D8qOP4kM.d.ts +0 -260
package/dist/index.d.ts
CHANGED
|
@@ -1,37 +1,13 @@
|
|
|
1
|
+
import { I as IntegrationClient } from './prompts-B0UL03Hu.js';
|
|
2
|
+
export { C as CachedTexts, l as DEFAULT_RUN_BUDGET_MS, m as DEFAULT_RUN_PROFILE, F as FetchIdentityLineOptions, n as INTEGRATION_ENV, o as INTEGRATION_ENV_LEGACY, p as INTEGRATION_STATUS_FILE, e as IntegrationLastRun, b as IntegrationStatus, L as LEGACY_STATUS_FILE, q as LoadTextsOptions, r as LoadedTexts, s as RUN_BUDGET_ENV, t as RUN_PROFILES, u as RUN_PROFILE_ENV, g as RunKind, f as RunOutcome, h as RunOutcomeState, i as RunPreflight, a as RunProfile, c as RunPrompts, j as RunRequest, R as RunRunner, v as SOCKET_STATES, S as SocketState, w as TEXTS_CACHE_FILE, x as TEXTS_REFRESH_MS, y as TEXTS_RETRY_MS, z as TextsClient, A as TextsSource, B as TextsStatus, T as TextsStore, E as TextsStoreOptions, G as buildRunPrompts, H as clearIntegrationStatus, J as clientHeadersOf, K as clientIdentityOf, M as fetchIdentityLine, N as formatIntegrationStatus, O as integrationDisabled, P as integrationDisabledBy, Q as integrationStatusAge, U as integrationStatusPath, V as isRunProfile, X as loadTexts, Y as readCachedTexts, Z as readIntegrationStatus, _ as resolveRunBudgetMs, $ as resolveRunProfile, a0 as textsCachePath, a1 as writeCachedTexts, a2 as writeIntegrationStatus } from './prompts-B0UL03Hu.js';
|
|
3
|
+
import { AgentChatClient, Texts } from 'agentchatme';
|
|
1
4
|
import { z } from 'zod';
|
|
2
|
-
export { B as BARE_TOOL_NAMER, i as DEFAULT_RUN_BUDGET_MS, j as DEFAULT_RUN_PROFILE, k as DOORBELL_ENV, l as DOORBELL_STATUS_FILE, c as DoorbellLastRun, D as DoorbellPrompts, b as DoorbellStatus, H as HOSTED_TOOLS, P as PromptOptions, m as RUN_BUDGET_ENV, n as RUN_PROFILES, o as RUN_PROFILE_ENV, e as RunKind, d as RunOutcome, f as RunOutcomeState, g as RunPreflight, a as RunProfile, h as RunRequest, R as RunRunner, p as SOCKET_STATES, S as SocketState, T as ToolNamer, q as buildDoorbellPrompts, r as clearDoorbellStatus, s as doorbellDisabled, t as doorbellStatusAge, u as doorbellStatusPath, v as formatDoorbellStatus, w as invitePrompt, x as isRunProfile, y as knockPrompt, z as mcpToolNamer, A as readDoorbellStatus, C as resolveRunBudgetMs, E as resolveRunProfile, F as wakeInstruction, G as writeDoorbellStatus } from './status-D8qOP4kM.js';
|
|
3
5
|
import { spawn, spawnSync } from 'node:child_process';
|
|
4
6
|
|
|
5
|
-
/** Low-cardinality identity attached to every coding-agent API operation. */
|
|
6
|
-
declare const CODING_AGENTS_CLIENT_IDENTITY: {
|
|
7
|
-
readonly name: "coding_agents";
|
|
8
|
-
readonly version: "0.1.0";
|
|
9
|
-
};
|
|
10
|
-
/** Headers for raw HTTP and WebSocket transports that bypass the SDK. */
|
|
11
|
-
declare const CODING_AGENTS_CLIENT_HEADERS: Readonly<Record<string, string>>;
|
|
12
|
-
|
|
13
7
|
/** Published package version, kept in lockstep with package.json by tests. */
|
|
14
|
-
declare const VERSION = "0.
|
|
8
|
+
declare const VERSION = "0.2.0";
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
apiKey: string;
|
|
18
|
-
apiBase: string;
|
|
19
|
-
timeoutMs?: number;
|
|
20
|
-
}
|
|
21
|
-
declare class WireError extends Error {
|
|
22
|
-
readonly status: number;
|
|
23
|
-
constructor(status: number, detail: string);
|
|
24
|
-
}
|
|
25
|
-
declare function wireRequest(cfg: WireConfig, method: 'GET' | 'POST', pathname: string, body?: unknown): Promise<unknown>;
|
|
26
|
-
/**
|
|
27
|
-
* Minimal self-lookup for an env-var key with no credentials file (so no
|
|
28
|
-
* cached handle). Only the handle is read.
|
|
29
|
-
*/
|
|
30
|
-
declare function getMeLite(cfg: WireConfig): Promise<{
|
|
31
|
-
handle: string;
|
|
32
|
-
} | null>;
|
|
33
|
-
/** Server caps on the tray: `INBOX_TRAY_MAX_LIMIT`. */
|
|
34
|
-
declare const INBOX_MAX_LIMIT = 50;
|
|
10
|
+
type TrayClient = Pick<AgentChatClient, 'inbox'>;
|
|
35
11
|
interface TraySummary {
|
|
36
12
|
/** Conversations with something waiting (cards on the tray). */
|
|
37
13
|
waiting: number;
|
|
@@ -40,37 +16,15 @@ interface TraySummary {
|
|
|
40
16
|
/** More conversations are waiting than one tray shows. */
|
|
41
17
|
truncated: boolean;
|
|
42
18
|
}
|
|
19
|
+
/** How many conversations are waiting, for `status`. One tray page, counted. */
|
|
20
|
+
declare function traySummary(client: TrayClient): Promise<TraySummary>;
|
|
43
21
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
declare function traySummary(cfg: WireConfig): Promise<TraySummary>;
|
|
49
|
-
/**
|
|
50
|
-
* Is anything waiting on the tray? `GET /v1/inbox?wait_ms=0&limit=1` — a
|
|
51
|
-
* count, never a card: the one card the server may return is not read, not
|
|
52
|
-
* kept, not logged. Marks nothing delivered. This is the connect-time question
|
|
53
|
-
* "does this (re)connect deserve a run at all?" — the server re-offers stored
|
|
54
|
-
* envelopes as `message.new` frames right after `hello.ok`, so this is a
|
|
55
|
-
* second opinion that coalesces with them, and the reason a reconnect with an
|
|
56
|
-
* empty tray starts no run.
|
|
57
|
-
*/
|
|
58
|
-
declare function trayHasWaiting(cfg: WireConfig): Promise<boolean>;
|
|
59
|
-
/** A pending group invite, as the doorbell knocks for it: the same four fields the live frame carries. */
|
|
60
|
-
interface PendingInvite {
|
|
61
|
-
readonly inviteId: string;
|
|
62
|
-
readonly groupId: string | null;
|
|
63
|
-
readonly groupName: string | null;
|
|
64
|
-
readonly inviterHandle: string | null;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Pending group invites: `GET /v1/groups/invites`. The server pushes an invite
|
|
68
|
-
* live only (`group.service.ts`) and never re-offers it on reconnect, so an
|
|
69
|
-
* invite that arrived while the socket was down is surfaced by this read on
|
|
70
|
-
* connect — the invoker deduplicates by id, so one seen live is not run twice.
|
|
71
|
-
* Four fields read; descriptions, avatars and member counts are ignored.
|
|
22
|
+
* Is anything waiting on the tray? `GET /v1/inbox?limit=1` — a count, never a
|
|
23
|
+
* card: the one card the server may return is not read. This is the question
|
|
24
|
+
* asked before every wake run: "does this wake deserve a run at all?" — the
|
|
25
|
+
* reason a reconnect with an empty tray starts no run.
|
|
72
26
|
*/
|
|
73
|
-
declare function
|
|
27
|
+
declare function trayHasWaiting(client: TrayClient): Promise<boolean>;
|
|
74
28
|
|
|
75
29
|
declare const DEFAULT_API_BASE = "https://api.agentchat.me";
|
|
76
30
|
declare const CredentialsSchema: z.ZodObject<{
|
|
@@ -170,8 +124,6 @@ declare const MANUAL_FILENAME = "SKILL.md";
|
|
|
170
124
|
declare const MANUAL: string;
|
|
171
125
|
/** The `version:` field of the manual's YAML front matter, or null. */
|
|
172
126
|
declare function manualVersion(text?: string): string | null;
|
|
173
|
-
/** Lockstep check: the identity line this package writes is the one the manual publishes. */
|
|
174
|
-
declare function manualCarriesIdentityLine(text?: string): boolean;
|
|
175
127
|
/**
|
|
176
128
|
* The one pointer line a run prompt ends with. `location` is how THIS runtime
|
|
177
129
|
* reaches the bundled copy (a skill name, a path) — the integration knows that,
|
|
@@ -179,12 +131,10 @@ declare function manualCarriesIdentityLine(text?: string): boolean;
|
|
|
179
131
|
*/
|
|
180
132
|
declare function manualPointer(location: string): string;
|
|
181
133
|
|
|
182
|
-
|
|
183
|
-
declare
|
|
134
|
+
/** The identity line, ready to place, from a served (or cached) texts response. */
|
|
135
|
+
declare function identityLineOf(texts: Pick<Texts, 'identity_line'>): string;
|
|
184
136
|
/** Handles are canonical lowercase on the wire; a leading `@` is display only. */
|
|
185
137
|
declare function normalizeHandle(handle: string): string;
|
|
186
|
-
/** The published identity line with this agent's handle filled in. */
|
|
187
|
-
declare function renderIdentityLine(handle: string): string;
|
|
188
138
|
|
|
189
139
|
/**
|
|
190
140
|
* How ONE integration names itself in user-facing copy.
|
|
@@ -218,8 +168,8 @@ declare function renderDeclinedBlock(copy: HostCopy): string;
|
|
|
218
168
|
|
|
219
169
|
declare const ANCHOR_START = "<!-- agentchat:start -->";
|
|
220
170
|
declare const ANCHOR_END = "<!-- agentchat:end -->";
|
|
221
|
-
/** The identity block: the
|
|
222
|
-
declare function renderAnchorBlock(
|
|
171
|
+
/** The identity block: the served identity line, as fetched for this agent, between the markers. */
|
|
172
|
+
declare function renderAnchorBlock(identityLine: string): string;
|
|
223
173
|
type AnchorAction = 'written' | 'removed' | 'noop';
|
|
224
174
|
/**
|
|
225
175
|
* Upsert `block` into the file at `filePath`, creating it if needed.
|
|
@@ -231,8 +181,8 @@ type AnchorAction = 'written' | 'removed' | 'noop';
|
|
|
231
181
|
declare function writeAnchor(filePath: string, block: string, expectHandle?: string): AnchorAction;
|
|
232
182
|
declare function removeAnchorAt(filePath: string): AnchorAction;
|
|
233
183
|
declare function hasAnchorAt(filePath: string): boolean;
|
|
234
|
-
/** Whether the file's block is exactly the
|
|
235
|
-
declare function anchorIsCurrentAt(filePath: string,
|
|
184
|
+
/** Whether the file's block is exactly the block for this served identity line. */
|
|
185
|
+
declare function anchorIsCurrentAt(filePath: string, identityLine: string): boolean;
|
|
236
186
|
/**
|
|
237
187
|
* The handle a file's anchor block currently CLAIMS, or null if there is no
|
|
238
188
|
* block. Lets an integration catch an anchor that disagrees with its own
|
|
@@ -258,8 +208,12 @@ interface McpProbeResult {
|
|
|
258
208
|
declare function probeHostedMcp(params: {
|
|
259
209
|
apiKey: string;
|
|
260
210
|
apiBase: string;
|
|
261
|
-
|
|
262
|
-
|
|
211
|
+
/** How this integration identifies to the server (headers on the probe). */
|
|
212
|
+
client: IntegrationClient;
|
|
213
|
+
/** MCP `clientInfo.name`; defaults to the runtime name. */
|
|
214
|
+
clientName?: string;
|
|
215
|
+
/** MCP `clientInfo.version`; defaults to the integration's version. */
|
|
216
|
+
clientVersion?: string;
|
|
263
217
|
timeoutMs?: number;
|
|
264
218
|
fetch?: typeof fetch;
|
|
265
219
|
}): Promise<McpProbeResult>;
|
|
@@ -270,6 +224,16 @@ interface DoctorCheck {
|
|
|
270
224
|
verdict: Verdict;
|
|
271
225
|
detail: string;
|
|
272
226
|
}
|
|
227
|
+
/** What the shared `status` hands a host's extra lines: the served identity line it already fetched (one fetch per command). */
|
|
228
|
+
interface StatusContext {
|
|
229
|
+
identityLine: string | null;
|
|
230
|
+
}
|
|
231
|
+
/** What the shared doctor hands a host's extra checks. */
|
|
232
|
+
interface DoctorContext {
|
|
233
|
+
fix?: boolean;
|
|
234
|
+
/** The served identity line for this agent, or null when the server could not be reached and nothing is cached. */
|
|
235
|
+
identityLine: string | null;
|
|
236
|
+
}
|
|
273
237
|
/**
|
|
274
238
|
* Everything the shared identity commands need to know about ONE coding agent.
|
|
275
239
|
*
|
|
@@ -292,14 +256,16 @@ interface HostProfile {
|
|
|
292
256
|
label: string;
|
|
293
257
|
/** Stable machine identifier for `--json`, e.g. `claude-code`. */
|
|
294
258
|
id: string;
|
|
259
|
+
/** How this integration names itself to the server: the texts runtime and its own version. */
|
|
260
|
+
client: IntegrationClient;
|
|
295
261
|
/** THE identity home for this agent. */
|
|
296
262
|
home(): string;
|
|
297
263
|
/** This host's always-loaded instruction file. */
|
|
298
264
|
anchorFile(): string;
|
|
299
265
|
/** Exactly what a user types to reach this integration. */
|
|
300
266
|
invocation(): string;
|
|
301
|
-
/** Render the anchor block body this host wants
|
|
302
|
-
renderAnchor(
|
|
267
|
+
/** Render the anchor block body this host wants from the served identity line (normally `renderAnchorBlock`). */
|
|
268
|
+
renderAnchor(identityLine: string): string;
|
|
303
269
|
/**
|
|
304
270
|
* What to call the anchor in output. Defaults to the instruction file's own
|
|
305
271
|
* basename (`CLAUDE.md`, `AGENTS.md`), which is what a user actually looks
|
|
@@ -313,13 +279,16 @@ interface HostProfile {
|
|
|
313
279
|
*/
|
|
314
280
|
isWired?(): boolean;
|
|
315
281
|
/**
|
|
316
|
-
* Place the
|
|
282
|
+
* Place the integration's texts for a freshly established identity: the
|
|
317
283
|
* identity line, the manual, the hosted tool server with the key, and
|
|
318
284
|
* whatever the key's home is on this runtime. Called after register, login
|
|
319
|
-
* and recover (every time the key changes), and by `doctor --fix`.
|
|
320
|
-
*
|
|
285
|
+
* and recover (every time the key changes), and by `doctor --fix`.
|
|
286
|
+
* `identityLine` is the served line for this agent (fetched just before,
|
|
287
|
+
* or the cached one), or null when neither could be had — the host then
|
|
288
|
+
* leaves the anchor for `doctor --fix` and says so. Returns report lines.
|
|
289
|
+
* When absent, only the anchor is written.
|
|
321
290
|
*/
|
|
322
|
-
place?(handle: string, apiKey: string): string[];
|
|
291
|
+
place?(handle: string, apiKey: string, identityLine: string | null): string[];
|
|
323
292
|
/**
|
|
324
293
|
* Undo `place` for the identity being signed out: remove the key from the
|
|
325
294
|
* tool server registration and anything else that would still authenticate
|
|
@@ -334,9 +303,13 @@ interface HostProfile {
|
|
|
334
303
|
*/
|
|
335
304
|
unplace?(identity: ResolvedIdentity | null): string[];
|
|
336
305
|
/** Host-specific doctor checks, appended after the shared ones. */
|
|
337
|
-
extraDoctorChecks?(
|
|
338
|
-
|
|
339
|
-
|
|
306
|
+
extraDoctorChecks?(context: DoctorContext): DoctorCheck[];
|
|
307
|
+
/**
|
|
308
|
+
* Host-specific `status` lines (placement, probes), printed after the shared
|
|
309
|
+
* ones in text mode. The served identity line comes along so the host does
|
|
310
|
+
* not fetch `/v1/texts` a second time.
|
|
311
|
+
*/
|
|
312
|
+
extraStatus?(context: StatusContext): string[] | Promise<string[]>;
|
|
340
313
|
/** Extra lines printed after a successful logout. */
|
|
341
314
|
logoutHints?(): string[];
|
|
342
315
|
}
|
|
@@ -520,6 +493,15 @@ declare function systemdQuote(value: string): string;
|
|
|
520
493
|
declare function systemdUnit(p: Plan): string;
|
|
521
494
|
declare function xmlEscape(value: string): string;
|
|
522
495
|
declare function launchdPlist(p: Plan): string;
|
|
496
|
+
/** The host as service management sees it. `wsl` is Linux under WSL2 (Windows Startup launcher, not systemd). */
|
|
497
|
+
type ServiceHostOs = 'linux' | 'darwin' | 'win32' | 'wsl' | 'other';
|
|
498
|
+
/**
|
|
499
|
+
* Tests only: pretend to be another host so the Linux and Windows command
|
|
500
|
+
* sequences can be pinned on any CI runner. Paths and the real service
|
|
501
|
+
* manager are never reached: pair it with a fake command runner and
|
|
502
|
+
* `AGENTCHATD_SERVICE_NO_START=1`.
|
|
503
|
+
*/
|
|
504
|
+
declare function setServiceHostOsForTests(hostOs: ServiceHostOs | null): void;
|
|
523
505
|
declare function installService(opts: ServiceOpts): void;
|
|
524
506
|
declare function uninstallService(opts: ServiceRef): void;
|
|
525
507
|
declare function serviceStatus(opts: ServiceRef): string;
|
|
@@ -542,4 +524,4 @@ declare function readJsonFile<T>(filePath: string): T | null;
|
|
|
542
524
|
declare const spawnCommand: typeof spawn;
|
|
543
525
|
declare const spawnCommandSync: typeof spawnSync;
|
|
544
526
|
|
|
545
|
-
export { ANCHOR_END, ANCHOR_START, type AlwaysOnState, type AnchorAction,
|
|
527
|
+
export { ANCHOR_END, ANCHOR_START, type AlwaysOnState, type AnchorAction, type Credentials, DEFAULT_API_BASE, type DoctorCheck, type DoctorContext, type DoctorOpts, HEARTBEAT_FILE, HOSTED_MCP_PATH, type HostCopy, type HostProfile, type IdentityCommands, type IdentityState, IntegrationClient, type LockHandle, MANUAL, MANUAL_FILENAME, MANUAL_SKILL_NAME, MANUAL_URL, type McpProbeResult, type PendingRegistration, type Plan, type RecoverOpts, type RegisterOpts, type ResolvedIdentity, type ServiceCommandRunner, type ServiceHostOs, type ServiceOpts, type ServiceRef, type StatusContext, type TrayClient, type TraySummary, VERSION, type Verdict, acquireLeaderLock, alwaysOnHealth, alwaysOnOptedOut, alwaysOnState, alwaysOnWanted, anchorIsCurrentAt, anchorLabelOf, atomicCopyFile, atomicWriteFile, beat, clearAlwaysOnInstalledVersion, clearAlwaysOnOptOut, clearAlwaysOnWanted, clearCredentials, clearOfferDeclined, clearPending, createIdentityCommands, credentialsPath, hasAnchorAt, hostedMcpUrl, identityLineOf, idle, installService, launchdPlist, log, manualPointer, manualVersion, markAlwaysOnInstalledVersion, markAlwaysOnOptOut, markAlwaysOnWanted, normalizeHandle, offerDeclined, parseServiceHome, pendingPath, planForTest, probeHostedMcp, readAlwaysOnInstalledVersion, readAnchorHandleAt, readAnchorHandleFrom, readCredentials, readJsonFile, readPending, readState, recordOfferDeclined, removeAnchorAt, renderAnchorBlock, renderDeclinedBlock, renderUnregisteredBlock, resolveIdentity, serviceDefinitionCurrent, serviceInstalled, serviceLabelFor, serviceStatus, setServiceCommandRunnerForTests, setServiceHostOsForTests, spawnCommand, spawnCommandSync, statePath, stripAnchorBlock, systemdQuote, systemdUnit, trayHasWaiting, traySummary, uninstallService, upsertAnchorBlock, writeAnchor, writeCredentials, writePending, writeState, xmlEscape };
|