@caupulican/pi-adaptative 0.79.0 → 0.80.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/CHANGELOG.md +17 -0
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +34 -2
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/resource-loader.d.ts +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +26 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +12 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +16 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +2 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +98 -3
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +11 -2
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-group.d.ts +3 -0
- package/dist/modes/interactive/components/tool-group.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-group.js +13 -0
- package/dist/modes/interactive/components/tool-group.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +13 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +356 -21
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/extensions.md +1 -1
- package/docs/settings.md +30 -6
- package/docs/usage.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -6,6 +6,9 @@ export declare class ToolGroupComponent implements Component {
|
|
|
6
6
|
private expanded;
|
|
7
7
|
constructor(toolGroup: string, tools?: ToolExecutionComponent[]);
|
|
8
8
|
addTool(tool: ToolExecutionComponent): void;
|
|
9
|
+
removeTool(tool: ToolExecutionComponent): boolean;
|
|
10
|
+
getToolCount(): number;
|
|
11
|
+
getOnlyTool(): ToolExecutionComponent | undefined;
|
|
9
12
|
setExpanded(expanded: boolean): void;
|
|
10
13
|
setShowImages(show: boolean): void;
|
|
11
14
|
setImageWidthCells(width: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-group.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,qBAAa,kBAAmB,YAAW,SAAS;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IACtD,OAAO,CAAC,QAAQ,CAAS;IAEzB,YAAY,SAAS,EAAE,MAAM,EAAE,KAAK,GAAE,sBAAsB,EAAO,EAGlE;IAED,OAAO,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAG1C;IAED,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAGnC;IAED,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAEjC;IAED,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEtC;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ9B;IAED,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,kBAAkB;CAM1B","sourcesContent":["import { Box, type Component } from \"@earendil-works/pi-tui\";\nimport { type ThemeBg, theme } from \"../theme/theme.ts\";\nimport { keyText } from \"./keybinding-hints.ts\";\nimport type { ToolExecutionComponent } from \"./tool-execution.ts\";\n\nexport class ToolGroupComponent implements Component {\n\treadonly toolGroup: string;\n\tprivate readonly tools: ToolExecutionComponent[] = [];\n\tprivate expanded = false;\n\n\tconstructor(toolGroup: string, tools: ToolExecutionComponent[] = []) {\n\t\tthis.toolGroup = toolGroup;\n\t\tfor (const tool of tools) this.addTool(tool);\n\t}\n\n\taddTool(tool: ToolExecutionComponent): void {\n\t\ttool.setExpanded(this.expanded);\n\t\tthis.tools.push(tool);\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tfor (const tool of this.tools) tool.setExpanded(expanded);\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tfor (const tool of this.tools) tool.setShowImages(show);\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tfor (const tool of this.tools) tool.setImageWidthCells(width);\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const tool of this.tools) tool.invalidate();\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.tools.length === 0) return [];\n\t\tconst safeWidth = Math.max(1, width);\n\t\tif (this.expanded) return this.tools.flatMap((tool) => tool.render(safeWidth));\n\n\t\tconst box = new Box(1, 1, (text) => theme.bg(this.getBackgroundColor(), text));\n\t\tbox.addChild({ render: (contentWidth) => this.renderCollapsed(contentWidth), invalidate: () => {} });\n\t\treturn [\" \".repeat(safeWidth), ...box.render(safeWidth)];\n\t}\n\n\tprivate renderCollapsed(width: number): string[] {\n\t\tconst lines = this.tools.flatMap((tool) =>\n\t\t\ttool.renderCallSummary(width).map((line) => line.replace(/[ \\t]+$/g, \"\")),\n\t\t);\n\t\tfor (let i = lines.length - 1; i >= 0; i--) {\n\t\t\tif (lines[i]?.trim()) {\n\t\t\t\tlines[i] += theme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn lines;\n\t}\n\n\tprivate getBackgroundColor(): ThemeBg {\n\t\tconst colors = this.tools.map((tool) => tool.getBackgroundColor());\n\t\tif (colors.includes(\"toolErrorBg\")) return \"toolErrorBg\";\n\t\tif (colors.includes(\"toolPendingBg\")) return \"toolPendingBg\";\n\t\treturn \"toolSuccessBg\";\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-group.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,qBAAa,kBAAmB,YAAW,SAAS;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IACtD,OAAO,CAAC,QAAQ,CAAS;IAEzB,YAAY,SAAS,EAAE,MAAM,EAAE,KAAK,GAAE,sBAAsB,EAAO,EAGlE;IAED,OAAO,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAG1C;IAED,UAAU,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAKhD;IAED,YAAY,IAAI,MAAM,CAErB;IAED,WAAW,IAAI,sBAAsB,GAAG,SAAS,CAEhD;IAED,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAGnC;IAED,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAEjC;IAED,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEtC;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ9B;IAED,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,kBAAkB;CAM1B","sourcesContent":["import { Box, type Component } from \"@earendil-works/pi-tui\";\nimport { type ThemeBg, theme } from \"../theme/theme.ts\";\nimport { keyText } from \"./keybinding-hints.ts\";\nimport type { ToolExecutionComponent } from \"./tool-execution.ts\";\n\nexport class ToolGroupComponent implements Component {\n\treadonly toolGroup: string;\n\tprivate readonly tools: ToolExecutionComponent[] = [];\n\tprivate expanded = false;\n\n\tconstructor(toolGroup: string, tools: ToolExecutionComponent[] = []) {\n\t\tthis.toolGroup = toolGroup;\n\t\tfor (const tool of tools) this.addTool(tool);\n\t}\n\n\taddTool(tool: ToolExecutionComponent): void {\n\t\ttool.setExpanded(this.expanded);\n\t\tthis.tools.push(tool);\n\t}\n\n\tremoveTool(tool: ToolExecutionComponent): boolean {\n\t\tconst index = this.tools.indexOf(tool);\n\t\tif (index === -1) return false;\n\t\tthis.tools.splice(index, 1);\n\t\treturn true;\n\t}\n\n\tgetToolCount(): number {\n\t\treturn this.tools.length;\n\t}\n\n\tgetOnlyTool(): ToolExecutionComponent | undefined {\n\t\treturn this.tools.length === 1 ? this.tools[0] : undefined;\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tfor (const tool of this.tools) tool.setExpanded(expanded);\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tfor (const tool of this.tools) tool.setShowImages(show);\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tfor (const tool of this.tools) tool.setImageWidthCells(width);\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const tool of this.tools) tool.invalidate();\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.tools.length === 0) return [];\n\t\tconst safeWidth = Math.max(1, width);\n\t\tif (this.expanded) return this.tools.flatMap((tool) => tool.render(safeWidth));\n\n\t\tconst box = new Box(1, 1, (text) => theme.bg(this.getBackgroundColor(), text));\n\t\tbox.addChild({ render: (contentWidth) => this.renderCollapsed(contentWidth), invalidate: () => {} });\n\t\treturn [\" \".repeat(safeWidth), ...box.render(safeWidth)];\n\t}\n\n\tprivate renderCollapsed(width: number): string[] {\n\t\tconst lines = this.tools.flatMap((tool) =>\n\t\t\ttool.renderCallSummary(width).map((line) => line.replace(/[ \\t]+$/g, \"\")),\n\t\t);\n\t\tfor (let i = lines.length - 1; i >= 0; i--) {\n\t\t\tif (lines[i]?.trim()) {\n\t\t\t\tlines[i] += theme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn lines;\n\t}\n\n\tprivate getBackgroundColor(): ThemeBg {\n\t\tconst colors = this.tools.map((tool) => tool.getBackgroundColor());\n\t\tif (colors.includes(\"toolErrorBg\")) return \"toolErrorBg\";\n\t\tif (colors.includes(\"toolPendingBg\")) return \"toolPendingBg\";\n\t\treturn \"toolSuccessBg\";\n\t}\n}\n"]}
|
|
@@ -14,6 +14,19 @@ export class ToolGroupComponent {
|
|
|
14
14
|
tool.setExpanded(this.expanded);
|
|
15
15
|
this.tools.push(tool);
|
|
16
16
|
}
|
|
17
|
+
removeTool(tool) {
|
|
18
|
+
const index = this.tools.indexOf(tool);
|
|
19
|
+
if (index === -1)
|
|
20
|
+
return false;
|
|
21
|
+
this.tools.splice(index, 1);
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
getToolCount() {
|
|
25
|
+
return this.tools.length;
|
|
26
|
+
}
|
|
27
|
+
getOnlyTool() {
|
|
28
|
+
return this.tools.length === 1 ? this.tools[0] : undefined;
|
|
29
|
+
}
|
|
17
30
|
setExpanded(expanded) {
|
|
18
31
|
this.expanded = expanded;
|
|
19
32
|
for (const tool of this.tools)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"t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AAC,EAAE,EAAE,CAAC;YAC5C,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;gBACtB,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,OAAO,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;gBAC3E,MAAM;YACP,CAAC;QACF,CAAC;QACD,OAAO,KAAK,CAAC;IAAA,CACb;IAEO,kBAAkB,GAAY;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACnE,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;YAAE,OAAO,aAAa,CAAC;QACzD,IAAI,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC;YAAE,OAAO,eAAe,CAAC;QAC7D,OAAO,eAAe,CAAC;IAAA,CACvB;CACD","sourcesContent":["import { Box, type Component } from \"@earendil-works/pi-tui\";\nimport { type ThemeBg, theme } from \"../theme/theme.ts\";\nimport { keyText } from \"./keybinding-hints.ts\";\nimport type { ToolExecutionComponent } from \"./tool-execution.ts\";\n\nexport class ToolGroupComponent implements Component {\n\treadonly toolGroup: string;\n\tprivate readonly tools: ToolExecutionComponent[] = [];\n\tprivate expanded = false;\n\n\tconstructor(toolGroup: string, tools: ToolExecutionComponent[] = []) {\n\t\tthis.toolGroup = toolGroup;\n\t\tfor (const tool of tools) this.addTool(tool);\n\t}\n\n\taddTool(tool: ToolExecutionComponent): void {\n\t\ttool.setExpanded(this.expanded);\n\t\tthis.tools.push(tool);\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tfor (const tool of this.tools) tool.setExpanded(expanded);\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tfor (const tool of this.tools) tool.setShowImages(show);\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tfor (const tool of this.tools) tool.setImageWidthCells(width);\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const tool of this.tools) tool.invalidate();\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.tools.length === 0) return [];\n\t\tconst safeWidth = Math.max(1, width);\n\t\tif (this.expanded) return this.tools.flatMap((tool) => tool.render(safeWidth));\n\n\t\tconst box = new Box(1, 1, (text) => theme.bg(this.getBackgroundColor(), text));\n\t\tbox.addChild({ render: (contentWidth) => this.renderCollapsed(contentWidth), invalidate: () => {} });\n\t\treturn [\" \".repeat(safeWidth), ...box.render(safeWidth)];\n\t}\n\n\tprivate renderCollapsed(width: number): string[] {\n\t\tconst lines = this.tools.flatMap((tool) =>\n\t\t\ttool.renderCallSummary(width).map((line) => line.replace(/[ \\t]+$/g, \"\")),\n\t\t);\n\t\tfor (let i = lines.length - 1; i >= 0; i--) {\n\t\t\tif (lines[i]?.trim()) {\n\t\t\t\tlines[i] += theme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn lines;\n\t}\n\n\tprivate getBackgroundColor(): ThemeBg {\n\t\tconst colors = this.tools.map((tool) => tool.getBackgroundColor());\n\t\tif (colors.includes(\"toolErrorBg\")) return \"toolErrorBg\";\n\t\tif (colors.includes(\"toolPendingBg\")) return \"toolPendingBg\";\n\t\treturn \"toolSuccessBg\";\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-group.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAgB,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,MAAM,OAAO,kBAAkB;IACrB,SAAS,CAAS;IACV,KAAK,GAA6B,EAAE,CAAC;IAC9C,QAA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C,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CACzE,CAAC;QACF,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5C,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;gBACtB,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,OAAO,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;gBAC3E,MAAM;YACP,CAAC;QACF,CAAC;QACD,OAAO,KAAK,CAAC;IAAA,CACb;IAEO,kBAAkB,GAAY;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACnE,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;YAAE,OAAO,aAAa,CAAC;QACzD,IAAI,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC;YAAE,OAAO,eAAe,CAAC;QAC7D,OAAO,eAAe,CAAC;IAAA,CACvB;CACD","sourcesContent":["import { Box, type Component } from \"@earendil-works/pi-tui\";\nimport { type ThemeBg, theme } from \"../theme/theme.ts\";\nimport { keyText } from \"./keybinding-hints.ts\";\nimport type { ToolExecutionComponent } from \"./tool-execution.ts\";\n\nexport class ToolGroupComponent implements Component {\n\treadonly toolGroup: string;\n\tprivate readonly tools: ToolExecutionComponent[] = [];\n\tprivate expanded = false;\n\n\tconstructor(toolGroup: string, tools: ToolExecutionComponent[] = []) {\n\t\tthis.toolGroup = toolGroup;\n\t\tfor (const tool of tools) this.addTool(tool);\n\t}\n\n\taddTool(tool: ToolExecutionComponent): void {\n\t\ttool.setExpanded(this.expanded);\n\t\tthis.tools.push(tool);\n\t}\n\n\tremoveTool(tool: ToolExecutionComponent): boolean {\n\t\tconst index = this.tools.indexOf(tool);\n\t\tif (index === -1) return false;\n\t\tthis.tools.splice(index, 1);\n\t\treturn true;\n\t}\n\n\tgetToolCount(): number {\n\t\treturn this.tools.length;\n\t}\n\n\tgetOnlyTool(): ToolExecutionComponent | undefined {\n\t\treturn this.tools.length === 1 ? this.tools[0] : undefined;\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tfor (const tool of this.tools) tool.setExpanded(expanded);\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tfor (const tool of this.tools) tool.setShowImages(show);\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tfor (const tool of this.tools) tool.setImageWidthCells(width);\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const tool of this.tools) tool.invalidate();\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.tools.length === 0) return [];\n\t\tconst safeWidth = Math.max(1, width);\n\t\tif (this.expanded) return this.tools.flatMap((tool) => tool.render(safeWidth));\n\n\t\tconst box = new Box(1, 1, (text) => theme.bg(this.getBackgroundColor(), text));\n\t\tbox.addChild({ render: (contentWidth) => this.renderCollapsed(contentWidth), invalidate: () => {} });\n\t\treturn [\" \".repeat(safeWidth), ...box.render(safeWidth)];\n\t}\n\n\tprivate renderCollapsed(width: number): string[] {\n\t\tconst lines = this.tools.flatMap((tool) =>\n\t\t\ttool.renderCallSummary(width).map((line) => line.replace(/[ \\t]+$/g, \"\")),\n\t\t);\n\t\tfor (let i = lines.length - 1; i >= 0; i--) {\n\t\t\tif (lines[i]?.trim()) {\n\t\t\t\tlines[i] += theme.fg(\"dim\", ` (${keyText(\"app.tools.expand\")} to expand)`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn lines;\n\t}\n\n\tprivate getBackgroundColor(): ThemeBg {\n\t\tconst colors = this.tools.map((tool) => tool.getBackgroundColor());\n\t\tif (colors.includes(\"toolErrorBg\")) return \"toolErrorBg\";\n\t\tif (colors.includes(\"toolPendingBg\")) return \"toolPendingBg\";\n\t\treturn \"toolSuccessBg\";\n\t}\n}\n"]}
|
|
@@ -155,6 +155,7 @@ export declare class InteractiveMode {
|
|
|
155
155
|
private getRegisteredToolDefinition;
|
|
156
156
|
private getToolPanelScope;
|
|
157
157
|
private appendToolExecutionComponent;
|
|
158
|
+
private detachToolExecutionComponent;
|
|
158
159
|
private attachToolExecutionComponent;
|
|
159
160
|
private clearActiveToolCalls;
|
|
160
161
|
private clearRenderedToolPanelState;
|
|
@@ -334,6 +335,7 @@ export declare class InteractiveMode {
|
|
|
334
335
|
private writeAutoLearnState;
|
|
335
336
|
private isAutoLearnPidAlive;
|
|
336
337
|
private pruneAutoLearnState;
|
|
338
|
+
private getAutoLearnPresetForAutonomyMode;
|
|
337
339
|
private getEffectiveAutoLearnSettings;
|
|
338
340
|
private getAutoLearnTenantKey;
|
|
339
341
|
private getAutoLearnMessageCount;
|
|
@@ -342,11 +344,22 @@ export declare class InteractiveMode {
|
|
|
342
344
|
private validateAutoLearnModelValue;
|
|
343
345
|
private validateSelfModificationSource;
|
|
344
346
|
private evaluateAutoLearn;
|
|
347
|
+
private buildAutonomyAuthorityPrompt;
|
|
345
348
|
private buildAutoLearnPrompt;
|
|
346
349
|
private launchAutoLearn;
|
|
350
|
+
private sanitizeAutoLearnDigestText;
|
|
351
|
+
private capAutoLearnDigestText;
|
|
352
|
+
private getAgentMessagePlainText;
|
|
353
|
+
private countAgentToolCalls;
|
|
354
|
+
private buildAutonomyReviewDigest;
|
|
355
|
+
private evaluateAutonomyReview;
|
|
347
356
|
private maybeStartAutoLearn;
|
|
357
|
+
private maybeStartAutonomyReview;
|
|
348
358
|
private updateAutoLearnFooter;
|
|
349
359
|
private formatAutoLearnStatus;
|
|
360
|
+
private formatAutonomyStatus;
|
|
361
|
+
private applyAutonomyMode;
|
|
362
|
+
private handleAutonomyCommand;
|
|
350
363
|
private handleAutoLearnCommand;
|
|
351
364
|
private showSettingsSelector;
|
|
352
365
|
private handleModelCommand;
|