@plot-ai/linux-x64-musl 0.0.1 → 0.0.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/bin/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # changelog
2
2
 
3
- ## 0.0.1
3
+ ## 0.0.3
4
4
 
5
5
  - packaged plot-ai release
package/bin/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plot-ai/linux-x64-musl",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "piConfig": {
5
5
  "name": "plot",
6
6
  "configDir": ".plot"
package/bin/plot-ai CHANGED
Binary file
package/bin/tui-worker.js CHANGED
@@ -148024,7 +148024,7 @@ var require_lib4 = __commonJS((exports, module2) => {
148024
148024
  // packages/plot/src/tui-worker.ts
148025
148025
  import { Console } from "console";
148026
148026
  import { createWriteStream as createWriteStream5, mkdirSync as mkdirSync9, readFileSync as readFileSync22 } from "fs";
148027
- import { dirname as dirname20 } from "path";
148027
+ import { dirname as dirname21 } from "path";
148028
148028
 
148029
148029
  // node_modules/.bun/effect@3.19.19/node_modules/effect/dist/esm/Function.js
148030
148030
  var isFunction = (input) => typeof input === "function";
@@ -194228,8 +194228,8 @@ class ObservabilityApi extends exports_Effect.Service()("ObservabilityApi", {
194228
194228
  }
194229
194229
 
194230
194230
  // packages/plot/src/runtime-builder.ts
194231
- import { existsSync as existsSync24, readdirSync as readdirSync12 } from "fs";
194232
- import { dirname as dirname19, join as join34, resolve as resolve14 } from "path";
194231
+ import { existsSync as existsSync25, readdirSync as readdirSync12 } from "fs";
194232
+ import { dirname as dirname20, join as join35, resolve as resolve14 } from "path";
194233
194233
  import { fileURLToPath as fileURLToPath6 } from "url";
194234
194234
 
194235
194235
  // node_modules/.bun/@effect+platform-bun@0.87.1+6d9c3e47916ac965/node_modules/@effect/platform-bun/dist/esm/BunContext.js
@@ -290688,9 +290688,189 @@ var PiAgentLive = exports_Layer.succeed(AgentService, AgentService.of({
290688
290688
  run: (config2) => createEventStream(config2)
290689
290689
  }));
290690
290690
  // packages/plot/src/tracker/beads/index.ts
290691
+ import { execFile as execFile2 } from "child_process";
290692
+ import { promisify as promisify2 } from "util";
290693
+
290694
+ // packages/plot/src/tracker/beads/daemon-transport.ts
290691
290695
  import { execFile } from "child_process";
290696
+ import { existsSync as existsSync24 } from "fs";
290697
+ import { homedir as homedir14 } from "os";
290698
+ import { dirname as dirname19, join as join34 } from "path";
290699
+ import { createConnection } from "net";
290692
290700
  import { promisify } from "util";
290693
290701
  var execFileAsync = promisify(execFile);
290702
+ function walkUp(startDir, filename, globalFallback = false) {
290703
+ let dir = startDir;
290704
+ while (true) {
290705
+ const candidate = join34(dir, ".beads", filename);
290706
+ if (existsSync24(candidate))
290707
+ return candidate;
290708
+ const parent = dirname19(dir);
290709
+ if (parent === dir)
290710
+ break;
290711
+ dir = parent;
290712
+ }
290713
+ if (globalFallback) {
290714
+ const globalPath = join34(homedir14(), ".beads", filename);
290715
+ if (existsSync24(globalPath))
290716
+ return globalPath;
290717
+ }
290718
+ return null;
290719
+ }
290720
+ function findSocketPath(workspaceRoot) {
290721
+ return walkUp(workspaceRoot, "bd.sock", true);
290722
+ }
290723
+ function findBeadsDirectory(workspaceRoot) {
290724
+ let dir = workspaceRoot;
290725
+ while (true) {
290726
+ const candidate = join34(dir, ".beads");
290727
+ if (existsSync24(candidate))
290728
+ return candidate;
290729
+ const parent = dirname19(dir);
290730
+ if (parent === dir)
290731
+ break;
290732
+ dir = parent;
290733
+ }
290734
+ return null;
290735
+ }
290736
+
290737
+ class BeadsDaemonTransport {
290738
+ workspaceRoot;
290739
+ requestTimeoutMs;
290740
+ actor;
290741
+ socketPath = null;
290742
+ constructor(workspaceRoot, requestTimeoutMs = 5000, actor = "plot") {
290743
+ this.workspaceRoot = workspaceRoot;
290744
+ this.requestTimeoutMs = requestTimeoutMs;
290745
+ this.actor = actor;
290746
+ }
290747
+ async listAllIssues() {
290748
+ return this.send("list", { status: "all" });
290749
+ }
290750
+ async listOpenIssues() {
290751
+ return this.send("list", { limit: 0 });
290752
+ }
290753
+ async viewIssue(id3) {
290754
+ return this.send("show", { id: id3 });
290755
+ }
290756
+ async send(operation, args2) {
290757
+ const socketPath = await this.ensureRunning();
290758
+ return await new Promise((resolve14, reject) => {
290759
+ const socket = createConnection(socketPath);
290760
+ let responseData = "";
290761
+ let settled = false;
290762
+ const settle = (fn2, value6) => {
290763
+ if (settled)
290764
+ return;
290765
+ settled = true;
290766
+ clearTimeout(timeout5);
290767
+ fn2(value6);
290768
+ };
290769
+ const handleResponse = (raw2) => {
290770
+ const trimmed2 = raw2.trim();
290771
+ if (!trimmed2) {
290772
+ settle(reject, new Error("beads daemon returned empty response"));
290773
+ return;
290774
+ }
290775
+ try {
290776
+ const response = JSON.parse(trimmed2);
290777
+ if (response.success) {
290778
+ settle(resolve14, response.data);
290779
+ return;
290780
+ }
290781
+ settle(reject, new Error(response.error ?? "unknown beads daemon error"));
290782
+ } catch {
290783
+ settle(reject, new Error(`failed to parse beads daemon response: ${trimmed2}`));
290784
+ }
290785
+ };
290786
+ const timeout5 = setTimeout(() => {
290787
+ socket.destroy();
290788
+ settle(reject, new Error(`beads daemon request timed out after ${this.requestTimeoutMs}ms`));
290789
+ }, this.requestTimeoutMs);
290790
+ socket.on("connect", () => {
290791
+ socket.write(JSON.stringify({
290792
+ operation,
290793
+ args: args2,
290794
+ cwd: this.workspaceRoot,
290795
+ actor: this.actor
290796
+ }) + `
290797
+ `);
290798
+ });
290799
+ socket.on("data", (chunk5) => {
290800
+ responseData += chunk5.toString();
290801
+ if (responseData.includes(`
290802
+ `)) {
290803
+ socket.destroy();
290804
+ handleResponse(responseData);
290805
+ }
290806
+ });
290807
+ socket.on("end", () => {
290808
+ if (!settled && responseData.length > 0) {
290809
+ handleResponse(responseData);
290810
+ return;
290811
+ }
290812
+ if (!settled) {
290813
+ settle(reject, new Error("beads daemon closed connection without a response"));
290814
+ }
290815
+ });
290816
+ socket.on("error", (error4) => {
290817
+ this.socketPath = null;
290818
+ settle(reject, new Error(`beads daemon connection error: ${error4.message}`));
290819
+ });
290820
+ });
290821
+ }
290822
+ async ensureRunning() {
290823
+ if (this.socketPath)
290824
+ return this.socketPath;
290825
+ const found = findSocketPath(this.workspaceRoot);
290826
+ if (found) {
290827
+ this.socketPath = found;
290828
+ return found;
290829
+ }
290830
+ await this.startDaemon();
290831
+ if (!this.socketPath)
290832
+ throw new Error("beads daemon socket unavailable");
290833
+ return this.socketPath;
290834
+ }
290835
+ async startDaemon() {
290836
+ const beadsDirectory = findBeadsDirectory(this.workspaceRoot);
290837
+ if (!beadsDirectory) {
290838
+ throw new Error("no .beads directory found");
290839
+ }
290840
+ await execFileAsync("bd", ["daemon", "start"], {
290841
+ cwd: this.workspaceRoot,
290842
+ maxBuffer: 50 * 1024 * 1024
290843
+ });
290844
+ const expectedSocketPath = join34(beadsDirectory, "bd.sock");
290845
+ await new Promise((resolve14, reject) => {
290846
+ const startedAt = Date.now();
290847
+ const timer = setInterval(() => {
290848
+ if (existsSync24(expectedSocketPath)) {
290849
+ clearInterval(timer);
290850
+ this.socketPath = expectedSocketPath;
290851
+ resolve14();
290852
+ return;
290853
+ }
290854
+ if (Date.now() - startedAt >= this.requestTimeoutMs) {
290855
+ clearInterval(timer);
290856
+ reject(new Error(`beads daemon socket did not appear within ${this.requestTimeoutMs}ms`));
290857
+ }
290858
+ }, 100);
290859
+ });
290860
+ }
290861
+ }
290862
+ async function tryCreateBeadsDaemonTransport(workspaceRoot) {
290863
+ const transport = new BeadsDaemonTransport(workspaceRoot);
290864
+ try {
290865
+ await transport.listAllIssues();
290866
+ return transport;
290867
+ } catch {
290868
+ return null;
290869
+ }
290870
+ }
290871
+
290872
+ // packages/plot/src/tracker/beads/index.ts
290873
+ var execFileAsync2 = promisify2(execFile2);
290694
290874
  var normalizeState2 = (s) => s.trim().toLowerCase();
290695
290875
  function mapBdFailure(error4, resourceId) {
290696
290876
  const message = error4 instanceof Error ? error4.message : String(error4);
@@ -290709,36 +290889,65 @@ function mapBdFailure(error4, resourceId) {
290709
290889
  }
290710
290890
  return new Error(`bd command failed: ${details}`);
290711
290891
  }
290712
- function createBeadsOps(config2) {
290892
+ async function createBeadsOps(config2) {
290893
+ const workspaceRoot = config2.beadsDir ?? process.cwd();
290894
+ const daemon = await tryCreateBeadsDaemonTransport(workspaceRoot);
290713
290895
  const runBd = async (args2, options5) => {
290714
290896
  try {
290715
- return await execFileAsync("bd", args2, {
290897
+ return await execFileAsync2("bd", args2, {
290716
290898
  maxBuffer: 50 * 1024 * 1024,
290717
- ...config2.beadsDir ? { cwd: config2.beadsDir } : {}
290899
+ cwd: workspaceRoot
290718
290900
  });
290719
290901
  } catch (error4) {
290720
290902
  throw mapBdFailure(error4, options5?.resourceId);
290721
290903
  }
290722
290904
  };
290905
+ const parseIssueList = (value6) => value6;
290906
+ const parseDetailedIssue = (value6, id3) => {
290907
+ const issue2 = Array.isArray(value6) ? value6[0] : value6;
290908
+ if (!issue2)
290909
+ throw new Error(`bd show returned empty result for ${id3}`);
290910
+ return issue2;
290911
+ };
290912
+ const runDaemon = async (operation) => {
290913
+ if (!daemon)
290914
+ return null;
290915
+ try {
290916
+ return await operation(daemon);
290917
+ } catch {
290918
+ return null;
290919
+ }
290920
+ };
290723
290921
  const listIssues = async (status3) => {
290922
+ const daemonResult = await runDaemon((transport) => transport.listAllIssues());
290923
+ if (daemonResult) {
290924
+ if (status3 === "all")
290925
+ return daemonResult;
290926
+ return daemonResult.filter((issue2) => normalizeState2(issue2.status) === normalizeState2(status3));
290927
+ }
290724
290928
  const result = await runBd(["list", "--json", "--status", status3]);
290725
- return JSON.parse(result.stdout);
290929
+ return parseIssueList(JSON.parse(result.stdout));
290726
290930
  };
290727
290931
  const listAllIssues = async () => {
290932
+ const daemonResult = await runDaemon((transport) => transport.listAllIssues());
290933
+ if (daemonResult)
290934
+ return daemonResult;
290728
290935
  const result = await runBd(["list", "--json", "--status", "all"]);
290729
- return JSON.parse(result.stdout);
290936
+ return parseIssueList(JSON.parse(result.stdout));
290730
290937
  };
290731
290938
  const listOpenIssues = async () => {
290939
+ const daemonResult = await runDaemon((transport) => transport.listOpenIssues());
290940
+ if (daemonResult)
290941
+ return daemonResult;
290732
290942
  const result = await runBd(["list", "--json", "--limit", "0"]);
290733
- return JSON.parse(result.stdout);
290943
+ return parseIssueList(JSON.parse(result.stdout));
290734
290944
  };
290735
290945
  const viewIssue = async (id3) => {
290946
+ const daemonResult = await runDaemon((transport) => transport.viewIssue(id3));
290947
+ if (daemonResult)
290948
+ return parseDetailedIssue(daemonResult, id3);
290736
290949
  const result = await runBd(["show", id3, "--json"], { resourceId: id3 });
290737
- const parsed = JSON.parse(result.stdout);
290738
- const issue2 = Array.isArray(parsed) ? parsed[0] : parsed;
290739
- if (!issue2)
290740
- throw new Error(`bd show returned empty result for ${id3}`);
290741
- return issue2;
290950
+ return parseDetailedIssue(JSON.parse(result.stdout), id3);
290742
290951
  };
290743
290952
  const mapState = (bd) => {
290744
290953
  const labelNames = (bd.labels ?? []).map((l) => normalizeState2(l));
@@ -290801,7 +291010,7 @@ var plugin2 = {
290801
291010
  ...config2.parkedStates ?? [],
290802
291011
  ...config2.terminalStates ?? []
290803
291012
  ].filter((s, i, arr) => arr.indexOf(s) === i);
290804
- const ops = createBeadsOps({
291013
+ const ops = await createBeadsOps({
290805
291014
  beadsDir: config2.beadsDir,
290806
291015
  allStates
290807
291016
  });
@@ -290819,19 +291028,12 @@ var plugin2 = {
290819
291028
  return issues.filter((i) => normalized.has(normalizeState2(i.state)));
290820
291029
  },
290821
291030
  async fetchIssueStatesByIds(ids3) {
290822
- const results = await Promise.all(ids3.map(async (id3) => {
290823
- try {
290824
- const bd = await ops.viewIssue(id3);
290825
- return [
290826
- { id: bd.id, state: ops.mapState(bd) }
290827
- ];
290828
- } catch (e) {
290829
- if (e instanceof PluginNotFoundError)
290830
- return [];
290831
- throw e;
290832
- }
291031
+ const wantedIds = new Set(ids3);
291032
+ const allIssues = await ops.listAllIssues();
291033
+ return allIssues.filter((issue2) => wantedIds.has(issue2.id)).map((issue2) => ({
291034
+ id: issue2.id,
291035
+ state: ops.mapState(issue2)
290833
291036
  }));
290834
- return results.flat();
290835
291037
  },
290836
291038
  fetchRunContext: (issueId, state) => ops.fetchRunContext(issueId, state)
290837
291039
  };
@@ -290839,9 +291041,9 @@ var plugin2 = {
290839
291041
  };
290840
291042
  var beads_default = plugin2;
290841
291043
  // packages/plot/src/tracker/github/index.ts
290842
- import { execFile as execFile2 } from "child_process";
290843
- import { promisify as promisify2 } from "util";
290844
- var execFileAsync2 = promisify2(execFile2);
291044
+ import { execFile as execFile3 } from "child_process";
291045
+ import { promisify as promisify3 } from "util";
291046
+ var execFileAsync3 = promisify3(execFile3);
290845
291047
  var normalizeState3 = (s) => s.trim().toLowerCase();
290846
291048
  function mapGhFailure(error4, resourceId) {
290847
291049
  const message = error4 instanceof Error ? error4.message : String(error4);
@@ -290870,7 +291072,7 @@ function createGithubOps(config2) {
290870
291072
  const ghFields = "number,title,body,state,labels,url,createdAt,updatedAt";
290871
291073
  const runGh = async (args2, options5) => {
290872
291074
  try {
290873
- return await execFileAsync2("gh", args2, {
291075
+ return await execFileAsync3("gh", args2, {
290874
291076
  maxBuffer: 50 * 1024 * 1024
290875
291077
  });
290876
291078
  } catch (error4) {
@@ -291156,11 +291358,11 @@ function adaptTrackerClient(plain) {
291156
291358
  var builtinTrackers = {
291157
291359
  beads: {
291158
291360
  definition: beads_default,
291159
- moduleDir: join34(dirname19(fileURLToPath6(import.meta.url)), "tracker", "beads")
291361
+ moduleDir: join35(dirname20(fileURLToPath6(import.meta.url)), "tracker", "beads")
291160
291362
  },
291161
291363
  github: {
291162
291364
  definition: github_default,
291163
- moduleDir: join34(dirname19(fileURLToPath6(import.meta.url)), "tracker", "github")
291365
+ moduleDir: join35(dirname20(fileURLToPath6(import.meta.url)), "tracker", "github")
291164
291366
  }
291165
291367
  };
291166
291368
  function buildPluginConfig(resolved) {
@@ -291178,11 +291380,11 @@ function syncGithubRepoEnv(resolved) {
291178
291380
  delete process.env["GITHUB_REPO"];
291179
291381
  }
291180
291382
  function discoverSkillPaths(moduleDir) {
291181
- const skillsDir = join34(moduleDir, "skills");
291182
- if (!existsSync24(skillsDir))
291383
+ const skillsDir = join35(moduleDir, "skills");
291384
+ if (!existsSync25(skillsDir))
291183
291385
  return [];
291184
291386
  try {
291185
- return readdirSync12(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join34(skillsDir, entry.name)).filter((dir) => existsSync24(join34(dir, "SKILL.md")));
291387
+ return readdirSync12(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join35(skillsDir, entry.name)).filter((dir) => existsSync25(join35(dir, "SKILL.md")));
291186
291388
  } catch {
291187
291389
  return [];
291188
291390
  }
@@ -291225,7 +291427,7 @@ function resolvePlugin(resolved) {
291225
291427
  return yield* exports_Effect.die(new Error(`Tracker plugin "${kind}" does not export a valid default tracker plugin definition`));
291226
291428
  }
291227
291429
  const config2 = yield* resolveDefinitionConfig(definition, rawConfig);
291228
- const moduleDir = kind.startsWith("./") || kind.startsWith("../") || kind.startsWith("/") ? dirname19(resolve14(kind)) : undefined;
291430
+ const moduleDir = kind.startsWith("./") || kind.startsWith("../") || kind.startsWith("/") ? dirname20(resolve14(kind)) : undefined;
291229
291431
  return yield* makeResolvedPlugin(definition, config2, moduleDir);
291230
291432
  });
291231
291433
  }
@@ -291379,7 +291581,7 @@ function postResponse(message) {
291379
291581
  function redirectProcessOutput(path14) {
291380
291582
  if (!path14)
291381
291583
  return;
291382
- mkdirSync9(dirname20(path14), { recursive: true });
291584
+ mkdirSync9(dirname21(path14), { recursive: true });
291383
291585
  const stream8 = createWriteStream5(path14, { flags: "a" });
291384
291586
  const write4 = (chunk5) => {
291385
291587
  stream8.write(typeof chunk5 === "string" ? chunk5 : Buffer.from(chunk5));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plot-ai/linux-x64-musl",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "orchestrate coding agents against an issue tracker",