@lapis-notes/ai 0.1.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/CHANGELOG.md +6 -0
- package/LICENSE.md +8 -0
- package/README.md +20 -0
- package/dist/ai-plugin.d.ts +88 -0
- package/dist/ai-plugin.js +742 -0
- package/dist/bootstrap/build.d.ts +15 -0
- package/dist/bootstrap/build.js +28 -0
- package/dist/bootstrap/folder-instructions.d.ts +4 -0
- package/dist/bootstrap/folder-instructions.js +49 -0
- package/dist/bootstrap/format.d.ts +2 -0
- package/dist/bootstrap/format.js +46 -0
- package/dist/bootstrap/instructions.d.ts +1 -0
- package/dist/bootstrap/instructions.js +8 -0
- package/dist/bootstrap/types.d.ts +36 -0
- package/dist/bootstrap/types.js +3 -0
- package/dist/catalog/ai-catalog-panel.svelte +742 -0
- package/dist/catalog/ai-catalog-panel.svelte.d.ts +13 -0
- package/dist/catalog/ai-catalog-view-type.d.ts +1 -0
- package/dist/catalog/ai-catalog-view-type.js +1 -0
- package/dist/catalog/ai-catalog-view.d.ts +22 -0
- package/dist/catalog/ai-catalog-view.js +48 -0
- package/dist/catalog/filter.d.ts +3 -0
- package/dist/catalog/filter.js +24 -0
- package/dist/catalog/inventory.d.ts +21 -0
- package/dist/catalog/inventory.js +255 -0
- package/dist/catalog/tree.d.ts +12 -0
- package/dist/catalog/tree.js +60 -0
- package/dist/catalog/types.d.ts +44 -0
- package/dist/catalog/types.js +1 -0
- package/dist/chat/ai-approval-card.svelte +54 -0
- package/dist/chat/ai-approval-card.svelte.d.ts +9 -0
- package/dist/chat/ai-chat-panel.svelte +1288 -0
- package/dist/chat/ai-chat-panel.svelte.d.ts +50 -0
- package/dist/chat/ai-inventory-result.css +55 -0
- package/dist/chat/ai-inventory-result.svelte +63 -0
- package/dist/chat/ai-inventory-result.svelte.d.ts +5 -0
- package/dist/chat/ai-question-card.svelte +132 -0
- package/dist/chat/ai-question-card.svelte.d.ts +9 -0
- package/dist/chat/ai-view-bootstrap.d.ts +13 -0
- package/dist/chat/ai-view-bootstrap.js +86 -0
- package/dist/chat/ai-view-panel.svelte +89 -0
- package/dist/chat/ai-view-panel.svelte.d.ts +13 -0
- package/dist/chat/ai-view-type.d.ts +1 -0
- package/dist/chat/ai-view-type.js +1 -0
- package/dist/chat/ai-view.d.ts +60 -0
- package/dist/chat/ai-view.js +121 -0
- package/dist/chat/chat-controller.svelte.d.ts +82 -0
- package/dist/chat/chat-controller.svelte.js +1926 -0
- package/dist/chat/chat-items.d.ts +88 -0
- package/dist/chat/chat-items.js +9 -0
- package/dist/chat/chat-mentions.d.ts +15 -0
- package/dist/chat/chat-mentions.js +77 -0
- package/dist/chat/chat-result-views.d.ts +5 -0
- package/dist/chat/chat-result-views.js +15 -0
- package/dist/chat/chat-session.d.ts +28 -0
- package/dist/chat/chat-session.js +50 -0
- package/dist/chat/chat-status.d.ts +1 -0
- package/dist/chat/chat-status.js +3 -0
- package/dist/chat/chat-time.d.ts +18 -0
- package/dist/chat/chat-time.js +90 -0
- package/dist/chat/chat-tool-display.d.ts +17 -0
- package/dist/chat/chat-tool-display.js +213 -0
- package/dist/chat/chat-tool-identity.d.ts +4 -0
- package/dist/chat/chat-tool-identity.js +42 -0
- package/dist/chat/chat-trace.d.ts +6 -0
- package/dist/chat/chat-trace.js +256 -0
- package/dist/chat/live-runtime-unavailable.d.ts +1 -0
- package/dist/chat/live-runtime-unavailable.js +1 -0
- package/dist/commands/agent.d.ts +8 -0
- package/dist/commands/agent.js +38 -0
- package/dist/commands/catalog.d.ts +18 -0
- package/dist/commands/catalog.js +115 -0
- package/dist/commands/discovery.d.ts +36 -0
- package/dist/commands/discovery.js +151 -0
- package/dist/commands/groups.d.ts +16 -0
- package/dist/commands/groups.js +121 -0
- package/dist/commands/inspect.d.ts +18 -0
- package/dist/commands/inspect.js +29 -0
- package/dist/commands/markdown.d.ts +21 -0
- package/dist/commands/markdown.js +117 -0
- package/dist/commands/parser.d.ts +4 -0
- package/dist/commands/parser.js +24 -0
- package/dist/commands/reserved.d.ts +4 -0
- package/dist/commands/reserved.js +107 -0
- package/dist/commands/router.d.ts +17 -0
- package/dist/commands/router.js +170 -0
- package/dist/commands/seed.d.ts +4 -0
- package/dist/commands/seed.js +8 -0
- package/dist/commands/types.d.ts +54 -0
- package/dist/commands/types.js +1 -0
- package/dist/commands/user-agents-node.d.ts +3 -0
- package/dist/commands/user-agents-node.js +52 -0
- package/dist/commands/user-agents.d.ts +22 -0
- package/dist/commands/user-agents.js +40 -0
- package/dist/conversations/approval-grants.d.ts +20 -0
- package/dist/conversations/approval-grants.js +75 -0
- package/dist/conversations/binding-state.d.ts +6 -0
- package/dist/conversations/binding-state.js +35 -0
- package/dist/conversations/context-handoff.d.ts +25 -0
- package/dist/conversations/context-handoff.js +207 -0
- package/dist/conversations/conversation-index-coordinator.d.ts +18 -0
- package/dist/conversations/conversation-index-coordinator.js +81 -0
- package/dist/conversations/conversation-index.d.ts +16 -0
- package/dist/conversations/conversation-index.js +125 -0
- package/dist/conversations/conversation-locator.d.ts +2 -0
- package/dist/conversations/conversation-locator.js +20 -0
- package/dist/conversations/conversation-palette.d.ts +18 -0
- package/dist/conversations/conversation-palette.js +29 -0
- package/dist/conversations/conversation-repository.d.ts +39 -0
- package/dist/conversations/conversation-repository.js +213 -0
- package/dist/conversations/handoff-summary.d.ts +48 -0
- package/dist/conversations/handoff-summary.js +269 -0
- package/dist/conversations/hashes.d.ts +5 -0
- package/dist/conversations/hashes.js +40 -0
- package/dist/conversations/history-creation-scope.d.ts +12 -0
- package/dist/conversations/history-creation-scope.js +44 -0
- package/dist/conversations/jsonl.d.ts +10 -0
- package/dist/conversations/jsonl.js +41 -0
- package/dist/conversations/memory-transcript-store.d.ts +15 -0
- package/dist/conversations/memory-transcript-store.js +119 -0
- package/dist/conversations/paths.d.ts +14 -0
- package/dist/conversations/paths.js +92 -0
- package/dist/conversations/redaction.d.ts +13 -0
- package/dist/conversations/redaction.js +94 -0
- package/dist/conversations/reveal-scope.d.ts +3 -0
- package/dist/conversations/reveal-scope.js +8 -0
- package/dist/conversations/scope-resolver.d.ts +11 -0
- package/dist/conversations/scope-resolver.js +18 -0
- package/dist/conversations/scope-tree.d.ts +10 -0
- package/dist/conversations/scope-tree.js +71 -0
- package/dist/conversations/transcript-projection.d.ts +9 -0
- package/dist/conversations/transcript-projection.js +409 -0
- package/dist/conversations/transcript-store.d.ts +24 -0
- package/dist/conversations/transcript-store.js +27 -0
- package/dist/conversations/types.d.ts +224 -0
- package/dist/conversations/types.js +12 -0
- package/dist/conversations/validation.d.ts +4 -0
- package/dist/conversations/validation.js +383 -0
- package/dist/conversations/vault-transcript-store.d.ts +22 -0
- package/dist/conversations/vault-transcript-store.js +219 -0
- package/dist/core/event-queue.d.ts +6 -0
- package/dist/core/event-queue.js +39 -0
- package/dist/core/types.d.ts +241 -0
- package/dist/core/types.js +50 -0
- package/dist/history/ai-history-panel.svelte +937 -0
- package/dist/history/ai-history-panel.svelte.d.ts +17 -0
- package/dist/history/ai-history-view-type.d.ts +1 -0
- package/dist/history/ai-history-view-type.js +1 -0
- package/dist/history/ai-history-view.d.ts +26 -0
- package/dist/history/ai-history-view.js +51 -0
- package/dist/history/conversation-history-tree.d.ts +15 -0
- package/dist/history/conversation-history-tree.js +71 -0
- package/dist/host/agent-workspace.d.ts +6 -0
- package/dist/host/agent-workspace.js +16 -0
- package/dist/host/create-host-runtimes.d.ts +2 -0
- package/dist/host/create-host-runtimes.js +14 -0
- package/dist/host/desktop-process-host.d.ts +6 -0
- package/dist/host/desktop-process-host.js +74 -0
- package/dist/host/host-runtime-availability.d.ts +1 -0
- package/dist/host/host-runtime-availability.js +3 -0
- package/dist/host/process-host.d.ts +31 -0
- package/dist/host/process-host.js +6 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.js +49 -0
- package/dist/jsonl/ai-jsonl-preview.d.ts +27 -0
- package/dist/jsonl/ai-jsonl-preview.js +68 -0
- package/dist/jsonl/ai-jsonl-view-type.d.ts +1 -0
- package/dist/jsonl/ai-jsonl-view-type.js +1 -0
- package/dist/jsonl/ai-jsonl-view.d.ts +16 -0
- package/dist/jsonl/ai-jsonl-view.js +57 -0
- package/dist/jsonl/ai-jsonl-view.svelte +260 -0
- package/dist/jsonl/ai-jsonl-view.svelte.d.ts +9 -0
- package/dist/memory/candidate-extractor.d.ts +25 -0
- package/dist/memory/candidate-extractor.js +191 -0
- package/dist/memory/forget-confirmation.d.ts +3 -0
- package/dist/memory/forget-confirmation.js +45 -0
- package/dist/memory/hashes.d.ts +5 -0
- package/dist/memory/hashes.js +37 -0
- package/dist/memory/memory-ingestion-coordinator.d.ts +19 -0
- package/dist/memory/memory-ingestion-coordinator.js +108 -0
- package/dist/memory/memory-record-store.d.ts +62 -0
- package/dist/memory/memory-record-store.js +369 -0
- package/dist/memory/memory-scheduler.d.ts +21 -0
- package/dist/memory/memory-scheduler.js +143 -0
- package/dist/memory/memory-tools.d.ts +61 -0
- package/dist/memory/memory-tools.js +99 -0
- package/dist/memory/native-memory-service.d.ts +72 -0
- package/dist/memory/native-memory-service.js +1256 -0
- package/dist/memory/paths.d.ts +13 -0
- package/dist/memory/paths.js +60 -0
- package/dist/memory/runtime-consolidation-provider.d.ts +18 -0
- package/dist/memory/runtime-consolidation-provider.js +154 -0
- package/dist/memory/types.d.ts +139 -0
- package/dist/memory/types.js +1 -0
- package/dist/providers/acp-model-provider.d.ts +11 -0
- package/dist/providers/acp-model-provider.js +99 -0
- package/dist/providers/codex-model-catalog.d.ts +7 -0
- package/dist/providers/codex-model-catalog.js +179 -0
- package/dist/providers/codex-model-provider.d.ts +12 -0
- package/dist/providers/codex-model-provider.js +42 -0
- package/dist/providers/model-provider.d.ts +26 -0
- package/dist/providers/model-provider.js +26 -0
- package/dist/public-components.d.ts +3 -0
- package/dist/public-components.js +3 -0
- package/dist/registry/runtime-registry.d.ts +11 -0
- package/dist/registry/runtime-registry.js +71 -0
- package/dist/registry/select-runtime.d.ts +9 -0
- package/dist/registry/select-runtime.js +31 -0
- package/dist/runtime-adapters.d.ts +16 -0
- package/dist/runtime-adapters.js +9 -0
- package/dist/runtimes/acp/acp-event-mapper.d.ts +56 -0
- package/dist/runtimes/acp/acp-event-mapper.js +237 -0
- package/dist/runtimes/acp/acp-runtime.d.ts +46 -0
- package/dist/runtimes/acp/acp-runtime.js +165 -0
- package/dist/runtimes/acp/desktop-acp-backend.d.ts +16 -0
- package/dist/runtimes/acp/desktop-acp-backend.js +243 -0
- package/dist/runtimes/codex/app-server-protocol.d.ts +28 -0
- package/dist/runtimes/codex/app-server-protocol.js +274 -0
- package/dist/runtimes/codex/codex-runtime.d.ts +24 -0
- package/dist/runtimes/codex/codex-runtime.js +318 -0
- package/dist/runtimes/fake/fake-runtime.d.ts +51 -0
- package/dist/runtimes/fake/fake-runtime.js +257 -0
- package/dist/sessions/plugin-data.d.ts +8 -0
- package/dist/sessions/plugin-data.js +29 -0
- package/dist/sessions/session-store.d.ts +47 -0
- package/dist/sessions/session-store.js +117 -0
- package/dist/settings/acp-agents.d.ts +8 -0
- package/dist/settings/acp-agents.js +11 -0
- package/dist/settings/ai-settings-tab.d.ts +8 -0
- package/dist/settings/ai-settings-tab.js +249 -0
- package/dist/settings/ai-settings.d.ts +43 -0
- package/dist/settings/ai-settings.js +147 -0
- package/dist/settings/app-tool-setting-rows.d.ts +16 -0
- package/dist/settings/app-tool-setting-rows.js +30 -0
- package/dist/settings/register-ai-settings.d.ts +3 -0
- package/dist/settings/register-ai-settings.js +393 -0
- package/dist/skills/activation.d.ts +2 -0
- package/dist/skills/activation.js +20 -0
- package/dist/skills/bundled/lapis-notes.d.ts +3 -0
- package/dist/skills/bundled/lapis-notes.js +52 -0
- package/dist/skills/bundled/research.d.ts +6 -0
- package/dist/skills/bundled/research.js +29 -0
- package/dist/skills/discovery.d.ts +21 -0
- package/dist/skills/discovery.js +227 -0
- package/dist/skills/manifest.d.ts +3 -0
- package/dist/skills/manifest.js +39 -0
- package/dist/skills/parser.d.ts +12 -0
- package/dist/skills/parser.js +124 -0
- package/dist/skills/registry.d.ts +21 -0
- package/dist/skills/registry.js +89 -0
- package/dist/skills/seed.d.ts +5 -0
- package/dist/skills/seed.js +18 -0
- package/dist/skills/skill-tools.d.ts +8 -0
- package/dist/skills/skill-tools.js +113 -0
- package/dist/skills/types.d.ts +67 -0
- package/dist/skills/types.js +1 -0
- package/dist/styles.css +514 -0
- package/dist/tools/app-tool-host.d.ts +47 -0
- package/dist/tools/app-tool-host.js +419 -0
- package/dist/tools/desktop-app-tool-bridge.d.ts +23 -0
- package/dist/tools/desktop-app-tool-bridge.js +223 -0
- package/dist/tools/mcp-server-registry.d.ts +7 -0
- package/dist/tools/mcp-server-registry.js +30 -0
- package/manifest.json +34 -0
- package/package.json +83 -0
- package/styles.css +1 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { PluginSettingTab, Setting, } from "@lapis-notes/api";
|
|
2
|
+
import { ACP_AGENT_IDS } from "./acp-agents";
|
|
3
|
+
import { applyAppToolEnablement } from "./ai-settings";
|
|
4
|
+
import { listAppToolSettingRows, registeredAppToolRefs, } from "./app-tool-setting-rows";
|
|
5
|
+
const ACP_AGENT_LABELS = {
|
|
6
|
+
codex: "Codex",
|
|
7
|
+
cursor: "Cursor",
|
|
8
|
+
};
|
|
9
|
+
const THINKING_OPTIONS = [
|
|
10
|
+
{ id: "off", label: "Off" },
|
|
11
|
+
{ id: "low", label: "Low" },
|
|
12
|
+
{ id: "medium", label: "Medium" },
|
|
13
|
+
{ id: "high", label: "High" },
|
|
14
|
+
];
|
|
15
|
+
export class AiSettingsTab extends PluginSettingTab {
|
|
16
|
+
aiPlugin;
|
|
17
|
+
constructor(app, aiPlugin) {
|
|
18
|
+
super(app, aiPlugin);
|
|
19
|
+
this.aiPlugin = aiPlugin;
|
|
20
|
+
const toolRegistryRef = this.app.agentTools.on("changed", () => {
|
|
21
|
+
if (this.containerEl?.isConnected)
|
|
22
|
+
this.display();
|
|
23
|
+
});
|
|
24
|
+
this.aiPlugin.register(() => this.app.agentTools.offref(toolRegistryRef));
|
|
25
|
+
}
|
|
26
|
+
display() {
|
|
27
|
+
const settings = this.aiPlugin.getSettings();
|
|
28
|
+
this.containerEl.empty();
|
|
29
|
+
new Setting(this.containerEl)
|
|
30
|
+
.setName("Default runtime")
|
|
31
|
+
.setDesc("Capability-based selection stays automatic unless you pin a runtime.")
|
|
32
|
+
.addDropdown((dropdown) => {
|
|
33
|
+
dropdown
|
|
34
|
+
.addOption("auto", "Automatic")
|
|
35
|
+
.addOption("acp", "ACP")
|
|
36
|
+
.addOption("codex-native", "Codex native")
|
|
37
|
+
.addOption("fake", "Fake (tests)")
|
|
38
|
+
.setValue(settings.defaultRuntime)
|
|
39
|
+
.onChange((value) => {
|
|
40
|
+
void this.aiPlugin.updateSettings({
|
|
41
|
+
defaultRuntime: value,
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
new Setting(this.containerEl)
|
|
46
|
+
.setName("ACP agent")
|
|
47
|
+
.setDesc("Built-in ACP agent used when ACP is selected.")
|
|
48
|
+
.addDropdown((dropdown) => {
|
|
49
|
+
for (const id of ACP_AGENT_IDS) {
|
|
50
|
+
dropdown.addOption(id, ACP_AGENT_LABELS[id]);
|
|
51
|
+
}
|
|
52
|
+
dropdown.setValue(settings.acpAgent).onChange((value) => {
|
|
53
|
+
void this.aiPlugin
|
|
54
|
+
.updateSettings({ acpAgent: value })
|
|
55
|
+
.then(() => this.display());
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
const modelSetting = new Setting(this.containerEl)
|
|
59
|
+
.setName("Default model")
|
|
60
|
+
.setDesc("Models reported by the selected agent provider.");
|
|
61
|
+
modelSetting.addDropdown((dropdown) => {
|
|
62
|
+
dropdown
|
|
63
|
+
.setItems([
|
|
64
|
+
{
|
|
65
|
+
value: settings.defaultModel || "__loading__",
|
|
66
|
+
label: settings.defaultModel || "Loading models…",
|
|
67
|
+
disabled: !settings.defaultModel,
|
|
68
|
+
},
|
|
69
|
+
])
|
|
70
|
+
.setValue(settings.defaultModel || "__loading__")
|
|
71
|
+
.setDisabled(true);
|
|
72
|
+
void this.loadModels(dropdown, settings, modelSetting);
|
|
73
|
+
});
|
|
74
|
+
new Setting(this.containerEl)
|
|
75
|
+
.setName("Thinking")
|
|
76
|
+
.setDesc("How much model reasoning to request on each turn.")
|
|
77
|
+
.addDropdown((dropdown) => {
|
|
78
|
+
for (const option of THINKING_OPTIONS) {
|
|
79
|
+
dropdown.addOption(option.id, option.label);
|
|
80
|
+
}
|
|
81
|
+
dropdown.setValue(settings.thinking).onChange((value) => {
|
|
82
|
+
void this.aiPlugin.updateSettings({
|
|
83
|
+
thinking: value,
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
new Setting(this.containerEl)
|
|
88
|
+
.setName("Automatic memory recall")
|
|
89
|
+
.setDesc("Inject up to three trusted curated memories into turns. Migrated vaults keep this off until enabled.")
|
|
90
|
+
.addToggle((toggle) => {
|
|
91
|
+
toggle.setValue(settings.memoryAutomaticRecall).onChange((value) => {
|
|
92
|
+
void this.aiPlugin.updateSettings({ memoryAutomaticRecall: value });
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
new Setting(this.containerEl)
|
|
96
|
+
.setName("Automatic memory consolidation")
|
|
97
|
+
.setDesc("Run bounded background proposals with a separately pinned processor. Enabling this may consume provider quota.")
|
|
98
|
+
.addToggle((toggle) => {
|
|
99
|
+
toggle
|
|
100
|
+
.setValue(settings.memoryConsolidationEnabled)
|
|
101
|
+
.onChange((value) => {
|
|
102
|
+
void this.aiPlugin.updateSettings({
|
|
103
|
+
memoryConsolidationEnabled: value,
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
new Setting(this.containerEl)
|
|
108
|
+
.setName("Memory processor runtime")
|
|
109
|
+
.setDesc("Pinned independently from the interactive chat runtime.")
|
|
110
|
+
.addDropdown((dropdown) => {
|
|
111
|
+
dropdown
|
|
112
|
+
.addOption("acp", "ACP")
|
|
113
|
+
.addOption("codex-native", "Codex native")
|
|
114
|
+
.setValue(settings.memoryConsolidationRuntime)
|
|
115
|
+
.onChange((value) => {
|
|
116
|
+
void this.aiPlugin.updateSettings({
|
|
117
|
+
memoryConsolidationRuntime: value === "codex-native" ? "codex-native" : "acp",
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
new Setting(this.containerEl)
|
|
122
|
+
.setName("Memory processor agent")
|
|
123
|
+
.setDesc("Pinned independently from the interactive chat agent.")
|
|
124
|
+
.addDropdown((dropdown) => {
|
|
125
|
+
for (const id of ACP_AGENT_IDS) {
|
|
126
|
+
dropdown.addOption(id, ACP_AGENT_LABELS[id]);
|
|
127
|
+
}
|
|
128
|
+
dropdown
|
|
129
|
+
.setValue(settings.memoryConsolidationAgent)
|
|
130
|
+
.onChange((value) => {
|
|
131
|
+
void this.aiPlugin.updateSettings({
|
|
132
|
+
memoryConsolidationAgent: value,
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
new Setting(this.containerEl)
|
|
137
|
+
.setName("Memory processor model")
|
|
138
|
+
.setDesc("Exact model used only for restricted background consolidation.")
|
|
139
|
+
.addText((text) => {
|
|
140
|
+
text.setValue(settings.memoryConsolidationModel).onChange((value) => {
|
|
141
|
+
void this.aiPlugin.updateSettings({
|
|
142
|
+
memoryConsolidationModel: value,
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
new Setting(this.containerEl)
|
|
147
|
+
.setName("Background handoff summaries")
|
|
148
|
+
.setDesc("Prepare verified summaries after long turns for future cross-agent switches. This is never run during a switch and may consume provider quota.")
|
|
149
|
+
.addToggle((toggle) => {
|
|
150
|
+
toggle.setValue(settings.handoffSummariesEnabled).onChange((value) => {
|
|
151
|
+
void this.aiPlugin.updateSettings({
|
|
152
|
+
handoffSummariesEnabled: value,
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
new Setting(this.containerEl)
|
|
157
|
+
.setName("Handoff summary runtime")
|
|
158
|
+
.setDesc("Pinned independently from the interactive chat runtime.")
|
|
159
|
+
.addDropdown((dropdown) => {
|
|
160
|
+
dropdown
|
|
161
|
+
.addOption("acp", "ACP")
|
|
162
|
+
.addOption("codex-native", "Codex native")
|
|
163
|
+
.setValue(settings.handoffSummaryRuntime)
|
|
164
|
+
.onChange((value) => {
|
|
165
|
+
void this.aiPlugin.updateSettings({
|
|
166
|
+
handoffSummaryRuntime: value === "codex-native" ? "codex-native" : "acp",
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
new Setting(this.containerEl)
|
|
171
|
+
.setName("Handoff summary agent")
|
|
172
|
+
.setDesc("Pinned independently from the interactive chat agent.")
|
|
173
|
+
.addDropdown((dropdown) => {
|
|
174
|
+
for (const id of ACP_AGENT_IDS) {
|
|
175
|
+
dropdown.addOption(id, ACP_AGENT_LABELS[id]);
|
|
176
|
+
}
|
|
177
|
+
dropdown.setValue(settings.handoffSummaryAgent).onChange((value) => {
|
|
178
|
+
void this.aiPlugin.updateSettings({
|
|
179
|
+
handoffSummaryAgent: value,
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
new Setting(this.containerEl)
|
|
184
|
+
.setName("Handoff summary model")
|
|
185
|
+
.setDesc("Exact model used only for restricted background summaries.")
|
|
186
|
+
.addText((text) => {
|
|
187
|
+
text.setValue(settings.handoffSummaryModel).onChange((value) => {
|
|
188
|
+
void this.aiPlugin.updateSettings({
|
|
189
|
+
handoffSummaryModel: value,
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
new Setting(this.containerEl)
|
|
194
|
+
.setName("Application tools")
|
|
195
|
+
.setDesc("Expose enabled application tools to new agent bindings. Existing bindings keep their frozen tool list.")
|
|
196
|
+
.addToggle((toggle) => {
|
|
197
|
+
toggle.setValue(settings.appToolsEnabled).onChange((value) => {
|
|
198
|
+
void this.aiPlugin.updateSettings({ appToolsEnabled: value });
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
for (const row of listAppToolSettingRows(this.app, settings)) {
|
|
202
|
+
new Setting(this.containerEl)
|
|
203
|
+
.setName(row.name)
|
|
204
|
+
.setDesc(row.description)
|
|
205
|
+
.addToggle((toggle) => {
|
|
206
|
+
toggle.setValue(row.enabled).onChange((value) => {
|
|
207
|
+
const registered = this.app.agentTools.get(row.name);
|
|
208
|
+
if (!registered)
|
|
209
|
+
return;
|
|
210
|
+
void this.aiPlugin.updateSettings(applyAppToolEnablement(this.aiPlugin.getSettings(), { name: registered.tool.name, owner: registered.owner }, value, registeredAppToolRefs(this.app)));
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async loadModels(dropdown, settings, setting) {
|
|
216
|
+
try {
|
|
217
|
+
const models = await this.aiPlugin.models.listModels(settings.acpAgent);
|
|
218
|
+
if (models.length === 0) {
|
|
219
|
+
setting.setDesc(`The ${settings.acpAgent} provider returned no model catalog; keeping the saved selection.`);
|
|
220
|
+
dropdown.setDisabled(false);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const selected = models.some((model) => model.model === settings.defaultModel)
|
|
224
|
+
? settings.defaultModel
|
|
225
|
+
: (models.find((model) => model.isDefault) ?? models[0]).model;
|
|
226
|
+
dropdown
|
|
227
|
+
.setItems(models.map((model) => ({
|
|
228
|
+
value: model.model,
|
|
229
|
+
label: model.badges?.length
|
|
230
|
+
? `${model.displayName ?? model.model} ${model.badges.join(" · ")}`
|
|
231
|
+
: (model.displayName ?? model.model),
|
|
232
|
+
})))
|
|
233
|
+
.setValue(selected)
|
|
234
|
+
.setDisabled(false)
|
|
235
|
+
.onChange((value) => {
|
|
236
|
+
void this.aiPlugin.updateSettings({ defaultModel: String(value) });
|
|
237
|
+
});
|
|
238
|
+
if (selected !== settings.defaultModel) {
|
|
239
|
+
await this.aiPlugin.updateSettings({ defaultModel: selected });
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
setting.setDesc(`Model catalog unavailable; keeping the saved selection. ${error instanceof Error ? error.message : String(error)}`);
|
|
244
|
+
dropdown.setDisabled(false).onChange((value) => {
|
|
245
|
+
void this.aiPlugin.updateSettings({ defaultModel: String(value) });
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AiThinkingLevel } from "../core/types";
|
|
2
|
+
import { type AcpAgentId } from "./acp-agents";
|
|
3
|
+
export type AppToolEnablementOwner = {
|
|
4
|
+
pluginId: string;
|
|
5
|
+
source: "core" | "community" | "official" | "system";
|
|
6
|
+
};
|
|
7
|
+
export type AppToolEnablementRef = {
|
|
8
|
+
name: string;
|
|
9
|
+
owner: AppToolEnablementOwner;
|
|
10
|
+
};
|
|
11
|
+
export type AiPluginSettings = {
|
|
12
|
+
defaultRuntime: "auto" | "acp" | "codex-native" | "fake";
|
|
13
|
+
acpAgent: AcpAgentId;
|
|
14
|
+
defaultModels: Record<AcpAgentId, string>;
|
|
15
|
+
/** Active-agent compatibility alias. Persisted model ownership lives in defaultModels. */
|
|
16
|
+
defaultModel: string;
|
|
17
|
+
thinking: AiThinkingLevel;
|
|
18
|
+
memoryAutomaticRecall: boolean;
|
|
19
|
+
memoryConsolidationEnabled: boolean;
|
|
20
|
+
memoryConsolidationRuntime: "acp" | "codex-native";
|
|
21
|
+
memoryConsolidationAgent: AcpAgentId;
|
|
22
|
+
memoryConsolidationModel: string;
|
|
23
|
+
handoffSummariesEnabled: boolean;
|
|
24
|
+
handoffSummaryRuntime: "acp" | "codex-native";
|
|
25
|
+
handoffSummaryAgent: AcpAgentId;
|
|
26
|
+
handoffSummaryModel: string;
|
|
27
|
+
appToolsEnabled: boolean;
|
|
28
|
+
disabledAppToolNames: string[];
|
|
29
|
+
enabledAppToolNames: string[];
|
|
30
|
+
/** @deprecated Migrated into enabledAppToolNames; omitted from new writes when empty. */
|
|
31
|
+
enabledCommunityToolPluginIds: string[];
|
|
32
|
+
};
|
|
33
|
+
export type StoredAiSettings = Partial<AiPluginSettings> & {
|
|
34
|
+
enabledCommunityToolPluginIds?: string[];
|
|
35
|
+
};
|
|
36
|
+
export declare const DEFAULT_AI_SETTINGS: AiPluginSettings;
|
|
37
|
+
export declare const APP_TOOL_SETTING_PREFIX = "ai.appTools.";
|
|
38
|
+
export declare function isCommunityAppToolOwner(owner: AppToolEnablementOwner): boolean;
|
|
39
|
+
export declare function appToolSettingId(toolName: string): string;
|
|
40
|
+
export declare function isAppToolEnabled(tool: AppToolEnablementRef, settings: Pick<AiPluginSettings, "disabledAppToolNames" | "enabledAppToolNames" | "enabledCommunityToolPluginIds">): boolean;
|
|
41
|
+
export declare function migrateLegacyCommunityToolOptIns(settings: AiPluginSettings, registeredTools: readonly AppToolEnablementRef[]): AiPluginSettings;
|
|
42
|
+
export declare function applyAppToolEnablement(settings: AiPluginSettings, tool: AppToolEnablementRef, enabled: boolean, registeredTools: readonly AppToolEnablementRef[]): Pick<AiPluginSettings, "disabledAppToolNames" | "enabledAppToolNames" | "enabledCommunityToolPluginIds">;
|
|
43
|
+
export declare function mergeAiSettings(value: StoredAiSettings | null | undefined, registeredTools?: readonly AppToolEnablementRef[]): AiPluginSettings;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { DEFAULT_ACP_AGENT, normalizeAcpAgent, } from "./acp-agents";
|
|
2
|
+
export const DEFAULT_AI_SETTINGS = {
|
|
3
|
+
defaultRuntime: "auto",
|
|
4
|
+
acpAgent: DEFAULT_ACP_AGENT,
|
|
5
|
+
defaultModels: {
|
|
6
|
+
codex: "gpt-5.6-sol",
|
|
7
|
+
cursor: "",
|
|
8
|
+
},
|
|
9
|
+
defaultModel: "gpt-5.6-sol",
|
|
10
|
+
thinking: "medium",
|
|
11
|
+
memoryAutomaticRecall: false,
|
|
12
|
+
memoryConsolidationEnabled: false,
|
|
13
|
+
memoryConsolidationRuntime: "acp",
|
|
14
|
+
memoryConsolidationAgent: "codex",
|
|
15
|
+
memoryConsolidationModel: "gpt-5.6-sol",
|
|
16
|
+
handoffSummariesEnabled: false,
|
|
17
|
+
handoffSummaryRuntime: "acp",
|
|
18
|
+
handoffSummaryAgent: "codex",
|
|
19
|
+
handoffSummaryModel: "gpt-5.6-sol",
|
|
20
|
+
appToolsEnabled: true,
|
|
21
|
+
disabledAppToolNames: [],
|
|
22
|
+
enabledAppToolNames: [],
|
|
23
|
+
enabledCommunityToolPluginIds: [],
|
|
24
|
+
};
|
|
25
|
+
export const APP_TOOL_SETTING_PREFIX = "ai.appTools.";
|
|
26
|
+
const THINKING_LEVELS = new Set([
|
|
27
|
+
"off",
|
|
28
|
+
"low",
|
|
29
|
+
"medium",
|
|
30
|
+
"high",
|
|
31
|
+
]);
|
|
32
|
+
const LEGACY_FILE_TOOL_NAMES = {
|
|
33
|
+
notes_read: "read",
|
|
34
|
+
notes_patch: "edit",
|
|
35
|
+
};
|
|
36
|
+
function migrateLegacyFileToolName(name) {
|
|
37
|
+
return LEGACY_FILE_TOOL_NAMES[name] ?? name;
|
|
38
|
+
}
|
|
39
|
+
function normalizeNameList(value) {
|
|
40
|
+
return [
|
|
41
|
+
...new Set((value ?? [])
|
|
42
|
+
.map((item) => migrateLegacyFileToolName(item.trim()))
|
|
43
|
+
.filter(Boolean)),
|
|
44
|
+
].sort();
|
|
45
|
+
}
|
|
46
|
+
export function isCommunityAppToolOwner(owner) {
|
|
47
|
+
return owner.source === "community";
|
|
48
|
+
}
|
|
49
|
+
export function appToolSettingId(toolName) {
|
|
50
|
+
return `${APP_TOOL_SETTING_PREFIX}${toolName}`;
|
|
51
|
+
}
|
|
52
|
+
export function isAppToolEnabled(tool, settings) {
|
|
53
|
+
if (isCommunityAppToolOwner(tool.owner)) {
|
|
54
|
+
return (settings.enabledAppToolNames.includes(tool.name) ||
|
|
55
|
+
settings.enabledCommunityToolPluginIds.includes(tool.owner.pluginId));
|
|
56
|
+
}
|
|
57
|
+
return !settings.disabledAppToolNames.includes(tool.name);
|
|
58
|
+
}
|
|
59
|
+
export function migrateLegacyCommunityToolOptIns(settings, registeredTools) {
|
|
60
|
+
const leftover = settings.enabledCommunityToolPluginIds;
|
|
61
|
+
if (leftover.length === 0)
|
|
62
|
+
return settings;
|
|
63
|
+
const opted = new Set(leftover);
|
|
64
|
+
const names = new Set(settings.enabledAppToolNames);
|
|
65
|
+
const seenOwners = new Set();
|
|
66
|
+
for (const tool of registeredTools) {
|
|
67
|
+
if (!isCommunityAppToolOwner(tool.owner) ||
|
|
68
|
+
!opted.has(tool.owner.pluginId)) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
names.add(tool.name);
|
|
72
|
+
seenOwners.add(tool.owner.pluginId);
|
|
73
|
+
}
|
|
74
|
+
if (seenOwners.size === 0)
|
|
75
|
+
return settings;
|
|
76
|
+
return {
|
|
77
|
+
...settings,
|
|
78
|
+
enabledAppToolNames: [...names].sort(),
|
|
79
|
+
enabledCommunityToolPluginIds: leftover.filter((pluginId) => !seenOwners.has(pluginId)),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function applyAppToolEnablement(settings, tool, enabled, registeredTools) {
|
|
83
|
+
const migrated = migrateLegacyCommunityToolOptIns(settings, registeredTools);
|
|
84
|
+
if (isCommunityAppToolOwner(tool.owner)) {
|
|
85
|
+
const names = new Set(migrated.enabledAppToolNames);
|
|
86
|
+
if (enabled)
|
|
87
|
+
names.add(tool.name);
|
|
88
|
+
else
|
|
89
|
+
names.delete(tool.name);
|
|
90
|
+
return {
|
|
91
|
+
disabledAppToolNames: migrated.disabledAppToolNames,
|
|
92
|
+
enabledAppToolNames: [...names].sort(),
|
|
93
|
+
enabledCommunityToolPluginIds: migrated.enabledCommunityToolPluginIds,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const disabled = new Set(migrated.disabledAppToolNames);
|
|
97
|
+
if (enabled)
|
|
98
|
+
disabled.delete(tool.name);
|
|
99
|
+
else
|
|
100
|
+
disabled.add(tool.name);
|
|
101
|
+
return {
|
|
102
|
+
disabledAppToolNames: [...disabled].sort(),
|
|
103
|
+
enabledAppToolNames: migrated.enabledAppToolNames,
|
|
104
|
+
enabledCommunityToolPluginIds: migrated.enabledCommunityToolPluginIds,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export function mergeAiSettings(value, registeredTools) {
|
|
108
|
+
const acpAgent = normalizeAcpAgent(value?.acpAgent);
|
|
109
|
+
const storedModels = value?.defaultModels;
|
|
110
|
+
const legacyModel = value?.defaultModel?.trim();
|
|
111
|
+
const defaultModels = {
|
|
112
|
+
codex: storedModels?.codex?.trim() ||
|
|
113
|
+
legacyModel ||
|
|
114
|
+
DEFAULT_AI_SETTINGS.defaultModels.codex,
|
|
115
|
+
cursor: storedModels?.cursor?.trim() || "",
|
|
116
|
+
};
|
|
117
|
+
const thinking = value?.thinking;
|
|
118
|
+
const merged = {
|
|
119
|
+
defaultRuntime: value?.defaultRuntime ?? DEFAULT_AI_SETTINGS.defaultRuntime,
|
|
120
|
+
acpAgent,
|
|
121
|
+
defaultModels,
|
|
122
|
+
defaultModel: defaultModels[acpAgent],
|
|
123
|
+
thinking: thinking && THINKING_LEVELS.has(thinking)
|
|
124
|
+
? thinking
|
|
125
|
+
: DEFAULT_AI_SETTINGS.thinking,
|
|
126
|
+
memoryAutomaticRecall: value?.memoryAutomaticRecall === true,
|
|
127
|
+
memoryConsolidationEnabled: value?.memoryConsolidationEnabled === true,
|
|
128
|
+
memoryConsolidationRuntime: value?.memoryConsolidationRuntime === "codex-native"
|
|
129
|
+
? "codex-native"
|
|
130
|
+
: "acp",
|
|
131
|
+
memoryConsolidationAgent: normalizeAcpAgent(value?.memoryConsolidationAgent),
|
|
132
|
+
memoryConsolidationModel: value?.memoryConsolidationModel?.trim() ||
|
|
133
|
+
DEFAULT_AI_SETTINGS.memoryConsolidationModel,
|
|
134
|
+
handoffSummariesEnabled: value?.handoffSummariesEnabled === true,
|
|
135
|
+
handoffSummaryRuntime: value?.handoffSummaryRuntime === "codex-native" ? "codex-native" : "acp",
|
|
136
|
+
handoffSummaryAgent: normalizeAcpAgent(value?.handoffSummaryAgent),
|
|
137
|
+
handoffSummaryModel: value?.handoffSummaryModel?.trim() ||
|
|
138
|
+
DEFAULT_AI_SETTINGS.handoffSummaryModel,
|
|
139
|
+
appToolsEnabled: value?.appToolsEnabled !== false,
|
|
140
|
+
disabledAppToolNames: normalizeNameList(value?.disabledAppToolNames),
|
|
141
|
+
enabledAppToolNames: normalizeNameList(value?.enabledAppToolNames),
|
|
142
|
+
enabledCommunityToolPluginIds: normalizeNameList(value?.enabledCommunityToolPluginIds),
|
|
143
|
+
};
|
|
144
|
+
return registeredTools
|
|
145
|
+
? migrateLegacyCommunityToolOptIns(merged, registeredTools)
|
|
146
|
+
: merged;
|
|
147
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { App } from "@lapis-notes/api";
|
|
2
|
+
import type { AppToolEffect } from "@lapis-notes/api/agent-tools";
|
|
3
|
+
import { type AiPluginSettings, type AppToolEnablementOwner, type AppToolEnablementRef } from "./ai-settings";
|
|
4
|
+
export type AppToolSettingRow = {
|
|
5
|
+
name: string;
|
|
6
|
+
fieldId: string;
|
|
7
|
+
pluginId: string;
|
|
8
|
+
pluginLabel: string;
|
|
9
|
+
effect: AppToolEffect;
|
|
10
|
+
description: string;
|
|
11
|
+
owner: AppToolEnablementOwner;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function registeredAppToolRefs(app: App): AppToolEnablementRef[];
|
|
15
|
+
export declare function contributingPluginLabel(app: App, pluginId: string): string;
|
|
16
|
+
export declare function listAppToolSettingRows(app: App, settings: AiPluginSettings): AppToolSettingRow[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { appToolSettingId, isAppToolEnabled, } from "./ai-settings";
|
|
2
|
+
export function registeredAppToolRefs(app) {
|
|
3
|
+
return app.agentTools.list().map((registered) => ({
|
|
4
|
+
name: registered.tool.name,
|
|
5
|
+
owner: registered.owner,
|
|
6
|
+
}));
|
|
7
|
+
}
|
|
8
|
+
export function contributingPluginLabel(app, pluginId) {
|
|
9
|
+
const name = app.plugins.plugins.get(pluginId)?.manifest.name?.trim();
|
|
10
|
+
return name || pluginId;
|
|
11
|
+
}
|
|
12
|
+
export function listAppToolSettingRows(app, settings) {
|
|
13
|
+
return app.agentTools
|
|
14
|
+
.list()
|
|
15
|
+
.slice()
|
|
16
|
+
.sort((left, right) => left.tool.name.localeCompare(right.tool.name))
|
|
17
|
+
.map((registered) => {
|
|
18
|
+
const pluginLabel = contributingPluginLabel(app, registered.owner.pluginId);
|
|
19
|
+
return {
|
|
20
|
+
name: registered.tool.name,
|
|
21
|
+
fieldId: appToolSettingId(registered.tool.name),
|
|
22
|
+
pluginId: registered.owner.pluginId,
|
|
23
|
+
pluginLabel,
|
|
24
|
+
effect: registered.tool.effect,
|
|
25
|
+
description: `${pluginLabel} · ${registered.tool.effect}`,
|
|
26
|
+
owner: registered.owner,
|
|
27
|
+
enabled: isAppToolEnabled({ name: registered.tool.name, owner: registered.owner }, settings),
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|