@plot-ai/darwin-arm64 0.0.6 → 0.0.8

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.6
3
+ ## 0.0.8
4
4
 
5
5
  - packaged plot-ai release
package/bin/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plot-ai/darwin-arm64",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "piConfig": {
5
5
  "name": "plot",
6
6
  "configDir": ".plot"
package/bin/plot-ai CHANGED
Binary file
package/bin/tui-worker.js CHANGED
@@ -147452,7 +147452,7 @@ var require_lib4 = __commonJS((exports, module2) => {
147452
147452
 
147453
147453
  // packages/plot/src/tui-worker.ts
147454
147454
  import { Console } from "console";
147455
- import { createWriteStream as createWriteStream5, mkdirSync as mkdirSync9, readFileSync as readFileSync22 } from "fs";
147455
+ import { createWriteStream as createWriteStream5, mkdirSync as mkdirSync10, readFileSync as readFileSync22 } from "fs";
147456
147456
  import { dirname as dirname20 } from "path";
147457
147457
 
147458
147458
  // node_modules/.bun/effect@4.0.0-beta.34/node_modules/effect/dist/Pipeable.js
@@ -182190,6 +182190,33 @@ class PlotRpcs extends exports_RpcGroup.make(exports_Rpc.make("TriggerRefresh",
182190
182190
  payload: { identifier: exports_Schema.String }
182191
182191
  })) {
182192
182192
  }
182193
+ // packages/sdk/src/plugin/types.ts
182194
+ function defineTracker(definition) {
182195
+ return {
182196
+ name: definition.name,
182197
+ validateConfig: definition.config,
182198
+ async factory(config) {
182199
+ const pluginConfig = config;
182200
+ const baseCtx = {
182201
+ config,
182202
+ states: {
182203
+ dispatch: pluginConfig.dispatchStates ?? pluginConfig.dispatch_states ?? [],
182204
+ parked: pluginConfig.parkedStates ?? pluginConfig.parked_states ?? [],
182205
+ terminal: pluginConfig.terminalStates ?? pluginConfig.terminal_states ?? []
182206
+ }
182207
+ };
182208
+ const setupResult = definition.setup ? await Promise.resolve(definition.setup(baseCtx)) : {};
182209
+ const ctx = { ...baseCtx, ...setupResult };
182210
+ return {
182211
+ fetchCandidateIssues: (dispatchStates) => definition.fetchCandidateIssues(ctx, dispatchStates),
182212
+ fetchIssuesByStates: definition.fetchIssuesByStates ? (states) => definition.fetchIssuesByStates(ctx, states) : undefined,
182213
+ fetchIssueStatesByIds: definition.fetchIssueStatesByIds ? (ids) => definition.fetchIssueStatesByIds(ctx, ids) : undefined,
182214
+ fetchRunContext: definition.fetchRunContext ? (issueId, state) => definition.fetchRunContext(ctx, issueId, state) : undefined,
182215
+ dispose: definition.dispose
182216
+ };
182217
+ }
182218
+ };
182219
+ }
182193
182220
  // packages/sdk/src/plugin/errors.ts
182194
182221
  class PluginAuthError extends Error {
182195
182222
  constructor(message) {
@@ -184735,6 +184762,7 @@ var ServerConfig2 = exports_Config.all({
184735
184762
  return exports_Effect.succeed(s);
184736
184763
  return exports_Effect.die(`invalid LOG_LEVEL: ${s}`);
184737
184764
  })),
184765
+ refreshPlugins: exports_Config.boolean("REFRESH_PLUGINS").pipe(exports_Config.withDefault(false)),
184738
184766
  overrides: WorkflowOverridesConfig
184739
184767
  }).pipe(exports_Config.nested("PLOT"));
