@lunchbox-labs/opencode-tool-inspector 0.3.0 → 0.3.1
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/tui.js +22 -43
- package/package.json +1 -1
package/dist/tui.js
CHANGED
|
@@ -392,7 +392,7 @@ function namedValues(values, name, separator, { distinct = false } = {}) {
|
|
|
392
392
|
const rest = values.length - named;
|
|
393
393
|
return [...names, ...rest > 0 ? [`… ${rest} more`] : []].join(separator);
|
|
394
394
|
}
|
|
395
|
-
function plain
|
|
395
|
+
function plain(text) {
|
|
396
396
|
return {
|
|
397
397
|
text,
|
|
398
398
|
tone: "plain"
|
|
@@ -410,7 +410,7 @@ function indentText(depth) {
|
|
|
410
410
|
function writeDescription(rendering, description, depth) {
|
|
411
411
|
if (typeof description !== "string" || description.trim() === "") return;
|
|
412
412
|
const text = shortened(description.trim(), maximumDescriptionLength);
|
|
413
|
-
for (const line of text.split(/\r?\n/)) write(rendering, [plain
|
|
413
|
+
for (const line of text.split(/\r?\n/)) write(rendering, [plain(`${indentText(depth)}${line}`)]);
|
|
414
414
|
}
|
|
415
415
|
function withoutReference(node) {
|
|
416
416
|
const { $ref: _reference, ...rest } = node;
|
|
@@ -727,7 +727,7 @@ function objectUnion(node, rendering, visiting, nesting = 0) {
|
|
|
727
727
|
function writeProperties(rendering, objectSchema, visiting, depth, path) {
|
|
728
728
|
if (depth > maximumDepth) {
|
|
729
729
|
rendering.depthCutoffs++;
|
|
730
|
-
write(rendering, [plain
|
|
730
|
+
write(rendering, [plain(`${indentText(depth)}…`)]);
|
|
731
731
|
return;
|
|
732
732
|
}
|
|
733
733
|
/**
|
|
@@ -736,7 +736,7 @@ function writeProperties(rendering, objectSchema, visiting, depth, path) {
|
|
|
736
736
|
*/
|
|
737
737
|
const writeListedAt = (listing) => {
|
|
738
738
|
if (listing === void 0) return false;
|
|
739
|
-
write(rendering, [plain
|
|
739
|
+
write(rendering, [plain(indentText(depth + 1)), muted$2(`Same fields as ${listing.path}.`)]);
|
|
740
740
|
return true;
|
|
741
741
|
};
|
|
742
742
|
const listingOf = (definition) => definition === void 0 ? void 0 : rendering.listedDefinitions.get(definition);
|
|
@@ -775,7 +775,7 @@ function writeProperties(rendering, objectSchema, visiting, depth, path) {
|
|
|
775
775
|
...constraintNotes(resolved)
|
|
776
776
|
];
|
|
777
777
|
write(rendering, [
|
|
778
|
-
plain
|
|
778
|
+
plain(indentText(depth)),
|
|
779
779
|
{
|
|
780
780
|
text: name,
|
|
781
781
|
tone: "name"
|
|
@@ -788,10 +788,10 @@ function writeProperties(rendering, objectSchema, visiting, depth, path) {
|
|
|
788
788
|
else if (isObject(property)) writeListedAt(listingOf(recursiveDefinition(property, rendering, visiting)));
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
|
-
if (rendering.cutMerges.has(objectSchema)) write(rendering, [plain
|
|
792
|
-
if (properties.length > 0 && listedOptions.length > 0) write(rendering, [plain
|
|
791
|
+
if (rendering.cutMerges.has(objectSchema)) write(rendering, [plain(`${indentText(depth)}…`)]);
|
|
792
|
+
if (properties.length > 0 && listedOptions.length > 0) write(rendering, [plain(indentText(depth)), muted$2("And one of:")]);
|
|
793
793
|
listedOptions.forEach((variant, index) => {
|
|
794
|
-
const heading = [plain
|
|
794
|
+
const heading = [plain(indentText(depth)), {
|
|
795
795
|
text: `Option ${index + 1}`,
|
|
796
796
|
tone: "name"
|
|
797
797
|
}];
|
|
@@ -825,7 +825,7 @@ function rootLines(rendering, schema) {
|
|
|
825
825
|
}
|
|
826
826
|
const type = typeName(schema, rendering, noneVisiting, 0);
|
|
827
827
|
if (type === "object" || type === "any") return hasCombinators(resolved) ? capped(rawSchemaLines(rendering.hostName, schema)) : [[muted$2("Takes no input.")]];
|
|
828
|
-
return [[plain
|
|
828
|
+
return [[plain("Input is "), {
|
|
829
829
|
text: type,
|
|
830
830
|
tone: "name"
|
|
831
831
|
}]];
|
|
@@ -860,47 +860,29 @@ function linesText(lines) {
|
|
|
860
860
|
}
|
|
861
861
|
|
|
862
862
|
// ../core/src/agent-text.ts
|
|
863
|
-
const modeLabels = {
|
|
864
|
-
primary: "primary",
|
|
865
|
-
subagent: "subagent",
|
|
866
|
-
all: "primary or subagent",
|
|
867
|
-
unknown: void 0
|
|
868
|
-
};
|
|
869
863
|
function muted$1(text) {
|
|
870
864
|
return {
|
|
871
865
|
text,
|
|
872
866
|
tone: "muted"
|
|
873
867
|
};
|
|
874
868
|
}
|
|
875
|
-
function plain(text) {
|
|
876
|
-
return {
|
|
877
|
-
text,
|
|
878
|
-
tone: "plain"
|
|
879
|
-
};
|
|
880
|
-
}
|
|
881
|
-
function indent(depth) {
|
|
882
|
-
return " ".repeat(depth);
|
|
883
|
-
}
|
|
884
869
|
function decisionSummary(decision, actionLabels) {
|
|
885
|
-
if (decision.access === "unknown") return "
|
|
886
|
-
if (decision.offeredToModel === false) return
|
|
870
|
+
if (decision.access === "unknown") return "Unknown";
|
|
871
|
+
if (decision.offeredToModel === false) return actionLabels.deny;
|
|
887
872
|
return actionLabels[decision.access];
|
|
888
873
|
}
|
|
889
|
-
function exceptionLines(decision,
|
|
874
|
+
function exceptionLines(decision, actionLabels) {
|
|
890
875
|
if (decision.offeredToModel === false) return [];
|
|
891
|
-
return decision.exceptions.map((exception) => [
|
|
892
|
-
text: exception.pattern
|
|
876
|
+
return decision.exceptions.map((exception) => [{
|
|
877
|
+
text: ` ${exception.pattern}`,
|
|
893
878
|
tone: "name"
|
|
894
|
-
}]);
|
|
879
|
+
}, muted$1(`: ${actionLabels[exception.access]}`)]);
|
|
895
880
|
}
|
|
896
881
|
function agentLines(agent, actionLabels) {
|
|
897
|
-
|
|
898
|
-
const lines = [[{
|
|
882
|
+
return [[{
|
|
899
883
|
text: agent.agent,
|
|
900
884
|
tone: "name"
|
|
901
|
-
}, muted$1(` ${
|
|
902
|
-
if (agent.whenSubagent !== void 0) lines.push([plain(`${indent(1)}as a subagent: ${decisionSummary(agent.whenSubagent, actionLabels)}`)], ...exceptionLines(agent.whenSubagent, 2, actionLabels));
|
|
903
|
-
return lines;
|
|
885
|
+
}, muted$1(` ${decisionSummary(agent, actionLabels)}`)], ...exceptionLines(agent, actionLabels)];
|
|
904
886
|
}
|
|
905
887
|
/** The host's own hidden agents, such as `compaction` and `title`, never take tool calls. */
|
|
906
888
|
function listed(agent) {
|
|
@@ -925,13 +907,10 @@ function agentAccessLines(access, host) {
|
|
|
925
907
|
const { actionLabels } = host;
|
|
926
908
|
const agents = access.agents.filter(listed).sort(primaryFirst);
|
|
927
909
|
if (agents.length === 0) return [[muted$1(`${host.name} reported no agents that use tools.`)]];
|
|
928
|
-
const permissionNote = access.permission === access.tool ? [] : [[muted$1(`Checked as the ${access.permission} permission.`)]];
|
|
929
|
-
const patternNote = agents.some((agent) => exceptionLines(agent, 1, actionLabels).length > 0 || agent.whenSubagent !== void 0 && exceptionLines(agent.whenSubagent, 2, actionLabels).length > 0) ? [[muted$1("Patterns match the call's input, such as a command or path; a later line wins.")]] : [];
|
|
930
910
|
return [
|
|
931
|
-
...
|
|
911
|
+
...access.permission === access.tool ? [] : [[muted$1(`Checked as the ${access.permission} permission.`)]],
|
|
932
912
|
...accessNoteLines(host.accessNotes, access),
|
|
933
|
-
...agents.flatMap((agent) => agentLines(agent, actionLabels))
|
|
934
|
-
...patternNote
|
|
913
|
+
...agents.flatMap((agent) => agentLines(agent, actionLabels))
|
|
935
914
|
];
|
|
936
915
|
}
|
|
937
916
|
|
|
@@ -1386,9 +1365,9 @@ function createToolInspectorTui(host) {
|
|
|
1386
1365
|
const opencodeHost = {
|
|
1387
1366
|
name: "OpenCode",
|
|
1388
1367
|
actionLabels: {
|
|
1389
|
-
allow: "
|
|
1390
|
-
ask: "
|
|
1391
|
-
deny: "
|
|
1368
|
+
allow: "Allow",
|
|
1369
|
+
ask: "Ask",
|
|
1370
|
+
deny: "Deny"
|
|
1392
1371
|
},
|
|
1393
1372
|
accessNotes: {}
|
|
1394
1373
|
};
|