@senpi/runtime 3.0.6-dev.runtime-phase-2.20260627082846 → 3.0.6-dev.skill-manager-v2.20260629194505
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/index.d.ts +18 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/skills-manager/bootstrap.d.ts +12 -7
- package/dist/skills-manager/bootstrap.d.ts.map +1 -1
- package/dist/skills-manager/bootstrap.js +44 -22
- package/dist/skills-manager/bootstrap.js.map +1 -1
- package/dist/skills-manager/constants.d.ts +5 -33
- package/dist/skills-manager/constants.d.ts.map +1 -1
- package/dist/skills-manager/constants.js +11 -50
- package/dist/skills-manager/constants.js.map +1 -1
- package/dist/skills-manager/coordinator.d.ts +26 -119
- package/dist/skills-manager/coordinator.d.ts.map +1 -1
- package/dist/skills-manager/coordinator.js +107 -344
- package/dist/skills-manager/coordinator.js.map +1 -1
- package/dist/skills-manager/fetcher.d.ts +23 -2
- package/dist/skills-manager/fetcher.d.ts.map +1 -1
- package/dist/skills-manager/fetcher.js +36 -6
- package/dist/skills-manager/fetcher.js.map +1 -1
- package/dist/skills-manager/manifest.d.ts +136 -0
- package/dist/skills-manager/manifest.d.ts.map +1 -0
- package/dist/skills-manager/manifest.js +177 -0
- package/dist/skills-manager/manifest.js.map +1 -0
- package/dist/skills-manager/skills-manifest.json +16 -0
- package/dist/skills-manager/types.d.ts +49 -30
- package/dist/skills-manager/types.d.ts.map +1 -1
- package/dist/skills-manager/utils.d.ts +10 -26
- package/dist/skills-manager/utils.d.ts.map +1 -1
- package/dist/skills-manager/utils.js +18 -34
- package/dist/skills-manager/utils.js.map +1 -1
- package/dist/skills-manager/version-manager.d.ts +21 -91
- package/dist/skills-manager/version-manager.d.ts.map +1 -1
- package/dist/skills-manager/version-manager.js +48 -178
- package/dist/skills-manager/version-manager.js.map +1 -1
- package/dist/skills-manager/writer.d.ts +12 -1
- package/dist/skills-manager/writer.d.ts.map +1 -1
- package/dist/skills-manager/writer.js +50 -4
- package/dist/skills-manager/writer.js.map +1 -1
- package/openclaw.plugin.json +17 -6
- package/package.json +3 -2
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
export type SkillUpdateKind = "none" | "patch" | "minor" | "major" | "unknown";
|
|
2
|
+
/**
|
|
3
|
+
* Per-skill source override. Lets an operator/QA point one skill at a
|
|
4
|
+
* different repo/branch/path than the manifest declares — e.g. testing a skill
|
|
5
|
+
* on a feature branch without editing the checked-in manifest.
|
|
6
|
+
*
|
|
7
|
+
* A per-skill `branch` override **beats** the global `SENPI_SKILLS_BRANCH`
|
|
8
|
+
* env knob (per-skill intent wins over the force-all knob); only the
|
|
9
|
+
* `SENPI_SKILLS_BRANCH_<NAME>` per-skill env var outranks it. See
|
|
10
|
+
* `resolveSkillSource` for the full precedence.
|
|
11
|
+
*/
|
|
12
|
+
export interface SkillSourceOverride {
|
|
13
|
+
repo?: string;
|
|
14
|
+
branch?: string;
|
|
15
|
+
/** Pin to a commit SHA, or `"latest"` to track the branch tip. */
|
|
16
|
+
commit?: string;
|
|
17
|
+
path?: string;
|
|
18
|
+
}
|
|
2
19
|
/** Minimal logger interface accepted throughout the skills-manager package. */
|
|
3
20
|
export interface LoggerLike {
|
|
4
21
|
info(...args: unknown[]): void;
|
|
@@ -21,7 +38,21 @@ export interface RawSkillsManagerConfig {
|
|
|
21
38
|
* `DEFAULT_SKILLS_DIRS` when omitted, null, an empty array, or wrong-typed.
|
|
22
39
|
*/
|
|
23
40
|
skillsDir?: string | string[];
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Ignored. The managed skill set is defined solely by the
|
|
43
|
+
* manifest (`skills-manifest.json`). This field is tolerated for backward
|
|
44
|
+
* compatibility with existing configs but no longer affects which skills are
|
|
45
|
+
* managed. Use `overrides` to retarget a skill's source, or `enabled: false`
|
|
46
|
+
* to disable the manager.
|
|
47
|
+
*/
|
|
24
48
|
skills?: string[];
|
|
49
|
+
/**
|
|
50
|
+
* Per-skill source overrides keyed by skill name. Optional. Each entry may
|
|
51
|
+
* override `repo`, `branch`, and/or `path` for that skill (e.g.
|
|
52
|
+
* `{ "senpi-strategy-ops": { "branch": "strategy-v2" } }`). The global
|
|
53
|
+
* `SENPI_SKILLS_BRANCH` env var still takes precedence over these.
|
|
54
|
+
*/
|
|
55
|
+
overrides?: Record<string, SkillSourceOverride>;
|
|
25
56
|
}
|
|
26
57
|
/** Resolved config — all fields have safe defaults filled in. */
|
|
27
58
|
export interface SkillsManagerConfig {
|
|
@@ -36,16 +67,19 @@ export interface SkillsManagerConfig {
|
|
|
36
67
|
*/
|
|
37
68
|
skillsDir: string[];
|
|
38
69
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* - Explicit non-empty array → uses those names.
|
|
45
|
-
* - Explicit empty array `[]` → discovery mode: scan subdirs under
|
|
46
|
-
* `skillsDir`.
|
|
70
|
+
* @deprecated Ignored by the coordinator. The managed skill set is the
|
|
71
|
+
* manifest set (`getManifestSkillNames`), full stop. Still resolved here
|
|
72
|
+
* (defaults to the manifest names) for backward-compatible config shape, but
|
|
73
|
+
* nothing reads it to define the set. To disable the manager use
|
|
74
|
+
* `enabled: false`; to retarget a skill's source use `overrides`.
|
|
47
75
|
*/
|
|
48
76
|
skills: string[];
|
|
77
|
+
/**
|
|
78
|
+
* Per-skill source overrides (repo/branch/path), keyed by skill name.
|
|
79
|
+
* Always present after resolution (defaults to `{}`). See
|
|
80
|
+
* {@link SkillSourceOverride}.
|
|
81
|
+
*/
|
|
82
|
+
overrides: Record<string, SkillSourceOverride>;
|
|
49
83
|
}
|
|
50
84
|
/** Per-skill state persisted across gateway restarts. */
|
|
51
85
|
export interface SkillState {
|
|
@@ -64,9 +98,6 @@ export interface SkillState {
|
|
|
64
98
|
*/
|
|
65
99
|
latestVersion: string | null;
|
|
66
100
|
lastCheckedAt: string | null;
|
|
67
|
-
lastAppliedVersion: string | null;
|
|
68
|
-
/** Dedup key: if remote major version matches this, skip re-notification. */
|
|
69
|
-
lastNotifiedMajorVersion: string | null;
|
|
70
101
|
consecutiveFailures: number;
|
|
71
102
|
lastFailureAt: string | null;
|
|
72
103
|
lastFailureReason: string | null;
|
|
@@ -103,23 +134,6 @@ export interface SkillVersionInfo {
|
|
|
103
134
|
localVersion: string | null;
|
|
104
135
|
remoteVersion: string | null;
|
|
105
136
|
updateKind: SkillUpdateKind;
|
|
106
|
-
/**
|
|
107
|
-
* Short description parsed from the **remote** SKILL.md frontmatter (the
|
|
108
|
-
* version the user is being notified about), surfaced back to the
|
|
109
|
-
* coordinator so notification text can include an "About:" line that
|
|
110
|
-
* reflects the upcoming version rather than the potentially-stale local
|
|
111
|
-
* copy.
|
|
112
|
-
*
|
|
113
|
-
* Null when:
|
|
114
|
-
* - The remote fetch returned 404 (skill not in the remote repo).
|
|
115
|
-
* - The remote SKILL.md is present but its frontmatter has no
|
|
116
|
-
* `description` field.
|
|
117
|
-
*
|
|
118
|
-
* Optional in the interface for backward compatibility with injected
|
|
119
|
-
* test deps that only return version data; the real `checkSkillVersion`
|
|
120
|
-
* always populates it (possibly null) on every return path.
|
|
121
|
-
*/
|
|
122
|
-
remoteDescription?: string | null;
|
|
123
137
|
}
|
|
124
138
|
/** Injectable overrides used in unit tests to avoid network and git calls. */
|
|
125
139
|
export interface SkillsUpdateCoordinatorDeps {
|
|
@@ -130,7 +144,7 @@ export interface SkillsUpdateCoordinatorDeps {
|
|
|
130
144
|
* `skillsDirs` is the search-path array from the resolved config; the real
|
|
131
145
|
* `checkSkillVersion` tries each in order when reading SKILL.md.
|
|
132
146
|
*/
|
|
133
|
-
checkSkillVersion?: (skillsDirs: readonly string[], skillName: string, rawBaseUrl: string, logger?: LoggerLike) => Promise<SkillVersionInfo>;
|
|
147
|
+
checkSkillVersion?: (skillsDirs: readonly string[], skillName: string, rawBaseUrl: string, logger?: LoggerLike, remotePath?: string) => Promise<SkillVersionInfo>;
|
|
134
148
|
/**
|
|
135
149
|
* Override clone + install — receives the list of skill names that need
|
|
136
150
|
* updating and the config. Defaults to real cloneSkillsRepo + installSkill.
|
|
@@ -138,13 +152,18 @@ export interface SkillsUpdateCoordinatorDeps {
|
|
|
138
152
|
cloneAndInstall?: (skills: string[], config: SkillsManagerConfig) => Promise<Map<string, string | null>>;
|
|
139
153
|
/** Override bootstrap — avoids real git clone in unit tests. */
|
|
140
154
|
bootstrapSkillsIfNeeded?: (config: SkillsManagerConfig, logger: LoggerLike) => Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Override the managed skill set. **Test-only seam** — production always
|
|
157
|
+
* uses the manifest (`getManifestSkillNames`). Lets unit tests drive the set
|
|
158
|
+
* without a fixture manifest on disk.
|
|
159
|
+
*/
|
|
160
|
+
listManagedSkills?: () => string[];
|
|
141
161
|
}
|
|
142
162
|
/** Constructor options for {@link SkillsUpdateCoordinator}. */
|
|
143
163
|
export interface SkillsUpdateCoordinatorOptions {
|
|
144
164
|
config: SkillsManagerConfig;
|
|
145
165
|
stateDir: string;
|
|
146
166
|
logger: LoggerLike;
|
|
147
|
-
notify: (message: string) => Promise<void>;
|
|
148
167
|
deps?: SkillsUpdateCoordinatorDeps;
|
|
149
168
|
}
|
|
150
169
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/skills-manager/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;AAE/E,+EAA+E;AAC/E,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE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AAExE;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAC/B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACzC;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import type { RawSkillsManagerConfig, SkillsManagerConfig, SkillsManagerState, SkillState } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Canonical default list of managed skill names when the user omits the
|
|
4
|
-
* `skills` field
|
|
5
|
-
*
|
|
4
|
+
* `skills` field — sourced from the **manifest** (`skills-manifest.json`), the
|
|
5
|
+
* single source of truth for the managed set. No longer a hardcoded list.
|
|
6
6
|
*
|
|
7
7
|
* Semantics for the resolved `skills` array:
|
|
8
|
-
* - Field omitted entirely → defaults to
|
|
9
|
-
* configs like `{ enabled: true }` get
|
|
10
|
-
* automatically without
|
|
8
|
+
* - Field omitted entirely → defaults to the manifest skill set. Partial
|
|
9
|
+
* configs like `{ enabled: true }` get every manifest skill bootstrapped
|
|
10
|
+
* automatically without repeating the array in JSON.
|
|
11
11
|
* - Field present and non-empty → use the provided names (filtered for
|
|
12
|
-
* non-empty strings)
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* non-empty strings) as a subset/override; each still resolves its source
|
|
13
|
+
* (repo/branch/path) from the manifest.
|
|
14
|
+
* - Field present and explicitly empty (`"skills": []`) → legacy discovery
|
|
15
|
+
* mode: scan subdirs under `skillsDir`. Retained for backward compatibility;
|
|
16
|
+
* the manifest is the preferred source.
|
|
15
17
|
*/
|
|
16
18
|
export declare const DEFAULT_MANAGED_SKILLS: readonly string[];
|
|
17
19
|
/**
|
|
@@ -43,24 +45,6 @@ export declare function createDefaultSkillsManagerState(): SkillsManagerState;
|
|
|
43
45
|
export declare function createDefaultSkillState(name: string): SkillState;
|
|
44
46
|
/** Formats an unknown thrown value as a short string for log messages. */
|
|
45
47
|
export declare function formatErr(e: unknown): string;
|
|
46
|
-
/**
|
|
47
|
-
* Parse a positive integer from an env-var string, falling back to the
|
|
48
|
-
* supplied default on anything unparseable, zero, or negative.
|
|
49
|
-
*
|
|
50
|
-
* Used to load numeric env-overridable constants in `constants.ts` (e.g.
|
|
51
|
-
* `TELEGRAM_NOTIFICATION_BUDGET_CHARS`) without throwing at module load
|
|
52
|
-
* time when the env var is bogus — matches the rest of `constants.ts`'s
|
|
53
|
-
* "default wins on bad input, never crash startup" style.
|
|
54
|
-
*
|
|
55
|
-
* Examples:
|
|
56
|
-
* parseEnvPositiveInt("8000", 4000) // 8000 (valid override)
|
|
57
|
-
* parseEnvPositiveInt("abc", 4000) // 4000 (unparseable → default)
|
|
58
|
-
* parseEnvPositiveInt("0", 4000) // 4000 (zero → default)
|
|
59
|
-
* parseEnvPositiveInt("-100", 4000) // 4000 (negative → default)
|
|
60
|
-
* parseEnvPositiveInt("", 4000) // 4000 (empty → default)
|
|
61
|
-
* parseEnvPositiveInt(undefined, 4000) // 4000 (unset → default)
|
|
62
|
-
*/
|
|
63
|
-
export declare function parseEnvPositiveInt(envValue: string | undefined, defaultValue: number): number;
|
|
64
48
|
/**
|
|
65
49
|
* Normalise the raw `skillsDir` value into a non-empty `string[]` (the
|
|
66
50
|
* "search path" form used internally).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/skills-manager/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/skills-manager/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACX,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAA4B,CAAC;AAEjF;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,CAAC,EAAE,sBAAsB,GAAG,IAAI,GACpC,mBAAmB,CAqBrB;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,IAAI,kBAAkB,CAEpE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAUhE;AAED,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAE5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAc3D"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { DEFAULT_SKILLS_DIRS } from "./constants.js";
|
|
2
|
+
import { getManifestSkillNames } from "./manifest.js";
|
|
2
3
|
/**
|
|
3
4
|
* Canonical default list of managed skill names when the user omits the
|
|
4
|
-
* `skills` field
|
|
5
|
-
*
|
|
5
|
+
* `skills` field — sourced from the **manifest** (`skills-manifest.json`), the
|
|
6
|
+
* single source of truth for the managed set. No longer a hardcoded list.
|
|
6
7
|
*
|
|
7
8
|
* Semantics for the resolved `skills` array:
|
|
8
|
-
* - Field omitted entirely → defaults to
|
|
9
|
-
* configs like `{ enabled: true }` get
|
|
10
|
-
* automatically without
|
|
9
|
+
* - Field omitted entirely → defaults to the manifest skill set. Partial
|
|
10
|
+
* configs like `{ enabled: true }` get every manifest skill bootstrapped
|
|
11
|
+
* automatically without repeating the array in JSON.
|
|
11
12
|
* - Field present and non-empty → use the provided names (filtered for
|
|
12
|
-
* non-empty strings)
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* non-empty strings) as a subset/override; each still resolves its source
|
|
14
|
+
* (repo/branch/path) from the manifest.
|
|
15
|
+
* - Field present and explicitly empty (`"skills": []`) → legacy discovery
|
|
16
|
+
* mode: scan subdirs under `skillsDir`. Retained for backward compatibility;
|
|
17
|
+
* the manifest is the preferred source.
|
|
15
18
|
*/
|
|
16
|
-
export const DEFAULT_MANAGED_SKILLS =
|
|
19
|
+
export const DEFAULT_MANAGED_SKILLS = getManifestSkillNames();
|
|
17
20
|
/**
|
|
18
21
|
* Parses and normalises the raw `skillsManager` config block from the plugin
|
|
19
22
|
* config into a fully-resolved {@link SkillsManagerConfig}.
|
|
@@ -37,6 +40,12 @@ export function resolveSkillsManagerConfig(value) {
|
|
|
37
40
|
skills: Array.isArray(raw.skills)
|
|
38
41
|
? raw.skills.filter((s) => typeof s === "string" && s.length > 0)
|
|
39
42
|
: [...DEFAULT_MANAGED_SKILLS],
|
|
43
|
+
// Per-skill source overrides — pass through when a plain object, else {}.
|
|
44
|
+
overrides: raw.overrides !== null &&
|
|
45
|
+
typeof raw.overrides === "object" &&
|
|
46
|
+
!Array.isArray(raw.overrides)
|
|
47
|
+
? raw.overrides
|
|
48
|
+
: {},
|
|
40
49
|
};
|
|
41
50
|
}
|
|
42
51
|
/**
|
|
@@ -62,8 +71,6 @@ export function createDefaultSkillState(name) {
|
|
|
62
71
|
installedVersion: null,
|
|
63
72
|
latestVersion: null,
|
|
64
73
|
lastCheckedAt: null,
|
|
65
|
-
lastAppliedVersion: null,
|
|
66
|
-
lastNotifiedMajorVersion: null,
|
|
67
74
|
consecutiveFailures: 0,
|
|
68
75
|
lastFailureAt: null,
|
|
69
76
|
lastFailureReason: null,
|
|
@@ -73,29 +80,6 @@ export function createDefaultSkillState(name) {
|
|
|
73
80
|
export function formatErr(e) {
|
|
74
81
|
return e instanceof Error ? e.message : String(e);
|
|
75
82
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Parse a positive integer from an env-var string, falling back to the
|
|
78
|
-
* supplied default on anything unparseable, zero, or negative.
|
|
79
|
-
*
|
|
80
|
-
* Used to load numeric env-overridable constants in `constants.ts` (e.g.
|
|
81
|
-
* `TELEGRAM_NOTIFICATION_BUDGET_CHARS`) without throwing at module load
|
|
82
|
-
* time when the env var is bogus — matches the rest of `constants.ts`'s
|
|
83
|
-
* "default wins on bad input, never crash startup" style.
|
|
84
|
-
*
|
|
85
|
-
* Examples:
|
|
86
|
-
* parseEnvPositiveInt("8000", 4000) // 8000 (valid override)
|
|
87
|
-
* parseEnvPositiveInt("abc", 4000) // 4000 (unparseable → default)
|
|
88
|
-
* parseEnvPositiveInt("0", 4000) // 4000 (zero → default)
|
|
89
|
-
* parseEnvPositiveInt("-100", 4000) // 4000 (negative → default)
|
|
90
|
-
* parseEnvPositiveInt("", 4000) // 4000 (empty → default)
|
|
91
|
-
* parseEnvPositiveInt(undefined, 4000) // 4000 (unset → default)
|
|
92
|
-
*/
|
|
93
|
-
export function parseEnvPositiveInt(envValue, defaultValue) {
|
|
94
|
-
if (envValue === undefined || envValue === "")
|
|
95
|
-
return defaultValue;
|
|
96
|
-
const n = parseInt(envValue, 10);
|
|
97
|
-
return Number.isFinite(n) && n > 0 ? n : defaultValue;
|
|
98
|
-
}
|
|
99
83
|
/**
|
|
100
84
|
* Normalise the raw `skillsDir` value into a non-empty `string[]` (the
|
|
101
85
|
* "search path" form used internally).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/skills-manager/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/skills-manager/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAQtD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB,qBAAqB,EAAE,CAAC;AAEjF;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAqC;IAErC,MAAM,GAAG,GAAG,KAAK,IAAI,EAAE,CAAC;IACxB,OAAO;QACL,OAAO,EAAE,MAAM,CAA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;;;;;;GAeG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,KAAK;aACnB,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;aACjD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/B,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,QAAQ,CAAC;IAC3C,CAAC;IACD,2EAA2E;IAC3E,4EAA4E;IAC5E,OAAO,CAAC,GAAG,mBAAmB,CAAC,CAAC;AAClC,CAAC;AAED,+EAA+E;AAC/E,+EAA+E;AAC/E,qEAAqE;AACrE,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,mEAAmE;AACnE,SAAS,MAAM,CAAC,KAAc,EAAE,QAAiB;IAC/C,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACvD,CAAC"}
|
|
@@ -26,111 +26,41 @@ export declare function normalizeVersion(v: string): string;
|
|
|
26
26
|
* Returns null when the frontmatter block is absent or the field is missing.
|
|
27
27
|
*/
|
|
28
28
|
export declare function parseSkillMdVersion(content: string): string | null;
|
|
29
|
-
/**
|
|
30
|
-
* Extract the `description` value from a SKILL.md YAML frontmatter block.
|
|
31
|
-
*
|
|
32
|
-
* Skill descriptions can be authored a few different ways. This helper
|
|
33
|
-
* handles the real-world shapes that appear in the senpi-skills repo today:
|
|
34
|
-
*
|
|
35
|
-
* 1. Single-line, double-quoted:
|
|
36
|
-
* description: "Configure, deploy, ..."
|
|
37
|
-
* 2. Single-line, single-quoted or unquoted:
|
|
38
|
-
* description: Manage runtimes ...
|
|
39
|
-
* 3. YAML block scalar (folded or literal, optional chomping indicator):
|
|
40
|
-
* description: >
|
|
41
|
-
* A short summary
|
|
42
|
-
* continues on this line.
|
|
43
|
-
* description: >- # strip trailing newlines (this PR's senpi-skills repo)
|
|
44
|
-
* A short summary
|
|
45
|
-
* description: | # literal — preserves newlines (collapsed to spaces here)
|
|
46
|
-
* A short summary
|
|
47
|
-
* description: |+ # keep trailing newlines (same handling)
|
|
48
|
-
*
|
|
49
|
-
* The block scalar header is `[>|][-+]?` per the YAML 1.2 spec:
|
|
50
|
-
* `>` = folded, `|` = literal; `-` strips trailing newlines,
|
|
51
|
-
* `+` keeps them, no indicator clips. For notification rendering we
|
|
52
|
-
* always collapse to a single line joined by spaces, so the chomping
|
|
53
|
-
* indicator only affects whether we match the block-scalar branch.
|
|
54
|
-
*
|
|
55
|
-
* Returns null when the field is absent or the frontmatter block is missing.
|
|
56
|
-
*
|
|
57
|
-
* Note: kept as a regex extractor rather than introducing a full YAML
|
|
58
|
-
* parse here — `parseSkillMdVersion` uses the same approach, and skill
|
|
59
|
-
* frontmatters are constrained enough that the regex covers the shapes we
|
|
60
|
-
* actually encounter. If we ever adopt a full YAML parser for this file,
|
|
61
|
-
* both helpers should switch together.
|
|
62
|
-
*/
|
|
63
|
-
export declare function parseSkillMdDescription(content: string): string | null;
|
|
64
|
-
/**
|
|
65
|
-
* Read both the installed version and description for a skill from its local
|
|
66
|
-
* SKILL.md. Shared core for `readLocalVersion` and `readLocalDescription` so a
|
|
67
|
-
* tick that needs both pays a single file read per dir rather than two.
|
|
68
|
-
*
|
|
69
|
-
* Multi-dir search path: tries each entry in order and returns the first
|
|
70
|
-
* readable SKILL.md's parsed fields. Either field may be null if absent in
|
|
71
|
-
* the frontmatter — that's distinct from "no SKILL.md found at all" (which
|
|
72
|
-
* returns nulls only after every dir has been tried).
|
|
73
|
-
*/
|
|
74
|
-
export declare function readLocalSkillMetadata(skillsDir: string | readonly string[], skillName: string, logger?: LoggerLike): Promise<{
|
|
75
|
-
version: string | null;
|
|
76
|
-
description: string | null;
|
|
77
|
-
}>;
|
|
78
29
|
/**
|
|
79
30
|
* Read the installed version for a skill from its local SKILL.md.
|
|
80
31
|
*
|
|
81
|
-
* Accepts either a single dir (legacy callers) or an array of dirs (
|
|
32
|
+
* Accepts either a single dir (legacy callers) or an array of dirs (the
|
|
82
33
|
* multi-dir search path). When given an array, tries each entry in order and
|
|
83
|
-
* returns the first
|
|
84
|
-
* that `skillsDir[0]` is the *primary* (writes go here)
|
|
85
|
-
* entries are read-only fallbacks scanned during version
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
34
|
+
* returns the first readable SKILL.md's parsed version — this mirrors the
|
|
35
|
+
* documented behaviour that `skillsDir[0]` is the *primary* (writes go here)
|
|
36
|
+
* and the remaining entries are read-only fallbacks scanned during version
|
|
37
|
+
* checks.
|
|
38
|
+
*
|
|
39
|
+
* The first readable SKILL.md wins even if its version field is absent — a
|
|
40
|
+
* present-but-versionless file is meaningful state (skill predates versioning),
|
|
41
|
+
* not a "not found" signal that should let the next dir override it. Returns
|
|
42
|
+
* null when no readable SKILL.md is found across any candidate dir, or when the
|
|
43
|
+
* version field is absent. Logs a warning per dir for unexpected errors
|
|
44
|
+
* (anything other than ENOENT).
|
|
90
45
|
*/
|
|
91
46
|
export declare function readLocalVersion(skillsDir: string | readonly string[], skillName: string, logger?: LoggerLike): Promise<string | null>;
|
|
92
47
|
/**
|
|
93
|
-
*
|
|
94
|
-
* Multi-dir search path semantics identical to `readLocalVersion`.
|
|
95
|
-
*
|
|
96
|
-
* Returns null when no readable SKILL.md is found across any of the
|
|
97
|
-
* candidate dirs, or when the description field is absent.
|
|
98
|
-
*/
|
|
99
|
-
export declare function readLocalDescription(skillsDir: string | readonly string[], skillName: string, logger?: LoggerLike): Promise<string | null>;
|
|
100
|
-
/**
|
|
101
|
-
* Fetch the remote SKILL.md for a skill and return both the version and the
|
|
102
|
-
* description in one network round-trip.
|
|
103
|
-
*
|
|
104
|
-
* Notification text uses the description from the **remote** SKILL.md (not
|
|
105
|
-
* the local one) so the "About:" line reflects the version the user is being
|
|
106
|
-
* asked about — a description on disk for v1.x may be stale relative to the
|
|
107
|
-
* v2.0.0 the major-update notification is announcing.
|
|
48
|
+
* Fetch the remote SKILL.md for a skill and return its version.
|
|
108
49
|
*
|
|
109
|
-
* Returns null
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* its frontmatter omits the corresponding field.
|
|
50
|
+
* Returns null when the skill does not exist in the remote repo (HTTP 404) —
|
|
51
|
+
* that's a legitimate state ("skill removed or not yet published"), not an
|
|
52
|
+
* error, so it should not pollute failure counters. Also null when the remote
|
|
53
|
+
* SKILL.md is present but its frontmatter omits the version field.
|
|
114
54
|
*
|
|
115
55
|
* Throws on transient/operational failures (network errors, timeouts, 5xx
|
|
116
56
|
* responses, body-parse failures) so the caller's failure-recording path can
|
|
117
57
|
* fire.
|
|
118
58
|
*
|
|
59
|
+
* @param remotePath Subdirectory inside the repo holding the skill (manifest
|
|
60
|
+
* `path`); defaults to the skill name (monorepo convention).
|
|
119
61
|
* @param fetchImpl Injectable for unit testing — defaults to global `fetch`.
|
|
120
62
|
*/
|
|
121
|
-
export declare function
|
|
122
|
-
version: string | null;
|
|
123
|
-
description: string | null;
|
|
124
|
-
}>;
|
|
125
|
-
/**
|
|
126
|
-
* Fetch the remote SKILL.md for a skill and return its version.
|
|
127
|
-
*
|
|
128
|
-
* Thin wrapper over {@link fetchRemoteSkillMetadata} kept for backward
|
|
129
|
-
* compatibility with callers (and tests) that only need the version field.
|
|
130
|
-
* New code that wants both version + description in a single round-trip
|
|
131
|
-
* should call `fetchRemoteSkillMetadata` directly.
|
|
132
|
-
*/
|
|
133
|
-
export declare function fetchRemoteVersion(skillName: string, rawBaseUrl?: string, fetchImpl?: typeof fetch): Promise<string | null>;
|
|
63
|
+
export declare function fetchRemoteVersion(skillName: string, rawBaseUrl?: string, fetchImpl?: typeof fetch, remotePath?: string): Promise<string | null>;
|
|
134
64
|
/**
|
|
135
65
|
* Compare the local and remote versions for a skill and return a classified diff.
|
|
136
66
|
*
|
|
@@ -142,5 +72,5 @@ export declare function fetchRemoteVersion(skillName: string, rawBaseUrl?: strin
|
|
|
142
72
|
* - Remote version is absent or unparseable → "unknown", caller should log and
|
|
143
73
|
* skip.
|
|
144
74
|
*/
|
|
145
|
-
export declare function checkSkillVersion(skillsDir: string | readonly string[], skillName: string, rawBaseUrl?: string, fetchImpl?: typeof fetch, logger?: LoggerLike): Promise<SkillVersionInfo>;
|
|
75
|
+
export declare function checkSkillVersion(skillsDir: string | readonly string[], skillName: string, rawBaseUrl?: string, fetchImpl?: typeof fetch, logger?: LoggerLike, remotePath?: string): Promise<SkillVersionInfo>;
|
|
146
76
|
//# sourceMappingURL=version-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-manager.d.ts","sourceRoot":"","sources":["../../src/skills-manager/version-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAmB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGhF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMlE;AAED
|
|
1
|
+
{"version":3,"file":"version-manager.d.ts","sourceRoot":"","sources":["../../src/skills-manager/version-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAmB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGhF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMlE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EACrC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBxB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,UAAU,GAAE,MAA4B,EACxC,SAAS,GAAE,OAAO,KAAa,EAC/B,UAAU,GAAE,MAAkB,GAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoCxB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EACrC,SAAS,EAAE,MAAM,EACjB,UAAU,GAAE,MAA4B,EACxC,SAAS,GAAE,OAAO,KAAa,EAC/B,MAAM,CAAC,EAAE,UAAU,EACnB,UAAU,GAAE,MAAkB,GAC7B,OAAO,CAAC,gBAAgB,CAAC,CAyC3B"}
|