@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gustavo Gutiérrez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @alisio/core
|
|
2
|
+
|
|
3
|
+
Embeddable core of [Alisio](https://github.com/GustavoGutierrez/alisio): the agent tool loop, structured
|
|
4
|
+
context compaction, the OpenAI-compatible provider (Chat Completions and Responses), local tools with
|
|
5
|
+
explicit permissions, the MCP client, the plugin host (with hook timeouts and failure isolation) and a
|
|
6
|
+
SQLite session store. Runs on Node.js >= 22.16 (`node:sqlite` with FTS5) and on Bun.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { createApplication } from "@alisio/core";
|
|
10
|
+
|
|
11
|
+
const app = await createApplication({ config: "./alisio.json", readOnly: true });
|
|
12
|
+
try {
|
|
13
|
+
const session = app.store.create(app.workspace, app.provider.id, app.provider.model);
|
|
14
|
+
const { text } = await app.runner.run(session.id, "Summarize this repository");
|
|
15
|
+
console.log(text);
|
|
16
|
+
} finally {
|
|
17
|
+
await app.close();
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Built-in plugins are opt-in for embedders: pass `builtins` (the `alisio` CLI wires
|
|
22
|
+
`@alisio/plugin-memory`). See the [architecture](https://gustavogutierrez.github.io/alisio/architecture) and
|
|
23
|
+
[configuration](https://gustavogutierrez.github.io/alisio/configuration) docs.
|
|
24
|
+
|
|
25
|
+
Maintainer: Gustavo Gutiérrez · License: MIT
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import type { AvailableProviderModel, ModelInfo, ModelProvider, Plugin, PluginCategory, ResolvedProviderModel, RunEvent } from "@alisio/sdk";
|
|
2
|
+
import type { ApprovalHandler } from "./core/contracts.ts";
|
|
3
|
+
import { ToolRegistry } from "./core/registry.ts";
|
|
4
|
+
import { AgentRunner } from "./core/runner.ts";
|
|
5
|
+
import { HerdrBridge } from "./integrations/herdr.ts";
|
|
6
|
+
import { McpConnector } from "./mcp/connector.ts";
|
|
7
|
+
import { PluginHost } from "./plugins/host.ts";
|
|
8
|
+
import { ActiveProvider, ProviderRegistry } from "./providers/registry.ts";
|
|
9
|
+
import { ProviderSettingsStore } from "./providers/settings.ts";
|
|
10
|
+
import { ProjectContext } from "./resources/context.ts";
|
|
11
|
+
import { Skills } from "./resources/skills.ts";
|
|
12
|
+
import { SQLiteStore } from "./runtime/store.ts";
|
|
13
|
+
export interface AppOptions {
|
|
14
|
+
cwd?: string;
|
|
15
|
+
config?: string;
|
|
16
|
+
trustProject?: boolean;
|
|
17
|
+
plugin?: string[];
|
|
18
|
+
allowWrite?: boolean;
|
|
19
|
+
allowProcess?: boolean;
|
|
20
|
+
/** Allow network tools (webfetch, websearch) and a provider-native search tool. */
|
|
21
|
+
allowExternal?: boolean;
|
|
22
|
+
allowMcp?: boolean;
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
allowAgents?: boolean;
|
|
25
|
+
noHerdr?: boolean;
|
|
26
|
+
model?: string;
|
|
27
|
+
baseURL?: string;
|
|
28
|
+
apiMode?: string;
|
|
29
|
+
db?: string;
|
|
30
|
+
provider?: ModelProvider;
|
|
31
|
+
onEvent?: (event: RunEvent) => void;
|
|
32
|
+
/** First-party plugins activated through the trusted path (the CLI passes its registry). */
|
|
33
|
+
builtins?: BuiltinPlugin[];
|
|
34
|
+
/** Prompt templates shipped by the embedder (lowest precedence). */
|
|
35
|
+
builtinPrompts?: Array<{
|
|
36
|
+
name: string;
|
|
37
|
+
text: string;
|
|
38
|
+
}>;
|
|
39
|
+
/** Names templates may not take (e.g. the UI's own slash commands). */
|
|
40
|
+
reservedPromptNames?: string[];
|
|
41
|
+
/** Options merged over `builtinPlugins.<id>` from the configuration (e.g. CLI flags). */
|
|
42
|
+
pluginOptions?: Record<string, Record<string, unknown>>;
|
|
43
|
+
/** Built-in plugin ids to disable (e.g. `memory`). */
|
|
44
|
+
disablePlugins?: string[];
|
|
45
|
+
/** Interactive approval for write/process tools; ignored in read-only mode. */
|
|
46
|
+
approve?: ApprovalHandler;
|
|
47
|
+
}
|
|
48
|
+
export interface BuiltinContext {
|
|
49
|
+
workspace: string;
|
|
50
|
+
cwd: string;
|
|
51
|
+
stateHome: string;
|
|
52
|
+
configHome: string;
|
|
53
|
+
home: string;
|
|
54
|
+
/** Project-level resources may load (--trust-project or an explicit --config). */
|
|
55
|
+
trusted: boolean;
|
|
56
|
+
/** Directory of the configuration file, for relative paths in plugin options. */
|
|
57
|
+
configDir: string;
|
|
58
|
+
}
|
|
59
|
+
export interface BuiltinPlugin {
|
|
60
|
+
id: string;
|
|
61
|
+
name?: string;
|
|
62
|
+
description: string;
|
|
63
|
+
categories?: PluginCategory[];
|
|
64
|
+
/** Marks the initial provider plugin used for legacy root provider configuration. */
|
|
65
|
+
defaultProvider?: boolean;
|
|
66
|
+
/** `options` is the raw `builtinPlugins.<id>` object; the plugin validates it. */
|
|
67
|
+
create(options: unknown, context: BuiltinContext): Plugin;
|
|
68
|
+
}
|
|
69
|
+
export type PluginCatalogStatus = "active" | "inactive" | "failed" | "restart-required";
|
|
70
|
+
export interface PluginCatalogEntry {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
description: string;
|
|
74
|
+
version?: string;
|
|
75
|
+
categories: PluginCategory[];
|
|
76
|
+
builtin: boolean;
|
|
77
|
+
source: string;
|
|
78
|
+
status: PluginCatalogStatus;
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
manageable: boolean;
|
|
81
|
+
diagnostic?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface ConfiguredProviderCatalog {
|
|
84
|
+
profile: string;
|
|
85
|
+
provider: string;
|
|
86
|
+
title: string;
|
|
87
|
+
configuredModel: string;
|
|
88
|
+
models: ModelInfo[];
|
|
89
|
+
unavailable: boolean;
|
|
90
|
+
}
|
|
91
|
+
/** A built-in runs unless its config sets `enabled: false` or it is disabled by id. */
|
|
92
|
+
export declare function enabledBuiltins(available: BuiltinPlugin[], config: Record<string, {
|
|
93
|
+
enabled?: boolean;
|
|
94
|
+
} & Record<string, unknown>>, disabled?: string[]): BuiltinPlugin[];
|
|
95
|
+
export declare function createApplication(options?: AppOptions): Promise<{
|
|
96
|
+
workspace: string;
|
|
97
|
+
config: import("./config.ts").LoadedConfig;
|
|
98
|
+
prompts: {
|
|
99
|
+
templates: Map<string, import("./index.ts").PromptTemplate>;
|
|
100
|
+
diagnostics: import("./index.ts").PromptDiagnostic[];
|
|
101
|
+
};
|
|
102
|
+
expandPrompt: (input: string) => {
|
|
103
|
+
name: string;
|
|
104
|
+
args: string;
|
|
105
|
+
display: string;
|
|
106
|
+
text: string;
|
|
107
|
+
template: import("./index.ts").PromptTemplate;
|
|
108
|
+
} | undefined;
|
|
109
|
+
store: SQLiteStore;
|
|
110
|
+
registry: ToolRegistry;
|
|
111
|
+
context: ProjectContext;
|
|
112
|
+
skills: Skills;
|
|
113
|
+
/** Path- and content-safe metadata for the interactive skills manager. */
|
|
114
|
+
skillCatalog(): {
|
|
115
|
+
name: string;
|
|
116
|
+
id: string;
|
|
117
|
+
effectiveId: string;
|
|
118
|
+
displayId: string;
|
|
119
|
+
description: string;
|
|
120
|
+
scope: import("./index.ts").SkillScope;
|
|
121
|
+
source: string;
|
|
122
|
+
owner?: {
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
};
|
|
126
|
+
manageable: boolean;
|
|
127
|
+
locked: boolean;
|
|
128
|
+
enabled: boolean;
|
|
129
|
+
effective: boolean;
|
|
130
|
+
shadowedBy?: string;
|
|
131
|
+
approximateTokens: number;
|
|
132
|
+
}[];
|
|
133
|
+
/** Persist a project-local override and apply it to model-visible skills immediately. */
|
|
134
|
+
setSkillEnabled(id: string, enabled: boolean): Promise<import("./index.ts").Skill>;
|
|
135
|
+
plugins: PluginHost;
|
|
136
|
+
/** Credential- and path-safe catalog for the current resolved plugin set. */
|
|
137
|
+
pluginCatalog(): PluginCatalogEntry[];
|
|
138
|
+
/** Persist a project-local override. Runtime registrations intentionally change on restart. */
|
|
139
|
+
setPluginEnabled(id: string, enabled: boolean, lifecycle?: {
|
|
140
|
+
liveSession?: boolean;
|
|
141
|
+
}): Promise<PluginCatalogEntry>;
|
|
142
|
+
mcp: McpConnector;
|
|
143
|
+
/** Current-process MCP grant; deliberately independent from persisted server enablement. */
|
|
144
|
+
mcpRuntimePermission(): "granted" | "not-granted" | "read-only";
|
|
145
|
+
/** Host-owned interactive consent boundary. Headless callers remain blocked unless flagged. */
|
|
146
|
+
grantMcpRuntimePermission(request: {
|
|
147
|
+
source: "interactive-tui";
|
|
148
|
+
confirmed: boolean;
|
|
149
|
+
}): "granted" | "not-granted" | "read-only";
|
|
150
|
+
/** Persist an MCP toggle in its defining layer, then safely update this process. */
|
|
151
|
+
setMcpEnabled(id: string, enabled: boolean, connect?: boolean): Promise<import("./index.ts").McpServerInfo>;
|
|
152
|
+
provider: ActiveProvider;
|
|
153
|
+
providers: ProviderRegistry;
|
|
154
|
+
providerSettings: ProviderSettingsStore;
|
|
155
|
+
readonly providerError: string | undefined;
|
|
156
|
+
readonly providerInfo: {
|
|
157
|
+
id: string;
|
|
158
|
+
profile: Record<string, import("@alisio/sdk").ProviderConfigurationValue>;
|
|
159
|
+
persisted: boolean;
|
|
160
|
+
profileName: string;
|
|
161
|
+
} | {
|
|
162
|
+
id: string;
|
|
163
|
+
profile: Record<string, import("@alisio/sdk").ProviderConfigurationValue>;
|
|
164
|
+
persisted: boolean;
|
|
165
|
+
profileName: undefined;
|
|
166
|
+
} | undefined;
|
|
167
|
+
runner: AgentRunner;
|
|
168
|
+
herdr: HerdrBridge;
|
|
169
|
+
contextWindow: (model: string) => number | undefined;
|
|
170
|
+
loadModels: (signal: AbortSignal) => Promise<ModelInfo[]>;
|
|
171
|
+
/** Creates a provider for validation/model discovery without changing the active provider. */
|
|
172
|
+
probeProvider(id: string, profile: Record<string, import("@alisio/sdk").ProviderConfigurationValue>, credentials: Record<string, string>, signal: AbortSignal): Promise<ModelInfo[]>;
|
|
173
|
+
/** Lists every plugin-configured profile without returning credentials or provider errors. */
|
|
174
|
+
configuredProviderCatalogs(signal: AbortSignal): Promise<ConfiguredProviderCatalog[]>;
|
|
175
|
+
/** Lists credential-free models from globally configured `/connect` profiles. */
|
|
176
|
+
listAvailableModels: (signal?: AbortSignal) => Promise<AvailableProviderModel[]>;
|
|
177
|
+
/** Resolves `provider/model` or a unique bare model id without exposing credentials. */
|
|
178
|
+
resolveModel: (reference: string, signal?: AbortSignal) => Promise<ResolvedProviderModel>;
|
|
179
|
+
/** Creates and binds a fresh session to an optional configured model selector. */
|
|
180
|
+
createSession(reference?: string): Promise<import("./index.ts").Session>;
|
|
181
|
+
/** Persists and activates only after construction succeeds; programmatic overrides stay fixed. */
|
|
182
|
+
activateProvider(id: string, profile: Record<string, import("@alisio/sdk").ProviderConfigurationValue>, credentials: Record<string, string>, model: string, profileName?: string): Promise<void>;
|
|
183
|
+
/** Activates a stored profile without exposing its credentials. Returns false for a no-op. */
|
|
184
|
+
activateProviderProfile(name: string, model: string): Promise<boolean>;
|
|
185
|
+
/** Resolves, globally activates, and creates the fresh session required by a main switch. */
|
|
186
|
+
switchModel(reference: string): Promise<import("./index.ts").Session | undefined>;
|
|
187
|
+
/** Runs session-end plugin hooks (bounded by the host timeout). */
|
|
188
|
+
endSession(sessionId: string, reason: "clear" | "exit"): Promise<{
|
|
189
|
+
failures: import("./index.ts").HookFailure[];
|
|
190
|
+
}>;
|
|
191
|
+
close(): Promise<void>;
|
|
192
|
+
}>;
|