@agentchatme/agent-core 0.7.1 → 0.7.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 +23 -3
- package/dist/{chunk-4PCDVXAR.js → chunk-7TTV2CQX.js} +2 -2
- package/dist/{chunk-4PCDVXAR.js.map → chunk-7TTV2CQX.js.map} +1 -1
- package/dist/{chunk-AQTRC7G4.js → chunk-FPAOQGMV.js} +514 -76
- package/dist/chunk-FPAOQGMV.js.map +1 -0
- package/dist/daemon-entry.d.ts +54 -5
- package/dist/daemon-entry.js +76 -6
- package/dist/daemon-entry.js.map +1 -1
- package/dist/index.d.ts +141 -49
- package/dist/index.js +162 -303
- package/dist/index.js.map +1 -1
- package/dist/presets.js +1 -1
- package/dist/{served-manual-Bg-y_MEy.d.ts → served-manual-CwxBzpwQ.d.ts} +181 -3
- package/package.json +2 -2
- package/dist/chunk-AQTRC7G4.js.map +0 -1
package/dist/presets.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TextsRuntime, AgentChatClientIdentity,
|
|
1
|
+
import { TextsRuntime, AgentChatClientIdentity, Texts, integration, SignupFlow } from 'agentchatme';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
declare const LEASE_RENEW_MS = 10000;
|
|
@@ -107,6 +107,154 @@ declare function clientIdentityOf(client: IntegrationClient): AgentChatClientIde
|
|
|
107
107
|
/** The same identity as headers, for the one raw request this package still makes (the MCP probe). */
|
|
108
108
|
declare function clientHeadersOf(client: IntegrationClient): Record<string, string>;
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Where the manual is when no served texts are in hand: the offline floor for
|
|
112
|
+
* a first install, never the address a run is pointed at while texts are
|
|
113
|
+
* (`servedManualUrl`).
|
|
114
|
+
*/
|
|
115
|
+
declare const MANUAL_URL = "https://agentchat.me/skill.md";
|
|
116
|
+
/** The skill name every runtime sees: `<skills dir>/agentchat/SKILL.md`. */
|
|
117
|
+
declare const MANUAL_SKILL_NAME = "agentchat";
|
|
118
|
+
declare const MANUAL_FILENAME = "SKILL.md";
|
|
119
|
+
/** The bundled copy, byte for byte (the fallback; the served manual is the source). */
|
|
120
|
+
declare const MANUAL: string;
|
|
121
|
+
/**
|
|
122
|
+
* The YAML front matter's top-level `key: value` fields, or null when the text
|
|
123
|
+
* does not open with a front matter block. Deliberately not a YAML parser:
|
|
124
|
+
* the manual's front matter is flat, and nothing here interprets more of a
|
|
125
|
+
* downloaded text than its name and version. A leading byte-order mark and
|
|
126
|
+
* CRLF line endings (a file saved by a Windows editor) read the same as LF.
|
|
127
|
+
*/
|
|
128
|
+
declare function manualFrontMatter(raw: string): ReadonlyMap<string, string> | null;
|
|
129
|
+
/** The `version:` field of the manual's YAML front matter, or null. */
|
|
130
|
+
declare function manualVersion(text?: string): string | null;
|
|
131
|
+
/**
|
|
132
|
+
* Where the served texts say the manual is (`texts.manual.url`), or
|
|
133
|
+
* `MANUAL_URL` when no texts are in hand. Only an address a run can follow
|
|
134
|
+
* counts, under the manual download's own rule: an absolute `https:` URL, or
|
|
135
|
+
* plain `http:` to loopback (a development server). Anything else — another
|
|
136
|
+
* scheme, a relative path, credentials in it, whitespace or a control
|
|
137
|
+
* character in it (more than an address) — reads as none.
|
|
138
|
+
*/
|
|
139
|
+
declare function servedManualUrl(texts: Pick<Texts, 'manual'> | null | undefined): string;
|
|
140
|
+
/**
|
|
141
|
+
* The one pointer line a run prompt ends with. `location` is how THIS runtime
|
|
142
|
+
* reaches its copy of the manual (a skill name, a path) — the integration knows
|
|
143
|
+
* that, this package does not. `url` is where the served texts say the manual
|
|
144
|
+
* is (`servedManualUrl`); `MANUAL_URL` only when none are in hand.
|
|
145
|
+
*/
|
|
146
|
+
declare function manualPointer(location: string, url?: string): string;
|
|
147
|
+
/**
|
|
148
|
+
* The pointer a run prompt ends with, as an integration hands it to the
|
|
149
|
+
* daemon: a function of the manual's address, called for each run with the
|
|
150
|
+
* address the texts in hand announce (`servedManualUrl`), so the line follows
|
|
151
|
+
* the served texts. A plain string is used as it is (an empty one adds
|
|
152
|
+
* nothing).
|
|
153
|
+
*/
|
|
154
|
+
type ManualPointer = string | ((manualUrl: string) => string);
|
|
155
|
+
/** The pointer line for a run, with the manual's address the texts in hand announce. */
|
|
156
|
+
declare function resolveManualPointer(pointer: ManualPointer, texts: Pick<Texts, 'manual'> | null | undefined): string;
|
|
157
|
+
|
|
158
|
+
/** The kit's outcomes (`integration.anchor.FollowOutcome`): `updated`, `unchanged`, `absent`, `setup_offer`, `hand_edited`, `other_agent`, `several_blocks`, `edited_meanwhile`, `failed`. */
|
|
159
|
+
type IdentityAnchorOutcome = Awaited<ReturnType<typeof integration.anchor.follow>>['outcome'];
|
|
160
|
+
interface IdentityAnchorResult {
|
|
161
|
+
readonly outcome: IdentityAnchorOutcome;
|
|
162
|
+
readonly path: string;
|
|
163
|
+
/** The handle the block is AgentChat's for (for `other_agent`, the other agent's); null otherwise. */
|
|
164
|
+
readonly claimed: string | null;
|
|
165
|
+
/** What happened, in words, for the log and the status file — with the repair, where one applies. */
|
|
166
|
+
readonly detail: string;
|
|
167
|
+
}
|
|
168
|
+
interface FollowIdentityAnchorOptions {
|
|
169
|
+
/** The host's always-loaded instruction file. */
|
|
170
|
+
readonly filePath: string;
|
|
171
|
+
/** The agent this daemon serves. */
|
|
172
|
+
readonly handle: string;
|
|
173
|
+
/** The served identity line (`texts.identity_line`). */
|
|
174
|
+
readonly identityLine: string;
|
|
175
|
+
/** The served `identity_line_template`: a block with no handle line whose text is this, filled in, is AgentChat's. */
|
|
176
|
+
readonly template?: string | null;
|
|
177
|
+
/** Test seam: the kit's `beforeWrite` (the new text flushed beside the file, before the file is read again for the rename). */
|
|
178
|
+
readonly beforeWrite?: () => void | Promise<void>;
|
|
179
|
+
}
|
|
180
|
+
/** Decisions in all before a file that keeps changing is left for now (the kit's `FOLLOW_ATTEMPTS`). */
|
|
181
|
+
declare const IDENTITY_ANCHOR_ATTEMPTS: number;
|
|
182
|
+
/**
|
|
183
|
+
* Bring this agent's identity block in `filePath` to the served line: the
|
|
184
|
+
* kit's `follow`, with this package's setup offer recognised and the repair
|
|
185
|
+
* named. Never creates a block (nor the file), never touches one that is not
|
|
186
|
+
* this agent's, and never throws.
|
|
187
|
+
*/
|
|
188
|
+
declare function followIdentityAnchor(options: FollowIdentityAnchorOptions): Promise<IdentityAnchorResult>;
|
|
189
|
+
/** The served line a host's `anchorLoadNote` judges another file's block against (the texts in hand; nulls when none are). */
|
|
190
|
+
interface AnchorServedLine {
|
|
191
|
+
readonly identityLine: string | null;
|
|
192
|
+
readonly template: string | null;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* What a host says when its runtime loads another file in the instruction
|
|
196
|
+
* file's place (`HostProfile.anchorLoadNote`): one clause naming the file
|
|
197
|
+
* the runtime loads, and whether the identity line it gets there is the
|
|
198
|
+
* served one. Said by `status`, `doctor` and every daemon follow; nothing
|
|
199
|
+
* writes that other file.
|
|
200
|
+
*/
|
|
201
|
+
interface AnchorLoadNote {
|
|
202
|
+
/** One clause, naming the file the runtime loads, and what to do when `ok` is false. */
|
|
203
|
+
readonly note: string;
|
|
204
|
+
/**
|
|
205
|
+
* True: the runtime loads the served identity line all the same (from the
|
|
206
|
+
* other file); the note is said, nothing is wrong. False: it loads no
|
|
207
|
+
* identity line, or an older one — never a PASS.
|
|
208
|
+
*/
|
|
209
|
+
readonly ok: boolean;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* - `current` — this agent's block, the served one (`checked: false`: no usable served line in hand to compare with);
|
|
213
|
+
* - `stale` — this agent's block, older text or an older shape;
|
|
214
|
+
* - `missing` — no file, or no AgentChat block in it;
|
|
215
|
+
* - `setup_offer`, `hand_edited`, `other_agent`, `several_blocks` — as the follow says;
|
|
216
|
+
* - `unreadable` — the file exists but cannot be read (permissions, a symlink loop, not UTF-8).
|
|
217
|
+
*/
|
|
218
|
+
type IdentityBlockStateName = 'current' | 'stale' | 'missing' | 'setup_offer' | 'hand_edited' | 'other_agent' | 'several_blocks' | 'unreadable';
|
|
219
|
+
interface IdentityBlockState {
|
|
220
|
+
readonly state: IdentityBlockStateName;
|
|
221
|
+
/** `doctor`'s verdict: PASS only for the served block where the runtime loads it; FAIL when the file cannot be read; WARN otherwise. */
|
|
222
|
+
readonly verdict: 'PASS' | 'WARN' | 'FAIL';
|
|
223
|
+
/** A usable served line was in hand, so currency was compared (false: `current` means this agent's block, unchecked). */
|
|
224
|
+
readonly checked: boolean;
|
|
225
|
+
/** The handle the block is AgentChat's for (the kit's `owner`), or null. */
|
|
226
|
+
readonly claimed: string | null;
|
|
227
|
+
/** What the host says about the file its runtime loads instead (`anchorLoadNote`), or null when it loads this one. */
|
|
228
|
+
readonly loadNote: AnchorLoadNote | null;
|
|
229
|
+
/** That note when the runtime does not get the served line (`loadNote.ok` false), else null: what `status --json` carries as `anchor_not_loaded`. */
|
|
230
|
+
readonly notLoaded: string | null;
|
|
231
|
+
/** What the block is, in one clause, naming the file (no repair: `describeIdentityBlock` adds it). */
|
|
232
|
+
readonly what: string;
|
|
233
|
+
}
|
|
234
|
+
interface IdentityBlockStateOptions {
|
|
235
|
+
readonly handle: string;
|
|
236
|
+
readonly identityLine: string | null;
|
|
237
|
+
readonly template: string | null;
|
|
238
|
+
/** The host's note on the file its runtime loads instead (`anchorLoadNote`); null when it loads this one. */
|
|
239
|
+
readonly loadNote?: AnchorLoadNote | null;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* What the block in `filePath` is, read the way the daemon decides (the
|
|
243
|
+
* kit's `decide`; its `owner` when no usable served line is in hand), for
|
|
244
|
+
* `status` and `doctor`. Never throws: a file that cannot be read is
|
|
245
|
+
* `unreadable`.
|
|
246
|
+
*/
|
|
247
|
+
declare function identityBlockState(filePath: string, options: IdentityBlockStateOptions): IdentityBlockState;
|
|
248
|
+
/**
|
|
249
|
+
* The one sentence `status` and `doctor` say about the block: what it is,
|
|
250
|
+
* the repair (`fix`: the command that places the served block, e.g.
|
|
251
|
+
* `npx -y @agentchatme/example doctor --fix`), and the host's note on the
|
|
252
|
+
* file its runtime loads instead, when there is one. The repair is said only
|
|
253
|
+
* where it changes something: not for the served block, nor for a file it
|
|
254
|
+
* cannot read.
|
|
255
|
+
*/
|
|
256
|
+
declare function describeIdentityBlock(state: IdentityBlockState, fix: string): string;
|
|
257
|
+
|
|
110
258
|
declare const INTEGRATION_STATUS_FILE = "integration.status.json";
|
|
111
259
|
/** The file a daemon before the rename writes; read when the current one is absent. */
|
|
112
260
|
declare const LEGACY_STATUS_FILE = "doorbell.status.json";
|
|
@@ -214,6 +362,28 @@ interface IntegrationStatus {
|
|
|
214
362
|
last_ok_run_at?: string | null;
|
|
215
363
|
/** Could not process: the kit's reports and the server's answers, and the conversations paused for this agent. Null or absent from an older daemon. */
|
|
216
364
|
could_not_process?: IntegrationCouldNotProcess | null;
|
|
365
|
+
/**
|
|
366
|
+
* What the daemon last did with the identity block in the host's
|
|
367
|
+
* instruction file when the served texts changed (`followIdentityAnchor`).
|
|
368
|
+
* Null or absent when the daemon is not given one (the CLI places none),
|
|
369
|
+
* before the first texts, or from an older daemon.
|
|
370
|
+
*/
|
|
371
|
+
identity_line?: IntegrationIdentityLine | null;
|
|
372
|
+
}
|
|
373
|
+
/** The identity block's last follow of the served identity line. */
|
|
374
|
+
interface IntegrationIdentityLine {
|
|
375
|
+
/** `updated`, `unchanged`, `absent`, `setup_offer`, `hand_edited`, `other_agent`, `several_blocks`, `edited_meanwhile` or `failed` (`IdentityAnchorOutcome`). */
|
|
376
|
+
readonly outcome: string;
|
|
377
|
+
/** The instruction file. */
|
|
378
|
+
readonly path: string;
|
|
379
|
+
/** When it was done. */
|
|
380
|
+
readonly at: string;
|
|
381
|
+
/** The served text set's version it followed. */
|
|
382
|
+
readonly texts_version: string;
|
|
383
|
+
/** What happened, in words. */
|
|
384
|
+
readonly detail: string;
|
|
385
|
+
/** Why the runtime does not load the file now (a file it reads in its place), or null; absent from a file an older daemon wrote. */
|
|
386
|
+
readonly not_loaded?: string | null;
|
|
217
387
|
}
|
|
218
388
|
/** A conversation paused for this agent (the server's 24 h mute, source `could_not_process`). */
|
|
219
389
|
interface IntegrationPausedConversation {
|
|
@@ -352,7 +522,6 @@ declare function describeCouldNotProcessCounts(c: IntegrationCouldNotProcess, no
|
|
|
352
522
|
declare function runtimeCheckFailingNow(status: Pick<IntegrationStatus, 'could_not_process' | 'last_ok_run_at'> | null): boolean;
|
|
353
523
|
/** Runs in a row that did not get done, when that is a pattern (`REPEATED_FAILED_CYCLES` or more) and no runtime reason explains it; null otherwise. */
|
|
354
524
|
declare function repeatedFailedRuns(status: Pick<IntegrationStatus, 'failed_runs_in_a_row' | 'runs_failing' | 'unservable'> | null): number | null;
|
|
355
|
-
/** Human lines for `status`. Pure. */
|
|
356
525
|
declare function formatIntegrationStatus(status: IntegrationStatus | null, now?: number): string[];
|
|
357
526
|
|
|
358
527
|
declare const DEFAULT_API_BASE = "https://api.agentchat.me";
|
|
@@ -494,6 +663,15 @@ interface HostProfile {
|
|
|
494
663
|
* owner's command): no identity line is placed, checked or removed.
|
|
495
664
|
*/
|
|
496
665
|
anchorFile?(): string;
|
|
666
|
+
/**
|
|
667
|
+
* For a runtime that reads another file in `anchorFile()`'s place when
|
|
668
|
+
* that one exists: which file it loads now, and whether the identity line
|
|
669
|
+
* it gets there is the served one (`served`, the texts in hand), or null
|
|
670
|
+
* when it loads `anchorFile()`. `status` and `doctor` say it (never a PASS
|
|
671
|
+
* when `ok` is false), and the daemon's follow of the identity line says
|
|
672
|
+
* it too. Nothing writes into that other file: it is the user's.
|
|
673
|
+
*/
|
|
674
|
+
anchorLoadNote?(handle: string, served: AnchorServedLine): AnchorLoadNote | null;
|
|
497
675
|
/** Exactly what a user types to reach this integration. */
|
|
498
676
|
invocation(): string;
|
|
499
677
|
/**
|
|
@@ -621,4 +799,4 @@ interface CheckManualOptions {
|
|
|
621
799
|
/** Compare the skill file with the announced manual. Reads one file; no network. */
|
|
622
800
|
declare function checkManual(options: CheckManualOptions): ManualCheck;
|
|
623
801
|
|
|
624
|
-
export {
|
|
802
|
+
export { type ResolvedIdentity as $, type AnchorServedLine as A, LEASE_RENEW_MS as B, type CheckManualOptions as C, DEFAULT_API_BASE as D, LEASE_STALE_MS as E, FAILED_CYCLE_OUTCOMES as F, LEGACY_STATUS_FILE as G, type HostProfile as H, type IntegrationClient as I, MANUAL as J, MANUAL_FETCH_TIMEOUT_MS as K, type LeaseOptions as L, type ManualPointer as M, MANUAL_FILENAME as N, MANUAL_MAX_BYTES as O, MANUAL_MAX_REDIRECTS as P, MANUAL_SKILL_NAME as Q, MANUAL_URL as R, type SocketState as S, type ManualCheck as T, type ManualCheckState as U, type ManualSyncResult as V, type ManualSyncState as W, type PendingRegistration as X, type PendingSignup as Y, REPEATED_FAILED_CYCLES as Z, type ResolveIdentityOptions as _, type AnchorLoadNote as a, SOCKET_STATES as a0, type ServedManual as a1, type StatusContext as a2, type SyncManualOptions as a3, type TextsStatus as a4, type Verdict as a5, acquireLease as a6, anchorLabelOf as a7, bootedAt as a8, checkManual as a9, manualVersion as aA, parseLease as aB, pendingPath as aC, pidAlive as aD, readCredentials as aE, readIntegrationStatus as aF, readManualVersion as aG, readPending as aH, repeatedFailedRuns as aI, resetLeaseObservations as aJ, resolveIdentity as aK, resolveManualPointer as aL, runtimeCheckFailingNow as aM, servedManualUrl as aN, statePath as aO, syncManual as aP, writeCredentials as aQ, writeIntegrationStatus as aR, writePending as aS, clearCredentials as aa, clearIntegrationStatus as ab, clearPending as ac, clientHeadersOf as ad, clientIdentityOf as ae, clientNameOf as af, credentialsPath as ag, describeCouldNotProcessCounts as ah, describeIdentityBlock as ai, describeManualSync as aj, describePausedConversations as ak, envApiKey as al, envKeyConflict as am, failedCyclesInARow as an, followIdentityAnchor as ao, formatIntegrationStatus as ap, fromKitResult as aq, holderLive as ar, identityBlockState as as, integrationStatusAge as at, integrationStatusFresh as au, integrationStatusPath as av, integrationStatusStaleFor as aw, leaseHolder as ax, manualFrontMatter as ay, manualPointer as az, type ManualFetch as b, type IntegrationStatus as c, type IntegrationRunsFailing as d, type Lease as e, type LeaseAttempt as f, type LeaseHolder as g, type Credentials as h, type DoctorCheck as i, type DoctorContext as j, type FollowIdentityAnchorOptions as k, IDENTITY_ANCHOR_ATTEMPTS as l, INTEGRATION_STATUS_FILE as m, INTEGRATION_STATUS_STALE_MS as n, type IdentityAnchorOutcome as o, type IdentityAnchorResult as p, type IdentityBlockState as q, type IdentityBlockStateName as r, type IdentityBlockStateOptions as s, type IntegrationCouldNotProcess as t, type IntegrationCycle as u, type IntegrationIdentityLine as v, type IntegrationLastRun as w, type IntegrationPausedConversation as x, type IntegrationStandby as y, type IntegrationUnservable as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentchatme/agent-core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Shared host-agnostic engine for AgentChat integrations — the resident supervisor on the AgentChat SDK's integration kit (single-run mode: the socket acking on receipt, wakes, the tray before every run), the runner seam and spawnRun, the presets for known coding agents' headless runs, identity storage and flows, service plumbing. Runtime code only; every function takes an identity home, none resolves one.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"prepare": "pnpm run build"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"agentchatme": "^1.
|
|
45
|
+
"agentchatme": "^1.8.0",
|
|
46
46
|
"cross-spawn": "^7.0.6",
|
|
47
47
|
"ws": "^8.18.0",
|
|
48
48
|
"zod": "^3.23.0"
|