@litfamily/litcodex 1.0.12 → 1.0.13

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 (32) hide show
  1. package/README-Ko-KR.md +9 -9
  2. package/README.md +9 -9
  3. package/dist/config-migration/gpt56-policy.js +3 -0
  4. package/dist/install/auto-handoff-doctor.js +22 -2
  5. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
  6. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  7. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  8. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  9. package/marketplace/plugins/litcodex/components/lit-loop/dist/auto-handoff-settings.d.ts +9 -2
  10. package/marketplace/plugins/litcodex/components/lit-loop/dist/auto-handoff-settings.js +55 -9
  11. package/marketplace/plugins/litcodex/components/lit-loop/dist/auto-handoff.d.ts +10 -2
  12. package/marketplace/plugins/litcodex/components/lit-loop/dist/auto-handoff.js +23 -17
  13. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +1 -1
  14. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +41 -21
  15. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  16. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  17. package/marketplace/plugins/litcodex/components/rules/dist/model-metadata.d.ts +1 -1
  18. package/marketplace/plugins/litcodex/components/rules/dist/model-metadata.js +1 -0
  19. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  20. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  21. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  22. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  23. package/model-catalog.json +25 -5
  24. package/node_modules/@litcodex/lit-loop/dist/auto-handoff-settings.d.ts +9 -2
  25. package/node_modules/@litcodex/lit-loop/dist/auto-handoff-settings.js +55 -9
  26. package/node_modules/@litcodex/lit-loop/dist/auto-handoff.d.ts +10 -2
  27. package/node_modules/@litcodex/lit-loop/dist/auto-handoff.js +23 -17
  28. package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +1 -1
  29. package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +41 -21
  30. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  31. package/package.json +2 -2
  32. package/readme-assets/badge-version.svg +1 -1
@@ -9,8 +9,8 @@
9
9
  // hint (./jev-hint.ts) and, once per session while it is on, a plain-text banner; with its switch
10
10
  // off, that path makes no request and writes nothing.
11
11
  import { isAbsolute } from "node:path";
12
- import { evaluateAutoHandoffStop, recordCompaction, takeReloadContext } from "./auto-handoff.js";
13
- import { applyAutoHandoffRoute, parseAutoHandoffRoute } from "./auto-handoff-settings.js";
12
+ import { claimReloadContext, evaluateAutoHandoffStop, recordCompaction, takeReloadContext } from "./auto-handoff.js";
13
+ import { applyAutoHandoffRoute, clearManagedCompactionWhenOff, parseAutoHandoffRoute, } from "./auto-handoff-settings.js";
14
14
  import { applyPreToolUseCreateGoalGuard, isLitUserPromptSubmitInput, runUserPromptSubmitHook } from "./codex-hook.js";
15
15
  import { claimJevOnBanner, formatJevHookOutput, jevSwitchState, runJevSkillHint, withJevBanner, } from "./jev-hint.js";
16
16
  import { evaluatePlanPersistence, formatStopBlockOutput, recordLitPlanActivation } from "./plan-persistence.js";
@@ -98,19 +98,15 @@ export async function runUserPromptSubmitHookCli(stdin, stdout, stderr, repoRoot
98
98
  stdout.write(route);
99
99
  return 0;
100
100
  }
101
- const reload = autoHandoffReload(parsed, repoRoot, auto);
101
+ clearManagedCompactionWhenOff(hookCwd(parsed, repoRoot), auto.env ?? process.env);
102
102
  const decision = runUserPromptSubmitHook(parsed);
103
103
  if (decision.kind === "inject" && decision.mode === "lit-plan") {
104
104
  const scope = hookSessionScope(parsed, repoRoot);
105
105
  if (scope !== null)
106
106
  recordLitPlanActivation(scope.cwd, scope.sessionId);
107
107
  }
108
- if (decision.kind === "inject") {
109
- stdout.write(withReloadContext(decision.stdout, reload));
110
- return 0;
111
- }
112
- const hint = await jevHintOutput(parsed, repoRoot, jev);
113
- const output = withReloadContext(hint, reload);
108
+ const own = decision.kind === "inject" ? decision.stdout : await jevHintOutput(parsed, repoRoot, jev);
109
+ const output = withAutoHandoffReload(own, parsed, repoRoot, auto);
114
110
  if (output !== "")
115
111
  stdout.write(output);
116
112
  return 0;
@@ -127,32 +123,53 @@ function autoHandoffRouteOutput(parsed, repoRoot, options) {
127
123
  const reason = applyAutoHandoffRoute(cwd, options.env ?? process.env, route);
128
124
  return `${JSON.stringify({ decision: "block", reason })}\n`;
129
125
  }
