@alisio/core 0.1.0-alpha.3
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/LICENSE +21 -0
- package/README.md +25 -0
- package/dist/application.d.ts +192 -0
- package/dist/application.js +764 -0
- package/dist/config.d.ts +420 -0
- package/dist/config.js +416 -0
- package/dist/core/compaction.d.ts +48 -0
- package/dist/core/compaction.js +206 -0
- package/dist/core/contracts.d.ts +141 -0
- package/dist/core/contracts.js +1 -0
- package/dist/core/registry.d.ts +8 -0
- package/dist/core/registry.js +54 -0
- package/dist/core/runner.d.ts +121 -0
- package/dist/core/runner.js +543 -0
- package/dist/extensions/registry.d.ts +28 -0
- package/dist/extensions/registry.js +58 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +27 -0
- package/dist/integrations/herdr.d.ts +34 -0
- package/dist/integrations/herdr.js +174 -0
- package/dist/mcp/connector.d.ts +63 -0
- package/dist/mcp/connector.js +384 -0
- package/dist/plugins/host.d.ts +164 -0
- package/dist/plugins/host.js +572 -0
- package/dist/providers/openai-compatible.d.ts +14 -0
- package/dist/providers/openai-compatible.js +228 -0
- package/dist/providers/registry.d.ts +35 -0
- package/dist/providers/registry.js +74 -0
- package/dist/providers/routing.d.ts +11 -0
- package/dist/providers/routing.js +41 -0
- package/dist/providers/settings.d.ts +30 -0
- package/dist/providers/settings.js +80 -0
- package/dist/resources/context.d.ts +39 -0
- package/dist/resources/context.js +164 -0
- package/dist/resources/prompts.d.ts +77 -0
- package/dist/resources/prompts.js +182 -0
- package/dist/resources/skills.d.ts +82 -0
- package/dist/resources/skills.js +214 -0
- package/dist/runtime/fs.d.ts +9 -0
- package/dist/runtime/fs.js +73 -0
- package/dist/runtime/modules.d.ts +14 -0
- package/dist/runtime/modules.js +76 -0
- package/dist/runtime/paths.d.ts +4 -0
- package/dist/runtime/paths.js +42 -0
- package/dist/runtime/process.d.ts +16 -0
- package/dist/runtime/process.js +104 -0
- package/dist/runtime/sqlite.d.ts +3 -0
- package/dist/runtime/sqlite.js +85 -0
- package/dist/runtime/store.d.ts +37 -0
- package/dist/runtime/store.js +250 -0
- package/dist/sessions/children.d.ts +55 -0
- package/dist/sessions/children.js +231 -0
- package/dist/startup/index.d.ts +41 -0
- package/dist/startup/index.js +105 -0
- package/dist/startup/mascot.d.ts +6 -0
- package/dist/startup/mascot.js +30 -0
- package/dist/startup/screen.d.ts +18 -0
- package/dist/startup/screen.js +116 -0
- package/dist/startup/text.d.ts +19 -0
- package/dist/startup/text.js +68 -0
- package/dist/tools/execute.d.ts +16 -0
- package/dist/tools/execute.js +96 -0
- package/dist/tools/search.d.ts +69 -0
- package/dist/tools/search.js +232 -0
- package/dist/tools/standard.d.ts +22 -0
- package/dist/tools/standard.js +408 -0
- package/dist/tools/webfetch.d.ts +26 -0
- package/dist/tools/webfetch.js +119 -0
- package/dist/trust.d.ts +34 -0
- package/dist/trust.js +113 -0
- package/package.json +62 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { AskQuestionsRequest, AskQuestionsResult, CommandContext, CommandOptions, CompletionRequest, Message, PanelProvider, Plugin, PluginAPI, PluginMetadata, RunEvent, SelectRequest } from "@alisio/sdk";
|
|
2
|
+
import type { HookFailure, RunnerExtensions } from "../core/contracts.ts";
|
|
3
|
+
import type { ToolRegistry } from "../core/registry.ts";
|
|
4
|
+
import { ExtensionRegistry } from "../extensions/registry.ts";
|
|
5
|
+
import type { ProviderRegistry } from "../providers/registry.ts";
|
|
6
|
+
export declare const pluginPrefix: (id: string) => string;
|
|
7
|
+
export interface PluginHostOptions {
|
|
8
|
+
/** Timeout for compaction and session-start hooks. */
|
|
9
|
+
hookTimeoutMs?: number;
|
|
10
|
+
/** Timeout for session-end hooks (for example an automatic summary). */
|
|
11
|
+
sessionEndTimeoutMs?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class PluginHost implements RunnerExtensions {
|
|
14
|
+
private registry;
|
|
15
|
+
private state;
|
|
16
|
+
private options;
|
|
17
|
+
private providers?;
|
|
18
|
+
commands: Map<string, (args: string, context?: CommandContext) => Promise<string>>;
|
|
19
|
+
commandInfo: Map<string, CommandOptions & {
|
|
20
|
+
plugin: string;
|
|
21
|
+
builtin: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
/** Ids of active built-in plugins. */
|
|
24
|
+
builtins: Set<string>;
|
|
25
|
+
/** Status entries contributed through `ui.status`, keyed `plugin:key`. */
|
|
26
|
+
status: Map<string, {
|
|
27
|
+
plugin: string;
|
|
28
|
+
text: string;
|
|
29
|
+
detail?: string;
|
|
30
|
+
}>;
|
|
31
|
+
onStatusChange?: () => void;
|
|
32
|
+
/** Providers for typed extension points (mascot, startup-screen, ...). */
|
|
33
|
+
readonly extensions: ExtensionRegistry;
|
|
34
|
+
/** Loaded plugins that did not come from the built-in registry. */
|
|
35
|
+
externalCount: number;
|
|
36
|
+
private compactionHooks;
|
|
37
|
+
private startHandlers;
|
|
38
|
+
private endHandlers;
|
|
39
|
+
private fieldOwners;
|
|
40
|
+
private completer?;
|
|
41
|
+
private modelsImpl?;
|
|
42
|
+
observers: Set<(event: Readonly<RunEvent>) => void>;
|
|
43
|
+
contexts: Array<() => Promise<string>>;
|
|
44
|
+
/** Skill directories registered by plugins, retaining trusted registration ownership. */
|
|
45
|
+
skillSources: Array<{
|
|
46
|
+
plugin: string;
|
|
47
|
+
name: string;
|
|
48
|
+
dir: string;
|
|
49
|
+
}>;
|
|
50
|
+
/** Prompt template directories registered by plugins, with their plugin id. */
|
|
51
|
+
promptSources: Array<{
|
|
52
|
+
plugin: string;
|
|
53
|
+
dir: string;
|
|
54
|
+
}>;
|
|
55
|
+
/** Agent definition directories registered by plugins, with their plugin id. */
|
|
56
|
+
agentSources: Array<{
|
|
57
|
+
plugin: string;
|
|
58
|
+
dir: string;
|
|
59
|
+
}>;
|
|
60
|
+
/** Tree panels contributed by plugins, keyed `plugin:id`. */
|
|
61
|
+
panels: Map<string, {
|
|
62
|
+
plugin: string;
|
|
63
|
+
provider: PanelProvider;
|
|
64
|
+
}>;
|
|
65
|
+
private sessionsImpl?;
|
|
66
|
+
private uiImpl?;
|
|
67
|
+
/** Binds the child session service once the runner exists. */
|
|
68
|
+
setSessions(sessions: PluginAPI["sessions"]): void;
|
|
69
|
+
/** Binds interactive UI services (the TUI); without them select/askQuestions resolve undefined. */
|
|
70
|
+
setInteractiveUI(ui: {
|
|
71
|
+
select(request: SelectRequest): Promise<string | undefined>;
|
|
72
|
+
askQuestions(request: AskQuestionsRequest): Promise<AskQuestionsResult>;
|
|
73
|
+
open(sessionId: string): boolean;
|
|
74
|
+
}): void;
|
|
75
|
+
get sessions(): PluginAPI["sessions"];
|
|
76
|
+
/**
|
|
77
|
+
* Live accessor for core standard tools (e.g. `ask_user_question`), which are not "a plugin"
|
|
78
|
+
* with an id and so cannot use the per-plugin `ui` wrapper built in `activate()`. Bound lazily
|
|
79
|
+
* (reads `this.uiImpl` at call time) since `registerStandard` runs before the TUI calls
|
|
80
|
+
* `setInteractiveUI`. `interactive()` reflects whether ANY interactive UI is bound at all,
|
|
81
|
+
* never which session is asking, so child sessions under an interactive root TUI pass too.
|
|
82
|
+
*/
|
|
83
|
+
get ui(): {
|
|
84
|
+
interactive(): boolean;
|
|
85
|
+
askQuestions(request: AskQuestionsRequest): Promise<AskQuestionsResult>;
|
|
86
|
+
};
|
|
87
|
+
get promptRoots(): string[];
|
|
88
|
+
get skillRoots(): string[];
|
|
89
|
+
private loaded;
|
|
90
|
+
constructor(registry: ToolRegistry, state: {
|
|
91
|
+
getState(plugin: string, key: string): unknown;
|
|
92
|
+
setState(plugin: string, key: string, value: unknown): void;
|
|
93
|
+
}, options?: PluginHostOptions, providers?: ProviderRegistry | undefined);
|
|
94
|
+
/** Binds the provider-agnostic completion service once a provider exists. */
|
|
95
|
+
setCompleter(fn: (request: CompletionRequest & {
|
|
96
|
+
signal: AbortSignal;
|
|
97
|
+
}) => Promise<string>): void;
|
|
98
|
+
/** Binds credential-free model discovery/resolution after provider startup is complete. */
|
|
99
|
+
setModels(models: PluginAPI["models"]): void;
|
|
100
|
+
/**
|
|
101
|
+
* Loads an explicitly trusted plugin: a file/directory path, or an npm package name resolved
|
|
102
|
+
* from `from` (project) upwards and then global roots. Never called for untrusted input.
|
|
103
|
+
*/
|
|
104
|
+
load(spec: string, options?: {
|
|
105
|
+
from?: string;
|
|
106
|
+
globalRoots?: string[];
|
|
107
|
+
}): Promise<void>;
|
|
108
|
+
/** Imports and validates a trusted plugin without running setup, for cataloging disabled entries. */
|
|
109
|
+
inspect(spec: string, options?: {
|
|
110
|
+
from?: string;
|
|
111
|
+
globalRoots?: string[];
|
|
112
|
+
}): Promise<{
|
|
113
|
+
plugin: Plugin;
|
|
114
|
+
base: string;
|
|
115
|
+
}>;
|
|
116
|
+
private validate;
|
|
117
|
+
/**
|
|
118
|
+
* `builtin` is reserved for first-party plugins from the built-in registry: their tools and
|
|
119
|
+
* commands keep unprefixed names and may declare the `internal` effect.
|
|
120
|
+
*/
|
|
121
|
+
activate(plugin: Plugin, base: string, options?: {
|
|
122
|
+
builtin?: boolean;
|
|
123
|
+
}): Promise<void>;
|
|
124
|
+
/** Runs one hook with a host-enforced timeout; the hook receives an abort signal. */
|
|
125
|
+
private guarded;
|
|
126
|
+
beforeCompact(input: Parameters<RunnerExtensions["beforeCompact"]>[0]): Promise<{
|
|
127
|
+
instructions: string[];
|
|
128
|
+
fields: Record<string, {
|
|
129
|
+
source: string;
|
|
130
|
+
description: string;
|
|
131
|
+
}>;
|
|
132
|
+
failures: HookFailure[];
|
|
133
|
+
}>;
|
|
134
|
+
afterCompact(input: Parameters<RunnerExtensions["afterCompact"]>[0]): Promise<{
|
|
135
|
+
inject: string[];
|
|
136
|
+
reports: Record<string, Record<string, unknown>>;
|
|
137
|
+
failures: HookFailure[];
|
|
138
|
+
}>;
|
|
139
|
+
sessionStart(input: Parameters<RunnerExtensions["sessionStart"]>[0]): Promise<{
|
|
140
|
+
inject: {
|
|
141
|
+
source: string;
|
|
142
|
+
text: string;
|
|
143
|
+
}[];
|
|
144
|
+
failures: HookFailure[];
|
|
145
|
+
}>;
|
|
146
|
+
/** Session end hooks run concurrently and are bounded by one host timeout. */
|
|
147
|
+
sessionEnd(input: {
|
|
148
|
+
sessionId: string;
|
|
149
|
+
model: string;
|
|
150
|
+
workspace: string;
|
|
151
|
+
reason: "clear" | "exit";
|
|
152
|
+
messages: readonly Message[];
|
|
153
|
+
}): Promise<{
|
|
154
|
+
failures: HookFailure[];
|
|
155
|
+
}>;
|
|
156
|
+
/** Loaded plugins (id, version, built-in flag), ordered by id. */
|
|
157
|
+
metadata(): PluginMetadata[];
|
|
158
|
+
get hasSessionEndHooks(): boolean;
|
|
159
|
+
/** Conservative ownership check used to protect a live session from plugin removal. */
|
|
160
|
+
ownsSessionResources(plugin: string): boolean;
|
|
161
|
+
emit(event: RunEvent): void;
|
|
162
|
+
close(): Promise<void>;
|
|
163
|
+
}
|
|
164
|
+
export declare function discoverPlugins(root: string): Promise<string[]>;
|