agentbox-sdk 0.1.313 → 0.1.315

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.
@@ -2,7 +2,7 @@ import {
2
2
  Agent,
3
3
  agentboxRoot,
4
4
  getAgentLayout
5
- } from "../chunk-ZJKJ7XFX.js";
5
+ } from "../chunk-V5KRPZXE.js";
6
6
  import "../chunk-2DH5OVG4.js";
7
7
  import {
8
8
  AGENT_RESERVED_PORTS,
@@ -3975,7 +3975,7 @@ async function ensureSandboxOpenCodeServer(request) {
3975
3975
  const launchCommand = [
3976
3976
  `mkdir -p ${shellQuote(target.layout.rootDir)}`,
3977
3977
  `(${[
3978
- `nohup ${[
3978
+ `setsid nohup ${[
3979
3979
  binary,
3980
3980
  "serve",
3981
3981
  "--hostname",
@@ -3983,20 +3983,19 @@ async function ensureSandboxOpenCodeServer(request) {
3983
3983
  "--port",
3984
3984
  String(port),
3985
3985
  ...options.provider?.args ?? []
3986
- ].map(shellQuote).join(" ")} > ${shellQuote(logFilePath)} 2>&1 &`,
3987
- `echo $! > ${shellQuote(pidFilePath)}`
3986
+ ].map(shellQuote).join(" ")} </dev/null > ${shellQuote(logFilePath)} 2>&1 &`,
3987
+ `echo $! > ${shellQuote(pidFilePath)}`,
3988
+ `disown 2>/dev/null || true`
3988
3989
  ].join(" ")})`
3989
3990
  ].join(" && ");
3990
3991
  const launchResult = await time(
3991
3992
  debugOpencode,
3992
3993
  "spawn opencode serve",
3993
- async () => {
3994
- const launchHandle = await sandbox.runAsync(launchCommand, {
3995
- cwd: options.cwd,
3996
- env: serveEnv
3997
- });
3998
- return launchHandle.wait();
3999
- }
3994
+ () => sandbox.run(launchCommand, {
3995
+ cwd: options.cwd,
3996
+ env: serveEnv,
3997
+ timeoutMs: 1e4
3998
+ })
4000
3999
  );
4001
4000
  if (launchResult.exitCode !== 0) {
4002
4001
  await target.cleanup().catch(() => void 0);
@@ -4141,6 +4140,7 @@ var OpenCodeAgentAdapter = class {
4141
4140
  let streamedTextFromSse = "";
4142
4141
  const assistantTextByMessageId = /* @__PURE__ */ new Map();
4143
4142
  const announcedAssistantCompletions = /* @__PURE__ */ new Set();
4143
+ const partTypeById = /* @__PURE__ */ new Map();
4144
4144
  let dispatchError;
4145
4145
  let firstSseEventLogged = false;
4146
4146
  let sendToSession;
@@ -4391,16 +4391,28 @@ var OpenCodeAgentAdapter = class {
4391
4391
  resolveSessionTerminal();
4392
4392
  }
4393
4393
  }
4394
+ if (payloadRecord?.type === "message.part.updated") {
4395
+ const properties = payloadRecord.properties;
4396
+ const part = properties?.part;
4397
+ if (part && typeof part.id === "string" && typeof part.type === "string") {
4398
+ partTypeById.set(part.id, part.type);
4399
+ }
4400
+ }
4394
4401
  if (payloadRecord?.type === "message.part.delta") {
4395
4402
  const properties = payloadRecord.properties;
4396
4403
  const eventSessionId = typeof properties?.sessionID === "string" ? properties.sessionID : void 0;
4397
4404
  const eventMessageId = typeof properties?.messageID === "string" ? properties.messageID : void 0;
4405
+ const eventPartId = typeof properties?.partID === "string" ? properties.partID : void 0;
4398
4406
  const isForeignSession = eventSessionId !== void 0 && eventSessionId !== sessionId || eventSessionId === void 0 && eventMessageId !== void 0 && foreignMessageIds.has(eventMessageId);
4399
4407
  if (isForeignSession) {
4400
4408
  continue;
4401
4409
  }
4402
4410
  const delta = typeof properties?.delta === "string" ? properties.delta : "";
4403
- if (delta && properties?.field === "text") {
4411
+ const field = typeof properties?.field === "string" ? properties.field : void 0;
4412
+ const partType = eventPartId ? partTypeById.get(eventPartId) : void 0;
4413
+ const isTextDelta = field === "text" && partType !== "reasoning";
4414
+ const isReasoningDelta = field === "text" && partType === "reasoning" || field === "reasoning_content" || field === "reasoning_details";
4415
+ if (delta && isTextDelta) {
4404
4416
  streamedTextFromSse += delta;
4405
4417
  if (eventMessageId) {
4406
4418
  assistantTextByMessageId.set(
@@ -4419,7 +4431,7 @@ var OpenCodeAgentAdapter = class {
4419
4431
  { delta }
4420
4432
  )
4421
4433
  );
4422
- } else if (delta && (properties?.field === "reasoning" || properties?.field === "thinking")) {
4434
+ } else if (delta && isReasoningDelta) {
4423
4435
  sink.emitEvent(
4424
4436
  createNormalizedEvent(
4425
4437
  "reasoning.delta",
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  Agent,
3
3
  agentboxRoot,
4
4
  getAgentLayout
5
- } from "./chunk-ZJKJ7XFX.js";
5
+ } from "./chunk-V5KRPZXE.js";
6
6
  import {
7
7
  ProviderLogAssembler,
8
8
  createNormalizedEvent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentbox-sdk",
3
- "version": "0.1.313",
3
+ "version": "0.1.315",
4
4
  "description": "Swappable coding agents and sandbox providers for Bun and TypeScript.",
5
5
  "license": "MIT",
6
6
  "repository": {