priiisk 0.1.4 → 0.1.5

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.
@@ -8,13 +8,13 @@ import {
8
8
  makeDoctorReport,
9
9
  resolveCampSurface,
10
10
  withCampRpc
11
- } from "./chunk-XI3HWC7Q.js";
11
+ } from "./chunk-F5HRZ52I.js";
12
12
  import {
13
13
  PI_RUNTIME_VERSION,
14
14
  PiModelCatalogIssueCode,
15
15
  inspectPiModelCatalog,
16
16
  makePiOperatorResources
17
- } from "./chunk-44I2RCT5.js";
17
+ } from "./chunk-NBNWSCBX.js";
18
18
  import {
19
19
  CampHealthComponentStatus,
20
20
  CampHealthOverallStatus,
@@ -48,7 +48,7 @@ import {
48
48
  resolveCredentialsPath,
49
49
  resolveProjectScope,
50
50
  resolveWorkerConfigPath
51
- } from "./chunk-QX5EESCS.js";
51
+ } from "./chunk-LIJU6Y2U.js";
52
52
  import {
53
53
  Clock_exports,
54
54
  Effect_exports,
@@ -1152,7 +1152,7 @@ var numberArgument = (parameters, name) => {
1152
1152
  const value = parameters[name];
1153
1153
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
1154
1154
  };
1155
- var campUiExploredReadPath = (parameters) => stringArgument(parameters, "path") ?? stringArgument(parameters, "file_path");
1155
+ var campUiExploredReadPath = (parameters) => stringArgument(parameters, "path");
1156
1156
  var campUiExploredReadRange = (parameters) => {
1157
1157
  const offset = numberArgument(parameters, "offset");
1158
1158
  const limit = numberArgument(parameters, "limit");
@@ -1196,7 +1196,14 @@ var collectNodes = (reads) => {
1196
1196
  node.errorMessage = read.errorMessage;
1197
1197
  }
1198
1198
  }
1199
- return [...byPath.values()];
1199
+ const directoryOrder = /* @__PURE__ */ new Map();
1200
+ for (const node of byPath.values()) {
1201
+ if (!directoryOrder.has(node.directory))
1202
+ directoryOrder.set(node.directory, directoryOrder.size);
1203
+ }
1204
+ return [...byPath.values()].sort(
1205
+ (left, right) => (directoryOrder.get(left.directory) ?? 0) - (directoryOrder.get(right.directory) ?? 0)
1206
+ );
1200
1207
  };