130
- /** The handoff excerpt to bring back after a compaction between turns, or null. Claims it once. */
131
- function autoHandoffReload(parsed, repoRoot, options) {
126
+ /**
127
+ * Put the handoff excerpt for a compaction between turns into this turn's output, claiming it once. The
128
+ * claim is made only when the output is built, and it is given back when the text cannot be merged, so a
129
+ * reload that never reached the model stays available for the next prompt.
130
+ */
131
+ function withAutoHandoffReload(stdout, parsed, repoRoot, options) {
132
132
  const scope = hookSessionScope(parsed, repoRoot);
133
133
  if (scope === null)
134
- return null;
135
- return takeReloadContext(scope.cwd, scope.sessionId, options.env ?? process.env, false);
134
+ return stdout;
135
+ const claim = claimReloadContext(scope.cwd, scope.sessionId, options.env ?? process.env, false);
136
+ if (claim === null)
137
+ return stdout;
138
+ const merged = withReloadContext(stdout, claim.text);
139
+ if (merged === null) {
140
+ claim.release();
141
+ return stdout;
142
+ }
143
+ return merged;
136
144
  }
137
- /** Add reload text to a UserPromptSubmit output that may already carry context; "" stays "" without one. */
145
+ /**
146
+ * Add reload text to a UserPromptSubmit output that may already carry context, or carry only a visible
147
+ * line; "" becomes a context-only output. Null when the output cannot be merged (it is not JSON).
148
+ */
138
149
  function withReloadContext(stdout, reload) {
139
- if (reload === null)
140
- return stdout;
141
150
  if (stdout === "") {
142
151
  return `${JSON.stringify({ hookSpecificOutput: { hookEventName: "UserPromptSubmit", additionalContext: reload } })}\n`;
143
152
  }
144
153
  try {
145
154
  const output = JSON.parse(stdout);
146
- const specific = output.hookSpecificOutput;
147
- if (specific === undefined)
148
- return stdout;
155
+ if (typeof output !== "object" || output === null || Array.isArray(output))
156
+ return null;
157
+ const specific = output.hookSpecificOutput ?? { hookEventName: "UserPromptSubmit" };
149
158
  specific.additionalContext = [specific.additionalContext, reload].filter(Boolean).join("\n\n");
159
+ output.hookSpecificOutput = specific;
150
160
  return `${JSON.stringify(output)}\n`;
151
161
  }
152
162
  catch {
153
- return stdout;
163
+ return null;
154
164
  }
155
165
  }
166
+ /** Absolute `cwd` from a hook event, else the fallback root. */
167
+ function hookCwd(parsed, repoRoot) {
168
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
169
+ return repoRoot;
170
+ const cwd = parsed["cwd"];
171
+ return typeof cwd === "string" && isAbsolute(cwd) ? cwd : repoRoot;
172
+ }
156
173
  /** Optional Jev skill hint for a turn the deterministic router left alone. Never throws. */
157
174
  async function jevHintOutput(parsed, repoRoot, options) {
158
175
  const env = options.env ?? process.env;
@@ -208,6 +225,7 @@ export async function runStopPlanPersistenceHookCli(stdin, stdout, stderr, repoR
208
225
  stderr.write(errorLine("LIT_HOOK_STDIN_INVALID_JSON", INVALID_JSON_MESSAGE));
209
226
  return 2;
210
227
  }
228
+ clearManagedCompactionWhenOff(hookCwd(parsed, repoRoot), auto.env ?? process.env);
211
229
  const scope = hookSessionScope(parsed, repoRoot);
212
230
  if (scope !== null) {
213
231
  const persistence = evaluatePlanPersistence(scope.cwd, scope.sessionId);
@@ -254,6 +272,7 @@ export async function runSessionStartHookCli(stdin, stdout, stderr, repoRoot = p
254
272
  const event = await readHookEvent(stdin, stderr);
255
273
  if (event.exit !== null)
256
274
  return event.exit;
275
+ clearManagedCompactionWhenOff(hookCwd(event.parsed, repoRoot), auto.env ?? process.env);
257
276
  const record = event.parsed;
258
277
  if (typeof record !== "object" || record === null || record["source"] !== "compact")
259
278
  return 0;
@@ -267,10 +286,11 @@ export async function runSessionStartHookCli(stdin, stdout, stderr, repoRoot = p
267
286
  return 0;
268
287
  }
269
288
  /** PostCompact: remember that a session that saved a handoff has now been compacted. Writes nothing to stdout. */
270
- export async function runPostCompactHookCli(stdin, _stdout, stderr, repoRoot = process.cwd()) {
289
+ export async function runPostCompactHookCli(stdin, _stdout, stderr, repoRoot = process.cwd(), auto = {}) {
271
290
  const event = await readHookEvent(stdin, stderr);
272
291
  if (event.exit !== null)
273
292
  return event.exit;
293
+ clearManagedCompactionWhenOff(hookCwd(event.parsed, repoRoot), auto.env ?? process.env);
274
294
  const scope = hookSessionScope(event.parsed, repoRoot);
275
295
  if (scope !== null)
276
296
  recordCompaction(scope.cwd, scope.sessionId);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litcodex/lit-loop",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "LitCodex Lit-Loop runtime: durable repo-native multi-goal orchestration with embedded success criteria and observable evidence audit.",
5
5
  "type": "module",
6
6
  "private": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litfamily/litcodex",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Codex loop harness installer. Run `npm exec --package @litfamily/litcodex -- litcodex install` to set up the LitCodex Codex platform: the bare `lit` hook and the durable lit-loop runtime.",
5
5
  "keywords": [
6
6
  "codex",
@@ -44,7 +44,7 @@
44
44
  "readme-assets"
45
45
  ],
46
46
  "dependencies": {
47
- "@litcodex/lit-loop": "1.0.12"
47
+ "@litcodex/lit-loop": "1.0.13"
48
48
  },
49
49
  "bundledDependencies": [
50
50
  "@litcodex/lit-loop"
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="146" height="20" role="img" aria-label="release: 1.0.12"><title>release: 1.0.12</title><g shape-rendering="crispEdges"><rect width="49" height="20" fill="#080d14"/><rect x="49" width="97" height="20" fill="#ff6337"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text x="255" y="140" textLength="390" transform="scale(.1)">release</text><text x="965" y="140" textLength="870" transform="scale(.1)" fill="#080D14">1.0.12</text></g></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="146" height="20" role="img" aria-label="release: 1.0.13"><title>release: 1.0.13</title><g shape-rendering="crispEdges"><rect width="49" height="20" fill="#080d14"/><rect x="49" width="97" height="20" fill="#ff6337"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text x="255" y="140" textLength="390" transform="scale(.1)">release</text><text x="965" y="140" textLength="870" transform="scale(.1)" fill="#080D14">1.0.13</text></g></svg>