@nexrall/code-core 1.4.48 → 1.4.49
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/dist/agent/agentTypes.d.ts +21 -0
- package/dist/agent/agentTypes.d.ts.map +1 -1
- package/dist/agent/agentTypes.js +14 -4
- package/dist/agent/skills.d.ts.map +1 -1
- package/dist/agent/skills.js +17 -1
- package/dist/commands/loader.d.ts.map +1 -1
- package/dist/commands/loader.js +2 -1
- package/package.json +1 -1
|
@@ -52,6 +52,10 @@ export interface AgentType {
|
|
|
52
52
|
}
|
|
53
53
|
/** Where a sub-agent's own persistent notes live. */
|
|
54
54
|
export type AgentMemoryScope = 'project' | 'user' | 'local';
|
|
55
|
+
export declare const VALID_MODELS: readonly ["claude-sonnet-5", "claude-opus-5", "claude-fable-5", "gpt-5.4", "gpt-5.4-mini", "gpt-4.1", "turbo", "pro", "ultra", "fast"];
|
|
56
|
+
/** The four tier aliases specifically (a subset of VALID_MODELS) — the only values `AgentType.model`/`Skill.model` narrow to when recognised; a real model id passes through as a plain string instead. */
|
|
57
|
+
export declare const MODEL_TIER_ALIASES: readonly ["turbo", "pro", "ultra", "fast"];
|
|
58
|
+
export type ModelTier = (typeof MODEL_TIER_ALIASES)[number];
|
|
55
59
|
/**
|
|
56
60
|
* A problem found while loading an agent definition.
|
|
57
61
|
*
|
|
@@ -66,6 +70,23 @@ export interface AgentWarning {
|
|
|
66
70
|
agent: string;
|
|
67
71
|
message: string;
|
|
68
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Parse the `model:` frontmatter of an agent definition.
|
|
75
|
+
*
|
|
76
|
+
* Accepts a tier alias (turbo/pro/ultra) OR a real model id now that the picker
|
|
77
|
+
* exposes those. Validation is deliberately NOT an allowlist of ids: this file
|
|
78
|
+
* ships in a client that users do not update in lockstep with the backend, so
|
|
79
|
+
* an allowlist here would reject a model that is perfectly valid server-side
|
|
80
|
+
* and make new models unusable until everyone upgrades. The backend already
|
|
81
|
+
* refuses anything it does not recognise (resolveExplicitModel), which is the
|
|
82
|
+
* correct place for that decision — it is the side that knows.
|
|
83
|
+
*
|
|
84
|
+
* Only aliases are lowercased. Real model ids are case- and punctuation-
|
|
85
|
+
* sensitive ('gpt-5.4', 'claude-haiku-4-5-20251001'), so lowercasing them
|
|
86
|
+
* blindly — as this function used to do to everything — would corrupt ids that
|
|
87
|
+
* happen to contain uppercase.
|
|
88
|
+
*/
|
|
89
|
+
export declare function parseModel(v: string | undefined): string | undefined;
|
|
69
90
|
/**
|
|
70
91
|
* Discover all agent types. Precedence: project > global > plugin > builtin.
|
|
71
92
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentTypes.d.ts","sourceRoot":"","sources":["../../src/agent/agentTypes.ts"],"names":[],"mappings":"AAmCA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IACpD;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,qDAAqD;AACrD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"agentTypes.d.ts","sourceRoot":"","sources":["../../src/agent/agentTypes.ts"],"names":[],"mappings":"AAmCA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAA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BAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAED,2FAA2F;AAC3F,wBAAgB,aAAa,IAAI,SAAS,EAAE,CAE3C;AACD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAY1D;AASD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAIjG"}
|
package/dist/agent/agentTypes.js
CHANGED
|
@@ -33,6 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.MODEL_TIER_ALIASES = exports.VALID_MODELS = void 0;
|
|
37
|
+
exports.parseModel = parseModel;
|
|
36
38
|
exports.loadAgentTypes = loadAgentTypes;
|
|
37
39
|
exports.loadAgentTypesWithWarnings = loadAgentTypesWithWarnings;
|
|
38
40
|
exports.knownToolNames = knownToolNames;
|
|
@@ -390,12 +392,20 @@ const KNOWN_META_KEYS = new Set([
|
|
|
390
392
|
// `model: auto`, which parsed to undefined and was silently ignored, so the
|
|
391
393
|
// agent ran on the session model while its file claimed otherwise. What made
|
|
392
394
|
// that costly was the SILENCE, not the value.
|
|
393
|
-
|
|
395
|
+
//
|
|
396
|
+
// Exported so skills.ts's `model:` field parses the SAME set — it used to
|
|
397
|
+
// carry its own, shorter copy (`turbo | pro | ultra`, missing `fast`) that
|
|
398
|
+
// silently dropped `model: fast` in a SKILL.md to `undefined` with no warning
|
|
399
|
+
// at all. Two independently-maintained model lists are exactly the kind of
|
|
400
|
+
// drift the shared parseFrontmatter migration was meant to end.
|
|
401
|
+
exports.VALID_MODELS = [
|
|
394
402
|
'claude-sonnet-5', 'claude-opus-5', 'claude-fable-5',
|
|
395
403
|
'gpt-5.4', 'gpt-5.4-mini', 'gpt-4.1',
|
|
396
404
|
// Legacy tier aliases — still accepted, still resolved by the backend.
|
|
397
405
|
'turbo', 'pro', 'ultra', 'fast',
|
|
398
406
|
];
|
|
407
|
+
/** The four tier aliases specifically (a subset of VALID_MODELS) — the only values `AgentType.model`/`Skill.model` narrow to when recognised; a real model id passes through as a plain string instead. */
|
|
408
|
+
exports.MODEL_TIER_ALIASES = ['turbo', 'pro', 'ultra', 'fast'];
|
|
399
409
|
// parseFrontmatter now lives in ../util/frontmatter (shared with skills.ts and
|
|
400
410
|
// commands/loader.ts) so this file no longer carries its own copy — it used
|
|
401
411
|
// to, and the two silently drifted (the shared copy gained multi-line/nested
|
|
@@ -421,7 +431,7 @@ function parseModel(v) {
|
|
|
421
431
|
if (!raw)
|
|
422
432
|
return undefined;
|
|
423
433
|
const lower = raw.toLowerCase();
|
|
424
|
-
if (lower
|
|
434
|
+
if (exports.MODEL_TIER_ALIASES.includes(lower))
|
|
425
435
|
return lower;
|
|
426
436
|
return raw;
|
|
427
437
|
}
|
|
@@ -523,11 +533,11 @@ function loadDir(dir, source, into, warnings) {
|
|
|
523
533
|
const declaredModel = meta.model === undefined ? undefined : parseModel(meta.model);
|
|
524
534
|
if (meta.model !== undefined
|
|
525
535
|
&& (declaredModel === undefined
|
|
526
|
-
|| !VALID_MODELS.includes(declaredModel))) {
|
|
536
|
+
|| !exports.VALID_MODELS.includes(declaredModel))) {
|
|
527
537
|
warnings.push({
|
|
528
538
|
file: full,
|
|
529
539
|
agent: name,
|
|
530
|
-
message: `has model: "${meta.model}", which this version does not recognise — expected one of ${VALID_MODELS.join(', ')}, or omit the line to inherit the current session's model. It will still be sent; the server decides whether it is valid.`,
|
|
540
|
+
message: `has model: "${meta.model}", which this version does not recognise — expected one of ${exports.VALID_MODELS.join(', ')}, or omit the line to inherit the current session's model. It will still be sent; the server decides whether it is valid.`,
|
|
531
541
|
});
|
|
532
542
|
}
|
|
533
543
|
// The highest-value warning of the lot. An allowlist only ever GRANTS, so a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/agent/skills.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/agent/skills.ts"],"names":[],"mappings":"AA0EA,MAAM,WAAW,YAAY;IAC3B,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IACpD,0IAA0I;IAC1I,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kHAAkH;IAClH,sBAAsB,EAAE,OAAO,CAAC;IAChC,iGAAiG;IACjG,aAAa,EAAE,OAAO,CAAC;IACvB,2GAA2G;IAC3G,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8GAA8G;IAC9G,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kHAAkH;IAClH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,0JAA0J;IAC1J,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AA6MD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,CAsBrG;AAED,kKAAkK;AAClK,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,CAEnD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAG1E;AAED,6GAA6G;AAC7G,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAE5D;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAE5D;AAED,oHAAoH;AACpH,wBAAgB,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAIvD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAcpF"}
|
package/dist/agent/skills.js
CHANGED
|
@@ -46,6 +46,7 @@ const os = __importStar(require("os"));
|
|
|
46
46
|
const index_1 = require("../plugins/index");
|
|
47
47
|
const loader_1 = require("../commands/loader");
|
|
48
48
|
const frontmatter_1 = require("../util/frontmatter");
|
|
49
|
+
const agentTypes_1 = require("./agentTypes");
|
|
49
50
|
/** Frontmatter keys this parser understands, for typo/unrecognised-key detection (see SkillWarning). */
|
|
50
51
|
const KNOWN_META_KEYS = new Set([
|
|
51
52
|
'name', 'description', 'model', 'mode',
|
|
@@ -76,7 +77,7 @@ function parseSpaceList(v) {
|
|
|
76
77
|
return items.length ? items : undefined;
|
|
77
78
|
}
|
|
78
79
|
function toSkill(meta, body, name, source, dir, nested) {
|
|
79
|
-
const model =
|
|
80
|
+
const model = (0, agentTypes_1.parseModel)(meta.model);
|
|
80
81
|
return {
|
|
81
82
|
name,
|
|
82
83
|
description: meta.description || `Custom /${name} skill`,
|
|
@@ -126,6 +127,21 @@ function validateSkillMeta(meta, rawName, effectiveName, dirName, file, warnings
|
|
|
126
127
|
if (strayKeys.length) {
|
|
127
128
|
warnings.push({ file, name: effectiveName, message: `has unrecognised frontmatter key(s): ${strayKeys.join(', ')} — these are ignored.` });
|
|
128
129
|
}
|
|
130
|
+
// Same class of mistake agentTypes.ts already guards against for sub-agents:
|
|
131
|
+
// pass the value through regardless (parseModel never rejects), but say
|
|
132
|
+
// something when this build doesn't recognise it, so a typo doesn't look
|
|
133
|
+
// identical to "inherit the session's model". Before this, `model: fast`
|
|
134
|
+
// (a valid tier alias) silently parsed to undefined in a skill because this
|
|
135
|
+
// file carried its own, shorter, independently-drifted copy of the model list.
|
|
136
|
+
const declaredModel = meta.model === undefined ? undefined : (0, agentTypes_1.parseModel)(meta.model);
|
|
137
|
+
if (meta.model !== undefined
|
|
138
|
+
&& (declaredModel === undefined
|
|
139
|
+
|| !agentTypes_1.VALID_MODELS.includes(declaredModel))) {
|
|
140
|
+
warnings.push({
|
|
141
|
+
file, name: effectiveName,
|
|
142
|
+
message: `has model: "${meta.model}", which this version does not recognise — expected one of ${agentTypes_1.VALID_MODELS.join(', ')}, or omit the line to inherit the current session's model. It will still be sent; the server decides whether it is valid.`,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
129
145
|
}
|
|
130
146
|
// Legacy flat-file skills: .nexrall/commands/<name>.md (and plugin commands/).
|
|
131
147
|
// Kept as its own loader (rather than merged into loadSkillDir below) since the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/commands/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/commands/loader.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;CACrD;AAsED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,CASjE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAG7F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAuCnF;AAED,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3F"}
|
package/dist/commands/loader.js
CHANGED
|
@@ -43,6 +43,7 @@ const os = __importStar(require("os"));
|
|
|
43
43
|
const child_process_1 = require("child_process");
|
|
44
44
|
const index_1 = require("../plugins/index");
|
|
45
45
|
const frontmatter_1 = require("../util/frontmatter");
|
|
46
|
+
const agentTypes_1 = require("../agent/agentTypes");
|
|
46
47
|
// ── Built-in commands ─────────────────────────────────────────────────────────
|
|
47
48
|
// Shipped with the product; lowest precedence (project > global > builtin), so
|
|
48
49
|
// a user can override any of them by creating a file with the same name.
|
|
@@ -97,7 +98,7 @@ function loadDir(dir, source, into) {
|
|
|
97
98
|
continue;
|
|
98
99
|
if (source !== 'project' && into.has(name))
|
|
99
100
|
continue; // earlier tiers win
|
|
100
|
-
const model =
|
|
101
|
+
const model = (0, agentTypes_1.parseModel)(meta.model);
|
|
101
102
|
into.set(name, {
|
|
102
103
|
name,
|
|
103
104
|
description: meta.description || `Custom /${name} command`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexrall/code-core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.49",
|
|
4
4
|
"description": "Core agent loop, tools, and extension primitives for Nexrall Code — embed an AI coding agent in any Node.js application.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Nexrall <support@nexrall.com> (https://nexrall.com)",
|