@4onstudios/iris-agent 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/LICENSE +21 -0
- package/README.md +690 -0
- package/dist/api/acp/acpServer.d.ts +23 -0
- package/dist/api/acp/acpServer.js +814 -0
- package/dist/api/acp/index.d.ts +2 -0
- package/dist/api/acp/index.js +2 -0
- package/dist/api/acp/irisClient.d.ts +58 -0
- package/dist/api/acp/irisClient.js +214 -0
- package/dist/api/agent.d.ts +14 -0
- package/dist/api/agent.js +4171 -0
- package/dist/api/backendService.d.ts +4 -0
- package/dist/api/backendService.js +14 -0
- package/dist/api/core/agent/host/AgentContract.d.ts +82 -0
- package/dist/api/core/agent/host/AgentContract.js +1 -0
- package/dist/api/core/agent/host/AgentRegistry.d.ts +24 -0
- package/dist/api/core/agent/host/AgentRegistry.js +125 -0
- package/dist/api/core/agent/host/defaultRegistry.d.ts +15 -0
- package/dist/api/core/agent/host/defaultRegistry.js +46 -0
- package/dist/api/core/agent/host/externalAgentLifecycle.d.ts +65 -0
- package/dist/api/core/agent/host/externalAgentLifecycle.js +117 -0
- package/dist/api/core/agent/host/hostSessionManager.d.ts +111 -0
- package/dist/api/core/agent/host/hostSessionManager.js +352 -0
- package/dist/api/core/agent/host/index.d.ts +5 -0
- package/dist/api/core/agent/host/index.js +5 -0
- package/dist/api/core/agent/index.d.ts +87 -0
- package/dist/api/core/agent/index.js +1024 -0
- package/dist/api/core/agent/publicContracts.d.ts +35 -0
- package/dist/api/core/agent/publicContracts.js +103 -0
- package/dist/api/core/agent/tools/applyDiff.d.ts +51 -0
- package/dist/api/core/agent/tools/applyDiff.js +131 -0
- package/dist/api/core/agent/tools/backgroundTasks.d.ts +240 -0
- package/dist/api/core/agent/tools/backgroundTasks.js +313 -0
- package/dist/api/core/agent/tools/createDirectory.d.ts +43 -0
- package/dist/api/core/agent/tools/createDirectory.js +77 -0
- package/dist/api/core/agent/tools/deleteFile.d.ts +37 -0
- package/dist/api/core/agent/tools/deleteFile.js +66 -0
- package/dist/api/core/agent/tools/editFile.d.ts +73 -0
- package/dist/api/core/agent/tools/editFile.js +173 -0
- package/dist/api/core/agent/tools/executeCommand.d.ts +59 -0
- package/dist/api/core/agent/tools/executeCommand.js +250 -0
- package/dist/api/core/agent/tools/fileContent.d.ts +54 -0
- package/dist/api/core/agent/tools/fileContent.js +227 -0
- package/dist/api/core/agent/tools/findDefinition.d.ts +72 -0
- package/dist/api/core/agent/tools/findDefinition.js +109 -0
- package/dist/api/core/agent/tools/findReferences.d.ts +86 -0
- package/dist/api/core/agent/tools/findReferences.js +135 -0
- package/dist/api/core/agent/tools/formatDocument.d.ts +67 -0
- package/dist/api/core/agent/tools/formatDocument.js +90 -0
- package/dist/api/core/agent/tools/getCodeActions.d.ts +77 -0
- package/dist/api/core/agent/tools/getCodeActions.js +97 -0
- package/dist/api/core/agent/tools/getCodeCompletion.d.ts +77 -0
- package/dist/api/core/agent/tools/getCodeCompletion.js +174 -0
- package/dist/api/core/agent/tools/getCodeContext.d.ts +14 -0
- package/dist/api/core/agent/tools/getCodeContext.js +282 -0
- package/dist/api/core/agent/tools/getSignatureHelp.d.ts +61 -0
- package/dist/api/core/agent/tools/getSignatureHelp.js +85 -0
- package/dist/api/core/agent/tools/getSymbols.d.ts +50 -0
- package/dist/api/core/agent/tools/getSymbols.js +164 -0
- package/dist/api/core/agent/tools/getSymbolsLSP.d.ts +58 -0
- package/dist/api/core/agent/tools/getSymbolsLSP.js +147 -0
- package/dist/api/core/agent/tools/getTypeInfo.d.ts +70 -0
- package/dist/api/core/agent/tools/getTypeInfo.js +84 -0
- package/dist/api/core/agent/tools/getWorkspaceInfo.d.ts +80 -0
- package/dist/api/core/agent/tools/getWorkspaceInfo.js +281 -0
- package/dist/api/core/agent/tools/getWorkspaceSymbols.d.ts +53 -0
- package/dist/api/core/agent/tools/getWorkspaceSymbols.js +97 -0
- package/dist/api/core/agent/tools/grepSearch.d.ts +100 -0
- package/dist/api/core/agent/tools/grepSearch.js +211 -0
- package/dist/api/core/agent/tools/languageModelToolsIntegration.d.ts +13 -0
- package/dist/api/core/agent/tools/languageModelToolsIntegration.js +22 -0
- package/dist/api/core/agent/tools/listDirectory.d.ts +66 -0
- package/dist/api/core/agent/tools/listDirectory.js +161 -0
- package/dist/api/core/agent/tools/mcpTools.d.ts +48 -0
- package/dist/api/core/agent/tools/mcpTools.js +442 -0
- package/dist/api/core/agent/tools/queryKnowledgeGraph.d.ts +120 -0
- package/dist/api/core/agent/tools/queryKnowledgeGraph.js +306 -0
- package/dist/api/core/agent/tools/readFile.d.ts +92 -0
- package/dist/api/core/agent/tools/readFile.js +337 -0
- package/dist/api/core/agent/tools/renameFile.d.ts +49 -0
- package/dist/api/core/agent/tools/renameFile.js +86 -0
- package/dist/api/core/agent/tools/renameSymbol.d.ts +70 -0
- package/dist/api/core/agent/tools/renameSymbol.js +106 -0
- package/dist/api/core/agent/tools/runTerminalCommand.d.ts +72 -0
- package/dist/api/core/agent/tools/runTerminalCommand.js +69 -0
- package/dist/api/core/agent/tools/searchFiles.d.ts +82 -0
- package/dist/api/core/agent/tools/searchFiles.js +280 -0
- package/dist/api/core/agent/tools/terminalAutoApprove.d.ts +3 -0
- package/dist/api/core/agent/tools/terminalAutoApprove.js +676 -0
- package/dist/api/core/agent/tools/treeTraversal.d.ts +60 -0
- package/dist/api/core/agent/tools/treeTraversal.js +217 -0
- package/dist/api/core/agent/tools/webSearch.d.ts +37 -0
- package/dist/api/core/agent/tools/webSearch.js +80 -0
- package/dist/api/core/agent/tools/writeFile.d.ts +59 -0
- package/dist/api/core/agent/tools/writeFile.js +97 -0
- package/dist/api/core/agent/utils/capturedWorkspaceMutationBridge.d.ts +12 -0
- package/dist/api/core/agent/utils/capturedWorkspaceMutationBridge.js +67 -0
- package/dist/api/core/agent/utils/diffUtils.d.ts +14 -0
- package/dist/api/core/agent/utils/diffUtils.js +39 -0
- package/dist/api/core/agent/utils/environmentSnapshot.d.ts +42 -0
- package/dist/api/core/agent/utils/environmentSnapshot.js +213 -0
- package/dist/api/core/agent/utils/errorRecovery.d.ts +49 -0
- package/dist/api/core/agent/utils/errorRecovery.js +229 -0
- package/dist/api/core/agent/utils/multimodalTokenLimiter.d.ts +8 -0
- package/dist/api/core/agent/utils/multimodalTokenLimiter.js +238 -0
- package/dist/api/core/agent/utils/openRouterModelSettings.d.ts +12 -0
- package/dist/api/core/agent/utils/openRouterModelSettings.js +34 -0
- package/dist/api/core/agent/utils/pathRecovery.d.ts +1 -0
- package/dist/api/core/agent/utils/pathRecovery.js +29 -0
- package/dist/api/core/agent/utils/repoMapIndex.d.ts +3 -0
- package/dist/api/core/agent/utils/repoMapIndex.js +197 -0
- package/dist/api/core/agent/utils/skillsDiscovery.d.ts +10 -0
- package/dist/api/core/agent/utils/skillsDiscovery.js +50 -0
- package/dist/api/core/agent/utils/toolCallBudget.d.ts +9 -0
- package/dist/api/core/agent/utils/toolCallBudget.js +55 -0
- package/dist/api/core/agent/utils/toolLifecycle.d.ts +30 -0
- package/dist/api/core/agent/utils/toolLifecycle.js +361 -0
- package/dist/api/core/agent/utils/toolResultSafetyProcessor.d.ts +12 -0
- package/dist/api/core/agent/utils/toolResultSafetyProcessor.js +57 -0
- package/dist/api/core/agent/utils/workspaceMutationBridge.d.ts +13 -0
- package/dist/api/core/agent/utils/workspaceMutationBridge.js +149 -0
- package/dist/api/core/agent/utils/workspacePathGuard.d.ts +7 -0
- package/dist/api/core/agent/utils/workspacePathGuard.js +79 -0
- package/dist/api/core/containers/chat/toolResultSerialization.d.ts +8 -0
- package/dist/api/core/containers/chat/toolResultSerialization.js +71 -0
- package/dist/api/core/library/BrowserManager.d.ts +11 -0
- package/dist/api/core/library/BrowserManager.js +66 -0
- package/dist/api/core/library/desktopWorkspace.d.ts +1 -0
- package/dist/api/core/library/desktopWorkspace.js +3 -0
- package/dist/api/core/library/extensionManager.d.ts +10 -0
- package/dist/api/core/library/extensionManager.js +27 -0
- package/dist/api/core/library/knowledgeGraph.d.ts +268 -0
- package/dist/api/core/library/knowledgeGraph.js +989 -0
- package/dist/api/core/library/languageModelTools.d.ts +141 -0
- package/dist/api/core/library/languageModelTools.js +207 -0
- package/dist/api/core/library/localRuntime.d.ts +23 -0
- package/dist/api/core/library/localRuntime.js +144 -0
- package/dist/api/core/library/lsp/coreLsp.d.ts +367 -0
- package/dist/api/core/library/lsp/coreLsp.js +2076 -0
- package/dist/api/core/library/lsp/protocol.d.ts +25 -0
- package/dist/api/core/library/lsp/protocol.js +1 -0
- package/dist/api/core/library/lsp/serverManager.d.ts +37 -0
- package/dist/api/core/library/lsp/serverManager.js +427 -0
- package/dist/api/core/library/mcpServerProvider.d.ts +69 -0
- package/dist/api/core/library/mcpServerProvider.js +152 -0
- package/dist/api/core/library/mcpSettings.d.ts +20 -0
- package/dist/api/core/library/mcpSettings.js +131 -0
- package/dist/api/core/library/patternMatcher.d.ts +66 -0
- package/dist/api/core/library/patternMatcher.js +284 -0
- package/dist/api/core/library/regexEscape.d.ts +4 -0
- package/dist/api/core/library/regexEscape.js +4 -0
- package/dist/api/core/library/runtimeEventBus.d.ts +27 -0
- package/dist/api/core/library/runtimeEventBus.js +78 -0
- package/dist/api/core/library/safetyMiddleware.d.ts +98 -0
- package/dist/api/core/library/safetyMiddleware.js +215 -0
- package/dist/api/core/library/tauri.d.ts +71 -0
- package/dist/api/core/library/tauri.js +222 -0
- package/dist/api/core/library/tauriImport.d.ts +5 -0
- package/dist/api/core/library/tauriImport.js +7 -0
- package/dist/api/core/library/terminalAutoApproveSettings.d.ts +32 -0
- package/dist/api/core/library/terminalAutoApproveSettings.js +529 -0
- package/dist/api/core/library/workspaceIdentity.d.ts +10 -0
- package/dist/api/core/library/workspaceIdentity.js +49 -0
- package/dist/api/core/library/workspaceSummary.d.ts +19 -0
- package/dist/api/core/library/workspaceSummary.js +35 -0
- package/dist/api/core/skills/agent-customization/SKILL.md +27 -0
- package/dist/api/core/skills/bug-fix/SKILL.md +21 -0
- package/dist/api/core/skills/create-pr/SKILL.md +32 -0
- package/dist/api/core/skills/dev-server/SKILL.md +20 -0
- package/dist/api/core/skills/fix-suggestions/SKILL.md +21 -0
- package/dist/api/core/skills/github-search/SKILL.md +21 -0
- package/dist/api/core/skills/github-summary/SKILL.md +25 -0
- package/dist/api/core/skills/integration-tests/SKILL.md +29 -0
- package/dist/api/core/skills/pr-comments/SKILL.md +23 -0
- package/dist/api/core/skills/project-setup/SKILL.md +20 -0
- package/dist/api/core/skills/search-integration/SKILL.md +19 -0
- package/dist/api/core/skills/search-results/SKILL.md +19 -0
- package/dist/api/core/skills/typescript-upgrade/SKILL.md +21 -0
- package/dist/api/data/runStore.d.ts +46 -0
- package/dist/api/data/runStore.js +244 -0
- package/dist/api/helpers/agentUtils.d.ts +11 -0
- package/dist/api/helpers/agentUtils.js +23 -0
- package/dist/api/helpers/modelTokenLimits.d.ts +2 -0
- package/dist/api/helpers/modelTokenLimits.js +158 -0
- package/dist/api/helpers/observationalMemory.d.ts +10 -0
- package/dist/api/helpers/observationalMemory.js +36 -0
- package/dist/api/helpers/promptBudget.d.ts +30 -0
- package/dist/api/helpers/promptBudget.js +216 -0
- package/dist/api/helpers/resolveImageMessageParts.d.ts +9 -0
- package/dist/api/helpers/resolveImageMessageParts.js +140 -0
- package/dist/api/helpers/slashCommands.d.ts +31 -0
- package/dist/api/helpers/slashCommands.js +129 -0
- package/dist/api/helpers/tokenUsage.d.ts +19 -0
- package/dist/api/helpers/tokenUsage.js +81 -0
- package/dist/api/routes/fileRoutes.d.ts +2 -0
- package/dist/api/routes/fileRoutes.js +108 -0
- package/dist/api/routes/lspDocumentRoutes.d.ts +4 -0
- package/dist/api/routes/lspDocumentRoutes.js +84 -0
- package/dist/api/routes/lspHierarchyRoutes.d.ts +4 -0
- package/dist/api/routes/lspHierarchyRoutes.js +122 -0
- package/dist/api/routes/lspPositionRoutes.d.ts +4 -0
- package/dist/api/routes/lspPositionRoutes.js +263 -0
- package/dist/api/routes/lspQueryRoutes.d.ts +4 -0
- package/dist/api/routes/lspQueryRoutes.js +679 -0
- package/dist/api/routes/lspResolveRoutes.d.ts +4 -0
- package/dist/api/routes/lspResolveRoutes.js +143 -0
- package/dist/api/routes/lspSemanticDocumentRoutes.d.ts +4 -0
- package/dist/api/routes/lspSemanticDocumentRoutes.js +98 -0
- package/dist/api/routes/semanticRoutes.d.ts +2 -0
- package/dist/api/routes/semanticRoutes.js +126 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +160 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +38 -0
- package/package.json +100 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import agentRouter from "./agent.js";
|
|
2
|
+
export const DEFAULT_BACKEND_SERVICE = "iris-agent";
|
|
3
|
+
const normalizeBackendService = (value) => (value || DEFAULT_BACKEND_SERVICE).trim().toLowerCase();
|
|
4
|
+
export const resolveBackendService = () => normalizeBackendService(process.env.IRIS_BACKEND_SERVICE);
|
|
5
|
+
export const getBackendApiRouter = () => {
|
|
6
|
+
const backendService = resolveBackendService();
|
|
7
|
+
switch (backendService) {
|
|
8
|
+
case "iris-agent":
|
|
9
|
+
return agentRouter;
|
|
10
|
+
default:
|
|
11
|
+
console.warn(`[server] Unknown IRIS_BACKEND_SERVICE='${backendService}', falling back to '${DEFAULT_BACKEND_SERVICE}'.`);
|
|
12
|
+
return agentRouter;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare const AGENT_HOST_CONTRACT_VERSION = "1.0.0";
|
|
2
|
+
export type AgentSource = "builtin" | "external";
|
|
3
|
+
export type AgentCapability = "filesystem" | "workspace_search" | "terminal" | "lsp" | "mcp" | "tool_calling" | "streaming" | "approval_flow";
|
|
4
|
+
export type AgentCapabilityMap = Partial<Record<AgentCapability, boolean>>;
|
|
5
|
+
export type AgentPermissionScope = "workspace_read" | "workspace_write" | "workspace_delete" | "terminal_execute" | "network" | "lsp_request" | "mcp_request";
|
|
6
|
+
export type AgentPermissionMode = "allow" | "deny" | "ask";
|
|
7
|
+
export type AgentPermissionPolicy = Partial<Record<AgentPermissionScope, AgentPermissionMode>>;
|
|
8
|
+
export type AgentDescriptor = {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
version: string;
|
|
12
|
+
source: AgentSource;
|
|
13
|
+
description?: string;
|
|
14
|
+
capabilities?: AgentCapabilityMap;
|
|
15
|
+
permissions?: AgentPermissionPolicy;
|
|
16
|
+
tags?: string[];
|
|
17
|
+
};
|
|
18
|
+
export type AgentSessionContext = {
|
|
19
|
+
sessionId: string;
|
|
20
|
+
workspacePath: string;
|
|
21
|
+
modelId?: string;
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
export type AgentSession = {
|
|
25
|
+
sessionId: string;
|
|
26
|
+
agentId: string;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
};
|
|
29
|
+
export type AgentTurnRequest = {
|
|
30
|
+
sessionId: string;
|
|
31
|
+
input: string;
|
|
32
|
+
conversation?: Array<{
|
|
33
|
+
role: "user" | "assistant" | "system" | "tool";
|
|
34
|
+
content: string;
|
|
35
|
+
}>;
|
|
36
|
+
metadata?: Record<string, unknown>;
|
|
37
|
+
onPreToolUse?: (input: {
|
|
38
|
+
toolName: string;
|
|
39
|
+
toolCallId?: string;
|
|
40
|
+
toolArgs?: Record<string, unknown>;
|
|
41
|
+
}) => Promise<void> | void;
|
|
42
|
+
};
|
|
43
|
+
export type AgentStreamEvent = {
|
|
44
|
+
type: "text-delta";
|
|
45
|
+
text: string;
|
|
46
|
+
} | {
|
|
47
|
+
type: "tool-call";
|
|
48
|
+
name: string;
|
|
49
|
+
args?: Record<string, unknown>;
|
|
50
|
+
} | {
|
|
51
|
+
type: "tool-result";
|
|
52
|
+
name: string;
|
|
53
|
+
result?: unknown;
|
|
54
|
+
} | {
|
|
55
|
+
type: "approval-required";
|
|
56
|
+
reason: string;
|
|
57
|
+
payload?: Record<string, unknown>;
|
|
58
|
+
} | {
|
|
59
|
+
type: "error";
|
|
60
|
+
message: string;
|
|
61
|
+
} | {
|
|
62
|
+
type: "done";
|
|
63
|
+
};
|
|
64
|
+
export type AgentTurnResult = {
|
|
65
|
+
text: string;
|
|
66
|
+
toolCalls?: Array<Record<string, unknown>>;
|
|
67
|
+
toolResults?: Array<Record<string, unknown>>;
|
|
68
|
+
raw?: unknown;
|
|
69
|
+
};
|
|
70
|
+
export type AgentTurnStreamResult = {
|
|
71
|
+
stream: ReadableStream<AgentStreamEvent>;
|
|
72
|
+
getFinalResult: () => Promise<AgentTurnResult>;
|
|
73
|
+
};
|
|
74
|
+
export interface AgentRuntime {
|
|
75
|
+
readonly descriptor: AgentDescriptor;
|
|
76
|
+
startSession(context: AgentSessionContext): Promise<AgentSession>;
|
|
77
|
+
runTurn(request: AgentTurnRequest): Promise<AgentTurnResult>;
|
|
78
|
+
runTurnStream?(request: AgentTurnRequest): Promise<AgentTurnStreamResult>;
|
|
79
|
+
cancelTurn?(sessionId: string): Promise<void>;
|
|
80
|
+
endSession(sessionId: string): Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
export type AgentRuntimeFactory<TRuntime = AgentRuntime> = () => Promise<TRuntime> | TRuntime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const AGENT_HOST_CONTRACT_VERSION = "1.0.0";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentCapability, AgentDescriptor, AgentPermissionScope, AgentRuntime, AgentRuntimeFactory } from "./AgentContract.js";
|
|
2
|
+
export type AgentSelectionPolicy = {
|
|
3
|
+
requiredCapabilities?: AgentCapability[];
|
|
4
|
+
requiredPermissions?: AgentPermissionScope[];
|
|
5
|
+
};
|
|
6
|
+
export declare class AgentRegistry<TRuntime = AgentRuntime> {
|
|
7
|
+
private readonly descriptors;
|
|
8
|
+
private readonly factories;
|
|
9
|
+
private defaultAgentId;
|
|
10
|
+
registerBuiltin(descriptor: AgentDescriptor, factory: AgentRuntimeFactory<TRuntime>, options?: {
|
|
11
|
+
asDefault?: boolean;
|
|
12
|
+
}): void;
|
|
13
|
+
registerExternal(descriptor: AgentDescriptor, factory: AgentRuntimeFactory<TRuntime>): void;
|
|
14
|
+
private register;
|
|
15
|
+
setDefaultAgent(agentId: string): void;
|
|
16
|
+
getDefaultAgentId(): string | null;
|
|
17
|
+
getDefaultAgentDescriptor(): AgentDescriptor | null;
|
|
18
|
+
getAgentDescriptor(agentId: string): AgentDescriptor | null;
|
|
19
|
+
listAgents(): AgentDescriptor[];
|
|
20
|
+
private satisfiesPolicy;
|
|
21
|
+
resolveAgentId(preferredAgentId?: string): string;
|
|
22
|
+
resolveAgentIdWithPolicy(preferredAgentId: string | undefined, policy: AgentSelectionPolicy): string;
|
|
23
|
+
createRuntime(preferredAgentId?: string, policy?: AgentSelectionPolicy): Promise<TRuntime>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
const ensureNonEmpty = (value, field) => {
|
|
2
|
+
const trimmed = value.trim();
|
|
3
|
+
if (!trimmed) {
|
|
4
|
+
throw new Error(`Agent descriptor requires a non-empty ${field}`);
|
|
5
|
+
}
|
|
6
|
+
return trimmed;
|
|
7
|
+
};
|
|
8
|
+
const normalizeDescriptor = (descriptor, expectedSource) => {
|
|
9
|
+
const id = ensureNonEmpty(descriptor.id, "id");
|
|
10
|
+
const name = ensureNonEmpty(descriptor.name, "name");
|
|
11
|
+
const version = ensureNonEmpty(descriptor.version, "version");
|
|
12
|
+
if (descriptor.source !== expectedSource) {
|
|
13
|
+
throw new Error(`Agent '${id}' has source '${descriptor.source}' but must be '${expectedSource}' in this registration path`);
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
...descriptor,
|
|
17
|
+
id,
|
|
18
|
+
name,
|
|
19
|
+
version,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export class AgentRegistry {
|
|
23
|
+
descriptors = new Map();
|
|
24
|
+
factories = new Map();
|
|
25
|
+
defaultAgentId = null;
|
|
26
|
+
registerBuiltin(descriptor, factory, options = {}) {
|
|
27
|
+
const normalized = normalizeDescriptor(descriptor, "builtin");
|
|
28
|
+
this.register(normalized, factory);
|
|
29
|
+
if (options.asDefault || this.defaultAgentId === null) {
|
|
30
|
+
this.defaultAgentId = normalized.id;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
registerExternal(descriptor, factory) {
|
|
34
|
+
const normalized = normalizeDescriptor(descriptor, "external");
|
|
35
|
+
this.register(normalized, factory);
|
|
36
|
+
}
|
|
37
|
+
register(descriptor, factory) {
|
|
38
|
+
if (this.descriptors.has(descriptor.id)) {
|
|
39
|
+
throw new Error(`Agent '${descriptor.id}' is already registered`);
|
|
40
|
+
}
|
|
41
|
+
this.descriptors.set(descriptor.id, descriptor);
|
|
42
|
+
this.factories.set(descriptor.id, factory);
|
|
43
|
+
}
|
|
44
|
+
setDefaultAgent(agentId) {
|
|
45
|
+
const normalizedId = ensureNonEmpty(agentId, "agent id");
|
|
46
|
+
if (!this.descriptors.has(normalizedId)) {
|
|
47
|
+
throw new Error(`Cannot set default agent. Unknown agent '${normalizedId}'`);
|
|
48
|
+
}
|
|
49
|
+
this.defaultAgentId = normalizedId;
|
|
50
|
+
}
|
|
51
|
+
getDefaultAgentId() {
|
|
52
|
+
return this.defaultAgentId;
|
|
53
|
+
}
|
|
54
|
+
getDefaultAgentDescriptor() {
|
|
55
|
+
if (!this.defaultAgentId) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return this.descriptors.get(this.defaultAgentId) || null;
|
|
59
|
+
}
|
|
60
|
+
getAgentDescriptor(agentId) {
|
|
61
|
+
const normalizedId = ensureNonEmpty(agentId, "agent id");
|
|
62
|
+
return this.descriptors.get(normalizedId) || null;
|
|
63
|
+
}
|
|
64
|
+
listAgents() {
|
|
65
|
+
return Array.from(this.descriptors.values());
|
|
66
|
+
}
|
|
67
|
+
satisfiesPolicy(descriptor, policy) {
|
|
68
|
+
if (!descriptor || !policy) {
|
|
69
|
+
return Boolean(descriptor);
|
|
70
|
+
}
|
|
71
|
+
const requiredCapabilities = policy.requiredCapabilities || [];
|
|
72
|
+
const requiredPermissions = policy.requiredPermissions || [];
|
|
73
|
+
if (requiredCapabilities.length > 0) {
|
|
74
|
+
const capabilities = descriptor.capabilities || {};
|
|
75
|
+
for (const capability of requiredCapabilities) {
|
|
76
|
+
if (capabilities[capability] !== true) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (requiredPermissions.length > 0) {
|
|
82
|
+
const permissions = descriptor.permissions || {};
|
|
83
|
+
for (const scope of requiredPermissions) {
|
|
84
|
+
if (permissions[scope] === "deny") {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
resolveAgentId(preferredAgentId) {
|
|
92
|
+
const preferred = preferredAgentId?.trim();
|
|
93
|
+
if (preferred && this.descriptors.has(preferred)) {
|
|
94
|
+
return preferred;
|
|
95
|
+
}
|
|
96
|
+
if (this.defaultAgentId) {
|
|
97
|
+
return this.defaultAgentId;
|
|
98
|
+
}
|
|
99
|
+
throw new Error("No default agent is configured");
|
|
100
|
+
}
|
|
101
|
+
resolveAgentIdWithPolicy(preferredAgentId, policy) {
|
|
102
|
+
const preferred = preferredAgentId?.trim();
|
|
103
|
+
const preferredDescriptor = preferred ? this.descriptors.get(preferred) : undefined;
|
|
104
|
+
if (preferred && this.satisfiesPolicy(preferredDescriptor, policy)) {
|
|
105
|
+
return preferred;
|
|
106
|
+
}
|
|
107
|
+
if (this.defaultAgentId) {
|
|
108
|
+
const fallbackDescriptor = this.descriptors.get(this.defaultAgentId);
|
|
109
|
+
if (this.satisfiesPolicy(fallbackDescriptor, policy)) {
|
|
110
|
+
return this.defaultAgentId;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
throw new Error("No eligible agent is configured for the requested policy");
|
|
114
|
+
}
|
|
115
|
+
async createRuntime(preferredAgentId, policy) {
|
|
116
|
+
const agentId = policy
|
|
117
|
+
? this.resolveAgentIdWithPolicy(preferredAgentId, policy)
|
|
118
|
+
: this.resolveAgentId(preferredAgentId);
|
|
119
|
+
const factory = this.factories.get(agentId);
|
|
120
|
+
if (!factory) {
|
|
121
|
+
throw new Error(`No runtime factory registered for agent '${agentId}'`);
|
|
122
|
+
}
|
|
123
|
+
return await Promise.resolve(factory());
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AgentRegistry } from "./AgentRegistry.js";
|
|
2
|
+
import type { AgentDescriptor, AgentRuntimeFactory } from "./AgentContract.js";
|
|
3
|
+
export declare const IRIS_DEFAULT_AGENT_DESCRIPTOR: AgentDescriptor;
|
|
4
|
+
type ExternalAgentRegistration<TRuntime> = {
|
|
5
|
+
id?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
runtimeFactory: AgentRuntimeFactory<TRuntime>;
|
|
9
|
+
};
|
|
10
|
+
type CreateDefaultAgentRegistryOptions<TRuntime> = {
|
|
11
|
+
irisFactory: AgentRuntimeFactory<TRuntime>;
|
|
12
|
+
externalRegistration?: ExternalAgentRegistration<TRuntime>;
|
|
13
|
+
};
|
|
14
|
+
export declare const createDefaultAgentRegistry: <TRuntime>({ irisFactory, externalRegistration, }: CreateDefaultAgentRegistryOptions<TRuntime>) => AgentRegistry<TRuntime>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AgentRegistry } from "./AgentRegistry.js";
|
|
2
|
+
export const IRIS_DEFAULT_AGENT_DESCRIPTOR = {
|
|
3
|
+
id: "iris",
|
|
4
|
+
name: "Iris",
|
|
5
|
+
version: "1.0.0",
|
|
6
|
+
source: "builtin",
|
|
7
|
+
description: "Default built-in Iris coding agent runtime",
|
|
8
|
+
capabilities: {
|
|
9
|
+
tool_calling: true,
|
|
10
|
+
streaming: true,
|
|
11
|
+
approval_flow: true,
|
|
12
|
+
workspace_search: true,
|
|
13
|
+
filesystem: true,
|
|
14
|
+
lsp: true,
|
|
15
|
+
mcp: true,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const createDefaultAgentRegistry = ({ irisFactory, externalRegistration, }) => {
|
|
19
|
+
const registry = new AgentRegistry();
|
|
20
|
+
registry.registerBuiltin(IRIS_DEFAULT_AGENT_DESCRIPTOR, irisFactory, {
|
|
21
|
+
asDefault: true,
|
|
22
|
+
});
|
|
23
|
+
if (externalRegistration) {
|
|
24
|
+
const id = (externalRegistration.id || "external-agent").trim() || "external-agent";
|
|
25
|
+
const name = (externalRegistration.name || "External Agent").trim() || "External Agent";
|
|
26
|
+
registry.registerExternal({
|
|
27
|
+
id,
|
|
28
|
+
name,
|
|
29
|
+
version: "0.1.0",
|
|
30
|
+
source: "external",
|
|
31
|
+
description: externalRegistration.description ||
|
|
32
|
+
"External agent registration hook.",
|
|
33
|
+
capabilities: {
|
|
34
|
+
tool_calling: true,
|
|
35
|
+
streaming: true,
|
|
36
|
+
approval_flow: true,
|
|
37
|
+
workspace_search: true,
|
|
38
|
+
filesystem: true,
|
|
39
|
+
lsp: true,
|
|
40
|
+
mcp: true,
|
|
41
|
+
},
|
|
42
|
+
tags: ["external"],
|
|
43
|
+
}, externalRegistration.runtimeFactory);
|
|
44
|
+
}
|
|
45
|
+
return registry;
|
|
46
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AgentDescriptor, AgentRuntimeFactory } from "./AgentContract.js";
|
|
3
|
+
declare const manifestSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
version: z.ZodDefault<z.ZodString>;
|
|
7
|
+
description: z.ZodOptional<z.ZodString>;
|
|
8
|
+
modulePath: z.ZodString;
|
|
9
|
+
exportName: z.ZodOptional<z.ZodString>;
|
|
10
|
+
capabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
11
|
+
permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["allow", "deny", "ask"]>>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
description?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
version?: string;
|
|
17
|
+
modulePath?: string;
|
|
18
|
+
exportName?: string;
|
|
19
|
+
capabilities?: Record<string, boolean>;
|
|
20
|
+
permissions?: Record<string, "allow" | "deny" | "ask">;
|
|
21
|
+
}, {
|
|
22
|
+
description?: string;
|
|
23
|
+
id?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
version?: string;
|
|
26
|
+
modulePath?: string;
|
|
27
|
+
exportName?: string;
|
|
28
|
+
capabilities?: Record<string, boolean>;
|
|
29
|
+
permissions?: Record<string, "allow" | "deny" | "ask">;
|
|
30
|
+
}>;
|
|
31
|
+
export type ExternalAgentManifest = z.infer<typeof manifestSchema>;
|
|
32
|
+
export type ExternalAgentRuntimeContext = {
|
|
33
|
+
modelId: string;
|
|
34
|
+
workspacePath: string;
|
|
35
|
+
mcpServers: unknown[];
|
|
36
|
+
};
|
|
37
|
+
export type ExternalAgentRegistration<TRuntime> = {
|
|
38
|
+
descriptor: AgentDescriptor;
|
|
39
|
+
runtimeFactory: AgentRuntimeFactory<TRuntime>;
|
|
40
|
+
};
|
|
41
|
+
export declare class ExternalAgentLifecycleManager<TRuntime> {
|
|
42
|
+
private readonly manifestPath;
|
|
43
|
+
private manifestCache;
|
|
44
|
+
private moduleCache;
|
|
45
|
+
private lastHealthStatus;
|
|
46
|
+
constructor(manifestPath: string);
|
|
47
|
+
loadManifest(): Promise<ExternalAgentManifest>;
|
|
48
|
+
private loadModule;
|
|
49
|
+
healthCheck(): Promise<{
|
|
50
|
+
ok: true;
|
|
51
|
+
} | {
|
|
52
|
+
ok: false;
|
|
53
|
+
reason: string;
|
|
54
|
+
}>;
|
|
55
|
+
getLastHealthStatus(): {
|
|
56
|
+
ok: true;
|
|
57
|
+
checkedAt: number;
|
|
58
|
+
} | {
|
|
59
|
+
ok: false;
|
|
60
|
+
checkedAt: number;
|
|
61
|
+
reason: string;
|
|
62
|
+
} | null;
|
|
63
|
+
createRegistration(context: ExternalAgentRuntimeContext): Promise<ExternalAgentRegistration<TRuntime>>;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { pathToFileURL } from "url";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
const manifestSchema = z.object({
|
|
6
|
+
id: z.string().min(1),
|
|
7
|
+
name: z.string().min(1),
|
|
8
|
+
version: z.string().min(1).default("0.1.0"),
|
|
9
|
+
description: z.string().optional(),
|
|
10
|
+
modulePath: z.string().min(1),
|
|
11
|
+
exportName: z.string().optional(),
|
|
12
|
+
capabilities: z.record(z.string(), z.boolean()).optional(),
|
|
13
|
+
permissions: z.record(z.string(), z.enum(["allow", "deny", "ask"])).optional(),
|
|
14
|
+
});
|
|
15
|
+
const toCapabilities = (value) => {
|
|
16
|
+
if (!value)
|
|
17
|
+
return undefined;
|
|
18
|
+
return value;
|
|
19
|
+
};
|
|
20
|
+
const toPermissions = (value) => {
|
|
21
|
+
if (!value)
|
|
22
|
+
return undefined;
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
25
|
+
const resolveModuleFactory = (moduleNamespace, exportName) => {
|
|
26
|
+
const candidates = exportName
|
|
27
|
+
? [exportName]
|
|
28
|
+
: ["createAgentRuntime", "default", "createRuntime"];
|
|
29
|
+
for (const candidate of candidates) {
|
|
30
|
+
const resolved = moduleNamespace[candidate];
|
|
31
|
+
if (typeof resolved === "function") {
|
|
32
|
+
return resolved;
|
|
33
|
+
}
|
|
34
|
+
const defaultNamespace = moduleNamespace.default;
|
|
35
|
+
if (defaultNamespace && typeof defaultNamespace === "object") {
|
|
36
|
+
const nested = defaultNamespace[candidate];
|
|
37
|
+
if (typeof nested === "function") {
|
|
38
|
+
return nested;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
throw new Error(`External agent module is missing a runtime factory export. Checked: ${candidates.join(", ")}`);
|
|
43
|
+
};
|
|
44
|
+
export class ExternalAgentLifecycleManager {
|
|
45
|
+
manifestPath;
|
|
46
|
+
manifestCache = null;
|
|
47
|
+
moduleCache = null;
|
|
48
|
+
lastHealthStatus = null;
|
|
49
|
+
constructor(manifestPath) {
|
|
50
|
+
this.manifestPath = manifestPath;
|
|
51
|
+
}
|
|
52
|
+
async loadManifest() {
|
|
53
|
+
if (this.manifestCache) {
|
|
54
|
+
return this.manifestCache;
|
|
55
|
+
}
|
|
56
|
+
const raw = await fs.readFile(this.manifestPath, "utf8");
|
|
57
|
+
const parsed = manifestSchema.parse(JSON.parse(raw));
|
|
58
|
+
this.manifestCache = parsed;
|
|
59
|
+
return parsed;
|
|
60
|
+
}
|
|
61
|
+
async loadModule() {
|
|
62
|
+
if (this.moduleCache) {
|
|
63
|
+
return this.moduleCache;
|
|
64
|
+
}
|
|
65
|
+
const manifest = await this.loadManifest();
|
|
66
|
+
const baseDir = path.dirname(this.manifestPath);
|
|
67
|
+
const modulePath = path.isAbsolute(manifest.modulePath)
|
|
68
|
+
? manifest.modulePath
|
|
69
|
+
: path.resolve(baseDir, manifest.modulePath);
|
|
70
|
+
const moduleUrl = pathToFileURL(modulePath).href;
|
|
71
|
+
const loaded = (await import(moduleUrl));
|
|
72
|
+
this.moduleCache = loaded;
|
|
73
|
+
return loaded;
|
|
74
|
+
}
|
|
75
|
+
async healthCheck() {
|
|
76
|
+
try {
|
|
77
|
+
const manifest = await this.loadManifest();
|
|
78
|
+
const moduleNamespace = await this.loadModule();
|
|
79
|
+
resolveModuleFactory(moduleNamespace, manifest.exportName);
|
|
80
|
+
this.lastHealthStatus = { ok: true, checkedAt: Date.now() };
|
|
81
|
+
return { ok: true };
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
const err = error;
|
|
85
|
+
const reason = err.message || "Unknown external agent health-check failure";
|
|
86
|
+
this.lastHealthStatus = { ok: false, checkedAt: Date.now(), reason };
|
|
87
|
+
return { ok: false, reason };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
getLastHealthStatus() {
|
|
91
|
+
return this.lastHealthStatus;
|
|
92
|
+
}
|
|
93
|
+
async createRegistration(context) {
|
|
94
|
+
const health = await this.healthCheck();
|
|
95
|
+
if (!health.ok) {
|
|
96
|
+
const reason = "reason" in health ? health.reason : "unknown";
|
|
97
|
+
throw new Error(`External agent failed health check: ${reason}`);
|
|
98
|
+
}
|
|
99
|
+
const manifest = await this.loadManifest();
|
|
100
|
+
const moduleNamespace = await this.loadModule();
|
|
101
|
+
const factory = resolveModuleFactory(moduleNamespace, manifest.exportName);
|
|
102
|
+
const descriptor = {
|
|
103
|
+
id: manifest.id,
|
|
104
|
+
name: manifest.name,
|
|
105
|
+
version: manifest.version,
|
|
106
|
+
source: "external",
|
|
107
|
+
description: manifest.description,
|
|
108
|
+
capabilities: toCapabilities(manifest.capabilities),
|
|
109
|
+
permissions: toPermissions(manifest.permissions),
|
|
110
|
+
tags: ["manifest", "external", "health-checked"],
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
descriptor,
|
|
114
|
+
runtimeFactory: () => Promise.resolve(factory(context)),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { AgentRuntime, AgentRuntimeFactory, AgentSessionContext, AgentTurnRequest, AgentTurnResult, AgentTurnStreamResult } from "./AgentContract.js";
|
|
2
|
+
export type HostPermissionRequestKind = "shell" | "read" | "write" | "mcp" | "custom-tool" | "factory" | "hook";
|
|
3
|
+
export type HostPermissionRequest = {
|
|
4
|
+
kind: HostPermissionRequestKind;
|
|
5
|
+
intention?: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
command?: string;
|
|
8
|
+
toolName?: string;
|
|
9
|
+
args?: Record<string, unknown>;
|
|
10
|
+
managedApprovalRequired?: boolean;
|
|
11
|
+
toolCallId?: string;
|
|
12
|
+
};
|
|
13
|
+
export type HostPermissionRequestResult = {
|
|
14
|
+
kind: "approve-once";
|
|
15
|
+
} | {
|
|
16
|
+
kind: "reject";
|
|
17
|
+
feedback?: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "ask";
|
|
20
|
+
feedback?: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "user-not-available";
|
|
23
|
+
} | {
|
|
24
|
+
kind: "no-result";
|
|
25
|
+
};
|
|
26
|
+
export type HostPermissionHandler = (request: HostPermissionRequest, invocation: {
|
|
27
|
+
sessionId: string;
|
|
28
|
+
}) => Promise<HostPermissionRequestResult> | HostPermissionRequestResult;
|
|
29
|
+
export type HostSessionHooks = {
|
|
30
|
+
onSessionStart?: (input: {
|
|
31
|
+
context: AgentSessionContext;
|
|
32
|
+
}, invocation: {
|
|
33
|
+
sessionId: string;
|
|
34
|
+
}) => Promise<void> | void;
|
|
35
|
+
onPreTurn?: (input: {
|
|
36
|
+
request: AgentTurnRequest;
|
|
37
|
+
}, invocation: {
|
|
38
|
+
sessionId: string;
|
|
39
|
+
}) => Promise<void> | void;
|
|
40
|
+
onPostTurn?: (input: {
|
|
41
|
+
request: AgentTurnRequest;
|
|
42
|
+
result: AgentTurnResult;
|
|
43
|
+
}, invocation: {
|
|
44
|
+
sessionId: string;
|
|
45
|
+
}) => Promise<void> | void;
|
|
46
|
+
onPreToolUse?: (input: {
|
|
47
|
+
toolName: string;
|
|
48
|
+
toolCallId?: string;
|
|
49
|
+
toolArgs?: Record<string, unknown>;
|
|
50
|
+
turnRequest: AgentTurnRequest;
|
|
51
|
+
}, invocation: {
|
|
52
|
+
sessionId: string;
|
|
53
|
+
}) => Promise<{
|
|
54
|
+
permissionDecision?: "allow" | "deny" | "ask";
|
|
55
|
+
} | null | void> | {
|
|
56
|
+
permissionDecision?: "allow" | "deny" | "ask";
|
|
57
|
+
} | null | void;
|
|
58
|
+
onPostToolUse?: (input: {
|
|
59
|
+
toolName: string;
|
|
60
|
+
toolCallId?: string;
|
|
61
|
+
toolResult?: unknown;
|
|
62
|
+
turnResult: AgentTurnResult;
|
|
63
|
+
}, invocation: {
|
|
64
|
+
sessionId: string;
|
|
65
|
+
}) => Promise<void> | void;
|
|
66
|
+
onSessionEnd?: (input: {
|
|
67
|
+
sessionId: string;
|
|
68
|
+
}, invocation: {
|
|
69
|
+
sessionId: string;
|
|
70
|
+
}) => Promise<void> | void;
|
|
71
|
+
};
|
|
72
|
+
export type HostSessionConfig = {
|
|
73
|
+
sessionId?: string;
|
|
74
|
+
modelId?: string;
|
|
75
|
+
metadata?: Record<string, unknown>;
|
|
76
|
+
onPermissionRequest?: HostPermissionHandler;
|
|
77
|
+
hooks?: HostSessionHooks;
|
|
78
|
+
};
|
|
79
|
+
export type HostSessionPromptRequest = {
|
|
80
|
+
prompt: string;
|
|
81
|
+
conversation?: AgentTurnRequest["conversation"];
|
|
82
|
+
metadata?: Record<string, unknown>;
|
|
83
|
+
permissionRequest?: HostPermissionRequest;
|
|
84
|
+
};
|
|
85
|
+
export type HostSessionHandle = {
|
|
86
|
+
sessionId: string;
|
|
87
|
+
sendAndWait: (request: HostSessionPromptRequest) => Promise<AgentTurnResult>;
|
|
88
|
+
sendStream: (request: HostSessionPromptRequest) => Promise<AgentTurnStreamResult>;
|
|
89
|
+
cancel: () => Promise<void>;
|
|
90
|
+
disconnect: () => Promise<void>;
|
|
91
|
+
};
|
|
92
|
+
export declare class HostSessionManager<TRuntime extends AgentRuntime> {
|
|
93
|
+
private readonly runtimeFactory;
|
|
94
|
+
private readonly baseContext;
|
|
95
|
+
private readonly sessions;
|
|
96
|
+
private readonly pendingSessions;
|
|
97
|
+
private stopping;
|
|
98
|
+
constructor(runtimeFactory: AgentRuntimeFactory<TRuntime>, baseContext: Omit<AgentSessionContext, "sessionId">);
|
|
99
|
+
createSession(config?: HostSessionConfig): Promise<HostSessionHandle>;
|
|
100
|
+
resumeSession(sessionId: string, config?: Omit<HostSessionConfig, "sessionId">): Promise<HostSessionHandle>;
|
|
101
|
+
private openSession;
|
|
102
|
+
private startSession;
|
|
103
|
+
private toHandle;
|
|
104
|
+
private getManagedSession;
|
|
105
|
+
private enforcePermission;
|
|
106
|
+
sendAndWait(sessionId: string, request: HostSessionPromptRequest): Promise<AgentTurnResult>;
|
|
107
|
+
sendStream(sessionId: string, request: HostSessionPromptRequest): Promise<AgentTurnStreamResult>;
|
|
108
|
+
disconnectSession(sessionId: string): Promise<void>;
|
|
109
|
+
cancelSession(sessionId: string): Promise<void>;
|
|
110
|
+
stopAll(): Promise<void>;
|
|
111
|
+
}
|