@plot-ai/darwin-arm64 0.0.5 → 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 +1 -1
- package/bin/package.json +1 -1
- package/bin/plot-ai +0 -0
- package/bin/tui-worker.js +300 -165
- package/package.json +1 -1
- package/web-dist/assets/index-Bw92jDU7.js +35 -0
- package/web-dist/index.html +1 -1
- package/web-dist/assets/index-pqfrb_rb.js +0 -35
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
|
|
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
|
|
@@ -181713,8 +181713,8 @@ class Issue extends exports_Schema.Class("Issue")({
|
|
|
181713
181713
|
blockedBy: exports_Schema.optional(exports_Schema.Array(BlockerRef)),
|
|
181714
181714
|
autoMerge: exports_Schema.optional(exports_Schema.Boolean),
|
|
181715
181715
|
metadata: exports_Schema.optional(exports_Schema.Record(exports_Schema.String, exports_Schema.Unknown)),
|
|
181716
|
-
createdAt: exports_Schema.NullOr(exports_Schema.
|
|
181717
|
-
updatedAt: exports_Schema.NullOr(exports_Schema.
|
|
181716
|
+
createdAt: exports_Schema.NullOr(exports_Schema.String),
|
|
181717
|
+
updatedAt: exports_Schema.NullOr(exports_Schema.String)
|
|
181718
181718
|
}) {
|
|
181719
181719
|
}
|
|
181720
181720
|
|
|
@@ -181743,7 +181743,7 @@ class TrackerRunContext extends exports_Schema.Class("TrackerRunContext")({
|
|
|
181743
181743
|
class TrackerClient extends exports_ServiceMap.Service()("TrackerClient") {
|
|
181744
181744
|
}
|
|
181745
181745
|
// packages/sdk/src/schemas/workflow.ts
|
|
181746
|
-
|
|
181746
|
+
var TrackerConfig = exports_Schema.StructWithRest(exports_Schema.Struct({
|
|
181747
181747
|
kind: exports_Schema.String,
|
|
181748
181748
|
endpoint: exports_Schema.optional(exports_Schema.String),
|
|
181749
181749
|
apiKey: exports_Schema.optional(exports_Schema.String),
|
|
@@ -181751,8 +181751,7 @@ class TrackerConfig extends exports_Schema.Class("TrackerConfig")({
|
|
|
181751
181751
|
dispatchStates: exports_Schema.optional(exports_Schema.Array(exports_Schema.String)),
|
|
181752
181752
|
parkedStates: exports_Schema.optional(exports_Schema.Array(exports_Schema.String)),
|
|
181753
181753
|
terminalStates: exports_Schema.optional(exports_Schema.Array(exports_Schema.String))
|
|
181754
|
-
})
|
|
181755
|
-
}
|
|
181754
|
+
}), [exports_Schema.Record(exports_Schema.String, exports_Schema.Unknown)]);
|
|
181756
181755
|
|
|
181757
181756
|
class PollingConfig extends exports_Schema.Class("PollingConfig")({
|
|
181758
181757
|
intervalMs: exports_Schema.optional(exports_Schema.Number)
|
|
@@ -182191,6 +182190,33 @@ class PlotRpcs extends exports_RpcGroup.make(exports_Rpc.make("TriggerRefresh",
|
|
|
182191
182190
|
payload: { identifier: exports_Schema.String }
|
|
182192
182191
|
})) {
|
|
182193
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
|
+
}
|
|
182194
182220
|
// packages/sdk/src/plugin/errors.ts
|
|
182195
182221
|
class PluginAuthError extends Error {
|
|
182196
182222
|
constructor(message) {
|
|
@@ -184736,6 +184762,7 @@ var ServerConfig2 = exports_Config.all({
|
|
|
184736
184762
|
return exports_Effect.succeed(s);
|
|
184737
184763
|
return exports_Effect.die(`invalid LOG_LEVEL: ${s}`);
|
|
184738
184764
|
})),
|
|
184765
|
+
refreshPlugins: exports_Config.boolean("REFRESH_PLUGINS").pipe(exports_Config.withDefault(false)),
|
|
184739
184766
|
overrides: WorkflowOverridesConfig
|
|
184740
184767
|
}).pipe(exports_Config.nested("PLOT"));
|
|
184741
184768
|
function parseWorkflowFrontmatter(content) {
|
|
@@ -185289,8 +185316,8 @@ var renderPrompt = (template, issue2, attempt, context3) => exports_Effect.try({
|
|
|
185289
185316
|
url: issue2.url,
|
|
185290
185317
|
labels: issue2.labels,
|
|
185291
185318
|
blocked_by: issue2.blockedBy,
|
|
185292
|
-
created_at: issue2.createdAt
|
|
185293
|
-
updated_at: issue2.updatedAt
|
|
185319
|
+
created_at: issue2.createdAt ?? null,
|
|
185320
|
+
updated_at: issue2.updatedAt ?? null
|
|
185294
185321
|
},
|
|
185295
185322
|
attempt,
|
|
185296
185323
|
context: context3
|
|
@@ -185558,8 +185585,8 @@ var sortCandidates = (issues) => [...issues].sort((a, b) => {
|
|
|
185558
185585
|
const pb = b.priority ?? 999;
|
|
185559
185586
|
if (pa !== pb)
|
|
185560
185587
|
return pa - pb;
|
|
185561
|
-
const ca = a.createdAt ?
|
|
185562
|
-
const cb = b.createdAt ?
|
|
185588
|
+
const ca = a.createdAt ? Date.parse(a.createdAt) || Infinity : Infinity;
|
|
185589
|
+
const cb = b.createdAt ? Date.parse(b.createdAt) || Infinity : Infinity;
|
|
185563
185590
|
if (ca !== cb)
|
|
185564
185591
|
return ca - cb;
|
|
185565
185592
|
return a.identifier.localeCompare(b.identifier);
|
|
@@ -185715,11 +185742,17 @@ var clearEventLog = (state2, issueId) => {
|
|
|
185715
185742
|
|
|
185716
185743
|
// packages/plot/src/core/application/tracker-fallback.ts
|
|
185717
185744
|
var isFatal = (error) => error instanceof TrackerAuthError || error instanceof TrackerValidationError || error instanceof TrackerNotFoundError;
|
|
185718
|
-
var withTrackerFallback = (effect3, operation, fallback) => effect3.pipe(exports_Effect.
|
|
185745
|
+
var withTrackerFallback = (effect3, operation, fallback) => effect3.pipe(exports_Effect.catchCause((cause) => {
|
|
185746
|
+
const error = exports_Cause.squash(cause);
|
|
185719
185747
|
if (isFatal(error)) {
|
|
185720
185748
|
return exports_Effect.logError("tracker_fatal_error").pipe(exports_Effect.annotateLogs({ operation, error: String(error) }), exports_Effect.flatMap(() => exports_Effect.die(error)));
|
|
185721
185749
|
}
|
|
185722
|
-
|
|
185750
|
+
const isDefect = exports_Cause.hasDies(cause);
|
|
185751
|
+
return exports_Effect.logWarning(isDefect ? "tracker_defect" : "tracker_fetch_failed").pipe(exports_Effect.annotateLogs({
|
|
185752
|
+
operation,
|
|
185753
|
+
error: String(error),
|
|
185754
|
+
defect: String(isDefect)
|
|
185755
|
+
}), exports_Effect.as(fallback));
|
|
185723
185756
|
}));
|
|
185724
185757
|
|
|
185725
185758
|
// packages/plot/src/core/application/dispatch.ts
|
|
@@ -186242,9 +186275,10 @@ class Orchestrator extends exports_ServiceMap.Service()("Orchestrator", {
|
|
|
186242
186275
|
if (cmd.coalesced) {
|
|
186243
186276
|
yield* exports_Ref.set(pendingPollTickRef, false);
|
|
186244
186277
|
}
|
|
186245
|
-
yield* tickRuntime.runTick.pipe(exports_Effect.
|
|
186278
|
+
yield* tickRuntime.runTick.pipe(exports_Effect.catchCause((cause) => exports_Effect.logError("tick_failed").pipe(exports_Effect.annotateLogs({
|
|
186246
186279
|
reason: cmd.reason,
|
|
186247
|
-
error: String(
|
|
186280
|
+
error: String(exports_Cause.squash(cause)),
|
|
186281
|
+
defect: String(exports_Cause.hasDies(cause))
|
|
186248
186282
|
}))));
|
|
186249
186283
|
})), exports_Match.discriminator("_tag")("runtime_event", (cmd) => consumeEvent(cmd.event)), exports_Match.discriminator("_tag")("retry_due", (cmd) => tickRuntime.handleRetryDue(cmd)), exports_Match.discriminator("_tag")("worker_exit", (cmd) => dispatchRuntime.handleWorkerExit(cmd).pipe(exports_Effect.catch((e) => exports_Effect.logError("worker_exit_failed").pipe(exports_Effect.annotateLogs({
|
|
186250
186284
|
issue_id: cmd.issueId,
|
|
@@ -186339,6 +186373,40 @@ class Orchestrator extends exports_ServiceMap.Service()("Orchestrator", {
|
|
|
186339
186373
|
}) {
|
|
186340
186374
|
static layer = exports_Layer.effect(this, this.make);
|
|
186341
186375
|
}
|
|
186376
|
+
// packages/plot/src/runtime-builder.ts
|
|
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
|
+
}
|
|
186409
|
+
|
|
186342
186410
|
// node_modules/.bun/@effect+platform-node-shared@4.0.0-beta.34+a3beb9cffb0732f9/node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js
|
|
186343
186411
|
import * as NodeChildProcess from "child_process";
|
|
186344
186412
|
|
|
@@ -187433,7 +187501,7 @@ var layer14 = /* @__PURE__ */ layer5.pipe(/* @__PURE__ */ provideMerge(/* @__PUR
|
|
|
187433
187501
|
// packages/plot/src/agent/pi-adapter.ts
|
|
187434
187502
|
import { existsSync as existsSync23 } from "fs";
|
|
187435
187503
|
import { dirname as dirname18, join as join31 } from "path";
|
|
187436
|
-
import { homedir as
|
|
187504
|
+
import { homedir as homedir14 } from "os";
|
|
187437
187505
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
187438
187506
|
|
|
187439
187507
|
// node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/index.js
|
|
@@ -187566,7 +187634,7 @@ __export(exports_dist4, {
|
|
|
187566
187634
|
|
|
187567
187635
|
// node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/config.js
|
|
187568
187636
|
import { existsSync, readFileSync as readFileSync2 } from "fs";
|
|
187569
|
-
import { homedir } from "os";
|
|
187637
|
+
import { homedir as homedir2 } from "os";
|
|
187570
187638
|
import { dirname as dirname3, join as join5, resolve as resolve6 } from "path";
|
|
187571
187639
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
187572
187640
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
@@ -187613,9 +187681,9 @@ function getPackageDir() {
|
|
|
187613
187681
|
const envDir = process.env.PI_PACKAGE_DIR;
|
|
187614
187682
|
if (envDir) {
|
|
187615
187683
|
if (envDir === "~")
|
|
187616
|
-
return
|
|
187684
|
+
return homedir2();
|
|
187617
187685
|
if (envDir.startsWith("~/"))
|
|
187618
|
-
return
|
|
187686
|
+
return homedir2() + envDir.slice(1);
|
|
187619
187687
|
return envDir;
|
|
187620
187688
|
}
|
|
187621
187689
|
if (isBunBinary) {
|
|
@@ -187675,12 +187743,12 @@ function getAgentDir() {
|
|
|
187675
187743
|
const envDir = process.env[ENV_AGENT_DIR];
|
|
187676
187744
|
if (envDir) {
|
|
187677
187745
|
if (envDir === "~")
|
|
187678
|
-
return
|
|
187746
|
+
return homedir2();
|
|
187679
187747
|
if (envDir.startsWith("~/"))
|
|
187680
|
-
return
|
|
187748
|
+
return homedir2() + envDir.slice(1);
|
|
187681
187749
|
return envDir;
|
|
187682
187750
|
}
|
|
187683
|
-
return join5(
|
|
187751
|
+
return join5(homedir2(), CONFIG_DIR_NAME, "agent");
|
|
187684
187752
|
}
|
|
187685
187753
|
function getCustomThemesDir() {
|
|
187686
187754
|
return join5(getAgentDir(), "themes");
|
|
@@ -245025,7 +245093,7 @@ __export(exports_dist3, {
|
|
|
245025
245093
|
// node_modules/.bun/@mariozechner+pi-tui@0.57.1/node_modules/@mariozechner/pi-tui/dist/autocomplete.js
|
|
245026
245094
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
245027
245095
|
import { readdirSync as readdirSync3, statSync as statSync2 } from "fs";
|
|
245028
|
-
import { homedir as
|
|
245096
|
+
import { homedir as homedir3 } from "os";
|
|
245029
245097
|
import { basename as basename3, dirname as dirname5, join as join11 } from "path";
|
|
245030
245098
|
|
|
245031
245099
|
// node_modules/.bun/@mariozechner+pi-tui@0.57.1/node_modules/@mariozechner/pi-tui/dist/fuzzy.js
|
|
@@ -245397,10 +245465,10 @@ class CombinedAutocompleteProvider {
|
|
|
245397
245465
|
}
|
|
245398
245466
|
expandHomePath(path6) {
|
|
245399
245467
|
if (path6.startsWith("~/")) {
|
|
245400
|
-
const expandedPath = join11(
|
|
245468
|
+
const expandedPath = join11(homedir3(), path6.slice(2));
|
|
245401
245469
|
return path6.endsWith("/") && !expandedPath.endsWith("/") ? `${expandedPath}/` : expandedPath;
|
|
245402
245470
|
} else if (path6 === "~") {
|
|
245403
|
-
return
|
|
245471
|
+
return homedir3();
|
|
245404
245472
|
}
|
|
245405
245473
|
return path6;
|
|
245406
245474
|
}
|
|
@@ -253918,7 +253986,7 @@ var UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
|
|
|
253918
253986
|
function normalizeUnicodeSpaces(str3) {
|
|
253919
253987
|
return str3.replace(UNICODE_SPACES, " ");
|
|
253920
253988
|
}
|
|
253921
|
-
function
|
|
253989
|
+
function expandPath2(p) {
|
|
253922
253990
|
const normalized = normalizeUnicodeSpaces(p);
|
|
253923
253991
|
if (normalized.startsWith("~/")) {
|
|
253924
253992
|
return path7.join(os3.homedir(), normalized.slice(2));
|
|
@@ -253928,8 +253996,8 @@ function expandPath(p) {
|
|
|
253928
253996
|
}
|
|
253929
253997
|
return normalized;
|
|
253930
253998
|
}
|
|
253931
|
-
function
|
|
253932
|
-
const expanded =
|
|
253999
|
+
function resolvePath4(extPath, cwd) {
|
|
254000
|
+
const expanded = expandPath2(extPath);
|
|
253933
254001
|
if (path7.isAbsolute(expanded)) {
|
|
253934
254002
|
return expanded;
|
|
253935
254003
|
}
|
|
@@ -254073,7 +254141,7 @@ function createExtension(extensionPath, resolvedPath) {
|
|
|
254073
254141
|
};
|
|
254074
254142
|
}
|
|
254075
254143
|
async function loadExtension(extensionPath, cwd, eventBus, runtime2) {
|
|
254076
|
-
const resolvedPath =
|
|
254144
|
+
const resolvedPath = resolvePath4(extensionPath, cwd);
|
|
254077
254145
|
try {
|
|
254078
254146
|
const factory = await loadExtensionModule(resolvedPath);
|
|
254079
254147
|
if (!factory) {
|
|
@@ -254199,7 +254267,7 @@ async function discoverAndLoadExtensions(configuredPaths, cwd, agentDir = getAge
|
|
|
254199
254267
|
const globalExtDir = path7.join(agentDir, "extensions");
|
|
254200
254268
|
addPaths(discoverExtensionsInDir(globalExtDir));
|
|
254201
254269
|
for (const p of configuredPaths) {
|
|
254202
|
-
const resolved =
|
|
254270
|
+
const resolved = resolvePath4(p, cwd);
|
|
254203
254271
|
if (fs6.existsSync(resolved) && fs6.statSync(resolved).isDirectory()) {
|
|
254204
254272
|
const entries3 = resolveExtensionEntries(resolved);
|
|
254205
254273
|
if (entries3) {
|
|
@@ -254963,7 +255031,7 @@ function wrapToolsWithExtensions(tools, runner) {
|
|
|
254963
255031
|
}
|
|
254964
255032
|
// node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/core/prompt-templates.js
|
|
254965
255033
|
import { existsSync as existsSync8, readdirSync as readdirSync5, readFileSync as readFileSync8, statSync as statSync4 } from "fs";
|
|
254966
|
-
import { homedir as
|
|
255034
|
+
import { homedir as homedir6 } from "os";
|
|
254967
255035
|
import { basename as basename4, isAbsolute as isAbsolute3, join as join14, resolve as resolve9, sep } from "path";
|
|
254968
255036
|
function parseCommandArgs(argsString) {
|
|
254969
255037
|
const args2 = [];
|
|
@@ -255074,11 +255142,11 @@ function loadTemplatesFromDir(dir, source, sourceLabel) {
|
|
|
255074
255142
|
function normalizePath(input) {
|
|
255075
255143
|
const trimmed = input.trim();
|
|
255076
255144
|
if (trimmed === "~")
|
|
255077
|
-
return
|
|
255145
|
+
return homedir6();
|
|
255078
255146
|
if (trimmed.startsWith("~/"))
|
|
255079
|
-
return join14(
|
|
255147
|
+
return join14(homedir6(), trimmed.slice(2));
|
|
255080
255148
|
if (trimmed.startsWith("~"))
|
|
255081
|
-
return join14(
|
|
255149
|
+
return join14(homedir6(), trimmed.slice(1));
|
|
255082
255150
|
return trimmed;
|
|
255083
255151
|
}
|
|
255084
255152
|
function resolvePromptPath(p, cwd) {
|
|
@@ -255182,7 +255250,7 @@ var BUILTIN_SLASH_COMMANDS = [
|
|
|
255182
255250
|
// node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/core/skills.js
|
|
255183
255251
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
255184
255252
|
import { existsSync as existsSync9, readdirSync as readdirSync6, readFileSync as readFileSync9, realpathSync, statSync as statSync5 } from "fs";
|
|
255185
|
-
import { homedir as
|
|
255253
|
+
import { homedir as homedir7 } from "os";
|
|
255186
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";
|
|
255187
255255
|
var MAX_NAME_LENGTH = 64;
|
|
255188
255256
|
var MAX_DESCRIPTION_LENGTH = 1024;
|
|
@@ -255383,11 +255451,11 @@ function escapeXml(str3) {
|
|
|
255383
255451
|
function normalizePath2(input) {
|
|
255384
255452
|
const trimmed = input.trim();
|
|
255385
255453
|
if (trimmed === "~")
|
|
255386
|
-
return
|
|
255454
|
+
return homedir7();
|
|
255387
255455
|
if (trimmed.startsWith("~/"))
|
|
255388
|
-
return join15(
|
|
255456
|
+
return join15(homedir7(), trimmed.slice(2));
|
|
255389
255457
|
if (trimmed.startsWith("~"))
|
|
255390
|
-
return join15(
|
|
255458
|
+
return join15(homedir7(), trimmed.slice(1));
|
|
255391
255459
|
return trimmed;
|
|
255392
255460
|
}
|
|
255393
255461
|
function resolveSkillPath(p, cwd) {
|
|
@@ -256504,7 +256572,7 @@ import { access as access3, readFile as readFile5 } from "fs/promises";
|
|
|
256504
256572
|
// node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/core/tools/path-utils.js
|
|
256505
256573
|
import { accessSync, constants as constants2 } from "fs";
|
|
256506
256574
|
import * as os4 from "os";
|
|
256507
|
-
import { isAbsolute as isAbsolute5, resolve as
|
|
256575
|
+
import { isAbsolute as isAbsolute5, resolve as resolvePath5 } from "path";
|
|
256508
256576
|
var UNICODE_SPACES2 = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
|
|
256509
256577
|
var NARROW_NO_BREAK_SPACE = "\u202F";
|
|
256510
256578
|
function normalizeUnicodeSpaces2(str3) {
|
|
@@ -256530,7 +256598,7 @@ function fileExists(filePath) {
|
|
|
256530
256598
|
function normalizeAtPrefix(filePath) {
|
|
256531
256599
|
return filePath.startsWith("@") ? filePath.slice(1) : filePath;
|
|
256532
256600
|
}
|
|
256533
|
-
function
|
|
256601
|
+
function expandPath3(filePath) {
|
|
256534
256602
|
const normalized = normalizeUnicodeSpaces2(normalizeAtPrefix(filePath));
|
|
256535
256603
|
if (normalized === "~") {
|
|
256536
256604
|
return os4.homedir();
|
|
@@ -256541,11 +256609,11 @@ function expandPath2(filePath) {
|
|
|
256541
256609
|
return normalized;
|
|
256542
256610
|
}
|
|
256543
256611
|
function resolveToCwd(filePath, cwd) {
|
|
256544
|
-
const expanded =
|
|
256612
|
+
const expanded = expandPath3(filePath);
|
|
256545
256613
|
if (isAbsolute5(expanded)) {
|
|
256546
256614
|
return expanded;
|
|
256547
256615
|
}
|
|
256548
|
-
return
|
|
256616
|
+
return resolvePath5(cwd, expanded);
|
|
256549
256617
|
}
|
|
256550
256618
|
function resolveReadPath(filePath, cwd) {
|
|
256551
256619
|
const resolved = resolveToCwd(filePath, cwd);
|
|
@@ -267039,7 +267107,7 @@ var import_ignore2 = __toESM(require_ignore(), 1);
|
|
|
267039
267107
|
import { spawn as spawn7, spawnSync as spawnSync5 } from "child_process";
|
|
267040
267108
|
import { createHash as createHash2 } from "crypto";
|
|
267041
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";
|
|
267042
|
-
import { homedir as
|
|
267110
|
+
import { homedir as homedir9, tmpdir as tmpdir5 } from "os";
|
|
267043
267111
|
import { basename as basename7, dirname as dirname13, join as join22, relative as relative3, resolve as resolve11, sep as sep4 } from "path";
|
|
267044
267112
|
|
|
267045
267113
|
// node_modules/.bun/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
|
|
@@ -269912,21 +269980,21 @@ class DefaultPackageManager {
|
|
|
269912
269980
|
resolvePath(input) {
|
|
269913
269981
|
const trimmed = input.trim();
|
|
269914
269982
|
if (trimmed === "~")
|
|
269915
|
-
return
|
|
269983
|
+
return homedir9();
|
|
269916
269984
|
if (trimmed.startsWith("~/"))
|
|
269917
|
-
return join22(
|
|
269985
|
+
return join22(homedir9(), trimmed.slice(2));
|
|
269918
269986
|
if (trimmed.startsWith("~"))
|
|
269919
|
-
return join22(
|
|
269987
|
+
return join22(homedir9(), trimmed.slice(1));
|
|
269920
269988
|
return resolve11(this.cwd, trimmed);
|
|
269921
269989
|
}
|
|
269922
269990
|
resolvePathFromBase(input, baseDir) {
|
|
269923
269991
|
const trimmed = input.trim();
|
|
269924
269992
|
if (trimmed === "~")
|
|
269925
|
-
return
|
|
269993
|
+
return homedir9();
|
|
269926
269994
|
if (trimmed.startsWith("~/"))
|
|
269927
|
-
return join22(
|
|
269995
|
+
return join22(homedir9(), trimmed.slice(2));
|
|
269928
269996
|
if (trimmed.startsWith("~"))
|
|
269929
|
-
return join22(
|
|
269997
|
+
return join22(homedir9(), trimmed.slice(1));
|
|
269930
269998
|
return resolve11(baseDir, trimmed);
|
|
269931
269999
|
}
|
|
269932
270000
|
collectPackageResources(packageRoot, accumulator, filter13, metadata) {
|
|
@@ -270086,7 +270154,7 @@ class DefaultPackageManager {
|
|
|
270086
270154
|
prompts: join22(projectBaseDir, "prompts"),
|
|
270087
270155
|
themes: join22(projectBaseDir, "themes")
|
|
270088
270156
|
};
|
|
270089
|
-
const userAgentsSkillsDir = join22(
|
|
270157
|
+
const userAgentsSkillsDir = join22(homedir9(), ".agents", "skills");
|
|
270090
270158
|
const projectAgentsSkillDirs = collectAncestorAgentsSkillDirs(this.cwd).filter((dir) => resolve11(dir) !== resolve11(userAgentsSkillsDir));
|
|
270091
270159
|
const addResources = (resourceType, paths, metadata, overrides, baseDir) => {
|
|
270092
270160
|
const target = this.getTargetMap(accumulator, resourceType);
|
|
@@ -270198,7 +270266,7 @@ class DefaultPackageManager {
|
|
|
270198
270266
|
}
|
|
270199
270267
|
// node_modules/.bun/@mariozechner+pi-coding-agent@0.57.1+e410abd818ecf4d1/node_modules/@mariozechner/pi-coding-agent/dist/core/resource-loader.js
|
|
270200
270268
|
import { existsSync as existsSync17, readdirSync as readdirSync10, readFileSync as readFileSync15, statSync as statSync9 } from "fs";
|
|
270201
|
-
import { homedir as
|
|
270269
|
+
import { homedir as homedir10 } from "os";
|
|
270202
270270
|
import { join as join23, resolve as resolve12, sep as sep5 } from "path";
|
|
270203
270271
|
function resolvePromptInput(input, description) {
|
|
270204
270272
|
if (!input) {
|
|
@@ -270576,11 +270644,11 @@ class DefaultResourceLoader {
|
|
|
270576
270644
|
const trimmed = p.trim();
|
|
270577
270645
|
let expanded = trimmed;
|
|
270578
270646
|
if (trimmed === "~") {
|
|
270579
|
-
expanded =
|
|
270647
|
+
expanded = homedir10();
|
|
270580
270648
|
} else if (trimmed.startsWith("~/")) {
|
|
270581
|
-
expanded = join23(
|
|
270649
|
+
expanded = join23(homedir10(), trimmed.slice(2));
|
|
270582
270650
|
} else if (trimmed.startsWith("~")) {
|
|
270583
|
-
expanded = join23(
|
|
270651
|
+
expanded = join23(homedir10(), trimmed.slice(1));
|
|
270584
270652
|
}
|
|
270585
270653
|
return resolve12(this.cwd, expanded);
|
|
270586
270654
|
}
|
|
@@ -282743,7 +282811,7 @@ function resolveModel(modelSpec, registry2, available) {
|
|
|
282743
282811
|
var agentDir = dirname18(fileURLToPath5(import.meta.url));
|
|
282744
282812
|
var repoSkillDirectories = [".agent/skills", ".claude/skills"];
|
|
282745
282813
|
var PlotPiSkillsDir = exports_Config.string("PI_SKILLS_DIR").pipe(exports_Config.nested("PLOT"), exports_Config.withDefault(join31(agentDir, "../../resources/skills")));
|
|
282746
|
-
var PlotAgentDir = exports_Config.string("CODING_AGENT_DIR").pipe(exports_Config.nested("PLOT"), exports_Config.withDefault(join31(
|
|
282814
|
+
var PlotAgentDir = exports_Config.string("CODING_AGENT_DIR").pipe(exports_Config.nested("PLOT"), exports_Config.withDefault(join31(homedir14(), ".plot", "agent")));
|
|
282747
282815
|
function resolvePlotSkillPaths(workspacePath, coreSkillsDir) {
|
|
282748
282816
|
return [
|
|
282749
282817
|
coreSkillsDir,
|
|
@@ -282986,21 +283054,36 @@ function mapSessionEvent(acc, event, threadId, issueId, issueIdentifier) {
|
|
|
282986
283054
|
var createEventStream = (config) => exports_Stream.unwrap(exports_Effect.gen(function* () {
|
|
282987
283055
|
const plotAgentDir = yield* PlotAgentDir.asEffect().pipe(exports_Effect.mapError((e) => new AgentRunnerError({ code: "config_error", message: String(e) })));
|
|
282988
283056
|
const plotSkillsDir = yield* PlotPiSkillsDir.asEffect().pipe(exports_Effect.mapError((e) => new AgentRunnerError({ code: "config_error", message: String(e) })));
|
|
283057
|
+
const bootstrapStart = Date.now();
|
|
282989
283058
|
const authStorage = AuthStorage.create(join31(plotAgentDir, "auth.json"));
|
|
282990
283059
|
const modelRegistry2 = new ModelRegistry(authStorage, join31(plotAgentDir, "models.json"));
|
|
282991
283060
|
const available = modelRegistry2.getAvailable();
|
|
282992
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
|
+
}
|
|
282993
283079
|
const skillPaths = resolvePlotSkillPaths(config.workspacePath, plotSkillsDir);
|
|
282994
|
-
yield* exports_Effect.logDebug("agent_skill_paths").pipe(exports_Effect.annotateLogs({
|
|
282995
|
-
issue_id: config.issueId,
|
|
282996
|
-
skill_paths: JSON.stringify(skillPaths),
|
|
282997
|
-
core_skills_dir: plotSkillsDir,
|
|
282998
|
-
workspace: config.workspacePath
|
|
282999
|
-
}));
|
|
283000
283080
|
const loader = new DefaultResourceLoader({
|
|
283001
283081
|
cwd: config.workspacePath,
|
|
283002
283082
|
systemPromptOverride: () => config.systemPrompt,
|
|
283083
|
+
noExtensions: true,
|
|
283003
283084
|
noSkills: true,
|
|
283085
|
+
noPromptTemplates: true,
|
|
283086
|
+
noThemes: true,
|
|
283004
283087
|
additionalSkillPaths: skillPaths
|
|
283005
283088
|
});
|
|
283006
283089
|
yield* exports_Effect.tryPromise({
|
|
@@ -283011,13 +283094,6 @@ var createEventStream = (config) => exports_Stream.unwrap(exports_Effect.gen(fun
|
|
|
283011
283094
|
})
|
|
283012
283095
|
});
|
|
283013
283096
|
const { skills: loadedSkills } = loader.getSkills();
|
|
283014
|
-
yield* exports_Effect.logInfo("agent_skills_loaded").pipe(exports_Effect.annotateLogs({
|
|
283015
|
-
issue_id: config.issueId,
|
|
283016
|
-
skill_count: String(loadedSkills.length),
|
|
283017
|
-
skill_names: JSON.stringify(loadedSkills.map((s) => s.name)),
|
|
283018
|
-
system_prompt_length: String(config.systemPrompt.length),
|
|
283019
|
-
system_prompt_first_200: config.systemPrompt.slice(0, 200)
|
|
283020
|
-
}));
|
|
283021
283097
|
const { session } = yield* exports_Effect.tryPromise({
|
|
283022
283098
|
try: () => createAgentSession({
|
|
283023
283099
|
cwd: config.workspacePath,
|
|
@@ -283038,10 +283114,11 @@ var createEventStream = (config) => exports_Stream.unwrap(exports_Effect.gen(fun
|
|
|
283038
283114
|
component: "agent",
|
|
283039
283115
|
issue_id: config.issueId,
|
|
283040
283116
|
identifier: config.issueIdentifier,
|
|
283041
|
-
|
|
283042
|
-
model_id: model.id,
|
|
283117
|
+
model: `${model.provider}/${model.id}`,
|
|
283043
283118
|
workspace: config.workspacePath,
|
|
283044
|
-
max_turns: String(config.maxTurns)
|
|
283119
|
+
max_turns: String(config.maxTurns),
|
|
283120
|
+
skill_count: String(loadedSkills.length),
|
|
283121
|
+
bootstrap_ms: String(Date.now() - bootstrapStart)
|
|
283045
283122
|
}));
|
|
283046
283123
|
const abortingRef = yield* exports_Ref.make(false);
|
|
283047
283124
|
const abortSession = exports_Effect.fnUntraced(function* (reason) {
|
|
@@ -283098,7 +283175,7 @@ var execFileAsync = promisify(execFile);
|
|
|
283098
283175
|
|
|
283099
283176
|
// packages/plot/src/tracker/beads/daemon-transport.ts
|
|
283100
283177
|
import { existsSync as existsSync24 } from "fs";
|
|
283101
|
-
import { homedir as
|
|
283178
|
+
import { homedir as homedir15 } from "os";
|
|
283102
283179
|
import { dirname as dirname19, join as join32 } from "path";
|
|
283103
283180
|
import { createConnection } from "net";
|
|
283104
283181
|
function walkUp(startDir, filename, globalFallback = false) {
|
|
@@ -283113,7 +283190,7 @@ function walkUp(startDir, filename, globalFallback = false) {
|
|
|
283113
283190
|
dir = parent;
|
|
283114
283191
|
}
|
|
283115
283192
|
if (globalFallback) {
|
|
283116
|
-
const globalPath = join32(
|
|
283193
|
+
const globalPath = join32(homedir15(), ".beads", filename);
|
|
283117
283194
|
if (existsSync24(globalPath))
|
|
283118
283195
|
return globalPath;
|
|
283119
283196
|
}
|
|
@@ -283430,7 +283507,7 @@ async function createBeadsOps(config) {
|
|
|
283430
283507
|
const repoArgs = config.githubRepo ? ["--repo", config.githubRepo] : [];
|
|
283431
283508
|
reviews = await fetchPrReviewFeedback(issueId, repoArgs, workspaceRoot);
|
|
283432
283509
|
}
|
|
283433
|
-
return
|
|
283510
|
+
return { workpad, reviewFeedback: reviews };
|
|
283434
283511
|
};
|
|
283435
283512
|
return {
|
|
283436
283513
|
listAllIssues,
|
|
@@ -283440,48 +283517,48 @@ async function createBeadsOps(config) {
|
|
|
283440
283517
|
fetchRunContext
|
|
283441
283518
|
};
|
|
283442
283519
|
}
|
|
283443
|
-
var
|
|
283520
|
+
var beads_default = defineTracker({
|
|
283444
283521
|
name: "beads",
|
|
283445
|
-
|
|
283522
|
+
config(raw) {
|
|
283446
283523
|
return {
|
|
283447
283524
|
...validateCommonTrackerFields(raw),
|
|
283448
283525
|
beadsDir: typeof raw["beadsDir"] === "string" ? raw["beadsDir"] : undefined
|
|
283449
283526
|
};
|
|
283450
283527
|
},
|
|
283451
|
-
async
|
|
283452
|
-
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);
|
|
283453
283530
|
const ops = await createBeadsOps({
|
|
283454
|
-
beadsDir: config.beadsDir,
|
|
283455
|
-
githubRepo: config.githubRepo,
|
|
283456
|
-
dispatchStates: config.dispatchStates ?? [],
|
|
283531
|
+
beadsDir: ctx.config.beadsDir,
|
|
283532
|
+
githubRepo: ctx.config.githubRepo,
|
|
283533
|
+
dispatchStates: ctx.config.dispatchStates ?? [],
|
|
283457
283534
|
allStates
|
|
283458
283535
|
});
|
|
283459
|
-
return {
|
|
283460
|
-
|
|
283461
|
-
|
|
283462
|
-
|
|
283463
|
-
|
|
283464
|
-
|
|
283465
|
-
|
|
283466
|
-
|
|
283467
|
-
|
|
283468
|
-
|
|
283469
|
-
|
|
283470
|
-
|
|
283471
|
-
|
|
283472
|
-
|
|
283473
|
-
|
|
283474
|
-
|
|
283475
|
-
|
|
283476
|
-
|
|
283477
|
-
|
|
283478
|
-
|
|
283479
|
-
|
|
283480
|
-
|
|
283481
|
-
|
|
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);
|
|
283482
283560
|
}
|
|
283483
|
-
};
|
|
283484
|
-
var beads_default = plugin2;
|
|
283561
|
+
});
|
|
283485
283562
|
// packages/plot/src/tracker/github/index.ts
|
|
283486
283563
|
async function ghApi(args2, cwd) {
|
|
283487
283564
|
const { stdout } = await execFileAsync("gh", args2, {
|
|
@@ -283614,7 +283691,7 @@ function createGithubOps(config) {
|
|
|
283614
283691
|
repoFlag
|
|
283615
283692
|
]);
|
|
283616
283693
|
}
|
|
283617
|
-
return
|
|
283694
|
+
return { workpad, reviewFeedback: reviews };
|
|
283618
283695
|
};
|
|
283619
283696
|
return {
|
|
283620
283697
|
listIssues,
|
|
@@ -283624,54 +283701,55 @@ function createGithubOps(config) {
|
|
|
283624
283701
|
fetchRunContext
|
|
283625
283702
|
};
|
|
283626
283703
|
}
|
|
283627
|
-
var
|
|
283704
|
+
var github_default = defineTracker({
|
|
283628
283705
|
name: "github",
|
|
283629
|
-
|
|
283706
|
+
config(raw) {
|
|
283630
283707
|
return validateCommonTrackerFields(raw);
|
|
283631
283708
|
},
|
|
283632
|
-
async
|
|
283709
|
+
async setup(ctx) {
|
|
283633
283710
|
await getAuthToken();
|
|
283634
|
-
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}`];
|
|
283635
283713
|
const ops = createGithubOps({
|
|
283636
283714
|
owner,
|
|
283637
283715
|
repo,
|
|
283638
|
-
dispatchStates: config.dispatchStates,
|
|
283639
|
-
parkedStates: config.parkedStates,
|
|
283640
|
-
terminalStates: config.terminalStates
|
|
283716
|
+
dispatchStates: ctx.config.dispatchStates,
|
|
283717
|
+
parkedStates: ctx.config.parkedStates,
|
|
283718
|
+
terminalStates: ctx.config.terminalStates
|
|
283641
283719
|
});
|
|
283642
|
-
return {
|
|
283643
|
-
|
|
283644
|
-
|
|
283645
|
-
|
|
283646
|
-
|
|
283647
|
-
|
|
283648
|
-
|
|
283649
|
-
|
|
283650
|
-
|
|
283651
|
-
|
|
283652
|
-
|
|
283653
|
-
|
|
283654
|
-
|
|
283655
|
-
|
|
283656
|
-
|
|
283657
|
-
|
|
283658
|
-
|
|
283659
|
-
|
|
283660
|
-
|
|
283661
|
-
|
|
283662
|
-
|
|
283663
|
-
|
|
283664
|
-
|
|
283665
|
-
|
|
283666
|
-
|
|
283667
|
-
|
|
283668
|
-
|
|
283669
|
-
|
|
283670
|
-
|
|
283671
|
-
|
|
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);
|
|
283672
283751
|
}
|
|
283673
|
-
};
|
|
283674
|
-
var github_default = plugin3;
|
|
283752
|
+
});
|
|
283675
283753
|
// packages/plot/src/runtime-builder.ts
|
|
283676
283754
|
function parseServerLogLevel(s) {
|
|
283677
283755
|
switch (s.toLowerCase()) {
|
|
@@ -283714,11 +283792,6 @@ function mapPluginError(error4, operation) {
|
|
|
283714
283792
|
const message = error4 instanceof Error ? error4.message : String(error4);
|
|
283715
283793
|
return new TrackerNetworkError({ message: `${operation}: ${message}` });
|
|
283716
283794
|
}
|
|
283717
|
-
function toDateTime(value7) {
|
|
283718
|
-
if (value7 == null)
|
|
283719
|
-
return null;
|
|
283720
|
-
return exports_DateTime.fromDateUnsafe(new Date(value7));
|
|
283721
|
-
}
|
|
283722
283795
|
function normalizeIssue(plain) {
|
|
283723
283796
|
return new Issue({
|
|
283724
283797
|
id: plain.id,
|
|
@@ -283737,22 +283810,25 @@ function normalizeIssue(plain) {
|
|
|
283737
283810
|
})),
|
|
283738
283811
|
metadata: plain.metadata,
|
|
283739
283812
|
autoMerge: plain.autoMerge,
|
|
283740
|
-
createdAt:
|
|
283741
|
-
updatedAt:
|
|
283813
|
+
createdAt: plain.createdAt,
|
|
283814
|
+
updatedAt: plain.updatedAt
|
|
283742
283815
|
});
|
|
283743
283816
|
}
|
|
283744
283817
|
function normalizeIssueStateEntry(plain) {
|
|
283745
283818
|
return new IssueStateEntry({ id: plain.id, state: plain.state });
|
|
283746
283819
|
}
|
|
283747
|
-
function normalizeRunContext(
|
|
283748
|
-
if (
|
|
283820
|
+
function normalizeRunContext(raw) {
|
|
283821
|
+
if (raw == null)
|
|
283822
|
+
return null;
|
|
283823
|
+
const built = buildRunContext(raw);
|
|
283824
|
+
if (built == null)
|
|
283749
283825
|
return null;
|
|
283750
283826
|
return new TrackerRunContext({
|
|
283751
|
-
raw:
|
|
283752
|
-
promptContext:
|
|
283753
|
-
workpad:
|
|
283754
|
-
reviewFeedback:
|
|
283755
|
-
workpadSections: (
|
|
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))
|
|
283756
283832
|
});
|
|
283757
283833
|
}
|
|
283758
283834
|
function adaptTrackerClient(plain) {
|
|
@@ -283809,7 +283885,63 @@ function makeResolvedPlugin(definition, config) {
|
|
|
283809
283885
|
trackerLayer: adaptTrackerClient(plain)
|
|
283810
283886
|
})));
|
|
283811
283887
|
}
|
|
283812
|
-
|
|
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) {
|
|
283813
283945
|
syncGithubRepoEnv(resolved);
|
|
283814
283946
|
const rawConfig = buildPluginConfig(resolved);
|
|
283815
283947
|
const builtin = builtinTrackers[resolved.trackerKind];
|
|
@@ -283818,16 +283950,19 @@ function resolvePlugin(resolved) {
|
|
|
283818
283950
|
}
|
|
283819
283951
|
return exports_Effect.gen(function* () {
|
|
283820
283952
|
const kind = resolved.trackerKind;
|
|
283953
|
+
const pluginKind = classifyPluginKind(kind, process.cwd());
|
|
283954
|
+
const resolvedPath = pluginKind.type === "local" ? pluginKind.specifier : yield* resolveNpmPlugin(pluginKind.specifier, { refresh: options3?.refreshPlugins });
|
|
283821
283955
|
const mod = yield* exports_Effect.tryPromise({
|
|
283822
|
-
try: () => import(
|
|
283823
|
-
catch: (cause) => new Error(`Failed to load tracker plugin "${kind}": ${cause instanceof Error ? cause.message : String(cause)}`)
|
|
283956
|
+
try: () => import(resolvedPath),
|
|
283957
|
+
catch: (cause) => new Error(`Failed to load tracker plugin "${kind}" (${pluginKind.type}:${pluginKind.specifier}): ${cause instanceof Error ? cause.message : String(cause)}`)
|
|
283824
283958
|
}).pipe(exports_Effect.orDie);
|
|
283825
283959
|
const definition = mod.default;
|
|
283826
283960
|
if (!definition || typeof definition !== "object" || typeof definition.name !== "string" || typeof definition.factory !== "function") {
|
|
283827
283961
|
return yield* exports_Effect.die(new Error(`Tracker plugin "${kind}" does not export a valid default tracker plugin definition`));
|
|
283828
283962
|
}
|
|
283829
283963
|
const config = yield* resolveDefinitionConfig(definition, rawConfig);
|
|
283830
|
-
|
|
283964
|
+
const result6 = yield* makeResolvedPlugin(definition, config);
|
|
283965
|
+
return result6;
|
|
283831
283966
|
});
|
|
283832
283967
|
}
|
|
283833
283968
|
function makeAppLayer(resolvedPlugin) {
|
|
@@ -283896,7 +284031,7 @@ async function boot(env3) {
|
|
|
283896
284031
|
const content = readFileSync22(config.workflowPath, "utf-8");
|
|
283897
284032
|
const workflowConfig = parseWorkflowFrontmatter(content);
|
|
283898
284033
|
const resolved = new ResolvedConfig(workflowConfig, config.overrides);
|
|
283899
|
-
const resolvedPlugin = await exports_Effect.runPromise(resolvePlugin(resolved));
|
|
284034
|
+
const resolvedPlugin = await exports_Effect.runPromise(resolvePlugin(resolved, { refreshPlugins: config.refreshPlugins }));
|
|
283900
284035
|
runtime2 = makeOrchestratorRuntime(config, resolvedPlugin);
|
|
283901
284036
|
orchestrator2 = await runtime2.runPromise(exports_Effect.gen(function* () {
|
|
283902
284037
|
return yield* Orchestrator;
|
|
@@ -283950,7 +284085,7 @@ function postResponse(message) {
|
|
|
283950
284085
|
function redirectProcessOutput(path14) {
|
|
283951
284086
|
if (!path14)
|
|
283952
284087
|
return;
|
|
283953
|
-
|
|
284088
|
+
mkdirSync10(dirname20(path14), { recursive: true });
|
|
283954
284089
|
const stream5 = createWriteStream5(path14, { flags: "a" });
|
|
283955
284090
|
const write2 = (chunk) => {
|
|
283956
284091
|
stream5.write(typeof chunk === "string" ? chunk : Buffer.from(chunk));
|