@alook/daemon 0.1.64 → 0.1.65

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/index.js CHANGED
@@ -23250,11 +23250,11 @@ async function readShellEnvironment(options = {}) {
23250
23250
  const child = (options.spawnProcess ?? spawn)(command.file, command.args, { env: command.env, argv0: command.argv0, detached: platform !== "win32", windowsHide: true, stdio: ["ignore", "pipe", "ignore"] });
23251
23251
  const chunks = [];
23252
23252
  let bytes = 0;
23253
- let failed = false;
23254
- const fail = () => {
23255
- if (failed)
23253
+ let failure;
23254
+ const fail = (cause) => {
23255
+ if (failure)
23256
23256
  return;
23257
- failed = true;
23257
+ failure = cause;
23258
23258
  if (child.pid) {
23259
23259
  if (platform === "win32") {
23260
23260
  const killer = spawn("taskkill", ["/pid", String(child.pid), "/T", "/F"], { windowsHide: true, stdio: "ignore" });
@@ -23268,28 +23268,28 @@ async function readShellEnvironment(options = {}) {
23268
23268
  }
23269
23269
  }
23270
23270
  };
23271
- const timeout = setTimeout(fail, options.timeoutMs ?? 5000);
23271
+ const timeout = setTimeout(() => fail("timeout"), options.timeoutMs ?? 5000);
23272
23272
  child.stdout.on("data", (data) => {
23273
23273
  bytes += data.length;
23274
23274
  if (bytes > MAX_BYTES)
23275
- fail();
23275
+ fail("output_limit");
23276
23276
  else
23277
23277
  chunks.push(data);
23278
23278
  });
23279
23279
  child.once("error", () => {
23280
23280
  clearTimeout(timeout);
23281
- reject(new Error("environment_unavailable"));
23281
+ reject(new Error("environment_unavailable", { cause: failure ?? "child_error" }));
23282
23282
  });
23283
23283
  child.once("close", (code) => {
23284
23284
  clearTimeout(timeout);
23285
- if (failed || code !== 0) {
23286
- reject(new Error("environment_unavailable"));
23285
+ if (failure || code !== 0) {
23286
+ reject(new Error("environment_unavailable", { cause: failure ?? "exit" }));
23287
23287
  return;
23288
23288
  }
23289
23289
  try {
23290
23290
  resolve(parseShellEnvironment(Buffer.concat(chunks), platform));
23291
23291
  } catch {
23292
- reject(new Error("environment_unavailable"));
23292
+ reject(new Error("environment_unavailable", { cause: "parse" }));
23293
23293
  }
23294
23294
  });
23295
23295
  });
@@ -23340,6 +23340,7 @@ import { homedir as homedir3 } from "node:os";
23340
23340
 
23341
23341
  // agent-driver/dist/controller/process-host.js
23342
23342
  import { EventEmitter } from "events";
23343
+ import { StringDecoder } from "node:string_decoder";
23343
23344
 
23344
23345
  // agent-driver/dist/internal/killTree.js
23345
23346
  import { execFileSync as execFileSync2, spawn as spawn2 } from "child_process";
@@ -24182,7 +24183,8 @@ class ProcessLane {
24182
24183
  events = new EventEmitter;
24183
24184
  process = null;
24184
24185
  started = false;
24185
- stdoutBuffer = "";
24186
+ stdoutDecoder = new StringDecoder("utf8");
24187
+ stdoutFragments = [];
24186
24188
  requestedStopReason;
24187
24189
  admissionSequence = 0;
24188
24190
  activeTerminalReceipt;
@@ -24391,12 +24393,20 @@ class ProcessLane {
24391
24393
  }
24392
24394
  attachProcess(proc) {
24393
24395
  proc.stdout?.on("data", (chunk) => {
24394
- const chunkText = chunk.toString();
24395
- this.events.emit("stdout", chunkText);
24396
- this.stdoutBuffer += chunkText;
24397
- const lines = this.stdoutBuffer.split(`
24398
- `);
24399
- this.stdoutBuffer = lines.pop() || "";
24396
+ this.events.emit("stdout", chunk.toString());
24397
+ const chunkText = Buffer.isBuffer(chunk) ? this.stdoutDecoder.write(chunk) : chunk.toString();
24398
+ const lines = [];
24399
+ let offset = 0;
24400
+ for (let newline = chunkText.indexOf(`
24401
+ `);newline !== -1; newline = chunkText.indexOf(`
24402
+ `, offset)) {
24403
+ this.stdoutFragments.push(chunkText.slice(offset, newline));
24404
+ lines.push(this.stdoutFragments.join(""));
24405
+ this.stdoutFragments = [];
24406
+ offset = newline + 1;
24407
+ }
24408
+ if (offset < chunkText.length)
24409
+ this.stdoutFragments.push(chunkText.slice(offset));
24400
24410
  for (const line of lines) {
24401
24411
  if (!line.trim())
24402
24412
  continue;
@@ -27972,7 +27982,7 @@ class CodexDriver {
27972
27982
  if (f.fastMode)
27973
27983
  freshParams.serviceTier = "fast";
27974
27984
  if (resuming) {
27975
- proc.stdin?.write(jsonRpcRequest("thread/resume", { ...freshParams, threadId: ctx.config.sessionId }, this.nextRequestId()) + `
27985
+ proc.stdin?.write(jsonRpcRequest("thread/resume", { ...freshParams, threadId: ctx.config.sessionId, excludeTurns: true }, this.nextRequestId()) + `
27976
27986
  `);
27977
27987
  } else {
27978
27988
  proc.stdin?.write(jsonRpcRequest("thread/start", freshParams, this.nextRequestId()) + `
@@ -28988,7 +28998,7 @@ class CursorAcpLane {
28988
28998
  }
28989
28999
 
28990
29000
  // agent-driver/dist/internal/discovery-process.js
28991
- import { StringDecoder } from "node:string_decoder";
29001
+ import { StringDecoder as StringDecoder2 } from "node:string_decoder";
28992
29002
  function toBuffer(chunk) {
28993
29003
  if (Buffer.isBuffer(chunk))
28994
29004
  return chunk;
@@ -29008,7 +29018,7 @@ function onStream(stream, event, listener) {
29008
29018
  }
29009
29019
  function runBoundedDiscoveryProcess(options) {
29010
29020
  return new Promise((resolve3, reject) => {
29011
- const decoder = new StringDecoder("utf8");
29021
+ const decoder = new StringDecoder2("utf8");
29012
29022
  let settled = false;
29013
29023
  let decoderEnded = false;
29014
29024
  let outputBytes = 0;
@@ -32846,7 +32856,7 @@ function resolveOptionalPackage(name, locations = installationLocations()) {
32846
32856
  // agent-driver/dist/internal/sdk-worker-lane.js
32847
32857
  import { EventEmitter as EventEmitter7 } from "node:events";
32848
32858
  import { mkdtempSync, rmSync, writeFileSync as writeFileSync3 } from "node:fs";
32849
- import { StringDecoder as StringDecoder2 } from "node:string_decoder";
32859
+ import { StringDecoder as StringDecoder3 } from "node:string_decoder";
32850
32860
  import { tmpdir } from "node:os";
32851
32861
  import { join as join13 } from "node:path";
32852
32862
  import { pathToFileURL as pathToFileURL2 } from "node:url";
@@ -32960,8 +32970,8 @@ class SdkWorkerLane {
32960
32970
  sequence = 0;
32961
32971
  sessionId = null;
32962
32972
  buffer = "";
32963
- stdoutDecoder = new StringDecoder2("utf8");
32964
- stderrDecoder = new StringDecoder2("utf8");
32973
+ stdoutDecoder = new StringDecoder3("utf8");
32974
+ stderrDecoder = new StringDecoder3("utf8");
32965
32975
  started = false;
32966
32976
  stopping = false;
32967
32977
  exited = false;
@@ -58725,6 +58735,7 @@ var ProviderQuotaSnapshotSchema = exports_external.object({
58725
58735
  agentBackendId: exports_external.enum(["claude", "codex", "grok", "antigravity"]),
58726
58736
  observation: ProviderQuotaObservationSchema
58727
58737
  }).strict();
58738
+ var ProviderQuotaSnapshotListSchema = exports_external.array(ProviderQuotaSnapshotSchema).refine((snapshots) => new Set(snapshots.map((snapshot) => snapshot.agentBackendId)).size === snapshots.length, { message: "duplicate provider quota backend" });
58728
58739
 
58729
58740
  // ../shared/src/lib/community-name.ts
58730
58741
  var FORBIDDEN_NAME_CHARS = /[#@\x00-\x1f\x7f-\x9f]/;
@@ -59345,7 +59356,7 @@ var HostReadyMessageSchema = exports_external.object({
59345
59356
  osRelease: exports_external.string().optional(),
59346
59357
  daemonVersion: exports_external.string().optional(),
59347
59358
  timeZone: exports_external.string().min(1).max(128).optional(),
59348
- providerQuotas: exports_external.array(ProviderQuotaSnapshotSchema).max(4).optional().default([])
59359
+ providerQuotas: ProviderQuotaSnapshotListSchema.optional().default([])
59349
59360
  });
59350
59361
  var CommunityDaemonReadySchema = exports_external.object({
59351
59362
  runtimeReport: CommunityMachineRuntimeListSchema.optional(),
package/dist/index.js CHANGED
@@ -23191,6 +23191,7 @@ import { homedir as homedir3 } from "node:os";
23191
23191
 
23192
23192
  // agent-driver/dist/controller/process-host.js
23193
23193
  import { EventEmitter } from "events";
23194
+ import { StringDecoder } from "node:string_decoder";
23194
23195
 
23195
23196
  // agent-driver/dist/internal/killTree.js
23196
23197
  import { execFileSync as execFileSync2, spawn } from "child_process";
@@ -24033,7 +24034,8 @@ class ProcessLane {
24033
24034
  events = new EventEmitter;
24034
24035
  process = null;
24035
24036
  started = false;
24036
- stdoutBuffer = "";
24037
+ stdoutDecoder = new StringDecoder("utf8");
24038
+ stdoutFragments = [];
24037
24039
  requestedStopReason;
24038
24040
  admissionSequence = 0;
24039
24041
  activeTerminalReceipt;
@@ -24242,12 +24244,20 @@ class ProcessLane {
24242
24244
  }
24243
24245
  attachProcess(proc) {
24244
24246
  proc.stdout?.on("data", (chunk) => {
24245
- const chunkText = chunk.toString();
24246
- this.events.emit("stdout", chunkText);
24247
- this.stdoutBuffer += chunkText;
24248
- const lines = this.stdoutBuffer.split(`
24249
- `);
24250
- this.stdoutBuffer = lines.pop() || "";
24247
+ this.events.emit("stdout", chunk.toString());
24248
+ const chunkText = Buffer.isBuffer(chunk) ? this.stdoutDecoder.write(chunk) : chunk.toString();
24249
+ const lines = [];
24250
+ let offset = 0;
24251
+ for (let newline = chunkText.indexOf(`
24252
+ `);newline !== -1; newline = chunkText.indexOf(`
24253
+ `, offset)) {
24254
+ this.stdoutFragments.push(chunkText.slice(offset, newline));
24255
+ lines.push(this.stdoutFragments.join(""));
24256
+ this.stdoutFragments = [];
24257
+ offset = newline + 1;
24258
+ }
24259
+ if (offset < chunkText.length)
24260
+ this.stdoutFragments.push(chunkText.slice(offset));
24251
24261
  for (const line of lines) {
24252
24262
  if (!line.trim())
24253
24263
  continue;
@@ -27823,7 +27833,7 @@ class CodexDriver {
27823
27833
  if (f.fastMode)
27824
27834
  freshParams.serviceTier = "fast";
27825
27835
  if (resuming) {
27826
- proc.stdin?.write(jsonRpcRequest("thread/resume", { ...freshParams, threadId: ctx.config.sessionId }, this.nextRequestId()) + `
27836
+ proc.stdin?.write(jsonRpcRequest("thread/resume", { ...freshParams, threadId: ctx.config.sessionId, excludeTurns: true }, this.nextRequestId()) + `
27827
27837
  `);
27828
27838
  } else {
27829
27839
  proc.stdin?.write(jsonRpcRequest("thread/start", freshParams, this.nextRequestId()) + `
@@ -28839,7 +28849,7 @@ class CursorAcpLane {
28839
28849
  }
28840
28850
 
28841
28851
  // agent-driver/dist/internal/discovery-process.js
28842
- import { StringDecoder } from "node:string_decoder";
28852
+ import { StringDecoder as StringDecoder2 } from "node:string_decoder";
28843
28853
  function toBuffer(chunk) {
28844
28854
  if (Buffer.isBuffer(chunk))
28845
28855
  return chunk;
@@ -28859,7 +28869,7 @@ function onStream(stream, event, listener) {
28859
28869
  }
28860
28870
  function runBoundedDiscoveryProcess(options) {
28861
28871
  return new Promise((resolve3, reject) => {
28862
- const decoder = new StringDecoder("utf8");
28872
+ const decoder = new StringDecoder2("utf8");
28863
28873
  let settled = false;
28864
28874
  let decoderEnded = false;
28865
28875
  let outputBytes = 0;
@@ -32697,7 +32707,7 @@ function resolveOptionalPackage(name, locations = installationLocations()) {
32697
32707
  // agent-driver/dist/internal/sdk-worker-lane.js
32698
32708
  import { EventEmitter as EventEmitter7 } from "node:events";
32699
32709
  import { mkdtempSync, rmSync, writeFileSync as writeFileSync3 } from "node:fs";
32700
- import { StringDecoder as StringDecoder2 } from "node:string_decoder";
32710
+ import { StringDecoder as StringDecoder3 } from "node:string_decoder";
32701
32711
  import { tmpdir } from "node:os";
32702
32712
  import { join as join13 } from "node:path";
32703
32713
  import { pathToFileURL as pathToFileURL2 } from "node:url";
@@ -32811,8 +32821,8 @@ class SdkWorkerLane {
32811
32821
  sequence = 0;
32812
32822
  sessionId = null;
32813
32823
  buffer = "";
32814
- stdoutDecoder = new StringDecoder2("utf8");
32815
- stderrDecoder = new StringDecoder2("utf8");
32824
+ stdoutDecoder = new StringDecoder3("utf8");
32825
+ stderrDecoder = new StringDecoder3("utf8");
32816
32826
  started = false;
32817
32827
  stopping = false;
32818
32828
  exited = false;
@@ -60204,6 +60214,7 @@ var ProviderQuotaSnapshotSchema = exports_external.object({
60204
60214
  agentBackendId: exports_external.enum(["claude", "codex", "grok", "antigravity"]),
60205
60215
  observation: ProviderQuotaObservationSchema
60206
60216
  }).strict();
60217
+ var ProviderQuotaSnapshotListSchema = exports_external.array(ProviderQuotaSnapshotSchema).refine((snapshots) => new Set(snapshots.map((snapshot) => snapshot.agentBackendId)).size === snapshots.length, { message: "duplicate provider quota backend" });
60207
60218
 
60208
60219
  // ../shared/src/lib/community-name.ts
60209
60220
  var FORBIDDEN_NAME_CHARS = /[#@\x00-\x1f\x7f-\x9f]/;
@@ -60824,7 +60835,7 @@ var HostReadyMessageSchema = exports_external.object({
60824
60835
  osRelease: exports_external.string().optional(),
60825
60836
  daemonVersion: exports_external.string().optional(),
60826
60837
  timeZone: exports_external.string().min(1).max(128).optional(),
60827
- providerQuotas: exports_external.array(ProviderQuotaSnapshotSchema).max(4).optional().default([])
60838
+ providerQuotas: ProviderQuotaSnapshotListSchema.optional().default([])
60828
60839
  });
60829
60840
  var CommunityDaemonReadySchema = exports_external.object({
60830
60841
  runtimeReport: CommunityMachineRuntimeListSchema.optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alook/daemon",
3
- "version": "0.1.64",
3
+ "version": "0.1.65",
4
4
  "description": "Alook agent daemon — host-side runtime backend, process manager, credential proxy, and control plane.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/alookai/alook#readme",