1201
1208
  var toneByStatus = {
1202
1209
  completed: CampUiTone.success,
@@ -20,7 +20,7 @@ import {
20
20
  layerNet,
21
21
  makeCampSurfaceName,
22
22
  resolveProjectScopeSync
23
- } from "./chunk-QX5EESCS.js";
23
+ } from "./chunk-LIJU6Y2U.js";
24
24
  import {
25
25
  Clock_exports,
26
26
  Config_exports,
@@ -111,7 +111,7 @@ var CliSurfaceSelectionError = class extends Data_exports.TaggedError("CliSurfac
111
111
  import { randomUUID } from "node:crypto";
112
112
 
113
113
  // packages/cli/src/domain/cliVersion.ts
114
- var PRIIISK_CLI_VERSION = "0.1.4";
114
+ var PRIIISK_CLI_VERSION = "0.1.5";
115
115
 
116
116
  // packages/cli/src/client/campRpcConnection.ts
117
117
  var PRIIISK_CONTROLLER_ID_ENV = "PRIIISK_CONTROLLER_ID";
@@ -10643,16 +10643,42 @@ var currentDirectToolSandbox = () => {
10643
10643
  cached2 ??= detectDirectToolSandbox();
10644
10644
  return cached2;
10645
10645
  };
10646
+ var DIRECT_TOOL_SANDBOX_STATUS_FD = 3;
10646
10647
  var directToolSandboxCommand = (sandbox2, executablePath, args, options4) => sandbox2.kind === DirectToolSandboxKind.bubblewrap && sandbox2.command !== void 0 ? {
10647
10648
  command: sandbox2.command,
10648
- args: [...sandboxArguments(options4.cwd, true), executablePath, ...args]
10649
+ args: [
10650
+ "--json-status-fd",
10651
+ String(DIRECT_TOOL_SANDBOX_STATUS_FD),
10652
+ ...sandboxArguments(options4.cwd, true),
10653
+ executablePath,
10654
+ ...args
10655
+ ],
10656
+ statusFd: DIRECT_TOOL_SANDBOX_STATUS_FD
10649
10657
  } : { command: executablePath, args };
10650
- var isDirectToolSandboxFailure = (stderr3) => stderr3.startsWith("bwrap:");
10658
+ var parseDirectToolSandboxStatus = (status) => {
10659
+ let started = false;
10660
+ let exitCode3;
10661
+ for (const line of status.split("\n")) {
10662
+ const trimmed = line.trim();
10663
+ if (trimmed === "") continue;
10664
+ let document;
10665
+ try {
10666
+ document = JSON.parse(trimmed);
10667
+ } catch {
10668
+ continue;
10669
+ }
10670
+ if (typeof document !== "object" || document === null) continue;
10671
+ if ("child-pid" in document) started = true;
10672
+ const reported = document["exit-code"];
10673
+ if (typeof reported === "number") exitCode3 = reported;
10674
+ }
10675
+ return { started, ...exitCode3 === void 0 ? {} : { exitCode: exitCode3 } };
10676
+ };
10651
10677
  var describeDirectToolSandbox = (sandbox2) => sandbox2.kind === DirectToolSandboxKind.bubblewrap ? "External binaries run in a bubblewrap sandbox: read-only filesystem, writable worker directory, no network" : sandbox2.absence === DirectToolSandboxAbsence.disabled ? `External binaries run without an OS sandbox: disabled by ${DIRECT_TOOL_SANDBOX_ENV}` : sandbox2.absence === DirectToolSandboxAbsence.unsupportedPlatform ? `External binaries run without an OS sandbox: no supported mechanism on ${sandbox2.detail ?? "this platform"}` : sandbox2.absence === DirectToolSandboxAbsence.binaryMissing ? "External binaries run without an OS sandbox: bubblewrap (bwrap) is not installed" : "External binaries run without an OS sandbox: bubblewrap is present but cannot start";
10652
10678
 
10653
10679
  // packages/protocol/src/domain/protocolVersion.ts
10654
10680
  var PRIIISK_PROTOCOL_VERSION = "11";
10655
- var PRIIISK_PROTOCOL_PACKAGE_VERSION = "0.1.4";
10681
+ var PRIIISK_PROTOCOL_PACKAGE_VERSION = "0.1.5";
10656
10682
  var ProtocolVersionSchema = Schema_exports.String.pipe(Schema_exports.minLength(1));
10657
10683
 
10658
10684
  // packages/protocol/src/domain/protocolIdentifiers.ts
@@ -13527,7 +13553,7 @@ var CampProtocol = class extends RpcGroup_exports.make(
13527
13553
  };
13528
13554
 
13529
13555
  // packages/camp-state/src/bootstrap/campHostVersion.ts
13530
- var PRIIISK_HOST_VERSION = "0.1.4";
13556
+ var PRIIISK_HOST_VERSION = "0.1.5";
13531
13557
 
13532
13558
  // packages/surface/src/domain/surfaceModel.ts
13533
13559
  var NonEmptyString7 = Schema_exports.String.pipe(Schema_exports.minLength(1));
@@ -14909,7 +14935,7 @@ export {
14909
14935
  resolveExecutablePath,
14910
14936
  currentDirectToolSandbox,
14911
14937
  directToolSandboxCommand,
14912
- isDirectToolSandboxFailure,
14938
+ parseDirectToolSandboxStatus,
14913
14939
  describeDirectToolSandbox,
14914
14940
  NetSocket,
14915
14941
  fromDuplex,
@@ -3,7 +3,7 @@ const require = __priiiskCreateRequire(import.meta.url);
3
3
  import {
4
4
  FileSystem_exports,
5
5
  PRIIISK_PI_AGENT_DIR_ENV
6
- } from "./chunk-QX5EESCS.js";
6
+ } from "./chunk-LIJU6Y2U.js";
7
7
  import {
8
8
  CampDeliveryPort,
9
9
  CampFailureCode,
@@ -28,7 +28,7 @@ import {
28
28
  makePlatform,
29
29
  makeRunMain,
30
30
  stdin
31
- } from "./chunk-QX5EESCS.js";
31
+ } from "./chunk-LIJU6Y2U.js";
32
32
  import {
33
33
  BaseProto,
34
34
  __export,
@@ -84,7 +84,7 @@ import {
84
84
  selectCampRun,
85
85
  styleCampUiTone,
86
86
  uniqueCampUiNames
87
- } from "./chunk-62BTCFUO.js";
87
+ } from "./chunk-32R4IEGS.js";
88
88
  import "./chunk-KFSFN6L5.js";
89
89
  export {
90
90
  CAMP_UI_BASH_PREVIEW_LINES,
@@ -4,14 +4,14 @@ const require = __priiiskCreateRequire(import.meta.url);
4
4
  import {
5
5
  NodeContext_exports,
6
6
  NodeRuntime_exports
7
- } from "./chunk-GLWKYPVL.js";
7
+ } from "./chunk-Q7YCBJEO.js";
8
8
  import {
9
9
  CampUiBackendError,
10
10
  CampUiHealthStatus,
11
11
  CampUiPlacement,
12
12
  CampUiRuntimeStatus,
13
13
  mountPiCampUi
14
- } from "./chunk-62BTCFUO.js";
14
+ } from "./chunk-32R4IEGS.js";
15
15
  import {
16
16
  PiTransport,
17
17
  makePiOperatorResources,
@@ -19,7 +19,7 @@ import {
19
19
  makePiTransportLayer,
20
20
  requirePiModelCatalog,
21
21
  require_undici
22
- } from "./chunk-44I2RCT5.js";
22
+ } from "./chunk-NBNWSCBX.js";
23
23
  import {
24
24
  AgentRole,
25
25
  AgentRoleSchema,
@@ -73,11 +73,11 @@ import {
73
73
  fromDuplex,
74
74
  fromWebSocket,
75
75
  hostStoppedCampManifest,
76
- isDirectToolSandboxFailure,
77
76
  listWorkerModelCatalogEntries,
78
77
  loadCampManifest,
79
78
  loadReferencedMcpCredentials,
80
79
  loadWorkerConfig,
80
+ parseDirectToolSandboxStatus,
81
81
  prepareCampRunStorage,
82
82
  prepareCampStorage,
83
83
  projectScopeFromCwd,
@@ -100,7 +100,7 @@ import {
100
100
  runningCampManifest,
101
101
  saveCampHealth,
102
102
  saveCampManifest
103
- } from "./chunk-QX5EESCS.js";
103
+ } from "./chunk-LIJU6Y2U.js";
104
104
  import {
105
105
  CampAskRouter,
106
106
  CampCancellationCode,
@@ -11198,7 +11198,7 @@ var require_cross_spawn = __commonJS({
11198
11198
  var cp = __require("child_process");
11199
11199
  var parse3 = require_parse();
11200
11200
  var enoent = require_enoent();
11201
- function spawn2(command, args, options) {
11201
+ function spawn3(command, args, options) {
11202
11202
  const parsed = parse3(command, args, options);
11203
11203
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
11204
11204
  enoent.hookChildProcess(spawned, parsed);
@@ -11210,8 +11210,8 @@ var require_cross_spawn = __commonJS({
11210
11210
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
11211
11211
  return result;
11212
11212
  }
11213
- module.exports = spawn2;
11214
- module.exports.spawn = spawn2;
11213
+ module.exports = spawn3;
11214
+ module.exports.spawn = spawn3;
11215
11215
  module.exports.sync = spawnSync;
11216
11216
  module.exports._parse = parse3;
11217
11217
  module.exports._enoent = enoent;
@@ -22416,7 +22416,7 @@ var Client = class extends Protocol {
22416
22416
  };
22417
22417
 
22418
22418
  // packages/mcp-backend/src/connections/clientIdentity.ts
22419
- var backendVersion = "0.1.4";
22419
+ var backendVersion = "0.1.5";
22420
22420
 
22421
22421
  // packages/mcp-backend/src/connections/mcpFailure.ts
22422
22422
  var McpFailure = class extends Data_exports.TaggedError("McpFailure") {
@@ -26376,7 +26376,7 @@ var makeCampRpcServerLayer = (socketPath) => {
26376
26376
  };
26377
26377
 
26378
26378
  // packages/host/src/tools/directTools.ts
26379
- import { execFile } from "node:child_process";
26379
+ import { spawn as spawn2 } from "node:child_process";
26380
26380
 
26381
26381
  // packages/host/src/tools/directToolPolicy.ts
26382
26382
  var flagName = (argument) => {
@@ -26423,34 +26423,70 @@ var truncate = (value, limit) => {
26423
26423
  return encoded.byteLength <= limit ? { text: value, truncated: false } : { text: encoded.subarray(0, limit).toString("utf8"), truncated: true };
26424
26424
  };
26425
26425
  var binaryCandidates = (bin) => bin === "fd" ? ["fd", "fdfind"] : [bin];
26426
+ var collect = (stream, onOverflow) => {
26427
+ const chunks = [];
26428
+ let size = 0;
26429
+ let overflowed = false;
26430
+ stream?.on("data", (chunk) => {
26431
+ if (overflowed) return;
26432
+ size += chunk.byteLength;
26433
+ if (size > MAX_BUFFER_BYTES) {
26434
+ overflowed = true;
26435
+ onOverflow();
26436
+ return;
26437
+ }
26438
+ chunks.push(chunk);
26439
+ });
26440
+ return { text: () => Buffer.concat(chunks).toString("utf8") };
26441
+ };
26426
26442
  var runBinary = (executablePath, args, options, environment, signal) => {
26427
26443
  const sandbox = options.sandbox ?? currentDirectToolSandbox();
26428
26444
  const launch = directToolSandboxCommand(sandbox, executablePath, args, { cwd: options.cwd });
26445
+ const sandboxed = launch.statusFd !== void 0;
26429
26446
  return new Promise((resolve) => {
26430
- const child = execFile(
26431
- launch.command,
26432
- [...launch.args],
26433
- {
26434
- cwd: options.cwd,
26435
- env: environment,
26436
- timeout: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
26437
- maxBuffer: MAX_BUFFER_BYTES,
26438
- ...signal === void 0 ? {} : { signal }
26439
- },
26440
- (error2, stdout, stderr) => {
26441
- const failure = error2;
26442
- const sandboxed = launch.command !== executablePath;
26443
- resolve({
26444
- stdout,
26445
- stderr,
26446
- exitCode: typeof failure?.code === "number" ? failure.code : failure === null ? 0 : 1,
26447
- signal: child.signalCode ?? void 0,
26448
- timedOut: failure?.killed === true,
26449
- ...sandboxed && isDirectToolSandboxFailure(stderr) ? { sandboxFailed: true } : {},
26450
- ...typeof failure?.code === "string" && failure.code !== "" ? { launchError: `${failure.code}: ${failure.message}` } : {}
26451
- });
26452
- }
26447
+ const child = spawn2(launch.command, [...launch.args], {
26448
+ cwd: options.cwd,
26449
+ env: environment,
26450
+ stdio: sandboxed ? ["ignore", "pipe", "pipe", "pipe"] : ["ignore", "pipe", "pipe"],
26451
+ ...signal === void 0 ? {} : { signal }
26452
+ });
26453
+ let timedOut = false;
26454
+ let launchError;
26455
+ const stop = () => {
26456
+ child.kill("SIGTERM");
26457
+ };
26458
+ const stdout = collect(child.stdout, stop);
26459
+ const stderr = collect(child.stderr, stop);
26460
+ const status = collect(
26461
+ sandboxed ? child.stdio[launch.statusFd ?? 3] ?? null : null,
26462
+ stop
26453
26463
  );
26464
+ const timer = setTimeout(() => {
26465
+ timedOut = true;
26466
+ stop();
26467
+ }, options.timeoutMs ?? DEFAULT_TIMEOUT_MS);
26468
+ child.on("error", (cause) => {
26469
+ if (signal?.aborted === true || cause.name === "AbortError") return;
26470
+ launchError = `${cause.code ?? cause.name}: ${cause.message}`;
26471
+ });
26472
+ child.on("close", (code, terminatedBy) => {
26473
+ clearTimeout(timer);
26474
+ const sandboxStatus = sandboxed ? parseDirectToolSandboxStatus(status.text()) : void 0;
26475
+ resolve({
26476
+ stdout: stdout.text(),
26477
+ stderr: stderr.text(),
26478
+ exitCode: sandboxStatus?.exitCode ?? code ?? void 0,
26479
+ signal: terminatedBy ?? void 0,
26480
+ timedOut,
26481
+ /*
26482
+ * A sandbox that never reached the command is only a refusal when the
26483
+ * command was not stopped from the outside: a killed sandbox reports no
26484
+ * child either, and that is the timeout, not the boundary.
26485
+ */
26486
+ ...sandboxStatus !== void 0 && !sandboxStatus.started && !timedOut && launchError === void 0 ? { sandboxFailed: true } : {},
26487
+ ...launchError === void 0 ? {} : { launchError }
26488
+ });
26489
+ });
26454
26490
  });
26455
26491
  };
26456
26492
  var runWithFallback = async (policy, args, options, signal) => {
package/dist/priiisk.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  fromReadable,
6
6
  layer,
7
7
  runMain
8
- } from "./chunk-GLWKYPVL.js";
8
+ } from "./chunk-Q7YCBJEO.js";
9
9
  import {
10
10
  CliCampLifecycleError,
11
11
  CliEquipmentConflict,
@@ -23,7 +23,7 @@ import {
23
23
  resolveCampSurface,
24
24
  withCampRpc,
25
25
  withCampRpcSession
26
- } from "./chunk-XI3HWC7Q.js";
26
+ } from "./chunk-F5HRZ52I.js";
27
27
  import {
28
28
  CampCommandFailure,
29
29
  CampHostReadiness,
@@ -58,7 +58,7 @@ import {
58
58
  resolveProjectScopeSync,
59
59
  saveCampManifest,
60
60
  startingCampManifest
61
- } from "./chunk-QX5EESCS.js";
61
+ } from "./chunk-LIJU6Y2U.js";
62
62
  import {
63
63
  Cause_exports,
64
64
  CommitPrototype,
@@ -19903,7 +19903,7 @@ var campResumeListCommand = Command_exports.make(
19903
19903
  )
19904
19904
  ).pipe(Command_exports.withDescription("Lists saved runs of this project that resume can restore."));
19905
19905
  var runIdArgument = Args_exports.text({ name: "runId" }).pipe(Args_exports.optional);
19906
- var selectCampRunOnDemand = (items) => Effect_exports.promise(() => import("./chunk-JFAW425C.js")).pipe(
19906
+ var selectCampRunOnDemand = (items) => Effect_exports.promise(() => import("./chunk-TOVFB7H6.js")).pipe(
19907
19907
  Effect_exports.flatMap((ui) => ui.selectCampRun({ items }))
19908
19908
  );
19909
19909
  var selectAndResume = (json) => {
@@ -19976,7 +19976,7 @@ var rootCommand = Command_exports.make(
19976
19976
  ).pipe(Command_exports.withDescription("Runs and observes a camp of collaborating workers."));
19977
19977
 
19978
19978
  // packages/cli/src/commands/doctorCommand.ts
19979
- var runDoctorOnDemand = Effect_exports.promise(() => import("./chunk-GZTHKLSX.js")).pipe(
19979
+ var runDoctorOnDemand = Effect_exports.promise(() => import("./chunk-2RSY5TXT.js")).pipe(
19980
19980
  Effect_exports.flatMap((doctor) => doctor.runDoctor)
19981
19981
  );
19982
19982
  var statusLabel = {
@@ -20672,7 +20672,7 @@ var command = rootCommand.pipe(
20672
20672
  );
20673
20673
  var cli = Command_exports.run(command, {
20674
20674
  name: "priiisk camp control",
20675
- version: "0.1.4"
20675
+ version: "0.1.5"
20676
20676
  });
20677
20677
  var runCliCommand = (argumentsList) => cli(argumentsList).pipe(
20678
20678
  Effect_exports.matchEffect({
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "priiisk",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "CLI for running and observing a camp of collaborating agents",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "priiisk": "./dist/priiisk.js"
8
8
  },
9
9
  "files": [
10
- "dist/chunk-44I2RCT5.js",
11
- "dist/chunk-44I2RCT5.js.LEGAL.txt",
12
- "dist/chunk-62BTCFUO.js",
13
- "dist/chunk-GLWKYPVL.js",
14
- "dist/chunk-GZTHKLSX.js",
15
- "dist/chunk-JFAW425C.js",
10
+ "dist/chunk-2RSY5TXT.js",
11
+ "dist/chunk-32R4IEGS.js",
12
+ "dist/chunk-F5HRZ52I.js",
16
13
  "dist/chunk-KFSFN6L5.js",
17
- "dist/chunk-QX5EESCS.js",
18
- "dist/chunk-QX5EESCS.js.LEGAL.txt",
19
- "dist/chunk-XI3HWC7Q.js",
14
+ "dist/chunk-LIJU6Y2U.js",
15
+ "dist/chunk-LIJU6Y2U.js.LEGAL.txt",
16
+ "dist/chunk-NBNWSCBX.js",
17
+ "dist/chunk-NBNWSCBX.js.LEGAL.txt",
18
+ "dist/chunk-Q7YCBJEO.js",
19
+ "dist/chunk-TOVFB7H6.js",
20
20
  "dist/priiisk-host.js",
21
21
  "dist/priiisk.js",
22
22
  "profiles",