@agentchatme/agent-core 0.5.0 → 0.5.2
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 +3 -1
- package/dist/{chunk-NAAHIK7Z.js → chunk-CDJASQ3X.js} +43 -9
- package/dist/chunk-CDJASQ3X.js.map +1 -0
- package/dist/{chunk-UE7DKW3C.js → chunk-WDHXWAWF.js} +2 -2
- package/dist/{chunk-UE7DKW3C.js.map → chunk-WDHXWAWF.js.map} +1 -1
- package/dist/daemon-entry.d.ts +1 -1
- package/dist/daemon-entry.js +1 -1
- package/dist/index.d.ts +15 -7
- package/dist/index.js +288 -308
- package/dist/index.js.map +1 -1
- package/dist/presets.js +1 -1
- package/dist/{served-manual-2rjsjJFD.d.ts → served-manual-Be_eUo0m.d.ts} +19 -26
- package/package.json +3 -3
- package/dist/chunk-NAAHIK7Z.js.map +0 -1
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-AFDD53DD.js";
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
|
-
var VERSION = "0.5.
|
|
8
|
+
var VERSION = "0.5.2";
|
|
9
9
|
|
|
10
10
|
// src/integration/mcp-probe.ts
|
|
11
11
|
import { integration as kit } from "agentchatme";
|
|
@@ -94,4 +94,4 @@ export {
|
|
|
94
94
|
PROBE_KILL_WAIT_MS,
|
|
95
95
|
runProbe
|
|
96
96
|
};
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-WDHXWAWF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/version.ts","../src/integration/mcp-probe.ts","../src/util/probe.ts"],"sourcesContent":["/** Published package version, kept in lockstep with package.json by tests. */\nexport const VERSION = '0.5.
|
|
1
|
+
{"version":3,"sources":["../src/version.ts","../src/integration/mcp-probe.ts","../src/util/probe.ts"],"sourcesContent":["/** Published package version, kept in lockstep with package.json by tests. */\nexport const VERSION = '0.5.2'\n","import { integration as kit } from 'agentchatme'\nimport { clientIdentityOf, type IntegrationClient } from '../client-identity.js'\n\n// ─── Can this key reach the hosted tools? ───────────────────────────────────\n//\n// `status` and `doctor` ask the SDK kit's `probeHostedTools`: one MCP\n// `initialize` over Streamable HTTP with the bearer key — the same first\n// request a runtime makes on connect — then `tools/list`, which must show the\n// tools a run needs (`agentchat_inbox`, `agentchat_decide`). A 401 means the\n// key does not authenticate; a transport error means the endpoint is not\n// reachable from here. No tool is called.\n\nexport const HOSTED_MCP_PATH = kit.HOSTED_MCP_PATH\n\nexport function hostedMcpUrl(apiBase: string): string {\n return kit.hostedMcpUrl(apiBase)\n}\n\nexport interface McpProbeResult {\n readonly ok: boolean\n readonly status?: number\n readonly serverName?: string\n readonly serverVersion?: string\n readonly protocolVersion?: string\n /** Every tool the server listed for this key. */\n readonly tools?: readonly string[]\n /** Tools a run needs that were not listed. */\n readonly missing?: readonly string[]\n readonly error?: string\n}\n\nexport async function probeHostedMcp(params: {\n apiKey: string\n apiBase: string\n /** How this integration identifies to the server. */\n client: IntegrationClient\n /**\n * Accepted for compatibility and ignored: the probe identifies as `client`\n * (headers and `clientInfo` alike), so the server's analytics see the\n * integration, never a free-text name it would file as unknown.\n */\n clientName?: string\n /** Accepted for compatibility and ignored (see `clientName`). */\n clientVersion?: string\n timeoutMs?: number\n fetch?: typeof fetch\n}): Promise<McpProbeResult> {\n return kit.probeHostedTools({\n apiBase: params.apiBase,\n apiKey: params.apiKey,\n clientIdentity: clientIdentityOf(params.client),\n ...(params.timeoutMs !== undefined ? { timeoutMs: params.timeoutMs } : {}),\n ...(params.fetch !== undefined ? { fetch: params.fetch } : {}),\n })\n}\n","import { killProcessTree } from '../integration/spawn-run.js'\nimport { spawnCommand } from './spawn.js'\n\n// ─── A short command whose answer we need (`--version`, a sign-in check) ────\n//\n// Was `spawnSync` with a timeout, which on timeout kills only the direct child:\n// on Windows the npm `.cmd` shim (the real process under it keeps running), and\n// the npm launcher of a runtime that starts its native binary as a child. A sync\n// spawn then also waits for those survivors to close the output pipes it reads —\n// blocking the whole daemon, socket included. A probe is therefore async: on\n// timeout the whole tree is killed (its process group on POSIX, `taskkill /T /F`\n// on Windows), its exit is waited for, and a tree that will not die is given up\n// on after a bound — the probe always answers.\n\nexport interface ProbeResult {\n /** Why it did not answer: it could not be started, or it timed out. */\n readonly error?: Error\n readonly status: number | null\n readonly stdout: string\n readonly stderr: string\n readonly timedOut: boolean\n}\n\nexport interface ProbeOptions {\n readonly env?: NodeJS.ProcessEnv\n readonly timeoutMs: number\n readonly cwd?: string\n /** Aborting it stops the probe as a timeout would (its tree killed, its exit waited for). */\n readonly signal?: AbortSignal\n}\n\n/** After a probe is killed: how long its exit is waited for before it is given up on. */\nexport const PROBE_KILL_WAIT_MS = 5_000\nconst MAX_OUTPUT = 64 * 1024\n\nexport function runProbe(command: string, args: readonly string[], options: ProbeOptions): Promise<ProbeResult> {\n return new Promise((resolve) => {\n let child: ReturnType<typeof spawnCommand>\n try {\n child = spawnCommand(command, [...args], {\n ...(options.env !== undefined ? { env: options.env } : {}),\n ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),\n stdio: ['ignore', 'pipe', 'pipe'],\n // Its own process group on POSIX, so the whole tree can be killed.\n detached: process.platform !== 'win32',\n windowsHide: true,\n })\n } catch (err) {\n resolve({ error: err instanceof Error ? err : new Error(String(err)), status: null, stdout: '', stderr: '', timedOut: false })\n return\n }\n const proc = child\n let stdout = ''\n let stderr = ''\n let timedOut = false\n let stopped = false\n let finished = false\n let giveUp: NodeJS.Timeout | null = null\n const finish = (result: ProbeResult): void => {\n if (finished) return\n finished = true\n clearTimeout(timer)\n if (giveUp !== null) clearTimeout(giveUp)\n resolve(result)\n }\n proc.stdout?.on('data', (chunk: Buffer) => {\n if (stdout.length < MAX_OUTPUT) stdout += chunk.toString('utf-8')\n })\n proc.stderr?.on('data', (chunk: Buffer) => {\n if (stderr.length < MAX_OUTPUT) stderr += chunk.toString('utf-8')\n })\n const stop = (error: Error, byTimeout: boolean): void => {\n if (timedOut || finished) return\n timedOut = byTimeout\n stopped = true\n killProcessTree(proc, 'SIGKILL')\n // Its exit (every pipe closed) is the answer; a tree that will not die is given up on.\n giveUp = setTimeout(() => {\n proc.stdout?.destroy()\n proc.stderr?.destroy()\n finish({ error, status: null, stdout, stderr, timedOut })\n }, PROBE_KILL_WAIT_MS)\n proc.once('close', () => finish({ error, status: null, stdout, stderr, timedOut }))\n }\n const timer = setTimeout(() => stop(new Error(`${command} ${args.join(' ')} did not answer within ${Math.round(options.timeoutMs / 1000)} s`), true), options.timeoutMs)\n const onAbort = (): void => stop(new Error(`${command} ${args.join(' ')} was stopped`), false)\n if (options.signal?.aborted) onAbort()\n else options.signal?.addEventListener('abort', onAbort, { once: true })\n proc.on('error', (err) => finish({ error: err, status: null, stdout, stderr, timedOut }))\n proc.on('close', (code) => {\n options.signal?.removeEventListener('abort', onAbort)\n if (!stopped) finish({ status: code, stdout, stderr, timedOut })\n })\n })\n}\n"],"mappings":";;;;;;;AACO,IAAM,UAAU;;;ACDvB,SAAS,eAAe,WAAW;AAY5B,IAAM,kBAAkB,IAAI;AAE5B,SAAS,aAAa,SAAyB;AACpD,SAAO,IAAI,aAAa,OAAO;AACjC;AAeA,eAAsB,eAAe,QAeT;AAC1B,SAAO,IAAI,iBAAiB;AAAA,IAC1B,SAAS,OAAO;AAAA,IAChB,QAAQ,OAAO;AAAA,IACf,gBAAgB,iBAAiB,OAAO,MAAM;AAAA,IAC9C,GAAI,OAAO,cAAc,SAAY,EAAE,WAAW,OAAO,UAAU,IAAI,CAAC;AAAA,IACxE,GAAI,OAAO,UAAU,SAAY,EAAE,OAAO,OAAO,MAAM,IAAI,CAAC;AAAA,EAC9D,CAAC;AACH;;;ACtBO,IAAM,qBAAqB;AAClC,IAAM,aAAa,KAAK;AAEjB,SAAS,SAAS,SAAiB,MAAyB,SAA6C;AAC9G,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,QAAI;AACJ,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AAQ,QAAQ,SAAS,CAAC;AAAA,MAC1D,GAAG,kBAAkB;AACrB,WAAK,KAAK,SAAS,MAAM,OAAO,EAAE,OAAO,QAAQ,MAAM,QAAQ,QAAQ,SAAS,CAAC,CAAC;AAAA,IACpF;AACA,UAAM,QAAQ,WAAW,MAAM,KAAK,IAAI,MAAM,GAAG,OAAO,IAAI,KAAK,KAAK,GAAG,CAAC,0BAA0B,KAAK,MAAM,QAAQ,YAAY,GAAI,CAAC,IAAI,GAAG,IAAI,GAAG,QAAQ,SAAS;AACvK,UAAM,UAAU,MAAY,KAAK,IAAI,MAAM,GAAG,OAAO,IAAI,KAAK,KAAK,GAAG,CAAC,cAAc,GAAG,KAAK;AAC7F,QAAI,QAAQ,QAAQ,QAAS,SAAQ;AAAA,QAChC,SAAQ,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AACtE,SAAK,GAAG,SAAS,CAAC,QAAQ,OAAO,EAAE,OAAO,KAAK,QAAQ,MAAM,QAAQ,QAAQ,SAAS,CAAC,CAAC;AACxF,SAAK,GAAG,SAAS,CAAC,SAAS;AACzB,cAAQ,QAAQ,oBAAoB,SAAS,OAAO;AACpD,UAAI,CAAC,QAAS,QAAO,EAAE,QAAQ,MAAM,QAAQ,QAAQ,SAAS,CAAC;AAAA,IACjE,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
package/dist/daemon-entry.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IntegrationClient, L as LeaseOptions, M as ManualFetch, a as IntegrationStatus, b as IntegrationRunsFailing, S as SocketState } from './served-manual-
|
|
1
|
+
import { I as IntegrationClient, L as LeaseOptions, M as ManualFetch, a as IntegrationStatus, b as IntegrationRunsFailing, S as SocketState } from './served-manual-Be_eUo0m.js';
|
|
2
2
|
import { R as RunnerSource, a as RunProfile, b as RunRunner, c as RunOutcome } from './runner-DYVqz_9P.js';
|
|
3
3
|
export { d as RunKind, e as RunOutcomeState, f as RunPreflight, g as RunRequest, h as RunWake, i as RunnerFactory, j as RunnerIdentity } from './runner-DYVqz_9P.js';
|
|
4
4
|
import { AgentChatClient, RealtimeClient, BlockedInfo, RealtimeState } from 'agentchatme';
|
package/dist/daemon-entry.js
CHANGED
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, R as REPEATED_FAILED_CYCLES,
|
|
1
|
+
import { I as IntegrationClient, H as HostProfile, c as Lease, L as LeaseOptions, d as LeaseAttempt, e as LeaseHolder } from './served-manual-Be_eUo0m.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 failedCyclesInARow, a2 as formatIntegrationStatus, a3 as fromKitResult, a4 as holderLive, a5 as integrationStatusAge, a6 as integrationStatusPath, a7 as leaseHolder, a8 as parseLease, a9 as pendingPath, aa as pidAlive, ab as readCredentials, ac as readIntegrationStatus, ad as readManualVersion, ae as readPending, af as resetLeaseObservations, ag as resolveIdentity, ah as statePath, ai as syncManual, aj as writeCredentials, ak as writeIntegrationStatus, al as writePending } from './served-manual-Be_eUo0m.js';
|
|
3
3
|
import { AgentChatClient, Texts, TextsRuntime, integration } from 'agentchatme';
|
|
4
4
|
import { z } from 'zod';
|
|
5
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 integrationDisabled, s as integrationDisabledBy, t as isRunProfile, u as isRunnerFactory, v as resolveRunBudgetMs, w as resolveRunProfile, x as runProfileWarning, y as workdirExposesHome } from './runner-DYVqz_9P.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.5.
|
|
9
|
+
declare const VERSION = "0.5.2";
|
|
10
10
|
|
|
11
11
|
type TrayClient = Pick<AgentChatClient, 'inbox'>;
|
|
12
12
|
interface TraySummary {
|
|
@@ -137,6 +137,12 @@ interface HostCopy {
|
|
|
137
137
|
* Deliberately bounded: static text is re-read every session, so without an
|
|
138
138
|
* explicit stop condition an agent would raise it forever. `--not-now` records
|
|
139
139
|
* the decline and rewrites this block to the silent variant below.
|
|
140
|
+
*
|
|
141
|
+
* It names the commands and nothing of the server's: no handle rules, no
|
|
142
|
+
* code length, no scripted answer for a failure. Each command prints the
|
|
143
|
+
* server's sentence and the command to run next, and the agent relays the one
|
|
144
|
+
* and runs the other, so a rule that moves on the server never leaves a stale
|
|
145
|
+
* copy in every instruction file.
|
|
140
146
|
*/
|
|
141
147
|
declare function renderUnregisteredBlock(copy: HostCopy): string;
|
|
142
148
|
/**
|
|
@@ -247,6 +253,7 @@ interface RegisterOpts {
|
|
|
247
253
|
handle?: string;
|
|
248
254
|
displayName?: string;
|
|
249
255
|
description?: string;
|
|
256
|
+
/** The code from the verification email — the completion leg. */
|
|
250
257
|
code?: string;
|
|
251
258
|
apiBase?: string;
|
|
252
259
|
}
|
|
@@ -254,12 +261,13 @@ interface RecoverOpts {
|
|
|
254
261
|
/** The email the agent registered with. */
|
|
255
262
|
email?: string;
|
|
256
263
|
/**
|
|
257
|
-
* Which agent on that email to re-key.
|
|
258
|
-
*
|
|
259
|
-
*
|
|
264
|
+
* Which agent on that email to re-key. When omitted it defaults to this
|
|
265
|
+
* agent's stored handle, then to a prompt on a TTY; without one the
|
|
266
|
+
* server is asked by email alone, and names the handles to choose from
|
|
267
|
+
* when the email backs several agents.
|
|
260
268
|
*/
|
|
261
269
|
handle?: string;
|
|
262
|
-
/** The
|
|
270
|
+
/** The code from the recovery email — the completion leg. */
|
|
263
271
|
code?: string;
|
|
264
272
|
apiBase?: string;
|
|
265
273
|
}
|