litcodex-ai 0.3.15 → 0.3.16

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.md CHANGED
@@ -61,7 +61,7 @@ every success criterion passes. Durable loop state lives under `.litcodex/lit-lo
61
61
 
62
62
  LitCodex also ships a sibling family of triggers and phrases — `litwork`, `lit-plan`, `litgoal`,
63
63
  `review-work`, `litresearch`, plus `lit plan` / `lit review` / `lit research` / `lit goal` and the
64
- `lit start work` handoff — alongside a 24-skill library and hook components, all registered as a
64
+ `lit start work` handoff — alongside a 25-skill library and hook components, all registered as a
65
65
  single Codex plugin.
66
66
 
67
67
  The bundled `public-page-reader` skill adds a public-only Node stdlib runtime with safety preflight,
@@ -0,0 +1,3 @@
1
+ import type { LitTriggerToken } from "./trigger.js";
2
+ export declare function isCodexSkillMentionToken(prompt: string, tokenIndex: number): boolean;
3
+ export declare function scopedTokenForBareLit(prompt: string, tokenIndex: number): LitTriggerToken | null;
@@ -0,0 +1,49 @@
1
+ const LITCODEX_PLUGIN_NAME = "litcodex";
2
+ const CODEX_SKILL_MENTION_PATTERN = /\$([A-Za-z0-9_-]+):([A-Za-z0-9_-]+)/gu;
3
+ export function isCodexSkillMentionToken(prompt, tokenIndex) {
4
+ let start = tokenIndex;
5
+ while (start > 0 && !/\s/u.test(prompt[start - 1] ?? "")) {
6
+ start -= 1;
7
+ }
8
+ let end = tokenIndex;
9
+ while (end < prompt.length && !/\s/u.test(prompt[end] ?? "")) {
10
+ end += 1;
11
+ }
12
+ const mention = prompt.slice(start, end);
13
+ return mention.startsWith("$") && mention.includes(":") && tokenIndex > start;
14
+ }
15
+ export function scopedTokenForBareLit(prompt, tokenIndex) {
16
+ let scopedToken = null;
17
+ for (const match of prompt.slice(0, tokenIndex).matchAll(CODEX_SKILL_MENTION_PATTERN)) {
18
+ const pluginName = match[1]?.toLowerCase();
19
+ const skillName = match[2]?.toLowerCase();
20
+ if (pluginName !== LITCODEX_PLUGIN_NAME || skillName === undefined) {
21
+ continue;
22
+ }
23
+ const token = tokenForSkillName(skillName);
24
+ if (token !== null) {
25
+ scopedToken = token;
26
+ }
27
+ }
28
+ return scopedToken;
29
+ }
30
+ function tokenForSkillName(skillName) {
31
+ switch (skillName) {
32
+ case "lit-loop":
33
+ return "lit-loop";
34
+ case "lit-plan":
35
+ return "lit-plan";
36
+ case "litwork":
37
+ return "litwork";
38
+ case "litgoal":
39
+ return "litgoal";
40
+ case "litresearch":
41
+ return "litresearch";
42
+ case "start-work":
43
+ return "start-work";
44
+ case "review-work":
45
+ return "review-work";
46
+ default:
47
+ return null;
48
+ }
49
+ }
@@ -9,6 +9,7 @@
9
9
  // This module imports NOTHING from `state-store`, `directive`, `guards`, `markers`, or
10
10
  // `codex-hook` (one-way: hook → trigger, never the reverse). It reads no files, touches no state,
11
11
  // emits no hook JSON, and never mutates the prompt. (A3 C9 flat layout; A2 §2.1 export surface.)
12
+ import { isCodexSkillMentionToken, scopedTokenForBareLit } from "./skill-mention-scope.js";
12
13
  /**
13
14
  * Frozen tuple of the accepted tokens in match-priority (longest-first) order.
14
15
  * Exported so tests and the mode router (modes.ts) can enumerate without re-deriving.
@@ -75,10 +76,17 @@ export function matchLitTrigger(prompt) {
75
76
  if (isSlashCommandOrPathToken(prompt, index, token)) {
76
77
  continue;
77
78
  }
79
+ if (isCodexSkillMentionToken(prompt, index)) {
80
+ continue;
81
+ }
78
82
  const phrase = raw.toLowerCase() === "lit" ? naturalPhraseAfterLit(prompt, searchable, index, raw.length) : null;
79
83
  if (phrase !== null) {
80
84
  return phrase;
81
85
  }
86
+ const scopedToken = raw.toLowerCase() === "lit" ? scopedTokenForBareLit(prompt, index) : null;
87
+ if (scopedToken !== null) {
88
+ return { token: scopedToken, raw: prompt.slice(index, index + raw.length), index };
89
+ }
82
90
  return { token, raw: prompt.slice(index, index + raw.length), index };
83
91
  }
84
92
  return null;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litcodex/lit-loop",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
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
  "bin": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litcodex-ai",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "description": "Codex loop harness installer. Run `npx litcodex-ai install` to set up the LitCodex Codex platform: the bare `lit` hook and the durable lit-loop runtime.",
5
5
  "keywords": ["codex", "litcodex", "lit-loop", "ai-agents", "orchestration"],
6
6
  "author": "LitCodex Authors",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "files": ["bin", "dist", "model-catalog.json", "README.md", "LICENSE"],
17
17
  "dependencies": {
18
- "@litcodex/lit-loop": "0.3.15"
18
+ "@litcodex/lit-loop": "0.3.16"
19
19
  },
20
20
  "bundledDependencies": ["@litcodex/lit-loop"],
21
21
  "scripts": {