@brainervirus/workit-pi 8.5.2 → 8.6.1

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.
Files changed (2) hide show
  1. package/dist/workit.js +50 -24
  2. 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
@@ -20412,10 +20411,10 @@ var PI_DESCRIPTOR = {
20412
20411
  shellPolicy: { deny: "native", channel: "block", failClosed: false },
20413
20412
  context: {
20414
20413
  sessionStart: "native",
20415
- perTurn: "partial",
20414
+ perTurn: "native",
20416
20415
  afterCompact: "native",
20417
20416
  task: "session-bound",
20418
- turnResend: "per-session"
20417
+ turnResend: "on-change"
20419
20418
  },
20420
20419
  subagents: {
20421
20420
  identity: "none",
@@ -20472,21 +20471,39 @@ var piContext = (ctx) => ({
20472
20471
  constraints: [],
20473
20472
  now: () => new Date().toISOString().replace(/\.\d{3}Z$/, "Z")
20474
20473
  });
20475
- var workitContext = (ctx) => {
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)) => {
20476
20498
  const session = ctx.sessionManager.getSessionId();
20477
20499
  if (!ctx.isProjectTrusted())
20478
20500
  return `${invariantBootstrap()}
20479
20501
 
20480
20502
  Native Pi session: ${session}. Project-local Workit state is unavailable until Pi trusts this project.`;
20481
- let taskContext = null;
20482
- try {
20483
- taskContext = sessionCompactContext(new TaskStore(ctx.cwd), { host: "pi", handle: session }, piContext(ctx));
20484
- } catch {}
20485
- const taskText = taskContext ? `
20486
- Current task context: ${taskContext}` : "";
20487
20503
  return `${invariantBootstrap()}
20488
20504
 
20489
- Native Pi session: ${session}.${taskText}`;
20505
+ Native Pi session: ${session}.${taskContext ? `
20506
+ ${taskContext}` : ""}`;
20490
20507
  };
20491
20508
  var unfinishedTaskOffer2 = (ctx) => {
20492
20509
  if (!ctx.isProjectTrusted() || process.env.WORKIT_PI_WORKER_ID)
@@ -21203,11 +21220,9 @@ var runtimeFor = (ctx) => ({
21203
21220
  workitExtension: fileURLToPath2(import.meta.url),
21204
21221
  root: ctx.cwd
21205
21222
  });
21206
- var contextMessage = (ctx, offer = null) => ({
21223
+ var contextMessage = (ctx, content) => ({
21207
21224
  customType: "workit-context",
21208
- content: `${workitContext(ctx)}${offer ? `
21209
-
21210
- ${offer}` : ""}`,
21225
+ content,
21211
21226
  display: false,
21212
21227
  details: { session: piContext(ctx).caller.actor }
21213
21228
  });
@@ -21515,15 +21530,26 @@ function extension(pi) {
21515
21530
  pi.on("before_agent_start", (event, ctx) => {
21516
21531
  const nudge = skillPromptNudge(event.prompt, ctx);
21517
21532
  const id = ctx.sessionManager.getSessionId();
21518
- if (sessions.has(id))
21519
- return nudge ? { message: { customType: "workit-skill", content: nudge, display: false } } : undefined;
21520
- sessions.add(id);
21521
- const offer = historyOfferSessions.has(id) ? null : unfinishedTaskOffer2(ctx);
21522
- historyOfferSessions.add(id);
21523
- const message = contextMessage(ctx, offer);
21524
- return { message: nudge ? { ...message, content: `${message.content}
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}
21525
21550
 
21526
- ${nudge}` } : message };
21551
+ ${nudge}` : content) };
21552
+ return nudge ? { message: { customType: "workit-skill", content: nudge, display: false } } : undefined;
21527
21553
  });
21528
21554
  pi.on("session_before_compact", () => {
21529
21555
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-pi",
3
- "version": "8.5.2",
3
+ "version": "8.6.1",
4
4
  "description": "Workit native extension for Pi — tools, method skills, and session continuity",
5
5
  "keywords": [
6
6
  "agentic-coding",