agent-shim 11.71.1 → 11.72.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/dist/cli.cjs CHANGED
@@ -37387,7 +37387,7 @@ var init_package = __esm({
37387
37387
  "package.json"() {
37388
37388
  package_default = {
37389
37389
  name: "agent-shim",
37390
- version: "11.71.1",
37390
+ version: "11.72.0",
37391
37391
  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.",
37392
37392
  license: "MIT",
37393
37393
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -135223,6 +135223,9 @@ function createAntigravityRelay(params) {
135223
135223
  let currentBlockIndex = -1;
135224
135224
  let sawToolUse = false;
135225
135225
  let finished = false;
135226
+ let stopReason = "end_turn";
135227
+ const content = [];
135228
+ let activeText;
135226
135229
  let usage = {
135227
135230
  input_tokens: 0,
135228
135231
  cache_creation_input_tokens: 0,
@@ -135284,6 +135287,8 @@ function createAntigravityRelay(params) {
135284
135287
  closeActiveBlock();
135285
135288
  currentBlockIndex += 1;
135286
135289
  activeBlockType = "text";
135290
+ activeText = { type: "text", text: "" };
135291
+ content.push(activeText);
135287
135292
  frames.push({
135288
135293
  event: "content_block_start",
135289
135294
  data: {
@@ -135293,6 +135298,9 @@ function createAntigravityRelay(params) {
135293
135298
  }
135294
135299
  });
135295
135300
  }
135301
+ if (activeText !== void 0) {
135302
+ activeText.text += part.text;
135303
+ }
135296
135304
  frames.push({
135297
135305
  event: "content_block_delta",
135298
135306
  data: {
@@ -135309,6 +135317,7 @@ function createAntigravityRelay(params) {
135309
135317
  const callName = part.functionCall.name;
135310
135318
  const originalName = params.toolNames.get(callName) ?? callName;
135311
135319
  const callId = params.fallbackId();
135320
+ content.push({ type: "tool_use", id: callId, name: originalName, input: part.functionCall.args });
135312
135321
  if (typeof part.thoughtSignature === "string") {
135313
135322
  rememberToolCallSignature(callId, part.thoughtSignature);
135314
135323
  }
@@ -135342,7 +135351,7 @@ function createAntigravityRelay(params) {
135342
135351
  }
135343
135352
  }
135344
135353
  if (candidate?.finishReason !== void 0) {
135345
- const stopReason = sawToolUse ? "tool_use" : candidate.finishReason === "MAX_TOKENS" ? "max_tokens" : "end_turn";
135354
+ stopReason = sawToolUse ? "tool_use" : candidate.finishReason === "MAX_TOKENS" ? "max_tokens" : "end_turn";
135346
135355
  closeActiveBlock();
135347
135356
  frames.push({
135348
135357
  event: "message_delta",
@@ -135365,7 +135374,7 @@ function createAntigravityRelay(params) {
135365
135374
  if (!finished) {
135366
135375
  ensureStarted();
135367
135376
  closeActiveBlock();
135368
- const stopReason = sawToolUse ? "tool_use" : "end_turn";
135377
+ stopReason = sawToolUse ? "tool_use" : "end_turn";
135369
135378
  frames.push({
135370
135379
  event: "message_delta",
135371
135380
  data: {
@@ -135382,7 +135391,8 @@ function createAntigravityRelay(params) {
135382
135391
  }
135383
135392
  return { frames: [...frames], done: true };
135384
135393
  };
135385
- return { pushChunk, finish };
135394
+ const message = () => ({ id: messageId, type: "message", role: "assistant", model: params.servedModel, content: [...content], stop_reason: stopReason, stop_sequence: null, usage });
135395
+ return { pushChunk, finish, message };
135386
135396
  }
135387
135397
 
135388
135398
  // src/antigravity/route.ts
@@ -135701,12 +135711,12 @@ function createAntigravityRoute(ports) {
135701
135711
  nowMs,
135702
135712
  model: translated.model
135703
135713
  });
135704
- const stream = async function* () {
135714
+ const frames = async function* () {
135705
135715
  try {
135706
135716
  if (firstResult.done !== true) {
135707
135717
  const step2 = relay.pushChunk(firstResult.value);
135708
135718
  for (const frame of step2.frames) {
135709
- yield renderSseFrame2(frame);
135719
+ yield frame;
135710
135720
  }
135711
135721
  if (!step2.done) {
135712
135722
  for (; ; ) {
@@ -135719,7 +135729,7 @@ function createAntigravityRoute(ports) {
135719
135729
  }
135720
135730
  const nextStep = relay.pushChunk(nextResult.value);
135721
135731
  for (const frame of nextStep.frames) {
135722
- yield renderSseFrame2(frame);
135732
+ yield frame;
135723
135733
  }
135724
135734
  if (nextStep.done) {
135725
135735
  break;
@@ -135729,30 +135739,40 @@ function createAntigravityRoute(ports) {
135729
135739
  }
135730
135740
  const finalStep = relay.finish();
135731
135741
  for (const frame of finalStep.frames) {
135732
- yield renderSseFrame2(frame);
135742
+ yield frame;
135733
135743
  }
135734
135744
  } catch (error63) {
135735
135745
  if (!request7.signal.aborted) {
135736
135746
  const errMsg = error63 instanceof Error ? error63.message : String(error63);
135737
- yield renderSseFrame2({
135738
- event: "error",
135739
- data: { type: "error", error: { type: "api_error", message: errMsg } }
135740
- });
135747
+ yield { event: "error", data: { type: "error", error: { type: "api_error", message: errMsg } } };
135741
135748
  }
135742
135749
  }
135743
135750
  };
135744
- return {
135745
- status: HTTP_STATUS.ok,
135746
- headers: {
135747
- "Content-Type": "text/event-stream",
135748
- "Cache-Control": "no-cache",
135749
- Connection: "keep-alive",
135750
- ...quotaHeaders2
135751
- },
135752
- body: stream(),
135753
- // The tier alias the session asked for, whenever the translation resolved it to a different model: the front door's mount turns it into the model choice the usage record keeps.
135754
- ...requestedModel !== translated.model ? { requestedModel } : {}
135755
- };
135751
+ const served = requestedModel !== translated.model ? { requestedModel } : {};
135752
+ if (parsed.data.stream === true) {
135753
+ const rendered = async function* () {
135754
+ for await (const frame of frames()) {
135755
+ yield renderSseFrame2(frame);
135756
+ }
135757
+ };
135758
+ return {
135759
+ status: HTTP_STATUS.ok,
135760
+ headers: {
135761
+ "Content-Type": "text/event-stream",
135762
+ "Cache-Control": "no-cache",
135763
+ Connection: "keep-alive",
135764
+ ...quotaHeaders2
135765
+ },
135766
+ body: rendered(),
135767
+ ...served
135768
+ };
135769
+ }
135770
+ for await (const frame of frames()) {
135771
+ if (frame.event === "error") {
135772
+ return { status: HTTP_STATUS.badGateway, headers: { "Content-Type": "application/json" }, body: JSON.stringify(frame.data) };
135773
+ }
135774
+ }
135775
+ return { status: HTTP_STATUS.ok, headers: { "Content-Type": "application/json", ...quotaHeaders2 }, body: JSON.stringify(relay.message()), ...served };
135756
135776
  };
135757
135777
  }
135758
135778
 
package/dist/index.cjs CHANGED
@@ -4762,7 +4762,7 @@ var init_package = __esm({
4762
4762
  "package.json"() {
4763
4763
  package_default = {
4764
4764
  name: "agent-shim",
4765
- version: "11.71.1",
4765
+ version: "11.72.0",
4766
4766
  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.",
4767
4767
  license: "MIT",
4768
4768
  author: "Joseph Mearman <joseph@mearman.co.uk>",
package/dist/index.mjs CHANGED
@@ -4738,7 +4738,7 @@ var init_package = __esm({
4738
4738
  "package.json"() {
4739
4739
  package_default = {
4740
4740
  name: "agent-shim",
4741
- version: "11.71.1",
4741
+ version: "11.72.0",
4742
4742
  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.",
4743
4743
  license: "MIT",
4744
4744
  author: "Joseph Mearman <joseph@mearman.co.uk>",