@agentconnect.md/daemon 1.0.0-rc.231 → 1.0.0-rc.233
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/{acp-host-CXUQ91Gh.js → acp-host-CF3j4yST.js} +63 -6
- package/dist/acp-host-CF3j4yST.js.map +1 -0
- package/dist/{chat-Di5QFvjw.js → chat-CGFDCD-I.js} +2 -2
- package/dist/{chat-Di5QFvjw.js.map → chat-CGFDCD-I.js.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/{login-8pfSiMc2.js → login-Bchp4kkl.js} +3 -3
- package/dist/{login-8pfSiMc2.js.map → login-Bchp4kkl.js.map} +1 -1
- package/dist/run-foreground-CgCBnrA0.js +2 -0
- package/dist/{run-foreground-Cg2ewYjn.js → run-foreground-DrL_bDro.js} +307 -10
- package/dist/run-foreground-DrL_bDro.js.map +1 -0
- package/package.json +1 -1
- package/dist/acp-host-CXUQ91Gh.js.map +0 -1
- package/dist/run-foreground-Cg2ewYjn.js.map +0 -1
- package/dist/run-foreground-DxSBKNXU.js +0 -2
|
@@ -608,6 +608,24 @@ const RegisterReq = object({
|
|
|
608
608
|
leases: array(string())
|
|
609
609
|
})
|
|
610
610
|
});
|
|
611
|
+
/**
|
|
612
|
+
* One relay the daemon SHOULD hold an outbound WS to (shared-bot-relay.md §5).
|
|
613
|
+
* The roster is all-to-all by design: a webchat/webhook landing on ANY relay
|
|
614
|
+
* instance must find this daemon's connection without cross-instance forwarding.
|
|
615
|
+
* That only holds if `url` (the relay's registered `daemonUrl`) routes to that
|
|
616
|
+
* SPECIFIC instance — the daemon confirms the landing spot against
|
|
617
|
+
* `rd/hello/ok.relayId` and treats a mismatch as a deployment misroute.
|
|
618
|
+
*/
|
|
619
|
+
const RelayRosterEntry = object({
|
|
620
|
+
relayId: string().uuid(),
|
|
621
|
+
url: string()
|
|
622
|
+
});
|
|
623
|
+
/**
|
|
624
|
+
* C→D EVT (`relay/roster`) — hot roster update (relay registered / swept).
|
|
625
|
+
* Carries the WHOLE desired set, same converge-don't-diff semantics as the
|
|
626
|
+
* `register/ok.relays` snapshot it refreshes.
|
|
627
|
+
*/
|
|
628
|
+
const RelayRosterUpdate = object({ relays: array(RelayRosterEntry) });
|
|
611
629
|
const RegisterOk = object({
|
|
612
630
|
routingEpoch: number().int(),
|
|
613
631
|
assignments: array(RouteAssign),
|
|
@@ -615,6 +633,7 @@ const RegisterOk = object({
|
|
|
615
633
|
crons: array(CronUpsert),
|
|
616
634
|
integrations: array(IntegrationSpec).default([]),
|
|
617
635
|
leases: array(SecretsGrant),
|
|
636
|
+
relays: array(RelayRosterEntry).default([]),
|
|
618
637
|
drop: object({
|
|
619
638
|
assignments: array(string()),
|
|
620
639
|
crons: array(string())
|
|
@@ -1245,6 +1264,7 @@ const FRAME_SCHEMAS = {
|
|
|
1245
1264
|
"auth/ok": AuthOk,
|
|
1246
1265
|
register: RegisterReq,
|
|
1247
1266
|
"register/ok": RegisterOk,
|
|
1267
|
+
"relay/roster": RelayRosterUpdate,
|
|
1248
1268
|
heartbeat: Heartbeat,
|
|
1249
1269
|
"agent/launch": AgentLaunch,
|
|
1250
1270
|
"agent/launched": AgentLaunched,
|
|
@@ -1351,6 +1371,15 @@ Object.keys(FRAME_SCHEMAS);
|
|
|
1351
1371
|
/**
|
|
1352
1372
|
* Builds the envelope schema for one frame `type` with a `type` literal and the
|
|
1353
1373
|
* typed payload, so the discriminated union infers `payload` precisely.
|
|
1374
|
+
*
|
|
1375
|
+
* Kept as a local generic (payload pinned to `FRAME_SCHEMAS[T]`) so a
|
|
1376
|
+
* mispaired member — `frame('auth', FRAME_SCHEMAS['register'])` — is a compile
|
|
1377
|
+
* error; a bare `frameSchema` alias would accept it. The body is deliberately
|
|
1378
|
+
* inlined rather than delegated: `return frameSchema(type, payload)` under
|
|
1379
|
+
* THIS generic signature collapses every union member's `payload` to `unknown`
|
|
1380
|
+
* (113 × TS18046 under TS 6.0.3 / zod 4.4.3 — reproducible by making exactly
|
|
1381
|
+
* that substitution), while the small relay unions call `frameSchema` with
|
|
1382
|
+
* concrete schemas and infer fine.
|
|
1354
1383
|
*/
|
|
1355
1384
|
function frame(type, payload) {
|
|
1356
1385
|
return object({
|
|
@@ -1367,6 +1396,7 @@ discriminatedUnion("type", [
|
|
|
1367
1396
|
frame("auth/ok", FRAME_SCHEMAS["auth/ok"]),
|
|
1368
1397
|
frame("register", FRAME_SCHEMAS["register"]),
|
|
1369
1398
|
frame("register/ok", FRAME_SCHEMAS["register/ok"]),
|
|
1399
|
+
frame("relay/roster", FRAME_SCHEMAS["relay/roster"]),
|
|
1370
1400
|
frame("heartbeat", FRAME_SCHEMAS["heartbeat"]),
|
|
1371
1401
|
frame("agent/launch", FRAME_SCHEMAS["agent/launch"]),
|
|
1372
1402
|
frame("agent/launched", FRAME_SCHEMAS["agent/launched"]),
|
|
@@ -1439,7 +1469,16 @@ discriminatedUnion("type", [
|
|
|
1439
1469
|
frame("error", FRAME_SCHEMAS["error"])
|
|
1440
1470
|
]);
|
|
1441
1471
|
//#endregion
|
|
1442
|
-
//#region ../protocol/dist/
|
|
1472
|
+
//#region ../protocol/dist/wire.js
|
|
1473
|
+
/**
|
|
1474
|
+
* Generic envelope codec — the schema-map-agnostic core shared by every wire.
|
|
1475
|
+
*
|
|
1476
|
+
* The daemon↔CP wire (`codec.ts` over `FRAME_SCHEMAS`) and the two relay wires
|
|
1477
|
+
* (`frames/relay-cp.ts` / `frames/relay-daemon.ts` over their OWN maps) all
|
|
1478
|
+
* decode the same envelope shape but accept disjoint frame families — a relay
|
|
1479
|
+
* socket must answer a daemon↔CP frame with `UNKNOWN_FRAME`, and vice versa
|
|
1480
|
+
* (shared-bot-relay.md §8 "独立帧 union,不混入 daemon 协议").
|
|
1481
|
+
*/
|
|
1443
1482
|
/** Soft cap per frame — 256 KiB (protocol §1). Over this → FRAME_TOO_LARGE. */
|
|
1444
1483
|
const MAX_FRAME_BYTES = 256 * 1024;
|
|
1445
1484
|
const textEncoder = new TextEncoder();
|
|
@@ -1455,7 +1494,12 @@ function extractControlExt(json) {
|
|
|
1455
1494
|
if (typeof o.launchId === "string") ext.launchId = o.launchId;
|
|
1456
1495
|
return Object.keys(ext).length > 0 ? ext : void 0;
|
|
1457
1496
|
}
|
|
1458
|
-
|
|
1497
|
+
/**
|
|
1498
|
+
* Decode one wire frame against `schemas` (the wire's `type` → payload map).
|
|
1499
|
+
* Two-step parse: envelope first, then the per-type payload schema — an unknown
|
|
1500
|
+
* `type` is a typed `UNKNOWN_FRAME` failure (a REP, never a hard close).
|
|
1501
|
+
*/
|
|
1502
|
+
function decodeEnvelopeWith(schemas, text) {
|
|
1459
1503
|
if (byteLength(text) > 262144) return {
|
|
1460
1504
|
ok: false,
|
|
1461
1505
|
id: NIL_UUID,
|
|
@@ -1477,7 +1521,7 @@ function decodeEnvelope(text) {
|
|
|
1477
1521
|
id: typeof json === "object" && json !== null && typeof json.id === "string" ? json.id : NIL_UUID,
|
|
1478
1522
|
msg: env.error.message
|
|
1479
1523
|
};
|
|
1480
|
-
const schema =
|
|
1524
|
+
const schema = schemas[env.data.type];
|
|
1481
1525
|
if (!schema) return {
|
|
1482
1526
|
ok: false,
|
|
1483
1527
|
id: env.data.id,
|
|
@@ -1499,7 +1543,12 @@ function decodeEnvelope(text) {
|
|
|
1499
1543
|
...ext ? { ext } : {}
|
|
1500
1544
|
};
|
|
1501
1545
|
}
|
|
1502
|
-
|
|
1546
|
+
/**
|
|
1547
|
+
* Wrap a payload in the wire envelope. Untyped core — each wire exports a typed
|
|
1548
|
+
* wrapper (`buildEnvelope` / `buildRelayCpFrame` / `buildRelayDaemonFrame`) that
|
|
1549
|
+
* pins `type` to its own union and casts the result.
|
|
1550
|
+
*/
|
|
1551
|
+
function buildEnvelopeRaw(type, payload, opts = {}) {
|
|
1503
1552
|
return {
|
|
1504
1553
|
v: 1,
|
|
1505
1554
|
id: opts.id ?? randomUUID(),
|
|
@@ -1510,6 +1559,14 @@ function buildEnvelope(type, payload, opts = {}) {
|
|
|
1510
1559
|
...opts.ext ?? {}
|
|
1511
1560
|
};
|
|
1512
1561
|
}
|
|
1562
|
+
//#endregion
|
|
1563
|
+
//#region ../protocol/dist/codec.js
|
|
1564
|
+
function decodeEnvelope(text) {
|
|
1565
|
+
return decodeEnvelopeWith(FRAME_SCHEMAS, text);
|
|
1566
|
+
}
|
|
1567
|
+
function buildEnvelope(type, payload, opts = {}) {
|
|
1568
|
+
return buildEnvelopeRaw(type, payload, opts);
|
|
1569
|
+
}
|
|
1513
1570
|
function encode(frame) {
|
|
1514
1571
|
return JSON.stringify(frame);
|
|
1515
1572
|
}
|
|
@@ -10637,6 +10694,6 @@ var AcpHost = class {
|
|
|
10637
10694
|
}
|
|
10638
10695
|
};
|
|
10639
10696
|
//#endregion
|
|
10640
|
-
export { cachedRuntimeNames as _, initGitInjection as a, simpleGit as c,
|
|
10697
|
+
export { cachedRuntimeNames as _, initGitInjection as a, simpleGit as c, buildEnvelope as d, decodeEnvelope as f, RESERVED_MCP_SERVER_NAME as g, MEMORY_INDEX as h, prepareWorkspace as i, isFrame as l, MAX_FRAME_BYTES as m, installedRuntimes as n, probeGitVersion as o, encode as p, prefetchWorkspace as r, sessionGitEnv as s, AcpHost as t, normalizeGitUrl as u, cachedRuntimeVersions as v, resolveRuntimes as y };
|
|
10641
10698
|
|
|
10642
|
-
//# sourceMappingURL=acp-host-
|
|
10699
|
+
//# sourceMappingURL=acp-host-CF3j4yST.js.map
|