pi-skill-shiori 0.6.16 → 0.6.17
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 +6 -0
- package/README.md +4 -4
- package/package.json +1 -1
- package/src/retrieval.ts +10 -5
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ For maintenance priorities and the phased plan, see [`ROADMAP.md`](ROADMAP.md).
|
|
|
19
19
|
|
|
20
20
|
Pi Skill Shiori is a [Pi](https://pi.dev/) package for vaults or projects with many Agent Skills where the default catalog becomes noisy and expensive. It hides the normal skill catalog when safe, recommends triggerable skills with compact summaries, and loads full `SKILL.md` bodies on demand.
|
|
21
21
|
|
|
22
|
-
`0.6.
|
|
22
|
+
`0.6.17` is the current working release. Prompt-boundary suppression is intentionally conservative: if Shiori cannot safely recognize a catalog boundary, it leaves the prompt untouched and warns instead of deleting too much.
|
|
23
23
|
|
|
24
24
|
## Features
|
|
25
25
|
|
|
@@ -38,7 +38,7 @@ Pi Skill Shiori is a [Pi](https://pi.dev/) package for vaults or projects with m
|
|
|
38
38
|
### Global install from npm
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
pi install npm:pi-skill-shiori@0.6.
|
|
41
|
+
pi install npm:pi-skill-shiori@0.6.17
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Without a version pin:
|
|
@@ -50,7 +50,7 @@ pi install npm:pi-skill-shiori
|
|
|
50
50
|
### Project-local install from npm
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
pi install -l npm:pi-skill-shiori@0.6.
|
|
53
|
+
pi install -l npm:pi-skill-shiori@0.6.17
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
Without a version pin:
|
|
@@ -62,7 +62,7 @@ pi install -l npm:pi-skill-shiori
|
|
|
62
62
|
### Install from GitHub
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
|
-
pi install git:github.com/eiei114/pi-skill-shiori@v0.6.
|
|
65
|
+
pi install git:github.com/eiei114/pi-skill-shiori@v0.6.17
|
|
66
66
|
pi install -l git:github.com/eiei114/pi-skill-shiori
|
|
67
67
|
```
|
|
68
68
|
|
package/package.json
CHANGED
package/src/retrieval.ts
CHANGED
|
@@ -12,20 +12,21 @@ export function retrieveCandidates(
|
|
|
12
12
|
index?: RetrievalIndex,
|
|
13
13
|
): SkillCandidate[] {
|
|
14
14
|
const normalizedQuery = normalize(query);
|
|
15
|
+
const queryTokens = tokenize(normalizedQuery);
|
|
15
16
|
const candidatesByName = new Map<string, SkillCandidate>();
|
|
16
17
|
const triggerableSkills = skills.filter(
|
|
17
18
|
(skill) => (policy.skills[skill.name]?.activation ?? policy.defaults.activation) === "triggerable",
|
|
18
19
|
);
|
|
19
20
|
|
|
20
21
|
for (const skill of triggerableSkills) {
|
|
21
|
-
const triggerCandidate = evaluateSkill(skill, normalizedQuery, policy, true);
|
|
22
|
+
const triggerCandidate = evaluateSkill(skill, normalizedQuery, queryTokens, policy, true);
|
|
22
23
|
if (triggerCandidate) candidatesByName.set(skill.name, triggerCandidate);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const ftsMatches = index?.search(query, policy.candidateInjection.maxCandidates * 4) ?? [];
|
|
26
27
|
const scoringPool = ftsMatches.length > 0 ? ftsMatches : skills;
|
|
27
28
|
for (const skill of scoringPool) {
|
|
28
|
-
const candidate = evaluateSkill(skill, normalizedQuery, policy, false);
|
|
29
|
+
const candidate = evaluateSkill(skill, normalizedQuery, queryTokens, policy, false);
|
|
29
30
|
if (!candidate) continue;
|
|
30
31
|
const previous = candidatesByName.get(skill.name);
|
|
31
32
|
if (!previous || candidate.score > previous.score) {
|
|
@@ -89,6 +90,7 @@ export function excludedSkillNames(
|
|
|
89
90
|
function evaluateSkill(
|
|
90
91
|
skill: SkillRecord,
|
|
91
92
|
normalizedQuery: string,
|
|
93
|
+
queryTokens: ReadonlySet<string>,
|
|
92
94
|
policy: ShioriPolicy,
|
|
93
95
|
exactTriggerOnly: boolean,
|
|
94
96
|
): SkillCandidate | undefined {
|
|
@@ -113,7 +115,7 @@ function evaluateSkill(
|
|
|
113
115
|
if (exactTriggerOnly) return undefined;
|
|
114
116
|
|
|
115
117
|
const text = normalize(`${skill.name} ${skill.description} ${includes.join(" ")}`);
|
|
116
|
-
const tokenScore = scoreTokens(
|
|
118
|
+
const tokenScore = scoreTokens(queryTokens, text);
|
|
117
119
|
if (tokenScore < policy.candidateInjection.minScore) return undefined;
|
|
118
120
|
return attachRecommendationReason(
|
|
119
121
|
{
|
|
@@ -134,8 +136,11 @@ function includesNormalized(query: string, trigger: string): boolean {
|
|
|
134
136
|
return query.includes(normalize(trigger));
|
|
135
137
|
}
|
|
136
138
|
|
|
137
|
-
function
|
|
138
|
-
|
|
139
|
+
function tokenize(query: string): Set<string> {
|
|
140
|
+
return new Set(query.split(/[^\p{L}\p{N}_-]+/u).filter((token) => token.length >= 2));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function scoreTokens(tokens: ReadonlySet<string>, text: string): number {
|
|
139
144
|
if (tokens.size === 0) return 0;
|
|
140
145
|
let hits = 0;
|
|
141
146
|
for (const token of tokens) {
|