184740
184768
  function parseWorkflowFrontmatter(content) {
@@ -186346,7 +186374,38 @@ class Orchestrator extends exports_ServiceMap.Service()("Orchestrator", {
186346
186374
  static layer = exports_Layer.effect(this, this.make);
186347
186375
  }
186348
186376
  // packages/plot/src/runtime-builder.ts
186349
- import { resolve as resolvePath5 } from "path";
186377
+ import { resolve as resolvePath6, join as joinPath } from "path";
186378
+ import { mkdirSync as mkdirSync9, existsSync as existsSync25, writeFileSync as writeFileSync10 } from "fs";
186379
+ import { execSync as execSync3 } from "child_process";
186380
+ import { homedir as homedir16 } from "os";
186381
+ import { createHash as createHash3 } from "crypto";
186382
+
186383
+ // packages/plot/src/core/plugin-kind.ts
186384
+ import { resolve as resolvePath3 } from "path";
186385
+ import { homedir } from "os";
186386
+ var NPM_PREFIX = "npm:";
186387
+ var FILE_PREFIX = "file:";
186388
+ function classifyPluginKind(kind, cwd) {
186389
+ if (kind.startsWith(NPM_PREFIX)) {
186390
+ return { type: "npm", specifier: kind.slice(NPM_PREFIX.length) };
186391
+ }
186392
+ if (kind.startsWith(FILE_PREFIX)) {
186393
+ return { type: "local", specifier: expandPath(kind.slice(FILE_PREFIX.length), cwd) };
186394
+ }
186395
+ if (isLocalPath(kind)) {
186396
+ return { type: "local", specifier: expandPath(kind, cwd) };
186397
+ }
186398
+ return { type: "npm", specifier: kind };
186399
+ }
186400
+ function isLocalPath(kind) {
186401
+ return kind.startsWith(".") || kind.startsWith("/") || kind.startsWith("~");
186402
+ }
186403
+ function expandPath(path2, cwd) {
186404
+ if (path2.startsWith("~")) {
186405
+ return resolvePath3(homedir(), path2.slice(path2.startsWith("~/") ? 2 : 1));
186406
+ }
186407
+ return resolvePath3(cwd, path2);
186408
+ }
186350
186409
 
186351
186410
  // node_modules/.bun/@effect+platform-node-shared@4.0.0-beta.34+a3beb9cffb0732f9/node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js
186352
186411
  import * as NodeChildProcess from "child_process";
@@ -187442,7 +187501,7 @@ var layer14 = /* @__PURE__ */ layer5.pipe(/* @__PURE__ */ provideMerge(/* @__PUR
187442
187501
  // packages/plot/src/agent/pi-adapter.ts
187443
187502
  import { existsSync as existsSync23 } from "fs";
187444
187503
  import { dirname as dirname18, join as join31 } from "path";
187445
- import { homedir as homedir13 } from "os";
187504
+ import { homedir as homedir14 } from "os";
187446
187505
  import { fileURLToPath as fileURLToPath5 } from "url";
187447
187506
 
187448
187507
  // node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/index.js
@@ -187575,7 +187634,7 @@ __export(exports_dist4, {
187575
187634
 
187576
187635
  // node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/config.js
187577
187636
  import { existsSync, readFileSync as readFileSync2 } from "fs";
187578
- import { homedir } from "os";
187637
+ import { homedir as homedir2 } from "os";
187579
187638
  import { dirname as dirname3, join as join5, resolve as resolve6 } from "path";
187580
187639
  import { fileURLToPath as fileURLToPath2 } from "url";
187581
187640
  var __filename2 = fileURLToPath2(import.meta.url);
@@ -187622,9 +187681,9 @@ function getPackageDir() {
187622
187681
  const envDir = process.env.PI_PACKAGE_DIR;
187623
187682
  if (envDir) {
187624
187683
  if (envDir === "~")
187625
- return homedir();
187684
+ return homedir2();
187626
187685
  if (envDir.startsWith("~/"))
187627
- return homedir() + envDir.slice(1);
187686
+ return homedir2() + envDir.slice(1);
187628
187687
  return envDir;
187629
187688
  }
187630
187689
  if (isBunBinary) {
@@ -187684,12 +187743,12 @@ function getAgentDir() {
187684
187743
  const envDir = process.env[ENV_AGENT_DIR];
187685
187744
  if (envDir) {
187686
187745
  if (envDir === "~")
187687
- return homedir();
187746
+ return homedir2();
187688
187747
  if (envDir.startsWith("~/"))
187689
- return homedir() + envDir.slice(1);
187748
+ return homedir2() + envDir.slice(1);
187690
187749
  return envDir;
187691
187750
  }
187692
- return join5(homedir(), CONFIG_DIR_NAME, "agent");
187751
+ return join5(homedir2(), CONFIG_DIR_NAME, "agent");
187693
187752
  }
187694
187753
  function getCustomThemesDir() {
187695
187754
  return join5(getAgentDir(), "themes");
@@ -245034,7 +245093,7 @@ __export(exports_dist3, {
245034
245093
  // node_modules/.bun/@mariozechner+pi-tui@0.57.1/node_modules/@mariozechner/pi-tui/dist/autocomplete.js
245035
245094
  import { spawnSync as spawnSync2 } from "child_process";
245036
245095
  import { readdirSync as readdirSync3, statSync as statSync2 } from "fs";
245037
- import { homedir as homedir2 } from "os";
245096
+ import { homedir as homedir3 } from "os";
245038
245097
  import { basename as basename3, dirname as dirname5, join as join11 } from "path";
245039
245098
 
245040
245099
  // node_modules/.bun/@mariozechner+pi-tui@0.57.1/node_modules/@mariozechner/pi-tui/dist/fuzzy.js
@@ -245406,10 +245465,10 @@ class CombinedAutocompleteProvider {
245406
245465
  }
245407
245466
  expandHomePath(path6) {
245408
245467
  if (path6.startsWith("~/")) {
245409
- const expandedPath = join11(homedir2(), path6.slice(2));
245468
+ const expandedPath = join11(homedir3(), path6.slice(2));
245410
245469
  return path6.endsWith("/") && !expandedPath.endsWith("/") ? `${expandedPath}/` : expandedPath;
245411
245470
  } else if (path6 === "~") {
245412
- return homedir2();
245471
+ return homedir3();
245413
245472
  }
245414
245473
  return path6;
245415
245474
  }
@@ -253927,7 +253986,7 @@ var UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
253927
253986
  function normalizeUnicodeSpaces(str3) {
253928
253987
  return str3.replace(UNICODE_SPACES, " ");
253929
253988
  }
253930
- function expandPath(p) {
253989
+ function expandPath2(p) {
253931
253990
  const normalized = normalizeUnicodeSpaces(p);
253932
253991
  if (normalized.startsWith("~/")) {
253933
253992
  return path7.join(os3.homedir(), normalized.slice(2));
@@ -253937,8 +253996,8 @@ function expandPath(p) {
253937
253996
  }
253938
253997
  return normalized;
253939
253998
  }
253940
- function resolvePath3(extPath, cwd) {
253941
- const expanded = expandPath(extPath);
253999
+ function resolvePath4(extPath, cwd) {
254000
+ const expanded = expandPath2(extPath);
253942
254001
  if (path7.isAbsolute(expanded)) {
253943
254002
  return expanded;
253944
254003
  }
@@ -254082,7 +254141,7 @@ function createExtension(extensionPath, resolvedPath) {
254082
254141
  };
254083
254142
  }
254084
254143
  async function loadExtension(extensionPath, cwd, eventBus, runtime2) {
254085
- const resolvedPath = resolvePath3(extensionPath, cwd);
254144
+ const resolvedPath = resolvePath4(extensionPath, cwd);
254086
254145
  try {
254087
254146
  const factory = await loadExtensionModule(resolvedPath);
254088
254147
  if (!factory) {
@@ -254208,7 +254267,7 @@ async function discoverAndLoadExtensions(configuredPaths, cwd, agentDir = getAge
254208
254267
  const globalExtDir = path7.join(agentDir, "extensions");
254209
254268
  addPaths(discoverExtensionsInDir(globalExtDir));
254210
254269
  for (const p of configuredPaths) {
254211
- const resolved = resolvePath3(p, cwd);
254270
+ const resolved = resolvePath4(p, cwd);
254212
254271
  if (fs6.existsSync(resolved) && fs6.statSync(resolved).isDirectory()) {
254213
254272
  const entries3 = resolveExtensionEntries(resolved);
254214
254273
  if (entries3) {
@@ -254972,7 +255031,7 @@ function wrapToolsWithExtensions(tools, runner) {
254972
255031
  }
254973
255032
  // node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/core/prompt-templates.js
254974
255033
  import { existsSync as existsSync8, readdirSync as readdirSync5, readFileSync as readFileSync8, statSync as statSync4 } from "fs";
254975
- import { homedir as homedir5 } from "os";
255034
+ import { homedir as homedir6 } from "os";
254976
255035
  import { basename as basename4, isAbsolute as isAbsolute3, join as join14, resolve as resolve9, sep } from "path";
254977
255036
  function parseCommandArgs(argsString) {
254978
255037
  const args2 = [];
@@ -255083,11 +255142,11 @@ function loadTemplatesFromDir(dir, source, sourceLabel) {
255083
255142
  function normalizePath(input) {
255084
255143
  const trimmed = input.trim();
255085
255144
  if (trimmed === "~")
255086
- return homedir5();
255145
+ return homedir6();
255087
255146
  if (trimmed.startsWith("~/"))
255088
- return join14(homedir5(), trimmed.slice(2));
255147
+ return join14(homedir6(), trimmed.slice(2));
255089
255148
  if (trimmed.startsWith("~"))
255090
- return join14(homedir5(), trimmed.slice(1));
255149
+ return join14(homedir6(), trimmed.slice(1));
255091
255150
  return trimmed;
255092
255151
  }
255093
255152
  function resolvePromptPath(p, cwd) {
@@ -255191,7 +255250,7 @@ var BUILTIN_SLASH_COMMANDS = [
255191
255250
  // node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/core/skills.js
255192
255251
  var import_ignore = __toESM(require_ignore(), 1);
255193
255252
  import { existsSync as existsSync9, readdirSync as readdirSync6, readFileSync as readFileSync9, realpathSync, statSync as statSync5 } from "fs";
255194
- import { homedir as homedir6 } from "os";
255253
+ import { homedir as homedir7 } from "os";
255195
255254
  import { basename as basename5, dirname as dirname8, isAbsolute as isAbsolute4, join as join15, relative as relative2, resolve as resolve10, sep as sep2 } from "path";
255196
255255
  var MAX_NAME_LENGTH = 64;
255197
255256
  var MAX_DESCRIPTION_LENGTH = 1024;
@@ -255392,11 +255451,11 @@ function escapeXml(str3) {
255392
255451
  function normalizePath2(input) {
255393
255452
  const trimmed = input.trim();
255394
255453
  if (trimmed === "~")
255395
- return homedir6();
255454
+ return homedir7();
255396
255455
  if (trimmed.startsWith("~/"))
255397
- return join15(homedir6(), trimmed.slice(2));
255456
+ return join15(homedir7(), trimmed.slice(2));
255398
255457
  if (trimmed.startsWith("~"))
255399
- return join15(homedir6(), trimmed.slice(1));
255458
+ return join15(homedir7(), trimmed.slice(1));
255400
255459
  return trimmed;
255401
255460
  }
255402
255461
  function resolveSkillPath(p, cwd) {
@@ -256513,7 +256572,7 @@ import { access as access3, readFile as readFile5 } from "fs/promises";
256513
256572
  // node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/core/tools/path-utils.js
256514
256573
  import { accessSync, constants as constants2 } from "fs";
256515
256574
  import * as os4 from "os";
256516
- import { isAbsolute as isAbsolute5, resolve as resolvePath4 } from "path";
256575
+ import { isAbsolute as isAbsolute5, resolve as resolvePath5 } from "path";
256517
256576
  var UNICODE_SPACES2 = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
256518
256577
  var NARROW_NO_BREAK_SPACE = "\u202F";
256519
256578
  function normalizeUnicodeSpaces2(str3) {
@@ -256539,7 +256598,7 @@ function fileExists(filePath) {
256539
256598
  function normalizeAtPrefix(filePath) {
256540
256599
  return filePath.startsWith("@") ? filePath.slice(1) : filePath;
256541
256600
  }
256542
- function expandPath2(filePath) {
256601
+ function expandPath3(filePath) {
256543
256602
  const normalized = normalizeUnicodeSpaces2(normalizeAtPrefix(filePath));
256544
256603
  if (normalized === "~") {
256545
256604
  return os4.homedir();
@@ -256550,11 +256609,11 @@ function expandPath2(filePath) {
256550
256609
  return normalized;
256551
256610
  }
256552
256611
  function resolveToCwd(filePath, cwd) {
256553
- const expanded = expandPath2(filePath);
256612
+ const expanded = expandPath3(filePath);
256554
256613
  if (isAbsolute5(expanded)) {
256555
256614
  return expanded;
256556
256615
  }
256557
- return resolvePath4(cwd, expanded);
256616
+ return resolvePath5(cwd, expanded);
256558
256617
  }
256559
256618
  function resolveReadPath(filePath, cwd) {
256560
256619
  const resolved = resolveToCwd(filePath, cwd);
@@ -267048,7 +267107,7 @@ var import_ignore2 = __toESM(require_ignore(), 1);
267048
267107
  import { spawn as spawn7, spawnSync as spawnSync5 } from "child_process";
267049
267108
  import { createHash as createHash2 } from "crypto";
267050
267109
  import { existsSync as existsSync16, mkdirSync as mkdirSync6, readdirSync as readdirSync9, readFileSync as readFileSync14, rmSync as rmSync2, statSync as statSync8, writeFileSync as writeFileSync6 } from "fs";
267051
- import { homedir as homedir8, tmpdir as tmpdir5 } from "os";
267110
+ import { homedir as homedir9, tmpdir as tmpdir5 } from "os";
267052
267111
  import { basename as basename7, dirname as dirname13, join as join22, relative as relative3, resolve as resolve11, sep as sep4 } from "path";
267053
267112
 
267054
267113
  // node_modules/.bun/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
@@ -269921,21 +269980,21 @@ class DefaultPackageManager {
269921
269980
  resolvePath(input) {
269922
269981
  const trimmed = input.trim();
269923
269982
  if (trimmed === "~")
269924
- return homedir8();
269983
+ return homedir9();
269925
269984
  if (trimmed.startsWith("~/"))
269926
- return join22(homedir8(), trimmed.slice(2));
269985
+ return join22(homedir9(), trimmed.slice(2));
269927
269986
  if (trimmed.startsWith("~"))
269928
- return join22(homedir8(), trimmed.slice(1));
269987
+ return join22(homedir9(), trimmed.slice(1));
269929
269988
  return resolve11(this.cwd, trimmed);
269930
269989
  }
269931
269990
  resolvePathFromBase(input, baseDir) {
269932
269991
  const trimmed = input.trim();
269933
269992
  if (trimmed === "~")
269934
- return homedir8();
269993
+ return homedir9();
269935
269994
  if (trimmed.startsWith("~/"))
269936
- return join22(homedir8(), trimmed.slice(2));
269995
+ return join22(homedir9(), trimmed.slice(2));
269937
269996
  if (trimmed.startsWith("~"))
269938
- return join22(homedir8(), trimmed.slice(1));
269997
+ return join22(homedir9(), trimmed.slice(1));
269939
269998
  return resolve11(baseDir, trimmed);
269940
269999
  }
269941
270000
  collectPackageResources(packageRoot, accumulator, filter13, metadata) {
@@ -270095,7 +270154,7 @@ class DefaultPackageManager {
270095
270154
  prompts: join22(projectBaseDir, "prompts"),
270096
270155
  themes: join22(projectBaseDir, "themes")
270097
270156
  };
270098
- const userAgentsSkillsDir = join22(homedir8(), ".agents", "skills");
270157
+ const userAgentsSkillsDir = join22(homedir9(), ".agents", "skills");
270099
270158
  const projectAgentsSkillDirs = collectAncestorAgentsSkillDirs(this.cwd).filter((dir) => resolve11(dir) !== resolve11(userAgentsSkillsDir));
270100
270159
  const addResources = (resourceType, paths, metadata, overrides, baseDir) => {
270101
270160
  const target = this.getTargetMap(accumulator, resourceType);
@@ -270207,7 +270266,7 @@ class DefaultPackageManager {
270207
270266
  }
270208
270267
  // node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/core/resource-loader.js
270209
270268
  import { existsSync as existsSync17, readdirSync as readdirSync10, readFileSync as readFileSync15, statSync as statSync9 } from "fs";
270210
- import { homedir as homedir9 } from "os";
270269
+ import { homedir as homedir10 } from "os";
270211
270270
  import { join as join23, resolve as resolve12, sep as sep5 } from "path";
270212
270271
  function resolvePromptInput(input, description) {
270213
270272
  if (!input) {
@@ -270585,11 +270644,11 @@ class DefaultResourceLoader {
270585
270644
  const trimmed = p.trim();
270586
270645
  let expanded = trimmed;
270587
270646
  if (trimmed === "~") {
270588
- expanded = homedir9();
270647
+ expanded = homedir10();
270589
270648
  } else if (trimmed.startsWith("~/")) {
270590
- expanded = join23(homedir9(), trimmed.slice(2));
270649
+ expanded = join23(homedir10(), trimmed.slice(2));
270591
270650
  } else if (trimmed.startsWith("~")) {
270592
- expanded = join23(homedir9(), trimmed.slice(1));
270651
+ expanded = join23(homedir10(), trimmed.slice(1));
270593
270652
  }
270594
270653
  return resolve12(this.cwd, expanded);
270595
270654
  }
@@ -282752,7 +282811,7 @@ function resolveModel(modelSpec, registry2, available) {
282752
282811
  var agentDir = dirname18(fileURLToPath5(import.meta.url));
282753
282812
  var repoSkillDirectories = [".agent/skills", ".claude/skills"];
282754
282813
  var PlotPiSkillsDir = exports_Config.string("PI_SKILLS_DIR").pipe(exports_Config.nested("PLOT"), exports_Config.withDefault(join31(agentDir, "../../resources/skills")));
282755
- var PlotAgentDir = exports_Config.string("CODING_AGENT_DIR").pipe(exports_Config.nested("PLOT"), exports_Config.withDefault(join31(homedir13(), ".plot", "agent")));
282814
+ var PlotAgentDir = exports_Config.string("CODING_AGENT_DIR").pipe(exports_Config.nested("PLOT"), exports_Config.withDefault(join31(homedir14(), ".plot", "agent")));
282756
282815
  function resolvePlotSkillPaths(workspacePath, coreSkillsDir) {
282757
282816
  return [
282758
282817
  coreSkillsDir,
@@ -282995,21 +283054,36 @@ function mapSessionEvent(acc, event, threadId, issueId, issueIdentifier) {
282995
283054
  var createEventStream = (config) => exports_Stream.unwrap(exports_Effect.gen(function* () {
282996
283055
  const plotAgentDir = yield* PlotAgentDir.asEffect().pipe(exports_Effect.mapError((e) => new AgentRunnerError({ code: "config_error", message: String(e) })));
282997
283056
  const plotSkillsDir = yield* PlotPiSkillsDir.asEffect().pipe(exports_Effect.mapError((e) => new AgentRunnerError({ code: "config_error", message: String(e) })));
283057
+ const bootstrapStart = Date.now();
282998
283058
  const authStorage = AuthStorage.create(join31(plotAgentDir, "auth.json"));
282999
283059
  const modelRegistry2 = new ModelRegistry(authStorage, join31(plotAgentDir, "models.json"));
283000
283060
  const available = modelRegistry2.getAvailable();
283001
283061
  const model = resolveModel(config.modelSpec, modelRegistry2, available);
283062
+ const preflightKey = yield* exports_Effect.tryPromise({
283063
+ try: () => modelRegistry2.getApiKey(model),
283064
+ catch: (e) => new AgentRunnerError({
283065
+ code: "auth_error",
283066
+ message: `Failed to get API key for ${model.provider}/${model.id}: ${e}`
283067
+ })
283068
+ });
283069
+ if (!preflightKey) {
283070
+ yield* exports_Effect.logError("agent_auth_failed").pipe(exports_Effect.annotateLogs({
283071
+ issue_id: config.issueId,
283072
+ model: `${model.provider}/${model.id}`
283073
+ }));
283074
+ return yield* exports_Effect.fail(new AgentRunnerError({
283075
+ code: "auth_error",
283076
+ message: `No API key for ${model.provider}/${model.id}. Token may have expired \u2014 run '/login ${model.provider}' to re-authenticate.`
283077
+ }));
283078
+ }
283002
283079
  const skillPaths = resolvePlotSkillPaths(config.workspacePath, plotSkillsDir);
283003
- yield* exports_Effect.logDebug("agent_skill_paths").pipe(exports_Effect.annotateLogs({
283004
- issue_id: config.issueId,
283005
- skill_paths: JSON.stringify(skillPaths),
283006
- core_skills_dir: plotSkillsDir,
283007
- workspace: config.workspacePath
283008
- }));
283009
283080
  const loader = new DefaultResourceLoader({
283010
283081
  cwd: config.workspacePath,
283011
283082
  systemPromptOverride: () => config.systemPrompt,
283083
+ noExtensions: true,
283012
283084
  noSkills: true,
283085
+ noPromptTemplates: true,
283086
+ noThemes: true,
283013
283087
  additionalSkillPaths: skillPaths
283014
283088
  });
283015
283089
  yield* exports_Effect.tryPromise({
@@ -283020,13 +283094,6 @@ var createEventStream = (config) => exports_Stream.unwrap(exports_Effect.gen(fun
283020
283094
  })
283021
283095
  });
283022
283096
  const { skills: loadedSkills } = loader.getSkills();
283023
- yield* exports_Effect.logInfo("agent_skills_loaded").pipe(exports_Effect.annotateLogs({
283024
- issue_id: config.issueId,
283025
- skill_count: String(loadedSkills.length),
283026
- skill_names: JSON.stringify(loadedSkills.map((s) => s.name)),
283027
- system_prompt_length: String(config.systemPrompt.length),
283028
- system_prompt_first_200: config.systemPrompt.slice(0, 200)
283029
- }));
283030
283097
  const { session } = yield* exports_Effect.tryPromise({
283031
283098
  try: () => createAgentSession({
283032
283099
  cwd: config.workspacePath,
@@ -283047,10 +283114,11 @@ var createEventStream = (config) => exports_Stream.unwrap(exports_Effect.gen(fun
283047
283114
  component: "agent",
283048
283115
  issue_id: config.issueId,
283049
283116
  identifier: config.issueIdentifier,
283050
- model_provider: model.provider,
283051
- model_id: model.id,
283117
+ model: `${model.provider}/${model.id}`,
283052
283118
  workspace: config.workspacePath,
283053
- max_turns: String(config.maxTurns)
283119
+ max_turns: String(config.maxTurns),
283120
+ skill_count: String(loadedSkills.length),
283121
+ bootstrap_ms: String(Date.now() - bootstrapStart)
283054
283122
  }));
283055
283123
  const abortingRef = yield* exports_Ref.make(false);
283056
283124
  const abortSession = exports_Effect.fnUntraced(function* (reason) {
@@ -283107,7 +283175,7 @@ var execFileAsync = promisify(execFile);
283107
283175
 
283108
283176
  // packages/plot/src/tracker/beads/daemon-transport.ts
283109
283177
  import { existsSync as existsSync24 } from "fs";
283110
- import { homedir as homedir14 } from "os";
283178
+ import { homedir as homedir15 } from "os";
283111
283179
  import { dirname as dirname19, join as join32 } from "path";
283112
283180
  import { createConnection } from "net";
283113
283181
  function walkUp(startDir, filename, globalFallback = false) {
@@ -283122,7 +283190,7 @@ function walkUp(startDir, filename, globalFallback = false) {
283122
283190
  dir = parent;
283123
283191
  }
283124
283192
  if (globalFallback) {
283125
- const globalPath = join32(homedir14(), ".beads", filename);
283193
+ const globalPath = join32(homedir15(), ".beads", filename);
283126
283194
  if (existsSync24(globalPath))
283127
283195
  return globalPath;
283128
283196
  }
@@ -283439,7 +283507,7 @@ async function createBeadsOps(config) {
283439
283507
  const repoArgs = config.githubRepo ? ["--repo", config.githubRepo] : [];
283440
283508
  reviews = await fetchPrReviewFeedback(issueId, repoArgs, workspaceRoot);
283441
283509
  }
283442
- return buildRunContext({ workpad, reviewFeedback: reviews });
283510
+ return { workpad, reviewFeedback: reviews };
283443
283511
  };
283444
283512
  return {
283445
283513
  listAllIssues,
@@ -283449,48 +283517,48 @@ async function createBeadsOps(config) {
283449
283517
  fetchRunContext
283450
283518
  };
283451
283519
  }
283452
- var plugin2 = {
283520
+ var beads_default = defineTracker({
283453
283521
  name: "beads",
283454
- validateConfig(raw) {
283522
+ config(raw) {
283455
283523
  return {
283456
283524
  ...validateCommonTrackerFields(raw),
283457
283525
  beadsDir: typeof raw["beadsDir"] === "string" ? raw["beadsDir"] : undefined
283458
283526
  };
283459
283527
  },
283460
- async factory(config) {
283461
- const allStates = deriveAllStates(config.dispatchStates, config.parkedStates, config.terminalStates);
283528
+ async setup(ctx) {
283529
+ const allStates = deriveAllStates(ctx.config.dispatchStates, ctx.config.parkedStates, ctx.config.terminalStates);
283462
283530
  const ops = await createBeadsOps({
283463
- beadsDir: config.beadsDir,
283464
- githubRepo: config.githubRepo,
283465
- dispatchStates: config.dispatchStates ?? [],
283531
+ beadsDir: ctx.config.beadsDir,
283532
+ githubRepo: ctx.config.githubRepo,
283533
+ dispatchStates: ctx.config.dispatchStates ?? [],
283466
283534
  allStates
283467
283535
  });
283468
- return {
283469
- async fetchCandidateIssues(dispatchStates) {
283470
- const bdIssues = await ops.listAllIssues();
283471
- const issues = bdIssues.map(ops.mapIssue);
283472
- const normalized = new Set(dispatchStates.map(normalizeState));
283473
- return issues.filter((i) => normalized.has(normalizeState(i.state)));
283474
- },
283475
- async fetchIssuesByStates(states) {
283476
- const bdIssues = await ops.listAllIssues();
283477
- const issues = bdIssues.map(ops.mapIssue);
283478
- const normalized = new Set(states.map(normalizeState));
283479
- return issues.filter((i) => normalized.has(normalizeState(i.state)));
283480
- },
283481
- async fetchIssueStatesByIds(ids) {
283482
- const wantedIds = new Set(ids);
283483
- const allIssues = await ops.listAllIssues();
283484
- return allIssues.filter((issue2) => wantedIds.has(issue2.id)).map((issue2) => ({
283485
- id: issue2.id,
283486
- state: ops.mapState(issue2)
283487
- }));
283488
- },
283489
- fetchRunContext: (issueId, state2) => ops.fetchRunContext(issueId, state2)
283490
- };
283536
+ return { ops };
283537
+ },
283538
+ async fetchCandidateIssues(ctx, dispatchStates) {
283539
+ const bdIssues = await ctx.ops.listAllIssues();
283540
+ const issues = bdIssues.map(ctx.ops.mapIssue);
283541
+ const normalized = new Set(dispatchStates.map(normalizeState));
283542
+ return issues.filter((i) => normalized.has(normalizeState(i.state)));
283543
+ },
283544
+ async fetchIssuesByStates(ctx, states) {
283545
+ const bdIssues = await ctx.ops.listAllIssues();
283546
+ const issues = bdIssues.map(ctx.ops.mapIssue);
283547
+ const normalized = new Set(states.map(normalizeState));
283548
+ return issues.filter((i) => normalized.has(normalizeState(i.state)));
283549
+ },
283550
+ async fetchIssueStatesByIds(ctx, ids) {
283551
+ const wantedIds = new Set(ids);
283552
+ const allIssues = await ctx.ops.listAllIssues();
283553
+ return allIssues.filter((issue2) => wantedIds.has(issue2.id)).map((issue2) => ({
283554
+ id: issue2.id,
283555
+ state: ctx.ops.mapState(issue2)
283556
+ }));
283557
+ },
283558
+ async fetchRunContext(ctx, issueId, state2) {
283559
+ return ctx.ops.fetchRunContext(issueId, state2);
283491
283560
  }
283492
- };
283493
- var beads_default = plugin2;
283561
+ });
283494
283562
  // packages/plot/src/tracker/github/index.ts
283495
283563
  async function ghApi(args2, cwd) {
283496
283564
  const { stdout } = await execFileAsync("gh", args2, {
@@ -283623,7 +283691,7 @@ function createGithubOps(config) {
283623
283691
  repoFlag
283624
283692
  ]);
283625
283693
  }
283626
- return buildRunContext({ workpad, reviewFeedback: reviews });
283694
+ return { workpad, reviewFeedback: reviews };
283627
283695
  };
283628
283696
  return {
283629
283697
  listIssues,
@@ -283633,54 +283701,55 @@ function createGithubOps(config) {
283633
283701
  fetchRunContext
283634
283702
  };
283635
283703
  }
283636
- var plugin3 = {
283704
+ var github_default = defineTracker({
283637
283705
  name: "github",
283638
- validateConfig(raw) {
283706
+ config(raw) {
283639
283707
  return validateCommonTrackerFields(raw);
283640
283708
  },
283641
- async factory(config) {
283709
+ async setup(ctx) {
283642
283710
  await getAuthToken();
283643
- const { owner, repo } = config.githubRepo ? parseRepoSlug(config.githubRepo) : await detectRepo();
283711
+ const { owner, repo } = ctx.config.githubRepo ? parseRepoSlug(ctx.config.githubRepo) : await detectRepo();
283712
+ const repoArgs = ["--repo", `${owner}/${repo}`];
283644
283713
  const ops = createGithubOps({
283645
283714
  owner,
283646
283715
  repo,
283647
- dispatchStates: config.dispatchStates,
283648
- parkedStates: config.parkedStates,
283649
- terminalStates: config.terminalStates
283716
+ dispatchStates: ctx.config.dispatchStates,
283717
+ parkedStates: ctx.config.parkedStates,
283718
+ terminalStates: ctx.config.terminalStates
283650
283719
  });
283651
- return {
283652
- async fetchCandidateIssues(dispatchStates) {
283653
- const ghIssues = await ops.listIssues("open");
283654
- const issues = ghIssues.map(ops.mapIssue);
283655
- const normalized = new Set(dispatchStates.map(normalizeState));
283656
- return issues.filter((i) => normalized.has(normalizeState(i.state)));
283657
- },
283658
- async fetchIssuesByStates(states) {
283659
- const ghIssues = await ops.listIssues("all");
283660
- const issues = ghIssues.map(ops.mapIssue);
283661
- const normalized = new Set(states.map(normalizeState));
283662
- return issues.filter((i) => normalized.has(normalizeState(i.state)));
283663
- },
283664
- async fetchIssueStatesByIds(ids) {
283665
- const results = await Promise.all(ids.map(async (id2) => {
283666
- try {
283667
- const gh = await ops.viewIssue(id2);
283668
- return [
283669
- { id: String(gh.number), state: ops.mapState(gh) }
283670
- ];
283671
- } catch (e) {
283672
- if (e instanceof PluginNotFoundError)
283673
- return [];
283674
- throw e;
283675
- }
283676
- }));
283677
- return results.flat();
283678
- },
283679
- fetchRunContext: (issueId, state2) => ops.fetchRunContext(issueId, state2)
283680
- };
283720
+ return { owner, repo, repoArgs, ops };
283721
+ },
283722
+ async fetchCandidateIssues(ctx, dispatchStates) {
283723
+ const ghIssues = await ctx.ops.listIssues("open");
283724
+ const issues = ghIssues.map(ctx.ops.mapIssue);
283725
+ const normalized = new Set(dispatchStates.map(normalizeState));
283726
+ return issues.filter((i) => normalized.has(normalizeState(i.state)));
283727
+ },
283728
+ async fetchIssuesByStates(ctx, states) {
283729
+ const ghIssues = await ctx.ops.listIssues("all");
283730
+ const issues = ghIssues.map(ctx.ops.mapIssue);
283731
+ const normalized = new Set(states.map(normalizeState));
283732
+ return issues.filter((i) => normalized.has(normalizeState(i.state)));
283733
+ },
283734
+ async fetchIssueStatesByIds(ctx, ids) {
283735
+ const results = await Promise.all(ids.map(async (id2) => {
283736
+ try {
283737
+ const gh = await ctx.ops.viewIssue(id2);
283738
+ return [
283739
+ { id: String(gh.number), state: ctx.ops.mapState(gh) }
283740
+ ];
283741
+ } catch (e) {
283742
+ if (e instanceof PluginNotFoundError)
283743
+ return [];
283744
+ throw e;
283745
+ }
283746
+ }));
283747
+ return results.flat();
283748
+ },
283749
+ async fetchRunContext(ctx, issueId, state2) {
283750
+ return ctx.ops.fetchRunContext(issueId, state2);
283681
283751
  }
283682
- };
283683
- var github_default = plugin3;
283752
+ });
283684
283753
  // packages/plot/src/runtime-builder.ts
283685
283754
  function parseServerLogLevel(s) {
283686
283755
  switch (s.toLowerCase()) {
@@ -283748,15 +283817,18 @@ function normalizeIssue(plain) {
283748
283817
  function normalizeIssueStateEntry(plain) {
283749
283818
  return new IssueStateEntry({ id: plain.id, state: plain.state });
283750
283819
  }
283751
- function normalizeRunContext(plain) {
283752
- if (plain == null)
283820
+ function normalizeRunContext(raw) {
283821
+ if (raw == null)
283822
+ return null;
283823
+ const built = buildRunContext(raw);
283824
+ if (built == null)
283753
283825
  return null;
283754
283826
  return new TrackerRunContext({
283755
- raw: plain.raw ?? null,
283756
- promptContext: plain.promptContext ?? null,
283757
- workpad: plain.workpad ?? null,
283758
- reviewFeedback: plain.reviewFeedback ?? null,
283759
- workpadSections: (plain.workpadSections ?? []).map((s) => new WorkpadSection(s))
283827
+ raw: built.raw ?? null,
283828
+ promptContext: built.promptContext ?? null,
283829
+ workpad: built.workpad ?? null,
283830
+ reviewFeedback: built.reviewFeedback ?? null,
283831
+ workpadSections: (built.workpadSections ?? []).map((s) => new WorkpadSection(s))
283760
283832
  });
283761
283833
  }
283762
283834
  function adaptTrackerClient(plain) {
@@ -283813,7 +283885,63 @@ function makeResolvedPlugin(definition, config) {
283813
283885
  trackerLayer: adaptTrackerClient(plain)
283814
283886
  })));
283815
283887
  }
283816
- function resolvePlugin(resolved) {
283888
+ var PLUGIN_CACHE_DIR = joinPath(homedir16(), ".plot", "plugins");
283889
+ function detectNpmRegistry() {
283890
+ try {
283891
+ const output = execSync3("npm config get registry", { stdio: "pipe", timeout: 5000 }).toString().trim();
283892
+ if (output && output !== "undefined" && !output.includes("registry.npmjs.org"))
283893
+ return output;
283894
+ } catch {}
283895
+ try {
283896
+ const yarnrc = joinPath(process.cwd(), ".yarnrc.yml");
283897
+ if (existsSync25(yarnrc)) {
283898
+ const content = __require("fs").readFileSync(yarnrc, "utf-8");
283899
+ const match11 = /npmRegistryServer:\s*"?([^"\n]+)"?/.exec(content);
283900
+ if (match11?.[1] && !match11[1].includes("registry.npmjs.org"))
283901
+ return match11[1];
283902
+ }
283903
+ } catch {}
283904
+ return null;
283905
+ }
283906
+ function resolveNpmPlugin(packageName, options3) {
283907
+ return exports_Effect.tryPromise({
283908
+ try: async () => {
283909
+ const hash3 = createHash3("sha256").update(packageName).digest("hex").slice(0, 12);
283910
+ const cacheDir = joinPath(PLUGIN_CACHE_DIR, hash3);
283911
+ const markerPath = joinPath(cacheDir, "node_modules", ...packageName.split("/"));
283912
+ if (options3?.refresh || !existsSync25(markerPath)) {
283913
+ mkdirSync9(cacheDir, { recursive: true });
283914
+ writeFileSync10(joinPath(cacheDir, "package.json"), '{"private":true}');
283915
+ const registry2 = detectNpmRegistry();
283916
+ const registryFlag = registry2 ? ` --registry ${registry2}` : "";
283917
+ execSync3(`bun add ${packageName}${registryFlag}`, {
283918
+ cwd: cacheDir,
283919
+ stdio: "pipe",
283920
+ timeout: 30000
283921
+ });
283922
+ }
283923
+ const pkgJsonPath = joinPath(markerPath, "package.json");
283924
+ const pkgJson = JSON.parse(await Bun.file(pkgJsonPath).text());
283925
+ let entrypoint = "dist/index.js";
283926
+ if (typeof pkgJson.exports === "string") {
283927
+ entrypoint = pkgJson.exports;
283928
+ } else if (pkgJson.exports?.["."] != null) {
283929
+ const dotExport = pkgJson.exports["."];
283930
+ if (typeof dotExport === "string")
283931
+ entrypoint = dotExport;
283932
+ else if (typeof dotExport === "object" && dotExport !== null) {
283933
+ const rec = dotExport;
283934
+ entrypoint = rec["default"] ?? rec["import"] ?? rec["require"] ?? entrypoint;
283935
+ }
283936
+ } else if (pkgJson.main) {
283937
+ entrypoint = pkgJson.main;
283938
+ }
283939
+ return resolvePath6(markerPath, entrypoint);
283940
+ },
283941
+ catch: (cause) => new Error(`Failed to install tracker plugin "${packageName}": ${cause instanceof Error ? cause.message : String(cause)}`)
283942
+ }).pipe(exports_Effect.orDie);
283943
+ }
283944
+ function resolvePlugin(resolved, options3) {
283817
283945
  syncGithubRepoEnv(resolved);
283818
283946
  const rawConfig = buildPluginConfig(resolved);
283819
283947
  const builtin = builtinTrackers[resolved.trackerKind];
@@ -283822,10 +283950,11 @@ function resolvePlugin(resolved) {
283822
283950
  }
283823
283951
  return exports_Effect.gen(function* () {
283824
283952
  const kind = resolved.trackerKind;
283825
- const resolvedPath = kind.startsWith(".") ? resolvePath5(process.cwd(), kind) : kind;
283953
+ const pluginKind = classifyPluginKind(kind, process.cwd());
283954
+ const resolvedPath = pluginKind.type === "local" ? pluginKind.specifier : yield* resolveNpmPlugin(pluginKind.specifier, { refresh: options3?.refreshPlugins });
283826
283955
  const mod = yield* exports_Effect.tryPromise({
283827
283956
  try: () => import(resolvedPath),
283828
- catch: (cause) => new Error(`Failed to load tracker plugin "${kind}": ${cause instanceof Error ? cause.message : String(cause)}`)
283957
+ catch: (cause) => new Error(`Failed to load tracker plugin "${kind}" (${pluginKind.type}:${pluginKind.specifier}): ${cause instanceof Error ? cause.message : String(cause)}`)
283829
283958
  }).pipe(exports_Effect.orDie);
283830
283959
  const definition = mod.default;
283831
283960
  if (!definition || typeof definition !== "object" || typeof definition.name !== "string" || typeof definition.factory !== "function") {
@@ -283902,7 +284031,7 @@ async function boot(env3) {
283902
284031
  const content = readFileSync22(config.workflowPath, "utf-8");
283903
284032
  const workflowConfig = parseWorkflowFrontmatter(content);
283904
284033
  const resolved = new ResolvedConfig(workflowConfig, config.overrides);
283905
- const resolvedPlugin = await exports_Effect.runPromise(resolvePlugin(resolved));
284034
+ const resolvedPlugin = await exports_Effect.runPromise(resolvePlugin(resolved, { refreshPlugins: config.refreshPlugins }));
283906
284035
  runtime2 = makeOrchestratorRuntime(config, resolvedPlugin);
283907
284036
  orchestrator2 = await runtime2.runPromise(exports_Effect.gen(function* () {
283908
284037
  return yield* Orchestrator;
@@ -283956,7 +284085,7 @@ function postResponse(message) {
283956
284085
  function redirectProcessOutput(path14) {
283957
284086
  if (!path14)
283958
284087
  return;
283959
- mkdirSync9(dirname20(path14), { recursive: true });
284088
+ mkdirSync10(dirname20(path14), { recursive: true });
283960
284089
  const stream5 = createWriteStream5(path14, { flags: "a" });
283961
284090
  const write2 = (chunk) => {
283962
284091
  stream5.write(typeof chunk === "string" ? chunk : Buffer.from(chunk));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plot-ai/darwin-arm64",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "orchestrate coding agents against an issue tracker",