@litfamily/litcodex 1.0.39 → 1.0.41
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/README-Ko-KR.md +37 -15
- package/README.md +37 -15
- package/dist/cli.js +13 -0
- package/dist/install/auto-handoff-doctor.js +14 -8
- package/dist/install/extensions-notice.d.ts +13 -0
- package/dist/install/extensions-notice.js +26 -6
- package/dist/install/extensions.d.ts +74 -0
- package/dist/install/extensions.js +856 -0
- package/dist/install/generated-skill-payload-hashes.d.ts +8 -8
- package/dist/install/generated-skill-payload-hashes.js +8 -8
- package/dist/install/index.js +7 -1
- package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
- package/marketplace/plugins/litcodex/components/auto-update/dist/extensions-notice.js +13 -2
- package/marketplace/plugins/litcodex/components/auto-update/dist/shown-notices.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/auto-update/dist/shown-notices.js +63 -0
- package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
- package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
- package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-schematic.md +5 -3
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-scientific-visualization.md +5 -3
- package/marketplace/plugins/litcodex/components/lit-loop/dist/auto-handoff-settings.d.ts +7 -4
- package/marketplace/plugins/litcodex/components/lit-loop/dist/auto-handoff-settings.js +38 -22
- package/marketplace/plugins/litcodex/components/lit-loop/dist/auto-handoff.js +7 -5
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +7 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/route-heads.js +1 -2
- package/marketplace/plugins/litcodex/components/lit-loop/dist/run-end.d.ts +22 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/run-end.js +93 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.js +3 -1
- package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
- package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
- package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
- package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
- package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
- package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +6 -4
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/SKILL.md +6 -4
- package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +6 -4
- package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +6 -4
- package/marketplace/plugins/litcodex/skills/lit-schematic/SKILL.md +6 -4
- package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/SKILL.md +6 -4
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/SKILL.md +6 -4
- package/marketplace/plugins/litcodex/skills/readme-studio/SKILL.md +6 -4
- package/marketplace/plugins/litcodex/skills/visual-qa/SKILL.md +6 -4
- package/node_modules/@litcodex/lit-loop/README.md +4 -4
- package/node_modules/@litcodex/lit-loop/directives/lit-schematic.md +5 -3
- package/node_modules/@litcodex/lit-loop/directives/lit-scientific-visualization.md +5 -3
- package/node_modules/@litcodex/lit-loop/dist/auto-handoff-settings.d.ts +7 -4
- package/node_modules/@litcodex/lit-loop/dist/auto-handoff-settings.js +38 -22
- package/node_modules/@litcodex/lit-loop/dist/auto-handoff.js +7 -5
- package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +7 -0
- package/node_modules/@litcodex/lit-loop/dist/route-heads.js +1 -2
- package/node_modules/@litcodex/lit-loop/dist/run-end.d.ts +22 -0
- package/node_modules/@litcodex/lit-loop/dist/run-end.js +93 -0
- package/node_modules/@litcodex/lit-loop/dist/workflow-map.d.ts +2 -0
- package/node_modules/@litcodex/lit-loop/dist/workflow-map.js +3 -1
- package/node_modules/@litcodex/lit-loop/package.json +1 -1
- package/node_modules/@litcodex/lit-loop/skills/lit-schematic/SKILL.md +6 -4
- package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/SKILL.md +6 -4
- package/package.json +2 -2
- package/readme-assets/badge-version.svg +1 -1
|
@@ -9,7 +9,7 @@ export declare const BROWSER_DRIVE_PAYLOAD_HASHES: {
|
|
|
9
9
|
readonly "scripts/capability-probe.mjs": "086a19a5df2d1a5887d2df0c130eb4baf228ac00429248e90775f289e181e633";
|
|
10
10
|
};
|
|
11
11
|
export declare const FRONTEND_UIUX_PAYLOAD_HASHES: {
|
|
12
|
-
readonly "SKILL.md": "
|
|
12
|
+
readonly "SKILL.md": "1216f545edeeff4202eef872f5d92c852f7a9a056599d7be84e150c506915378";
|
|
13
13
|
};
|
|
14
14
|
export declare const HUMANIZER_PAYLOAD_HASHES: {
|
|
15
15
|
readonly NOTICE: "f1587efda830c594a727d651da82265c565e178a4665eb7327c0c07f516673f0";
|
|
@@ -82,10 +82,10 @@ export declare const HUMANIZER_PAYLOAD_HASHES: {
|
|
|
82
82
|
readonly "scripts/test-ko-metrics.mjs": "75e1e23486f3beca247922a8c37564670c043eb29b22148a71e1ce2b67374b28";
|
|
83
83
|
};
|
|
84
84
|
export declare const README_STUDIO_PAYLOAD_HASHES: {
|
|
85
|
-
readonly "SKILL.md": "
|
|
85
|
+
readonly "SKILL.md": "da31c724c7c70bc84a2ad414899f781e3d1d4395214432e381dca61e638a194e";
|
|
86
86
|
};
|
|
87
87
|
export declare const VISUAL_QA_PAYLOAD_HASHES: {
|
|
88
|
-
readonly "SKILL.md": "
|
|
88
|
+
readonly "SKILL.md": "5c34fbc7174f4f9b9bda63ba75449b7f909770dcb1f3553aaa6e80c6e4d642ae";
|
|
89
89
|
};
|
|
90
90
|
export declare const STRUCTURAL_SEARCH_PAYLOAD_HASHES: {
|
|
91
91
|
readonly "SKILL.md": "7f36bba0ccb78bacc803e08a30c127926ce56b249b1938e4d1c186c9d1478aa0";
|
|
@@ -100,19 +100,19 @@ export declare const CODING_SESSION_AUDIT_PAYLOAD_HASHES: {
|
|
|
100
100
|
readonly "references/session-formats.md": "5c35e9148db2eac84c240702382c31e7e9ff875b9f5036f45b642a209335fbd8";
|
|
101
101
|
};
|
|
102
102
|
export declare const DIAGRAM_DRAWER_PAYLOAD_HASHES: {
|
|
103
|
-
readonly "SKILL.md": "
|
|
103
|
+
readonly "SKILL.md": "3cf29db5e8e12753671ff8ebca7fe7cec68d73d72c02b7362641fe1cc7020ec8";
|
|
104
104
|
readonly "agents/openai.yaml": "705f4a2078a9ac0a357218b762c9baee9731663ca86111ecb55d7d3528b379cf";
|
|
105
105
|
};
|
|
106
106
|
export declare const DOCX_PAYLOAD_HASHES: {
|
|
107
|
-
readonly "SKILL.md": "
|
|
107
|
+
readonly "SKILL.md": "e98b3248dc429e92b50bd1acda3e825147e24e00cc2f574a90c893f9bfbffaad";
|
|
108
108
|
readonly "agents/openai.yaml": "a8a0c0dc807f992075d73123dbe14124d45c9f13d7dcce1ab5403723f222f68c";
|
|
109
109
|
};
|
|
110
110
|
export declare const PPTX_PAYLOAD_HASHES: {
|
|
111
|
-
readonly "SKILL.md": "
|
|
111
|
+
readonly "SKILL.md": "8f6032634ee8597bddc56b82f30df7d1365ec626cd852851b21cc5d98dbf7b6c";
|
|
112
112
|
readonly "agents/openai.yaml": "2d07a60a4742faaac628338b82dc2b185f1813018cbf1c2b974909cf20266618";
|
|
113
113
|
};
|
|
114
114
|
export declare const SCHEMATIC_PAYLOAD_HASHES: {
|
|
115
|
-
readonly "SKILL.md": "
|
|
115
|
+
readonly "SKILL.md": "4b7ec8b14a27b02f622cabe350224be630d5f366b8aa62e0bd61f21363f8e42d";
|
|
116
116
|
readonly "agents/openai.yaml": "60743b930cf6728cd261fe0b09c218e5981b315c94065bb3179702b0e531d305";
|
|
117
117
|
};
|
|
118
118
|
export declare const HIJACK_PAYLOAD_HASHES: {
|
|
@@ -126,7 +126,7 @@ export declare const HIJACK_PAYLOAD_HASHES: {
|
|
|
126
126
|
readonly "scripts/hijack.mjs": "8a802d795900ca0471e93549863386c3da1d465ede19bbb056eb0fe2dd0eeb27";
|
|
127
127
|
};
|
|
128
128
|
export declare const MOTION_PAYLOAD_HASHES: {
|
|
129
|
-
readonly "SKILL.md": "
|
|
129
|
+
readonly "SKILL.md": "d1e882c49a56b10ab0d111fbcc9daeeeb8087697e1b682dc2548df021a89e86b";
|
|
130
130
|
readonly "agents/openai.yaml": "903236ce200da815aff7affb3cc78c8f9b821bb4d8e56cca9d4464c20999e7f0";
|
|
131
131
|
};
|
|
132
132
|
export declare const AUTORESEARCH_PAYLOAD_HASHES: {
|
|
@@ -10,7 +10,7 @@ export const BROWSER_DRIVE_PAYLOAD_HASHES = {
|
|
|
10
10
|
"scripts/capability-probe.mjs": "086a19a5df2d1a5887d2df0c130eb4baf228ac00429248e90775f289e181e633",
|
|
11
11
|
};
|
|
12
12
|
export const FRONTEND_UIUX_PAYLOAD_HASHES = {
|
|
13
|
-
"SKILL.md": "
|
|
13
|
+
"SKILL.md": "1216f545edeeff4202eef872f5d92c852f7a9a056599d7be84e150c506915378",
|
|
14
14
|
};
|
|
15
15
|
export const HUMANIZER_PAYLOAD_HASHES = {
|
|
16
16
|
NOTICE: "f1587efda830c594a727d651da82265c565e178a4665eb7327c0c07f516673f0",
|
|
@@ -83,10 +83,10 @@ export const HUMANIZER_PAYLOAD_HASHES = {
|
|
|
83
83
|
"scripts/test-ko-metrics.mjs": "75e1e23486f3beca247922a8c37564670c043eb29b22148a71e1ce2b67374b28",
|
|
84
84
|
};
|
|
85
85
|
export const README_STUDIO_PAYLOAD_HASHES = {
|
|
86
|
-
"SKILL.md": "
|
|
86
|
+
"SKILL.md": "da31c724c7c70bc84a2ad414899f781e3d1d4395214432e381dca61e638a194e",
|
|
87
87
|
};
|
|
88
88
|
export const VISUAL_QA_PAYLOAD_HASHES = {
|
|
89
|
-
"SKILL.md": "
|
|
89
|
+
"SKILL.md": "5c34fbc7174f4f9b9bda63ba75449b7f909770dcb1f3553aaa6e80c6e4d642ae",
|
|
90
90
|
};
|
|
91
91
|
export const STRUCTURAL_SEARCH_PAYLOAD_HASHES = {
|
|
92
92
|
"SKILL.md": "7f36bba0ccb78bacc803e08a30c127926ce56b249b1938e4d1c186c9d1478aa0",
|
|
@@ -101,19 +101,19 @@ export const CODING_SESSION_AUDIT_PAYLOAD_HASHES = {
|
|
|
101
101
|
"references/session-formats.md": "5c35e9148db2eac84c240702382c31e7e9ff875b9f5036f45b642a209335fbd8",
|
|
102
102
|
};
|
|
103
103
|
export const DIAGRAM_DRAWER_PAYLOAD_HASHES = {
|
|
104
|
-
"SKILL.md": "
|
|
104
|
+
"SKILL.md": "3cf29db5e8e12753671ff8ebca7fe7cec68d73d72c02b7362641fe1cc7020ec8",
|
|
105
105
|
"agents/openai.yaml": "705f4a2078a9ac0a357218b762c9baee9731663ca86111ecb55d7d3528b379cf",
|
|
106
106
|
};
|
|
107
107
|
export const DOCX_PAYLOAD_HASHES = {
|
|
108
|
-
"SKILL.md": "
|
|
108
|
+
"SKILL.md": "e98b3248dc429e92b50bd1acda3e825147e24e00cc2f574a90c893f9bfbffaad",
|
|
109
109
|
"agents/openai.yaml": "a8a0c0dc807f992075d73123dbe14124d45c9f13d7dcce1ab5403723f222f68c",
|
|
110
110
|
};
|
|
111
111
|
export const PPTX_PAYLOAD_HASHES = {
|
|
112
|
-
"SKILL.md": "
|
|
112
|
+
"SKILL.md": "8f6032634ee8597bddc56b82f30df7d1365ec626cd852851b21cc5d98dbf7b6c",
|
|
113
113
|
"agents/openai.yaml": "2d07a60a4742faaac628338b82dc2b185f1813018cbf1c2b974909cf20266618",
|
|
114
114
|
};
|
|
115
115
|
export const SCHEMATIC_PAYLOAD_HASHES = {
|
|
116
|
-
"SKILL.md": "
|
|
116
|
+
"SKILL.md": "4b7ec8b14a27b02f622cabe350224be630d5f366b8aa62e0bd61f21363f8e42d",
|
|
117
117
|
"agents/openai.yaml": "60743b930cf6728cd261fe0b09c218e5981b315c94065bb3179702b0e531d305",
|
|
118
118
|
};
|
|
119
119
|
export const HIJACK_PAYLOAD_HASHES = {
|
|
@@ -127,7 +127,7 @@ export const HIJACK_PAYLOAD_HASHES = {
|
|
|
127
127
|
"scripts/hijack.mjs": "8a802d795900ca0471e93549863386c3da1d465ede19bbb056eb0fe2dd0eeb27",
|
|
128
128
|
};
|
|
129
129
|
export const MOTION_PAYLOAD_HASHES = {
|
|
130
|
-
"SKILL.md": "
|
|
130
|
+
"SKILL.md": "d1e882c49a56b10ab0d111fbcc9daeeeb8087697e1b682dc2548df021a89e86b",
|
|
131
131
|
"agents/openai.yaml": "903236ce200da815aff7affb3cc78c8f9b821bb4d8e56cca9d4464c20999e7f0",
|
|
132
132
|
};
|
|
133
133
|
export const AUTORESEARCH_PAYLOAD_HASHES = {
|
package/dist/install/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { codexSpawnInvocation, resolveCodexHome } from "./codex.js";
|
|
|
17
17
|
import { doctorScopeFor, renderDoctorText, runDoctor } from "./doctor.js";
|
|
18
18
|
import { exitCodeForInstallError, InstallError, toErrorJson } from "./errors.js";
|
|
19
19
|
import { executeInstallPlan } from "./execute.js";
|
|
20
|
+
import { extensionsDoctorLine, extensionsNoticeLine } from "./extensions.js";
|
|
20
21
|
import { announceExtensions } from "./extensions-notice.js";
|
|
21
22
|
import { listPayloadEntries, readRegularFileBuffer } from "./file-walk.js";
|
|
22
23
|
import { promptModelRoute, renderModelRouteSummary, waitForModelRouteConfirmation } from "./install-model-prompt.js";
|
|
@@ -398,6 +399,7 @@ export async function runInstallCli(args, io = defaultIo()) {
|
|
|
398
399
|
env: io.env,
|
|
399
400
|
json: opts.json,
|
|
400
401
|
write: (text) => io.stdout.write(text),
|
|
402
|
+
...checkLineFor(io),
|
|
401
403
|
});
|
|
402
404
|
}
|
|
403
405
|
return result.ok ? 0 : 3;
|
|
@@ -418,9 +420,13 @@ export function runDoctorCli(args, io = defaultIo()) {
|
|
|
418
420
|
if (json)
|
|
419
421
|
io.stdout.write(`${JSON.stringify(report)}\n`);
|
|
420
422
|
else
|
|
421
|
-
io.stdout.write(`${renderDoctorText(report)}\n`);
|
|
423
|
+
io.stdout.write(`${renderDoctorText(report)}\n${extensionsDoctorLine({ env: io.env, cwd: io.repoRoot })}\n`);
|
|
422
424
|
return report.ok ? 0 : 4;
|
|
423
425
|
}
|
|
426
|
+
function checkLineFor(io) {
|
|
427
|
+
const checkLine = extensionsNoticeLine({ env: io.env, cwd: io.repoRoot });
|
|
428
|
+
return checkLine === undefined ? {} : { checkLine };
|
|
429
|
+
}
|
|
424
430
|
/** Shared text for a `--dry-run` of a state-changing route: the title, then numbered steps. */
|
|
425
431
|
export function renderDryRunPlan(title, steps) {
|
|
426
432
|
return `${title} plan (dry run: nothing was changed)\n${steps.map((step, index) => `${index + 1}. ${step}`).join("\n")}\n`;
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
// `litcodex install` writes the notice to <LITCODEX_DATA_ROOT or ~/.litcodex>/extensions-notice.json when it lands a
|
|
4
4
|
// new payload. This SessionStart hook claims the file with a rename, so two sessions starting together cannot both
|
|
5
5
|
// show it, deletes it, and returns the text for the hook's user-visible systemMessage. Anything malformed is dropped.
|
|
6
|
+
// Every later install writes the same text again, so the hash of each text that was shown goes into the "already
|
|
7
|
+
// shown" record (shown-notices.ts) and the same text is claimed and dropped without being shown a second time.
|
|
6
8
|
import { readFileSync, renameSync, rmSync } from "node:fs";
|
|
7
9
|
import { homedir } from "node:os";
|
|
8
|
-
import { join } from "node:path";
|
|
10
|
+
import { dirname, join } from "node:path";
|
|
11
|
+
import { markShown, noticeHash, wasShown } from "./shown-notices.js";
|
|
9
12
|
const NOTICE_SCHEMA_VERSION = 1;
|
|
10
13
|
const MAX_NOTICE_CHARS = 2000;
|
|
11
14
|
export function extensionsNoticePath(env) {
|
|
@@ -26,7 +29,15 @@ export function takeExtensionsNotice(env = process.env) {
|
|
|
26
29
|
if (parsed.schemaVersion !== NOTICE_SCHEMA_VERSION || typeof parsed.message !== "string")
|
|
27
30
|
return undefined;
|
|
28
31
|
const message = parsed.message.replace(/[^\P{Cc}\n]/gu, "").trim();
|
|
29
|
-
|
|
32
|
+
if (message.length === 0)
|
|
33
|
+
return undefined;
|
|
34
|
+
const text = message.slice(0, MAX_NOTICE_CHARS);
|
|
35
|
+
const dataRoot = dirname(path);
|
|
36
|
+
const hash = noticeHash(text);
|
|
37
|
+
if (wasShown(dataRoot, hash))
|
|
38
|
+
return undefined;
|
|
39
|
+
markShown(dataRoot, hash);
|
|
40
|
+
return text;
|
|
30
41
|
}
|
|
31
42
|
catch {
|
|
32
43
|
return undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function noticeHash(text: string): string;
|
|
2
|
+
export declare function shownNoticesPath(dataRoot: string): string;
|
|
3
|
+
/** True only when a well-formed line of the record carries this hash. */
|
|
4
|
+
export declare function wasShown(dataRoot: string, hash: string): boolean;
|
|
5
|
+
/** Append one line. Never throws and never writes through a symlink or past the cap. */
|
|
6
|
+
export declare function markShown(dataRoot: string, hash: string, now?: number): void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// The "already shown" record: one line per notice text LitCodex itself has printed, kept in the data root beside
|
|
2
|
+
// the notice it guards (`<LITCODEX_DATA_ROOT or ~/.litcodex>/shown-notices.jsonl`).
|
|
3
|
+
//
|
|
4
|
+
// A line is `{"hash":"<16 hex>","at":<ms>}`: a hash of the whitespace-normalised text and the time it was shown,
|
|
5
|
+
// never the text. The file is append-only and capped, and every problem reads as "not shown yet", so a missing,
|
|
6
|
+
// corrupt, oversized, symlinked or unwritable record changes nothing: the notice appears exactly as it did before
|
|
7
|
+
// the record existed.
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
import { closeSync, constants, lstatSync, mkdirSync, openSync, readFileSync, writeSync } from "node:fs";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
const LEDGER_FILE = "shown-notices.jsonl";
|
|
12
|
+
/** About 3,000 lines. Past this nothing is read or appended, which is the same as having no record. */
|
|
13
|
+
const MAX_LEDGER_BYTES = 64 * 1024;
|
|
14
|
+
const NO_FOLLOW = constants.O_NOFOLLOW ?? 0;
|
|
15
|
+
export function noticeHash(text) {
|
|
16
|
+
return createHash("sha256").update(text.replace(/\s+/gu, " ").trim()).digest("hex").slice(0, 16);
|
|
17
|
+
}
|
|
18
|
+
export function shownNoticesPath(dataRoot) {
|
|
19
|
+
return join(dataRoot, LEDGER_FILE);
|
|
20
|
+
}
|
|
21
|
+
/** True only when a well-formed line of the record carries this hash. */
|
|
22
|
+
export function wasShown(dataRoot, hash) {
|
|
23
|
+
try {
|
|
24
|
+
const path = shownNoticesPath(dataRoot);
|
|
25
|
+
const stat = lstatSync(path, { throwIfNoEntry: false });
|
|
26
|
+
if (stat === undefined || !stat.isFile() || stat.size > MAX_LEDGER_BYTES)
|
|
27
|
+
return false;
|
|
28
|
+
for (const line of readFileSync(path, "utf8").split("\n")) {
|
|
29
|
+
try {
|
|
30
|
+
const entry = JSON.parse(line);
|
|
31
|
+
if (typeof entry === "object" && entry !== null && entry.hash === hash)
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// a corrupt line is skipped
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Append one line. Never throws and never writes through a symlink or past the cap. */
|
|
45
|
+
export function markShown(dataRoot, hash, now = Date.now()) {
|
|
46
|
+
try {
|
|
47
|
+
const path = shownNoticesPath(dataRoot);
|
|
48
|
+
mkdirSync(dataRoot, { recursive: true });
|
|
49
|
+
const stat = lstatSync(path, { throwIfNoEntry: false });
|
|
50
|
+
if (stat !== undefined && (!stat.isFile() || stat.size >= MAX_LEDGER_BYTES))
|
|
51
|
+
return;
|
|
52
|
+
const fd = openSync(path, constants.O_WRONLY | constants.O_APPEND | constants.O_CREAT | NO_FOLLOW, 0o600);
|
|
53
|
+
try {
|
|
54
|
+
writeSync(fd, `${JSON.stringify({ hash, at: now })}\n`);
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
closeSync(fd);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// the notice was already shown; losing the record only means it may show again
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -65,11 +65,13 @@ This directive is an LLM-facing contract injected by the LitCodex Codex plugin,
|
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
67
|
git clone https://github.com/wjgoarxiv/wjgoarxiv-skills
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
cx="${CODEX_HOME:-$HOME/.codex}"; p="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"; for d in "$cx/skills" "$HOME/.agents/skills" "$p/.agents/skills" "$p/.codex/skills"; do [ -e "$d/lit-schematic" ] && echo "found: $d/lit-schematic"; done; echo "check done"
|
|
69
|
+
cx="${CODEX_HOME:-$HOME/.codex}"; if [ -e "$cx/skills/lit-schematic" ]; then b="$cx/extension-backups/$(date +%Y%m%d-%H%M%S)"; mkdir -p "$b" && [ ! -e "$b/lit-schematic" ] && mv "$cx/skills/lit-schematic" "$b/lit-schematic" && echo "moved aside: $b/lit-schematic"; fi
|
|
70
|
+
cx="${CODEX_HOME:-$HOME/.codex}"; if [ -e "$cx/skills/lit-schematic" ]; then echo "stopped: $cx/skills/lit-schematic still exists"; else mkdir -p "$cx/skills" && cp -R "<path to your wjgoarxiv-skills clone>/variants/litcodex/lit-schematic" "$cx/skills/lit-schematic"; fi
|
|
71
|
+
cx="${CODEX_HOME:-$HOME/.codex}"; [ -f "$cx/skills/lit-schematic/SKILL.md" ] && printf '{"id":"lit-schematic","source":"%s","variant":"litcodex","installed_at":"%s"}\n' "<path to your wjgoarxiv-skills clone>/variants/litcodex/lit-schematic" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" > "$cx/skills/lit-schematic/.litfamily-extension.json"
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
wjgoarxiv-skills is public at https://github.com/wjgoarxiv/wjgoarxiv-skills; the copy reads from the user's clone of it (the path is a placeholder). After copying, the user starts a new Codex session.
|
|
74
|
+
wjgoarxiv-skills is public at https://github.com/wjgoarxiv/wjgoarxiv-skills; the copy reads from the user's clone of it (the path is a placeholder). The lines check for same-name skills, move an old copy whole to `${CODEX_HOME:-$HOME/.codex}/extension-backups/<date-time>/lit-schematic` and write a receipt; running them again updates. `litcodex extensions install lit-schematic` does the same steps (a plan first, `--yes` to run). After copying, the user starts a new Codex session.
|
|
73
75
|
|
|
74
76
|
## #contract.outputs
|
|
75
77
|
|
package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-scientific-visualization.md
CHANGED
|
@@ -51,11 +51,13 @@ This directive is an LLM-facing contract injected by the LitCodex Codex plugin,
|
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
git clone https://github.com/wjgoarxiv/wjgoarxiv-skills
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
cx="${CODEX_HOME:-$HOME/.codex}"; p="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"; for d in "$cx/skills" "$HOME/.agents/skills" "$p/.agents/skills" "$p/.codex/skills"; do [ -e "$d/lit-scientific-visualization" ] && echo "found: $d/lit-scientific-visualization"; done; echo "check done"
|
|
55
|
+
cx="${CODEX_HOME:-$HOME/.codex}"; if [ -e "$cx/skills/lit-scientific-visualization" ]; then b="$cx/extension-backups/$(date +%Y%m%d-%H%M%S)"; mkdir -p "$b" && [ ! -e "$b/lit-scientific-visualization" ] && mv "$cx/skills/lit-scientific-visualization" "$b/lit-scientific-visualization" && echo "moved aside: $b/lit-scientific-visualization"; fi
|
|
56
|
+
cx="${CODEX_HOME:-$HOME/.codex}"; if [ -e "$cx/skills/lit-scientific-visualization" ]; then echo "stopped: $cx/skills/lit-scientific-visualization still exists"; else mkdir -p "$cx/skills" && cp -R "<path to your wjgoarxiv-skills clone>/variants/litcodex/lit-scientific-visualization" "$cx/skills/lit-scientific-visualization"; fi
|
|
57
|
+
cx="${CODEX_HOME:-$HOME/.codex}"; [ -f "$cx/skills/lit-scientific-visualization/SKILL.md" ] && printf '{"id":"lit-scientific-visualization","source":"%s","variant":"litcodex","installed_at":"%s"}\n' "<path to your wjgoarxiv-skills clone>/variants/litcodex/lit-scientific-visualization" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" > "$cx/skills/lit-scientific-visualization/.litfamily-extension.json"
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
wjgoarxiv-skills is public at https://github.com/wjgoarxiv/wjgoarxiv-skills; the copy reads from the user's clone of it (the path is a placeholder). After copying, the user starts a new Codex session.
|
|
60
|
+
wjgoarxiv-skills is public at https://github.com/wjgoarxiv/wjgoarxiv-skills; the copy reads from the user's clone of it (the path is a placeholder). The lines check for same-name skills, move an old copy whole to `${CODEX_HOME:-$HOME/.codex}/extension-backups/<date-time>/lit-scientific-visualization` and write a receipt; running them again updates. `litcodex extensions install lit-scientific-visualization` does the same steps (a plan first, `--yes` to run). After copying, the user starts a new Codex session.
|
|
59
61
|
4. The authored scientific-visualization source ships inside that one folder (`vendor/scientific-visualization/`), so no second copy is needed. The scoped `$litcodex:lit-scientific-visualization` and the picker stay native Codex skill-discovery routes to the stub.
|
|
60
62
|
|
|
61
63
|
## #contract.outputs
|
|
@@ -2,6 +2,8 @@ export declare const AUTO_HANDOFF_FLAG_ENV = "LITCODEX_AUTO_HANDOFF";
|
|
|
2
2
|
export declare const AUTO_HANDOFF_PERCENT_ENV = "LITCODEX_AUTO_HANDOFF_PERCENT";
|
|
3
3
|
export declare const AUTO_HANDOFF_DIR = ".litcodex/auto-handoff";
|
|
4
4
|
export declare const AUTO_HANDOFF_SETTINGS_FILE = "settings.json";
|
|
5
|
+
/** Chosen below Codex's own automatic compaction point, so the handoff is written before the host compacts. */
|
|
6
|
+
export declare const DEFAULT_AUTO_HANDOFF_PERCENT = 80;
|
|
5
7
|
export declare const HOST_COMPACT_KEY = "model_post_turn_compact_threshold_percent";
|
|
6
8
|
export declare const HOST_COMPACT_BEGIN = "# litcodex automatic handoff (managed by `lit-handoff auto`; `lit-handoff auto off` removes it)";
|
|
7
9
|
export interface StoredAutoHandoff {
|
|
@@ -24,7 +26,7 @@ export declare function parsePercent(raw: string | undefined): number | null;
|
|
|
24
26
|
export declare function settingsPath(repoRoot: string): string;
|
|
25
27
|
/** Read a small regular file; null when missing, a symlink, too large, or unreadable. */
|
|
26
28
|
export declare function readSmallFile(path: string): string | null;
|
|
27
|
-
/** The stored choice; a missing, malformed or hand-edited
|
|
29
|
+
/** The stored choice; a missing file reads as the default (on), a malformed or hand-edited one as "off, no percent". */
|
|
28
30
|
export declare function readStoredAutoHandoff(repoRoot: string): {
|
|
29
31
|
stored: StoredAutoHandoff;
|
|
30
32
|
warning: string | null;
|
|
@@ -32,7 +34,7 @@ export declare function readStoredAutoHandoff(repoRoot: string): {
|
|
|
32
34
|
/**
|
|
33
35
|
* Combine the environment with the stored choice. The environment wins when it is set: `=1` turns the
|
|
34
36
|
* feature on and `=0` turns it off. The percent comes from its variable first, then from the stored
|
|
35
|
-
* value.
|
|
37
|
+
* value, then from the default. An invalid percent variable keeps the feature off.
|
|
36
38
|
*/
|
|
37
39
|
export declare function resolveAutoHandoff(env: NodeJS.ProcessEnv, stored: StoredAutoHandoff, storedWarning?: string | null): AutoHandoffState;
|
|
38
40
|
export declare function loadAutoHandoffState(repoRoot: string, env: NodeJS.ProcessEnv): AutoHandoffState;
|
|
@@ -65,8 +67,9 @@ export declare function writeProjectCompaction(repoRoot: string, percent: number
|
|
|
65
67
|
export declare function removeProjectCompaction(repoRoot: string): ProjectConfigResult;
|
|
66
68
|
/**
|
|
67
69
|
* Remove the managed block when the feature is effectively off, however it got there: `lit-handoff auto
|
|
68
|
-
* off`, `LITCODEX_AUTO_HANDOFF=0`,
|
|
69
|
-
*
|
|
70
|
+
* off`, `LITCODEX_AUTO_HANDOFF=0`, or a percent that is not valid. A deleted settings file puts the feature
|
|
71
|
+
* back on its default percent, which the block no longer matches, so it goes too. Without this the block
|
|
72
|
+
* outlives the switch and Codex keeps compacting at that percent with no handoff. Only the marked
|
|
70
73
|
* block goes; a key the user wrote by hand is never touched. Never throws.
|
|
71
74
|
*/
|
|
72
75
|
export declare function clearManagedCompactionWhenOff(repoRoot: string, env: NodeJS.ProcessEnv): ProjectConfigResult;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// src/auto-handoff-settings.ts — the user-controlled switch for automatic handoff.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// `lit-handoff auto off
|
|
6
|
-
//
|
|
7
|
-
//
|
|
3
|
+
// On by default at DEFAULT_AUTO_HANDOFF_PERCENT of the context window, so a long conversation saves its
|
|
4
|
+
// handoff before it is compacted without anyone setting anything up. The one off switch is the exact prompt
|
|
5
|
+
// `lit-handoff auto off` (or `LITCODEX_AUTO_HANDOFF=0`); `lit-handoff auto on <percent>` (or
|
|
6
|
+
// `LITCODEX_AUTO_HANDOFF=1` plus `LITCODEX_AUTO_HANDOFF_PERCENT`) chooses another percent, and
|
|
7
|
+
// `lit-handoff auto status` reads the state. `on` without a number reuses the last value the user stored,
|
|
8
|
+
// else the default. A percent that is not a whole number from 1 to 99 keeps the feature off and is reported,
|
|
9
|
+
// and so does a settings file that cannot be read: the user's choice is unknown, so nothing is assumed.
|
|
8
10
|
//
|
|
9
11
|
// Command-set values live in `.litcodex/auto-handoff/settings.json` under the project folder. When the
|
|
10
12
|
// feature is turned on by command, the same percent is written to the PROJECT `.codex/config.toml` as
|
|
@@ -20,11 +22,16 @@ export const AUTO_HANDOFF_FLAG_ENV = "LITCODEX_AUTO_HANDOFF";
|
|
|
20
22
|
export const AUTO_HANDOFF_PERCENT_ENV = "LITCODEX_AUTO_HANDOFF_PERCENT";
|
|
21
23
|
export const AUTO_HANDOFF_DIR = ".litcodex/auto-handoff";
|
|
22
24
|
export const AUTO_HANDOFF_SETTINGS_FILE = "settings.json";
|
|
25
|
+
/** Chosen below Codex's own automatic compaction point, so the handoff is written before the host compacts. */
|
|
26
|
+
export const DEFAULT_AUTO_HANDOFF_PERCENT = 80;
|
|
23
27
|
export const HOST_COMPACT_KEY = "model_post_turn_compact_threshold_percent";
|
|
24
28
|
export const HOST_COMPACT_BEGIN = "# litcodex automatic handoff (managed by `lit-handoff auto`; `lit-handoff auto off` removes it)";
|
|
25
29
|
const NO_FOLLOW = constants.O_NOFOLLOW ?? 0;
|
|
26
30
|
const MAX_FILE_BYTES = 256 * 1024;
|
|
27
|
-
|
|
31
|
+
/** No settings file: the product default. */
|
|
32
|
+
const DEFAULT_STORED = Object.freeze({ enabled: true, percent: null });
|
|
33
|
+
/** A settings file that cannot be read: the user's choice is unknown, so the feature stays off. */
|
|
34
|
+
const UNREADABLE_STORED = Object.freeze({ enabled: false, percent: null });
|
|
28
35
|
/** A whole number from 1 to 99 written as plain digits, else null. */
|
|
29
36
|
export function parsePercent(raw) {
|
|
30
37
|
const text = raw?.trim() ?? "";
|
|
@@ -61,7 +68,7 @@ export function readSmallFile(path) {
|
|
|
61
68
|
closeSync(fd);
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
|
-
/** The stored choice; a missing, malformed or hand-edited
|
|
71
|
+
/** The stored choice; a missing file reads as the default (on), a malformed or hand-edited one as "off, no percent". */
|
|
65
72
|
export function readStoredAutoHandoff(repoRoot) {
|
|
66
73
|
if (!isAbsolute(repoRoot))
|
|
67
74
|
return { stored: DEFAULT_STORED, warning: null };
|
|
@@ -80,7 +87,7 @@ export function readStoredAutoHandoff(repoRoot) {
|
|
|
80
87
|
}
|
|
81
88
|
catch {
|
|
82
89
|
return {
|
|
83
|
-
stored:
|
|
90
|
+
stored: UNREADABLE_STORED,
|
|
84
91
|
warning: `${AUTO_HANDOFF_DIR}/${AUTO_HANDOFF_SETTINGS_FILE} could not be read, so automatic handoff stays off.`,
|
|
85
92
|
};
|
|
86
93
|
}
|
|
@@ -92,7 +99,7 @@ function shown(raw) {
|
|
|
92
99
|
/**
|
|
93
100
|
* Combine the environment with the stored choice. The environment wins when it is set: `=1` turns the
|
|
94
101
|
* feature on and `=0` turns it off. The percent comes from its variable first, then from the stored
|
|
95
|
-
* value.
|
|
102
|
+
* value, then from the default. An invalid percent variable keeps the feature off.
|
|
96
103
|
*/
|
|
97
104
|
export function resolveAutoHandoff(env, stored, storedWarning = null) {
|
|
98
105
|
const warnings = [];
|
|
@@ -110,11 +117,13 @@ export function resolveAutoHandoff(env, stored, storedWarning = null) {
|
|
|
110
117
|
if (envPercentInvalid) {
|
|
111
118
|
warnings.push(`${AUTO_HANDOFF_PERCENT_ENV}=${shown(rawPercent)} is not a whole number from 1 to 99, so automatic handoff stays off.`);
|
|
112
119
|
}
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
const fallback = enabled ? DEFAULT_AUTO_HANDOFF_PERCENT : null;
|
|
121
|
+
const percent = envPercentInvalid ? null : (envPercent ?? stored.percent ?? fallback);
|
|
122
|
+
let source = "command";
|
|
123
|
+
if (envDecision !== null || envPercent !== null)
|
|
124
|
+
source = "environment";
|
|
125
|
+
else if (enabled && stored.percent === null)
|
|
126
|
+
source = "default";
|
|
118
127
|
return { active: enabled && percent !== null, percent, source, warnings };
|
|
119
128
|
}
|
|
120
129
|
export function loadAutoHandoffState(repoRoot, env) {
|
|
@@ -315,13 +324,17 @@ export function removeProjectCompaction(repoRoot) {
|
|
|
315
324
|
}
|
|
316
325
|
/**
|
|
317
326
|
* Remove the managed block when the feature is effectively off, however it got there: `lit-handoff auto
|
|
318
|
-
* off`, `LITCODEX_AUTO_HANDOFF=0`,
|
|
319
|
-
*
|
|
327
|
+
* off`, `LITCODEX_AUTO_HANDOFF=0`, or a percent that is not valid. A deleted settings file puts the feature
|
|
328
|
+
* back on its default percent, which the block no longer matches, so it goes too. Without this the block
|
|
329
|
+
* outlives the switch and Codex keeps compacting at that percent with no handoff. Only the marked
|
|
320
330
|
* block goes; a key the user wrote by hand is never touched. Never throws.
|
|
321
331
|
*/
|
|
322
332
|
export function clearManagedCompactionWhenOff(repoRoot, env) {
|
|
323
333
|
try {
|
|
324
|
-
if (!isAbsolute(repoRoot)
|
|
334
|
+
if (!isAbsolute(repoRoot))
|
|
335
|
+
return "nothing-to-remove";
|
|
336
|
+
const state = loadAutoHandoffState(repoRoot, env);
|
|
337
|
+
if (state.active && state.source !== "default")
|
|
325
338
|
return "nothing-to-remove";
|
|
326
339
|
return removeProjectCompaction(repoRoot);
|
|
327
340
|
}
|
|
@@ -354,8 +367,14 @@ function compactionSentence(repoRoot, percent, env) {
|
|
|
354
367
|
export function describeAutoHandoff(repoRoot, state, env) {
|
|
355
368
|
const lines = [];
|
|
356
369
|
if (state.active && state.percent !== null) {
|
|
357
|
-
const origin = state.source === "environment"
|
|
370
|
+
const origin = state.source === "environment"
|
|
371
|
+
? "set by environment variables"
|
|
372
|
+
: state.source === "default"
|
|
373
|
+
? "default"
|
|
374
|
+
: "set by command";
|
|
358
375
|
lines.push(`Automatic handoff is ON at ${state.percent}% (${origin}).`);
|
|
376
|
+
if (state.source === "default")
|
|
377
|
+
lines.push('Run "lit-handoff auto off" to turn it off.');
|
|
359
378
|
lines.push(compactionSentence(repoRoot, state.percent, env));
|
|
360
379
|
}
|
|
361
380
|
else {
|
|
@@ -388,10 +407,7 @@ export function applyAutoHandoffRoute(repoRoot, env, route) {
|
|
|
388
407
|
const kept = stored.percent === null ? "" : ` Your last percent (${stored.percent}%) is kept for next time.`;
|
|
389
408
|
return `Automatic handoff is OFF.${kept}${envNote}`;
|
|
390
409
|
}
|
|
391
|
-
const percent = route.argument === null ? stored.percent : parsePercent(route.argument);
|
|
392
|
-
if (route.argument === null && percent === null) {
|
|
393
|
-
return "Which percent should trigger the handoff? Run: lit-handoff auto on <percent from 1 to 99> (for example 60).";
|
|
394
|
-
}
|
|
410
|
+
const percent = route.argument === null ? (stored.percent ?? DEFAULT_AUTO_HANDOFF_PERCENT) : parsePercent(route.argument);
|
|
395
411
|
if (percent === null)
|
|
396
412
|
return `"${shown(route.argument ?? "")}" is not a whole number from 1 to 99. Nothing changed.`;
|
|
397
413
|
if (!writeStoredAutoHandoff(repoRoot, { enabled: true, percent })) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
// The flow across Codex hooks, each step reading and writing one small per-session record under
|
|
4
4
|
// `.litcodex/auto-handoff/<session>.json`:
|
|
5
5
|
//
|
|
6
|
-
// Stop reads the context percent from the session transcript. At or above the
|
|
7
|
-
//
|
|
8
|
-
// handoff now and to tell the user one plain line.
|
|
6
|
+
// Stop reads the context percent from the session transcript. At or above the percent in
|
|
7
|
+
// force (the user's, else the default), once per crossing, it blocks the stop with an
|
|
8
|
+
// instruction to write the handoff now and to tell the user one plain line.
|
|
9
9
|
// PostCompact marks the session as compacted (Codex compacts after the handoff turn when the
|
|
10
10
|
// project config asks for it, or the user runs /compact).
|
|
11
11
|
// SessionStart source "compact" (compaction inside a turn) and the next UserPromptSubmit (compaction
|
|
@@ -145,7 +145,7 @@ function percentText(value) {
|
|
|
145
145
|
export function buildHandoffInstruction(sessionId, percent, threshold, hostCompacts) {
|
|
146
146
|
const line = hostCompacts ? SAVED_LINE_HOST_COMPACTS : SAVED_LINE_RUN_COMPACT;
|
|
147
147
|
return [
|
|
148
|
-
`Automatic handoff: this conversation has used ${percentText(percent)}% of the context window, past the ${threshold}%
|
|
148
|
+
`Automatic handoff: this conversation has used ${percentText(percent)}% of the context window, past the ${threshold}% set for automatic handoff.`,
|
|
149
149
|
"Save the handoff now, before anything else:",
|
|
150
150
|
`1. Read ${resolveSkillPath("lit-handoff")} in full and follow it to create or refresh the handoff file. Its destination rules pick the file.`,
|
|
151
151
|
`2. Put this exact line in the handoff file so the next context can find it: ${HANDOFF_MARKER_LABEL} ${sessionId}`,
|
|
@@ -176,8 +176,10 @@ export function evaluateAutoHandoffStop(input) {
|
|
|
176
176
|
return PASS;
|
|
177
177
|
if (reading.percent < state.percent) {
|
|
178
178
|
if (session.phase === "idle" || session.phase === "compacted") {
|
|
179
|
-
|
|
179
|
+
// On the default alone nothing is written below the percent, so a project that never gets there stays untouched.
|
|
180
|
+
if (session.lastPercent !== seen.lastPercent && state.source !== "default") {
|
|
180
181
|
writeSession(input.repoRoot, path, seen);
|
|
182
|
+
}
|
|
181
183
|
return PASS;
|
|
182
184
|
}
|
|
183
185
|
writeSession(input.repoRoot, path, { ...seen, phase: "idle", firedAt: null, firedPercent: null });
|
|
@@ -18,6 +18,7 @@ import { detectWaitReason, endLiveStep, recordLiveStepEnd, recordLiveStepStart,
|
|
|
18
18
|
import { evaluatePlanPersistence, formatStopBlockOutput, rearmLitPlanIfSatisfied, recordLitPlanActivation, } from "./plan-persistence.js";
|
|
19
19
|
import { clearActiveRoute, isBareLit, isLitContinue, readActiveRoute, readResumeWork, recordActiveRoute, } from "./reentry.js";
|
|
20
20
|
import { isBoundaryAnswer, isGoPrompt, takeGo } from "./rewind-go.js";
|
|
21
|
+
import { outcomeFor, recordRunEnd } from "./run-end.js";
|
|
21
22
|
import { workflowCard } from "./screen-card.js";
|
|
22
23
|
import { screenColor } from "./screen-status.js";
|
|
23
24
|
import { recordLiveness } from "./session-liveness.js";
|
|
@@ -390,6 +391,12 @@ export async function runStopPlanPersistenceHookCli(stdin, stdout, stderr, repoR
|
|
|
390
391
|
: null;
|
|
391
392
|
const turn = line === null ? null : workflowTurn(scope.cwd, scope.sessionId);
|
|
392
393
|
const card = turn === null ? null : workflowCard(scope.cwd, scope.sessionId, turn.mode, line, { color: screenColor(env) });
|
|
394
|
+
// The end of a LIT run: remember whether it reported, had nothing to report, or waits on the user.
|
|
395
|
+
const opened = workflowTurn(scope.cwd, scope.sessionId);
|
|
396
|
+
const outcome = opened === null ? null : outcomeFor(line, detectWaitReason(lastMsg));
|
|
397
|
+
if (opened !== null && outcome !== null) {
|
|
398
|
+
recordRunEnd(scope.cwd, scope.sessionId, { mode: opened.mode, outcome }, auto.now);
|
|
399
|
+
}
|
|
393
400
|
// Codex puts a hook label before the first row, so the card starts on the next one.
|
|
394
401
|
if (card !== null)
|
|
395
402
|
stdout.write(`${JSON.stringify({ systemMessage: `\n${card}` })}\n`);
|
|
@@ -216,8 +216,7 @@ const LIT_SCHEMATIC = [
|
|
|
216
216
|
BLOCKED,
|
|
217
217
|
"",
|
|
218
218
|
"1. Read the stub {skill:lit-schematic}. When the session's skill list has a separate `lit-schematic` copy (normally under `$CODEX_HOME/skills/`, where `$CODEX_HOME` defaults to `~/.codex`), open that file and let it handle the request.",
|
|
219
|
-
"2. Otherwise say what lit-schematic makes, that it is a LitFamily extension in wjgoarxiv-skills, and give the stub's install lines unchanged
|
|
220
|
-
' `cp -R "<path to your wjgoarxiv-skills clone>/variants/litcodex/lit-schematic" "$CODEX_HOME/skills/lit-schematic"`, then a new Codex session.',
|
|
219
|
+
"2. Otherwise say what lit-schematic makes, that it is a LitFamily extension in wjgoarxiv-skills, and give the stub's four install lines unchanged: a check for same-name skills, a move-aside of an old copy into `$CODEX_HOME/extension-backups/`, the copy from `<path to your wjgoarxiv-skills clone>/variants/litcodex/lit-schematic`, and a receipt (or `litcodex extensions install lit-schematic --yes`); then a new Codex session.",
|
|
221
220
|
"3. Draw nothing by hand and do not imitate the moved procedure. Stop after the notice.",
|
|
222
221
|
];
|
|
223
222
|
const LIT_HIJACK = [
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type RunOutcome = "sent" | "nothing" | "waiting";
|
|
2
|
+
export interface RunEnd {
|
|
3
|
+
readonly version: 1;
|
|
4
|
+
readonly at: number;
|
|
5
|
+
readonly session: string;
|
|
6
|
+
readonly mode: string;
|
|
7
|
+
readonly outcome: RunOutcome;
|
|
8
|
+
}
|
|
9
|
+
export declare function runEndPath(repoRoot: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* The outcome for a turn that just closed, or null when the run is not over. `line` is the Stop line
|
|
12
|
+
* `workflowStopLine` made for the recorded turn (null when it made none) and `waitReason` what
|
|
13
|
+
* `detectWaitReason` read from the last assistant message.
|
|
14
|
+
*/
|
|
15
|
+
export declare function outcomeFor(line: string | null, waitReason: string | null): RunOutcome | null;
|
|
16
|
+
/** Append one run end. Never throws. */
|
|
17
|
+
export declare function recordRunEnd(repoRoot: string, sessionId: string, entry: {
|
|
18
|
+
readonly mode: string;
|
|
19
|
+
readonly outcome: RunOutcome;
|
|
20
|
+
}, now?: number): void;
|
|
21
|
+
/** Every well-formed run end, oldest first; a corrupt line is skipped and an unreadable file reads as empty. */
|
|
22
|
+
export declare function readRunEnds(repoRoot: string): RunEnd[];
|