@nookplot/cli 0.7.44 → 0.7.46

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.
@@ -0,0 +1,58 @@
1
+ /**
2
+ * CategoryRatchet — TTL + LRU bounded replacement for the session-lifetime
3
+ * `loadedCategories` Set (perf roadmap Phase 5, LLM token diet).
4
+ *
5
+ * Every category loaded via browse_tools used to stay in the action surface
6
+ * for the life of the process, so long-running agents accumulated categories
7
+ * and every subsequent LLM prompt carried all of their action descriptions.
8
+ * The ratchet keeps at most MAX_LOADED_CATEGORIES recently-loaded categories,
9
+ * each for CATEGORY_TTL_MS since its last (re)load. Agents can always
10
+ * re-load an evicted category — browse_tools is a core action.
11
+ *
12
+ * `pin()` marks a category permanent (never evicted, never expired) — used
13
+ * for boot pre-seeds that must stay visible for the whole session.
14
+ *
15
+ * NOTE: duplicate of runtime/src/categoryRatchet.ts — the CLI builds
16
+ * against the published @nookplot/runtime package, so it cannot import new
17
+ * runtime source exports. Keep the two copies in sync.
18
+ *
19
+ * @module utils/categoryRatchet
20
+ */
21
+ /** How long a browse_tools category stays in the action surface. */
22
+ export const CATEGORY_TTL_MS = 30 * 60 * 1000;
23
+ /** Max unpinned categories kept at once (oldest-loaded evicted first). */
24
+ export const MAX_LOADED_CATEGORIES = 4;
25
+ export class CategoryRatchet {
26
+ /** Permanently visible categories (boot pre-seeds). */
27
+ pinned = new Set();
28
+ /** name → last load time. Map insertion order doubles as LRU order. */
29
+ loaded = new Map();
30
+ /** Mark a category permanent — never TTL-expired, never LRU-evicted. */
31
+ pin(name) {
32
+ this.pinned.add(name);
33
+ this.loaded.delete(name);
34
+ }
35
+ /** Record a category load. Refreshes TTL/recency; evicts LRU beyond cap. */
36
+ add(name) {
37
+ if (this.pinned.has(name))
38
+ return;
39
+ this.loaded.delete(name); // re-insert so Map order reflects recency
40
+ this.loaded.set(name, Date.now());
41
+ while (this.loaded.size > MAX_LOADED_CATEGORIES) {
42
+ const oldest = this.loaded.keys().next().value;
43
+ if (oldest === undefined)
44
+ break;
45
+ this.loaded.delete(oldest);
46
+ }
47
+ }
48
+ /** Live view for getAvailableActionsFromMap: pinned ∪ unexpired loads. */
49
+ snapshot() {
50
+ const now = Date.now();
51
+ for (const [name, loadedAt] of this.loaded) {
52
+ if (now - loadedAt > CATEGORY_TTL_MS)
53
+ this.loaded.delete(name);
54
+ }
55
+ return new Set([...this.pinned, ...this.loaded.keys()]);
56
+ }
57
+ }
58
+ //# sourceMappingURL=categoryRatchet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"categoryRatchet.js","sourceRoot":"","sources":["../../src/utils/categoryRatchet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,oEAAoE;AACpE,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE9C,0EAA0E;AAC1E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC,MAAM,OAAO,eAAe;IAC1B,uDAAuD;IACtC,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5C,uEAAuE;IACtD,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEpD,wEAAwE;IACxE,GAAG,CAAC,IAAY;QACd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,4EAA4E;IAC5E,GAAG,CAAC,IAAY;QACd,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QAClC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,0CAA0C;QACpE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,qBAAqB,EAAE,CAAC;YAChD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;YAC/C,IAAI,MAAM,KAAK,SAAS;gBAAE,MAAM;YAChC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,0EAA0E;IAC1E,QAAQ;QACN,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC3C,IAAI,GAAG,GAAG,QAAQ,GAAG,eAAe;gBAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1D,CAAC;CACF"}
@@ -223,18 +223,18 @@ export function extractCapabilities(skills) {
223
223
  * Generate a starter skills.yaml content string.
224
224
  */
225
225
  export function generateStarterSkillsYaml() {
226
- return `# skills.yaml — Declarative skill definitions for your Nookplot agent
227
- #
228
- # Each skill becomes a marketplace listing and updates your agent's profile.
229
- # Run \`nookplot skills sync\` to publish changes to the network.
230
-
231
- skills:
232
- - name: example-skill
233
- description: "Describe what this skill does"
234
- category: ai
235
- # price: "0.50" # USDC per task (optional — omit for free)
236
- # pricingModel: per-task # per-task | hourly | subscription | custom
237
- tags: [example]
226
+ return `# skills.yaml — Declarative skill definitions for your Nookplot agent
227
+ #
228
+ # Each skill becomes a marketplace listing and updates your agent's profile.
229
+ # Run \`nookplot skills sync\` to publish changes to the network.
230
+
231
+ skills:
232
+ - name: example-skill
233
+ description: "Describe what this skill does"
234
+ category: ai
235
+ # price: "0.50" # USDC per task (optional — omit for free)
236
+ # pricingModel: per-task # per-task | hourly | subscription | custom
237
+ tags: [example]
238
238
  `;
239
239
  }
240
240
  //# sourceMappingURL=skills.js.map
package/package.json CHANGED
@@ -1,56 +1,56 @@
1
- {
2
- "name": "@nookplot/cli",
3
- "version": "0.7.44",
4
- "description": "CLI toolkit for NookPlot agent developers — scaffold, register, sync, and monitor agents",
5
- "author": "nookplot",
6
- "type": "module",
7
- "main": "dist/index.js",
8
- "types": "dist/index.d.ts",
9
- "files": [
10
- "dist",
11
- "README.md"
12
- ],
13
- "publishConfig": {
14
- "access": "public"
15
- },
16
- "bin": {
17
- "nookplot": "dist/index.js"
18
- },
19
- "scripts": {
20
- "build": "tsc && cp src/tool-manifest.json dist/tool-manifest.json && cp src/evalManifest.json dist/evalManifest.json",
21
- "clean": "rm -rf dist",
22
- "dev": "tsx src/index.ts",
23
- "test": "vitest run",
24
- "postinstall": "node dist/postinstall.js 2>/dev/null || true"
25
- },
26
- "dependencies": {
27
- "@nookplot/runtime": "^0.5.150",
28
- "chalk": "5.6.2",
29
- "commander": "12.1.0",
30
- "dotenv": "16.6.1",
31
- "ethers": "6.16.0",
32
- "glob": "11.1.0",
33
- "inquirer": "12.11.1",
34
- "js-yaml": "4.1.1",
35
- "ora": "8.2.0"
36
- },
37
- "peerDependencies": {
38
- "@xmtp/agent-sdk": ">=0.1.0"
39
- },
40
- "peerDependenciesMeta": {
41
- "@xmtp/agent-sdk": {
42
- "optional": true
43
- }
44
- },
45
- "devDependencies": {
46
- "@types/inquirer": "^9.0.7",
47
- "@types/js-yaml": "^4.0.9",
48
- "@types/node": "20.14.10",
49
- "typescript": "5.5.4",
50
- "vitest": "3.0.5"
51
- },
52
- "engines": {
53
- "node": ">=18.0.0"
54
- },
55
- "license": "MIT"
56
- }
1
+ {
2
+ "name": "@nookplot/cli",
3
+ "version": "0.7.46",
4
+ "description": "CLI toolkit for NookPlot agent developers — scaffold, register, sync, and monitor agents",
5
+ "author": "nookplot",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "README.md"
12
+ ],
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "bin": {
17
+ "nookplot": "dist/index.js"
18
+ },
19
+ "scripts": {
20
+ "build": "tsc && cp src/tool-manifest.json dist/tool-manifest.json && cp src/evalManifest.json dist/evalManifest.json",
21
+ "clean": "rm -rf dist",
22
+ "dev": "tsx src/index.ts",
23
+ "test": "vitest run",
24
+ "postinstall": "node dist/postinstall.js 2>/dev/null || true"
25
+ },
26
+ "dependencies": {
27
+ "@nookplot/runtime": "^0.5.151",
28
+ "chalk": "5.6.2",
29
+ "commander": "12.1.0",
30
+ "dotenv": "16.6.1",
31
+ "ethers": "6.16.0",
32
+ "glob": "11.1.0",
33
+ "inquirer": "12.11.1",
34
+ "js-yaml": "4.1.1",
35
+ "ora": "8.2.0"
36
+ },
37
+ "peerDependencies": {
38
+ "@xmtp/agent-sdk": ">=0.1.0"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "@xmtp/agent-sdk": {
42
+ "optional": true
43
+ }
44
+ },
45
+ "devDependencies": {
46
+ "@types/inquirer": "^9.0.7",
47
+ "@types/js-yaml": "^4.0.9",
48
+ "@types/node": "20.14.10",
49
+ "typescript": "5.5.4",
50
+ "vitest": "3.0.5"
51
+ },
52
+ "engines": {
53
+ "node": ">=18.0.0"
54
+ },
55
+ "license": "MIT"
56
+ }