@goodandready/dsh-context-lens 0.1.2 → 0.1.3
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/lib/index.js +7 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -17,6 +17,9 @@ const NS = '@goodandready/dsh-context-lens';
|
|
|
17
17
|
// in-memory focus state
|
|
18
18
|
let focusState = { paths: [], updatedAt: null };
|
|
19
19
|
|
|
20
|
+
const OUTPUT_SCHEMA = { type: 'object', properties: { success: { type: 'boolean' } }, additionalProperties: true };
|
|
21
|
+
const renderOutput = (_args, result) => JSON.stringify(result, null, 2);
|
|
22
|
+
|
|
20
23
|
export function apply(ctx, config) {
|
|
21
24
|
let getConfig = () => config;
|
|
22
25
|
|
|
@@ -46,6 +49,7 @@ export function apply(ctx, config) {
|
|
|
46
49
|
},
|
|
47
50
|
required: ['paths']
|
|
48
51
|
},
|
|
52
|
+
output: { schema: OUTPUT_SCHEMA, render: renderOutput },
|
|
49
53
|
execute: async (params) => {
|
|
50
54
|
const paths = Array.isArray(params.paths) ? params.paths : [];
|
|
51
55
|
focusState = { paths, updatedAt: new Date().toISOString() };
|
|
@@ -65,6 +69,7 @@ export function apply(ctx, config) {
|
|
|
65
69
|
},
|
|
66
70
|
required: ['text']
|
|
67
71
|
},
|
|
72
|
+
output: { schema: OUTPUT_SCHEMA, render: renderOutput },
|
|
68
73
|
execute: async (params) => {
|
|
69
74
|
const cfg = getConfig();
|
|
70
75
|
const mode = params.mode || cfg.compressionMode || 'balanced';
|
|
@@ -87,6 +92,7 @@ export function apply(ctx, config) {
|
|
|
87
92
|
},
|
|
88
93
|
required: ['code']
|
|
89
94
|
},
|
|
95
|
+
output: { schema: OUTPUT_SCHEMA, render: renderOutput },
|
|
90
96
|
execute: async (params) => {
|
|
91
97
|
const cfg = getConfig();
|
|
92
98
|
const maxDepth = params.maxDepth ?? cfg.astSkeletonMaxDepth ?? 3;
|
|
@@ -100,6 +106,7 @@ export function apply(ctx, config) {
|
|
|
100
106
|
name: 'context_lens_stats',
|
|
101
107
|
description: 'Show session token savings stats for context-lens',
|
|
102
108
|
parameters: { type: 'object', properties: {} },
|
|
109
|
+
output: { schema: OUTPUT_SCHEMA, render: renderOutput },
|
|
103
110
|
execute: async () => {
|
|
104
111
|
const stats = tracker.getStats();
|
|
105
112
|
const cfg = getConfig();
|