@brainervirus/workit-pi 8.5.0 → 8.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/workit.js +59 -28
- package/package.json +1 -1
package/dist/workit.js
CHANGED
|
@@ -19172,12 +19172,11 @@ var changedTurnContext = (input, text) => {
|
|
|
19172
19172
|
writeTurnDigest(file, digest);
|
|
19173
19173
|
return text;
|
|
19174
19174
|
};
|
|
19175
|
-
var seedTurnContext = (input, descriptor) => {
|
|
19175
|
+
var seedTurnContext = (input, descriptor, text = turnContextText(input, descriptor)) => {
|
|
19176
19176
|
const file = turnMarker(input);
|
|
19177
19177
|
if (!file)
|
|
19178
19178
|
return;
|
|
19179
19179
|
pruneTurnDigests(path20.dirname(file), Date.now());
|
|
19180
|
-
const text = turnContextText(input, descriptor);
|
|
19181
19180
|
if (text)
|
|
19182
19181
|
writeTurnDigest(file, digestOf(text));
|
|
19183
19182
|
else
|
|
@@ -20013,7 +20012,7 @@ var SKILL_HOST = {
|
|
|
20013
20012
|
var PROMPT_INTENTS = [
|
|
20014
20013
|
[
|
|
20015
20014
|
"workit-debug",
|
|
20016
|
-
/\b(flaky|regression|(?:is|are|got|looks) broken|debug (?:this|it|the|why)|fix (?:the|this|a) bug)\b/i
|
|
20015
|
+
/\b(flaky|regressed|(?:is|introduced) a regression|regression (?:in|after|since|from)|(?:is|are|got|looks) broken|debug (?:this|it|the|why)|fix (?:the|this|a) bug)\b/i
|
|
20017
20016
|
],
|
|
20018
20017
|
[
|
|
20019
20018
|
"workit-continue",
|
|
@@ -20025,14 +20024,17 @@ var PROMPT_INTENTS = [
|
|
|
20025
20024
|
],
|
|
20026
20025
|
[
|
|
20027
20026
|
"workit-ship",
|
|
20028
|
-
/\b(ship (?:it|this|the)|babysit|open (?:a|the) (?:PR|pr|MR|mr)|merge (?:the|this|my) (?:PR|pr|MR|mr|branch)|(?:get|until|make) CI (?:is )?green)\b/i
|
|
20027
|
+
/\b(ship (?:it|this|the)|babysit|open (?:a|the) (?:PR|pr|MR|mr)(?=\s*$|\s+(?:for|to|on|with|and|against|into|from|after|once)\b|[.!,;])|merge (?:the|this|my) (?:PR|pr|MR|mr|branch)|(?:get|until|make) CI (?:is )?green)\b/i
|
|
20029
20028
|
],
|
|
20030
20029
|
["workit-bdd", /\b(BDD|TDD|acceptance criteria|Given\/When\/Then)(?![\w/])/],
|
|
20031
20030
|
["workit-test-audit", /\b(test audit|audit the tests|tautolog\w*|weak tests)\b/i],
|
|
20032
20031
|
["workit-deslop", /\b(deslop|slop|dead code)\b/i],
|
|
20033
|
-
[
|
|
20032
|
+
[
|
|
20033
|
+
"workit-fanout",
|
|
20034
|
+
/\b(fan(?: |-)?out|parallelize|parallel agents|agent swarm|swarm of agents)\b/i
|
|
20035
|
+
],
|
|
20034
20036
|
["workit-verify-app", /\b(verify the app|smoke test|prove it works)\b/i],
|
|
20035
|
-
["workit-retro", /\b(
|
|
20037
|
+
["workit-retro", /\b((?:a|the) retro(?![-\w]|\.\w)|retrospective)/i],
|
|
20036
20038
|
["workit-architecture", /\b(deepen (?:the )?modules|architecture (?:review|pass|audit))\b/i],
|
|
20037
20039
|
[
|
|
20038
20040
|
"workit-shape",
|
|
@@ -20110,6 +20112,8 @@ var skillReadIn = (command, dialect = "posix") => {
|
|
|
20110
20112
|
for (const { words } of segmentsOf(command, dialect)) {
|
|
20111
20113
|
if (!READERS.has((words[0]?.split(/[\\/]/).at(-1) ?? "").toLowerCase()))
|
|
20112
20114
|
continue;
|
|
20115
|
+
if (words.some((word) => /^(?:-i(?:\.\w+)?|--in-place(?:=.*)?)$/.test(word)))
|
|
20116
|
+
continue;
|
|
20113
20117
|
for (const word of words.slice(1)) {
|
|
20114
20118
|
const skill = skillFileIn(word);
|
|
20115
20119
|
if (skill)
|
|
@@ -20407,10 +20411,10 @@ var PI_DESCRIPTOR = {
|
|
|
20407
20411
|
shellPolicy: { deny: "native", channel: "block", failClosed: false },
|
|
20408
20412
|
context: {
|
|
20409
20413
|
sessionStart: "native",
|
|
20410
|
-
perTurn: "
|
|
20414
|
+
perTurn: "native",
|
|
20411
20415
|
afterCompact: "native",
|
|
20412
20416
|
task: "session-bound",
|
|
20413
|
-
turnResend: "
|
|
20417
|
+
turnResend: "on-change"
|
|
20414
20418
|
},
|
|
20415
20419
|
subagents: {
|
|
20416
20420
|
identity: "none",
|
|
@@ -20467,21 +20471,39 @@ var piContext = (ctx) => ({
|
|
|
20467
20471
|
constraints: [],
|
|
20468
20472
|
now: () => new Date().toISOString().replace(/\.\d{3}Z$/, "Z")
|
|
20469
20473
|
});
|
|
20470
|
-
var
|
|
20474
|
+
var turnContext = (ctx) => {
|
|
20475
|
+
if (!ctx.isProjectTrusted())
|
|
20476
|
+
return null;
|
|
20477
|
+
try {
|
|
20478
|
+
const text = sessionCompactContext(new TaskStore(ctx.cwd), { host: "pi", handle: ctx.sessionManager.getSessionId() }, piContext(ctx));
|
|
20479
|
+
return text ? `Current task context: ${text}` : null;
|
|
20480
|
+
} catch {
|
|
20481
|
+
return null;
|
|
20482
|
+
}
|
|
20483
|
+
};
|
|
20484
|
+
var turnInput = (ctx) => ({
|
|
20485
|
+
host: "pi",
|
|
20486
|
+
cwd: ctx.cwd,
|
|
20487
|
+
session: {
|
|
20488
|
+
id: ctx.sessionManager.getSessionId(),
|
|
20489
|
+
agentId: null,
|
|
20490
|
+
agentType: null,
|
|
20491
|
+
parentId: null
|
|
20492
|
+
},
|
|
20493
|
+
permissionMode: null,
|
|
20494
|
+
transcriptPath: null,
|
|
20495
|
+
event: { kind: "context.turn" }
|
|
20496
|
+
});
|
|
20497
|
+
var workitContext = (ctx, taskContext = turnContext(ctx)) => {
|
|
20471
20498
|
const session = ctx.sessionManager.getSessionId();
|
|
20472
20499
|
if (!ctx.isProjectTrusted())
|
|
20473
20500
|
return `${invariantBootstrap()}
|
|
20474
20501
|
|
|
20475
20502
|
Native Pi session: ${session}. Project-local Workit state is unavailable until Pi trusts this project.`;
|
|
20476
|
-
let taskContext = null;
|
|
20477
|
-
try {
|
|
20478
|
-
taskContext = sessionCompactContext(new TaskStore(ctx.cwd), { host: "pi", handle: session }, piContext(ctx));
|
|
20479
|
-
} catch {}
|
|
20480
|
-
const taskText = taskContext ? `
|
|
20481
|
-
Current task context: ${taskContext}` : "";
|
|
20482
20503
|
return `${invariantBootstrap()}
|
|
20483
20504
|
|
|
20484
|
-
Native Pi session: ${session}.${
|
|
20505
|
+
Native Pi session: ${session}.${taskContext ? `
|
|
20506
|
+
${taskContext}` : ""}`;
|
|
20485
20507
|
};
|
|
20486
20508
|
var unfinishedTaskOffer2 = (ctx) => {
|
|
20487
20509
|
if (!ctx.isProjectTrusted() || process.env.WORKIT_PI_WORKER_ID)
|
|
@@ -21198,11 +21220,9 @@ var runtimeFor = (ctx) => ({
|
|
|
21198
21220
|
workitExtension: fileURLToPath2(import.meta.url),
|
|
21199
21221
|
root: ctx.cwd
|
|
21200
21222
|
});
|
|
21201
|
-
var contextMessage = (ctx,
|
|
21223
|
+
var contextMessage = (ctx, content) => ({
|
|
21202
21224
|
customType: "workit-context",
|
|
21203
|
-
content
|
|
21204
|
-
|
|
21205
|
-
${offer}` : ""}`,
|
|
21225
|
+
content,
|
|
21206
21226
|
display: false,
|
|
21207
21227
|
details: { session: piContext(ctx).caller.actor }
|
|
21208
21228
|
});
|
|
@@ -21510,15 +21530,26 @@ function extension(pi) {
|
|
|
21510
21530
|
pi.on("before_agent_start", (event, ctx) => {
|
|
21511
21531
|
const nudge = skillPromptNudge(event.prompt, ctx);
|
|
21512
21532
|
const id = ctx.sessionManager.getSessionId();
|
|
21513
|
-
|
|
21514
|
-
|
|
21515
|
-
|
|
21516
|
-
|
|
21517
|
-
|
|
21518
|
-
|
|
21519
|
-
|
|
21533
|
+
const trusted = ctx.isProjectTrusted();
|
|
21534
|
+
const task = turnContext(ctx);
|
|
21535
|
+
let content;
|
|
21536
|
+
if (sessions.has(id)) {
|
|
21537
|
+
content = trusted ? changedTurnContext(turnInput(ctx), task) : null;
|
|
21538
|
+
} else {
|
|
21539
|
+
sessions.add(id);
|
|
21540
|
+
const offer = historyOfferSessions.has(id) ? null : unfinishedTaskOffer2(ctx);
|
|
21541
|
+
historyOfferSessions.add(id);
|
|
21542
|
+
if (trusted)
|
|
21543
|
+
seedTurnContext(turnInput(ctx), PI_DESCRIPTOR, task);
|
|
21544
|
+
content = `${workitContext(ctx, task)}${offer ? `
|
|
21545
|
+
|
|
21546
|
+
${offer}` : ""}`;
|
|
21547
|
+
}
|
|
21548
|
+
if (content)
|
|
21549
|
+
return { message: contextMessage(ctx, nudge ? `${content}
|
|
21520
21550
|
|
|
21521
|
-
${nudge}`
|
|
21551
|
+
${nudge}` : content) };
|
|
21552
|
+
return nudge ? { message: { customType: "workit-skill", content: nudge, display: false } } : undefined;
|
|
21522
21553
|
});
|
|
21523
21554
|
pi.on("session_before_compact", () => {
|
|
21524
21555
|
return;
|