agent-shim 14.12.2 → 14.12.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/dist/cli.cjs +20 -13
- package/dist/index.cjs +20 -13
- package/dist/index.mjs +20 -13
- package/dist/types/index.d.ts +896 -896
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -76444,7 +76444,7 @@ var init_package = __esm({
|
|
|
76444
76444
|
"package.json"() {
|
|
76445
76445
|
package_default = {
|
|
76446
76446
|
name: "agent-shim",
|
|
76447
|
-
version: "14.12.
|
|
76447
|
+
version: "14.12.3",
|
|
76448
76448
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
76449
76449
|
license: "MIT",
|
|
76450
76450
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -155849,6 +155849,16 @@ function parseJsonObject5(body) {
|
|
|
155849
155849
|
}
|
|
155850
155850
|
return isRecord22(parsed) ? parsed : void 0;
|
|
155851
155851
|
}
|
|
155852
|
+
function internalEventOf(event, newUuid, now) {
|
|
155853
|
+
if (!isRecord22(event) || !isRecord22(event.payload)) {
|
|
155854
|
+
return void 0;
|
|
155855
|
+
}
|
|
155856
|
+
const eventType = nonEmptyString4(event.payload, "type");
|
|
155857
|
+
return eventType === void 0 ? void 0 : { eventId: newUuid(), eventType, payload: event.payload, isCompaction: event.is_compaction === true, agentId: nonEmptyString4(event, "session_agent_id"), createdAt: new Date(now()).toISOString() };
|
|
155858
|
+
}
|
|
155859
|
+
function internalEventRow(event) {
|
|
155860
|
+
return { event_id: event.eventId, event_type: event.eventType, payload: event.payload, is_compaction: event.isCompaction, created_at: event.createdAt, ...event.agentId === void 0 ? {} : { session_agent_id: event.agentId } };
|
|
155861
|
+
}
|
|
155852
155862
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
155853
155863
|
const encode3 = (value3) => Buffer.from(JSON.stringify(value3), "utf8").toString("base64url");
|
|
155854
155864
|
const header = encode3({ alg: "HS256", typ: "JWT" });
|
|
@@ -156165,25 +156175,22 @@ data: ${JSON.stringify(envelope2)}
|
|
|
156165
156175
|
return;
|
|
156166
156176
|
}
|
|
156167
156177
|
const events = body?.events;
|
|
156168
|
-
|
|
156169
|
-
|
|
156178
|
+
const posted = Array.isArray(events) ? events : void 0;
|
|
156179
|
+
const filed = posted?.map((event) => internalEventOf(event, deps.newUuid, deps.now)).filter((event) => event !== void 0);
|
|
156180
|
+
if (filed === void 0 || filed.length !== posted?.length) {
|
|
156181
|
+
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "an internal event batch is an array of events, each carrying one typed payload object" } });
|
|
156170
156182
|
return;
|
|
156171
156183
|
}
|
|
156172
|
-
|
|
156173
|
-
if (isRecord22(event)) {
|
|
156174
|
-
session.internalEvents.push({ eventId: deps.newUuid(), body: event });
|
|
156175
|
-
}
|
|
156176
|
-
}
|
|
156184
|
+
session.internalEvents.push(...filed);
|
|
156177
156185
|
await answerJson2(response, HTTP_STATUS.ok, {});
|
|
156178
156186
|
return;
|
|
156179
156187
|
}
|
|
156180
156188
|
if (workerTail === "internal-events" && method === "GET") {
|
|
156181
156189
|
const query = new URL(request7.url, "http://127.0.0.1").searchParams;
|
|
156182
|
-
|
|
156183
|
-
|
|
156184
|
-
|
|
156185
|
-
|
|
156186
|
-
const page = pageOfRcChannel(request7.url, session.internalEvents, (event) => event.eventId, (event) => ({ event_id: event.eventId, payload: event.body }));
|
|
156190
|
+
const agentId = query.get("session_agent_id");
|
|
156191
|
+
const everyAgent = query.get("subagents") !== null;
|
|
156192
|
+
const rows = session.internalEvents.filter((event) => agentId !== null ? event.agentId === agentId : event.agentId !== void 0 === everyAgent);
|
|
156193
|
+
const page = pageOfRcChannel(request7.url, rows, (event) => event.eventId, internalEventRow);
|
|
156187
156194
|
if ("error" in page) {
|
|
156188
156195
|
const anchorUnknown = query.get("after_event_id") !== null && page.error.startsWith("the anchor names an event id");
|
|
156189
156196
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: anchorUnknown ? "after_event_id_not_found" : "invalid_request_error", message: page.error } });
|
package/dist/index.cjs
CHANGED
|
@@ -15210,7 +15210,7 @@ var init_package = __esm({
|
|
|
15210
15210
|
"package.json"() {
|
|
15211
15211
|
package_default = {
|
|
15212
15212
|
name: "agent-shim",
|
|
15213
|
-
version: "14.12.
|
|
15213
|
+
version: "14.12.3",
|
|
15214
15214
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
15215
15215
|
license: "MIT",
|
|
15216
15216
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -27939,6 +27939,16 @@ function parseJsonObject5(body) {
|
|
|
27939
27939
|
}
|
|
27940
27940
|
return isRecord16(parsed) ? parsed : void 0;
|
|
27941
27941
|
}
|
|
27942
|
+
function internalEventOf(event, newUuid, now) {
|
|
27943
|
+
if (!isRecord16(event) || !isRecord16(event.payload)) {
|
|
27944
|
+
return void 0;
|
|
27945
|
+
}
|
|
27946
|
+
const eventType = nonEmptyString4(event.payload, "type");
|
|
27947
|
+
return eventType === void 0 ? void 0 : { eventId: newUuid(), eventType, payload: event.payload, isCompaction: event.is_compaction === true, agentId: nonEmptyString4(event, "session_agent_id"), createdAt: new Date(now()).toISOString() };
|
|
27948
|
+
}
|
|
27949
|
+
function internalEventRow(event) {
|
|
27950
|
+
return { event_id: event.eventId, event_type: event.eventType, payload: event.payload, is_compaction: event.isCompaction, created_at: event.createdAt, ...event.agentId === void 0 ? {} : { session_agent_id: event.agentId } };
|
|
27951
|
+
}
|
|
27942
27952
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
27943
27953
|
const encode = (value) => Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
|
|
27944
27954
|
const header = encode({ alg: "HS256", typ: "JWT" });
|
|
@@ -28255,25 +28265,22 @@ data: ${JSON.stringify(envelope)}
|
|
|
28255
28265
|
return;
|
|
28256
28266
|
}
|
|
28257
28267
|
const events = body?.events;
|
|
28258
|
-
|
|
28259
|
-
|
|
28268
|
+
const posted = Array.isArray(events) ? events : void 0;
|
|
28269
|
+
const filed = posted?.map((event) => internalEventOf(event, deps.newUuid, deps.now)).filter((event) => event !== void 0);
|
|
28270
|
+
if (filed === void 0 || filed.length !== posted?.length) {
|
|
28271
|
+
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "an internal event batch is an array of events, each carrying one typed payload object" } });
|
|
28260
28272
|
return;
|
|
28261
28273
|
}
|
|
28262
|
-
|
|
28263
|
-
if (isRecord16(event)) {
|
|
28264
|
-
session.internalEvents.push({ eventId: deps.newUuid(), body: event });
|
|
28265
|
-
}
|
|
28266
|
-
}
|
|
28274
|
+
session.internalEvents.push(...filed);
|
|
28267
28275
|
await answerJson2(response, HTTP_STATUS.ok, {});
|
|
28268
28276
|
return;
|
|
28269
28277
|
}
|
|
28270
28278
|
if (workerTail === "internal-events" && method === "GET") {
|
|
28271
28279
|
const query = new URL(request4.url, "http://127.0.0.1").searchParams;
|
|
28272
|
-
|
|
28273
|
-
|
|
28274
|
-
|
|
28275
|
-
|
|
28276
|
-
const page = pageOfRcChannel(request4.url, session.internalEvents, (event) => event.eventId, (event) => ({ event_id: event.eventId, payload: event.body }));
|
|
28280
|
+
const agentId = query.get("session_agent_id");
|
|
28281
|
+
const everyAgent = query.get("subagents") !== null;
|
|
28282
|
+
const rows = session.internalEvents.filter((event) => agentId !== null ? event.agentId === agentId : event.agentId !== void 0 === everyAgent);
|
|
28283
|
+
const page = pageOfRcChannel(request4.url, rows, (event) => event.eventId, internalEventRow);
|
|
28277
28284
|
if ("error" in page) {
|
|
28278
28285
|
const anchorUnknown = query.get("after_event_id") !== null && page.error.startsWith("the anchor names an event id");
|
|
28279
28286
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: anchorUnknown ? "after_event_id_not_found" : "invalid_request_error", message: page.error } });
|
package/dist/index.mjs
CHANGED
|
@@ -15181,7 +15181,7 @@ var init_package = __esm({
|
|
|
15181
15181
|
"package.json"() {
|
|
15182
15182
|
package_default = {
|
|
15183
15183
|
name: "agent-shim",
|
|
15184
|
-
version: "14.12.
|
|
15184
|
+
version: "14.12.3",
|
|
15185
15185
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
15186
15186
|
license: "MIT",
|
|
15187
15187
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -27486,6 +27486,16 @@ function parseJsonObject5(body) {
|
|
|
27486
27486
|
}
|
|
27487
27487
|
return isRecord16(parsed) ? parsed : void 0;
|
|
27488
27488
|
}
|
|
27489
|
+
function internalEventOf(event, newUuid, now) {
|
|
27490
|
+
if (!isRecord16(event) || !isRecord16(event.payload)) {
|
|
27491
|
+
return void 0;
|
|
27492
|
+
}
|
|
27493
|
+
const eventType = nonEmptyString4(event.payload, "type");
|
|
27494
|
+
return eventType === void 0 ? void 0 : { eventId: newUuid(), eventType, payload: event.payload, isCompaction: event.is_compaction === true, agentId: nonEmptyString4(event, "session_agent_id"), createdAt: new Date(now()).toISOString() };
|
|
27495
|
+
}
|
|
27496
|
+
function internalEventRow(event) {
|
|
27497
|
+
return { event_id: event.eventId, event_type: event.eventType, payload: event.payload, is_compaction: event.isCompaction, created_at: event.createdAt, ...event.agentId === void 0 ? {} : { session_agent_id: event.agentId } };
|
|
27498
|
+
}
|
|
27489
27499
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
27490
27500
|
const encode = (value) => Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
|
|
27491
27501
|
const header = encode({ alg: "HS256", typ: "JWT" });
|
|
@@ -27802,25 +27812,22 @@ data: ${JSON.stringify(envelope)}
|
|
|
27802
27812
|
return;
|
|
27803
27813
|
}
|
|
27804
27814
|
const events = body?.events;
|
|
27805
|
-
|
|
27806
|
-
|
|
27815
|
+
const posted = Array.isArray(events) ? events : void 0;
|
|
27816
|
+
const filed = posted?.map((event) => internalEventOf(event, deps.newUuid, deps.now)).filter((event) => event !== void 0);
|
|
27817
|
+
if (filed === void 0 || filed.length !== posted?.length) {
|
|
27818
|
+
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "an internal event batch is an array of events, each carrying one typed payload object" } });
|
|
27807
27819
|
return;
|
|
27808
27820
|
}
|
|
27809
|
-
|
|
27810
|
-
if (isRecord16(event)) {
|
|
27811
|
-
session.internalEvents.push({ eventId: deps.newUuid(), body: event });
|
|
27812
|
-
}
|
|
27813
|
-
}
|
|
27821
|
+
session.internalEvents.push(...filed);
|
|
27814
27822
|
await answerJson2(response, HTTP_STATUS.ok, {});
|
|
27815
27823
|
return;
|
|
27816
27824
|
}
|
|
27817
27825
|
if (workerTail === "internal-events" && method === "GET") {
|
|
27818
27826
|
const query = new URL(request4.url, "http://127.0.0.1").searchParams;
|
|
27819
|
-
|
|
27820
|
-
|
|
27821
|
-
|
|
27822
|
-
|
|
27823
|
-
const page = pageOfRcChannel(request4.url, session.internalEvents, (event) => event.eventId, (event) => ({ event_id: event.eventId, payload: event.body }));
|
|
27827
|
+
const agentId = query.get("session_agent_id");
|
|
27828
|
+
const everyAgent = query.get("subagents") !== null;
|
|
27829
|
+
const rows = session.internalEvents.filter((event) => agentId !== null ? event.agentId === agentId : event.agentId !== void 0 === everyAgent);
|
|
27830
|
+
const page = pageOfRcChannel(request4.url, rows, (event) => event.eventId, internalEventRow);
|
|
27824
27831
|
if ("error" in page) {
|
|
27825
27832
|
const anchorUnknown = query.get("after_event_id") !== null && page.error.startsWith("the anchor names an event id");
|
|
27826
27833
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: anchorUnknown ? "after_event_id_not_found" : "invalid_request_error", message: page.error } });
|