@agentchatme/agent-core 0.7.3 → 0.8.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 +73 -3
- package/dist/{chunk-FPAOQGMV.js → chunk-6GMYBMID.js} +869 -197
- package/dist/chunk-6GMYBMID.js.map +1 -0
- package/dist/{chunk-5KMQ23O6.js → chunk-LPTOKVEE.js} +17 -2
- package/dist/chunk-LPTOKVEE.js.map +1 -0
- package/dist/{chunk-7TTV2CQX.js → chunk-WYBLSTYB.js} +3 -3
- package/dist/{chunk-7TTV2CQX.js.map → chunk-WYBLSTYB.js.map} +1 -1
- package/dist/daemon-entry.d.ts +28 -2
- package/dist/daemon-entry.js +121 -39
- package/dist/daemon-entry.js.map +1 -1
- package/dist/index.d.ts +297 -10
- package/dist/index.js +451 -124
- package/dist/index.js.map +1 -1
- package/dist/{served-manual-CwxBzpwQ.d.ts → listener-report-V3oMkCj2.d.ts} +622 -397
- package/dist/presets.js +3 -3
- package/dist/presets.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-5KMQ23O6.js.map +0 -1
- package/dist/chunk-FPAOQGMV.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,186 @@
|
|
|
1
|
-
import { I as IntegrationClient, H as HostProfile,
|
|
2
|
-
export { a as AnchorLoadNote, A as AnchorServedLine,
|
|
3
|
-
import { AgentChatClient, Texts, TextsRuntime, integration } from 'agentchatme';
|
|
1
|
+
import { P as PendingSignup, i as ListenerEnsure, j as PlacementProblem, I as IntegrationClient, H as HostProfile, k as Lease, L as LeaseOptions, l as LeaseAttempt, m as LeaseHolder } from './listener-report-V3oMkCj2.js';
|
|
2
|
+
export { a as AnchorLoadNote, A as AnchorServedLine, n as CheckManualOptions, o as Credentials, D as DEFAULT_API_BASE, p as DoctorCheck, q as DoctorContext, F as FAILED_CYCLE_OUTCOMES, r as FollowIdentityAnchorOptions, s as HOST_FILE, t as IDENTITY_ANCHOR_ATTEMPTS, u as INSTALL_ID_FILE, v as INTEGRATION_STATUS_FILE, w as INTEGRATION_STATUS_STALE_MS, x as IdentityAnchorOutcome, y as IdentityAnchorResult, z as IdentityBlockState, B as IdentityBlockStateName, E as IdentityBlockStateOptions, G as IntegrationCouldNotProcess, J as IntegrationCycle, K as IntegrationIdentityLine, N as IntegrationLastRun, O as IntegrationListenerReport, Q as IntegrationPausedConversation, f as IntegrationRunsFailing, R as IntegrationStandby, d as IntegrationStatus, T as IntegrationUnservable, U as LEASE_RENEW_MS, V as LEASE_STALE_MS, W as LEGACY_STATUS_FILE, X as LISTENER_ID_FILE, Y as ListenerStoppedResult, Z as MANUAL, _ as MANUAL_FETCH_TIMEOUT_MS, $ as MANUAL_FILENAME, a0 as MANUAL_MAX_BYTES, a1 as MANUAL_MAX_REDIRECTS, a2 as MANUAL_SKILL_NAME, a3 as MANUAL_URL, a4 as ManualCheck, a5 as ManualCheckState, c as ManualFetch, M as ManualPointer, a6 as ManualSyncResult, a7 as ManualSyncState, a8 as PendingRegistration, a9 as PlacementOutput, aa as PlacementReport, ab as REPEATED_FAILED_CYCLES, ac as ReportListenerStoppedOptions, ad as ResolveIdentityOptions, ae as ResolvedIdentity, af as SOCKET_STATES, ag as STOPPED_REPORT_TIMEOUT_MS, ah as ServedManual, S as SocketState, ai as StatusContext, aj as SyncManualOptions, ak as TextsStatus, al as Verdict, am as acquireLease, an as anchorLabelOf, ao as bootedAt, ap as checkManual, aq as clearCredentials, ar as clearInstallId, as as clearIntegrationStatus, at as clearPending, au as clientHeadersOf, av as clientIdentityOf, aw as clientNameOf, ax as credentialsPath, ay as describeCouldNotProcessCounts, az as describeIdentityBlock, aA as describeListenerStopped, aB as describeManualSync, aC as describePausedConversations, aD as ensureInstallId, aE as envApiKey, aF as envKeyConflict, aG as failedCyclesInARow, aH as followIdentityAnchor, aI as formatIntegrationStatus, aJ as fromKitResult, aK as holderLive, aL as hostIdentityOf, aM as identityBlockState, aN as installIdPath, aO as installMethodOf, aP as integrationStatusAge, aQ as integrationStatusFresh, aR as integrationStatusPath, aS as integrationStatusStaleFor, aT as leaseHolder, aU as listenerIdPath, aV as manualFrontMatter, aW as manualPointer, aX as manualVersion, aY as newInstallId, aZ as parseLease, a_ as pendingPath, a$ as pidAlive, b0 as placementReportOf, b1 as readCredentials, b2 as readInstallId, b3 as readIntegrationStatus, b4 as readListenerInstanceId, b5 as readManualVersion, b6 as readPending, b7 as readRememberedHost, b8 as rememberHost, b9 as repeatedFailedRuns, ba as reportListenerStopped, bb as resetLeaseObservations, bc as resolveIdentity, bd as resolveManualPointer, be as runtimeCheckFailingNow, bf as servedManualUrl, bg as statePath, bh as syncManual, bi as writeCredentials, bj as writeIntegrationStatus, bk as writePending } from './listener-report-V3oMkCj2.js';
|
|
3
|
+
import { AgentChatClient, Texts, TextsRuntime, integration, AgentChatClientIdentity } from 'agentchatme';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { g as RunRequest } from './runner-BLvFalN4.js';
|
|
6
6
|
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, 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-BLvFalN4.js';
|
|
7
7
|
import { spawn, spawnSync } from 'node:child_process';
|
|
8
8
|
|
|
9
|
+
/** A listener registered, or a key saved, this recently is still coming up: not "down". The daemon follows a credential within 5 s; a service manager's cold start can take far longer than that. */
|
|
10
|
+
declare const SETUP_GRACE_MS = 90000;
|
|
11
|
+
declare const SETUP_STATES: readonly ["no_account", "code_pending", "code_expired", "key_refused", "suspended", "unreachable", "paused", "tools_missing", "listener_off", "listener_missing", "listener_down", "listener_starting", "listener_failing", "ready"];
|
|
12
|
+
type SetupState = (typeof SETUP_STATES)[number];
|
|
13
|
+
interface SetupVerdict {
|
|
14
|
+
readonly state: SetupState;
|
|
15
|
+
/** What is the case and what to do, in plain words with the exact command: the text after `Setup: <state> — `. */
|
|
16
|
+
readonly next: string;
|
|
17
|
+
/** The exact command to run next, or null (done, or the next step is the person's). */
|
|
18
|
+
readonly command: string | null;
|
|
19
|
+
/** Only the person can do the next step (sign the runtime in, turn the listener back on, …). */
|
|
20
|
+
readonly needs_person: boolean;
|
|
21
|
+
/** What to ask the person, in plain words; null when there is nothing to ask. Also set when the person may be needed (the emailed code, when the inbox is not yours to read). */
|
|
22
|
+
readonly ask: string | null;
|
|
23
|
+
/** The facts behind it, as found: the listener's own error, the server's words, a note. Null when none. */
|
|
24
|
+
readonly detail: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* One word for why, within the state (`^[a-z][a-z0-9_]{0,31}$`): the
|
|
27
|
+
* runtime's reason kind (`not_signed_in`, `runtime_missing`, …),
|
|
28
|
+
* `opted_out`, `standby`, `older_listener`, `not_seen`, …; null when the
|
|
29
|
+
* state says it all. What setup telemetry sends beside the state.
|
|
30
|
+
*/
|
|
31
|
+
readonly reason: string | null;
|
|
32
|
+
}
|
|
33
|
+
/** The verdict in one line. */
|
|
34
|
+
declare function formatSetupVerdict(verdict: SetupVerdict): string;
|
|
35
|
+
/** `reachability` as far as the verdict reads it (contract v1 §3.12). Unknown states and fields are kept as words or ignored. */
|
|
36
|
+
interface ReachabilityView {
|
|
37
|
+
readonly state: string;
|
|
38
|
+
readonly via: string | null;
|
|
39
|
+
readonly problemKind: string | null;
|
|
40
|
+
readonly problemText: string | null;
|
|
41
|
+
readonly text: string | null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The `reachability` a `GET /v1/agents/me` answer carries, or null: absent
|
|
45
|
+
* (a server before it, or one that could not read it), or not in a shape
|
|
46
|
+
* this release reads. Never required.
|
|
47
|
+
*/
|
|
48
|
+
declare function reachabilityOf(me: unknown): ReachabilityView | null;
|
|
49
|
+
/** The server's answer to `GET /v1/agents/me`, for the verdict. */
|
|
50
|
+
type ServerView = {
|
|
51
|
+
readonly kind: 'ok';
|
|
52
|
+
readonly handle: string;
|
|
53
|
+
readonly reachability: ReachabilityView | null;
|
|
54
|
+
} | {
|
|
55
|
+
readonly kind: 'refused';
|
|
56
|
+
readonly detail: string;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: 'suspended';
|
|
59
|
+
readonly detail: string;
|
|
60
|
+
} | {
|
|
61
|
+
readonly kind: 'unreachable';
|
|
62
|
+
readonly detail: string;
|
|
63
|
+
};
|
|
64
|
+
/** What the listener's daemon last said for the current credential. */
|
|
65
|
+
type DaemonWord =
|
|
66
|
+
/** Nothing for this credential: no status, one written before the key was saved, or one too old with no daemon alive. */
|
|
67
|
+
{
|
|
68
|
+
readonly kind: 'none';
|
|
69
|
+
}
|
|
70
|
+
/** Installed with the integration switched off (`AGENTCHAT_INTEGRATION=off`): no socket, no run. */
|
|
71
|
+
| {
|
|
72
|
+
readonly kind: 'off';
|
|
73
|
+
} | {
|
|
74
|
+
readonly kind: 'ready';
|
|
75
|
+
readonly runsFailing: {
|
|
76
|
+
readonly reason: string;
|
|
77
|
+
readonly since: string;
|
|
78
|
+
} | null;
|
|
79
|
+
readonly runtimeCheckFailing: boolean;
|
|
80
|
+
} | {
|
|
81
|
+
readonly kind: 'standby';
|
|
82
|
+
readonly home: string | null;
|
|
83
|
+
readonly pid: number | null;
|
|
84
|
+
} | {
|
|
85
|
+
readonly kind: 'unservable';
|
|
86
|
+
readonly reason: 'key_refused' | 'runs_failing';
|
|
87
|
+
readonly detail: string;
|
|
88
|
+
}
|
|
89
|
+
/** It could not start: the runtime is not ready, the server could not be asked, … (`last_error`). */
|
|
90
|
+
| {
|
|
91
|
+
readonly kind: 'start_failure';
|
|
92
|
+
readonly detail: string;
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: 'blocked';
|
|
95
|
+
readonly detail: string | null;
|
|
96
|
+
} | {
|
|
97
|
+
readonly kind: 'connecting';
|
|
98
|
+
};
|
|
99
|
+
interface ListenerReading {
|
|
100
|
+
/** The person switched it off (`daemon disable`, `uninstall`). */
|
|
101
|
+
readonly optedOut: boolean;
|
|
102
|
+
/** A service was registered for this home (`always-on.wanted`). */
|
|
103
|
+
readonly wanted: boolean;
|
|
104
|
+
/** The release the registered service runs, or null when not recorded. */
|
|
105
|
+
readonly installedVersion: string | null;
|
|
106
|
+
readonly daemon: DaemonWord;
|
|
107
|
+
/** A daemon process holds this home's lease now (renewed every 10 s). */
|
|
108
|
+
readonly alive: boolean;
|
|
109
|
+
/** Registered or signed in within `SETUP_GRACE_MS`. */
|
|
110
|
+
readonly withinGrace: boolean;
|
|
111
|
+
/** When the daemon last wrote its status, or null. */
|
|
112
|
+
readonly lastAliveAt: string | null;
|
|
113
|
+
}
|
|
114
|
+
interface ReadListenerOptions {
|
|
115
|
+
readonly now?: number;
|
|
116
|
+
/**
|
|
117
|
+
* The daemon process that held this home's lease before a command
|
|
118
|
+
* registered the service again (`daemonPidOf`, read just before): what it
|
|
119
|
+
* wrote is not the new process's word, however recent.
|
|
120
|
+
*/
|
|
121
|
+
readonly replacedPid?: number | null;
|
|
122
|
+
}
|
|
123
|
+
/** The pid of the daemon that holds this home's lease now, or null. */
|
|
124
|
+
declare function daemonPidOf(home: string): number | null;
|
|
125
|
+
/**
|
|
126
|
+
* The listener as its own files say it, for `handle`: the always-on markers,
|
|
127
|
+
* the daemon's status file (only when it was written for the credential the
|
|
128
|
+
* home holds now and names this handle), and the home's lease (a daemon
|
|
129
|
+
* process alive: its status is written once while it keeps failing to
|
|
130
|
+
* start, so an old file is not proof it is gone; and a "ready" from a process
|
|
131
|
+
* that is gone is not one). Pure reads; never throws.
|
|
132
|
+
*/
|
|
133
|
+
declare function readListener(home: string, handle: string | null, options?: ReadListenerOptions): ListenerReading;
|
|
134
|
+
/**
|
|
135
|
+
* Why a listener cannot start runs, in the server's words for it (contract
|
|
136
|
+
* v1 §3.13 `reason_kind`): what the verdict says to the agent, and what a
|
|
137
|
+
* listener report sends. Read from the runtime check's own words, which the
|
|
138
|
+
* presets in this package write (`claude is not signed in …`, `codex login
|
|
139
|
+
* status failed: …`, `… not found on PATH …`, `…; AgentChat requires … >= …`).
|
|
140
|
+
*/
|
|
141
|
+
type ListenerReasonKind = 'not_signed_in' | 'runtime_missing' | 'runtime_outdated' | 'runtime_check_failed' | 'other';
|
|
142
|
+
declare function listenerReasonKindOf(detail: string): ListenerReasonKind;
|
|
143
|
+
interface SetupInputs {
|
|
144
|
+
/** What a user types to reach this integration. */
|
|
145
|
+
readonly invocation: string;
|
|
146
|
+
/** The runtime's name for people (`Claude Code`). */
|
|
147
|
+
readonly label: string;
|
|
148
|
+
/** This build's version: a registered service from an older one is noted. */
|
|
149
|
+
readonly version: string;
|
|
150
|
+
/** The identity home (named when the key is only in the environment). */
|
|
151
|
+
readonly home: string;
|
|
152
|
+
/** The identity the home names now, or null. */
|
|
153
|
+
readonly identity: {
|
|
154
|
+
readonly handle: string | null;
|
|
155
|
+
readonly source: 'file' | 'env';
|
|
156
|
+
} | null;
|
|
157
|
+
readonly pending: PendingSignup | null;
|
|
158
|
+
/** The server's answer; null when it was not asked (no identity). */
|
|
159
|
+
readonly server: ServerView | null;
|
|
160
|
+
/** The listener; null for a host that places none (the verdict then stops at the account). */
|
|
161
|
+
readonly listener: ListenerReading | null;
|
|
162
|
+
/** What this command's `ensureListener` did, if it ran. */
|
|
163
|
+
readonly ensure?: ListenerEnsure | null;
|
|
164
|
+
/** A placement problem that keeps runs from having the AgentChat tools. */
|
|
165
|
+
readonly tools?: PlacementProblem | null;
|
|
166
|
+
/** Said right after a sign-in: the ready text ends with the one thing to tell the person. */
|
|
167
|
+
readonly afterSignIn?: boolean;
|
|
168
|
+
readonly now?: number;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Whether release `a` is newer than `b` (`x.y.z`, slot by slot, numerically);
|
|
172
|
+
* false when either cannot be read. What the verdict calls an older listener,
|
|
173
|
+
* and what a host's implicit ensure never replaces (no downgrade).
|
|
174
|
+
*/
|
|
175
|
+
declare function newerRelease(a: string | null, b: string | null): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* The setup verdict from plain inputs; null when there is nothing this host
|
|
178
|
+
* can judge (no listener of its own, and the account is fine).
|
|
179
|
+
*/
|
|
180
|
+
declare function setupVerdict(i: SetupInputs): SetupVerdict | null;
|
|
181
|
+
|
|
9
182
|
/** Published package version, kept in lockstep with package.json by tests. */
|
|
10
|
-
declare const VERSION = "0.
|
|
183
|
+
declare const VERSION = "0.8.0";
|
|
11
184
|
|
|
12
185
|
type TrayClient = Pick<AgentChatClient, 'inbox'>;
|
|
13
186
|
interface TraySummary {
|
|
@@ -118,9 +291,12 @@ interface HostCopy {
|
|
|
118
291
|
*
|
|
119
292
|
* It names the commands and nothing of the server's: no handle rules, no
|
|
120
293
|
* code length, no scripted answer for a failure. Each command prints the
|
|
121
|
-
* server's sentence and the command to run next, and
|
|
122
|
-
*
|
|
123
|
-
*
|
|
294
|
+
* server's sentence and the command to run next, and ends with the setup
|
|
295
|
+
* verdict (`Setup: <state> — …`: done, the exact next command, or the one
|
|
296
|
+
* thing to ask the person), so a rule that moves on the server never leaves a
|
|
297
|
+
* stale copy in every instruction file. An existing key goes in through a
|
|
298
|
+
* file on stdin (`login --api-key - < <file>`): never into the conversation,
|
|
299
|
+
* never on a command line.
|
|
124
300
|
*/
|
|
125
301
|
declare function renderUnregisteredBlock(copy: HostCopy): string;
|
|
126
302
|
/**
|
|
@@ -380,6 +556,104 @@ declare class PausedConversations {
|
|
|
380
556
|
private persist;
|
|
381
557
|
}
|
|
382
558
|
|
|
559
|
+
declare const TELEMETRY_ENV = "AGENTCHAT_TELEMETRY";
|
|
560
|
+
declare const TELEMETRY_PATH = "/v1/telemetry";
|
|
561
|
+
declare const TELEMETRY_VERSION: 1;
|
|
562
|
+
/** The most a command waits for its event to be taken. */
|
|
563
|
+
declare const TELEMETRY_TIMEOUT_MS = 1500;
|
|
564
|
+
/** The commands a `setup_verdict` names (the server's closed list). */
|
|
565
|
+
type SetupCommand = 'install' | 'register' | 'login' | 'recover' | 'doctor' | 'status' | 'uninstall' | 'daemon' | 'other';
|
|
566
|
+
interface SetupVerdictEvent {
|
|
567
|
+
readonly name: 'setup_verdict';
|
|
568
|
+
readonly at: string;
|
|
569
|
+
readonly props: {
|
|
570
|
+
readonly state: string;
|
|
571
|
+
readonly command: SetupCommand;
|
|
572
|
+
readonly needs_person: boolean;
|
|
573
|
+
readonly reason?: string;
|
|
574
|
+
readonly exit_code: number;
|
|
575
|
+
readonly duration_ms: number;
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
interface TelemetryBody {
|
|
579
|
+
readonly version: typeof TELEMETRY_VERSION;
|
|
580
|
+
readonly events: readonly SetupVerdictEvent[];
|
|
581
|
+
}
|
|
582
|
+
/** One request, as a sender gets it. */
|
|
583
|
+
interface TelemetryRequest {
|
|
584
|
+
readonly apiBase: string;
|
|
585
|
+
/** The identity's key, or null: the event is then anonymous (the install id names it). */
|
|
586
|
+
readonly apiKey: string | null;
|
|
587
|
+
/** What the request names itself with (the SDK turns it into the client headers and X-AgentChat-Platform). */
|
|
588
|
+
readonly clientIdentity: AgentChatClientIdentity;
|
|
589
|
+
readonly body: TelemetryBody;
|
|
590
|
+
/** Aborted when the time is up. */
|
|
591
|
+
readonly signal: AbortSignal;
|
|
592
|
+
}
|
|
593
|
+
/** Sends one request; may throw (the caller swallows it). */
|
|
594
|
+
type TelemetrySender = (request: TelemetryRequest) => Promise<void>;
|
|
595
|
+
/** `AGENTCHAT_TELEMETRY` set to `off`, `0` or `false` (any case). */
|
|
596
|
+
declare function telemetryOff(env?: NodeJS.ProcessEnv): boolean;
|
|
597
|
+
/** The event for a verdict a command said. */
|
|
598
|
+
declare function setupVerdictEvent(verdict: SetupVerdict, facts: {
|
|
599
|
+
command: SetupCommand;
|
|
600
|
+
exitCode: number;
|
|
601
|
+
startedAt: number;
|
|
602
|
+
now?: number;
|
|
603
|
+
}): SetupVerdictEvent;
|
|
604
|
+
/**
|
|
605
|
+
* The network sender: one attempt through the SDK's transport, so the request
|
|
606
|
+
* carries exactly the headers every SDK call does (no copy of them here).
|
|
607
|
+
*/
|
|
608
|
+
declare const httpTelemetrySender: TelemetrySender;
|
|
609
|
+
interface SendSetupVerdictOptions {
|
|
610
|
+
readonly command: SetupCommand;
|
|
611
|
+
readonly exitCode: number;
|
|
612
|
+
readonly startedAt: number;
|
|
613
|
+
readonly apiBase: string;
|
|
614
|
+
readonly apiKey: string | null;
|
|
615
|
+
readonly clientIdentity: AgentChatClientIdentity;
|
|
616
|
+
/** Default: the network (`httpTelemetrySender`), or nothing at all under AGENTCHAT_SERVICE_DRY_RUN. */
|
|
617
|
+
readonly sender?: TelemetrySender;
|
|
618
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
619
|
+
readonly timeoutMs?: number;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Tell AgentChat what a command said. Resolves within the timeout whatever
|
|
623
|
+
* happens; never throws, never prints. Nothing is sent when telemetry is
|
|
624
|
+
* off, or when there is neither an install id nor a key to name the sender.
|
|
625
|
+
*/
|
|
626
|
+
declare function sendSetupVerdict(verdict: SetupVerdict, opts: SendSetupVerdictOptions): Promise<void>;
|
|
627
|
+
|
|
628
|
+
/** How long an account command waits for the listener to connect: the daemon follows a new key within 5 s, then checks its runtime and opens the socket. */
|
|
629
|
+
declare const SETUP_WAIT_MS = 30000;
|
|
630
|
+
/** Test seams for `createIdentityCommands`. */
|
|
631
|
+
interface IdentityCommandOptions {
|
|
632
|
+
/** How long account commands wait for the listener to connect (default `SETUP_WAIT_MS`). */
|
|
633
|
+
setupWaitMs?: number;
|
|
634
|
+
/** How often the wait looks (default 500 ms). */
|
|
635
|
+
setupPollMs?: number;
|
|
636
|
+
/** Whether no service manager is used, so no listener will start and nothing is waited for (default: `AGENTCHAT_SERVICE_DRY_RUN`). */
|
|
637
|
+
serviceDryRun?: boolean;
|
|
638
|
+
/** Where setup telemetry goes (default: the network, or nowhere under AGENTCHAT_SERVICE_DRY_RUN). */
|
|
639
|
+
telemetrySender?: TelemetrySender;
|
|
640
|
+
}
|
|
641
|
+
/** What a host's install hands `reportSetup` (its own command, measured by it). */
|
|
642
|
+
interface ReportSetupOptions {
|
|
643
|
+
command: SetupCommand;
|
|
644
|
+
exitCode: number;
|
|
645
|
+
/** When the command started (ms since the epoch). */
|
|
646
|
+
startedAt: number;
|
|
647
|
+
}
|
|
648
|
+
/** What `confirmSetup` takes from a host's install. */
|
|
649
|
+
interface ConfirmSetupOptions {
|
|
650
|
+
/** What the install's `ensureListener` did, or null when it did not run (a placement step failed). */
|
|
651
|
+
ensure?: ListenerEnsure | null;
|
|
652
|
+
/** A placement problem that keeps runs from having the AgentChat tools. */
|
|
653
|
+
tools?: PlacementProblem | null;
|
|
654
|
+
/** The daemon pid that held the home's lease before the install's `ensureListener` (`daemonPidOf`): after `installed`, what it wrote is not the new process's word. */
|
|
655
|
+
replacedPid?: number | null;
|
|
656
|
+
}
|
|
383
657
|
interface RegisterOpts {
|
|
384
658
|
email?: string;
|
|
385
659
|
handle?: string;
|
|
@@ -416,11 +690,24 @@ interface IdentityCommands {
|
|
|
416
690
|
runStatus(opts: {
|
|
417
691
|
json?: boolean;
|
|
418
692
|
}): Promise<number>;
|
|
419
|
-
|
|
693
|
+
/** Async: it tells AgentChat the listener stopped (contract v1 §3.13) before the key goes. */
|
|
694
|
+
runLogout(): Promise<number>;
|
|
420
695
|
runDoctor(opts?: DoctorOpts): Promise<number>;
|
|
696
|
+
/**
|
|
697
|
+
* For a host's install: wait for the listener when there is an identity and
|
|
698
|
+
* it was registered (`ensure`), then print the setup verdict as the last
|
|
699
|
+
* line. Returns the verdict, or null when there is none to say.
|
|
700
|
+
*/
|
|
701
|
+
confirmSetup(opts?: ConfirmSetupOptions): Promise<SetupVerdict | null>;
|
|
702
|
+
/**
|
|
703
|
+
* For a host's install, after it knows its exit code: send setup telemetry
|
|
704
|
+
* for the verdict this process said last (`confirmSetup`), if any. Never
|
|
705
|
+
* prints, never throws, bounded (`TELEMETRY_TIMEOUT_MS`).
|
|
706
|
+
*/
|
|
707
|
+
reportSetup(opts: ReportSetupOptions): Promise<void>;
|
|
421
708
|
}
|
|
422
709
|
/** Build the identity command set for one coding agent. */
|
|
423
|
-
declare function createIdentityCommands(profile: HostProfile): IdentityCommands;
|
|
710
|
+
declare function createIdentityCommands(profile: HostProfile, options?: IdentityCommandOptions): IdentityCommands;
|
|
424
711
|
|
|
425
712
|
declare const HEARTBEAT_FILE = "daemon.heartbeat";
|
|
426
713
|
/** Record that the user wants always-on for this agent.
|
|
@@ -664,4 +951,4 @@ interface ProbeOptions {
|
|
|
664
951
|
declare const PROBE_KILL_WAIT_MS = 5000;
|
|
665
952
|
declare function runProbe(command: string, args: readonly string[], options: ProbeOptions): Promise<ProbeResult>;
|
|
666
953
|
|
|
667
|
-
export { AGENT_LOCK_DIR_ENV, ANCHOR_END, ANCHOR_START, type AlwaysOnState, type AnchorAction, COULD_NOT_PROCESS_FILE, type CachedTexts, DAEMON_LOCK_FILE, type DoctorOpts, type FetchIdentityLineOptions, type FetchServedTextsOptions, HEARTBEAT_FILE, HOSTED_MCP_PATH, type HostCopy, HostProfile, type IdentityCommands, type IdentityState, IntegrationClient, Lease, LeaseAttempt, LeaseHolder, LeaseOptions, type LoadTextsOptions, type LoadedTexts, type LockHandle, type McpProbeResult, PROBE_KILL_WAIT_MS, type PausedConversation, PausedConversations, type PlaceAnchorOptions, type PlaceAnchorOutcome, type PlaceAnchorResult, type Plan, type ProbeOptions, type ProbeResult, RUN_CONTEXT_ENV, type RecoverOpts, type RegisterOpts, type RemoveAnchorOptions, type RemoveAnchorResult, RunRequest, STANDBY_MARKER_FRESH_MS, type ServiceCommandRunner, type ServiceHostOs, type ServiceOpts, type ServiceRef, TEXTS_CACHE_FILE, type TextsClient, type TextsSource, type TrayClient, type TraySummary, VERSION, type WriteOfferResult, acquireAgentLock, acquireLeaderLock, agentLockDir, agentLockPath, agentLockRefusal, alwaysOnHealth, alwaysOnOptedOut, alwaysOnState, alwaysOnWanted, anchorIsCurrentAt, atomicCopyFile, atomicWriteFile, beat, clearAlwaysOnInstalledVersion, clearAlwaysOnOptOut, clearAlwaysOnWanted, clearOfferDeclined, clearStandby, couldNotProcessPath, createIdentityCommands, fetchIdentityLine, fetchServedTexts, hasAnchorAt, hostedMcpUrl, identityLineOf, idle, installService, isSetupOfferBody, launchdPlist, loadTexts, log, markAlwaysOnInstalledVersion, markAlwaysOnOptOut, markAlwaysOnWanted, markStandby, normalizeHandle, offerDeclined, parseServiceHome, placeAnchorAt, planForTest, probeHostedMcp, readAlwaysOnInstalledVersion, readAnchorHandleAt, readAnchorHandleFrom, readCachedTexts, readJsonFile, readState, recordOfferDeclined, removeAnchorAt, renderAnchorBlock, renderDeclinedBlock, renderUnregisteredBlock, runContextEnv, runProbe, serviceDefinitionCurrent, serviceInstalled, serviceLabelFor, serviceStatus, setServiceCommandRunnerForTests, setServiceHostOsForTests, spawnCommand, spawnCommandSync, standbyMarkerPath, standbyWaiting, stripAnchorBlock, systemdQuote, systemdUnit, textsCachePath, traySummary, uninstallService, upsertAnchorBlock, writeAnchor, writeOfferAt, writeState, xmlEscape };
|
|
954
|
+
export { AGENT_LOCK_DIR_ENV, ANCHOR_END, ANCHOR_START, type AlwaysOnState, type AnchorAction, COULD_NOT_PROCESS_FILE, type CachedTexts, type ConfirmSetupOptions, DAEMON_LOCK_FILE, type DaemonWord, type DoctorOpts, type FetchIdentityLineOptions, type FetchServedTextsOptions, HEARTBEAT_FILE, HOSTED_MCP_PATH, type HostCopy, HostProfile, type IdentityCommandOptions, type IdentityCommands, type IdentityState, IntegrationClient, Lease, LeaseAttempt, LeaseHolder, LeaseOptions, ListenerEnsure, type ListenerReading, type ListenerReasonKind, type LoadTextsOptions, type LoadedTexts, type LockHandle, type McpProbeResult, PROBE_KILL_WAIT_MS, type PausedConversation, PausedConversations, PendingSignup, type PlaceAnchorOptions, type PlaceAnchorOutcome, type PlaceAnchorResult, PlacementProblem, type Plan, type ProbeOptions, type ProbeResult, RUN_CONTEXT_ENV, type ReachabilityView, type ReadListenerOptions, type RecoverOpts, type RegisterOpts, type RemoveAnchorOptions, type RemoveAnchorResult, type ReportSetupOptions, RunRequest, SETUP_GRACE_MS, SETUP_STATES, SETUP_WAIT_MS, STANDBY_MARKER_FRESH_MS, type SendSetupVerdictOptions, type ServerView, type ServiceCommandRunner, type ServiceHostOs, type ServiceOpts, type ServiceRef, type SetupCommand, type SetupInputs, type SetupState, type SetupVerdict, type SetupVerdictEvent, TELEMETRY_ENV, TELEMETRY_PATH, TELEMETRY_TIMEOUT_MS, TELEMETRY_VERSION, TEXTS_CACHE_FILE, type TelemetryBody, type TelemetryRequest, type TelemetrySender, type TextsClient, type TextsSource, type TrayClient, type TraySummary, VERSION, type WriteOfferResult, acquireAgentLock, acquireLeaderLock, agentLockDir, agentLockPath, agentLockRefusal, alwaysOnHealth, alwaysOnOptedOut, alwaysOnState, alwaysOnWanted, anchorIsCurrentAt, atomicCopyFile, atomicWriteFile, beat, clearAlwaysOnInstalledVersion, clearAlwaysOnOptOut, clearAlwaysOnWanted, clearOfferDeclined, clearStandby, couldNotProcessPath, createIdentityCommands, daemonPidOf, fetchIdentityLine, fetchServedTexts, formatSetupVerdict, hasAnchorAt, hostedMcpUrl, httpTelemetrySender, identityLineOf, idle, installService, isSetupOfferBody, launchdPlist, listenerReasonKindOf, loadTexts, log, markAlwaysOnInstalledVersion, markAlwaysOnOptOut, markAlwaysOnWanted, markStandby, newerRelease, normalizeHandle, offerDeclined, parseServiceHome, placeAnchorAt, planForTest, probeHostedMcp, reachabilityOf, readAlwaysOnInstalledVersion, readAnchorHandleAt, readAnchorHandleFrom, readCachedTexts, readJsonFile, readListener, readState, recordOfferDeclined, removeAnchorAt, renderAnchorBlock, renderDeclinedBlock, renderUnregisteredBlock, runContextEnv, runProbe, sendSetupVerdict, serviceDefinitionCurrent, serviceInstalled, serviceLabelFor, serviceStatus, setServiceCommandRunnerForTests, setServiceHostOsForTests, setupVerdict, setupVerdictEvent, spawnCommand, spawnCommandSync, standbyMarkerPath, standbyWaiting, stripAnchorBlock, systemdQuote, systemdUnit, telemetryOff, textsCachePath, traySummary, uninstallService, upsertAnchorBlock, writeAnchor, writeOfferAt, writeState, xmlEscape };
|