@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,17 @@
|
|
|
1
|
+
import { type App } from "@lapis-notes/api";
|
|
2
|
+
import type { ConversationRepository } from "../conversations/conversation-repository";
|
|
3
|
+
import type { ConversationListEntry } from "../conversations/transcript-store";
|
|
4
|
+
import type { ConversationLocation } from "../conversations/types";
|
|
5
|
+
type $$ComponentProps = {
|
|
6
|
+
app: App;
|
|
7
|
+
repository: ConversationRepository;
|
|
8
|
+
getScope: () => string;
|
|
9
|
+
getActiveConversation: () => ConversationLocation | null;
|
|
10
|
+
onOpenConversation: (location: ConversationLocation) => void | Promise<void>;
|
|
11
|
+
onNewConversation: (scopeDir: string) => void | Promise<void>;
|
|
12
|
+
listConversationFolders: () => string[];
|
|
13
|
+
searchAllConversations: (query: string) => Promise<ConversationListEntry[]>;
|
|
14
|
+
};
|
|
15
|
+
declare const AiHistoryPanel: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
16
|
+
type AiHistoryPanel = ReturnType<typeof AiHistoryPanel>;
|
|
17
|
+
export default AiHistoryPanel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AiHistoryViewType = "ai-conversation-history";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const AiHistoryViewType = "ai-conversation-history";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { View, type WorkspaceLeaf } from "@lapis-notes/api";
|
|
2
|
+
import type { ConversationRepository } from "../conversations/conversation-repository";
|
|
3
|
+
import type { ConversationLocation } from "../conversations/types";
|
|
4
|
+
import type { ConversationListEntry } from "../conversations/transcript-store";
|
|
5
|
+
export type AiHistoryViewHost = {
|
|
6
|
+
conversations: ConversationRepository;
|
|
7
|
+
currentConversationScope(): string;
|
|
8
|
+
currentAiConversation(): ConversationLocation | null;
|
|
9
|
+
openAiConversation(location: ConversationLocation): Promise<void>;
|
|
10
|
+
createAiConversation(scopeDir: string): Promise<void>;
|
|
11
|
+
listConversationFolders(): string[];
|
|
12
|
+
searchAiConversations(query: string): Promise<ConversationListEntry[]>;
|
|
13
|
+
};
|
|
14
|
+
export declare class AiHistoryView extends View {
|
|
15
|
+
private readonly host;
|
|
16
|
+
private component;
|
|
17
|
+
constructor(leaf: WorkspaceLeaf, host: AiHistoryViewHost);
|
|
18
|
+
getViewType(): string;
|
|
19
|
+
getDisplayText(): string;
|
|
20
|
+
getIcon(): string;
|
|
21
|
+
protected onOpen(): Promise<void>;
|
|
22
|
+
protected onClose(): Promise<void>;
|
|
23
|
+
load(): void;
|
|
24
|
+
unload(): void;
|
|
25
|
+
}
|
|
26
|
+
export { AiHistoryViewType } from "./ai-history-view-type";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { View } from "@lapis-notes/api";
|
|
2
|
+
import { mount, unmount } from "svelte";
|
|
3
|
+
import AiHistoryPanel from "./ai-history-panel.svelte";
|
|
4
|
+
import { AiHistoryViewType } from "./ai-history-view-type";
|
|
5
|
+
export class AiHistoryView extends View {
|
|
6
|
+
host;
|
|
7
|
+
component = null;
|
|
8
|
+
constructor(leaf, host) {
|
|
9
|
+
super(leaf);
|
|
10
|
+
this.host = host;
|
|
11
|
+
}
|
|
12
|
+
getViewType() {
|
|
13
|
+
return AiHistoryViewType;
|
|
14
|
+
}
|
|
15
|
+
getDisplayText() {
|
|
16
|
+
return "AI conversations";
|
|
17
|
+
}
|
|
18
|
+
getIcon() {
|
|
19
|
+
return "history";
|
|
20
|
+
}
|
|
21
|
+
onOpen() {
|
|
22
|
+
return Promise.resolve();
|
|
23
|
+
}
|
|
24
|
+
onClose() {
|
|
25
|
+
return Promise.resolve();
|
|
26
|
+
}
|
|
27
|
+
load() {
|
|
28
|
+
this.unload();
|
|
29
|
+
this.containerEl.replaceChildren();
|
|
30
|
+
this.containerEl.classList.add("ai-history-view");
|
|
31
|
+
this.component = mount(AiHistoryPanel, {
|
|
32
|
+
target: this.containerEl,
|
|
33
|
+
props: {
|
|
34
|
+
app: this.app,
|
|
35
|
+
repository: this.host.conversations,
|
|
36
|
+
getScope: () => this.host.currentConversationScope(),
|
|
37
|
+
getActiveConversation: () => this.host.currentAiConversation(),
|
|
38
|
+
onOpenConversation: (location) => this.host.openAiConversation(location),
|
|
39
|
+
onNewConversation: (scopeDir) => this.host.createAiConversation(scopeDir),
|
|
40
|
+
listConversationFolders: () => this.host.listConversationFolders(),
|
|
41
|
+
searchAllConversations: (query) => this.host.searchAiConversations(query),
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
unload() {
|
|
46
|
+
if (this.component)
|
|
47
|
+
void unmount(this.component);
|
|
48
|
+
this.component = null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export { AiHistoryViewType } from "./ai-history-view-type";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ConversationListEntry } from "../conversations/transcript-store";
|
|
2
|
+
export type ConversationHistoryFolder = {
|
|
3
|
+
path: string;
|
|
4
|
+
name: string;
|
|
5
|
+
conversations: ConversationListEntry[];
|
|
6
|
+
children: ConversationHistoryFolder[];
|
|
7
|
+
conversationCount: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Build an Explorer-like tree containing only branches with conversations.
|
|
11
|
+
* Vault-root conversations are represented by an explicit root row so they
|
|
12
|
+
* remain distinguishable from conversations captured in top-level folders.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildConversationHistoryTree(entries: ConversationListEntry[]): ConversationHistoryFolder[];
|
|
15
|
+
export declare function conversationHistoryFolderPaths(folders: ConversationHistoryFolder[]): string[];
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function compareConversationEntries(left, right) {
|
|
2
|
+
return ((right.metadata?.updatedAt ?? "").localeCompare(left.metadata?.updatedAt ?? "") || (left.metadata?.title ?? "").localeCompare(right.metadata?.title ?? ""));
|
|
3
|
+
}
|
|
4
|
+
function finalizeFolder(folder) {
|
|
5
|
+
const children = folder.children
|
|
6
|
+
.map(finalizeFolder)
|
|
7
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
8
|
+
const conversations = [...folder.conversations].sort(compareConversationEntries);
|
|
9
|
+
return {
|
|
10
|
+
...folder,
|
|
11
|
+
children,
|
|
12
|
+
conversations,
|
|
13
|
+
conversationCount: conversations.length +
|
|
14
|
+
children.reduce((total, child) => total + child.conversationCount, 0),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build an Explorer-like tree containing only branches with conversations.
|
|
19
|
+
* Vault-root conversations are represented by an explicit root row so they
|
|
20
|
+
* remain distinguishable from conversations captured in top-level folders.
|
|
21
|
+
*/
|
|
22
|
+
export function buildConversationHistoryTree(entries) {
|
|
23
|
+
const root = {
|
|
24
|
+
path: "",
|
|
25
|
+
name: "Vault root",
|
|
26
|
+
conversations: [],
|
|
27
|
+
children: [],
|
|
28
|
+
};
|
|
29
|
+
const folders = new Map([
|
|
30
|
+
["", root],
|
|
31
|
+
]);
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
const scope = entry.location.scopeDir;
|
|
34
|
+
let parent = root;
|
|
35
|
+
if (scope) {
|
|
36
|
+
const segments = scope.split("/").filter(Boolean);
|
|
37
|
+
for (let index = 0; index < segments.length; index += 1) {
|
|
38
|
+
const path = segments.slice(0, index + 1).join("/");
|
|
39
|
+
let folder = folders.get(path);
|
|
40
|
+
if (!folder) {
|
|
41
|
+
folder = {
|
|
42
|
+
path,
|
|
43
|
+
name: segments[index],
|
|
44
|
+
conversations: [],
|
|
45
|
+
children: [],
|
|
46
|
+
};
|
|
47
|
+
folders.set(path, folder);
|
|
48
|
+
parent.children.push(folder);
|
|
49
|
+
}
|
|
50
|
+
parent = folder;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
parent.conversations.push(entry);
|
|
54
|
+
}
|
|
55
|
+
const topLevel = root.children
|
|
56
|
+
.map(finalizeFolder)
|
|
57
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
58
|
+
if (root.conversations.length) {
|
|
59
|
+
topLevel.unshift(finalizeFolder({
|
|
60
|
+
...root,
|
|
61
|
+
children: [],
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
return topLevel;
|
|
65
|
+
}
|
|
66
|
+
export function conversationHistoryFolderPaths(folders) {
|
|
67
|
+
return folders.flatMap((folder) => [
|
|
68
|
+
folder.path,
|
|
69
|
+
...conversationHistoryFolderPaths(folder.children),
|
|
70
|
+
]);
|
|
71
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the real native vault directory used as an agent working tree.
|
|
3
|
+
* Memory and browser vaults deliberately return undefined so an attached
|
|
4
|
+
* agent host can apply its own confined workspace root.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveAgentWorkspace(adapter: unknown): string | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the real native vault directory used as an agent working tree.
|
|
3
|
+
* Memory and browser vaults deliberately return undefined so an attached
|
|
4
|
+
* agent host can apply its own confined workspace root.
|
|
5
|
+
*/
|
|
6
|
+
export function resolveAgentWorkspace(adapter) {
|
|
7
|
+
if (!adapter || typeof adapter !== "object")
|
|
8
|
+
return undefined;
|
|
9
|
+
const candidate = adapter;
|
|
10
|
+
if (candidate.runtime !== "deno-desktop")
|
|
11
|
+
return undefined;
|
|
12
|
+
if (typeof candidate.rootPath !== "string")
|
|
13
|
+
return undefined;
|
|
14
|
+
const rootPath = candidate.rootPath.trim();
|
|
15
|
+
return rootPath || undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { hasNativeDesktopCapability } from "@lapis-notes/api/desktop-native";
|
|
2
|
+
import { AcpAgentRuntime } from "../runtimes/acp/acp-runtime";
|
|
3
|
+
import { DesktopAcpRuntimeBackend } from "../runtimes/acp/desktop-acp-backend";
|
|
4
|
+
import { CodexNativeRuntime } from "../runtimes/codex/codex-runtime";
|
|
5
|
+
import { createAgentProcessHost } from "./desktop-process-host";
|
|
6
|
+
import { hostLiveRuntimesEnabled } from "./host-runtime-availability";
|
|
7
|
+
export function createHostAgentRuntimes() {
|
|
8
|
+
if (!hostLiveRuntimesEnabled(hasNativeDesktopCapability))
|
|
9
|
+
return [];
|
|
10
|
+
return [
|
|
11
|
+
new AcpAgentRuntime(new DesktopAcpRuntimeBackend()),
|
|
12
|
+
new CodexNativeRuntime(createAgentProcessHost()),
|
|
13
|
+
];
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AgentProcessHandle, AgentProcessHost, AgentProcessSpawnOptions } from "./process-host";
|
|
2
|
+
export declare class DesktopAgentProcessHost implements AgentProcessHost {
|
|
3
|
+
get available(): boolean;
|
|
4
|
+
spawn(options: AgentProcessSpawnOptions): Promise<AgentProcessHandle>;
|
|
5
|
+
}
|
|
6
|
+
export declare function createAgentProcessHost(): AgentProcessHost;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getNativeDesktopBridge, hasNativeDesktopCapability, } from "@lapis-notes/api/desktop-native";
|
|
2
|
+
import { AsyncEventQueue } from "../core/event-queue";
|
|
3
|
+
export class DesktopAgentProcessHost {
|
|
4
|
+
get available() {
|
|
5
|
+
return hasNativeDesktopCapability("agent-runtime");
|
|
6
|
+
}
|
|
7
|
+
async spawn(options) {
|
|
8
|
+
if (!this.available) {
|
|
9
|
+
throw new Error("Live agent runtimes require the desktop agent-runtime capability.");
|
|
10
|
+
}
|
|
11
|
+
const bridge = getRequiredBridge();
|
|
12
|
+
const { processId } = await bridge.invoke("desktop_agent_process_spawn", {
|
|
13
|
+
command: options.command,
|
|
14
|
+
args: options.args ?? [],
|
|
15
|
+
cwd: options.cwd,
|
|
16
|
+
env: options.env,
|
|
17
|
+
appToolBridgeId: options.appToolBridgeId,
|
|
18
|
+
});
|
|
19
|
+
return new DesktopAgentProcessHandle(bridge, processId);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
class DesktopAgentProcessHandle {
|
|
23
|
+
id;
|
|
24
|
+
#bridge;
|
|
25
|
+
#messages = new AsyncEventQueue();
|
|
26
|
+
#unsubscribe;
|
|
27
|
+
constructor(bridge, processId) {
|
|
28
|
+
this.id = processId;
|
|
29
|
+
this.#bridge = bridge;
|
|
30
|
+
this.#unsubscribe =
|
|
31
|
+
bridge.onAgentProcessMessage?.((event) => {
|
|
32
|
+
if (event.processId !== processId)
|
|
33
|
+
return;
|
|
34
|
+
if (event.type === "exit") {
|
|
35
|
+
this.#messages.push({ type: "exit", exitCode: event.exitCode ?? 0 });
|
|
36
|
+
this.#messages.close();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.#messages.push({
|
|
40
|
+
type: event.type,
|
|
41
|
+
data: event.data ?? "",
|
|
42
|
+
});
|
|
43
|
+
}) ??
|
|
44
|
+
(() => {
|
|
45
|
+
/* no-op when the host cannot stream */
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
messages() {
|
|
49
|
+
return this.#messages;
|
|
50
|
+
}
|
|
51
|
+
async write(data) {
|
|
52
|
+
await this.#bridge.invoke("desktop_agent_process_write", {
|
|
53
|
+
processId: this.id,
|
|
54
|
+
data,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async kill() {
|
|
58
|
+
this.#unsubscribe();
|
|
59
|
+
await this.#bridge.invoke("desktop_agent_process_kill", {
|
|
60
|
+
processId: this.id,
|
|
61
|
+
});
|
|
62
|
+
this.#messages.close();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function getRequiredBridge() {
|
|
66
|
+
const bridge = getNativeDesktopBridge();
|
|
67
|
+
if (!bridge) {
|
|
68
|
+
throw new Error("The desktop agent-runtime bridge is not registered.");
|
|
69
|
+
}
|
|
70
|
+
return bridge;
|
|
71
|
+
}
|
|
72
|
+
export function createAgentProcessHost() {
|
|
73
|
+
return new DesktopAgentProcessHost();
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hostLiveRuntimesEnabled(hasCapability: (name: "agent-runtime") => boolean): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type AgentProcessSpawnOptions = {
|
|
2
|
+
command: string;
|
|
3
|
+
args?: string[];
|
|
4
|
+
cwd?: string;
|
|
5
|
+
env?: Record<string, string>;
|
|
6
|
+
appToolBridgeId?: string;
|
|
7
|
+
};
|
|
8
|
+
export type AgentProcessMessage = {
|
|
9
|
+
type: "stdout";
|
|
10
|
+
data: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: "stderr";
|
|
13
|
+
data: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: "exit";
|
|
16
|
+
exitCode: number;
|
|
17
|
+
};
|
|
18
|
+
export interface AgentProcessHandle {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
messages(): AsyncIterable<AgentProcessMessage>;
|
|
21
|
+
write(data: string): Promise<void>;
|
|
22
|
+
kill(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export interface AgentProcessHost {
|
|
25
|
+
readonly available: boolean;
|
|
26
|
+
spawn(options: AgentProcessSpawnOptions): Promise<AgentProcessHandle>;
|
|
27
|
+
}
|
|
28
|
+
export declare class UnavailableAgentProcessHost implements AgentProcessHost {
|
|
29
|
+
readonly available = false;
|
|
30
|
+
spawn(_options: AgentProcessSpawnOptions): Promise<AgentProcessHandle>;
|
|
31
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import "./styles.css";
|
|
2
|
+
export { default as manifest } from "../../manifest.json";
|
|
3
|
+
export { AiPlugin, default } from "./ai-plugin";
|
|
4
|
+
export { AiCatalogPanel, AiChatPanel, AiHistoryPanel, } from "./public-components";
|
|
5
|
+
export { AiView, AiViewType } from "./chat/ai-view";
|
|
6
|
+
export { AiCatalogView, AiCatalogViewType } from "./catalog/ai-catalog-view";
|
|
7
|
+
export { AiHistoryView, AiHistoryViewType } from "./history/ai-history-view";
|
|
8
|
+
export { AiJsonlView, AiJsonlViewType } from "./jsonl/ai-jsonl-view";
|
|
9
|
+
export { applyAgentEventToChatItems, markApprovalResponse, markQuestionResponse, } from "./chat/chat-trace";
|
|
10
|
+
export type { AiChatItem } from "./chat/chat-items";
|
|
11
|
+
export { ACP_APPROVAL_CAPABILITIES, DEFAULT_APPROVAL_OPTIONS, NATIVE_CODEX_APPROVAL_CAPABILITIES, UNAVAILABLE_APPROVAL_CAPABILITIES, } from "./core/types";
|
|
12
|
+
export type { AgentCapabilities, AgentContextBlock, AgentEvent, AgentRequest, AgentRuntime, AgentSession, AgentTurnOptions, AgentUsage, AiThinkingLevel, ApprovalCapabilities, ApprovalOption, ApprovalRequest, ModelRef, McpServerContribution, UserInputAnswers, UserInputOption, UserInputQuestion, UserInputRequest, } from "./core/types";
|
|
13
|
+
export { NativeMemoryService } from "./memory/native-memory-service";
|
|
14
|
+
export type { AutomaticMemoryRecall, ConsolidationPreview, ConsolidationProposal, ConsolidationResult, DurableMemoryKind, DurableMemoryRecord, GroundedConsolidationInput, MemoryConsolidationProvider, MemoryContext, MemoryDetail, MemoryEvidenceMessage, MemoryEvidenceRef, MemoryForgetPreview, MemoryForgetResult, MemoryOriginClass, MemoryRebuildResult, MemoryScope, MemorySearchQuery, MemorySearchResult, MemoryService, } from "./memory/types";
|
|
15
|
+
export { StaticModelProvider } from "./providers/model-provider";
|
|
16
|
+
export { CodexModelProvider } from "./providers/codex-model-provider";
|
|
17
|
+
export { normalizeCodexModelList } from "./providers/codex-model-catalog";
|
|
18
|
+
export type { ModelProvider, ProviderAuthStatus, } from "./providers/model-provider";
|
|
19
|
+
export { AgentRuntimeNotFoundError, createAgentRuntimeRegistry, } from "./registry/runtime-registry";
|
|
20
|
+
export type { AgentRuntimeRegistry } from "./registry/runtime-registry";
|
|
21
|
+
export { FAKE_RICH_ASSISTANT_TEXT, FAKE_RICH_THINKING, FAKE_RICH_TOOL, FakeAgentRuntime, } from "./runtimes/fake/fake-runtime";
|
|
22
|
+
export type { FakeAgentTrace } from "./runtimes/fake/fake-runtime";
|
|
23
|
+
export { ACP_AGENT_IDS, DEFAULT_ACP_AGENT, normalizeAcpAgent, } from "./settings/acp-agents";
|
|
24
|
+
export type { AcpAgentId } from "./settings/acp-agents";
|
|
25
|
+
export { DEFAULT_AI_SETTINGS, mergeAiSettings } from "./settings/ai-settings";
|
|
26
|
+
export type { AiPluginSettings } from "./settings/ai-settings";
|
|
27
|
+
export { formatChatDateLabel, formatChatTimestamp, groupChatItemsByDate, } from "./chat/chat-time";
|
|
28
|
+
export type { ChatTimelineEntry } from "./chat/chat-time";
|
|
29
|
+
export { createMemorySessionStore, createPersistedSessionStore, createStoredAgentSession, interruptPendingApprovals, interruptPendingInteractions, pendingApprovalIdFromItems, pendingQuestionIdFromItems, } from "./sessions/session-store";
|
|
30
|
+
export type { AgentSessionStore, StoredAgentSession, } from "./sessions/session-store";
|
|
31
|
+
export { parseAiPluginData, serializeAiPluginData, } from "./sessions/plugin-data";
|
|
32
|
+
export type { AiPluginData } from "./sessions/plugin-data";
|
|
33
|
+
export { extractMentionPaths, formatFileMention, mentionTokensFromText, mergeAttachmentPaths, searchVaultFiles, } from "./chat/chat-mentions";
|
|
34
|
+
export type { VaultFileRef } from "./chat/chat-mentions";
|
|
35
|
+
export { ConversationScopeResolver } from "./conversations/scope-resolver";
|
|
36
|
+
export { conversationsInScopeTree, formatDirectoryContextLabel, relativeScopeLabel, } from "./conversations/scope-tree";
|
|
37
|
+
export { FILE_EXPLORER_REVEAL_PATH_COMMAND, revealConversationScope, } from "./conversations/reveal-scope";
|
|
38
|
+
export { buildConversationContextHandoff, MAX_CONTEXT_HANDOFF_CODE_POINTS, MAX_CONTEXT_HANDOFF_TOKENS, } from "./conversations/context-handoff";
|
|
39
|
+
export type { ConversationContextHandoff } from "./conversations/context-handoff";
|
|
40
|
+
export { HandoffSummaryCoordinator, RuntimeHandoffSummaryProvider, } from "./conversations/handoff-summary";
|
|
41
|
+
export type { GroundedHandoffSummaryInput, HandoffSummaryProcessorIdentity, HandoffSummaryProvider, } from "./conversations/handoff-summary";
|
|
42
|
+
export { ConversationRepository, deriveConversationTitle, } from "./conversations/conversation-repository";
|
|
43
|
+
export { AI_CONVERSATION_SEARCH_PROVIDER_ID, AiConversationIndex, conversationIndexPath, conversationSearchDocument, } from "./conversations/conversation-index";
|
|
44
|
+
export { MemoryTranscriptStore } from "./conversations/memory-transcript-store";
|
|
45
|
+
export { VaultTranscriptStore } from "./conversations/vault-transcript-store";
|
|
46
|
+
export { projectChatItemsToTranscript, projectTranscriptToChatItems, } from "./conversations/transcript-projection";
|
|
47
|
+
export { MAX_DURABLE_FIELD_BYTES, sanitizeDurableField, } from "./conversations/redaction";
|
|
48
|
+
export type { DurableSanitizationOptions, SanitizedDurableField, } from "./conversations/redaction";
|
|
49
|
+
export type { ConversationListEntry, TranscriptStore, } from "./conversations/transcript-store";
|
|
50
|
+
export { CONVERSATION_ID_PATTERN, CONVERSATION_SCHEMA_VERSION, ConversationUnavailableError, } from "./conversations/types";
|
|
51
|
+
export type { AgentBindingCreatedRecord, AgentBindingConfigUpdatedRecord, AgentBindingContextUpdatedRecord, AgentBindingRecord, AgentUsageRecord, ConversationLocation, ConversationMetadata, ConversationReadWarning, ConversationSnapshot, RuntimeEventProvenance, HandoffSummaryCreatedRecord, TranscriptEntry, } from "./conversations/types";
|
|
52
|
+
export { parseSkillMarkdown, skillContentVersion } from "./skills/parser";
|
|
53
|
+
export { SkillRegistry, SkillSnapshotStore } from "./skills/registry";
|
|
54
|
+
export { buildAvailableSkillsManifest } from "./skills/manifest";
|
|
55
|
+
export { createSkillAppTools } from "./skills/skill-tools";
|
|
56
|
+
export { SlashCommandCatalog } from "./commands/catalog";
|
|
57
|
+
export { SlashCommandRouter } from "./commands/router";
|
|
58
|
+
export { parseSlashCommand } from "./commands/parser";
|
|
59
|
+
export { formatSlashHelp, composerSlashItems, filterComposerSlashItems, } from "./commands/groups";
|
|
60
|
+
export type { ComposerSlashItem } from "./commands/groups";
|
|
61
|
+
export { formatContextNotice, formatScopeNotice } from "./commands/inspect";
|
|
62
|
+
export { BUNDLED_RESEARCH_SKILL, BUNDLED_APP_SKILLS, } from "./skills/bundled/research";
|
|
63
|
+
export { BUNDLED_LAPIS_NOTES_SKILL } from "./skills/bundled/lapis-notes";
|
|
64
|
+
export { buildAgentBootstrap, buildSessionBootstrap } from "./bootstrap/build";
|
|
65
|
+
export { createMcpServerContributionRegistry } from "./tools/mcp-server-registry";
|
|
66
|
+
export { APP_TOOL_MCP_SERVER_NAME } from "./tools/mcp-server-registry";
|
|
67
|
+
export { AppToolApprovalBroker, AppToolExecutionError, AppToolHost, } from "./tools/app-tool-host";
|
|
68
|
+
export type { AppToolCall, AppToolExecutionErrorCode, AppToolPolicySettings, CreateAppToolSessionInput, } from "./tools/app-tool-host";
|
|
69
|
+
export type { McpServerContributionRegistry } from "./tools/mcp-server-registry";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import "./styles.css";
|
|
2
|
+
export { default as manifest } from "../../manifest.json";
|
|
3
|
+
export { AiPlugin, default } from "./ai-plugin";
|
|
4
|
+
export { AiCatalogPanel, AiChatPanel, AiHistoryPanel, } from "./public-components";
|
|
5
|
+
export { AiView, AiViewType } from "./chat/ai-view";
|
|
6
|
+
export { AiCatalogView, AiCatalogViewType } from "./catalog/ai-catalog-view";
|
|
7
|
+
export { AiHistoryView, AiHistoryViewType } from "./history/ai-history-view";
|
|
8
|
+
export { AiJsonlView, AiJsonlViewType } from "./jsonl/ai-jsonl-view";
|
|
9
|
+
export { applyAgentEventToChatItems, markApprovalResponse, markQuestionResponse, } from "./chat/chat-trace";
|
|
10
|
+
export { ACP_APPROVAL_CAPABILITIES, DEFAULT_APPROVAL_OPTIONS, NATIVE_CODEX_APPROVAL_CAPABILITIES, UNAVAILABLE_APPROVAL_CAPABILITIES, } from "./core/types";
|
|
11
|
+
export { NativeMemoryService } from "./memory/native-memory-service";
|
|
12
|
+
export { StaticModelProvider } from "./providers/model-provider";
|
|
13
|
+
export { CodexModelProvider } from "./providers/codex-model-provider";
|
|
14
|
+
export { normalizeCodexModelList } from "./providers/codex-model-catalog";
|
|
15
|
+
export { AgentRuntimeNotFoundError, createAgentRuntimeRegistry, } from "./registry/runtime-registry";
|
|
16
|
+
export { FAKE_RICH_ASSISTANT_TEXT, FAKE_RICH_THINKING, FAKE_RICH_TOOL, FakeAgentRuntime, } from "./runtimes/fake/fake-runtime";
|
|
17
|
+
export { ACP_AGENT_IDS, DEFAULT_ACP_AGENT, normalizeAcpAgent, } from "./settings/acp-agents";
|
|
18
|
+
export { DEFAULT_AI_SETTINGS, mergeAiSettings } from "./settings/ai-settings";
|
|
19
|
+
export { formatChatDateLabel, formatChatTimestamp, groupChatItemsByDate, } from "./chat/chat-time";
|
|
20
|
+
export { createMemorySessionStore, createPersistedSessionStore, createStoredAgentSession, interruptPendingApprovals, interruptPendingInteractions, pendingApprovalIdFromItems, pendingQuestionIdFromItems, } from "./sessions/session-store";
|
|
21
|
+
export { parseAiPluginData, serializeAiPluginData, } from "./sessions/plugin-data";
|
|
22
|
+
export { extractMentionPaths, formatFileMention, mentionTokensFromText, mergeAttachmentPaths, searchVaultFiles, } from "./chat/chat-mentions";
|
|
23
|
+
export { ConversationScopeResolver } from "./conversations/scope-resolver";
|
|
24
|
+
export { conversationsInScopeTree, formatDirectoryContextLabel, relativeScopeLabel, } from "./conversations/scope-tree";
|
|
25
|
+
export { FILE_EXPLORER_REVEAL_PATH_COMMAND, revealConversationScope, } from "./conversations/reveal-scope";
|
|
26
|
+
export { buildConversationContextHandoff, MAX_CONTEXT_HANDOFF_CODE_POINTS, MAX_CONTEXT_HANDOFF_TOKENS, } from "./conversations/context-handoff";
|
|
27
|
+
export { HandoffSummaryCoordinator, RuntimeHandoffSummaryProvider, } from "./conversations/handoff-summary";
|
|
28
|
+
export { ConversationRepository, deriveConversationTitle, } from "./conversations/conversation-repository";
|
|
29
|
+
export { AI_CONVERSATION_SEARCH_PROVIDER_ID, AiConversationIndex, conversationIndexPath, conversationSearchDocument, } from "./conversations/conversation-index";
|
|
30
|
+
export { MemoryTranscriptStore } from "./conversations/memory-transcript-store";
|
|
31
|
+
export { VaultTranscriptStore } from "./conversations/vault-transcript-store";
|
|
32
|
+
export { projectChatItemsToTranscript, projectTranscriptToChatItems, } from "./conversations/transcript-projection";
|
|
33
|
+
export { MAX_DURABLE_FIELD_BYTES, sanitizeDurableField, } from "./conversations/redaction";
|
|
34
|
+
export { CONVERSATION_ID_PATTERN, CONVERSATION_SCHEMA_VERSION, ConversationUnavailableError, } from "./conversations/types";
|
|
35
|
+
export { parseSkillMarkdown, skillContentVersion } from "./skills/parser";
|
|
36
|
+
export { SkillRegistry, SkillSnapshotStore } from "./skills/registry";
|
|
37
|
+
export { buildAvailableSkillsManifest } from "./skills/manifest";
|
|
38
|
+
export { createSkillAppTools } from "./skills/skill-tools";
|
|
39
|
+
export { SlashCommandCatalog } from "./commands/catalog";
|
|
40
|
+
export { SlashCommandRouter } from "./commands/router";
|
|
41
|
+
export { parseSlashCommand } from "./commands/parser";
|
|
42
|
+
export { formatSlashHelp, composerSlashItems, filterComposerSlashItems, } from "./commands/groups";
|
|
43
|
+
export { formatContextNotice, formatScopeNotice } from "./commands/inspect";
|
|
44
|
+
export { BUNDLED_RESEARCH_SKILL, BUNDLED_APP_SKILLS, } from "./skills/bundled/research";
|
|
45
|
+
export { BUNDLED_LAPIS_NOTES_SKILL } from "./skills/bundled/lapis-notes";
|
|
46
|
+
export { buildAgentBootstrap, buildSessionBootstrap } from "./bootstrap/build";
|
|
47
|
+
export { createMcpServerContributionRegistry } from "./tools/mcp-server-registry";
|
|
48
|
+
export { APP_TOOL_MCP_SERVER_NAME } from "./tools/mcp-server-registry";
|
|
49
|
+
export { AppToolApprovalBroker, AppToolExecutionError, AppToolHost, } from "./tools/app-tool-host";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AiChatItem } from "../chat/chat-items";
|
|
2
|
+
import type { AgentBindingRecord, ConversationReadWarning, TranscriptEntry } from "../conversations/types";
|
|
3
|
+
export type JsonlRecord = {
|
|
4
|
+
line: number;
|
|
5
|
+
value: unknown;
|
|
6
|
+
};
|
|
7
|
+
export type AiJsonlPreview = {
|
|
8
|
+
kind: "transcript";
|
|
9
|
+
entries: TranscriptEntry[];
|
|
10
|
+
items: AiChatItem[];
|
|
11
|
+
warnings: ConversationReadWarning[];
|
|
12
|
+
} | {
|
|
13
|
+
kind: "agents";
|
|
14
|
+
records: AgentBindingRecord[];
|
|
15
|
+
warnings: ConversationReadWarning[];
|
|
16
|
+
} | {
|
|
17
|
+
kind: "records";
|
|
18
|
+
records: JsonlRecord[];
|
|
19
|
+
warnings: Array<{
|
|
20
|
+
line: number;
|
|
21
|
+
message: string;
|
|
22
|
+
}>;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "error";
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function createAiJsonlPreview(filePath: string, content: string): AiJsonlPreview;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { parseJsonLines } from "../conversations/jsonl";
|
|
2
|
+
import { projectTranscriptToChatItems } from "../conversations/transcript-projection";
|
|
3
|
+
import { validateAgentBindingRecord, validateTranscriptEntry, } from "../conversations/validation";
|
|
4
|
+
export function createAiJsonlPreview(filePath, content) {
|
|
5
|
+
const fileName = filePath.split("/").at(-1)?.toLowerCase();
|
|
6
|
+
try {
|
|
7
|
+
if (fileName === "transcript.jsonl") {
|
|
8
|
+
const parsed = parseJsonLines({
|
|
9
|
+
content,
|
|
10
|
+
file: "transcript.jsonl",
|
|
11
|
+
validate: validateTranscriptEntry,
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
kind: "transcript",
|
|
15
|
+
entries: parsed.records,
|
|
16
|
+
items: projectTranscriptToChatItems(parsed.records),
|
|
17
|
+
warnings: parsed.warnings,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (fileName === "agents.jsonl") {
|
|
21
|
+
const parsed = parseJsonLines({
|
|
22
|
+
content,
|
|
23
|
+
file: "agents.jsonl",
|
|
24
|
+
validate: validateAgentBindingRecord,
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
kind: "agents",
|
|
28
|
+
records: parsed.records,
|
|
29
|
+
warnings: parsed.warnings,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return parseGenericJsonLines(content);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
kind: "error",
|
|
37
|
+
message: error instanceof Error ? error.message : "Unable to parse JSONL file",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function parseGenericJsonLines(content) {
|
|
42
|
+
const records = [];
|
|
43
|
+
const warnings = [];
|
|
44
|
+
const hasTerminalNewline = /\r?\n$/u.test(content);
|
|
45
|
+
const lines = content.split(/\r?\n/u);
|
|
46
|
+
if (lines.at(-1) === "")
|
|
47
|
+
lines.pop();
|
|
48
|
+
lines.forEach((line, index) => {
|
|
49
|
+
if (!line.trim())
|
|
50
|
+
return;
|
|
51
|
+
try {
|
|
52
|
+
records.push({ line: index + 1, value: JSON.parse(line) });
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (index === lines.length - 1 && !hasTerminalNewline) {
|
|
56
|
+
warnings.push({
|
|
57
|
+
line: index + 1,
|
|
58
|
+
message: "Ignored a malformed final JSONL line after an interrupted append",
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
throw new Error(`JSONL contains invalid JSON on line ${index + 1}`, {
|
|
63
|
+
cause: error,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return { kind: "records", records, warnings };
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AiJsonlViewType = "ai-jsonl";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const AiJsonlViewType = "ai-jsonl";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TextFileView } from "@lapis-notes/api";
|
|
2
|
+
export { AiJsonlViewType } from "./ai-jsonl-view-type";
|
|
3
|
+
export declare class AiJsonlView extends TextFileView {
|
|
4
|
+
#private;
|
|
5
|
+
getViewType(): string;
|
|
6
|
+
getViewData(): string;
|
|
7
|
+
setViewData(data: string, clear?: boolean): void;
|
|
8
|
+
clear(): void;
|
|
9
|
+
load(): void;
|
|
10
|
+
unload(): void;
|
|
11
|
+
canAcceptExtension(extension: string): boolean;
|
|
12
|
+
getDisplayText(): string;
|
|
13
|
+
getIcon(): string;
|
|
14
|
+
protected onOpen(): Promise<void>;
|
|
15
|
+
protected onClose(): Promise<void>;
|
|
16
|
+
}
|