@brainervirus/workit-core 8.5.2 → 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/package.json
CHANGED
package/src/hooks/context.ts
CHANGED
|
@@ -291,11 +291,11 @@ export const turnContextText = (input: HookInput, descriptor: HostDescriptor): s
|
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
293
|
|
|
294
|
-
// Change-only per-turn context.
|
|
295
|
-
//
|
|
296
|
-
//
|
|
297
|
-
// session
|
|
298
|
-
// workspace store (`hooks/turn-<session hash>.json`). Every cache failure
|
|
294
|
+
// Change-only per-turn context. Claude Code, Codex and Pi keep each injected
|
|
295
|
+
// context in the transcript, so the task context is resent only when it
|
|
296
|
+
// changed since the last injection for the session. Each hook is a fresh
|
|
297
|
+
// process (and a Pi session can resume in another one): the last digest
|
|
298
|
+
// lives in the workspace store (`hooks/turn-<session hash>.json`). Every cache failure
|
|
299
299
|
// answers "changed", so context is resent rather than lost.
|
|
300
300
|
|
|
301
301
|
const TURN_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
@@ -376,13 +376,17 @@ export const changedTurnContext = (input: HookInput, text: string | null): strin
|
|
|
376
376
|
* A session start already injects the task context (inside the contract), so
|
|
377
377
|
* the per-turn digest is seeded with what the next prompt would carry: the
|
|
378
378
|
* first turn after a start, resume or compaction does not resend it. A
|
|
379
|
-
* session without task context clears its digest instead.
|
|
379
|
+
* session without task context clears its digest instead. An in-process
|
|
380
|
+
* host that renders its own per-turn `text` seeds with it.
|
|
380
381
|
*/
|
|
381
|
-
export const seedTurnContext = (
|
|
382
|
+
export const seedTurnContext = (
|
|
383
|
+
input: HookInput,
|
|
384
|
+
descriptor: HostDescriptor,
|
|
385
|
+
text: string | null = turnContextText(input, descriptor),
|
|
386
|
+
): void => {
|
|
382
387
|
const file = turnMarker(input);
|
|
383
388
|
if (!file) return;
|
|
384
389
|
pruneTurnDigests(path.dirname(file), Date.now());
|
|
385
|
-
const text = turnContextText(input, descriptor);
|
|
386
390
|
if (text) writeTurnDigest(file, digestOf(text));
|
|
387
391
|
else clearTurnDigest(file);
|
|
388
392
|
};
|
|
@@ -58,9 +58,8 @@ export const CLAUDE_CODE_DESCRIPTOR: HostDescriptor = {
|
|
|
58
58
|
perTurn: "native",
|
|
59
59
|
afterCompact: "native",
|
|
60
60
|
task: "session-bound",
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
turnResend: "every-turn",
|
|
61
|
+
// Each additionalContext stays in the transcript: resend only on change.
|
|
62
|
+
turnResend: "on-change",
|
|
64
63
|
},
|
|
65
64
|
subagents: {
|
|
66
65
|
identity: "native",
|
package/src/hooks/hosts/pi.ts
CHANGED
|
@@ -24,12 +24,12 @@ export const PI_DESCRIPTOR: HostDescriptor = {
|
|
|
24
24
|
shellPolicy: { deny: "native", channel: "block", failClosed: false },
|
|
25
25
|
context: {
|
|
26
26
|
sessionStart: "native",
|
|
27
|
-
// before_agent_start runs every turn
|
|
28
|
-
//
|
|
29
|
-
perTurn: "
|
|
27
|
+
// before_agent_start runs every turn; its message stays in the session,
|
|
28
|
+
// so the extension resends the task context only when it changed.
|
|
29
|
+
perTurn: "native",
|
|
30
30
|
afterCompact: "native",
|
|
31
31
|
task: "session-bound",
|
|
32
|
-
turnResend: "
|
|
32
|
+
turnResend: "on-change",
|
|
33
33
|
},
|
|
34
34
|
subagents: {
|
|
35
35
|
identity: "none",
|