jg-agent-hq 11.1.0 → 11.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 11.1.1
4
+
5
+ - Report the argument hint of every listed Codex skill whose `SKILL.md` declares a single-line `argument-hint`, whatever form its other frontmatter fields take. 11.1.0 read a listed skill's hint only when its `name` and `description` were single lines too, so a skill whose description is a YAML block, such as `description: >-`, showed no hint. A skill in the operator's extra roots still needs single-line `name` and `description` fields, which are its identity there.
6
+ - Store nothing new: the schema and existing databases are unchanged.
7
+
3
8
  ## 11.1.0
4
9
 
5
10
  - Report each Codex skill's `argumentHint` from the `argument-hint` its `SKILL.md` declares. Codex's native skill list carries no hints, so a catalog read now reads the single-line frontmatter of the file at each listed skill's path, 8 files at a time, and of each skill in the operator's extra roots: a regular file of at most 65,536 bytes, without following a link at that path. A hint that is missing, empty, a block scalar or over 1,024 characters stays null, and a file that can't be read leaves only the hint null, without counting toward `unavailableCount`. Session and folder catalogs give a skill the same hint.
@@ -21,8 +21,10 @@ export declare const toCapabilityRoots: (roots: string[]) => {
21
21
  }[];
22
22
  /**
23
23
  * Reads the `argument-hint` of the skill file at an absolute path, such as one native discovery
24
- * lists, as `readSkillRoots` reads its files. A file that can't be read leaves the skill without
25
- * a hint, never without its listing.
24
+ * lists, as `readSkillRoots` reads its files. The catalog that lists the skill supplies its
25
+ * identity, so the hint counts whatever form the file's other fields take, such as a description
26
+ * written as a YAML block. A file that can't be read leaves the skill without a hint, never
27
+ * without its listing.
26
28
  * @returns A promise that resolves to the hint, or null when there is none or the file can't be
27
29
  * read.
28
30
  */
@@ -3,6 +3,23 @@ import { open, readdir } from 'node:fs/promises';
3
3
  import { isAbsolute, join } from 'node:path';
4
4
  import { hasErrorCode } from 'jg-exception';
5
5
  import { LOCAL_ENVIRONMENT_ID, MAX_ARGUMENT_HINT_LENGTH, MAX_ROOT_SKILLS, MAX_SKILL_FILE_BYTES, } from './constants.js';
6
+ // a skill file's frontmatter block, or undefined when the file has none
7
+ const readFrontmatter = (source) => /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(source)?.[1];
8
+ // a frontmatter key's single-line value without its quotes, or null when the key is missing
9
+ const readField = (block, key) => {
10
+ const value = new RegExp(`^${key}:[ \\t]*(.*?)[ \\t]*$`, 'm').exec(block)?.[1];
11
+ if (value === undefined)
12
+ return null;
13
+ return /^(['"])(.*)\1$/.exec(value)?.[2] ?? value;
14
+ };
15
+ /*
16
+ * A frontmatter block's `argument-hint`, or null when it is missing, empty, a block scalar or over
17
+ * MAX_ARGUMENT_HINT_LENGTH characters. It never depends on the block's other fields.
18
+ */
19
+ const readArgumentHint = (block) => {
20
+ const hint = readField(block, 'argument-hint');
21
+ return !hint || hint.length > MAX_ARGUMENT_HINT_LENGTH || /^[>|]/.test(hint) ? null : hint;
22
+ };
6
23
  /**
7
24
  * Reads a skill's single-line `name`, `description` and `argument-hint` frontmatter, the only
8
25
  * fields HQ takes from skill files. A hint that is missing, empty, a block scalar or over
@@ -10,17 +27,11 @@ import { LOCAL_ENVIRONMENT_ID, MAX_ARGUMENT_HINT_LENGTH, MAX_ROOT_SKILLS, MAX_SK
10
27
  * @returns The skill's frontmatter, or null when its identity is missing or not plain single-line.
11
28
  */
12
29
  export const parseSkillFrontmatter = (source) => {
13
- const block = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(source)?.[1];
30
+ const block = readFrontmatter(source);
14
31
  if (block === undefined)
15
32
  return null;
16
- const read = (key) => {
17
- const value = new RegExp(`^${key}:[ \\t]*(.*?)[ \\t]*$`, 'm').exec(block)?.[1];
18
- if (value === undefined)
19
- return null;
20
- return /^(['"])(.*)\1$/.exec(value)?.[2] ?? value;
21
- };
22
- const name = read('name');
23
- const description = read('description');
33
+ const name = readField(block, 'name');
34
+ const description = readField(block, 'description');
24
35
  if (!name ||
25
36
  name.length > 256 ||
26
37
  !/^[^\s\p{Cc}]+$/u.test(name) ||
@@ -28,9 +39,7 @@ export const parseSkillFrontmatter = (source) => {
28
39
  description.length > 8192 ||
29
40
  /^[>|]/.test(description))
30
41
  return null;
31
- const hint = read('argument-hint');
32
- const argumentHint = !hint || hint.length > MAX_ARGUMENT_HINT_LENGTH || /^[>|]/.test(hint) ? null : hint;
33
- return { name, description, argumentHint };
42
+ return { name, description, argumentHint: readArgumentHint(block) };
34
43
  };
35
44
  /**
36
45
  * Builds the per-thread capability roots Codex resolves for a thread HQ starts, so HQ's skills
@@ -61,8 +70,10 @@ const readSkillFile = async (path) => {
61
70
  };
62
71
  /**
63
72
  * Reads the `argument-hint` of the skill file at an absolute path, such as one native discovery
64
- * lists, as `readSkillRoots` reads its files. A file that can't be read leaves the skill without
65
- * a hint, never without its listing.
73
+ * lists, as `readSkillRoots` reads its files. The catalog that lists the skill supplies its
74
+ * identity, so the hint counts whatever form the file's other fields take, such as a description
75
+ * written as a YAML block. A file that can't be read leaves the skill without a hint, never
76
+ * without its listing.
66
77
  * @returns A promise that resolves to the hint, or null when there is none or the file can't be
67
78
  * read.
68
79
  */
@@ -71,7 +82,8 @@ export const readSkillHint = async (path) => {
71
82
  return null;
72
83
  try {
73
84
  const source = await readSkillFile(path);
74
- return source === null ? null : (parseSkillFrontmatter(source)?.argumentHint ?? null);
85
+ const block = source === null ? undefined : readFrontmatter(source);
86
+ return block === undefined ? null : readArgumentHint(block);
75
87
  }
76
88
  catch {
77
89
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jg-agent-hq",
3
- "version": "11.1.0",
3
+ "version": "11.1.1",
4
4
  "description": "Native Claude Code and Codex session control, history, usage and recoverable local storage for Node.js apps.",
5
5
  "type": "module",
6
6
  "license": "MIT",