@mrclrchtr/supi-context 4.0.0 → 4.2.0
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/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +1 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +9 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings.ts +1 -0
- package/package.json +2 -2
- package/src/context.ts +1 -2
- package/src/tool/guidance.ts +1 -5
|
@@ -34,6 +34,7 @@ export function buildActionMenu(field: ScopedFieldValue, scope: SettingsScope):
|
|
|
34
34
|
if (choices.length > 0) {
|
|
35
35
|
for (const choice of choices) menu.push({ value: `set:${choice}`, label: choice });
|
|
36
36
|
} else if (field.field.kind === "number") menu.push({ value: "edit", label: "Edit value…" });
|
|
37
|
+
else if (field.field.kind === "string") menu.push({ value: "edit", label: "Edit value…" });
|
|
37
38
|
else if (field.field.kind === "stringList") menu.push({ value: "edit", label: "Edit values…" });
|
|
38
39
|
else if (field.field.kind === "modelPicker")
|
|
39
40
|
menu.push({ value: "edit", label: "Choose model…" });
|
|
@@ -86,6 +86,11 @@ export interface NumberField extends BaseField {
|
|
|
86
86
|
values?: string[];
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/** One free-form string. */
|
|
90
|
+
export interface StringField extends BaseField {
|
|
91
|
+
kind: "string";
|
|
92
|
+
}
|
|
93
|
+
|
|
89
94
|
/** Comma-separated string list. */
|
|
90
95
|
export interface StringListField extends BaseField {
|
|
91
96
|
kind: "stringList";
|
|
@@ -164,6 +169,7 @@ export type SettingsField =
|
|
|
164
169
|
| BoolField
|
|
165
170
|
| EnumField
|
|
166
171
|
| NumberField
|
|
172
|
+
| StringField
|
|
167
173
|
| StringListField
|
|
168
174
|
| ModelPickerField
|
|
169
175
|
| CustomField;
|
|
@@ -248,6 +254,8 @@ export function formatValue(value: unknown, field: SettingsField): string {
|
|
|
248
254
|
return value ? "on" : "off";
|
|
249
255
|
case "number":
|
|
250
256
|
return String(value ?? "");
|
|
257
|
+
case "string":
|
|
258
|
+
return typeof value === "string" && value ? value : "none";
|
|
251
259
|
case "stringList": {
|
|
252
260
|
const arr = Array.isArray(value) ? value : [];
|
|
253
261
|
return arr.length > 0 ? arr.map(String).join(", ") : "none";
|
|
@@ -271,6 +279,7 @@ export function sourceBadge(displayValue: string, source: ValueSource): string {
|
|
|
271
279
|
|
|
272
280
|
/** Format the value used to prefill editors and compare concrete choices. */
|
|
273
281
|
export function formatEditValue(value: unknown, field: SettingsField): string {
|
|
282
|
+
if (field.kind === "string") return typeof value === "string" ? value : "";
|
|
274
283
|
if (field.kind === "stringList") {
|
|
275
284
|
const arr = Array.isArray(value) ? value : [];
|
|
276
285
|
return arr.map(String).join(", ");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-context",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "SuPi Context extension — agent pressure snapshots and TUI usage reports",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"typebox": "*",
|
|
35
|
-
"@mrclrchtr/supi-core": "4.
|
|
35
|
+
"@mrclrchtr/supi-core": "4.2.0"
|
|
36
36
|
},
|
|
37
37
|
"bundledDependencies": [
|
|
38
38
|
"@mrclrchtr/supi-core"
|
package/src/context.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { analyzeContext, analyzeContextPressure } from "./analysis.ts";
|
|
|
5
5
|
import { loadContextConfig } from "./config.ts";
|
|
6
6
|
import { type ContextReportEntryData, registerContextEntryRenderer } from "./entry-renderer.ts";
|
|
7
7
|
import { registerContextSettings } from "./settings-registration.ts";
|
|
8
|
-
import {
|
|
8
|
+
import { promptSnippet, toolDescription } from "./tool/guidance.ts";
|
|
9
9
|
import { serializeFullContextAnalysis } from "./tool/output.ts";
|
|
10
10
|
import {
|
|
11
11
|
type ContextToolDetails,
|
|
@@ -57,7 +57,6 @@ export default function contextExtension(pi: ExtensionAPI) {
|
|
|
57
57
|
description: toolDescription,
|
|
58
58
|
promptSnippet,
|
|
59
59
|
parameters: contextToolParameters,
|
|
60
|
-
promptGuidelines,
|
|
61
60
|
renderCall: renderContextToolCall,
|
|
62
61
|
renderResult: renderContextToolResult,
|
|
63
62
|
// biome-ignore lint/complexity/useMaxParams: pi tool execute signature
|
package/src/tool/guidance.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// Tool description and prompt snippet for the supi_context agent tool.
|
|
4
4
|
|
|
5
5
|
export const toolDescription =
|
|
6
6
|
"Report current context capacity. Omit mode for a concise, constant-shape pressure snapshot; use mode: full only when diagnostic attribution is needed. Full output is compact JSON and is replaced with a temporary-file envelope above " +
|
|
@@ -8,7 +8,3 @@ export const toolDescription =
|
|
|
8
8
|
|
|
9
9
|
export const promptSnippet =
|
|
10
10
|
"supi_context — concise context-pressure snapshot (mode: full for diagnostics)";
|
|
11
|
-
|
|
12
|
-
export const promptGuidelines = [
|
|
13
|
-
"Use supi_context before large operations or when context usage is near the limit.",
|
|
14
|
-
];
|